LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
PMAlgCosmicTagger.h
Go to the documentation of this file.
1 // Class: PMAlgCosmicTagger
3 // Author: L. Whitehead (leigh.howard.whitehead@cern.ch),
4 // R. Sulej (robert.sulej@cern.ch) March 2017
6 
7 #ifndef PMAlgCosmicTagger_h
8 #define PMAlgCosmicTagger_h
9 
10 #include <map>
11 
12 #include "fhiclcpp/types/Atom.h"
13 // #include "fhiclcpp/types/Sequence.h"
14 
17 
18 #include "TVector3.h"
19 
20 namespace pma
21 {
22  class PMAlgCosmicTagger;
23 }
24 
26 {
27 
28 public:
29 
30  struct Config {
31  using Name = fhicl::Name;
33 
35  Name("TagOutOfDriftTracks"),
36  Comment("Tag tracks sticking out of 1 drift window.")
37  };
39  Name("OutOfDriftMargin"),
40  Comment("The minimum distance beyond 1 drift window required for tagging track as a cosmic background.")
41  };
42 
44  Name("TagFullHeightTracks"),
45  Comment("Tag tracks crossing full detector height")
46  };
48  Name("TagFullWidthTracks"),
49  Comment("Tag tracks crossing full detector width")
50  };
52  Name("TagFullLengthTracks"),
53  Comment("Tag tracks crossing full detector length")
54  };
56  Name("FullCrossingMargin"),
57  Comment("The maximum distance between the track length and detector length for full detector crossing tracks.")
58  };
60  Name("TagNonBeamT0Tracks"),
61  Comment("Tag particles with reconstructed T0 not consistent with the beam")
62  };
64  Name("NonBeamT0Margin"),
65  Comment("Tag only those events at least <margin> from the beam time")
66  };
68  Name("TagTopFrontBack"),
69  Comment("Tag tracks that enter through the top of the detector and exit through the front or back")
70  };
72  Name("TopFrontBackMargin"),
73  Comment("Distance tolerence from the top, front and back of the detector")
74  };
76  Name("TagApparentStopper"),
77  Comment("Tag tracks that enter through the top of the detector appear to stop (without seeing evidence of stopping)")
78  };
80  Name("ApparentStopperMargin"),
81  Comment("Distance tolerence from the top of the detector to be considered coming in from the top")
82  };
84  Name("VetoActualStopper"),
85  Comment("If true: use de/dx information to identify stopping muons but do not tag them")
86  };
88  Name("StopperBuffer"),
89  Comment("Should find no tracks starting within this distance from the end point of the track")
90  };
91  };
92 
96 
101 
109  fStopperBuffer(config.StopperBuffer())
110  { }
111 
114 
115  void tag(pma::TrkCandidateColl& tracks);
116 
117 private:
118 
119  size_t outOfDriftWindow(pma::TrkCandidateColl& tracks);
123  size_t fullCrossingTagger(pma::TrkCandidateColl& tracks, int direction);
124  size_t nonBeamT0Tag(pma::TrkCandidateColl& tracks);
125  size_t tagTopFrontBack(pma::TrkCandidateColl& tracks);
127 
128  // Convenience functions to see if we have a vertex at the top of the detector
129  bool isTopVertex(const TVector3 &pos, double tolerance, short int dirIndx) const;
130  // or at the front / back walls
131  bool isFrontBackVertex(const TVector3 &pos, double tolerance, short int dirIndx) const;
132 
133  void GetDimensions(); // Use the geometry to get the extent of the detector in x, y and z.
134  short int ConvertDirToInt(const TVector3 &dir) const; // Is the direction along x, y or z?
135  // Tagging parameters
136  bool fTagOutOfDriftTracks; // Tag tracks sticking out of 1 drift window.
137  double fOutOfDriftMargin; // Min distance [cm] beyond 1 drift window required for tagging track as a cosmic background.
138 
139  bool fTagFullHeightTracks; // Tag tracks crossing full height
140  bool fTagFullWidthTracks; // Tag tracks crossing full heightwidth
141  bool fTagFullLengthTracks; // Tag tracks crossing full heightlength
142  double fFullCrossingMargin; // Max distance [cm] between track dimension and detector dimension for crossing tracks.
143 
144  bool fTagNonBeamT0Tracks; // Tag tracks that have a reconstructed T0 outside of the beam range.
145  double fNonBeamT0Margin; // Range outside which we should consider events not beam related.
146 
149 
153  double fStopperBuffer; // A distance from the end of the track within which we should find no other track starting.
154  // Helps to prevent identifying broken tracks or interacting particles as stoppers.
155 
156  // The dimensions of the detector from the geometry
157  std::vector<double> fDimensionsMin;
158  std::vector<double> fDimensionsMax;
159 };
160 
161 #endif
162 
void tag(pma::TrkCandidateColl &tracks)
fhicl::Atom< bool > TagFullHeightTracks
fhicl::Atom< bool > TagNonBeamT0Tracks
size_t tagApparentStopper(pma::TrkCandidateColl &tracks)
fhicl::Atom< double > TopFrontBackMargin
size_t nonBeamT0Tag(pma::TrkCandidateColl &tracks)
fhicl::Atom< double > NonBeamT0Margin
std::vector< double > fDimensionsMin
size_t fullHeightCrossing(pma::TrkCandidateColl &tracks)
PMAlgCosmicTagger(const pma::PMAlgCosmicTagger::Config &config)
fhicl::Atom< bool > TagTopFrontBack
bool isFrontBackVertex(const TVector3 &pos, double tolerance, short int dirIndx) const
size_t outOfDriftWindow(pma::TrkCandidateColl &tracks)
fhicl::Atom< bool > TagOutOfDriftTracks
fhicl::Atom< bool > TagApparentStopper
size_t tagTopFrontBack(pma::TrkCandidateColl &tracks)
short int ConvertDirToInt(const TVector3 &dir) const
std::vector< double > fDimensionsMax
fhicl::Atom< double > FullCrossingMargin
Definition of data types for geometry description.
fhicl::Atom< double > OutOfDriftMargin
Track finding helper for the Projection Matching Algorithm.
fhicl::Atom< double > ApparentStopperMargin
fhicl::Atom< bool > TagFullWidthTracks
TDirectory * dir
Definition: macro.C:5
fhicl::Atom< double > StopperBuffer
size_t fullWidthCrossing(pma::TrkCandidateColl &tracks)
bool isTopVertex(const TVector3 &pos, double tolerance, short int dirIndx) const
fhicl::Atom< bool > VetoActualStopper
fhicl::Atom< bool > TagFullLengthTracks
size_t fullCrossingTagger(pma::TrkCandidateColl &tracks, int direction)
size_t fullLengthCrossing(pma::TrkCandidateColl &tracks)