Belle II Software  release-05-02-19
CDCSimHit.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Heck, Guofu Cao *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #ifndef CDCSIMHIT_H
12 #define CDCSIMHIT_H
13 
14 #include <cdc/dataobjects/WireID.h>
15 #include <simulation/dataobjects/SimHitBase.h>
16 
17 #include <TVector3.h>
18 
19 namespace Belle2 {
24  class CDCSimHit : public SimHitBase {
26 
27  private:
28 
30  WireID m_wireID;
31 
33  unsigned short m_trackId;
34 
36  int m_pdg;
37 
39  float m_driftLength;
40 
42  float m_flightTime;
43 
45  float m_edep;
46 
48  float m_stepLength;
49 
51  // TVector3 m_momentum;
52  float m_momentum[3];
53 
55  // TVector3 m_posWire;
56  float m_posWire[3];
57 
59  // TVector3 m_posIn;
60  float m_posIn[3];
61 
63  // TVector3 m_posOut;
64  float m_posOut[3];
65 
67  // TVector3 m_posTrack;
68  float m_posTrack[3];
69 
76  unsigned char m_leftRight;
77 
79  float m_globalTime;
80 
81 
82  public:
88  void setWireID(int iCLayerID, int iWireID)
89  {
90  m_wireID.setWireID(iCLayerID, iWireID);
91  }
92 
94  void setTrackId(int trackId) { m_trackId = (unsigned short)trackId; }
95 
97  void setPDGCode(int pdg) { m_pdg = pdg; }
98 
100  void setDriftLength(double driftLength) { m_driftLength = driftLength; }
101 
103  void setFlightTime(double flightTime) { m_flightTime = flightTime; }
104 
106  void setGlobalTime(double globalTime) { m_globalTime = globalTime; }
107 
109  void setEnergyDep(double edep) { m_edep = edep; }
110 
112  void setStepLength(double stepLength) { m_stepLength = stepLength; }
113 
115  void setMomentum(TVector3 momentum)
116  {
117  m_momentum[0] = momentum.X();
118  m_momentum[1] = momentum.Y();
119  m_momentum[2] = momentum.Z();
120  }
121 
123  void setPosWire(TVector3 posWire)
124  {
125  m_posWire[0] = posWire.X();
126  m_posWire[1] = posWire.Y();
127  m_posWire[2] = posWire.Z();
128  }
129 
131  void setPosIn(TVector3 posIn)
132  {
133  m_posIn[0] = posIn.X();
134  m_posIn[1] = posIn.Y();
135  m_posIn[2] = posIn.Z();
136  }
137 
139  void setPosOut(TVector3 posOut)
140  {
141  m_posOut[0] = posOut.X();
142  m_posOut[1] = posOut.Y();
143  m_posOut[2] = posOut.Z();
144  }
145 
147  void setPosTrack(TVector3 posTrack)
148  {
149  m_posTrack[0] = posTrack.X();
150  m_posTrack[1] = posTrack.Y();
151  m_posTrack[2] = posTrack.Z();
152  }
153 
158  void setPosFlag(int zeroOrOne)
159  {
160  m_leftRight &= 0x6;
161  m_leftRight = (m_leftRight | (unsigned char)zeroOrOne);
162  }
163 
165  void setLeftRightPassageRaw(int minusOneOrZeroOrOne)
166  {
167  int zeroOrOne = (minusOneOrZeroOrOne <= 0) ? 0 : 1;
168  m_leftRight &= 0x5;
169  m_leftRight = (m_leftRight | ((unsigned char)zeroOrOne << 1));
170  }
171 
173  void setLeftRightPassage(int minusOneOrZeroOrOne)
174  {
175  int zeroOrOne = (minusOneOrZeroOrOne <= 0) ? 0 : 1;
176  m_leftRight &= 0x3;
177  m_leftRight = (m_leftRight | ((unsigned char)zeroOrOne << 2));
178  }
179 
181  WireID getWireID() const {return m_wireID;}
182 
184  int getTrackId() const { return m_trackId; }
185 
187  int getPDGCode() const { return m_pdg; }
188 
190  double getDriftLength() const { return m_driftLength; }
191 
193  double getFlightTime() const { return m_flightTime; }
194 
196  double getEnergyDep() const { return m_edep; }
197 
199  double getStepLength() const { return m_stepLength; }
200 
202  TVector3 getMomentum() const
203  {
204  return TVector3(m_momentum[0], m_momentum[1], m_momentum[2]);
205  }
206 
208  TVector3 getPosWire() const
209  {
210  return TVector3(m_posWire[0], m_posWire[1], m_posWire[2]);
211  }
212 
214  TVector3 getPosIn() const
215  {
216  return TVector3(m_posIn[0], m_posIn[1], m_posIn[2]);
217  }
218 
220  TVector3 getPosOut() const
221  {
222  return TVector3(m_posOut[0], m_posOut[1], m_posOut[2]);
223  }
224 
226  TVector3 getPosTrack() const
227  {
228  return TVector3(m_posTrack[0], m_posTrack[1], m_posTrack[2]);
229  }
230 
232  int getPosFlag() const
233  {
234  return (int)(m_leftRight & 0x1);
235  }
236 
238  int getLeftRightPassageRaw() const
239  {
240  // int minusOneOrOne = (int((m_leftRight & 0x2) >> 1) == 0) ? -1 : 1;
241  // return minusOneOrOne;
242  int zeroOrOne = (int((m_leftRight & 0x2) >> 1) == 0) ? 0 : 1;
243  return zeroOrOne;
244  }
245 
247  int getLeftRightPassage() const
248  {
249  // int minusOneOrOne = (int((m_leftRight & 0x4) >> 2) == 0) ? -1 : 1;
250  // return minusOneOrOne;
251  int zeroOrOne = (int((m_leftRight & 0x4) >> 2) == 0) ? 0 : 1;
252  return zeroOrOne;
253  }
254 
255 
257  float getGlobalTime() const override { return m_globalTime; }
258 
260 
263  CDCSimHit(): SimHitBase(),
264  m_trackId(0), m_pdg(0), m_driftLength(0.0),
265  m_flightTime(0.0), m_edep(0.0), m_stepLength(1.0),
266  m_momentum(), m_posWire(),
267  m_posIn(), m_posOut(), m_posTrack(),
268  m_leftRight(0), m_globalTime(0.0)
269  {}
270 
272  CDCSimHit(int layerId,
273  int wireId,
274  int trackId,
275  int pdg,
276  double driftLength,
277  double flightTime,
278  double edep,
279  double stepLength,
280  TVector3 momentum,
281  TVector3 posWire,
282  TVector3 posIn,
283  TVector3 posOut,
284  TVector3 posTrack,
285  int leftRight,
286  double globalTime): SimHitBase()
287  {
288 
289  m_wireID.setWireID(layerId, wireId);
290  m_trackId = trackId;
291  m_pdg = pdg;
292  m_driftLength = driftLength;
293  m_flightTime = flightTime;
294  m_edep = edep;
295  m_stepLength = stepLength;
296  m_momentum[0] = momentum.X();
297  m_momentum[1] = momentum.Y();
298  m_momentum[2] = momentum.Z();
299  m_posWire[0] = posWire.X();
300  m_posWire[1] = posWire.Y();
301  m_posWire[2] = posWire.Z();
302  m_posIn[0] = posIn.X();
303  m_posIn[1] = posIn.Y();
304  m_posIn[2] = posIn.Z();
305  m_posOut[0] = posOut.X();
306  m_posOut[1] = posOut.Y();
307  m_posOut[2] = posOut.Z();
308  m_posTrack[0] = posTrack.X();
309  m_posTrack[1] = posTrack.Y();
310  m_posTrack[2] = posTrack.Z();
311  m_leftRight = (unsigned char)leftRight & 0x7; // mask 3 bits (LSB).
312  m_globalTime = globalTime;
313  }
314 
318  virtual void shiftInTime(float delta) override
319  {
320  m_globalTime += delta;
321  }
322 
323 
326  };
328 } // end namespace Belle2
329 #endif
Belle2::CDCSimHit::getFlightTime
double getFlightTime() const
The method to get flight time.
Definition: CDCSimHit.h:201
Belle2::CDCSimHit::m_pdg
int m_pdg
Particle PDG (can be one of secondaries).
Definition: CDCSimHit.h:44
Belle2::CDCSimHit::getPosOut
TVector3 getPosOut() const
The method to get position of post-step.
Definition: CDCSimHit.h:228
Belle2::WireID
Class to identify a wire inside the CDC.
Definition: WireID.h:44
Belle2::CDCSimHit::m_trackId
unsigned short m_trackId
The track id of this hit.
Definition: CDCSimHit.h:41
Belle2::CDCSimHit::getLeftRightPassageRaw
int getLeftRightPassageRaw() const
The method to get new left/right info. for digitization.
Definition: CDCSimHit.h:246
Belle2::CDCSimHit::getPosFlag
int getPosFlag() const
The method to get old left/right info.
Definition: CDCSimHit.h:240
Belle2::CDCSimHit::setLeftRightPassage
void setLeftRightPassage(int minusOneOrZeroOrOne)
The method to set new left/right info. for tracking.
Definition: CDCSimHit.h:181
Belle2::CDCSimHit::getPosTrack
TVector3 getPosTrack() const
The method to get position on the track.
Definition: CDCSimHit.h:234
Belle2::CDCSimHit::setPosTrack
void setPosTrack(TVector3 posTrack)
The method to set position on the track.
Definition: CDCSimHit.h:155
Belle2::CDCSimHit::CDCSimHit
CDCSimHit()
Empty constructor.
Definition: CDCSimHit.h:271
Belle2::CDCSimHit::m_edep
float m_edep
Deposited energy of this hit.
Definition: CDCSimHit.h:53
Belle2::CDCSimHit::m_stepLength
float m_stepLength
Step length of this hit.
Definition: CDCSimHit.h:56
Belle2::SimHitBase
Class SimHitBase - A common base for subdetector SimHits.
Definition: SimHitBase.h:38
Belle2::CDCSimHit::setDriftLength
void setDriftLength(double driftLength)
The method to set drift length.
Definition: CDCSimHit.h:108
Belle2::CDCSimHit::m_posOut
float m_posOut[3]
Position of post-step.
Definition: CDCSimHit.h:72
Belle2::CDCSimHit::setStepLength
void setStepLength(double stepLength)
The method to set step length.
Definition: CDCSimHit.h:120
Belle2::CDCSimHit::setWireID
void setWireID(int iCLayerID, int iWireID)
Setter for Wire ID.
Definition: CDCSimHit.h:96
Belle2::CDCSimHit::setPosOut
void setPosOut(TVector3 posOut)
The method to set position of post-step.
Definition: CDCSimHit.h:147
Belle2::CDCSimHit::m_flightTime
float m_flightTime
Flight time from IP.
Definition: CDCSimHit.h:50
Belle2::CDCSimHit::setEnergyDep
void setEnergyDep(double edep)
The method to set deposited energy.
Definition: CDCSimHit.h:117
Belle2::CDCSimHit::getTrackId
int getTrackId() const
The method to get track id.
Definition: CDCSimHit.h:192
Belle2::CDCSimHit::setPDGCode
void setPDGCode(int pdg)
The method to set PDG code.
Definition: CDCSimHit.h:105
Belle2::CDCSimHit::shiftInTime
virtual void shiftInTime(float delta) override
Shift the SimHit in time.
Definition: CDCSimHit.h:326
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::CDCSimHit::setLeftRightPassageRaw
void setLeftRightPassageRaw(int minusOneOrZeroOrOne)
The method to set new left/right info. for digitization.
Definition: CDCSimHit.h:173
Belle2::CDCSimHit::m_posTrack
float m_posTrack[3]
Position on the track.
Definition: CDCSimHit.h:76
Belle2::CDCSimHit::setTrackId
void setTrackId(int trackId)
The method to set track id.
Definition: CDCSimHit.h:102
Belle2::CDCSimHit::m_globalTime
float m_globalTime
Time of energy deposition.
Definition: CDCSimHit.h:87
Belle2::CDCSimHit::setPosFlag
void setPosFlag(int zeroOrOne)
The method to set position flag.
Definition: CDCSimHit.h:166
Belle2::CDCSimHit::getLeftRightPassage
int getLeftRightPassage() const
The method to get new left/right info. for tracking.
Definition: CDCSimHit.h:255
Belle2::CDCSimHit::getGlobalTime
float getGlobalTime() const override
The method to get global time.
Definition: CDCSimHit.h:265
Belle2::CDCSimHit::getDriftLength
double getDriftLength() const
The method to get drift length.
Definition: CDCSimHit.h:198
Belle2::CDCSimHit::m_posWire
float m_posWire[3]
The position on wire which is closest to this hit.
Definition: CDCSimHit.h:64
Belle2::CDCSimHit::setMomentum
void setMomentum(TVector3 momentum)
The method to set momentum.
Definition: CDCSimHit.h:123
Belle2::CDCSimHit::ClassDefOverride
ClassDefOverride(CDCSimHit, 6)
ROOT Macro.
Belle2::CDCSimHit::getPosIn
TVector3 getPosIn() const
The method to get position of pre-step.
Definition: CDCSimHit.h:222
Belle2::CDCSimHit::getPosWire
TVector3 getPosWire() const
The method to get position on wire.
Definition: CDCSimHit.h:216
Belle2::CDCSimHit::setPosIn
void setPosIn(TVector3 posIn)
The method to set position of pre-step.
Definition: CDCSimHit.h:139
Belle2::CDCSimHit::m_driftLength
float m_driftLength
Drift length of this hit.
Definition: CDCSimHit.h:47
Belle2::CDCSimHit::m_momentum
float m_momentum[3]
The momentum at closest point.
Definition: CDCSimHit.h:60
Belle2::CDCSimHit::setGlobalTime
void setGlobalTime(double globalTime)
The method to set global time.
Definition: CDCSimHit.h:114
Belle2::CDCSimHit::m_leftRight
unsigned char m_leftRight
The flag to denote this hit is in the left or right side.
Definition: CDCSimHit.h:84
Belle2::CDCSimHit::setFlightTime
void setFlightTime(double flightTime)
The method to set flight time.
Definition: CDCSimHit.h:111
Belle2::WireID::setWireID
void setWireID(unsigned short iSuperLayer, unsigned short iLayer, unsigned short iWire)
Setter using official numbering.
Definition: WireID.h:122
Belle2::CDCSimHit::getMomentum
TVector3 getMomentum() const
The method to get momentum.
Definition: CDCSimHit.h:210
Belle2::CDCSimHit::getEnergyDep
double getEnergyDep() const
The method to get deposited energy.
Definition: CDCSimHit.h:204
Belle2::CDCSimHit::getWireID
WireID getWireID() const
Getter for WireID object.
Definition: CDCSimHit.h:189
Belle2::CDCSimHit::getPDGCode
int getPDGCode() const
The method to get PDG code.
Definition: CDCSimHit.h:195
Belle2::CDCSimHit::setPosWire
void setPosWire(TVector3 posWire)
The method to set position on wire.
Definition: CDCSimHit.h:131
Belle2::CDCSimHit::getStepLength
double getStepLength() const
The method to get step length.
Definition: CDCSimHit.h:207
Belle2::CDCSimHit::m_wireID
WireID m_wireID
The WireID of the hit.
Definition: CDCSimHit.h:38
Belle2::CDCSimHit::m_posIn
float m_posIn[3]
Position of pre-step.
Definition: CDCSimHit.h:68