EcalTiming
 All Classes Functions Variables Pages
EcalTimingEvent.h
1 #ifndef ecaltimingevent_hh
2 #define ecaltimingevent_hh
3 
4 #include <iostream>
5 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
6 #include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h"
7 
8 /** \class EcalTimingEvent EcalTiming.cc EcalTiming.cc
9  *
10  * Description: basic timing information
11  */
12 
13 #define MAX_TIME 32.767
14 #define MAX_ENERGY 655.35
15 
17 {
18 public:
20  {
21  detid_ = DetId(0);
22  setTime(MAX_TIME);
23  setEnergy(MAX_ENERGY);
24  }
25  EcalTimingEvent(DetId id) {
26  detid_ = id;
27  setTime(MAX_TIME);
28  setEnergy(MAX_ENERGY);
29  }
30  EcalTimingEvent(const EcalRecHit& rec) {
31  detid_ = rec.detid();
32  setTime(rec.time());
33  setEnergy(rec.energy());
34  }
35 
36  /// Time is stored in a int16_t in ps. time() returns a float in ns
37  float time() const{ return float(time_)/1000.0f; }
38  /// Energy is stored in a uint16_t in 10's of MeV. energy() returns a float in GeV
39  float energy() const { return float(energy_)/100.0f; }
40  const DetId& detid() const { return detid_; }
41 
42  void setTime(float t);
43  void setEnergy(float e);
44 
45 
46 private:
47  DetId detid_;
48  int16_t time_;
49  uint16_t energy_;
50 public:
51  friend std::ostream& operator << (std::ostream& os, const EcalTimingEvent& event)
52  {
53  if(event.detid().subdetId() == EcalBarrel) {
54  EBDetId id(event.detid());
55  os << id.ieta() << "\t" << id.iphi() << "\t" << id.zside() << "\t";
56  } else {
57  EEDetId id(event.detid());
58  os << id.ix() << "\t" << id.iy() << "\t" << id.zside() << "\t";
59  }
60 
61  os << event.time() << "\t" << event.energy();
62  return os;
63  }
64 
65  bool operator== (const EcalTimingEvent &first) const
66  {
67  // only check amp, time, sigmaT
68  if (first.energy() == this->energy() &&
69  first.time() == this->time())
70  {
71  return true;
72  }
73  return false;
74  }
75 
76 };
77 
78 typedef std::vector<EcalTimingEvent> EcalTimingCollection;
79 
80 #endif
81 
Definition: EcalTimingEvent.h:16
float time() const
Time is stored in a int16_t in ps. time() returns a float in ns.
Definition: EcalTimingEvent.h:37
float energy() const
Energy is stored in a uint16_t in 10&#39;s of MeV. energy() returns a float in GeV.
Definition: EcalTimingEvent.h:39