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  void setID(unsigned int id) { detId = id; }
41  unsigned int id() const { return detId; }
42 
43  //Encoded depth in the detector
44  //for ECAL: # radiation length, 30 == APD
45  //for HCAL:
46  void setDepth(uint16_t depth) { myDepth = depth; }
47  uint16_t depth() const { return myDepth; }
48 
49  //Event Id (for signal/pileup discrimination)
50 
52  EncodedEventId eventId() const {return theEventId;}
53 
54  // new method used by the new transient CF
55  void setTime(float t) {myTime=t;}
56 
57  //Comparisons
58 
59  bool operator<(const PCaloHit &d) const { return myEnergy < d.myEnergy; }
60 
61  //Same Hit (by value)
62  bool operator==(const PCaloHit &d) const
63  { return (myEnergy == d.myEnergy && detId == d.detId); }
64 
65 
66 protected:
67  float myEnergy;
68  float myEMFraction;
69  float myTime;
70  int myItra;
71  unsigned int detId;
72  uint16_t myDepth;
74 };
75 
76 #include<iosfwd>
77 std::ostream &operator<<(std::ostream &, const PCaloHit &);
78 
79 #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:47
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:73
int myItra
Definition: PCaloHit.h:70
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:46
void setEventId(EncodedEventId e)
Definition: PCaloHit.h:51
float myEMFraction
Definition: PCaloHit.h:68
uint16_t myDepth
Definition: PCaloHit.h:72
bool operator==(const PCaloHit &d) const
Definition: PCaloHit.h:62
int geantTrackId() const
Definition: PCaloHit.h:37
unsigned int id() const
Definition: PCaloHit.h:41
float myTime
Definition: PCaloHit.h:69
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:52
void setTime(float t)
Definition: PCaloHit.h:55
void setID(unsigned int id)
Definition: PCaloHit.h:40
unsigned int detId
Definition: PCaloHit.h:71
const char * getName() const
Definition: PCaloHit.h:26
float myEnergy
Definition: PCaloHit.h:67
bool operator<(const PCaloHit &d) const
Definition: PCaloHit.h:59