00001 00002 // File: CaloG4Hit.cc 00003 // Description: Transient Hit class for the calorimeters 00005 #include "SimG4CMS/Calo/interface/CaloG4Hit.h" 00006 #include <iostream> 00007 00008 CaloG4Hit::CaloG4Hit(){ 00009 00010 setEntry(0.,0.,0.); 00011 setEntryLocal(0.,0.,0.); 00012 elem = 0.; 00013 hadr = 0.; 00014 theIncidentEnergy = 0.; 00015 } 00016 00017 CaloG4Hit::~CaloG4Hit(){} 00018 00019 CaloG4Hit::CaloG4Hit(const CaloG4Hit &right) { 00020 00021 entry = right.entry; 00022 entryLocal = right.entryLocal; 00023 pos = right.pos; 00024 elem = right.elem; 00025 hadr = right.hadr; 00026 theIncidentEnergy = right.theIncidentEnergy; 00027 hitID = right.hitID; 00028 } 00029 00030 const CaloG4Hit& CaloG4Hit::operator=(const CaloG4Hit &right) { 00031 00032 entry = right.entry; 00033 entryLocal = right.entryLocal; 00034 pos = right.pos; 00035 elem = right.elem; 00036 hadr = right.hadr; 00037 theIncidentEnergy = right.theIncidentEnergy; 00038 hitID = right.hitID; 00039 00040 return *this; 00041 } 00042 00043 void CaloG4Hit::addEnergyDeposit(double em, double hd) { 00044 00045 elem += em ; 00046 hadr += hd; 00047 } 00048 00049 void CaloG4Hit::addEnergyDeposit(const CaloG4Hit& aHit) { 00050 00051 addEnergyDeposit(aHit.getEM(),aHit.getHadr()); 00052 } 00053 00054 00055 void CaloG4Hit::Print() { 00056 LogDebug("CaloSim") << (*this); 00057 } 00058 00059 std::ostream& operator<<(std::ostream& os, const CaloG4Hit& hit) { 00060 os << " Data of this CaloG4Hit are:" << "\n" 00061 << " HitID: " << hit.getID() << "\n" 00062 << " EnergyDeposit of EM particles = " << hit.getEM() << "\n" 00063 << " EnergyDeposit of HD particles = " << hit.getHadr() << "\n" 00064 << " Energy of primary particle = " << hit.getIncidentEnergy()/MeV 00065 << " (MeV)"<< "\n" 00066 << " Entry point in Calorimeter (global) : " << hit.getEntry() 00067 << " (local) " << hit.getEntryLocal() << "\n" 00068 << " Position of Hit (global) : " << hit.getPosition() << "\n" 00069 << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; 00070 return os; 00071 } 00072 00073