CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/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   void setID(unsigned int id) { detId = id; }
00041   unsigned int  id() const { return detId; }
00042 
00043   //Encoded depth in the detector 
00044   //for ECAL: # radiation length, 30 == APD
00045   //for HCAL:
00046   void setDepth(uint16_t depth) { myDepth = depth; }
00047   uint16_t depth() const { return myDepth; } 
00048 
00049   //Event Id (for signal/pileup discrimination)
00050 
00051   void setEventId(EncodedEventId e) { theEventId = e; }
00052   EncodedEventId eventId() const {return theEventId;}
00053 
00054   // new method used by the new transient CF
00055   void setTime(float t) {myTime=t;}
00056 
00057   //Comparisons
00058 
00059   bool operator<(const PCaloHit &d) const { return myEnergy < d.myEnergy; }
00060 
00061   //Same Hit (by value)
00062   bool operator==(const PCaloHit &d) const 
00063   { return (myEnergy == d.myEnergy && detId == d.detId); }
00064 
00065 
00066 protected: 
00067   float myEnergy;
00068   float myEMFraction; 
00069   float myTime; 
00070   int   myItra; 
00071   unsigned int detId; 
00072   uint16_t myDepth;
00073   EncodedEventId  theEventId;
00074 }; 
00075 
00076 #include<iosfwd>
00077 std::ostream &operator<<(std::ostream &, const PCaloHit &); 
00078 
00079 #endif // _SimDataFormats_SimCaloHit_PCaloHit_h_