CMS 3D CMS Logo

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 
00054   //Comparisons
00055 
00056   bool operator<(const PCaloHit &d) const { return myEnergy < d.myEnergy; }
00057 
00058   //Same Hit (by value)
00059   bool operator==(const PCaloHit &d) const 
00060   { return (myEnergy == d.myEnergy && detId == d.detId); }
00061 
00062 
00063 protected: 
00064   float myEnergy;
00065   float myEMFraction; 
00066   float myTime; 
00067   int   myItra; 
00068   unsigned int detId; 
00069   uint16_t myDepth;
00070   EncodedEventId  theEventId;
00071 }; 
00072 
00073 #include<iosfwd>
00074 std::ostream &operator<<(std::ostream &, const PCaloHit &); 
00075 
00076 #endif // _SimDataFormats_SimCaloHit_PCaloHit_h_

Generated on Tue Jun 9 17:46:31 2009 for CMSSW by  doxygen 1.5.4