CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 = 0;
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 
58 
60  LogDebug("CaloSim") << (*this);
61 }
62 
63 std::ostream& operator<<(std::ostream& os, const CaloG4Hit& hit) {
64  os << " Data of this CaloG4Hit are:" << "\n"
65  << " HitID: " << hit.getID() << "\n"
66  << " EnergyDeposit of EM particles = " << hit.getEM() << "\n"
67  << " EnergyDeposit of HD particles = " << hit.getHadr() << "\n"
68  << " Energy of primary particle = " << hit.getIncidentEnergy()/MeV
69  << " (MeV)"<< "\n"
70  << " Entry point in Calorimeter (global) : " << hit.getEntry()
71  << " (local) " << hit.getEntryLocal() << "\n"
72  << " Position of Hit (global) : " << hit.getPosition() << "\n"
73  << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
74  return os;
75 }
76 
77 
#define LogDebug(id)
math::XYZPoint getPosition() const
Definition: CaloG4Hit.h:56
G4ThreadLocal G4Allocator< CaloG4Hit > * fpCaloG4HitAllocator
Definition: CaloG4Hit.cc:10
void setEntryLocal(double x, double y, double z)
Definition: CaloG4Hit.h:54
double getIncidentEnergy() const
Definition: CaloG4Hit.h:65
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
CaloHitID getID() const
Definition: CaloG4Hit.h:74
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
double hadr
Definition: CaloG4Hit.h:89
math::XYZPoint entryLocal
Definition: CaloG4Hit.h:86
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()
Definition: CaloG4Hit.cc:59
double getHadr() const
Definition: CaloG4Hit.h:62
~CaloG4Hit()
Definition: CaloG4Hit.cc:21