Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ecal phisym run3 workflow #36988

Merged
merged 13 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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