Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-24 23:46:00

0001 #include "Calibration/EcalCalibAlgos/interface/EcalPhiSymRecHit.h"
0002 
0003 //**********constructors******************************************************************
0004 EcalPhiSymRecHit::EcalPhiSymRecHit()
0005     : id_(0), eeRing_(0), chStatus_(0), nHits_(0), etSum_(1, 0.), et2Sum_(0), lcSum_(0), lc2Sum_(0) {}
0006 
0007 EcalPhiSymRecHit::EcalPhiSymRecHit(uint32_t id, unsigned int nMisCalibV, unsigned int status)
0008     : id_(id), eeRing_(0), chStatus_(status), nHits_(0), etSum_(nMisCalibV, 0.), et2Sum_(0), lcSum_(0), lc2Sum_(0) {}
0009 
0010 EcalPhiSymRecHit::EcalPhiSymRecHit(uint32_t id, std::vector<float>& etValues, unsigned int status)
0011     : id_(id),
0012       eeRing_(0),
0013       chStatus_(status),
0014       nHits_(0),
0015       etSum_(etValues.begin(), etValues.end()),
0016       et2Sum_(0),
0017       lcSum_(0),
0018       lc2Sum_(0) {}
0019 
0020 //**********utils*************************************************************************
0021 void EcalPhiSymRecHit::addHit(const std::vector<float>& etValues, const float laserCorr) {
0022   if (etValues[0] > 0.) {
0023     ++nHits_;
0024     et2Sum_ += etValues[0] * etValues[0];
0025     lcSum_ += laserCorr;
0026     lc2Sum_ += laserCorr * laserCorr;
0027   }
0028   for (unsigned int i = 0; i < std::min(etSum_.size(), etValues.size()); ++i)
0029     etSum_[i] += etValues[i];
0030 }
0031 
0032 void EcalPhiSymRecHit::reset() {
0033   nHits_ = 0.;
0034   et2Sum_ = 0.;
0035   lcSum_ = 0.;
0036   lc2Sum_ = 0.;
0037   etSum_ = std::vector<float>(etSum_.size(), 0.);
0038 }
0039 
0040 //**********operators*********************************************************************
0041 
0042 EcalPhiSymRecHit& EcalPhiSymRecHit::operator+=(const EcalPhiSymRecHit& rhs) {
0043   // assume same id, do not check channel status
0044   assert("EcalPhiSymRecHit operator+= : attempting to sum RecHits belonging to different channels" &&
0045          (id_ == rhs.rawId()));
0046   nHits_ += rhs.nHits();
0047   et2Sum_ += rhs.sumEt2();
0048   lcSum_ += rhs.lcSum();
0049   lc2Sum_ += rhs.lc2Sum();
0050   for (unsigned int i = 0; i < etSum_.size(); ++i)
0051     etSum_[i] += rhs.sumEt(i);
0052 
0053   return *this;
0054 }