Belle II Software development
CDCMCTrackStore.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/ITrackType.h>
11#include <tracking/trackFindingCDC/numerics/Index.h>
12
13#include <map>
14#include <vector>
15
16namespace Belle2 {
21 class CDCHit;
22
23 namespace TrackFindingCDC {
24 class CDCMCMap;
25 class CDCSimHitLookUp;
26
29
30 public:
32 using CDCHitVector = std::vector<const CDCHit*>;
33
34 public:
36 static const CDCMCTrackStore& getInstance();
37
38 public:
39
41 CDCMCTrackStore() = default;
42
45
48
49 public:
51 void clear();
52
56 void fill(const CDCMCMap* ptrMCMap, const CDCSimHitLookUp* ptrSimHitLookUp);
57
58 public:
60 const std::map<ITrackType, Belle2::TrackFindingCDC::CDCMCTrackStore::CDCHitVector>& getMCTracksByMCParticleIdx() const
62
64 const std::map<ITrackType, std::vector<Belle2::TrackFindingCDC::CDCMCTrackStore::CDCHitVector> >& getMCSegmentsByMCParticleIdx()
65 const
67
68 private:
70 void fillMCTracks();
71
73 void fillMCSegments();
74
76 void arrangeMCTrack(CDCHitVector& mcTrack) const;
77
79 void fillInTrackId();
80
83
86
88
93 bool changedSuperLayer(const CDCHitVector& mcSegment, const CDCHitVector& nextMCSegment) const;
94
95 public:
97 Index getInTrackId(const CDCHit* ptrHit) const;
98
100 Index getInTrackSegmentId(const CDCHit* ptrHit) const;
101
103 Index getNPassedSuperLayers(const CDCHit* ptrHit) const;
104
106 Index getNLoops(const CDCHit* ptrHit) const;
107
108 private:
111
114
116 std::map<ITrackType, CDCHitVector> m_mcTracksByMCParticleIdx;
117
119 std::map<ITrackType, std::vector<CDCHitVector> > m_mcSegmentsByMCParticleIdx;
120
122 std::map<const CDCHit*, int> m_inTrackIds;
123
125 std::map<const CDCHit*, int> m_inTrackSegmentIds;
126
128 std::map<const CDCHit*, int> m_nPassedSuperLayers;
129
131 std::map<const CDCHit*, int> m_nLoops;
132 };
133 }
135}
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:40
Class to organize and present the Monte Carlo hit information.
Definition: CDCMCMap.h:28
Class to organize and present the monte carlo hit information.
std::map< const CDCHit *, int > m_inTrackIds
Look up table for index of the hit within its track.
Index getNPassedSuperLayers(const CDCHit *ptrHit) const
Getter for the number of super layers traversed until this hit.
std::map< ITrackType, std::vector< CDCHitVector > > m_mcSegmentsByMCParticleIdx
The memory for the segments made of CDCHits sorted for the time of flight and associated to the Monte...
void fillMCTracks()
Construct the tracks by grouping the hits by the mc particle id and sorted them for the FlightTime of...
void fillNLoopsAndNPassedSuperLayers()
Fill the look up table of the number of traversed super layers until each hit.
static const CDCMCTrackStore & getInstance()
Getter for the singletone instance.
CDCMCTrackStore & operator=(const CDCMCTrackStore &)=delete
Operator =.
Index getInTrackSegmentId(const CDCHit *ptrHit) const
Getter for the index of the segment of the hit within its track.
std::vector< const CDCHit * > CDCHitVector
Type for an ordered sequence of pointers to the CDCHit.
const CDCSimHitLookUp * m_ptrSimHitLookUp
Reference to the CDCSimHit look up for additional information about related primary sim hits.
std::map< const CDCHit *, int > m_nPassedSuperLayers
Look up table for the number of super layers the particle traversed before making the individual hit.
const std::map< ITrackType, Belle2::TrackFindingCDC::CDCMCTrackStore::CDCHitVector > & getMCTracksByMCParticleIdx() const
Getter for the stored Monte Carlo tracks ordered by their Monte Carlo Id.
CDCMCTrackStore(CDCMCTrackStore &)=delete
Singleton: Delete copy constructor and assignment operator.
const CDCMCMap * m_ptrMCMap
Reference to the MC map of the current event.
void fill(const CDCMCMap *ptrMCMap, const CDCSimHitLookUp *ptrSimHitLookUp)
Fill the store with the tracks from Monte Carlo information.
Index getNLoops(const CDCHit *ptrHit) const
Getter for the number of traversed loops until this hit.
std::map< const CDCHit *, int > m_nLoops
Look up table for the number of loops the particle traversed before making the individual hit.
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.
void clear()
Clear all Monte Carlo hits.
void arrangeMCTrack(CDCHitVector &mcTrack) const
Sorts the given track for the FlightTime of the associated CDCSimHits.
void fillInTrackId()
Fill the look up table for the in track index of each hit.
CDCMCTrackStore()=default
Default constructor - for cppcheck.
Index getInTrackId(const CDCHit *ptrHit) const
Getter for the index of the hit within its track.
void fillMCSegments()
Construct the segments by dividing the mc tracks in to disconnected parts and sorted them for the Fli...
std::map< const CDCHit *, int > m_inTrackSegmentIds
Look up table for index of the segment of the hits within their respective tracks.
void fillInTrackSegmentId()
Fill the look up table for the in track segment index of each hit.
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...
std::map< ITrackType, CDCHitVector > m_mcTracksByMCParticleIdx
The memory for the tracks made of CDCHits sorted for the time of flight and associated to the Monte C...
Singletone class to gather local information about the hits.
Abstract base class for different kinds of events.