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 
68 protected:
69  float myEnergy;
70  float myEMFraction;
71  float myTime;
72  int myItra;
73  unsigned int detId;
74  uint16_t myDepth;
76 };
77 
78 #include<iosfwd>
79 std::ostream &operator<<(std::ostream &, const PCaloHit &);
80 
81 #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
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:75
int myItra
Definition: PCaloHit.h:72
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
tuple d
Definition: ztail.py:151
void setEventId(EncodedEventId e)
Definition: PCaloHit.h:53
float myEMFraction
Definition: PCaloHit.h:70
uint16_t myDepth
Definition: PCaloHit.h:74
bool operator==(const PCaloHit &d) const
Definition: PCaloHit.h:64
int geantTrackId() const
Definition: PCaloHit.h:39
unsigned int id() const
Definition: PCaloHit.h:43
float myTime
Definition: PCaloHit.h:71
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:73
const char * getName() const
Definition: PCaloHit.h:26
float myEnergy
Definition: PCaloHit.h:69
bool operator<(const PCaloHit &d) const
Definition: PCaloHit.h:61