CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/SimG4CMS/Calo/src/CaloG4Hit.cc

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