Belle II Software  release-08-01-10
CDCMCTrackStore Class Reference

Class to organize and present the monte carlo hit information. More...

#include <CDCMCTrackStore.h>

Collaboration diagram for CDCMCTrackStore:

Public Types

using CDCHitVector = std::vector< const CDCHit * >
 Type for an ordered sequence of pointers to the CDCHit.
 

Public Member Functions

 CDCMCTrackStore ()=default
 Default constructor - for cppcheck.
 
 CDCMCTrackStore (CDCMCTrackStore &)=delete
 Singleton: Delete copy constructor and assignment operator.
 
CDCMCTrackStoreoperator= (const CDCMCTrackStore &)=delete
 Operator =.
 
void clear ()
 Clear all Monte Carlo hits.
 
void fill (const CDCMCMap *ptrMCMap, const CDCSimHitLookUp *ptrSimHitLookUp)
 Fill the store with the tracks from Monte Carlo information. More...
 
const std::map< ITrackType, Belle2::TrackFindingCDC::CDCMCTrackStore::CDCHitVector > & getMCTracksByMCParticleIdx () const
 Getter for the stored Monte Carlo tracks ordered by their Monte Carlo Id.
 
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.
 
Index getInTrackId (const CDCHit *ptrHit) const
 Getter for the index of the hit within its track.
 
Index getInTrackSegmentId (const CDCHit *ptrHit) const
 Getter for the index of the segment of the hit within its track.
 
Index getNPassedSuperLayers (const CDCHit *ptrHit) const
 Getter for the number of super layers traversed until this hit.
 
Index getNLoops (const CDCHit *ptrHit) const
 Getter for the number of traversed loops until this hit.
 

Static Public Member Functions

static const CDCMCTrackStoregetInstance ()
 Getter for the singletone instance.
 

Private Member Functions

void fillMCTracks ()
 Construct the tracks by grouping the hits by the mc particle id and sorted them for the FlightTime of the related CDCSimHits.
 
void fillMCSegments ()
 Construct the segments by dividing the mc tracks in to disconnected parts and sorted them for the FlightTime of the related CDCSimHits.
 
void arrangeMCTrack (CDCHitVector &mcTrack) const
 Sorts the given track for the FlightTime of the assoziated CDCSimHits. More...
 
void fillInTrackId ()
 Fill the look up table for the in track index of each hit.
 
void fillInTrackSegmentId ()
 Fill the look up table for the in track segment index of each hit.
 
void fillNLoopsAndNPassedSuperLayers ()
 Fill the look up table of the number of traversed super layers until 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 next. More...
 

Private Attributes

const CDCMCMapm_ptrMCMap
 Reference to the MC map of the current event.
 
const CDCSimHitLookUpm_ptrSimHitLookUp
 Reference to the CDCSimHit look up for additional information about related primary sim hits.
 
std::map< ITrackType, CDCHitVectorm_mcTracksByMCParticleIdx
 The memory for the tracks made of CDCHits sorted for the time of flight and assoziated to the Monte Carlo particle id.
 
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 Carlo particle id.
 
std::map< const CDCHit *, int > m_inTrackIds
 Look up table for index of the hit within its track.
 
std::map< const CDCHit *, int > m_inTrackSegmentIds
 Look up table for index of the segment of the hits within their respective tracks.
 
std::map< const CDCHit *, int > m_nPassedSuperLayers
 Look up table for the number of super layers the particle traversed before making the individual hit.
 
std::map< const CDCHit *, int > m_nLoops
 Look up table for the number of loops the particle traversed before making the individual hit.
 

Detailed Description

Class to organize and present the monte carlo hit information.

Definition at line 28 of file CDCMCTrackStore.h.

Member Function Documentation

◆ arrangeMCTrack()

void arrangeMCTrack ( CDCHitVector mcTrack) const
private

Sorts the given track for the FlightTime of the assoziated CDCSimHits.

Sort with NaN as high.

Definition at line 235 of file CDCMCTrackStore.cc.

236 {
237  if (not m_ptrMCMap) {
238  B2WARNING("CDCMCMap not set. Cannot sort track");
239  return;
240  }
241 
242  const CDCSimHitLookUp& simHitLookUp = *m_ptrSimHitLookUp;
243 
244  std::stable_sort(mcTrack.begin(), mcTrack.end(),
245  [&simHitLookUp](const CDCHit * ptrHit, const CDCHit * ptrOtherHit) -> bool {
246 
247  const CDCSimHit* ptrSimHit = simHitLookUp.getClosestPrimarySimHit(ptrHit);
248  const CDCSimHit* ptrOtherSimHit = simHitLookUp.getClosestPrimarySimHit(ptrOtherHit);
249 
250  if (not ptrSimHit)
251  {
252  B2FATAL("No CDCSimHit for CDCHit");
253  }
254 
255  if (not ptrOtherSimHit)
256  {
257  B2FATAL("No CDCSimHit for CDCHit");
258  }
259 
260  double secondaryFlightTime = ptrSimHit->getFlightTime();
261  double otherSecondaryFlightTime = ptrOtherSimHit->getFlightTime();
262 
264  return (secondaryFlightTime < std::fmin(INFINITY, otherSecondaryFlightTime));
265  });
266 
267 }
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:40
const CDCSimHitLookUp * m_ptrSimHitLookUp
Reference to the CDCSimHit look up for additional information about related primary sim hits.
const CDCMCMap * m_ptrMCMap
Reference to the MC map of the current event.
Singletone class to gather local information about the hits.

◆ changedSuperLayer()

bool changedSuperLayer ( const CDCHitVector mcSegment,
const CDCHitVector nextMCSegment 
) const
private

Helper function to decide whether the number of passed superlayers changed from one segment to the next.

The number of passed superlayers is easily detectable in a switch of the superlayer number form one segment to the next. An exception to this rule happens were particles are curling back exiting the super layer 0 and reentering the CDC super layer 0. There is no change of super layer number in this case since consecutive segments (only looking at the CDC) have the super layer number 0. Since this case would screw the evaluation of segment pair or triple selection we have to treat it seperatly.

Definition at line 341 of file CDCMCTrackStore.cc.

◆ fill()

void fill ( const CDCMCMap ptrMCMap,
const CDCSimHitLookUp ptrSimHitLookUp 
)

Fill the store with the tracks from Monte Carlo information.

It uses the CDCMCMap to construct the Monte Carlo tracks.

Definition at line 52 of file CDCMCTrackStore.cc.


The documentation for this class was generated from the following files: