CMS 3D CMS Logo

PassiveHit.h
Go to the documentation of this file.
1 #ifndef SimDataFormats_PassiveHit_H
2 #define SimDataFormats_PassiveHit_H
3 
4 #include <string>
5 #include <vector>
6 
7 // Persistent Hit in passive material
8 
9 class PassiveHit {
10 public:
11  PassiveHit(std::string vname, unsigned int id, float e = 0, float etot = 0, float t = 0, int it = 0)
12  : vname_(vname), id_(id), energy_(e), etotal_(etot), time_(t), it_(it) {}
13  PassiveHit() : vname_(""), id_(0), energy_(0), etotal_(0), time_(0), it_(0) {}
14 
15  //Names
16  static const char *name() { return "PassiveHit"; }
17 
18  const char *getName() const { return name(); }
19 
20  //Energy deposit of the Hit
21  double energy() const { return energy_; }
22  void setEnergy(double e) { energy_ = e; }
23  double energyTotal() const { return etotal_; }
24  void setEnergyTotal(double e) { etotal_ = e; }
25 
26  //Time of the deposit
27  double time() const { return time_; }
28  void setTime(float t) { time_ = t; }
29 
30  //Geant track number
31  int trackId() const { return it_; }
32  void setTrackId(int it) { it_ = it; }
33 
34  //DetId where the Hit is recorded
35  void setID(std::string vname, unsigned int id) {
36  vname_ = vname;
37  id_ = id;
38  }
39  std::string vname() const { return vname_; }
40  unsigned int id() const { return id_; }
41 
42  //Comparisons
43  bool operator<(const PassiveHit &d) const { return energy_ < d.energy_; }
44 
45  //Same Hit (by value)
46  bool operator==(const PassiveHit &d) const { return (energy_ == d.energy_ && id_ == d.id_ && vname_ == d.vname_); }
47 
48 protected:
50  unsigned int id_;
51  float energy_;
52  float etotal_;
53  float time_;
54  int it_;
55 };
56 
57 namespace edm {
58  typedef std::vector<PassiveHit> PassiveHitContainer;
59 } // namespace edm
60 
61 #include <iosfwd>
62 std::ostream &operator<<(std::ostream &, const PassiveHit &);
63 
64 #endif // _SimDataFormats_SimCaloHit_PassiveHit_h_
void setID(std::string vname, unsigned int id)
Definition: PassiveHit.h:35
bool operator<(const PassiveHit &d) const
Definition: PassiveHit.h:43
double energy() const
Definition: PassiveHit.h:21
std::ostream & operator<<(std::ostream &, const PassiveHit &)
Definition: PassiveHit.cc:4
double time() const
Definition: PassiveHit.h:27
float etotal_
Definition: PassiveHit.h:52
unsigned int id() const
Definition: PassiveHit.h:40
std::string vname() const
Definition: PassiveHit.h:39
const char * getName() const
Definition: PassiveHit.h:18
static const char * name()
Definition: PassiveHit.h:16
void setTime(float t)
Definition: PassiveHit.h:28
std::string vname_
Definition: PassiveHit.h:49
std::vector< PassiveHit > PassiveHitContainer
Definition: PassiveHit.h:58
void setEnergyTotal(double e)
Definition: PassiveHit.h:24
bool operator==(const PassiveHit &d) const
Definition: PassiveHit.h:46
float energy_
Definition: PassiveHit.h:51
float time_
Definition: PassiveHit.h:53
unsigned int id_
Definition: PassiveHit.h:50
HLT enums.
double energyTotal() const
Definition: PassiveHit.h:23
int trackId() const
Definition: PassiveHit.h:31
void setEnergy(double e)
Definition: PassiveHit.h:22
void setTrackId(int it)
Definition: PassiveHit.h:32
PassiveHit(std::string vname, unsigned int id, float e=0, float etot=0, float t=0, int it=0)
Definition: PassiveHit.h:11