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