Belle II Software  release-05-01-25
CDCMCTrackStore.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2014 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/trackFindingCDC/mclookup/ITrackType.h>
13 #include <tracking/trackFindingCDC/numerics/Index.h>
14 
15 #include <map>
16 #include <vector>
17 
18 namespace Belle2 {
23  class CDCHit;
24 
25  namespace TrackFindingCDC {
26  class CDCMCMap;
27  class CDCSimHitLookUp;
28 
30  class CDCMCTrackStore {
31 
32  public:
34  using CDCHitVector = std::vector<const CDCHit*>;
35 
36  public:
38  static const CDCMCTrackStore& getInstance();
39 
40  public:
42  CDCMCTrackStore() = default;
45  CDCMCTrackStore& operator=(const CDCMCTrackStore&) = delete;
46 
47  public:
49  void clear();
50 
54  void fill(const CDCMCMap* ptrMCMap, const CDCSimHitLookUp* ptrSimHitLookUp);
55 
56  public:
58  const std::map<ITrackType, Belle2::TrackFindingCDC::CDCMCTrackStore::CDCHitVector>& getMCTracksByMCParticleIdx() const
59  { return m_mcTracksByMCParticleIdx;}
60 
62  const std::map<ITrackType, std::vector<Belle2::TrackFindingCDC::CDCMCTrackStore::CDCHitVector> >& getMCSegmentsByMCParticleIdx()
63  const
65 
66  private:
68  void fillMCTracks();
69 
71  void fillMCSegments();
72 
74  void arrangeMCTrack(CDCHitVector& mcTrack) const;
75 
77  void fillInTrackId();
78 
80  void fillInTrackSegmentId();
81 
84 
86 
91  bool changedSuperLayer(const CDCHitVector& mcSegment, const CDCHitVector& nextMCSegment) const;
92 
93  public:
95  Index getInTrackId(const CDCHit* ptrHit) const;
96 
98  Index getInTrackSegmentId(const CDCHit* ptrHit) const;
99 
101  Index getNPassedSuperLayers(const CDCHit* ptrHit) const;
102 
104  Index getNLoops(const CDCHit* ptrHit) const;
105 
106  private:
108  const CDCMCMap* m_ptrMCMap;
109 
112 
114  std::map<ITrackType, CDCHitVector> m_mcTracksByMCParticleIdx;
115 
117  std::map<ITrackType, std::vector<CDCHitVector> > m_mcSegmentsByMCParticleIdx;
118 
120  std::map<const CDCHit*, int> m_inTrackIds;
121 
123  std::map<const CDCHit*, int> m_inTrackSegmentIds;
124 
126  std::map<const CDCHit*, int> m_nPassedSuperLayers;
127 
129  std::map<const CDCHit*, int> m_nLoops;
130  };
131  }
133 }
Belle2::TrackFindingCDC::CDCMCTrackStore::m_nLoops
std::map< const CDCHit *, int > m_nLoops
Look up table for the number of loops the particle traversed before making the individual hit.
Definition: CDCMCTrackStore.h:137
Belle2::TrackFindingCDC::CDCMCTrackStore::CDCHitVector
std::vector< const CDCHit * > CDCHitVector
Type for an ordered sequence of pointers to the CDCHit.
Definition: CDCMCTrackStore.h:42
Belle2::TrackFindingCDC::CDCMCTrackStore::getMCSegmentsByMCParticleIdx
const std::map< ITrackType, std::vector< Belle2::TrackFindingCDC::CDCMCTrackStore::CDCHitVector > > & getMCSegmentsByMCParticleIdx() const
Getter for the stored Monte Carlo segments ordered by their Monte Carlo Id.
Definition: CDCMCTrackStore.h:70
Belle2::TrackFindingCDC::CDCMCTrackStore::getNLoops
Index getNLoops(const CDCHit *ptrHit) const
Getter for the number of traversed loops until this hit.
Definition: CDCMCTrackStore.cc:405
Belle2::TrackFindingCDC::CDCMCTrackStore::arrangeMCTrack
void arrangeMCTrack(CDCHitVector &mcTrack) const
Sorts the given track for the FlightTime of the assoziated CDCSimHits.
Definition: CDCMCTrackStore.cc:237
Belle2::TrackFindingCDC::CDCMCTrackStore::m_mcTracksByMCParticleIdx
std::map< ITrackType, CDCHitVector > m_mcTracksByMCParticleIdx
The memory for the tracks made of CDCHits sorted for the time of flight and assoziated to the Monte C...
Definition: CDCMCTrackStore.h:122
Belle2::CDCHit
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:51
Belle2::TrackFindingCDC::CDCMCTrackStore::getInTrackId
Index getInTrackId(const CDCHit *ptrHit) const
Getter for the index of the hit within its track.
Definition: CDCMCTrackStore.cc:378
Belle2::TrackFindingCDC::CDCMCTrackStore
Class to organize and present the monte carlo hit information.
Definition: CDCMCTrackStore.h:38
Belle2::TrackFindingCDC::CDCMCTrackStore::fillInTrackId
void fillInTrackId()
Fill the look up table for the in track index of each hit.
Definition: CDCMCTrackStore.cc:276
Belle2::TrackFindingCDC::CDCMCTrackStore::fillNLoopsAndNPassedSuperLayers
void fillNLoopsAndNPassedSuperLayers()
Fill the look up table of the number of traversed super layers until each hit.
Definition: CDCMCTrackStore.cc:310
Belle2::TrackFindingCDC::CDCMCTrackStore::m_ptrSimHitLookUp
const CDCSimHitLookUp * m_ptrSimHitLookUp
Reference to the CDCSimHit look up for additional information about related primary sim hits.
Definition: CDCMCTrackStore.h:119
Belle2::TrackFindingCDC::CDCMCTrackStore::m_ptrMCMap
const CDCMCMap * m_ptrMCMap
Reference to the MC map of the current event.
Definition: CDCMCTrackStore.h:116
Belle2::TrackFindingCDC::CDCMCTrackStore::m_inTrackIds
std::map< const CDCHit *, int > m_inTrackIds
Look up table for index of the hit within its track.
Definition: CDCMCTrackStore.h:128
Belle2::TrackFindingCDC::CDCMCTrackStore::fillMCSegments
void fillMCSegments()
Construct the segments by dividing the mc tracks in to disconnected parts and sorted them for the Fli...
Definition: CDCMCTrackStore.cc:123
Belle2::TrackFindingCDC::CDCMCTrackStore::getNPassedSuperLayers
Index getNPassedSuperLayers(const CDCHit *ptrHit) const
Getter for the number of super layers traversed until this hit.
Definition: CDCMCTrackStore.cc:397
Belle2::TrackFindingCDC::CDCMCTrackStore::CDCMCTrackStore
CDCMCTrackStore()=default
Default constructor - for cppcheck.
Belle2::TrackFindingCDC::CDCMCTrackStore::fillInTrackSegmentId
void fillInTrackSegmentId()
Fill the look up table for the in track segment index of each hit.
Definition: CDCMCTrackStore.cc:293
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::CDCMCTrackStore::getInstance
static const CDCMCTrackStore & getInstance()
Getter for the singletone instance.
Definition: CDCMCTrackStore.cc:29
Belle2::TrackFindingCDC::CDCMCTrackStore::m_nPassedSuperLayers
std::map< const CDCHit *, int > m_nPassedSuperLayers
Look up table for the number of super layers the particle traversed before making the individual hit.
Definition: CDCMCTrackStore.h:134
Belle2::TrackFindingCDC::CDCSimHitLookUp
Singletone class to gather local information about the hits.
Definition: CDCSimHitLookUp.h:50
Belle2::TrackFindingCDC::CDCMCTrackStore::m_mcSegmentsByMCParticleIdx
std::map< ITrackType, std::vector< CDCHitVector > > m_mcSegmentsByMCParticleIdx
The memory for the segments made of CDCHits sorted for the time of flight and assoziated to the Monte...
Definition: CDCMCTrackStore.h:125
Belle2::TrackFindingCDC::CDCMCTrackStore::clear
void clear()
Clear all Monte Carlo hits.
Definition: CDCMCTrackStore.cc:35
Belle2::TrackFindingCDC::CDCMCTrackStore::getMCTracksByMCParticleIdx
const std::map< ITrackType, Belle2::TrackFindingCDC::CDCMCTrackStore::CDCHitVector > & getMCTracksByMCParticleIdx() const
Getter for the stored Monte Carlo tracks ordered by their Monte Carlo Id.
Definition: CDCMCTrackStore.h:66
Belle2::TrackFindingCDC::CDCMCTrackStore::changedSuperLayer
bool changedSuperLayer(const CDCHitVector &mcSegment, const CDCHitVector &nextMCSegment) const
Helper function to decide whether the number of passed superlayers changed from one segment to the ne...
Definition: CDCMCTrackStore.cc:343
Belle2::TrackFindingCDC::CDCMCTrackStore::getInTrackSegmentId
Index getInTrackSegmentId(const CDCHit *ptrHit) const
Getter for the index of the segment of the hit within its track.
Definition: CDCMCTrackStore.cc:388
Belle2::TrackFindingCDC::CDCMCTrackStore::m_inTrackSegmentIds
std::map< const CDCHit *, int > m_inTrackSegmentIds
Look up table for index of the segment of the hits within their respective tracks.
Definition: CDCMCTrackStore.h:131
Belle2::TrackFindingCDC::CDCMCMap
Class to organize and present the monte carlo hit information.
Definition: CDCMCMap.h:38
Belle2::TrackFindingCDC::CDCMCTrackStore::fillMCTracks
void fillMCTracks()
Construct the tracks by grouping the hits by the mc particle id and sorted them for the FlightTime of...
Definition: CDCMCTrackStore.cc:89
Belle2::TrackFindingCDC::CDCMCTrackStore::fill
void fill(const CDCMCMap *ptrMCMap, const CDCSimHitLookUp *ptrSimHitLookUp)
Fill the store with the tracks from Monte Carlo information.
Definition: CDCMCTrackStore.cc:54