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
7 #include <iostream>
8 
9 #include "G4SystemOfUnits.hh"
10 
11 G4ThreadLocal G4Allocator<CaloG4Hit>* fpCaloG4HitAllocator = nullptr;
12 
14  setEntry(0., 0., 0.);
15  setEntryLocal(0., 0., 0.);
16  elem = 0.;
17  hadr = 0.;
18  theIncidentEnergy = 0.;
19 }
20 
22 
24  entry = right.entry;
25  entryLocal = right.entryLocal;
26  pos = right.pos;
27  elem = right.elem;
28  hadr = right.hadr;
30  hitID = right.hitID;
31 }
32 
34  entry = right.entry;
35  entryLocal = right.entryLocal;
36  pos = right.pos;
37  elem = right.elem;
38  hadr = right.hadr;
40  hitID = right.hitID;
41 
42  return *this;
43 }
44 
45 void CaloG4Hit::addEnergyDeposit(double em, double hd) {
46  elem += em;
47  hadr += hd;
48 }
49 
50 void CaloG4Hit::addEnergyDeposit(const CaloG4Hit& aHit) { addEnergyDeposit(aHit.getEM(), aHit.getHadr()); }
51 
52 void CaloG4Hit::Print() { edm::LogVerbatim("CaloSim") << (*this); }
53 
54 std::ostream& operator<<(std::ostream& os, const CaloG4Hit& hit) {
55  os << " Data of this CaloG4Hit are:"
56  << "\n"
57  << " HitID: " << hit.getID() << "\n"
58  << " EnergyDeposit of EM particles = " << hit.getEM() << "\n"
59  << " EnergyDeposit of HD particles = " << hit.getHadr() << "\n"
60  << " Energy of primary particle = " << hit.getIncidentEnergy() / MeV << " (MeV)"
61  << "\n"
62  << " Entry point in Calorimeter (global) : " << hit.getEntry() << " (local) " << hit.getEntryLocal() << "\n"
63  << " Position of Hit (global) : " << hit.getPosition() << "\n"
64  << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
65  return os;
66 }
Log< level::Info, true > LogVerbatim
G4ThreadLocal G4Allocator< CaloG4Hit > * fpCaloG4HitAllocator
Definition: CaloG4Hit.cc:11
double getEM() const
Definition: CaloG4Hit.h:55
void setEntryLocal(double x, double y, double z)
Definition: CaloG4Hit.h:50
double getHadr() const
Definition: CaloG4Hit.h:58
void addEnergyDeposit(double em, double hd)
Definition: CaloG4Hit.cc:45
CaloHitID hitID
Definition: CaloG4Hit.h:88
math::XYZPoint entry
Definition: CaloG4Hit.h:82
const CaloG4Hit & operator=(const CaloG4Hit &right)
Definition: CaloG4Hit.cc:33
~CaloG4Hit() override
Definition: CaloG4Hit.cc:21
double hadr
Definition: CaloG4Hit.h:86
math::XYZPoint entryLocal
Definition: CaloG4Hit.h:83
std::ostream & operator<<(std::ostream &os, const CaloG4Hit &hit)
Definition: CaloG4Hit.cc:54
double theIncidentEnergy
Definition: CaloG4Hit.h:87
math::XYZPoint pos
Definition: CaloG4Hit.h:84
void setEntry(double x, double y, double z)
Definition: CaloG4Hit.h:47
double elem
Definition: CaloG4Hit.h:85
void Print() override
Definition: CaloG4Hit.cc:52