Belle II Software  release-08-01-10
VXDSimHit.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 #ifndef VXD_DATAOBJECTS_VXDSIMHIT_H
11 #define VXD_DATAOBJECTS_VXDSIMHIT_H
12 
13 #include <simulation/dataobjects/SimHitBase.h>
14 #include <vxd/dataobjects/VxdID.h>
15 #include <Math/Vector3D.h>
16 #include <vector>
17 #include <algorithm>
18 
19 namespace Belle2 {
30  class VXDSimHit : public SimHitBase {
31  public:
34 
42  VXDSimHit(VxdID sensorID, int pdg, float globalTime, const float* posIn, const float* posOut):
43  SimHitBase(), m_pdg(pdg), m_globalTime(globalTime), m_sensorID(sensorID)
44  {
45  std::copy_n(posIn, 3, m_posIn);
46  std::copy_n(posOut, 3, m_posOut);
47  }
48 
59  void setEnergyDeposit(std::vector<unsigned int>& electronProfile)
60  {
61  m_electronProfile.clear();
62  std::swap(m_electronProfile, electronProfile);
63  }
64 
66  VxdID getSensorID() const { return m_sensorID; }
68  int getPDGcode() const { return m_pdg; }
70  ROOT::Math::XYZVector getPosIn() const { return ROOT::Math::XYZVector(m_posIn[0], m_posIn[1], m_posIn[2]); }
72  ROOT::Math::XYZVector getPosOut() const { return ROOT::Math::XYZVector(m_posOut[0], m_posOut[1], m_posOut[2]); }
74  const float* getPosArrayIn() const { return m_posIn; }
76  const float* getPosArrayOut() const { return m_posOut; }
78  float getGlobalTime() const override { return m_globalTime; }
82  virtual void shiftInTime(float delta) override { m_globalTime += delta; }
83 
85  float getElectrons() const;
86 
94  std::vector<std::pair<float, float> > getElectronProfile() const;
95 
108  std::vector<std::pair<float, float> > getElectronsConstantDistance(double length) const;
109 
121  std::vector<std::pair<float, float> > getElectronsConstantNumber(double electronsPerStep) const;
122 
123  private:
125  std::vector<unsigned int> m_electronProfile;
127  int m_pdg;
131  float m_posIn[3];
133  float m_posOut[3];
135  unsigned short m_sensorID;
136 
137  ClassDefOverride(VXDSimHit, 1)
138  };
140 } // end namespace Belle2
141 
142 #endif
Class SimHitBase - A common base for subdetector SimHits.
Definition: SimHitBase.h:28
Class VXDSimHit - Geant4 simulated hit for the VXD.
Definition: VXDSimHit.h:30
std::vector< unsigned int > m_electronProfile
Energy depsoition profile encoded using the ElectronDeposit class.
Definition: VXDSimHit.h:125
float m_globalTime
Time of electron deposition.
Definition: VXDSimHit.h:129
float m_posOut[3]
End point of electron deposition in local coordinates.
Definition: VXDSimHit.h:133
unsigned short m_sensorID
ID of the sensor the electron was deposited in.
Definition: VXDSimHit.h:135
float getGlobalTime() const override
Return the time of the electron deposition.
Definition: VXDSimHit.h:78
int getPDGcode() const
Return the PDG code of the particle causing the electron deposition.
Definition: VXDSimHit.h:68
void setEnergyDeposit(std::vector< unsigned int > &electronProfile)
Set energy deposition profile To avoid copying of the entries this will take over the contents of the...
Definition: VXDSimHit.h:59
VXDSimHit()
default constructor for ROOT
Definition: VXDSimHit.h:33
float m_posIn[3]
Start point of electron deposition in local coordinates.
Definition: VXDSimHit.h:131
int m_pdg
PDG Code of the particle producing the Hit.
Definition: VXDSimHit.h:127
ROOT::Math::XYZVector getPosOut() const
Return the end point of the electron deposition in local coordinates.
Definition: VXDSimHit.h:72
std::vector< std::pair< float, float > > getElectronsConstantDistance(double length) const
Get the electron deposition along constant stepsize.
Definition: VXDSimhit.cc:32
float getElectrons() const
Return the number of created electrons.
Definition: VXDSimhit.cc:15
std::vector< std::pair< float, float > > getElectronProfile() const
Get the decoded electron profile.
Definition: VXDSimhit.cc:21
ROOT::Math::XYZVector getPosIn() const
Return the start point of the electron deposition in local coordinates.
Definition: VXDSimHit.h:70
const float * getPosArrayIn() const
Return the start point of the electron deposition in local coordinates as float array.
Definition: VXDSimHit.h:74
VxdID getSensorID() const
Return the sensorID of the sensor the electron was deposited in.
Definition: VXDSimHit.h:66
VXDSimHit(VxdID sensorID, int pdg, float globalTime, const float *posIn, const float *posOut)
Standard constructor.
Definition: VXDSimHit.h:42
std::vector< std::pair< float, float > > getElectronsConstantNumber(double electronsPerStep) const
Get the electron deposition with constant number of electrons between sampling points.
Definition: VXDSimhit.cc:66
virtual void shiftInTime(float delta) override
Shift the SimHit in time.
Definition: VXDSimHit.h:82
const float * getPosArrayOut() const
Return the end point of the electron deposition in local coordinates as float array.
Definition: VXDSimHit.h:76
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
Abstract base class for different kinds of events.