Belle II Software  release-08-01-10
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 <Math/Vector3D.h>
14 #include <Math/Point3D.h>
15 #include <TMatrixDSym.h>
16 #include <TVector3.h>
17 #include <G4ThreeVector.hh>
18 #include <G4ErrorSymMatrix.hh>
19 
20 namespace Belle2 {
27  enum ExtHitStatus { EXT_FIRST = -1, EXT_ENTER, EXT_EXIT, EXT_STOP, EXT_ESCAPE,
28  EXT_ECLCROSS, EXT_ECLDL, EXT_ECLNEAR
29  };
30 
32  class ExtHit : public RelationsObject {
33 
34  public:
35 
37  ExtHit();
38 
49  ExtHit(int pdgCode, Const::EDetector detector, int element, ExtHitStatus status, bool backwardPropagation, double t,
50  const ROOT::Math::XYZPoint& r, const ROOT::Math::XYZVector& p, const TMatrixDSym& e);
51 
62  ExtHit(int pdgCode, Const::EDetector detector, int element, ExtHitStatus status, bool backwardPropagation, double t,
63  const G4ThreeVector& r, const G4ThreeVector& p, const G4ErrorSymMatrix& e);
64 
66  ExtHit(const ExtHit&);
67 
69  ExtHit& operator=(const ExtHit&);
70 
72  virtual ~ExtHit() {}
73 
75  void setPDGCode(int pdgCode) { m_PdgCode = pdgCode; }
76 
78  void setDetectorID(Const::EDetector detectorID) { m_DetectorID = detectorID; }
79 
81  void setCopyID(int copyID) { m_CopyID = copyID; }
82 
84  void setBackwardPropagation(bool backwardPropagation) { m_BackwardPropagation = backwardPropagation; }
85 
87  void setStatus(ExtHitStatus extHitStatus) { m_Status = extHitStatus; }
88 
90  void setTOF(double tof) { m_TOF = tof; }
91 
93  void setPosition(const ROOT::Math::XYZVector& position)
94  {
95  m_Position[0] = position.x();
96  m_Position[1] = position.y();
97  m_Position[2] = position.z();
98  }
99 
101  void setMomentum(const ROOT::Math::XYZVector& momentum)
102  {
103  m_Momentum[0] = momentum.x();
104  m_Momentum[1] = momentum.y();
105  m_Momentum[2] = momentum.z();
106  }
107 
109  void setCovariance(double covArray[21])
110  {
111  for (int k = 0; k < 21; ++k) {
112  m_Covariance[k] = covArray[k];
113  }
114  }
115 
118  int getPdgCode() const { return m_PdgCode; }
119 
123 
126  int getCopyID() const { return m_CopyID; }
127 
130  ExtHitStatus getStatus() const { return m_Status; }
131 
134 
137  double getTOF() const { return m_TOF; }
138 
141  double getLength() const { return m_TOF; }
142 
145  ROOT::Math::XYZVector getPosition() const
146  {
147  return ROOT::Math::XYZVector(m_Position[0], m_Position[1], m_Position[2]);
148  }
149 
152  TVector3 getPositionTVector3() const
153  {
154  return TVector3(m_Position[0], m_Position[1], m_Position[2]);
155  }
156 
159  ROOT::Math::XYZVector getMomentum() const
160  {
161  return ROOT::Math::XYZVector(m_Momentum[0], m_Momentum[1], m_Momentum[2]);
162  }
163 
166  TVector3 getMomentumTVector3() const
167  {
168  return TVector3(m_Momentum[0], m_Momentum[1], m_Momentum[2]);
169  }
170 
173  TMatrixDSym getCovariance() const;
174 
181  void update(ExtHitStatus status, double t,
182  const G4ThreeVector& r, const G4ThreeVector& p, const G4ErrorSymMatrix& e);
183 
185  double getErrorTheta() const;
186 
188  double getErrorPhi() const;
189 
190  private:
191 
193  double getPolarCovariance(int i) const;
194 
197 
200 
202  int m_CopyID;
203 
206 
209 
211  float m_TOF;
212 
214  float m_Position[3];
215 
217  float m_Momentum[3];
218 
220  float m_Covariance[21];
221 
224 
225  };
227 }
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:32
ExtHit & operator=(const ExtHit &)
Assignment operator.
Definition: ExtHit.cc:110
int m_CopyID
copy ID
Definition: ExtHit.h:202
TVector3 getPositionTVector3() const
Get position of this extrapolation hit.
Definition: ExtHit.h:152
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:84
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:109
int getPdgCode() const
Get PDG code of this extrapolation's hypothesis.
Definition: ExtHit.h:118
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:90
float m_Momentum[3]
momentum (GeV/c)
Definition: ExtHit.h:217
TMatrixDSym getCovariance() const
Get phase-space covariance at this extrapolation hit.
Definition: ExtHit.cc:130
ExtHitStatus getStatus() const
Get state of extrapolation at this hit.
Definition: ExtHit.h:130
int m_PdgCode
PDG code.
Definition: ExtHit.h:196
void setCopyID(int copyID)
Set detector-element ID of sensitive element within detector.
Definition: ExtHit.h:81
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:75
float m_Covariance[21]
phase-space covariance (symmetric 6x6 linearized to 6*(6+1)/2: position & momentum in cm & GeV/c)
Definition: ExtHit.h:220
bool m_BackwardPropagation
Direction of track propagation.
Definition: ExtHit.h:208
int getCopyID() const
Get detector-element ID of sensitive element within detector.
Definition: ExtHit.h:126
Const::EDetector m_DetectorID
detector ID
Definition: ExtHit.h:199
void setPosition(const ROOT::Math::XYZVector &position)
Set position of this extrapolation hit.
Definition: ExtHit.h:93
float m_TOF
time of flight (ns)
Definition: ExtHit.h:211
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:214
virtual ~ExtHit()
Destructor.
Definition: ExtHit.h:72
TVector3 getMomentumTVector3() const
Get momentum at this extrapolation hit.
Definition: ExtHit.h:166
Const::EDetector getDetectorID() const
Get detector ID of this extrapolation hit.
Definition: ExtHit.h:122
ROOT::Math::XYZVector getMomentum() const
Get momentum at this extrapolation hit.
Definition: ExtHit.h:159
ROOT::Math::XYZVector getPosition() const
Get position of this extrapolation hit.
Definition: ExtHit.h:145
void setMomentum(const ROOT::Math::XYZVector &momentum)
Set momentum at this extrapolation hit.
Definition: ExtHit.h:101
void setDetectorID(Const::EDetector detectorID)
Set detector ID of this extrapolation hit.
Definition: ExtHit.h:78
ExtHitStatus m_Status
extrapolation state
Definition: ExtHit.h:205
bool isBackwardPropagated() const
Get the direction of track propagation.
Definition: ExtHit.h:133
void setStatus(ExtHitStatus extHitStatus)
Set state of extrapolation at this hit.
Definition: ExtHit.h:87
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:141
double getTOF() const
Get time of flight from the point of closest approach near the origin to this hit.
Definition: ExtHit.h:137
Defines interface for accessing relations of objects in StoreArray.
ExtHitStatus
Define state of extrapolation for each recorded hit.
Definition: ExtHit.h:27
Abstract base class for different kinds of events.