All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sbndcode/sbndcode/CosmicId/Algs/CosmicIdAlg.h
Go to the documentation of this file.
1 #ifndef COSMICIDALG_H_SEEN
2 #define COSMICIDALG_H_SEEN
3 
4 
5 ///////////////////////////////////////////////
6 // CosmicIdAlg.h
7 //
8 // Functions for fiducial volume cosmic tagger
9 // T Brooks (tbrooks@fnal.gov), November 2018
10 ///////////////////////////////////////////////
11 
22 
23 // framework
24 #include "art/Framework/Principal/Event.h"
25 #include "fhiclcpp/ParameterSet.h"
26 #include "fhiclcpp/types/Table.h"
27 #include "fhiclcpp/types/Atom.h"
28 #include "art/Framework/Principal/Handle.h"
29 #include "canvas/Persistency/Common/Ptr.h"
30 
31 // LArSoft
37 
38 // c++
39 #include <vector>
40 #include <utility>
41 
42 
43 namespace sbnd{
44 
45  class CosmicIdAlg {
46  public:
47 
48  struct BeamTime {
49  using Name = fhicl::Name;
50  using Comment = fhicl::Comment;
51 
52  fhicl::Atom<double> BeamTimeMin {
53  Name("BeamTimeMin"),
54  Comment("")
55  };
56 
57  fhicl::Atom<double> BeamTimeMax {
58  Name("BeamTimeMax"),
59  Comment("")
60  };
61 
62  };
63 
64  struct Config {
65  using Name = fhicl::Name;
66  using Comment = fhicl::Comment;
67 
68  fhicl::Atom<art::InputTag> CrtHitModuleLabel {
69  Name("CrtHitModuleLabel"),
70  Comment("tag of CRT hit producer data product")
71  };
72 
73  fhicl::Atom<art::InputTag> CrtTrackModuleLabel {
74  Name("CrtTrackModuleLabel"),
75  Comment("tag of CRT track producer data product")
76  };
77 
78  fhicl::Atom<art::InputTag> TpcTrackModuleLabel {
79  Name("TpcTrackModuleLabel"),
80  Comment("tag of TPC track producer data product")
81  };
82 
83  fhicl::Atom<art::InputTag> CaloModuleLabel {
84  Name("CaloModuleLabel"),
85  Comment("tag of calorimetry producer data product")
86  };
87 
88  fhicl::Atom<art::InputTag> PandoraLabel {
89  Name("PandoraLabel"),
90  Comment("tag of pandora data product")
91  };
92 
93  fhicl::Atom<bool> ApplyFiducialCut {
94  Name("ApplyFiducialCut"),
95  Comment("")
96  };
97 
98  fhicl::Atom<bool> ApplyStoppingCut {
99  Name("ApplyStoppingCut"),
100  Comment("")
101  };
102 
103  fhicl::Atom<bool> ApplyGeometryCut {
104  Name("ApplyGeometryCut"),
105  Comment("")
106  };
107 
108  fhicl::Atom<bool> ApplyCpaCrossCut {
109  Name("ApplyCpaCrossCut"),
110  Comment("")
111  };
112 
113  fhicl::Atom<bool> ApplyApaCrossCut {
114  Name("ApplyApaCrossCut"),
115  Comment("")
116  };
117 
118  fhicl::Atom<bool> ApplyCrtTrackCut {
119  Name("ApplyCrtTrackCut"),
120  Comment("")
121  };
122 
123  fhicl::Atom<bool> ApplyCrtHitCut {
124  Name("ApplyCrtHitCut"),
125  Comment("")
126  };
127 
128  fhicl::Atom<bool> ApplyPandoraT0Cut {
129  Name("ApplyPandoraT0Cut"),
130  Comment("")
131  };
132 
133  fhicl::Atom<bool> ApplyPandoraNuScoreCut {
134  Name("ApplyPandoraNuScoreCut"),
135  Comment("")
136  };
137 
138  fhicl::Atom<bool> UseTrackAngleVeto {
139  Name("UseTrackAngleVeto"),
140  Comment("")
141  };
142 
143  fhicl::Atom<double> MinSecondTrackLength {
144  Name("MinSecondTrackLength"),
145  Comment("")
146  };
147 
148  fhicl::Atom<double> MinVertexDistance {
149  Name("MinVertexDistance"),
150  Comment("")
151  };
152 
153  fhicl::Atom<double> MinMergeAngle {
154  Name("MinMergeAngle"),
155  Comment("")
156  };
157 
158  fhicl::Table<FiducialVolumeCosmicIdAlg::Config> FVTagAlg {
159  Name("FVTagAlg"),
160  };
161 
162  fhicl::Table<StoppingParticleCosmicIdAlg::Config> SPTagAlg {
163  Name("SPTagAlg"),
164  };
165 
166  fhicl::Table<CpaCrossCosmicIdAlg::Config> CCTagAlg {
167  Name("CCTagAlg"),
168  };
169 
170  fhicl::Table<ApaCrossCosmicIdAlg::Config> ACTagAlg {
171  Name("ACTagAlg"),
172  };
173 
174  fhicl::Table<CrtHitCosmicIdAlg::Config> CHTagAlg {
175  Name("CHTagAlg"),
176  };
177 
178  fhicl::Table<CrtTrackCosmicIdAlg::Config> CTTagAlg {
179  Name("CTTagAlg"),
180  };
181 
182  fhicl::Table<PandoraT0CosmicIdAlg::Config> PTTagAlg {
183  Name("PTTagAlg"),
184  };
185 
186  fhicl::Table<PandoraNuScoreCosmicIdAlg::Config> PNTagAlg {
187  Name("PNTagAlg"),
188  };
189 
190  fhicl::Table<BeamTime> BeamTimeLimits {
191  Name("BeamTimeLimits"),
192  Comment("")
193  };
194 
195  };
196 
197  CosmicIdAlg(const Config& config);
198 
199  CosmicIdAlg(const fhicl::ParameterSet& pset) :
200  CosmicIdAlg(fhicl::Table<Config>(pset, {})()) {}
201 
202  CosmicIdAlg();
203 
204  ~CosmicIdAlg();
205 
206  void reconfigure(const Config& config);
207 
208  // Change which cuts are run
209  void SetCuts(bool FV, bool SP, bool Geo, bool CC, bool AC, bool CT, bool CH, bool PT, bool PN);
210 
211  // Reset which cuts are run from fhicl parameters
212  void ResetCuts();
213 
214  // Run cuts to decide if track looks like a cosmic
215  bool CosmicId(recob::Track track, const art::Event& event, std::vector<double> t0Tpc0, std::vector<double> t0Tpc1);
216 
217  // Run cuts to decide if PFParticle looks like a cosmic
219  recob::PFParticle pfparticle, std::map< size_t, art::Ptr<recob::PFParticle> > pfParticleMap, const art::Event& event, std::vector<double> t0Tpc0, std::vector<double> t0Tpc1);
220 
221  // Getters for the underlying algorithms
225  ApaCrossCosmicIdAlg ApaAlg() const {return acTag;}
227 
228  private:
229 
230  double fBeamTimeMin;
231  double fBeamTimeMax;
232 
233  art::InputTag fTpcTrackModuleLabel;
234  art::InputTag fPandoraLabel;
235  art::InputTag fCrtHitModuleLabel;
236  art::InputTag fCrtTrackModuleLabel;
237  art::InputTag fCaloModuleLabel;
238 
248 
249  std::vector<bool> fOriginalSettings;
250 
255 
265 
266  };
267 
268 }
269 
270 #endif
fhicl::Table< CpaCrossCosmicIdAlg::Config > CCTagAlg
CosmicIdAlg(const fhicl::ParameterSet &pset)
StoppingParticleCosmicIdAlg StoppingAlg() const
Declaration of signal hit object.
fhicl::Table< PandoraT0CosmicIdAlg::Config > PTTagAlg
fhicl::Table< FiducialVolumeCosmicIdAlg::Config > FVTagAlg
bool CosmicId(recob::Track track, const art::Event &event, std::vector< double > t0Tpc0, std::vector< double > t0Tpc1)
process_name use argoneut_mc_hitfinder track
fhicl::Table< CrtTrackCosmicIdAlg::Config > CTTagAlg
fhicl::Table< CrtHitCosmicIdAlg::Config > CHTagAlg
BEGIN_PROLOG vertical distance to the surface Name
Provides recob::Track data product.
fhicl::Table< StoppingParticleCosmicIdAlg::Config > SPTagAlg
process_name showerreco Particles Coinciding wih the Vertex services ScanOptions nu_mu CC
fhicl::Table< ApaCrossCosmicIdAlg::Config > ACTagAlg
Hierarchical representation of particle flow.
Definition: PFParticle.h:44
fhicl::Table< PandoraNuScoreCosmicIdAlg::Config > PNTagAlg
stream1 can override from command line with o or output services user sbnd
PandoraNuScoreCosmicIdAlg PandoraNuScoreAlg() const
auto const detProp
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a &quot;fitted&quot; track:
void SetCuts(bool FV, bool SP, bool Geo, bool CC, bool AC, bool CT, bool CH, bool PT, bool PN)