Belle II Software  release-08-01-10
CDCMCHitCollectionLookUp.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #pragma once
9 
10 #include <tracking/trackFindingCDC/mclookup/CDCMCHitLookUp.h>
11 
12 #include <tracking/trackFindingCDC/numerics/EForwardBackward.h>
13 #include <tracking/trackFindingCDC/numerics/Index.h>
14 
15 #include <map>
16 
17 namespace Belle2 {
22  class MCParticle;
23  class CDCHit;
24 
25  namespace TrackFindingCDC {
26  class CDCTrajectory3D;
27 
30 
32  MCTrackIdPurityPair(ITrackType mcTrackId, float purity, int correctRLVote)
33  : m_mcTrackId(mcTrackId)
34  , m_purity(purity)
35  , m_correctRLVote(correctRLVote)
36  {
37  }
38 
40  ITrackType getMCTrackId() const
41  {
42  return m_mcTrackId;
43  }
44 
46  float getPurity() const
47  {
48  return m_purity;
49  }
50 
52  int getCorrectRLVote() const
53  {
54  return m_correctRLVote;
55  }
56 
57  private:
59  ITrackType m_mcTrackId;
60 
62  float m_purity;
63 
66  };
67 
69  template <typename ACDCHitCollection>
71 
72  public:
74  void clear();
75 
78 
79  private:
81  std::map<ITrackType, size_t> getHitCountByMCTrackId(const ACDCHitCollection& hits) const;
82 
83  public:
85  MCTrackIdPurityPair getHighestPurity(const ACDCHitCollection& hits) const;
86 
88 
92  ITrackType getMCTrackId(const ACDCHitCollection* ptrHits) const;
93 
95  int getCorrectRLVote(const ACDCHitCollection* ptrHits) const;
96 
98  double getRLPurity(const ACDCHitCollection* ptrHits) const;
99 
101  const MCParticle* getMCParticle(const ACDCHitCollection* ptrHits) const;
102 
103 
105  const CDCHit* getFirstHit(const ACDCHitCollection* ptrHits) const;
106 
108  const CDCHit* getLastHit(const ACDCHitCollection* ptrHits) const;
109 
110 
111 
113  Index getFirstInTrackId(const ACDCHitCollection* ptrHits) const
115 
117  Index getLastInTrackId(const ACDCHitCollection* ptrHits) const
118  { return CDCMCHitLookUp::getInstance().getInTrackId(getLastHit(ptrHits)); }
119 
120 
121 
123  Index getFirstInTrackSegmentId(const ACDCHitCollection* ptrHits) const
125 
127  Index getLastInTrackSegmentId(const ACDCHitCollection* ptrHits) const
129 
130 
131 
133  Index getFirstNPassedSuperLayers(const ACDCHitCollection* ptrHits) const
135 
137  Index getLastNPassedSuperLayers(const ACDCHitCollection* ptrHits) const
139 
141  Index getFirstNLoops(const ACDCHitCollection* ptrHits) const
142  { return CDCMCHitLookUp::getInstance().getNLoops(getFirstHit(ptrHits)); }
143 
145  Index getLastNLoops(const ACDCHitCollection* ptrHits) const
146  { return CDCMCHitLookUp::getInstance().getNLoops(getLastHit(ptrHits)); }
147 
155  EForwardBackward isForwardOrBackwardToMCTrack(const ACDCHitCollection* ptrHits) const;
156 
168  EForwardBackward areAlignedInMCTrack(const ACDCHitCollection* ptrFromHits,
169  const ACDCHitCollection* ptrToHits) const;
170 
176  EForwardBackward areAlignedInMCTrackWithRLCheck(const ACDCHitCollection* ptrFromHits,
177  const ACDCHitCollection* ptrToHits) const;
178 
180  CDCTrajectory3D getTrajectory3D(const ACDCHitCollection* ptrHits) const;
181 
182  private:
184  float m_minimalMatchPurity = 0.5;
185 
187  float m_minimalRLPurity = 0.5;
188  };
189  }
191 }
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:40
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
Interface class to the Monte Carlo information for collections of hits.
EForwardBackward isForwardOrBackwardToMCTrack(const ACDCHitCollection *ptrHits) const
Returns the orientation of the collection of hits relative to its matched track.
ITrackType getMCTrackId(const ACDCHitCollection *ptrHits) const
Getter for the Monte Carlo track id matched to this collection of hits.
Index getLastNPassedSuperLayers(const ACDCHitCollection *ptrHits) const
Getter for number of passed superlayer till the last hit the collection of hits which has the Monte C...
CDCMCHitCollectionLookUp()
Dummy constructor to silence the intel-compiler warnings (NOTE: using "=default" will make the intel ...
Index getFirstNLoops(const ACDCHitCollection *ptrHits) const
Getter for number of loops till the first hit the collection of hits which has the Monte Carlo track ...
Index getLastInTrackId(const ACDCHitCollection *ptrHits) const
Getter for in track id for the last hit in the collection of hits which has the Monte Carlo track id ...
float m_minimalMatchPurity
Threshold for the purity that must be exceeded to be considered as a match.
std::map< ITrackType, size_t > getHitCountByMCTrackId(const ACDCHitCollection &hits) const
Fill a map with the number of hits for each track id contained in the given hit range.
Index getLastNLoops(const ACDCHitCollection *ptrHits) const
Getter for number of loops till the last hit the collection of hits which has the Monte Carlo track i...
MCTrackIdPurityPair getHighestPurity(const ACDCHitCollection &hits) const
Get the track id with the highest corresponding purity.
const CDCHit * getLastHit(const ACDCHitCollection *ptrHits) const
Getter for the last hit in the collection of hits which has the Monte Carlo track id matched to this ...
EForwardBackward areAlignedInMCTrackWithRLCheck(const ACDCHitCollection *ptrFromHits, const ACDCHitCollection *ptrToHits) const
Returns if the second collection of hits follows the first collection of hits in their common Monte C...
const MCParticle * getMCParticle(const ACDCHitCollection *ptrHits) const
Getter for the mc particle matched to this collection of hits.
int getCorrectRLVote(const ACDCHitCollection *ptrHits) const
Getter for the difference of correct versus incorrect right left passage informations.
Index getLastInTrackSegmentId(const ACDCHitCollection *ptrHits) const
Getter for in track collection of hits id for the last hit in the collection of hits which has the Mo...
void clear()
Clears all Monte Carlo information left from the last event.
const CDCHit * getFirstHit(const ACDCHitCollection *ptrHits) const
Getter for the first hit in the collection of hits which has the Monte Carlo track id matched to this...
double getRLPurity(const ACDCHitCollection *ptrHits) const
Getter for the right left passge purity which respects the forward backward reconstruction.
CDCTrajectory3D getTrajectory3D(const ACDCHitCollection *ptrHits) const
Returns the trajectory of the collection of hits.
Index getFirstInTrackSegmentId(const ACDCHitCollection *ptrHits) const
Getter for in track collection of hits id for the first hit in the collection of hits which has the M...
Index getFirstInTrackId(const ACDCHitCollection *ptrHits) const
Getter for in track id for the first hit in the collection of hits which has the Monte Carlo track id...
EForwardBackward areAlignedInMCTrack(const ACDCHitCollection *ptrFromHits, const ACDCHitCollection *ptrToHits) const
Returns if the second collection of hits follows the first collection of hits in their common Monte C...
Index getFirstNPassedSuperLayers(const ACDCHitCollection *ptrHits) const
Getter for number of passed superlayer till the first hit the collection of hits which has the Monte ...
float m_minimalRLPurity
Threshold for the correct fraction of right left passage informations to be considered a match.
Index getNPassedSuperLayers(const CDCHit *ptrHit) const
Returns the number of superlayers the track traversed until this hit.
Index getInTrackSegmentId(const CDCHit *ptrHit) const
Returns the id of the segment in the track.
Index getNLoops(const CDCHit *ptrHit) const
Returns the number of loops the track traversed until this hit.
Index getInTrackId(const CDCHit *ptrHit) const
Returns the position of the wire hit in the track along the travel direction.
static const CDCMCHitLookUp & getInstance()
Getter for the singletone instance.
Particle full three dimensional trajectory.
EForwardBackward
Enumeration to represent the distinct possibilities of the right left passage information.
Abstract base class for different kinds of events.
Structure representing a matched Monte Carlo track id with the corresponding purity.
int getCorrectRLVote() const
Getter for the rl vote.
float getPurity() const
Getter for the purity.
MCTrackIdPurityPair(ITrackType mcTrackId, float purity, int correctRLVote)
Constructor taking the Monte Carlo track id and the purity to be stored.
ITrackType getMCTrackId() const
Getter for the Monte Carlo track Id.
int m_correctRLVote
Number of correct rl information in the track.