Belle II Software  release-06-02-00
ExtHit.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 
9 #pragma once
10 
11 #include <framework/datastore/RelationsObject.h>
12 #include <framework/gearbox/Const.h>
13 #include <TVector3.h>
14 #include <TMatrixDSym.h>
15 #include <G4ThreeVector.hh>
16 #include <G4ErrorSymMatrix.hh>
17 
18 namespace Belle2 {
25  enum ExtHitStatus { EXT_FIRST = -1, EXT_ENTER, EXT_EXIT, EXT_STOP, EXT_ESCAPE,
26  EXT_ECLCROSS, EXT_ECLDL, EXT_ECLNEAR
27  };
28 
30  class ExtHit : public RelationsObject {
31 
32  public:
33 
35  ExtHit();
36 
47  ExtHit(int pdgCode, Const::EDetector detector, int element, ExtHitStatus status, bool backwardPropagation, double t,
48  const TVector3& r, const TVector3& p, const TMatrixDSym& e);
49 
60  ExtHit(int pdgCode, Const::EDetector detector, int element, ExtHitStatus status, bool backwardPropagation, double t,
61  const G4ThreeVector& r, const G4ThreeVector& p, const G4ErrorSymMatrix& e);
62 
64  ExtHit(const ExtHit&);
65 
67  ExtHit& operator=(const ExtHit&);
68 
70  virtual ~ExtHit() {}
71 
73  void setPDGCode(int pdgCode) { m_PdgCode = pdgCode; }
74 
76  void setDetectorID(Const::EDetector detectorID) { m_DetectorID = detectorID; }
77 
79  void setCopyID(int copyID) { m_CopyID = copyID; }
80 
82  void setBackwardPropagation(bool backwardPropagation) { m_BackwardPropagation = backwardPropagation; }
83 
85  void setStatus(ExtHitStatus extHitStatus) { m_Status = extHitStatus; }
86 
88  void setTOF(double tof) { m_TOF = tof; }
89 
91  void setPosition(const TVector3& position)
92  {
93  m_Position[0] = position.x();
94  m_Position[1] = position.y();
95  m_Position[2] = position.z();
96  }
97 
99  void setMomentum(const TVector3& momentum)
100  {
101  m_Momentum[0] = momentum.x();
102  m_Momentum[1] = momentum.y();
103  m_Momentum[2] = momentum.z();
104  }
105 
107  void setCovariance(double covArray[21])
108  {
109  for (int k = 0; k < 21; ++k) {
110  m_Covariance[k] = covArray[k];
111  }
112  }
113 
116  int getPdgCode() const { return m_PdgCode; }
117 
121 
124  int getCopyID() const { return m_CopyID; }
125 
128  ExtHitStatus getStatus() const { return m_Status; }
129 
132 
135  double getTOF() const { return m_TOF; }
136 
139  double getLength() const { return m_TOF; }
140 
143  TVector3 getPosition() const { return TVector3(m_Position[0], m_Position[1], m_Position[2]); }
144 
147  TVector3 getMomentum() const { return TVector3(m_Momentum[0], m_Momentum[1], m_Momentum[2]); }
148 
151  TMatrixDSym getCovariance() const;
152 
159  void update(ExtHitStatus status, double t,
160  const G4ThreeVector& r, const G4ThreeVector& p, const G4ErrorSymMatrix& e);
161 
163  double getErrorTheta() const;
164 
166  double getErrorPhi() const;
167 
168  private:
169 
171  double getPolarCovariance(int i) const;
172 
175 
178 
180  int m_CopyID;
181 
184 
187 
189  float m_TOF;
190 
192  float m_Position[3];
193 
195  float m_Momentum[3];
196 
198  float m_Covariance[21];
199 
202 
203  };
205 }
EDetector
Enum for identifying the detector components (detector and subdetector).
Definition: Const.h:42
Store one Ext hit as a ROOT object.
Definition: ExtHit.h:30
void setMomentum(const TVector3 &momentum)
Set momentum at this extrapolation hit.
Definition: ExtHit.h:99
ExtHit & operator=(const ExtHit &)
Assignment operator.
Definition: ExtHit.cc:110
int m_CopyID
copy ID
Definition: ExtHit.h:180
double getErrorPhi() const
Get the uncertainty in the azimuthal angle phi (radians)
Definition: ExtHit.cc:169
void setBackwardPropagation(bool backwardPropagation)
Set the direction of track propagation.
Definition: ExtHit.h:82
double getErrorTheta() const
Get the uncertainty in the azimuthal angle phi (radians)
Definition: ExtHit.cc:163
void setCovariance(double covArray[21])
Set phase-space covariance at this extrapolation hit.
Definition: ExtHit.h:107
int getPdgCode() const
Get PDG code of this extrapolation's hypothesis.
Definition: ExtHit.h:116
double getPolarCovariance(int i) const
Get diagonal elemment of the 3x3 position-covariance matrix in polar coordinates (r,...
Definition: ExtHit.cc:174
void setTOF(double tof)
Set time of flight from the point of closest approach near the origin to this hit.
Definition: ExtHit.h:88
float m_Momentum[3]
momentum (GeV/c)
Definition: ExtHit.h:195
TMatrixDSym getCovariance() const
Get phase-space covariance at this extrapolation hit.
Definition: ExtHit.cc:130
void setPosition(const TVector3 &position)
Set position of this extrapolation hit.
Definition: ExtHit.h:91
ExtHitStatus getStatus() const
Get state of extrapolation at this hit.
Definition: ExtHit.h:128
int m_PdgCode
PDG code.
Definition: ExtHit.h:174
TVector3 getMomentum() const
Get momentum at this extrapolation hit.
Definition: ExtHit.h:147
void setCopyID(int copyID)
Set detector-element ID of sensitive element within detector.
Definition: ExtHit.h:79
void update(ExtHitStatus status, double t, const G4ThreeVector &r, const G4ThreeVector &p, const G4ErrorSymMatrix &e)
Update the parameters of this extrapolation hit.
Definition: ExtHit.cc:143
void setPDGCode(int pdgCode)
Set PDG code of this extrapolation's hypothesis.
Definition: ExtHit.h:73
float m_Covariance[21]
phase-space covariance (symmetric 6x6 linearized to 6*(6+1)/2: position & momentum in cm & GeV/c)
Definition: ExtHit.h:198
bool m_BackwardPropagation
Direction of track propagation.
Definition: ExtHit.h:186
int getCopyID() const
Get detector-element ID of sensitive element within detector.
Definition: ExtHit.h:124
Const::EDetector m_DetectorID
detector ID
Definition: ExtHit.h:177
float m_TOF
time of flight (ns)
Definition: ExtHit.h:189
ExtHit()
Empty constructor for ROOT IO (needed to make the class storable)
Definition: ExtHit.cc:19
float m_Position[3]
position (cm)
Definition: ExtHit.h:192
virtual ~ExtHit()
Destructor.
Definition: ExtHit.h:70
TVector3 getPosition() const
Get position of this extrapolation hit.
Definition: ExtHit.h:143
Const::EDetector getDetectorID() const
Get detector ID of this extrapolation hit.
Definition: ExtHit.h:120
void setDetectorID(Const::EDetector detectorID)
Set detector ID of this extrapolation hit.
Definition: ExtHit.h:76
ExtHitStatus m_Status
extrapolation state
Definition: ExtHit.h:183
bool isBackwardPropagated() const
Get the direction of track propagation.
Definition: ExtHit.h:131
void setStatus(ExtHitStatus extHitStatus)
Set state of extrapolation at this hit.
Definition: ExtHit.h:85
ClassDef(ExtHit, 8)
Needed to make the ROOT object storable.
double getLength() const
Get path length from start of extrapolation to closest approach to ECL cluster (for EXT_ECLDL only)
Definition: ExtHit.h:139
double getTOF() const
Get time of flight from the point of closest approach near the origin to this hit.
Definition: ExtHit.h:135
Defines interface for accessing relations of objects in StoreArray.
ExtHitStatus
Define state of extrapolation for each recorded hit.
Definition: ExtHit.h:25
Abstract base class for different kinds of events.