CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
10 public:
11 
12  PCaloHit(float e = 0., float t = 0., int i = 0, float emFraction = 1.,
13  uint16_t d = 0) : myEnergy(e), myEMFraction(emFraction), myTime(t),
14  myItra(i), myDepth(d) { }
15 
16  PCaloHit(unsigned int id, float e = 0., float t = 0., int i = 0,
17  float emFraction = 1., uint16_t d = 0) : myEnergy (e),
18  myEMFraction(emFraction), myTime (t), myItra (i), detId(id), myDepth(d) { }
19  PCaloHit(float eEM, float eHad, float t, int i = 0, uint16_t d = 0);
20  PCaloHit(unsigned int id, float eEM, float eHad, float t, int i = 0,
21  uint16_t d = 0);
22 
23  //Names
24  static const char *name() { return "Hit"; }
25 
26  const char * getName() const { return name (); }
27 
28  //Energy deposit of the Hit
29  double energy() const { return myEnergy; }
30  double energyEM() const { return myEMFraction*myEnergy; }
31  double energyHad() const { return (1.-myEMFraction)*myEnergy; }
32  void setEnergy(double e) { myEnergy = e; }
33 
34 
35  //Time of the deposit
36  double time() const { return myTime; }
37 
38  //Geant track number
39  int geantTrackId() const { return myItra; }
40 
41  //DetId where the Hit is recorded
42  void setID(unsigned int id) { detId = id; }
43  unsigned int id() const { return detId; }
44 
45  //Encoded depth in the detector
46  //for ECAL: # radiation length, 30 == APD
47  //for HCAL:
48  void setDepth(uint16_t depth) { myDepth = depth; }
49  uint16_t depth() const { return myDepth; }
50 
51  //Event Id (for signal/pileup discrimination)
52 
54  EncodedEventId eventId() const {return theEventId;}
55 
56  // new method used by the new transient CF
57  void setTime(float t) {myTime=t;}
58 
59  //Comparisons
60 
61  bool operator<(const PCaloHit &d) const { return myEnergy < d.myEnergy; }
62 
63  //Same Hit (by value)
64  bool operator==(const PCaloHit &d) const
65  { return (myEnergy == d.myEnergy && detId == d.detId); }
66 
67  static const int kEcalDepthIdMask = 0x3;
68  static const int kEcalDepthMask = 0x1FFF;
69  static const int kEcalDepthOffset = 3;
70  static const int kEcalDepthRefz = 0X4;
71 
72 protected:
73  float myEnergy;
74  float myEMFraction;
75  float myTime;
76  int myItra;
77  unsigned int detId;
78  uint16_t myDepth;
80 };
81 
82 #include<iosfwd>
83 std::ostream &operator<<(std::ostream &, const PCaloHit &);
84 
85 #endif // _SimDataFormats_SimCaloHit_PCaloHit_h_
int i
Definition: DBlmapReader.cc:9
double time() const
Definition: PCaloHit.h:36
double energyEM() const
Definition: PCaloHit.h:30
static const int kEcalDepthRefz
Definition: PCaloHit.h:70
double energy() const
Definition: PCaloHit.h:29
uint16_t depth() const
Definition: PCaloHit.h:49
double energyHad() const
Definition: PCaloHit.h:31
void setEnergy(double e)
Definition: PCaloHit.h:32
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
static const char * name()
Definition: PCaloHit.h:24
EncodedEventId theEventId
Definition: PCaloHit.h:79
int myItra
Definition: PCaloHit.h:76
PCaloHit(unsigned int id, float e=0., float t=0., int i=0, float emFraction=1., uint16_t d=0)
Definition: PCaloHit.h:16
void setDepth(uint16_t depth)
Definition: PCaloHit.h:48
void setEventId(EncodedEventId e)
Definition: PCaloHit.h:53
float myEMFraction
Definition: PCaloHit.h:74
uint16_t myDepth
Definition: PCaloHit.h:78
bool operator==(const PCaloHit &d) const
Definition: PCaloHit.h:64
static const int kEcalDepthMask
Definition: PCaloHit.h:68
int geantTrackId() const
Definition: PCaloHit.h:39
static const int kEcalDepthOffset
Definition: PCaloHit.h:69
unsigned int id() const
Definition: PCaloHit.h:43
float myTime
Definition: PCaloHit.h:75
PCaloHit(float e=0., float t=0., int i=0, float emFraction=1., uint16_t d=0)
Definition: PCaloHit.h:12
EncodedEventId eventId() const
Definition: PCaloHit.h:54
void setTime(float t)
Definition: PCaloHit.h:57
void setID(unsigned int id)
Definition: PCaloHit.h:42
unsigned int detId
Definition: PCaloHit.h:77
const char * getName() const
Definition: PCaloHit.h:26
float myEnergy
Definition: PCaloHit.h:73
bool operator<(const PCaloHit &d) const
Definition: PCaloHit.h:61
static const int kEcalDepthIdMask
Definition: PCaloHit.h:67