Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-24 23:45:59

0001 #ifndef Calibration_EcalCalibAlgos_EcalPhiSymInfo_h
0002 #define Calibration_EcalCalibAlgos_EcalPhiSymInfo_h
0003 
0004 /** \class EcalPhiSymInfo
0005  * 
0006  * EcalPhiSym calibration lumi/run based information
0007  * 
0008  * Original Author: Simone Pigazzini (2022)
0009  */
0010 
0011 #include <vector>
0012 #include <cstdint>
0013 #include <cassert>
0014 
0015 class EcalPhiSymInfo {
0016 public:
0017   //---ctors---
0018   EcalPhiSymInfo()
0019       : totHitsEB_(0),
0020         totHitsEE_(0),
0021         nEvents_(0),
0022         nLumis_(0),
0023         fillNumber_(0),
0024         delivLumi_(0),
0025         recLumi_(0),
0026         nMis_(0),
0027         minMisEB_(0),
0028         maxMisEB_(0),
0029         minMisEE_(0),
0030         maxMisEE_(0) {}
0031 
0032   EcalPhiSymInfo(
0033       uint64_t hitsEB, uint64_t hitsEE, uint64_t nEvents, uint32_t nLumis, uint16_t fill, float delivLumi, float recLumi)
0034       : totHitsEB_(hitsEB),
0035         totHitsEE_(hitsEE),
0036         nEvents_(nEvents),
0037         nLumis_(nLumis),
0038         fillNumber_(fill),
0039         delivLumi_(delivLumi),
0040         recLumi_(recLumi),
0041         nMis_(0),
0042         minMisEB_(0),
0043         maxMisEB_(0),
0044         minMisEE_(0),
0045         maxMisEE_(0) {}
0046 
0047   //---dtor---
0048   ~EcalPhiSymInfo() = default;
0049 
0050   //---setters---
0051   inline void setMiscalibInfo(
0052       const int& nmis, const float& minEB, const float& maxEB, const float& minEE, const float& maxEE) {
0053     nMis_ = nmis;
0054     minMisEB_ = minEB;
0055     maxMisEB_ = maxEB;
0056     minMisEE_ = minEE;
0057     maxMisEE_ = maxEE;
0058   };
0059 
0060   //---getters---
0061   inline uint64_t totHits() const { return totHitsEB_ + totHitsEE_; };
0062   inline uint64_t totHitsEB() const { return totHitsEB_; };
0063   inline uint64_t totHitsEE() const { return totHitsEE_; };
0064   inline uint32_t nEvents() const { return nEvents_; };
0065   inline uint16_t nLumis() const { return nLumis_; };
0066   inline uint16_t fillNumber() const { return fillNumber_; };
0067   inline float delivLumi() const { return delivLumi_; };
0068   inline float recLumi() const { return recLumi_; };
0069   inline uint8_t nMis() const { return nMis_; };
0070   inline float minMisEB() const { return minMisEB_; };
0071   inline float maxMisEB() const { return maxMisEB_; };
0072   inline float minMisEE() const { return minMisEE_; };
0073   inline float maxMisEE() const { return maxMisEE_; };
0074 
0075   //---operators---
0076   EcalPhiSymInfo& operator+=(const EcalPhiSymInfo& rhs) {
0077     // The class at the moment is designed to
0078     // hold at most data from a single run.
0079     // This implies fillNumber has to be the same,
0080     // unless it was not set, in that case it is 0.
0081     if (fillNumber_ != 0 && rhs.fillNumber() != 0)
0082       assert(fillNumber_ == rhs.fillNumber());
0083     else
0084       fillNumber_ = std::max(fillNumber_, rhs.fillNumber());
0085     totHitsEB_ += rhs.totHitsEB();
0086     totHitsEE_ += rhs.totHitsEE();
0087     nEvents_ += rhs.nEvents();
0088     nLumis_ += rhs.nLumis();
0089     delivLumi_ += rhs.delivLumi();
0090     recLumi_ += rhs.recLumi();
0091 
0092     return *this;
0093   }
0094 
0095 private:
0096   uint64_t totHitsEB_;
0097   uint64_t totHitsEE_;
0098   uint32_t nEvents_;
0099   uint16_t nLumis_;
0100   uint16_t fillNumber_;
0101   float delivLumi_;
0102   float recLumi_;
0103   uint8_t nMis_;
0104   float minMisEB_;
0105   float maxMisEB_;
0106   float minMisEE_;
0107   float maxMisEE_;
0108 };
0109 
0110 #endif