Belle II Software  release-05-02-19
VXDSimHit.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010-2014 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Andreas Moll, Peter Kvasnicka, Martin Ritter *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 #ifndef VXD_DATAOBJECTS_VXDSIMHIT_H
13 #define VXD_DATAOBJECTS_VXDSIMHIT_H
14 
15 #include <simulation/dataobjects/SimHitBase.h>
16 #include <vxd/dataobjects/VxdID.h>
17 #include <TVector3.h>
18 #include <vector>
19 #include <algorithm>
20 
21 namespace Belle2 {
32  class VXDSimHit : public SimHitBase {
33  public:
36 
44  VXDSimHit(VxdID sensorID, int pdg, float globalTime, const float* posIn, const float* posOut):
45  SimHitBase(), m_pdg(pdg), m_globalTime(globalTime), m_sensorID(sensorID)
46  {
47  std::copy_n(posIn, 3, m_posIn);
48  std::copy_n(posOut, 3, m_posOut);
49  }
50 
61  void setEnergyDeposit(std::vector<unsigned int>& electronProfile)
62  {
63  m_electronProfile.clear();
64  std::swap(m_electronProfile, electronProfile);
65  }
66 
68  VxdID getSensorID() const { return m_sensorID; }
70  int getPDGcode() const { return m_pdg; }
72  TVector3 getPosIn() const { return TVector3(m_posIn[0], m_posIn[1], m_posIn[2]); }
74  TVector3 getPosOut() const { return TVector3(m_posOut[0], m_posOut[1], m_posOut[2]); }
76  const float* getPosArrayIn() const { return m_posIn; }
78  const float* getPosArrayOut() const { return m_posOut; }
80  float getGlobalTime() const override { return m_globalTime; }
84  virtual void shiftInTime(float delta) override { m_globalTime += delta; }
85 
87  float getElectrons() const;
88 
96  std::vector<std::pair<float, float> > getElectronProfile() const;
97 
110  std::vector<std::pair<float, float> > getElectronsConstantDistance(double length) const;
111 
123  std::vector<std::pair<float, float> > getElectronsConstantNumber(double electronsPerStep) const;
124 
125  private:
127  std::vector<unsigned int> m_electronProfile;
129  int m_pdg;
133  float m_posIn[3];
135  float m_posOut[3];
137  unsigned short m_sensorID;
138 
139  ClassDefOverride(VXDSimHit, 1)
140  };
142 } // end namespace Belle2
143 
144 #endif
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
Belle2::VXDSimHit::VXDSimHit
VXDSimHit(VxdID sensorID, int pdg, float globalTime, const float *posIn, const float *posOut)
Standard constructor.
Definition: VXDSimHit.h:44
Belle2::VXDSimHit::m_posOut
float m_posOut[3]
End point of electron deposition in local coordinates.
Definition: VXDSimHit.h:135
Belle2::SimHitBase
Class SimHitBase - A common base for subdetector SimHits.
Definition: SimHitBase.h:38
Belle2::VXDSimHit::getElectrons
float getElectrons() const
Return the number of created electrons.
Definition: VXDSimhit.cc:17
Belle2::VXDSimHit::VXDSimHit
VXDSimHit()
default constructor for ROOT
Definition: VXDSimHit.h:35
Belle2::VXDSimHit::getElectronsConstantNumber
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:68
Belle2::VXDSimHit::m_pdg
int m_pdg
PDG Code of the particle producing the Hit.
Definition: VXDSimHit.h:129
Belle2::VXDSimHit::getPosOut
TVector3 getPosOut() const
Return the end point of the electron deposition in local coordinates.
Definition: VXDSimHit.h:74
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::VXDSimHit::getPosIn
TVector3 getPosIn() const
Return the start point of the electron deposition in local coordinates.
Definition: VXDSimHit.h:72
Belle2::VXDSimHit::getElectronProfile
std::vector< std::pair< float, float > > getElectronProfile() const
Get the decoded electron profile.
Definition: VXDSimhit.cc:23
Belle2::VXDSimHit::getGlobalTime
float getGlobalTime() const override
Return the time of the electron deposition.
Definition: VXDSimHit.h:80
Belle2::VXDSimHit::shiftInTime
virtual void shiftInTime(float delta) override
Shift the SimHit in time.
Definition: VXDSimHit.h:84
Belle2::VXDSimHit::m_electronProfile
std::vector< unsigned int > m_electronProfile
Energy depsoition profile encoded using the ElectronDeposit class.
Definition: VXDSimHit.h:127
Belle2::VXDSimHit::getSensorID
VxdID getSensorID() const
Return the sensorID of the sensor the electron was deposited in.
Definition: VXDSimHit.h:68
Belle2::VXDSimHit::getPosArrayOut
const float * getPosArrayOut() const
Return the end point of the electron deposition in local coordinates as float array.
Definition: VXDSimHit.h:78
Belle2::VXDSimHit::getPosArrayIn
const float * getPosArrayIn() const
Return the start point of the electron deposition in local coordinates as float array.
Definition: VXDSimHit.h:76
Belle2::VXDSimHit::setEnergyDeposit
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:61
Belle2::VXDSimHit::getPDGcode
int getPDGcode() const
Return the PDG code of the particle causing the electron deposition.
Definition: VXDSimHit.h:70
Belle2::VXDSimHit::m_sensorID
unsigned short m_sensorID
ID of the sensor the electron was deposited in.
Definition: VXDSimHit.h:137
Belle2::VXDSimHit::getElectronsConstantDistance
std::vector< std::pair< float, float > > getElectronsConstantDistance(double length) const
Get the electron deposition along constant stepsize.
Definition: VXDSimhit.cc:34
Belle2::VXDSimHit::m_posIn
float m_posIn[3]
Start point of electron deposition in local coordinates.
Definition: VXDSimHit.h:133
Belle2::VXDSimHit::m_globalTime
float m_globalTime
Time of electron deposition.
Definition: VXDSimHit.h:131
Belle2::VXDSimHit
Class VXDSimHit - Geant4 simulated hit for the VXD.
Definition: VXDSimHit.h:32