CMS 3D CMS Logo

HFPhase1PMTData.h
Go to the documentation of this file.
1 #ifndef CondFormats_HcalObjects_HFPhase1PMTData_h
2 #define CondFormats_HcalObjects_HFPhase1PMTData_h
3 
4 #include "boost/serialization/access.hpp"
5 #include "boost/serialization/version.hpp"
6 #include "boost/serialization/shared_ptr.hpp"
7 #include "boost/serialization/array.hpp"
8 
10 
12 {
13 public:
14  // Functor enum for the cut shapes
15  enum {
16  T_0_MIN = 0, // Min time measurement allowed for the first anode,
17  // depending on charge or energy
18  T_0_MAX, // Max time measurement allowed for the first anode
19  T_1_MIN, // Min time measurement allowed for the second anode
20  T_1_MAX, // Max time measurement allowed for the second anode
21  ASYMM_MIN, // Minimum allowed charge (or energy) asymmetry,
22  // depending on charge (or energy)
23  ASYMM_MAX, // Maximum allowed asymmetry
25  };
26  typedef boost::array<boost::shared_ptr<AbsHcalFunctor>,N_PMT_CUTS> Cuts;
27 
28  // Dummy constructor, to be used for deserialization only
29  inline HFPhase1PMTData()
30  : minCharge0_(0.0), minCharge1_(0.0), minChargeAsymm_(0.0) {}
31 
32  // Normal constructor
33  inline HFPhase1PMTData(const Cuts& cutShapes, const float charge0,
34  const float charge1, const float minQAsymm)
35  : cuts_(cutShapes), minCharge0_(charge0),
36  minCharge1_(charge1), minChargeAsymm_(minQAsymm) {}
37 
38  // Get the cut shape
39  inline const AbsHcalFunctor& cut(const unsigned which) const
40  {return *cuts_.at(which);}
41 
42  // Minimum charge on the first/second anode needed for
43  // a reliable timing measurement. Setting this charge
44  // to a very high value will disable timing measurements
45  // on that anode.
46  inline float minCharge0() const {return minCharge0_;}
47  inline float minCharge1() const {return minCharge1_;}
48 
49  // Minimum total charge for applying the charge asymmetry cut
50  inline float minChargeAsymm() const {return minChargeAsymm_;}
51 
52  // Deep comparison operators (useful for serialization tests)
53  inline bool operator==(const HFPhase1PMTData& r) const
54  {
55  if (minCharge0_ != r.minCharge0_)
56  return false;
57  if (minCharge1_ != r.minCharge1_)
58  return false;
60  return false;
61  for (unsigned i=0; i<N_PMT_CUTS; ++i)
62  if (!(*cuts_[i] == *r.cuts_[i]))
63  return false;
64  return true;
65  }
66 
67  inline bool operator!=(const HFPhase1PMTData& r) const
68  {return !(*this == r);}
69 
70 private:
71  Cuts cuts_;
72  float minCharge0_;
73  float minCharge1_;
75 
77 
78  template<class Archive>
79  inline void serialize(Archive & ar, unsigned /* version */)
80  {
81  ar & cuts_ & minCharge0_ & minCharge1_ & minChargeAsymm_;
82  }
83 };
84 
85 BOOST_CLASS_VERSION(HFPhase1PMTData, 1)
86 
87 #endif // CondFormats_HcalObjects_HFPhase1PMTData_h
float minChargeAsymm() const
bool operator==(const HFPhase1PMTData &r) const
HFPhase1PMTData(const Cuts &cutShapes, const float charge0, const float charge1, const float minQAsymm)
boost::array< boost::shared_ptr< AbsHcalFunctor >, N_PMT_CUTS > Cuts
const AbsHcalFunctor & cut(const unsigned which) const
bool operator!=(const HFPhase1PMTData &r) const
float minCharge0() const
friend class boost::serialization::access
float minCharge1() const
def which(cmd)
Definition: eostools.py:335
void serialize(Archive &ar, unsigned)