CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CaloGVHit.h
Go to the documentation of this file.
1 #ifndef SimG4CMS_CaloGVHit_h
2 #define SimG4CMS_CaloGVHit_h 1
3 // File: CaloGVHit.h
5 // Date: 10.02 Taken from CMSCaloHit
6 //
7 // Hit class for Calorimeters (Ecal, Hcal, ...)
8 //
9 // One Hit object should be created
10 // -for each new particle entering the calorimeter
11 // -for each detector unit (= crystal or fibre or scintillator layer)
12 // -for each nanosecond of the shower development
13 //
14 // This implies that all hit objects created for a given shower
15 // have the same value for
16 // - Entry (= local coordinates of the entrance point of the particle
17 // in the unit where the shower starts)
18 // - the TrackID (= Identification number of the incident particle)
19 // - the IncidentEnergy (= energy of that particle)
20 //
21 // Modified:
22 //
24 
28 #include <iostream>
29 
30 class CaloGVHit {
31 public:
32  CaloGVHit();
33  ~CaloGVHit();
34  CaloGVHit(const CaloGVHit& right);
35  const CaloGVHit& operator=(const CaloGVHit& right);
36  bool operator==(const CaloGVHit&) { return false; }
37 
38 public:
39  inline double getEM() const { return elem_; }
40  inline void setEM(double e) { elem_ = e; }
41 
42  inline double getHadr() const { return hadr_; }
43  inline void setHadr(double e) { hadr_ = e; }
44 
45  inline int getEventID() const { return eventID_; }
46  inline void setEventID(int id) { eventID_ = id; }
47 
48  inline int getTrackID() const { return hitID_.trackID(); }
49  inline uint32_t getUnitID() const { return hitID_.unitID(); }
50  inline double getTimeSlice() const { return hitID_.timeSlice(); }
51  inline int getTimeSliceID() const { return hitID_.timeSliceID(); }
52  inline uint16_t getDepth() const { return hitID_.depth(); }
53 
54  inline CaloHitID getID() const { return hitID_; }
55  inline void setID(uint32_t i, double d, int j, uint16_t k = 0) { hitID_.setID(i, d, j, k); }
56  inline void setID(const CaloHitID& id) { hitID_ = id; }
57 
58  void addEnergyDeposit(double em, double hd);
59  void addEnergyDeposit(const CaloGVHit& aHit);
60 
61  inline double getEnergyDeposit() const { return (elem_ + hadr_); }
62 
63 private:
64  int eventID_; //Event ID
65  double elem_; //EnergyDeposit of EM particles
66  double hadr_; //EnergyDeposit of HD particles
67  CaloHitID hitID_; //Identification number of the hit given
68  //by primary particle, Cell ID, Time of
69  //the hit
70 };
71 
73 public:
74  inline bool operator()(const CaloGVHit* a, const CaloGVHit* b) {
75  if (a->getEventID() != b->getEventID()) {
76  return (a->getEventID() < b->getEventID());
77  } else if (a->getTrackID() != b->getTrackID()) {
78  return (a->getTrackID() < b->getTrackID());
79  } else if (a->getUnitID() != b->getUnitID()) {
80  return (a->getUnitID() < b->getUnitID());
81  } else if (a->getDepth() != b->getDepth()) {
82  return (a->getDepth() < b->getDepth());
83  } else {
84  return (a->getTimeSliceID() < b->getTimeSliceID());
85  }
86  }
87 };
88 
90 public:
91  inline bool operator()(const CaloGVHit* a, const CaloGVHit* b) {
92  return (a->getEventID() == b->getEventID() && a->getTrackID() == b->getTrackID() &&
93  a->getUnitID() == b->getUnitID() && a->getDepth() == b->getDepth() &&
94  a->getTimeSliceID() == b->getTimeSliceID());
95  }
96 };
97 
98 std::ostream& operator<<(std::ostream&, const CaloGVHit&);
99 
100 #endif
void setID(uint32_t i, double d, int j, uint16_t k=0)
Definition: CaloGVHit.h:55
CaloHitID getID() const
Definition: CaloGVHit.h:54
uint16_t *__restrict__ id
bool operator()(const CaloGVHit *a, const CaloGVHit *b)
Definition: CaloGVHit.h:74
const CaloGVHit & operator=(const CaloGVHit &right)
Definition: CaloGVHit.cc:21
double timeSlice() const
Definition: CaloHitID.h:22
double getEnergyDeposit() const
Definition: CaloGVHit.h:61
int eventID_
Definition: CaloGVHit.h:64
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
uint16_t depth() const
Definition: CaloHitID.h:24
int getEventID() const
Definition: CaloGVHit.h:45
void setEventID(int id)
Definition: CaloGVHit.h:46
tuple d
Definition: ztail.py:151
double getTimeSlice() const
Definition: CaloGVHit.h:50
uint32_t getUnitID() const
Definition: CaloGVHit.h:49
double getEM() const
Definition: CaloGVHit.h:39
int timeSliceID() const
Definition: CaloHitID.h:21
int trackID() const
Definition: CaloHitID.h:23
void setHadr(double e)
Definition: CaloGVHit.h:43
void setID(const CaloHitID &id)
Definition: CaloGVHit.h:56
void setEM(double e)
Definition: CaloGVHit.h:40
~CaloGVHit()
Definition: CaloGVHit.cc:12
double getHadr() const
Definition: CaloGVHit.h:42
void addEnergyDeposit(double em, double hd)
Definition: CaloGVHit.cc:29
uint16_t getDepth() const
Definition: CaloGVHit.h:52
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:41
int getTrackID() const
Definition: CaloGVHit.h:48
bool operator()(const CaloGVHit *a, const CaloGVHit *b)
Definition: CaloGVHit.h:91
int getTimeSliceID() const
Definition: CaloGVHit.h:51
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
double hadr_
Definition: CaloGVHit.h:66
CaloGVHit()
Definition: CaloGVHit.cc:6
CaloHitID hitID_
Definition: CaloGVHit.h:67
bool operator==(const CaloGVHit &)
Definition: CaloGVHit.h:36
uint32_t unitID() const
Definition: CaloHitID.h:20
double elem_
Definition: CaloGVHit.h:65