CMS 3D CMS Logo

BSCG4Hit.cc
Go to the documentation of this file.
1 // File: BscG4Hit.cc
3 // Date: 02.2006
4 // Description: Transient Hit class for the Bsc
7 #include <iostream>
8 
9 BscG4Hit::BscG4Hit(): entry(0.,0.,0.),entrylp(0.,0.,0.),exitlp(0.,0.,0.) {
10  elem = 0.f;
11  hadr = 0.f;
12  theIncidentEnergy = 0.f;
13  theTimeSlice = 0.;
14  theTrackID = -1;
15  theUnitID = 0;
16  thePabs =0.f;
17  theTof=0.f;
18  theEnergyLoss=0.f;
20  theUnitID=0;
21  theTrackID=-1;
22  theThetaAtEntry=-10000.f;
23  thePhiAtEntry=-10000.f;
24  theParentId=0;
25  theProcessId=0;
26 
27  theX = 0.f;
28  theY = 0.f;
29  theZ = 0.f;
30  theVx = 0.f;
31  theVy = 0.f;
32  theVz = 0.f;
33 }
34 
36 
38  theUnitID = right.theUnitID;
39 
40  theTrackID = right.theTrackID;
41  theTof = right.theTof ;
44  thePabs = right.thePabs;
45  elem = right.elem;
46  hadr = right.hadr;
48  theTimeSlice = right.theTimeSlice;
49  entry = right.entry;
50  entrylp = right.entrylp;
51  exitlp = right.exitlp;
54  theParentId = right.theParentId;
55  theProcessId = right.theProcessId;
56 
57  theX = right.theX;
58  theY = right.theY;
59  theZ = right.theZ;
60 
61  theVx = right.theVx;
62  theVy = right.theVy;
63  theVz = right.theVz;
64 }
65 
66 const BscG4Hit& BscG4Hit::operator=(const BscG4Hit &right) {
67  theUnitID = right.theUnitID;
68 
69  theTrackID = right.theTrackID;
70  theTof = right.theTof ;
73  thePabs = right.thePabs;
74  elem = right.elem;
75  hadr = right.hadr;
77  theTimeSlice = right.theTimeSlice;
78  entry = right.entry;
79  entrylp = right.entrylp;
80  exitlp = right.exitlp;
83  theParentId = right.theParentId;
84  theProcessId = right.theProcessId;
85 
86  theX = right.theX;
87  theY = right.theY;
88  theZ = right.theZ;
89 
90  theVx = right.theVx;
91  theVy = right.theVy;
92  theVz = right.theVz;
93 
94  return *this;
95 }
96 
97 void BscG4Hit::setEntry(const G4ThreeVector& v) {
98  entry = v;
99  theX = v.x(); theY = v.y(); theZ = v.z();
100 }
101 
103  elem += aHit.getEM();
104  hadr += aHit.getHadr();
105  theEnergyLoss = elem + hadr;
106 }
107 
109  std::cout << (*this);
110 }
111 
112 void BscG4Hit::addEnergyDeposit(float em, float hd) {
113  elem += em;
114  hadr += hd;
115  theEnergyLoss = elem + hadr;
116 }
117 
118 void BscG4Hit::setHitPosition(const G4ThreeVector& v) {
119  theX = v.x(); theY = v.y(); theZ = v.z();
120 }
121 
122 void BscG4Hit::setVertexPosition(const G4ThreeVector& v) {
123  theVx = v.x(); theVy = v.y(); theVz = v.z();
124 }
125 
126 std::ostream& operator<<(std::ostream& os, const BscG4Hit& hit) {
127  os << " Data of this BscG4Hit are:" << std::endl
128  << " hitEntryLocalP: " << hit.getEntryLocalP() << std::endl
129  << " hitExitLocalP: " << hit.getExitLocalP() << std::endl
130  << " Time slice ID: " << hit.getTimeSliceID() << std::endl
131  << " Time slice : " << hit.getTimeSlice() << std::endl
132  << " Tof : " << hit.getTof() << std::endl
133  << " EnergyDeposit = " << hit.getEnergyDeposit() << std::endl
134  << " elmenergy = " << hit.getEM() << std::endl
135  << " hadrenergy = " << hit.getHadr() << std::endl
136  << " EnergyLoss = " << hit.getEnergyLoss() << std::endl
137  << " ParticleType = " << hit.getParticleType() << std::endl
138  << " Pabs = " << hit.getPabs() << std::endl
139  << " Energy of primary particle (ID = " << hit.getTrackID()
140  << ") = " << hit.getIncidentEnergy() << " (MeV)"<<std::endl
141  << " Entry point in Bsc unit number " << hit.getUnitID()
142  << " is: " << hit.getEntry() << " (mm)" << std::endl;
143  os << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
144  << std::endl;
145  return os;
146 
147 }
148 
149 
float theVx
Definition: BscG4Hit.h:128
void setHitPosition(const G4ThreeVector &)
Definition: BSCG4Hit.cc:118
void setEntry(const G4ThreeVector &xyz)
Definition: BSCG4Hit.cc:97
float theVy
Definition: BscG4Hit.h:129
int getParticleType() const
Definition: BscG4Hit.h:67
float theX
Definition: BscG4Hit.h:115
float theVz
Definition: BscG4Hit.h:130
std::ostream & operator<<(std::ostream &os, const BscG4Hit &hit)
Definition: BSCG4Hit.cc:126
G4ThreeVector entry
Definition: BscG4Hit.h:100
float getIncidentEnergy() const
Definition: BscG4Hit.h:47
int theUnitID
Definition: BscG4Hit.h:113
void Print() override
Definition: BSCG4Hit.cc:108
float getTof() const
Definition: BscG4Hit.h:65
float getPabs() const
Definition: BscG4Hit.h:64
BscG4Hit()
Definition: BSCG4Hit.cc:9
int theProcessId
Definition: BscG4Hit.h:127
int getTrackID() const
Definition: BscG4Hit.h:50
float theEnergyLoss
Definition: BscG4Hit.h:120
float elem
Definition: BscG4Hit.h:107
float theTof
Definition: BscG4Hit.h:119
int getTimeSliceID() const
Definition: BscG4Hit.h:58
int theTrackID
Definition: BscG4Hit.h:110
int theParticleType
Definition: BscG4Hit.h:121
const BscG4Hit & operator=(const BscG4Hit &right)
Definition: BSCG4Hit.cc:66
float hadr
Definition: BscG4Hit.h:108
float thePabs
Definition: BscG4Hit.h:118
const G4ThreeVector & getExitLocalP() const
Definition: BscG4Hit.h:38
const G4ThreeVector & getEntry() const
Definition: BscG4Hit.h:32
float getHadr() const
Definition: BscG4Hit.h:44
float theIncidentEnergy
Definition: BscG4Hit.h:109
float getEM() const
Definition: BscG4Hit.h:41
void addEnergyDeposit(float em, float hd)
Definition: BSCG4Hit.cc:112
float getEnergyDeposit() const
Definition: BscG4Hit.h:62
float theZ
Definition: BscG4Hit.h:117
~BscG4Hit() override
Definition: BSCG4Hit.cc:35
G4ThreeVector exitlp
Definition: BscG4Hit.h:106
void setVertexPosition(const G4ThreeVector &)
Definition: BSCG4Hit.cc:122
int theParentId
Definition: BscG4Hit.h:126
float theThetaAtEntry
Definition: BscG4Hit.h:123
float thePhiAtEntry
Definition: BscG4Hit.h:124
double theTimeSlice
Definition: BscG4Hit.h:111
const G4ThreeVector & getEntryLocalP() const
Definition: BscG4Hit.h:35
G4ThreeVector entrylp
Definition: BscG4Hit.h:105
uint32_t getUnitID() const
Definition: BscG4Hit.h:53
double getTimeSlice() const
Definition: BscG4Hit.h:56
float getEnergyLoss() const
Definition: BscG4Hit.h:66
float theY
Definition: BscG4Hit.h:116