CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 public:
17  // Functor enum for the cut shapes
18  enum {
19  T_0_MIN = 0, // Min time measurement allowed for the first anode,
20  // depending on charge or energy
21  T_0_MAX, // Max time measurement allowed for the first anode
22  T_1_MIN, // Min time measurement allowed for the second anode
23  T_1_MAX, // Max time measurement allowed for the second anode
24  ASYMM_MIN, // Minimum allowed charge (or energy) asymmetry,
25  // depending on charge (or energy)
26  ASYMM_MAX, // Maximum allowed asymmetry
28  };
29  typedef boost::array<std::shared_ptr<AbsHcalFunctor>, N_PMT_CUTS> Cuts;
30 
31  // Dummy constructor, to be used for deserialization only
32  inline HFPhase1PMTData() : minCharge0_(0.0), minCharge1_(0.0), minChargeAsymm_(0.0) {}
33 
34  // Normal constructor
35  inline HFPhase1PMTData(const Cuts& cutShapes, const float charge0, const float charge1, const float minQAsymm)
36  : cuts_(cutShapes), minCharge0_(charge0), minCharge1_(charge1), minChargeAsymm_(minQAsymm) {}
37 
38  // Get the cut shape
39  inline const AbsHcalFunctor& cut(const unsigned which) const { return *cuts_.at(which); }
40 
41  // Minimum charge on the first/second anode needed for
42  // a reliable timing measurement. Setting this charge
43  // to a very high value will disable timing measurements
44  // on that anode.
45  inline float minCharge0() const { return minCharge0_; }
46  inline float minCharge1() const { return minCharge1_; }
47 
48  // Minimum total charge for applying the charge asymmetry cut
49  inline float minChargeAsymm() const { return minChargeAsymm_; }
50 
51  // Deep comparison operators (useful for serialization tests)
52  inline bool operator==(const HFPhase1PMTData& r) const {
53  if (minCharge0_ != r.minCharge0_)
54  return false;
55  if (minCharge1_ != r.minCharge1_)
56  return false;
58  return false;
59  for (unsigned i = 0; i < N_PMT_CUTS; ++i)
60  if (!(*cuts_[i] == *r.cuts_[i]))
61  return false;
62  return true;
63  }
64 
65  inline bool operator!=(const HFPhase1PMTData& r) const { return !(*this == r); }
66 
67 private:
69  float minCharge0_;
70  float minCharge1_;
72 
74 
75  template <class Archive>
76  inline void serialize(Archive& ar, unsigned /* version */) {
78  }
79 };
80 
81 BOOST_CLASS_VERSION(HFPhase1PMTData, 1)
82 
83 #endif // CondFormats_HcalObjects_HFPhase1PMTData_h
def which
Definition: eostools.py:336
float minChargeAsymm() const
bool operator==(const HFPhase1PMTData &r) const
boost::array< std::shared_ptr< AbsHcalFunctor >, N_PMT_CUTS > Cuts
HFPhase1PMTData(const Cuts &cutShapes, const float charge0, const float charge1, const float minQAsymm)
const AbsHcalFunctor & cut(const unsigned which) const
bool operator!=(const HFPhase1PMTData &r) const
float minCharge0() const
friend class boost::serialization::access
float minCharge1() const
void serialize(Archive &ar, unsigned)