Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:40

0001 #ifndef SimDataFormats_PCaloHit_H
0002 #define SimDataFormats_PCaloHit_H
0003 
0004 #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h"
0005 
0006 // Persistent Calorimeter hit
0007 
0008 class PCaloHit {
0009 public:
0010   PCaloHit(float e = 0., float t = 0., int i = 0, float emFraction = 1., uint16_t d = 0)
0011       : myEnergy(e), myEMFraction(emFraction), myTime(t), myItra(i), myDepth(d) {}
0012 
0013   PCaloHit(unsigned int id, float e = 0., float t = 0., int i = 0, float emFraction = 1., uint16_t d = 0)
0014       : myEnergy(e), myEMFraction(emFraction), myTime(t), myItra(i), detId(id), myDepth(d) {}
0015   PCaloHit(float eEM, float eHad, float t, int i = 0, uint16_t d = 0);
0016   PCaloHit(unsigned int id, float eEM, float eHad, float t, int i = 0, uint16_t d = 0);
0017 
0018   //Names
0019   static const char *name() { return "Hit"; }
0020 
0021   const char *getName() const { return name(); }
0022 
0023   //Energy deposit of the Hit
0024   double energy() const { return myEnergy; }
0025   double energyEM() const { return myEMFraction * myEnergy; }
0026   double energyHad() const { return (1. - myEMFraction) * myEnergy; }
0027   void setEnergy(double e) { myEnergy = e; }
0028 
0029   //Time of the deposit
0030   double time() const { return myTime; }
0031 
0032   //Geant track number
0033   int geantTrackId() const { return myItra; }
0034 
0035   //DetId where the Hit is recorded
0036   void setID(unsigned int id) { detId = id; }
0037   unsigned int id() const { return detId; }
0038 
0039   //Encoded depth in the detector
0040   //for ECAL: # radiation length, 30 == APD
0041   //for HCAL:
0042   void setDepth(uint16_t depth) { myDepth = depth; }
0043   uint16_t depth() const { return myDepth; }
0044 
0045   //Event Id (for signal/pileup discrimination)
0046 
0047   void setEventId(EncodedEventId e) { theEventId = e; }
0048   EncodedEventId eventId() const { return theEventId; }
0049 
0050   // new method used by the new transient CF
0051   void setTime(float t) { myTime = t; }
0052 
0053   //Comparisons
0054 
0055   bool operator<(const PCaloHit &d) const { return myEnergy < d.myEnergy; }
0056 
0057   //Same Hit (by value)
0058   bool operator==(const PCaloHit &d) const { return (myEnergy == d.myEnergy && detId == d.detId); }
0059 
0060   static const int kEcalDepthIdMask = 0x3;
0061   static const int kEcalDepthMask = 0x1FFF;
0062   static const int kEcalDepthOffset = 3;
0063   static const int kEcalDepthRefz = 0X4;
0064 
0065 protected:
0066   float myEnergy;
0067   float myEMFraction;
0068   float myTime;
0069   int myItra;
0070   unsigned int detId;
0071   uint16_t myDepth;
0072   EncodedEventId theEventId;
0073 };
0074 
0075 #include <iosfwd>
0076 std::ostream &operator<<(std::ostream &, const PCaloHit &);
0077 
0078 #endif  // _SimDataFormats_SimCaloHit_PCaloHit_h_