CMS 3D CMS Logo

PCaloHit.h
Go to the documentation of this file.
1 #ifndef SimDataFormats_PCaloHit_H
2 #define SimDataFormats_PCaloHit_H
3 
5 
6 // Persistent Calorimeter hit
7 
8 class PCaloHit {
9 public:
10  PCaloHit(float e = 0., float t = 0., int i = 0, float emFraction = 1., uint16_t d = 0)
11  : myEnergy(e), myEMFraction(emFraction), myTime(t), myItra(i), myDepth(d) {}
12 
13  PCaloHit(unsigned int id, float e = 0., float t = 0., int i = 0, float emFraction = 1., uint16_t d = 0)
14  : myEnergy(e), myEMFraction(emFraction), myTime(t), myItra(i), detId(id), myDepth(d) {}
15  PCaloHit(float eEM, float eHad, float t, int i = 0, uint16_t d = 0);
16  PCaloHit(unsigned int id, float eEM, float eHad, float t, int i = 0, uint16_t d = 0);
17 
18  //Names
19  static const char *name() { return "Hit"; }
20 
21  const char *getName() const { return name(); }
22 
23  //Energy deposit of the Hit
24  double energy() const { return myEnergy; }
25  double energyEM() const { return myEMFraction * myEnergy; }
26  double energyHad() const { return (1. - myEMFraction) * myEnergy; }
27  void setEnergy(double e) { myEnergy = e; }
28 
29  //Time of the deposit
30  double time() const { return myTime; }
31 
32  //Geant track number
33  int geantTrackId() const { return myItra; }
34 
35  //DetId where the Hit is recorded
36  void setID(unsigned int id) { detId = id; }
37  unsigned int id() const { return detId; }
38 
39  //Encoded depth in the detector
40  //for ECAL: # radiation length, 30 == APD
41  //for HCAL:
42  void setDepth(uint16_t depth) { myDepth = depth; }
43  uint16_t depth() const { return myDepth; }
44 
45  //Event Id (for signal/pileup discrimination)
46 
48  EncodedEventId eventId() const { return theEventId; }
49 
50  // new method used by the new transient CF
51  void setTime(float t) { myTime = t; }
52 
53  //Comparisons
54 
55  bool operator<(const PCaloHit &d) const { return myEnergy < d.myEnergy; }
56 
57  //Same Hit (by value)
58  bool operator==(const PCaloHit &d) const { return (myEnergy == d.myEnergy && detId == d.detId); }
59 
60  static const int kEcalDepthIdMask = 0x3;
61  static const int kEcalDepthMask = 0x1FFF;
62  static const int kEcalDepthOffset = 3;
63  static const int kEcalDepthRefz = 0X4;
64 
65 protected:
66  float myEnergy;
67  float myEMFraction;
68  float myTime;
69  int myItra;
70  unsigned int detId;
71  uint16_t myDepth;
73 };
74 
75 #include <iosfwd>
76 std::ostream &operator<<(std::ostream &, const PCaloHit &);
77 
78 #endif // _SimDataFormats_SimCaloHit_PCaloHit_h_
double energyHad() const
Definition: PCaloHit.h:26
static const int kEcalDepthRefz
Definition: PCaloHit.h:63
void setEnergy(double e)
Definition: PCaloHit.h:27
static const char * name()
Definition: PCaloHit.h:19
EncodedEventId theEventId
Definition: PCaloHit.h:72
int myItra
Definition: PCaloHit.h:69
PCaloHit(unsigned int id, float e=0., float t=0., int i=0, float emFraction=1., uint16_t d=0)
Definition: PCaloHit.h:13
void setDepth(uint16_t depth)
Definition: PCaloHit.h:42
bool operator<(const PCaloHit &d) const
Definition: PCaloHit.h:55
void setEventId(EncodedEventId e)
Definition: PCaloHit.h:47
float myEMFraction
Definition: PCaloHit.h:67
uint16_t myDepth
Definition: PCaloHit.h:71
EncodedEventId eventId() const
Definition: PCaloHit.h:48
unsigned int id() const
Definition: PCaloHit.h:37
std::ostream & operator<<(std::ostream &, const PCaloHit &)
Definition: PCaloHit.cc:15
const char * getName() const
Definition: PCaloHit.h:21
static const int kEcalDepthMask
Definition: PCaloHit.h:61
double energyEM() const
Definition: PCaloHit.h:25
int geantTrackId() const
Definition: PCaloHit.h:33
static const int kEcalDepthOffset
Definition: PCaloHit.h:62
double energy() const
Definition: PCaloHit.h:24
d
Definition: ztail.py:151
double time() const
Definition: PCaloHit.h:30
uint16_t depth() const
Definition: PCaloHit.h:43
float myTime
Definition: PCaloHit.h:68
PCaloHit(float e=0., float t=0., int i=0, float emFraction=1., uint16_t d=0)
Definition: PCaloHit.h:10
bool operator==(const PCaloHit &d) const
Definition: PCaloHit.h:58
void setTime(float t)
Definition: PCaloHit.h:51
void setID(unsigned int id)
Definition: PCaloHit.h:36
unsigned int detId
Definition: PCaloHit.h:70
float myEnergy
Definition: PCaloHit.h:66
static const int kEcalDepthIdMask
Definition: PCaloHit.h:60