Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:48

0001 #ifndef SimDataFormats_PassiveHit_H
0002 #define SimDataFormats_PassiveHit_H
0003 
0004 #include <string>
0005 #include <vector>
0006 
0007 // Persistent Hit in passive material
0008 
0009 class PassiveHit {
0010 public:
0011   PassiveHit(std::string vname,
0012              unsigned int id,
0013              float e = 0,
0014              float etot = 0,
0015              float t = 0,
0016              int it = 0,
0017              int ip = 0,
0018              float stepl = 0,
0019              float xp = 0,
0020              float yp = 0,
0021              float zp = 0)
0022       : vname_(vname),
0023         id_(id),
0024         energy_(e),
0025         etotal_(etot),
0026         time_(t),
0027         it_(it),
0028         ip_(ip),
0029         stepl_(stepl),
0030         xp_(xp),
0031         yp_(yp),
0032         zp_(zp) {}
0033   PassiveHit()
0034       : vname_(""), id_(0), energy_(0), etotal_(0), time_(0), it_(0), ip_(0), stepl_(0), xp_(0), yp_(0), zp_(0) {}
0035 
0036   //Names
0037   static const char *name() { return "PassiveHit"; }
0038 
0039   const char *getName() const { return name(); }
0040 
0041   //Energy deposit of the Hit
0042   double energy() const { return energy_; }
0043   void setEnergy(double e) { energy_ = e; }
0044   double energyTotal() const { return etotal_; }
0045   void setEnergyTotal(double e) { etotal_ = e; }
0046 
0047   //Time of the deposit
0048   double time() const { return time_; }
0049   void setTime(float t) { time_ = t; }
0050 
0051   //Geant track number
0052   int trackId() const { return it_; }
0053   void setTrackId(int it) { it_ = it; }
0054 
0055   //DetId where the Hit is recorded
0056   void setID(std::string vname, unsigned int id) {
0057     vname_ = vname;
0058     id_ = id;
0059   }
0060   std::string vname() const { return vname_; }
0061   unsigned int id() const { return id_; }
0062 
0063   //PDGId of the track causing the Hit
0064   int pdgId() const { return ip_; }
0065   void setPDGId(int ip) { ip_ = ip; }
0066 
0067   //Step length for the current Hit
0068   float stepLength() const { return stepl_; }
0069   void setStepLength(float stepl) { stepl_ = stepl; }
0070 
0071   //Position of the Hit
0072   float x() const { return xp_; }
0073   void setX(float xp) { xp_ = xp; }
0074   float y() const { return yp_; }
0075   void setY(float yp) { yp_ = yp; }
0076   float z() const { return zp_; }
0077   void setZ(float zp) { zp_ = zp; }
0078 
0079   //Comparisons
0080   bool operator<(const PassiveHit &d) const { return energy_ < d.energy_; }
0081 
0082   //Same Hit (by value)
0083   bool operator==(const PassiveHit &d) const { return (energy_ == d.energy_ && id_ == d.id_ && vname_ == d.vname_); }
0084 
0085 protected:
0086   std::string vname_;
0087   unsigned int id_;
0088   float energy_;
0089   float etotal_;
0090   float time_;
0091   int it_;
0092   int ip_;
0093   float stepl_;
0094   float xp_;
0095   float yp_;
0096   float zp_;
0097 };
0098 
0099 namespace edm {
0100   typedef std::vector<PassiveHit> PassiveHitContainer;
0101 }  // namespace edm
0102 
0103 #include <iosfwd>
0104 std::ostream &operator<<(std::ostream &, const PassiveHit &);
0105 
0106 #endif  // _SimDataFormats_SimCaloHit_PassiveHit_h_