CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AbsOOTPileupCorrection.h
Go to the documentation of this file.
1 #ifndef CondFormats_HcalObjects_AbsOOTPileupCorrection_h
2 #define CondFormats_HcalObjects_AbsOOTPileupCorrection_h
3 
4 #include <typeinfo>
5 
6 #include "boost/serialization/base_object.hpp"
7 #include "boost/serialization/export.hpp"
8 
9 // Archive headers are needed here for the serialization registration to work.
10 // <cassert> is needed for the archive headers to work.
11 #if !defined(__GCCXML__)
12 #include <cassert>
13 #include "CondFormats/Serialization/interface/eos/portable_iarchive.hpp"
14 #include "CondFormats/Serialization/interface/eos/portable_oarchive.hpp"
15 #endif /* #if !defined(__GCCXML__) */
16 
18 
19 // The contents of the "BunchXParameter" class are not well
20 // defined yet. Potentially, they could be as simple as 0/1 flag
21 // for beam gap/normal bunch crossing or they can include bunch
22 // crossing lumi data. We need to figure out how to get this
23 // information.
24 class BunchXParameter;
25 
27 {
28 public:
29  inline virtual ~AbsOOTPileupCorrection() {}
30 
31  // Main correction application method to be implemented by
32  // derived classes. Arguments are as follows:
33  //
34  // id -- HCAL detector id.
35  //
36  // inputCharge -- This array contains pedestal-subtracted input
37  // charge. Gain factors converting charge into
38  // energy might already be applied by the caller.
39  // The caler should collaborate with this class
40  // providing the right arguments here, depending on
41  // what "inputIsEnergy" method returns.
42  //
43  // lenInputCharge -- Length of the "inputCharge" array.
44  //
45  // bcParams -- Information about bunch crossings, in the order
46  // corresponding to "inputCharge".
47  //
48  // lenBcParams -- Length of the "bunchParams" array. Must not be
49  // less than lenInputCharge.
50  //
51  // firstTimeSlice -- The first time slice that will be used for energy
52  // reconstruction.
53  //
54  // nTimeSlices -- Number of time slices that will be used for energy
55  // reconstruction. The sum firstTimeSlice + nTimeSlices
56  // must not exceed lenInputCharge.
57  //
58  // correctedCharge -- Array of corrected charges (or energies), to be
59  // filled on output.
60  //
61  // lenCorrectedCharge -- Length of the "correctedCharge" array. Must not
62  // be less than lenInputCharge.
63  //
64  // pulseShapeCorrApplied -- *pulseShapeCorrApplied should be set "true"
65  // if the algorithm effectively performs the phase-based
66  // amplitude correction, so that additional correction
67  // of this type is not needed. If additional correction
68  // has to be applied, this flag should be set "false".
69  //
70  // leakCorrApplied -- *leakCorrApplied should be set "true" if the
71  // algorithm effectively performs a correction for
72  // charge leakage into the time slice before the
73  // first one used for energy reconstruction. If not,
74  // this flag should be set "false".
75  //
76  // readjustTiming -- *readjustTiming should be set "true" if one should
77  // use OOT pileup corrected energies to derive hit time.
78  // To use the original, uncorrected energies set this
79  // to "false".
80  //
81  // Some of the input arguments may be ignored by derived classes.
82  //
83  virtual void apply(const HcalDetId& id,
84  const double* inputCharge, unsigned lenInputCharge,
85  const BunchXParameter* bcParams, unsigned lenBcParams,
86  unsigned firstTimeSlice, unsigned nTimeSlices,
87  double* correctedCharge, unsigned lenCorrectedCharge,
88  bool* pulseShapeCorrApplied, bool* leakCorrApplied,
89  bool* readjustTiming) const = 0;
90 
91  // Another method to be overriden by derived classes. This method
92  // tells whether fC -> GeV conversion should be performed before
93  // calling the "apply" method or after. If "true" is returned,
94  // it is assumed that the input is in GeV (this also takes into
95  // account potentially different gains per cap id).
96  virtual bool inputIsEnergy() const = 0;
97 
98  // Comparison operators. Note that they are not virtual and should
99  // not be overriden by derived classes. These operators are very
100  // useful for I/O testing.
101  inline bool operator==(const AbsOOTPileupCorrection& r) const
102  {return (typeid(*this) == typeid(r)) && this->isEqual(r);}
103  inline bool operator!=(const AbsOOTPileupCorrection& r) const
104  {return !(*this == r);}
105 
106 protected:
107  // Method needed to compare objects for equality.
108  // Must be implemented by derived classes.
109  virtual bool isEqual(const AbsOOTPileupCorrection&) const = 0;
110 
111 private:
113  template <typename Ar>
114  inline void serialize(Ar& ar, unsigned /* version */) {}
115 };
116 
117 BOOST_CLASS_EXPORT_KEY(AbsOOTPileupCorrection)
118 
119 #endif // CondFormats_HcalObjects_AbsOOTPileupCorrection_h
virtual bool inputIsEnergy() const =0
friend class boost::serialization::access
bool operator==(const AbsOOTPileupCorrection &r) const
void serialize(Ar &ar, unsigned)
virtual void apply(const HcalDetId &id, const double *inputCharge, unsigned lenInputCharge, const BunchXParameter *bcParams, unsigned lenBcParams, unsigned firstTimeSlice, unsigned nTimeSlices, double *correctedCharge, unsigned lenCorrectedCharge, bool *pulseShapeCorrApplied, bool *leakCorrApplied, bool *readjustTiming) const =0
virtual bool isEqual(const AbsOOTPileupCorrection &) const =0
bool operator!=(const AbsOOTPileupCorrection &r) const