Belle II Software  release-05-02-19
CDCMCHitLookUp.cc
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 #include <tracking/trackFindingCDC/mclookup/CDCMCHitLookUp.h>
11 
12 #include <tracking/trackFindingCDC/mclookup/CDCSimHitLookUp.h>
13 #include <tracking/trackFindingCDC/mclookup/CDCMCTrackStore.h>
14 #include <tracking/trackFindingCDC/mclookup/CDCMCMap.h>
15 #include <tracking/trackFindingCDC/mclookup/CDCMCManager.h>
16 
17 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
18 
19 #include <tracking/trackFindingCDC/topology/CDCWire.h>
20 
21 #include <tracking/trackFindingCDC/geometry/Vector3D.h>
22 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
23 
24 #include <cdc/dataobjects/CDCHit.h>
25 #include <cdc/dataobjects/CDCSimHit.h>
26 #include <mdst/dataobjects/MCParticle.h>
27 
28 using namespace Belle2;
29 using namespace TrackFindingCDC;
30 
31 
33 {
35 }
36 
37 
39 {
41 }
42 
43 
45 {
46  return CDCMCManager::getMCMap().getSimHit(ptrHit);
47 }
48 
49 
51 {
52  return CDCMCManager::getMCMap().getMCParticle(ptrHit);
53 }
54 
55 
56 const Vector2D CDCMCHitLookUp::getRefPos2D(const CDCHit* ptrHit) const
57 {
58  if (not ptrHit) return Vector2D();
59  const CDCHit& hit = *ptrHit;
60 
61  const CDCWire* ptrWire = CDCWire::getInstance(hit);
62 
63  if (not ptrWire) {
64  B2WARNING("Encountered CDCHit with wire ids that do not correspond to a valid wire in the CDC)");
65  return Vector2D();
66  }
67 
68  const CDCWire& wire = *ptrWire;
69  Vector2D refPos2D = wire.getRefPos2D();
70  return refPos2D;
71 }
72 
73 
74 float CDCMCHitLookUp::getRefDriftLength(const CDCHit* ptrHit) const
75 {
76 
77  if (not ptrHit) return NAN;
78  CDCWireHit wireHit(ptrHit);
79  return wireHit.getRefDriftLength();
80 
81 }
82 
83 
84 const Vector3D CDCMCHitLookUp::getRecoPos3D(const CDCHit* ptrHit) const
85 {
87 }
88 
89 
91 {
93 }
94 
95 
97 {
99 }
100 
101 
102 
104 {
106 }
107 
108 
110 {
111  return CDCMCManager::getSimHitLookUp().getRLInfo(ptrHit);
112 }
113 
114 
115 bool CDCMCHitLookUp::isBackground(const CDCHit* ptrHit) const
116 {
117  const CDCSimHit* ptrSimHit = getSimHit(ptrHit);
118  return ptrSimHit ? ptrSimHit->getBackgroundTag() != BackgroundMetaData::bg_none : false;
119 }
120 
121 
122 ITrackType CDCMCHitLookUp::getMCTrackId(const CDCHit* ptrHit) const
123 {
124  const MCParticle* ptrMCParticle = getMCParticle(ptrHit);
125  return ptrMCParticle ? ptrMCParticle->getArrayIndex() : INVALID_ITRACK;
126 }
127 
128 
129 Index CDCMCHitLookUp::getInTrackId(const CDCHit* ptrHit) const
130 {
132 }
133 
134 
135 Index CDCMCHitLookUp::getInTrackSegmentId(const CDCHit* ptrHit) const
136 {
138 }
139 
140 
142 {
144 }
145 
146 
147 Index CDCMCHitLookUp::getNLoops(const CDCHit* ptrHit) const
148 {
149  return CDCMCManager::getMCTrackStore().getNLoops(ptrHit);
150 }
Belle2::TrackFindingCDC::CDCMCHitLookUp::getMCParticle
const Belle2::MCParticle * getMCParticle(const CDCHit *ptrHit) const
Getter for the MCParticle which is related to the CDCHit contained in the given wire hit.
Definition: CDCMCHitLookUp.cc:50
Belle2::TrackFindingCDC::CDCMCHitLookUp::getRefDriftLength
float getRefDriftLength(const CDCHit *ptrHit) const
Getter for the reference drift length in the two dimensional projection.
Definition: CDCMCHitLookUp.cc:74
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::Vector2D
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:37
Belle2::TrackFindingCDC::CDCWireHit::getRefDriftLength
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
Definition: CDCWireHit.h:232
Belle2::TrackFindingCDC::CDCWire::getRefPos2D
const Vector2D & getRefPos2D() const
Getter for the wire reference position for 2D tracking Gives the wire's reference position projected ...
Definition: CDCWire.h:231
Belle2::TrackFindingCDC::CDCMCHitLookUp::getRecoPos3D
const Vector3D getRecoPos3D(const CDCHit *ptrHit) const
Getter for the three dimensional position of the primary ionisation for the hit.
Definition: CDCMCHitLookUp.cc:84
Belle2::TrackFindingCDC::CDCMCHitLookUp::getClosestPrimarySimHit
const CDCSimHit * getClosestPrimarySimHit(const CDCHit *ptrHit) const
Getter for the closest simulated hit of a primary particle to the given hit - may return nullptr of n...
Definition: CDCMCHitLookUp.cc:103
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::CDCMCHitLookUp::getNPassedSuperLayers
Index getNPassedSuperLayers(const CDCHit *ptrHit) const
Returns the number of superlayers the track traversed until this hit.
Definition: CDCMCHitLookUp.cc:141
Belle2::TrackFindingCDC::CDCMCManager::getMCMap
static const CDCMCMap & getMCMap()
Getter for the singletone instance of the CDCMCMap.
Definition: CDCMCManager.cc:82
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::CDCMCMap::getMCParticle
MayBePtr< const MCParticle > getMCParticle(const CDCHit *hit) const
Seeks the MCParticle related to the CDCHit.
Definition: CDCMCMap.cc:273
Belle2::TrackFindingCDC::CDCSimHitLookUp::getRecoPos3D
Vector3D getRecoPos3D(const CDCHit *ptrHit) const
Look up the position of the primary ionisation from related simulated hit.
Definition: CDCSimHitLookUp.cc:243
Belle2::CDCSimHit
Example Detector.
Definition: CDCSimHit.h:33
Belle2::MCParticle::getArrayIndex
int getArrayIndex() const
Get 0-based index of the particle in the corresponding MCParticle list.
Definition: MCParticle.h:255
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::CDCMCManager::fill
void fill()
Fill Monte Carlo look up maps from the DataStore.
Definition: CDCMCManager.cc:137
Belle2::TrackFindingCDC::CDCMCHitLookUp::getMCTrackId
ITrackType getMCTrackId(const CDCHit *ptrHit) const
Returns the track id for the hit.
Definition: CDCMCHitLookUp.cc:122
Belle2::TrackFindingCDC::CDCSimHitLookUp::getClosestPrimaryRecoPos3D
Vector3D getClosestPrimaryRecoPos3D(const CDCHit *ptrHit) const
Look up the position of the primary ionisation from the closest primary simulated hit.
Definition: CDCSimHitLookUp.cc:281
Belle2::TrackFindingCDC::CDCMCHitLookUp::isReassignedSecondary
bool isReassignedSecondary(const CDCHit *ptrHit) const
Indicates if the hit was reassigned to a different mc particle because it was caused by a secondary.
Definition: CDCMCHitLookUp.cc:96
Belle2::TrackFindingCDC::CDCMCHitLookUp::getRefPos2D
const Vector2D getRefPos2D(const CDCHit *ptrHit) const
Getter for the two dimensional reference position of the wire the given hit is located on - mainly fo...
Definition: CDCMCHitLookUp.cc:56
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::CDCMCManager::getMCTrackStore
static const CDCMCTrackStore & getMCTrackStore()
Getter for the singletone instance of the CDCMCTrackStore.
Definition: CDCMCManager.cc:87
Belle2::TrackFindingCDC::CDCMCHitLookUp
Interface class to the Monte Carlo information for individual hits.
Definition: CDCMCHitLookUp.h:41
Belle2::TrackFindingCDC::CDCMCHitLookUp::getNLoops
Index getNLoops(const CDCHit *ptrHit) const
Returns the number of loops the track traversed until this hit.
Definition: CDCMCHitLookUp.cc:147
Belle2::TrackFindingCDC::Vector3D
A three dimensional vector.
Definition: Vector3D.h:34
Belle2::TrackFindingCDC::CDCMCManager::getInstance
static CDCMCManager & getInstance()
Getter for the singletone instance.
Definition: CDCMCManager.cc:76
Belle2::TrackFindingCDC::CDCWire::getInstance
static const CDCWire * getInstance(const WireID &wireID)
Getter from the wireID convinience object. Does not construct a new object.
Definition: CDCWire.cc:26
Belle2::TrackFindingCDC::NRightLeft::ERightLeft
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition: ERightLeft.h:35
Belle2::BackgroundMetaData::bg_none
@ bg_none
No background.
Definition: BackgroundMetaData.h:41
Belle2::TrackFindingCDC::CDCMCManager::getSimHitLookUp
static const CDCSimHitLookUp & getSimHitLookUp()
Getter for the singletone instance of the CDCSimHitLookUp.
Definition: CDCMCManager.cc:92
Belle2::TrackFindingCDC::CDCMCMap::getSimHit
MayBePtr< const CDCSimHit > getSimHit(const CDCHit *hit) const
Seeks the CDCSimHit related to the CDCHit.
Definition: CDCMCMap.cc:253
Belle2::TrackFindingCDC::CDCMCHitLookUp::getSimHit
const Belle2::CDCSimHit * getSimHit(const CDCHit *ptrHit) const
Getter for the CDCSimHit which is related to the CDCHit contained in the given wire hit.
Definition: CDCMCHitLookUp.cc:44
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::CDCMCHitLookUp::getInstance
static const CDCMCHitLookUp & getInstance()
Getter for the singletone instance.
Definition: CDCMCHitLookUp.cc:32
Belle2::TrackFindingCDC::CDCSimHitLookUp::getClosestPrimarySimHit
MayBePtr< const CDCSimHit > getClosestPrimarySimHit(const CDCSimHit *ptrSimHit) const
Helper function to find the closest primary hit for the given CDCSimHit from the same MCParticle - nu...
Definition: CDCSimHitLookUp.cc:91
Belle2::TrackFindingCDC::CDCMCHitLookUp::getClosestPrimaryRecoPos3D
const Vector3D getClosestPrimaryRecoPos3D(const CDCHit *ptrHit) const
Getter for the three dimensional position of the ionisation of the primary simulated hit for the hit.
Definition: CDCMCHitLookUp.cc:90
Belle2::TrackFindingCDC::CDCMCHitLookUp::getInTrackId
Index getInTrackId(const CDCHit *ptrHit) const
Returns the position of the wire hit in the track along the travel direction.
Definition: CDCMCHitLookUp.cc:129
Belle2::TrackFindingCDC::CDCWire
Class representing a sense wire in the central drift chamber.
Definition: CDCWire.h:60
Belle2::SimHitBase::getBackgroundTag
virtual unsigned short getBackgroundTag() const
Get background tag.
Definition: SimHitBase.h:56
Belle2::TrackFindingCDC::CDCMCHitLookUp::getRLInfo
ERightLeft getRLInfo(const CDCHit *ptrHit) const
Returns the true right left passage information.
Definition: CDCMCHitLookUp.cc:109
Belle2::TrackFindingCDC::CDCMCHitLookUp::isBackground
bool isBackground(const CDCHit *ptrHit) const
Returns if this hit is considered background.
Definition: CDCMCHitLookUp.cc:115
Belle2::TrackFindingCDC::CDCMCMap::isReassignedSecondary
bool isReassignedSecondary(const CDCSimHit *ptrSimHit) const
Indicates if the CDCSimHit has been reassigned to a primary MCParticle.
Definition: CDCMCMap.h:120
Belle2::MCParticle
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:43
Belle2::TrackFindingCDC::CDCWireHit
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:65
Belle2::TrackFindingCDC::CDCMCManager::getMCHitLookUp
static const CDCMCHitLookUp & getMCHitLookUp()
Getter for the singletone instance of the CDCMCHitLookUp.
Definition: CDCMCManager.cc:97
Belle2::TrackFindingCDC::CDCMCHitLookUp::getInTrackSegmentId
Index getInTrackSegmentId(const CDCHit *ptrHit) const
Returns the id of the segment in the track.
Definition: CDCMCHitLookUp.cc:135
Belle2::TrackFindingCDC::CDCMCHitLookUp::fill
void fill() const
Method for forwarding a request to fill the Monte Carlo lookup tables from Python.
Definition: CDCMCHitLookUp.cc:38
Belle2::TrackFindingCDC::CDCSimHitLookUp::getRLInfo
ERightLeft getRLInfo(const CDCHit *ptrHit) const
Look up the Monte Carlo right left passage information for the given hit.
Definition: CDCSimHitLookUp.cc:237