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