Belle II Software  release-05-01-25
CDCSimHitLookUp.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/numerics/ERightLeft.h>
13 
14 #include <tracking/trackFindingCDC/utilities/MayBePtr.h>
15 
16 #include <map>
17 #include <vector>
18 
19 namespace Belle2 {
25  class CDCHit;
26  class CDCSimHit;
27 
28  namespace TrackFindingCDC {
29  class CDCMCMap;
30  class CDCRecoHit3D;
31  class CDCRecoHit2D;
32  class CDCRLWireHit;
33  class CDCWireHit;
34  class Vector3D;
35 
37 
42  class CDCSimHitLookUp {
43 
44  public:
46  static const CDCSimHitLookUp& getInstance();
47 
50  CDCSimHitLookUp& operator=(const CDCSimHitLookUp&) = delete;
51 
53  CDCSimHitLookUp() = default;
54 
56  void clear();
57 
59  void fill(const CDCMCMap* ptrMCMap);
60 
61  private:
63  void fillPrimarySimHits();
64 
66  MayBePtr<const CDCSimHit> getClosestPrimarySimHit(const CDCSimHit* ptrSimHit) const;
67 
68  public:
70  const CDCSimHit* getClosestPrimarySimHit(const CDCHit* ptrHit) const;
71 
73  Vector3D getDirectionOfFlight(const CDCHit* ptrHit);
74 
75  private:
77  void fillRLInfo();
78 
79  public:
81  ERightLeft getRLInfo(const CDCHit* ptrHit) const;
82 
84  Vector3D getRecoPos3D(const CDCHit* ptrHit) const;
85 
87  double getDriftLength(const CDCHit* ptrHit) const;
88 
91  Vector3D getClosestPrimaryRecoPos3D(const CDCHit* ptrHit) const;
92 
95  double getClosestPrimaryDriftLength(const CDCHit* ptrHit) const;
96 
97  public:
99  const CDCWireHit* getWireHit(const CDCHit* ptrHit,
100  const std::vector<CDCWireHit>& wireHits) const;
101 
103  CDCRLWireHit getRLWireHit(const CDCHit* ptrHit,
104  const std::vector<CDCWireHit>& wireHits) const;
105 
107  CDCRecoHit3D getRecoHit3D(const CDCHit* ptrHit,
108  const std::vector<CDCWireHit>& wireHits) const;
109 
112  const std::vector<CDCWireHit>& wireHits) const;
113 
115  CDCRecoHit2D getRecoHit2D(const CDCHit* ptrHit,
116  const std::vector<CDCWireHit>& wireHits) const;
117 
120  const std::vector<CDCWireHit>& wireHits) const;
121 
122  private:
124  const CDCMCMap* m_ptrMCMap;
125 
127  std::map<const CDCHit*, MayBePtr<const CDCSimHit> > m_primarySimHits;
128 
130  std::map<const CDCHit*, ERightLeft> m_rightLeftInfos;
131 
132  };
133  }
135 }
Belle2::TrackFindingCDC::CDCSimHitLookUp::getInstance
static const CDCSimHitLookUp & getInstance()
Getter for the singletone instance.
Definition: CDCSimHitLookUp.cc:33
Belle2::Vector3D
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition: Cell.h:35
Belle2::TrackFindingCDC::CDCRecoHit3D
Class representing a three dimensional reconstructed hit.
Definition: CDCRecoHit3D.h:62
Belle2::TrackFindingCDC::CDCSimHitLookUp::getDriftLength
double getDriftLength(const CDCHit *ptrHit) const
Look up the drift length from the primary ionisation to the wire from related simulated hit.
Definition: CDCSimHitLookUp.cc:262
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::CDCSimHitLookUp::getDirectionOfFlight
Vector3D getDirectionOfFlight(const CDCHit *ptrHit)
Calculate the local direction of flight. If the hit is secondary take the direction of flight from a ...
Definition: CDCSimHitLookUp.cc:178
Belle2::TrackFindingCDC::CDCSimHitLookUp::getRLWireHit
CDCRLWireHit getRLWireHit(const CDCHit *ptrHit, const std::vector< CDCWireHit > &wireHits) const
Retrieve the wire hit including right left passage information for the given CDCHit form the given wi...
Definition: CDCSimHitLookUp.cc:315
Belle2::TrackFindingCDC::CDCSimHitLookUp::CDCSimHitLookUp
CDCSimHitLookUp()=default
Default constructor - for cppcheck.
Belle2::TrackFindingCDC::CDCSimHitLookUp::clear
void clear()
Clear all information from the last event.
Definition: CDCSimHitLookUp.cc:38
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::TrackFindingCDC::CDCSimHitLookUp::fill
void fill(const CDCMCMap *ptrMCMap)
Gather the information about the right left passage using the CDCMCMap.
Definition: CDCSimHitLookUp.cc:46
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::CDCSimHitLookUp::getClosestPrimaryRecoHit2D
CDCRecoHit2D getClosestPrimaryRecoHit2D(const CDCHit *ptrHit, const std::vector< CDCWireHit > &wireHits) const
Construct an CDCRecoHit2D from the closest primary CDCSimHit information related to the CDCHit.
Definition: CDCSimHitLookUp.cc:353
Belle2::TrackFindingCDC::CDCRecoHit2D
Class representing a two dimensional reconstructed hit in the central drift chamber.
Definition: CDCRecoHit2D.h:57
Belle2::TrackFindingCDC::CDCSimHitLookUp::m_primarySimHits
std::map< const CDCHit *, MayBePtr< const CDCSimHit > > m_primarySimHits
Memory for the look up relation of close primary CDCSimHits.
Definition: CDCSimHitLookUp.h:135
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::CDCRLWireHit
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Definition: CDCRLWireHit.h:51
Belle2::TrackFindingCDC::Vector3D
A three dimensional vector.
Definition: Vector3D.h:34
Belle2::TrackFindingCDC::CDCSimHitLookUp::getRecoHit2D
CDCRecoHit2D getRecoHit2D(const CDCHit *ptrHit, const std::vector< CDCWireHit > &wireHits) const
Construct an CDCRecoHit2D from the (potential secondary) CDCSimHit information related to the CDCHit.
Definition: CDCSimHitLookUp.cc:346
Belle2::TrackFindingCDC::CDCSimHitLookUp::getClosestPrimaryDriftLength
double getClosestPrimaryDriftLength(const CDCHit *ptrHit) const
Look up the drift length from the primary ionisation to the wire from related simulated hit.
Definition: CDCSimHitLookUp.cc:291
Belle2::TrackFindingCDC::CDCSimHitLookUp::getClosestPrimaryRecoHit3D
CDCRecoHit3D getClosestPrimaryRecoHit3D(const CDCHit *ptrHit, const std::vector< CDCWireHit > &wireHits) const
Construct an CDCRecoHit3D from the closest primary CDCSimHit information related to the CDCHit.
Definition: CDCSimHitLookUp.cc:336
Belle2::TrackFindingCDC::CDCSimHitLookUp
Singletone class to gather local information about the hits.
Definition: CDCSimHitLookUp.h:50
Belle2::TrackFindingCDC::NRightLeft::ERightLeft
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition: ERightLeft.h:35
Belle2::TrackFindingCDC::CDCSimHitLookUp::getRecoHit3D
CDCRecoHit3D getRecoHit3D(const CDCHit *ptrHit, const std::vector< CDCWireHit > &wireHits) const
Construct an CDCRecoHit3D from the (potential secondary) CDCSimHit information related to the CDCHit.
Definition: CDCSimHitLookUp.cc:325
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::CDCSimHitLookUp::getWireHit
const CDCWireHit * getWireHit(const CDCHit *ptrHit, const std::vector< CDCWireHit > &wireHits) const
Retrieve the wire hit the given CDCHit form the given wire hits.
Definition: CDCSimHitLookUp.cc:302
Belle2::TrackFindingCDC::CDCWireHit
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:65
Belle2::TrackFindingCDC::CDCSimHitLookUp::m_rightLeftInfos
std::map< const CDCHit *, ERightLeft > m_rightLeftInfos
Memory for the look up relation of the right left passage information as defined in tracking.
Definition: CDCSimHitLookUp.h:138
Belle2::TrackFindingCDC::CDCSimHitLookUp::m_ptrMCMap
const CDCMCMap * m_ptrMCMap
Reference to the CDCMCMap to be used in this event.
Definition: CDCSimHitLookUp.h:132
Belle2::TrackFindingCDC::CDCMCMap
Class to organize and present the monte carlo hit information.
Definition: CDCMCMap.h:38
Belle2::TrackFindingCDC::CDCSimHitLookUp::fillRLInfo
void fillRLInfo()
Construct the look up relation for the right left passage information as used in track finding.
Definition: CDCSimHitLookUp.cc:210
Belle2::TrackFindingCDC::CDCSimHitLookUp::fillPrimarySimHits
void fillPrimarySimHits()
Constructs the relation from reassigned secondary to a close by primary hit from the same MCParticle.
Definition: CDCSimHitLookUp.cc:59
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