CMS 3D CMS Logo

CaloG4Hit.cc
Go to the documentation of this file.
1 // File: CaloG4Hit.cc
3 // Description: Transient Hit class for the calorimeters
6 #include <iostream>
7 
8 #include "G4SystemOfUnits.hh"
9 
10 G4ThreadLocal G4Allocator<CaloG4Hit> *fpCaloG4HitAllocator = nullptr;
11 
13 
14  setEntry(0.,0.,0.);
15  setEntryLocal(0.,0.,0.);
16  elem = 0.;
17  hadr = 0.;
18  theIncidentEnergy = 0.;
19 }
20 
22 
24 
25  entry = right.entry;
26  entryLocal = right.entryLocal;
27  pos = right.pos;
28  elem = right.elem;
29  hadr = right.hadr;
31  hitID = right.hitID;
32 }
33 
35 
36  entry = right.entry;
37  entryLocal = right.entryLocal;
38  pos = right.pos;
39  elem = right.elem;
40  hadr = right.hadr;
42  hitID = right.hitID;
43 
44  return *this;
45 }
46 
47 void CaloG4Hit::addEnergyDeposit(double em, double hd) {
48 
49  elem += em ;
50  hadr += hd;
51 }
52 
54 
55  addEnergyDeposit(aHit.getEM(),aHit.getHadr());
56 }
57 
59  LogDebug("CaloSim") << (*this);
60 }
61 
62 std::ostream& operator<<(std::ostream& os, const CaloG4Hit& hit) {
63  os << " Data of this CaloG4Hit are:" << "\n"
64  << " HitID: " << hit.getID() << "\n"
65  << " EnergyDeposit of EM particles = " << hit.getEM() << "\n"
66  << " EnergyDeposit of HD particles = " << hit.getHadr() << "\n"
67  << " Energy of primary particle = " << hit.getIncidentEnergy()/MeV
68  << " (MeV)"<< "\n"
69  << " Entry point in Calorimeter (global) : " << hit.getEntry()
70  << " (local) " << hit.getEntryLocal() << "\n"
71  << " Position of Hit (global) : " << hit.getPosition() << "\n"
72  << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
73  return os;
74 }
75 
76 
#define LogDebug(id)
G4ThreadLocal G4Allocator< CaloG4Hit > * fpCaloG4HitAllocator
Definition: CaloG4Hit.cc:10
math::XYZPoint getPosition() const
Definition: CaloG4Hit.h:56
void setEntryLocal(double x, double y, double z)
Definition: CaloG4Hit.h:54
double getIncidentEnergy() const
Definition: CaloG4Hit.h:65
CaloHitID getID() const
Definition: CaloG4Hit.h:74
const double MeV
void addEnergyDeposit(double em, double hd)
Definition: CaloG4Hit.cc:47
CaloHitID hitID
Definition: CaloG4Hit.h:91
math::XYZPoint entry
Definition: CaloG4Hit.h:85
const CaloG4Hit & operator=(const CaloG4Hit &right)
Definition: CaloG4Hit.cc:34
~CaloG4Hit() override
Definition: CaloG4Hit.cc:21
double hadr
Definition: CaloG4Hit.h:89
math::XYZPoint entryLocal
Definition: CaloG4Hit.h:86
std::ostream & operator<<(std::ostream &os, const CaloG4Hit &hit)
Definition: CaloG4Hit.cc:62
double getEM() const
Definition: CaloG4Hit.h:59
double theIncidentEnergy
Definition: CaloG4Hit.h:90
math::XYZPoint pos
Definition: CaloG4Hit.h:87
void setEntry(double x, double y, double z)
Definition: CaloG4Hit.h:51
double elem
Definition: CaloG4Hit.h:88
math::XYZPoint getEntryLocal() const
Definition: CaloG4Hit.h:53
math::XYZPoint getEntry() const
Definition: CaloG4Hit.h:50
void Print() override
Definition: CaloG4Hit.cc:58
double getHadr() const
Definition: CaloG4Hit.h:62