TrackCleanUpAlg.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file TrackCle/// TrackCleanUpAlg.h
3 /// \brief Preforms clean up on tracks on the MIP assumption
4 ///
5 /// \author ksachdev@physics.umn.edu
6 ////////////////////////////////////////////////////////////////////////
7 
8 
9 #ifndef TrackCleanUpAlg_h
10 #define TrackCleanUpAlg_h
11 
12 #include "fhiclcpp/ParameterSet.h"
15 
17 #include "Geometry/Geometry.h"
18 
19 
20 namespace rb
21 {
22  class Cluster;
23  class Track;
24  class CellHit;
25  struct WeightedHit;
26 }
27 
28 
29 namespace murem
30 {
31 
33  {
34 
35  public:
36  explicit TrackCleanUpAlg(fhicl::ParameterSet const& pset);
37  ~TrackCleanUpAlg();
38 
39  void reconfigure(const fhicl::ParameterSet& pset);
40 
41  /// \brief A function to disentangle the muon track from the hadronic
42  /// energy close to the vertex. Returns a vector of rb::WeightedHits
43  /// where the hit is the cellhits that were on the given track and
44  /// weight is the fraction of the energy in the hit that came from
45  /// the track. mipRangeLow, mipRangeHigh, mipValue and vertexRegionDeDxCutOff
46  /// are pointers that point to the value of mip range limits,
47  /// peak values andthe dedx cut off used to find the vertex region.
48  /// If these pointers are not provided, the default values are used.
49  /// The default values are good for muons, not for other particles.
50  std::vector<rb::WeightedHit> CleanUpTrack(const rb::Track &muonTrack,
51  const rb::Cluster &slice,
52  double* mipRangeHigh = NULL,
53  double* mipRangeLow = NULL,
54  double* mipValue = NULL,
55  double* vertexRegionDeDxCutOff = NULL);
56 
57 
58  /// \brief A function to decide how large a vertex region should be
59  /// considered for clean up. vertexRegion is an array of two ints.
60  /// 0th element is the track trajectory point in the x-view that
61  /// marks the end of the vertexRegion in the x-view and the 1st
62  /// element is that in the y-view. vertexRegionDeDxCutOff is
63  /// the dedx cut off used to find the vertex region.
64  /// If these pointers are not provided, the default values are used.
65  /// The default values are good for muons, not for other particles.
66  void ComputeVertexRegion(const rb::Track &muonTrack,
67  int *vertexRegion,
68  double* vertexRegionDeDxCutOff = NULL);
69 
70 
71  /// \brief A function to decide how large a vertex region should be
72  /// considered for clean up. vertexRegion is an array of two ints.
73  /// 0th element is the plane in the x-view that marks the end of the
74  /// vertexRegion in the x-view and the 1st element marks the end of
75  /// vertexRegion in the y-view. vertexRegionDeDxCutOff is
76  /// the dedx cut off used to find the vertex region.
77  /// If these pointers are not provided, the default values are used.
78  /// The default values are good for muons, not for other particles.
79  void LastVertexPlanes(const rb::Track &muonTrack,
80  int *vertexPlanes,
81  double* vertexRegionDeDxCutOff = NULL);
82 
83  /// \brief Calculates the total hadronic energy on the provided track
84  /// based on the assumption of MIP. mipRangeLow, mipRangeHigh,
85  /// mipValue and vertexRegionDeDxCutOff are pointers that point to
86  /// the value of mip range limits, peak values and the the dedx cut
87  /// off used to find the vertex region. If these pointers are not
88  /// provided, the default values are used.
89  /// The default values are good for muons, not for other particles.
90  float ExtraEOnTrack(const rb::Track &track,
91  const rb::Cluster &slice,
92  double* mipRangeHigh = NULL,
93  double* mipRangeLow = NULL,
94  double* mipValue = NULL,
95  double* vertexRegionDeDxCutOff = NULL);
96 
97  float ExtraEOnTrackInGeV(const rb::Track &track,
98  const rb::Cluster &slice,
99  double* mipRangeHigh = NULL,
100  double* mipRangeLow = NULL,
101  double* mipValue = NULL,
102  double* vertexRegionDeDxCutOff = NULL);
103 
104  /// \brief Calculates the total hadronic energy on the provided track
105  /// based on the assumption of MIP for each plane in the vertex region.
106  /// mipRangeLow, mipRangeHigh, mipValue and vertexRegionDeDxCutOff are
107  /// pointers that point to the value of mip range limits, peak values
108  /// and the the dedx cut off used to find the vertex region. If these
109  /// pointers are not provided, the default values are used.
110  /// The default values are good for muons, not for other particles.
111  std::map<int, float> ExtraEOnTrackPlanes(const rb::Track &track,
112  const rb::Cluster &slice,
113  double* mipRangeHigh = NULL,
114  double* mipRangeLow = NULL,
115  double* mipValue = NULL,
116  double* vertexRegionDeDxCutOff = NULL);
117 
118  std::map<int, float> ExtraEOnTrackPlanesInGeV(const rb::Track &track,
119  const rb::Cluster &slice,
120  double* mipRangeHigh = NULL,
121  double* mipRangeLow = NULL,
122  double* mipValue = NULL,
123  double* vertexRegionDeDxCutOff = NULL);
124 
125  /// \brief Returns a vector of rb::WeightedHit that have been impacted by
126  /// the CleanUp procedure. hits are all the hits on the muonTrack \a
127  /// within the vertex region and weight indicates the fraction of energy
128  /// deposited in the cell that belonged to the track. mipRangeLow,
129  /// mipRangeHigh, mipValue and vertexRegionDeDxCutOff are pointers
130  /// that point to the value of mip range limits, peak values and the
131  /// dedx cut off used to find the vertex region. If these pointers
132  /// are not provided, the default values are used.
133  /// The default values are good for muons, not for other particles.
134  std::vector<rb::WeightedHit> CleanUpWeightedHits(const rb::Track &muonTrack,
135  const rb::Cluster &slice,
136  double* mipRangeHigh = NULL,
137  double* mipRangeLow = NULL,
138  double* mipValue = NULL,
139  double* vertexRegionDeDxCutOff = NULL);
140 
141  /// A function to calculate the energy, dE/dx and tracklength of a track through a plane
142  std::map<unsigned int, double> DeDxInPlane( const rb::Track &muonTrack );
143 
144  /// A function for total energy calculation in terms of MIP
145  float TrackEinMIP (const rb::Track &track);
146 
147  private:
148 
149  /// FHiCL Parameters
150  //@{
151  /// Extra energy on track
153 
154  /// A map of planes in the vertex region of a track and the extra energy found on them
155  std::map< int, float > fExtraEOnTrackPlanes;
156 
157  /// Default lower bound of allowed MIP range (FHiCL parameter)
159 
160  /// Default upper bound of allowed MIP range (FHiCL parameter)
162 
163  /// Default MIP value in GeV/cm (FHiCL parameter)
164  float fMipValue;
165 
166  /// Default vertex region dedx cut off value (FHiCL parameter)
168 
169  /// the same as fMipRangeLow but in GeV/cm units (FHiCL parameter)
171 
172  /// the same as fMipRangeHigh but in GeV/cm units (FHiCL parameter)
174 
175  /// the same as fMipValue but in GeV/cm units (FHiCL parameter)
177 
178  /// the same as fVertexRegionDeDxCutOff but in GeV/cm units (FHiCL parameter)
180  //@}
181 
182  /// Handle to Geometry service
184 
185  /// Trajectories points in x view
186  std::vector<int> fTrajX;
187 
188  /// Trajectories points in y view
189  std::vector<int> fTrajY;
190 
191  /// A vector of planes on muon track with hits in them.
192  std::vector<int > fPlanes;
193 
194  /// A vector of X-view planes on muon track with hits in them.
195  std::vector<int > fPlanesX;
196 
197  /// A vector of Y-view planes on muon track with hits in them.
198  std::vector<int > fPlanesY;
199 
200  /// A map of plane and energy in plane left by the track
201  std::map<unsigned int, double> fPlaneEnergy;
202 
203  /// A map of plane and track length through plane
204  std::map<unsigned int, double> fPlaneTrkLength;
205 
206  /// A map of plane and average dedx over this and the next 2 planes
207  std::map<unsigned int, double> fAvgDeDx;
208 
209  /// A map of plane and dE/dX of the track in the plane
210  std::map<unsigned int, double> fPlaneDeDx;
211 
212  /// A map of cell and energy in Plane left by the track
213  std::map<geo::OfflineChan, double> fCellEnergy;
214 
215  /// A vector of \ref rb::WeightedHit that are impacted by CleanUp procedure
216  std::vector<rb::WeightedHit> fCleanUpWeightedHits;
217 
218  /// A map to store the cell numbers that are in each plane of the track
219  std::map<int, std::vector<art::Ptr<rb::CellHit> > > fPlaneHits;
220 
221  /// A function to check if the given dE/dx is consistent with MIP
222  int IsMIP( double dEdX) const;
223 
224  /// A function to reset the weight of a \ref rb::WeightedHit in a given vector of WeightedHits
225  std::vector<rb::WeightedHit> ResetHitWeight( std::vector< rb::WeightedHit > &trackHits,
227  float &weight);
228 
229  /// Sorts a vector of cellhits in ascending order by distance from the trajPt on track.
230  void SortByDistFromTrack( std::vector< art::Ptr<rb::CellHit> >&hits,
231  const rb::Track &track, int plane);
232  };
233 
234 }
235 
236 #endif // TrackCleanUpAlg_h
237 
238 ////////////////////////////////////////////////////////////////////////
239 
240 
241 
std::vector< int > fTrajY
Trajectories points in y view.
std::map< int, float > fExtraEOnTrackPlanes
A map of planes in the vertex region of a track and the extra energy found on them.
std::vector< int > fTrajX
Trajectories points in x view.
std::map< int, std::vector< art::Ptr< rb::CellHit > > > fPlaneHits
A map to store the cell numbers that are in each plane of the track.
std::map< geo::OfflineChan, double > fCellEnergy
A map of cell and energy in Plane left by the track.
const Var weight
Definition: event.h:19
std::map< unsigned int, double > fPlaneDeDx
A map of plane and dE/dX of the track in the plane.
A collection of associated CellHits.
Definition: Cluster.h:47
std::vector< rb::WeightedHit > fCleanUpWeightedHits
A vector of rb::WeightedHit that are impacted by CleanUp procedure.
float fMipRangeHigh
Default upper bound of allowed MIP range (FHiCL parameter)
art::ServiceHandle< geo::Geometry > fgeom
Handle to Geometry service.
A rb::Prong with full reconstructed trajectory.
Definition: Track.h:20
float fVertexRegionDeDxCutOffInGev
the same as fVertexRegionDeDxCutOff but in GeV/cm units (FHiCL parameter)
float fVertexRegionDeDxCutOff
Default vertex region dedx cut off value (FHiCL parameter)
void hits()
Definition: readHits.C:15
float fMipValueInGev
the same as fMipValue but in GeV/cm units (FHiCL parameter)
float fMipValue
Default MIP value in GeV/cm (FHiCL parameter)
std::vector< int > fPlanes
A vector of planes on muon track with hits in them.
Perform a "2 point" Hough transform on a collection of hits.
float fExtraEOnTrack
FHiCL Parameters.
std::vector< int > fPlanesX
A vector of X-view planes on muon track with hits in them.
Definition: structs.h:12
std::vector< int > fPlanesY
A vector of Y-view planes on muon track with hits in them.
std::map< unsigned int, double > fPlaneTrkLength
A map of plane and track length through plane.
float fMipRangeLowInGev
the same as fMipRangeLow but in GeV/cm units (FHiCL parameter)
Simple object representing a (plane, cell) pair.
Encapsulate the geometry of one entire detector (near, far, ndos)
std::map< unsigned int, double > fPlaneEnergy
A map of plane and energy in plane left by the track.
float fMipRangeHighInGev
the same as fMipRangeHigh but in GeV/cm units (FHiCL parameter)
std::map< unsigned int, double > fAvgDeDx
A map of plane and average dedx over this and the next 2 planes.
float fMipRangeLow
Default lower bound of allowed MIP range (FHiCL parameter)