Skip to content

Commit

Permalink
Merge pull request #37344 from simonepigazzini/ecal-phisym-run3-wf
Browse files Browse the repository at this point in the history
 [12_3_X] Ecal phisym run3 workflow
  • Loading branch information
cmsbuild authored Mar 25, 2022
2 parents 316c579 + 5267111 commit a176cd0
Show file tree
Hide file tree
Showing 23 changed files with 1,372 additions and 2,568 deletions.
110 changes: 110 additions & 0 deletions Calibration/EcalCalibAlgos/interface/EcalPhiSymInfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#ifndef Calibration_EcalCalibAlgos_EcalPhiSymInfo_h
#define Calibration_EcalCalibAlgos_EcalPhiSymInfo_h

/** \class EcalPhiSymInfo
*
* EcalPhiSym calibration lumi/run based information
*
* Original Author: Simone Pigazzini (2022)
*/

#include <vector>
#include <cstdint>
#include <cassert>

class EcalPhiSymInfo {
public:
//---ctors---
EcalPhiSymInfo()
: totHitsEB_(0),
totHitsEE_(0),
nEvents_(0),
nLumis_(0),
fillNumber_(0),
delivLumi_(0),
recLumi_(0),
nMis_(0),
minMisEB_(0),
maxMisEB_(0),
minMisEE_(0),
maxMisEE_(0) {}

EcalPhiSymInfo(
uint64_t hitsEB, uint64_t hitsEE, uint64_t nEvents, uint32_t nLumis, uint16_t fill, float delivLumi, float recLumi)
: totHitsEB_(hitsEB),
totHitsEE_(hitsEE),
nEvents_(nEvents),
nLumis_(nLumis),
fillNumber_(fill),
delivLumi_(delivLumi),
recLumi_(recLumi),
nMis_(0),
minMisEB_(0),
maxMisEB_(0),
minMisEE_(0),
maxMisEE_(0) {}

//---dtor---
~EcalPhiSymInfo() = default;

//---setters---
inline void setMiscalibInfo(
const int& nmis, const float& minEB, const float& maxEB, const float& minEE, const float& maxEE) {
nMis_ = nmis;
minMisEB_ = minEB;
maxMisEB_ = maxEB;
minMisEE_ = minEE;
maxMisEE_ = maxEE;
};

//---getters---
inline uint64_t totHits() const { return totHitsEB_ + totHitsEE_; };
inline uint64_t totHitsEB() const { return totHitsEB_; };
inline uint64_t totHitsEE() const { return totHitsEE_; };
inline uint32_t nEvents() const { return nEvents_; };
inline uint16_t nLumis() const { return nLumis_; };
inline uint16_t fillNumber() const { return fillNumber_; };
inline float delivLumi() const { return delivLumi_; };
inline float recLumi() const { return recLumi_; };
inline uint8_t nMis() const { return nMis_; };
inline float minMisEB() const { return minMisEB_; };
inline float maxMisEB() const { return maxMisEB_; };
inline float minMisEE() const { return minMisEE_; };
inline float maxMisEE() const { return maxMisEE_; };

//---operators---
EcalPhiSymInfo& operator+=(const EcalPhiSymInfo& rhs) {
// The class at the moment is designed to
// hold at most data from a single run.
// This implies fillNumber has to be the same,
// unless it was not set, in that case it is 0.
if (fillNumber_ != 0 && rhs.fillNumber() != 0)
assert(fillNumber_ == rhs.fillNumber());
else
fillNumber_ = std::max(fillNumber_, rhs.fillNumber());
totHitsEB_ += rhs.totHitsEB();
totHitsEE_ += rhs.totHitsEE();
nEvents_ += rhs.nEvents();
nLumis_ += rhs.nLumis();
delivLumi_ += rhs.delivLumi();
recLumi_ += rhs.recLumi();

return *this;
}

private:
uint64_t totHitsEB_;
uint64_t totHitsEE_;
uint32_t nEvents_;
uint16_t nLumis_;
uint16_t fillNumber_;
float delivLumi_;
float recLumi_;
uint8_t nMis_;
float minMisEB_;
float maxMisEB_;
float minMisEE_;
float maxMisEE_;
};

#endif
68 changes: 68 additions & 0 deletions Calibration/EcalCalibAlgos/interface/EcalPhiSymRecHit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#ifndef Calibration_EcalCalibAlgos_EcalPhiSymRecHit_h
#define Calibration_EcalCalibAlgos_EcalPhiSymRecHit_h

