CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/SimDataFormats/CaloHit/src/PCaloHit.cc

Go to the documentation of this file.
00001 #include "SimDataFormats/CaloHit/interface/PCaloHit.h"
00002 #include<iostream>
00003 
00004 PCaloHit::PCaloHit(float eEM, float eHad, float t, int i, 
00005                    uint16_t d) : myTime(t), myItra(i), myDepth(d) { 
00006   myEnergy = eEM + eHad;
00007   myEMFraction = (myEnergy <= 0. ? 1. :eEM/myEnergy);
00008 }
00009 
00010 PCaloHit::PCaloHit(unsigned int id, float eEM, float eHad, float t, int i, 
00011                    uint16_t d) : myTime(t), myItra(i), detId(id), myDepth(d) {
00012   myEnergy = eEM + eHad;
00013   myEMFraction = (myEnergy <= 0. ? 1. :eEM/myEnergy);
00014 }
00015 
00016 
00017 std::ostream & operator<<(std::ostream& o,const PCaloHit& hit)  {
00018   o << "0x" <<std::hex << hit.id() << std::dec
00019     << ": Energy (EM) " << hit.energyEM() << " GeV "
00020     << ": Energy (Had) " << hit.energyHad() << " GeV "
00021     << " Tof " << hit.time() << " ns "
00022     << " Geant track #" << hit.geantTrackId()
00023     << " Encoded depth " << hit.depth();
00024 
00025   return o;
00026 }