CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/SimDataFormats/CaloHit/interface/PCaloHit.h

Go to the documentation of this file.
00001 #ifndef SimDataFormats_PCaloHit_H
00002 #define SimDataFormats_PCaloHit_H
00003 
00004 #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h"
00005 
00006 // Persistent Calorimeter hit
00007 
00008 class PCaloHit { 
00009 
00010 public: 
00011 
00012   PCaloHit(float e = 0., float t = 0., int i = 0, float emFraction = 1.,
00013            uint16_t d = 0) : myEnergy(e), myEMFraction(emFraction), myTime(t),
00014     myItra(i), myDepth(d) { }
00015 
00016   PCaloHit(unsigned int id, float e = 0., float t = 0., int i = 0, 
00017            float emFraction = 1., uint16_t d = 0) : myEnergy (e), 
00018     myEMFraction(emFraction), myTime (t), myItra (i), detId(id), myDepth(d) { }
00019   PCaloHit(float eEM, float eHad, float t, int i = 0, uint16_t d = 0);
00020   PCaloHit(unsigned int id, float eEM, float eHad, float t, int i = 0, 
00021            uint16_t d = 0);
00022   
00023   //Names
00024   static const char *name() { return "Hit"; }
00025 
00026   const char * getName() const { return name (); }
00027 
00028   //Energy deposit of the Hit
00029   double energy()    const { return myEnergy; }
00030   double energyEM()  const { return myEMFraction*myEnergy; }
00031   double energyHad() const { return (1.-myEMFraction)*myEnergy; }
00032 
00033   //Time of the deposit
00034   double time() const { return myTime; }
00035 
00036   //Geant track number
00037   int geantTrackId() const { return myItra; }
00038 
00039   //DetId where the Hit is recorded
00040   unsigned int  id() const { return detId; }
00041 
00042   //Encoded depth in the detector 
00043   //for ECAL: # radiation length, 30 == APD
00044   //for HCAL:
00045   uint16_t depth() const { return myDepth; } 
00046 
00047   //Event Id (for signal/pileup discrimination)
00048 
00049   void setEventId(EncodedEventId e) { theEventId = e; }
00050 
00051   EncodedEventId eventId() const {return theEventId;}
00052 
00053   // new method used by the new transient CF
00054   void setTime(float t) {myTime=t;}
00055 
00056   //Comparisons
00057 
00058   bool operator<(const PCaloHit &d) const { return myEnergy < d.myEnergy; }
00059 
00060   //Same Hit (by value)
00061   bool operator==(const PCaloHit &d) const 
00062   { return (myEnergy == d.myEnergy && detId == d.detId); }
00063 
00064 
00065 protected: 
00066   float myEnergy;
00067   float myEMFraction; 
00068   float myTime; 
00069   int   myItra; 
00070   unsigned int detId; 
00071   uint16_t myDepth;
00072   EncodedEventId  theEventId;
00073 }; 
00074 
00075 #include<iosfwd>
00076 std::ostream &operator<<(std::ostream &, const PCaloHit &); 
00077 
00078 #endif // _SimDataFormats_SimCaloHit_PCaloHit_h_