/** \class EcalPhiSymRecHit
*
* Dataformat dedicated to Phi Symmetry ecal calibration
*
* Note: SumEt array ordering:
* 0 - central value
* 1<->N/2 - misCalib<1
* N/2+1<->N - misCalib>1
*
* Original Author: Simone Pigazzini (2022)
*/

#include <vector>
#include <cassert>

#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"

class EcalPhiSymRecHit {
public:
//---ctors---
EcalPhiSymRecHit();
EcalPhiSymRecHit(uint32_t id, unsigned int nMisCalibV, unsigned int status = 0);
EcalPhiSymRecHit(uint32_t id, std::vector<float>& etValues, unsigned int status = 0);

//---dtor---
~EcalPhiSymRecHit() = default;

//---getters---
inline uint32_t rawId() const { return id_; };
inline int8_t eeRing() const { return eeRing_; };
inline unsigned int statusCode() const { return chStatus_; };
inline uint32_t nHits() const { return nHits_; };
inline unsigned int nSumEt() const { return etSum_.size(); };
inline float sumEt(int i = 0) const { return etSum_[i]; };
inline float sumEt2() const { return et2Sum_; };
inline float lcSum() const { return lcSum_; };
inline float lc2Sum() const { return lc2Sum_; };

//---setters---
void setEERing(const int8_t& eering) { eeRing_ = eering; };

//---utils---
void addHit(const std::vector<float>& etValues, const float laserCorr = 0);
void reset();

//---operators---
EcalPhiSymRecHit& operator+=(const EcalPhiSymRecHit& rhs);

private:
uint32_t id_;
int8_t eeRing_;
unsigned int chStatus_;
uint32_t nHits_;
std::vector<float> etSum_;
float et2Sum_;
float lcSum_;
float lc2Sum_;
};

typedef std::vector<EcalPhiSymRecHit> EcalPhiSymRecHitCollection;

#endif
166 changes: 0 additions & 166 deletions Calibration/EcalCalibAlgos/interface/PhiSymmetryCalibration.h

This file was deleted.

18 changes: 18 additions & 0 deletions Calibration/EcalCalibAlgos/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
<use name="FWCore/Framework"/>
<use name="FWCore/Utilities"/>
<use name="FWCore/PluginManager"/>
<use name="FWCore/ParameterSet"/>
<use name="SimDataFormats/GeneratorProducts"/>
<use name="DataFormats/EcalRecHit"/>
<use name="DataFormats/EcalDetId"/>
<use name="CondFormats/EcalObjects"/>
<use name="CondFormats/RunInfo"/>
<use name="CondFormats/DataRecord"/>
<use name="Geometry/CaloGeometry"/>
<use name="Geometry/CaloTopology"/>
<use name="Geometry/EcalAlgo"/>
<use name="RecoEcal/EgammaCoreTools"/>
<use name="RecoLocalCalo/EcalRecAlgos"/>
<use name="CalibCalorimetry/CaloMiscalibTools"/>
<use name="Calibration/Tools"/>
<use name="PhysicsTools/NanoAOD"/>
<use name="Calibration/EcalCalibAlgos"/>
<flags EDM_PLUGIN="1"/>
18 changes: 18 additions & 0 deletions Calibration/EcalCalibAlgos/plugins/EcalPhiSymFlatTableProducers.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h"

#include "Calibration/EcalCalibAlgos/interface/EcalPhiSymRecHit.h"
#include "Calibration/EcalCalibAlgos/interface/EcalPhiSymInfo.h"

typedef LumiSimpleFlatTableProducer<EcalPhiSymRecHit, EcalPhiSymRecHitCollection> EcalPhiSymRecHitFlatTableProducerLumi;

typedef LumiSingletonSimpleFlatTableProducer<EcalPhiSymInfo> EcalPhiSymInfoFlatTableProducerLumi;

typedef RunSimpleFlatTableProducer<EcalPhiSymRecHit, EcalPhiSymRecHitCollection> EcalPhiSymRecHitFlatTableProducerRun;

typedef RunSingletonSimpleFlatTableProducer<EcalPhiSymInfo> EcalPhiSymInfoFlatTableProducerRun;

#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(EcalPhiSymRecHitFlatTableProducerLumi);
DEFINE_FWK_MODULE(EcalPhiSymInfoFlatTableProducerLumi);
DEFINE_FWK_MODULE(EcalPhiSymRecHitFlatTableProducerRun);
DEFINE_FWK_MODULE(EcalPhiSymInfoFlatTableProducerRun);
Loading

0 comments on commit a176cd0

Please sign in to comment.