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 
33  //Time of the deposit
34  double time() const { return myTime; }
35 
36  //Geant track number
37  int geantTrackId() const { return myItra; }
38 
39  //DetId where the Hit is recorded
40  unsigned int id() const { return detId; }
41 
42  //Encoded depth in the detector
43  //for ECAL: # radiation length, 30 == APD
44  //for HCAL:
45  uint16_t depth() const { return myDepth; }
46 
47  //Event Id (for signal/pileup discrimination)
48 
50 
51  EncodedEventId eventId() const {return theEventId;}
52 
53  // new method used by the new transient CF
54  void setTime(float t) {myTime=t;}
55 
56  //Comparisons
57 
58  bool operator<(const PCaloHit &d) const { return myEnergy < d.myEnergy; }
59 
60  //Same Hit (by value)
61  bool operator==(const PCaloHit &d) const
62  { return (myEnergy == d.myEnergy && detId == d.detId); }
63 
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_
int i
Definition: DBlmapReader.cc:9
double time() const
Definition: PCaloHit.h:34
double energyEM() const
Definition: PCaloHit.h:30
double energy() const
Definition: PCaloHit.h:29
uint16_t depth() const
Definition: PCaloHit.h:45
double energyHad() const
Definition: PCaloHit.h:31
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: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:16
void setEventId(EncodedEventId e)
Definition: PCaloHit.h:49
float myEMFraction
Definition: PCaloHit.h:67
uint16_t myDepth
Definition: PCaloHit.h:71
bool operator==(const PCaloHit &d) const
Definition: PCaloHit.h:61
int geantTrackId() const
Definition: PCaloHit.h:37
unsigned int id() const
Definition: PCaloHit.h:40
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:12
EncodedEventId eventId() const
Definition: PCaloHit.h:51
void setTime(float t)
Definition: PCaloHit.h:54
unsigned int detId
Definition: PCaloHit.h:70
const char * getName() const
Definition: PCaloHit.h:26
float myEnergy
Definition: PCaloHit.h:66
bool operator<(const PCaloHit &d) const
Definition: PCaloHit.h:58