All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PMAlgCosmicTagger.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Class: PMAlgCosmicTagger
3 // Author: L. Whitehead (leigh.howard.whitehead@cern.ch),
4 // R. Sulej (robert.sulej@cern.ch) March 2017
5 ////////////////////////////////////////////////////////////////////////////////////////////////////
6 
7 #ifndef PMAlgCosmicTagger_h
8 #define PMAlgCosmicTagger_h
9 
10 #include "fhiclcpp/types/Atom.h"
11 #include "fhiclcpp/types/Comment.h"
12 #include "fhiclcpp/types/Name.h"
13 
14 class TVector3;
15 
16 namespace detinfo {
17  class DetectorClocksData;
18 }
19 
20 namespace pma {
21  class PMAlgCosmicTagger;
22  class TrkCandidateColl;
23 }
24 
25 #include <vector>
26 
28 
29 public:
30  struct Config {
31  using Name = fhicl::Name;
32  using Comment = fhicl::Comment;
33 
34  fhicl::Atom<bool> TagOutOfDriftTracks{Name("TagOutOfDriftTracks"),
35  Comment("Tag tracks sticking out of 1 drift window.")};
36  fhicl::Atom<double> OutOfDriftMargin{
37  Name("OutOfDriftMargin"),
38  Comment("The minimum distance beyond 1 drift window required for tagging track as a cosmic "
39  "background.")};
40 
41  fhicl::Atom<bool> TagFullHeightTracks{Name("TagFullHeightTracks"),
42  Comment("Tag tracks crossing full detector height")};
43  fhicl::Atom<bool> TagFullWidthTracks{Name("TagFullWidthTracks"),
44  Comment("Tag tracks crossing full detector width")};
45  fhicl::Atom<bool> TagFullLengthTracks{Name("TagFullLengthTracks"),
46  Comment("Tag tracks crossing full detector length")};
47  fhicl::Atom<double> FullCrossingMargin{
48  Name("FullCrossingMargin"),
49  Comment("The maximum distance between the track length and detector length for full detector "
50  "crossing tracks.")};
51  fhicl::Atom<bool> TagNonBeamT0Tracks{
52  Name("TagNonBeamT0Tracks"),
53  Comment("Tag particles with reconstructed T0 not consistent with the beam")};
54  fhicl::Atom<double> NonBeamT0Margin{
55  Name("NonBeamT0Margin"),
56  Comment("Tag only those events at least <margin> from the beam time")};
57  fhicl::Atom<bool> TagTopFrontBack{Name("TagTopFrontBack"),
58  Comment("Tag tracks that enter through the top of the "
59  "detector and exit through the front or back")};
60  fhicl::Atom<double> TopFrontBackMargin{
61  Name("TopFrontBackMargin"),
62  Comment("Distance tolerence from the top, front and back of the detector")};
63  fhicl::Atom<bool> TagApparentStopper{
64  Name("TagApparentStopper"),
65  Comment("Tag tracks that enter through the top of the detector appear to stop (without "
66  "seeing evidence of stopping)")};
67  fhicl::Atom<double> ApparentStopperMargin{
68  Name("ApparentStopperMargin"),
69  Comment(
70  "Distance tolerence from the top of the detector to be considered coming in from the top")};
71  fhicl::Atom<bool> VetoActualStopper{
72  Name("VetoActualStopper"),
73  Comment("If true: use de/dx information to identify stopping muons but do not tag them")};
74  fhicl::Atom<double> StopperBuffer{
75  Name("StopperBuffer"),
76  Comment(
77  "Should find no tracks starting within this distance from the end point of the track")};
78  };
79 
81  : fTagOutOfDriftTracks(config.TagOutOfDriftTracks())
82  , fOutOfDriftMargin(config.OutOfDriftMargin())
83  ,
84 
85  fTagFullHeightTracks(config.TagFullHeightTracks())
86  , fTagFullWidthTracks(config.TagFullWidthTracks())
87  , fTagFullLengthTracks(config.TagFullLengthTracks())
88  , fFullCrossingMargin(config.FullCrossingMargin())
89  ,
90 
91  fTagNonBeamT0Tracks(config.TagNonBeamT0Tracks())
92  , fNonBeamT0Margin(config.NonBeamT0Margin())
93  , fTagTopFrontBack(config.TagTopFrontBack())
94  , fTopFrontBackMargin(config.TopFrontBackMargin())
95  , fTagApparentStopper(config.TagApparentStopper())
96  , fApparentStopperMargin(config.ApparentStopperMargin())
97  , fVetoActualStopper(config.VetoActualStopper())
98  , fStopperBuffer(config.StopperBuffer())
99  {}
100 
101  bool
102  tagAny() const
103  {
106  }
107 
109 
110 private:
115  size_t fullCrossingTagger(pma::TrkCandidateColl& tracks, int direction) const;
116  size_t nonBeamT0Tag(detinfo::DetectorClocksData const& clockData,
120 
121  // Convenience functions to see if we have a vertex at the top of the detector
122  bool isTopVertex(const TVector3& pos, double tolerance, short int dirIndx) const;
123  // or at the front / back walls
124  bool isFrontBackVertex(const TVector3& pos, double tolerance, short int dirIndx) const;
125 
126  void GetDimensions(); // Use the geometry to get the extent of the detector in x, y and z.
127  short int ConvertDirToInt(const TVector3& dir) const; // Is the direction along x, y or z?
128  // Tagging parameters
129  bool fTagOutOfDriftTracks; // Tag tracks sticking out of 1 drift window.
130  double fOutOfDriftMargin; // Min distance [cm] beyond 1 drift window required
131  // for tagging track as a cosmic background.
132 
133  bool fTagFullHeightTracks; // Tag tracks crossing full height
134  bool fTagFullWidthTracks; // Tag tracks crossing full heightwidth
135  bool fTagFullLengthTracks; // Tag tracks crossing full heightlength
136  double fFullCrossingMargin; // Max distance [cm] between track dimension and
137  // detector dimension for crossing tracks.
138 
139  bool fTagNonBeamT0Tracks; // Tag tracks that have a reconstructed T0 outside of the beam range.
140  double fNonBeamT0Margin; // Range outside which we should consider events not beam related.
141 
144 
148  double fStopperBuffer; // A distance from the end of the track within which we
149  // should find no other track starting. Helps to
150  // prevent identifying broken tracks or interacting
151  // particles as stoppers.
152 
153  // The dimensions of the detector from the geometry
154  std::vector<double> fDimensionsMin;
155  std::vector<double> fDimensionsMax;
156 };
157 
158 #endif
size_t fullWidthCrossing(pma::TrkCandidateColl &tracks) const
ClusterModuleLabel join with tracks
fhicl::Atom< bool > TagFullHeightTracks
fhicl::Atom< bool > TagNonBeamT0Tracks
fhicl::Atom< double > TopFrontBackMargin
fhicl::Atom< double > NonBeamT0Margin
auto const tolerance
std::vector< double > fDimensionsMin
PMAlgCosmicTagger(const pma::PMAlgCosmicTagger::Config &config)
size_t tagApparentStopper(pma::TrkCandidateColl &tracks) const
size_t outOfDriftWindow(pma::TrkCandidateColl &tracks) const
fhicl::Atom< bool > TagTopFrontBack
bool isFrontBackVertex(const TVector3 &pos, double tolerance, short int dirIndx) const
size_t nonBeamT0Tag(detinfo::DetectorClocksData const &clockData, pma::TrkCandidateColl &tracks) const
fhicl::Atom< bool > TagOutOfDriftTracks
fhicl::Atom< bool > TagApparentStopper
short int ConvertDirToInt(const TVector3 &dir) const
BEGIN_PROLOG vertical distance to the surface Name
std::vector< double > fDimensionsMax
fhicl::Atom< double > FullCrossingMargin
fhicl::Atom< double > OutOfDriftMargin
void tag(detinfo::DetectorClocksData const &clockData, pma::TrkCandidateColl &tracks)
tuple dir
Definition: dropbox.py:28
fhicl::Atom< double > ApparentStopperMargin
fhicl::Atom< bool > TagFullWidthTracks
Contains all timing reference information for the detector.
fhicl::Atom< double > StopperBuffer
size_t tagTopFrontBack(pma::TrkCandidateColl &tracks) const
size_t fullHeightCrossing(pma::TrkCandidateColl &tracks) const
size_t fullCrossingTagger(pma::TrkCandidateColl &tracks, int direction) const
bool isTopVertex(const TVector3 &pos, double tolerance, short int dirIndx) const
fhicl::Atom< bool > VetoActualStopper
fhicl::Atom< bool > TagFullLengthTracks
size_t fullLengthCrossing(pma::TrkCandidateColl &tracks) const