Belle II Software  release-05-02-19
ExtHit.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Leo Piilonen *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/datastore/RelationsObject.h>
14 #include <framework/gearbox/Const.h>
15 #include <TVector3.h>
16 #include <TMatrixDSym.h>
17 #include <G4ThreeVector.hh>
18 #include <G4ErrorSymMatrix.hh>
19 
20 namespace Belle2 {
26  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 TVector3& r, const TVector3& 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 TVector3& 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 TVector3& 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 
122  Const::EDetector getDetectorID() const { return m_DetectorID; }
123 
126  int getCopyID() const { return m_CopyID; }
127 
130  ExtHitStatus getStatus() const { return m_Status; }
131 
133  bool isBackwardPropagated() const { return m_BackwardPropagation; }
134 
137  double getTOF() const { return m_TOF; }
138 
141  double getLength() const { return m_TOF; }
142 
145  TVector3 getPosition() const { return TVector3(m_Position[0], m_Position[1], m_Position[2]); }
146 
149  TVector3 getMomentum() const { return TVector3(m_Momentum[0], m_Momentum[1], m_Momentum[2]); }
150 
153  TMatrixDSym getCovariance() const;
154 
161  void update(ExtHitStatus status, double t,
162  const G4ThreeVector& r, const G4ThreeVector& p, const G4ErrorSymMatrix& e);
163 
165  double getErrorTheta() const;
166 
168  double getErrorPhi() const;
169 
170  private:
171 
173  double getPolarCovariance(int i) const;
174 
176  int m_PdgCode;
177 
180 
182  int m_CopyID;
183 
186 
189 
191  float m_TOF;
192 
194  float m_Position[3];
195 
197  float m_Momentum[3];
198 
200  float m_Covariance[21];
201 
203  ClassDef(ExtHit, 8);
204 
205  };
207 }
Belle2::ExtHit::m_TOF
float m_TOF
time of flight (ns)
Definition: ExtHit.h:199
Belle2::ExtHit::getPdgCode
int getPdgCode() const
Get PDG code of this extrapolation's hypothesis.
Definition: ExtHit.h:126
Belle2::ExtHit::getPosition
TVector3 getPosition() const
Get position of this extrapolation hit.
Definition: ExtHit.h:153
Belle2::ExtHit::m_Momentum
float m_Momentum[3]
momentum (GeV/c)
Definition: ExtHit.h:205
Belle2::ExtHit::getErrorPhi
double getErrorPhi() const
Get the uncertainty in the azimuthal angle phi (radians)
Definition: ExtHit.cc:171
Belle2::ExtHit::ClassDef
ClassDef(ExtHit, 8)
Needed to make the ROOT object storable.
Belle2::ExtHit::getDetectorID
Const::EDetector getDetectorID() const
Get detector ID of this extrapolation hit.
Definition: ExtHit.h:130
Belle2::ExtHit::setMomentum
void setMomentum(const TVector3 &momentum)
Set momentum at this extrapolation hit.
Definition: ExtHit.h:109
Belle2::ExtHit::m_DetectorID
Const::EDetector m_DetectorID
detector ID
Definition: ExtHit.h:187
Belle2::ExtHit::setTOF
void setTOF(double tof)
Set time of flight from the point of closest approach near the origin to this hit.
Definition: ExtHit.h:98
Belle2::ExtHit::ExtHit
ExtHit()
Empty constructor for ROOT IO (needed to make the class storable)
Definition: ExtHit.cc:21
Belle2::ExtHit::setCovariance
void setCovariance(double covArray[21])
Set phase-space covariance at this extrapolation hit.
Definition: ExtHit.h:117
Belle2::ExtHit::getTOF
double getTOF() const
Get time of flight from the point of closest approach near the origin to this hit.
Definition: ExtHit.h:145
Belle2::ExtHit::~ExtHit
virtual ~ExtHit()
Destructor.
Definition: ExtHit.h:80
Belle2::ExtHit::setStatus
void setStatus(ExtHitStatus extHitStatus)
Set state of extrapolation at this hit.
Definition: ExtHit.h:95
Belle2::Const::EDetector
EDetector
Enum for identifying the detector components (detector and subdetector).
Definition: Const.h:44
Belle2::ExtHitStatus
ExtHitStatus
Define state of extrapolation for each recorded hit.
Definition: ExtHit.h:35
Belle2::ExtHit::m_Position
float m_Position[3]
position (cm)
Definition: ExtHit.h:202
Belle2::ExtHit::setPosition
void setPosition(const TVector3 &position)
Set position of this extrapolation hit.
Definition: ExtHit.h:101
Belle2::ExtHit
Store one Ext hit as a ROOT object.
Definition: ExtHit.h:40
Belle2::ExtHit::getStatus
ExtHitStatus getStatus() const
Get state of extrapolation at this hit.
Definition: ExtHit.h:138
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ExtHit::setDetectorID
void setDetectorID(Const::EDetector detectorID)
Set detector ID of this extrapolation hit.
Definition: ExtHit.h:86
Belle2::ExtHit::setBackwardPropagation
void setBackwardPropagation(bool backwardPropagation)
Set the direction of track propagation.
Definition: ExtHit.h:92
Belle2::ExtHit::m_CopyID
int m_CopyID
copy ID
Definition: ExtHit.h:190
Belle2::ExtHit::setPDGCode
void setPDGCode(int pdgCode)
Set PDG code of this extrapolation's hypothesis.
Definition: ExtHit.h:83
Belle2::ExtHit::getPolarCovariance
double getPolarCovariance(int i) const
Get diagonal elemment of the 3x3 position-covariance matrix in polar coordinates (r,...
Definition: ExtHit.cc:176
Belle2::ExtHit::m_PdgCode
int m_PdgCode
PDG code.
Definition: ExtHit.h:184
Belle2::ExtHit::m_BackwardPropagation
bool m_BackwardPropagation
Direction of track propagation.
Definition: ExtHit.h:196
Belle2::ExtHit::m_Covariance
float m_Covariance[21]
phase-space covariance (symmetric 6x6 linearized to 6*(6+1)/2: position & momentum in cm & GeV/c)
Definition: ExtHit.h:208
Belle2::ExtHit::m_Status
ExtHitStatus m_Status
extrapolation state
Definition: ExtHit.h:193
Belle2::ExtHit::getCopyID
int getCopyID() const
Get detector-element ID of sensitive element within detector.
Definition: ExtHit.h:134
Belle2::RelationsObject
RelationsInterface< TObject > RelationsObject
Provides interface for getting/adding relations to objects in StoreArrays.
Definition: RelationsObject.h:443
Belle2::ExtHit::update
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:145
Belle2::ExtHit::getMomentum
TVector3 getMomentum() const
Get momentum at this extrapolation hit.
Definition: ExtHit.h:157
Belle2::ExtHit::operator=
ExtHit & operator=(const ExtHit &)
Assignment operator.
Definition: ExtHit.cc:112
Belle2::ExtHit::getLength
double getLength() const
Get path length from start of extrapolation to closest approach to ECL cluster (for EXT_ECLDL only)
Definition: ExtHit.h:149
Belle2::ExtHit::getErrorTheta
double getErrorTheta() const
Get the uncertainty in the azimuthal angle phi (radians)
Definition: ExtHit.cc:165
Belle2::ExtHit::isBackwardPropagated
bool isBackwardPropagated() const
Get the direction of track propagation.
Definition: ExtHit.h:141
Belle2::ExtHit::setCopyID
void setCopyID(int copyID)
Set detector-element ID of sensitive element within detector.
Definition: ExtHit.h:89
Belle2::ExtHit::getCovariance
TMatrixDSym getCovariance() const
Get phase-space covariance at this extrapolation hit.
Definition: ExtHit.cc:132