Belle II Software development
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
11#include <simulation/dataobjects/SimHitBase.h>
12#include <vxd/dataobjects/VxdID.h>
13#include <Math/Vector3D.h>
14#include <vector>
15#include <algorithm>
16
17namespace Belle2 {
28 class VXDSimHit : public SimHitBase {
29 public:
32
40 VXDSimHit(VxdID sensorID, int pdg, float globalTime, const float* posIn, const float* posOut):
41 SimHitBase(), m_pdg(pdg), m_globalTime(globalTime), m_sensorID(sensorID)
42 {
43 std::copy_n(posIn, 3, m_posIn);
44 std::copy_n(posOut, 3, m_posOut);
45 }
46
57 void setEnergyDeposit(std::vector<unsigned int>& electronProfile)
58 {
59 m_electronProfile.clear();
60 std::swap(m_electronProfile, electronProfile);
61 }
62
64 VxdID getSensorID() const { return m_sensorID; }
66 int getPDGcode() const { return m_pdg; }
68 ROOT::Math::XYZVector getPosIn() const { return ROOT::Math::XYZVector(m_posIn[0], m_posIn[1], m_posIn[2]); }
70 ROOT::Math::XYZVector getPosOut() const { return ROOT::Math::XYZVector(m_posOut[0], m_posOut[1], m_posOut[2]); }
72 const float* getPosArrayIn() const { return m_posIn; }
74 const float* getPosArrayOut() const { return m_posOut; }
76 float getGlobalTime() const override { return m_globalTime; }
80 virtual void shiftInTime(float delta) override { m_globalTime += delta; }
81
83 float getElectrons() const;
84
92 std::vector<std::pair<float, float> > getElectronProfile() const;
93
106 std::vector<std::pair<float, float> > getElectronsConstantDistance(double length) const;
107
119 std::vector<std::pair<float, float> > getElectronsConstantNumber(double electronsPerStep) const;
120
121 private:
123 std::vector<unsigned int> m_electronProfile;
125 float m_posIn[3];
127 float m_posOut[3];
129 int m_pdg;
133 unsigned short m_sensorID;
134
135 ClassDefOverride(VXDSimHit, 2)
136 };
137
138} // end namespace Belle2
SimHitBase()
Constructor.
Definition SimHitBase.h:33
std::vector< unsigned int > m_electronProfile
Energy depsoition profile encoded using the ElectronDeposit class.
Definition VXDSimHit.h:123
float m_globalTime
Time of electron deposition.
Definition VXDSimHit.h:131
const float * getPosArrayIn() const
Return the start point of the electron deposition in local coordinates as float array.
Definition VXDSimHit.h:72
float m_posOut[3]
End point of electron deposition in local coordinates.
Definition VXDSimHit.h:127
unsigned short m_sensorID
ID of the sensor the electron was deposited in.
Definition VXDSimHit.h:133
float getGlobalTime() const override
Return the time of the electron deposition.
Definition VXDSimHit.h:76
int getPDGcode() const
Return the PDG code of the particle causing the electron deposition.
Definition VXDSimHit.h:66
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:57
VXDSimHit()
default constructor for ROOT
Definition VXDSimHit.h:31
float m_posIn[3]
Start point of electron deposition in local coordinates.
Definition VXDSimHit.h:125
int m_pdg
PDG Code of the particle producing the Hit.
Definition VXDSimHit.h:129
ROOT::Math::XYZVector getPosOut() const
Return the end point of the electron deposition in local coordinates.
Definition VXDSimHit.h:70
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:68
VxdID getSensorID() const
Return the sensorID of the sensor the electron was deposited in.
Definition VXDSimHit.h:64
VXDSimHit(VxdID sensorID, int pdg, float globalTime, const float *posIn, const float *posOut)
Standard constructor.
Definition VXDSimHit.h:40
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:80
const float * getPosArrayOut() const
Return the end point of the electron deposition in local coordinates as float array.
Definition VXDSimHit.h:74
Class to uniquely identify a any structure of the PXD and SVD.
Definition VxdID.h:32
Abstract base class for different kinds of events.