ElectronNeutrinoSelection
 All Classes Functions Variables Groups
ElectronEventSelectionAlg.h
1 
22 #ifndef ELECTRON_EVENT_SELECTION_ALG_H
23 #define ELECTRON_EVENT_SELECTION_ALG_H
24 
25 #include "art/Framework/Principal/Event.h"
26 #include "art/Framework/Principal/Handle.h"
27 // #include "art/Framework/Principal/Run.h"
28 // #include "art/Framework/Principal/SubRun.h"
29 #include "art/Framework/Services/Registry/ServiceHandle.h"
30 #include "art/Framework/Services/Registry/ServiceHandle.h"
31 
32 #include "canvas/Persistency/Common/FindOneP.h"
33 #include "canvas/Persistency/Common/FindManyP.h"
34 #include "canvas/Utilities/InputTag.h"
35 
36 #include "lardataobj/RecoBase/PFParticle.h"
37 #include "lardataobj/RecoBase/Vertex.h"
38 #include "lardataobj/RecoBase/Track.h"
39 #include "lardataobj/RecoBase/Shower.h"
40 #include "lardataobj/RecoBase/SpacePoint.h"
41 // #include "lardataobj/RecoBase/Cluster.h"
42 #include "lardataobj/RecoBase/Hit.h"
43 #include "lardataobj/RecoBase/OpFlash.h"
44 
45 //#include "uboone/SpaceChargeServices/SpaceChargeServiceMicroBooNE.h"
46 #include "larevt/SpaceChargeServices/SpaceChargeService.h"
47 
48 #include "fhiclcpp/ParameterSet.h"
49 #include "larcore/Geometry/Geometry.h"
50 #include "uboone/LLSelectionTool/OpT0Finder/Base/OpT0FinderTypes.h"
51 #include "uboone/LLSelectionTool/OpT0Finder/Algorithms/LightCharge.h"
52 #include "uboone/LLSelectionTool/OpT0Finder/Algorithms/PhotonLibHypothesis.h"
53 #include "uboone/LLSelectionTool/OpT0Finder/Base/FlashMatchManager.h"
54 
55 #include "GeometryHelper.h"
56 #include "PandoraInterfaceHelper.h"
57 
58 
59 namespace lee {
60 
62  {
63  public:
64  // ElectronEventSelectionAlg(){}
65  // ~ElectronEventSelectionAlg(){}
66 
74  bool eventSelected(const art::Event & evt);
75 
76 
82  void reconfigure(fhicl::ParameterSet const & p) ;
83 
91  const std::map<size_t, int > opticalfilter(const art::Event & evt,
92  const std::vector<size_t> &pfplist,
93  const art::ValidHandle<std::vector<recob::PFParticle>> pfparticle_handle);
94 
103  const std::map<size_t, int > flashBasedSelection(const art::Event & evt,
104  const std::vector<size_t> &pfplist,
105  const art::ValidHandle<std::vector<recob::PFParticle>> pfparticle_handle);
106 
115  const flashana::QCluster_t collect3DHits(const art::Event &evt,
116  const std::vector<size_t> &pfplist);
117 
124  TVector3 spaceChargeTrueToReco(const TVector3 & xyz);
125 
129  void clear();
130 
134  const std::vector<size_t> & get_primary_indexes() const {return _primary_indexes;}
135 
139  const size_t & get_n_neutrino_candidates() const {return _n_neutrino_candidates;}
140 
145  const std::map<size_t, bool> & get_neutrino_candidate_passed() const {return _neutrino_candidate_passed;}
146 
150  const std::map<size_t, int > & get_op_flash_indexes() const {return _op_flash_indexes;}
151 
155  const std::map<size_t, TVector3> & get_neutrino_vertex() const {return _neutrino_vertex;}
156 
160  const std::map<size_t, int> & get_n_showers() const {return _n_showers;}
161 
165  const std::map<size_t, int> &get_n_showers_as_tracks() const { return _n_showers_as_tracks; }
166 
170  const std::map<size_t, int> & get_n_tracks() const {return _n_tracks;}
171 
175  const std::map<size_t, std::vector<size_t> > &
176  get_pfp_id_showers_from_primary() const {return _pfp_id_showers_from_primary;}
177 
178 
182  const std::map<size_t, std::vector<size_t> > &
183  get_pfp_id_tracks_from_primary() const {return _pfp_id_tracks_from_primary;}
184 
188  const std::map<size_t, std::vector<size_t>> &
189  get_pfp_id_showers_as_tracks_from_primary() const { return _pfp_id_showers_as_tracks_from_primary; }
190 
194  const std::vector<double> &
195  get_flash_PE() const {return _flash_PE;}
196 
200  const std::vector<double> &
201  get_flash_time() const {return _flash_time;}
202 
206  const double & get_flash_x() const {return _flash_x;}
207 
211  const double & get_TPC_x() const {return _TPC_x;}
212 
216  const int & get_selection_result() const { return _selection_result; }
217 
218  private:
219 
220  // Variables that are used to determine the selection and might be worth passing
221  // to an analyzer module:
222 
223 
224  size_t _n_neutrino_candidates;
225  std::vector<size_t> _primary_indexes;
226  std::map<size_t, bool> _neutrino_candidate_passed;
227  std::map<size_t, int > _op_flash_indexes;
228  std::map<size_t, TVector3> _neutrino_vertex;
229  std::map<size_t, int> _n_showers;
230  std::map<size_t, std::vector < size_t > > _pfp_id_showers_from_primary;
231  std::map<size_t, int> _n_tracks;
232  std::map<size_t, std::vector < size_t > > _pfp_id_tracks_from_primary;
233  std::map<size_t, int> _n_showers_as_tracks;
234  std::map<size_t, std::vector < size_t > > _pfp_id_showers_as_tracks_from_primary;
235  std::vector<double> _flash_PE;
236  std::vector<double> _flash_time;
237 
238  double _TPC_x;
239  double _flash_x;
240  int _selection_result;
241  int kPassed = 0;
242  int kNoNeutrino = 1;
243  int kNoShowers = 2;
244  int kNoTracks = 3;
245  int kNoValidFlash = 4;
246  int kNoDataProducts = 5;
247  // Configurable variables from the fcl file:
248  int m_nTracks;
249  bool m_printDebug;
250  double m_fidvolXstart;
251  double m_fidvolXend;
252 
253  double m_fidvolYstart;
254  double m_fidvolYend;
255 
256  double m_fidvolZstart;
257  double m_fidvolZend;
258 
259  double m_fractionsigmaflashwidth;
260  double m_absoluteflashdist;
261 
262  double m_startbeamtime;
263  double m_endbeamtime;
264  double m_PE_threshold;
265 
266  // Prematching cuts
267  double m_cut_zwidth;
268  double m_cut_sigzwidth;
269  double m_cut_ywidth;
270  double m_cut_sigywidth;
271  double m_charge_light_ratio;
272 
273  bool m_flashmatching;
274  bool m_FM_all;
275  double m_isCosmicInTime;
276  bool m_showersAsTracks;
278  std::vector<int> _opdet_swap_map;
279 
280  // std::map<unsigned short, double> m_ly_map;
281 
282  std::string m_pfp_producer;
283 
284  std::string fOpticalFlashFinderLabel;
285 
286  // Helper class for geometry functions:
287  GeometryHelper geoHelper;
288 
289  // Helper class for dealing with pandora heirarchy:
290  PandoraInterfaceHelper pandoraHelper;
291 
292  flashana::FlashMatchManager m_mgr;
293  art::ServiceHandle<geo::Geometry> m_geo;
294  };
295 
296 } // lee
297 
298 #endif // ELECTRON_EVENT_SELECTION_ALG_H
void clear()
Reset internal variables.
Definition: ElectronEventSelectionAlg.cxx:9
const double & get_TPC_x() const
Return the position in x of the center of the collected charge.
Definition: ElectronEventSelectionAlg.h:211
bool eventSelected(const art::Event &evt)
Main Event Selection Function.
Definition: ElectronEventSelectionAlg.cxx:382
const std::map< size_t, TVector3 > & get_neutrino_vertex() const
Return the pandora calculated vertex indexed by pfparticle id number.
Definition: ElectronEventSelectionAlg.h:155
Definition: PandoraInterfaceHelper.h:55
const std::map< size_t, int > & get_n_showers() const
Return number of showers for this pfparticle.
Definition: ElectronEventSelectionAlg.h:160
Definition: ElectronEventSelectionAlg.h:61
TVector3 spaceChargeTrueToReco(const TVector3 &xyz)
Return the true coordinates corrected by the space-charge effect.
Definition: ElectronEventSelectionAlg.cxx:30
const std::map< size_t, std::vector< size_t > > & get_pfp_id_showers_as_tracks_from_primary() const
Return the list of pfparticle indexes that are tracks that are associated with primary pfparticle ind...
Definition: ElectronEventSelectionAlg.h:189
const double & get_flash_x() const
Return the position in x of the flash.
Definition: ElectronEventSelectionAlg.h:206
const int & get_selection_result() const
Return the selection failure mode.
Definition: ElectronEventSelectionAlg.h:216
void reconfigure(fhicl::ParameterSet const &p)
Configure all of the parameters of this class.
Definition: ElectronEventSelectionAlg.cxx:58
const std::vector< double > & get_flash_time() const
Return the list of times of the flashes.
Definition: ElectronEventSelectionAlg.h:201
const size_t & get_n_neutrino_candidates() const
Return the number of neutrino candidates.
Definition: ElectronEventSelectionAlg.h:139
const std::map< size_t, int > & get_n_showers_as_tracks() const
Return number of showers for this pfparticle, reconstructed as tracks;.
Definition: ElectronEventSelectionAlg.h:165
const std::map< size_t, std::vector< size_t > > & get_pfp_id_showers_from_primary() const
Return the list of pfparticle indexes that are showers that are associated with primary pfparticle in...
Definition: ElectronEventSelectionAlg.h:176
const std::map< size_t, int > flashBasedSelection(const art::Event &evt, const std::vector< size_t > &pfplist, const art::ValidHandle< std::vector< recob::PFParticle >> pfparticle_handle)
Checks if there is a flash within the flash_window_start - flash_window_end window with enough PE...
Definition: ElectronEventSelectionAlg.cxx:100
const std::map< size_t, int > & get_op_flash_indexes() const
Return the index of the flash matched with the pfparticle.
Definition: ElectronEventSelectionAlg.h:150
const std::vector< double > & get_flash_PE() const
Return the list of total PE of the flashes.
Definition: ElectronEventSelectionAlg.h:195
bool _do_opdet_swap
If true swaps reconstructed OpDets according to _opdet_swap_map.
Definition: ElectronEventSelectionAlg.h:277
const std::map< size_t, int > & get_n_tracks() const
Return number of tracks for pfparticle index.
Definition: ElectronEventSelectionAlg.h:170
const std::map< size_t, int > opticalfilter(const art::Event &evt, const std::vector< size_t > &pfplist, const art::ValidHandle< std::vector< recob::PFParticle >> pfparticle_handle)
Checks if there is a flash within the 3.2-4.8 ms window and compatible with the center of charge...
Definition: ElectronEventSelectionAlg.cxx:338
const std::vector< size_t > & get_primary_indexes() const
Return a list of the selected pfparticle top level neutrino candidate indexes.
Definition: ElectronEventSelectionAlg.h:134
const std::map< size_t, bool > & get_neutrino_candidate_passed() const
Inform whether a particular candidate passed or failed the algorithm.
Definition: ElectronEventSelectionAlg.h:145
Definition: GeometryHelper.h:40
const flashana::QCluster_t collect3DHits(const art::Event &evt, const std::vector< size_t > &pfplist)
Creates a photon cluster for a neutrino pfp hierarchy PFParticle.
Definition: ElectronEventSelectionAlg.cxx:288
const std::map< size_t, std::vector< size_t > > & get_pfp_id_tracks_from_primary() const
Return the list of pfparticle indexes that are tracks that are associated with primary pfparticle ind...
Definition: ElectronEventSelectionAlg.h:183
std::vector< int > _opdet_swap_map
The OpDet swap map for reco flashes.
Definition: ElectronEventSelectionAlg.h:278