Skip to content
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
5 changes: 3 additions & 2 deletions RecoLocalCalo/CaloTowersCreator/python/calotowermaker_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@
HcalPhase = cms.int32(0),

# Read HBHE thresholds from Global Tag
usePFThresholdsFromDB = cms.bool(False)

usePFThresholdsFromDB = cms.bool(False),
# Read ECAL thresholds from Global Tag
EcalRecHitThresh = cms.bool(False)
)

from Configuration.Eras.Modifier_run2_HE_2018_cff import run2_HE_2018
Expand Down
19 changes: 15 additions & 4 deletions RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreationAlgo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,10 @@ CaloTowersCreationAlgo::CaloTowersCreationAlgo(double EBthreshold,
// nalgo=N;
}

void CaloTowersCreationAlgo::setThresFromDB(const HcalPFCuts* cuts) { hcalCuts = cuts; }
void CaloTowersCreationAlgo::setThresFromDB(const EcalPFRecHitThresholds* EcalCuts, const HcalPFCuts* HcalCuts) {
ecalCuts = EcalCuts;
hcalCuts = HcalCuts;
}

void CaloTowersCreationAlgo::setGeometry(const CaloTowerTopology* cttopo,
const CaloTowerConstituentsMap* ctmap,
Expand Down Expand Up @@ -629,7 +632,7 @@ void CaloTowersCreationAlgo::assignHitHcal(const CaloRecHit* recHit) {
tower28.E_outer += e28;
tower29.E_outer += e29;
} // not a "bad" hit
} // end of special case
} // end of special case

else {
HcalDetId hcalDetId(detId);
Expand Down Expand Up @@ -1253,14 +1256,22 @@ void CaloTowersCreationAlgo::getThresholdAndWeight(const DetId& detId, double& t

EcalSubdetector subdet = (EcalSubdetector)(detId.subdetId());
if (subdet == EcalBarrel) {
threshold = theEBthreshold;
if (ecalCuts == nullptr) { // this means that ecalRecHitThresh_ is false
threshold = theEBthreshold;
} else {
threshold = (*ecalCuts)[detId];
}
weight = theEBweight;
if (weight <= 0.) {
ROOT::Math::Interpolator my(theEBGrid, theEBWeights, ROOT::Math::Interpolation::kAKIMA);
weight = my.Eval(theEBEScale);
}
} else if (subdet == EcalEndcap) {
threshold = theEEthreshold;
if (ecalCuts == nullptr) {
threshold = theEEthreshold;
} else {
threshold = (*ecalCuts)[detId];
}
weight = theEEweight;
if (weight <= 0.) {
ROOT::Math::Interpolator my(theEEGrid, theEEWeights, ROOT::Math::Interpolation::kAKIMA);
Expand Down
5 changes: 4 additions & 1 deletion RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreationAlgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include "CondFormats/DataRecord/interface/HcalPFCutsRcd.h"
#include "CondTools/Hcal/interface/HcalPFCutsHandler.h"

#include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h"

class CaloTowerTopology;
class HcalTopology;
class CaloGeometry;
Expand Down Expand Up @@ -162,7 +164,7 @@ class CaloTowersCreationAlgo {
const HcalTopology* htopo,
const CaloGeometry* geo);

void setThresFromDB(const HcalPFCuts* cuts);
void setThresFromDB(const EcalPFRecHitThresholds* EcalCuts, const HcalPFCuts* HcalCuts);
// pass the containers of channels status from the event record (stored in DB)
// these are called in CaloTowersCreator
void setHcalChStatusFromDB(const HcalChannelQuality* s) { theHcalChStatus = s; }
Expand Down Expand Up @@ -322,6 +324,7 @@ class CaloTowersCreationAlgo {
double theHOEScale;
double theHF1EScale;
double theHF2EScale;
const EcalPFRecHitThresholds* ecalCuts;
const HcalPFCuts* hcalCuts;
const CaloTowerTopology* theTowerTopology;
const HcalTopology* theHcalTopology;
Expand Down
27 changes: 22 additions & 5 deletions RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h"
#include "CondFormats/DataRecord/interface/HcalPFCutsRcd.h"
#include "CondTools/Hcal/interface/HcalPFCutsHandler.h"
#include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h"
#include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h"

class CaloTowersCreator : public edm::stream::EDProducer<> {
public:
Expand Down Expand Up @@ -90,6 +92,11 @@ class CaloTowersCreator : public edm::stream::EDProducer<> {
edm::ESGetToken<HcalPFCuts, HcalPFCutsRcd> hcalCutsToken_;
bool cutsFromDB;
HcalPFCuts const* paramPF = nullptr;

// Ecal noise thresholds
edm::ESGetToken<EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd> ecalPFRechitThresholdsToken_;
bool ecalRecHitThresh_;
EcalPFRecHitThresholds const* ecalThresholds = nullptr;
};

#include "FWCore/Framework/interface/MakerMacros.h"
Expand Down Expand Up @@ -172,9 +179,8 @@ CaloTowersCreator::CaloTowersCreator(const edm::ParameterSet& conf)

useRejectedRecoveredHcalHits_(conf.getParameter<bool>("UseRejectedRecoveredHcalHits")),
useRejectedRecoveredEcalHits_(conf.getParameter<bool>("UseRejectedRecoveredEcalHits")),
cutsFromDB(conf.getParameter<bool>("usePFThresholdsFromDB"))

{
cutsFromDB(conf.getParameter<bool>("usePFThresholdsFromDB")),
ecalRecHitThresh_(conf.getParameter<bool>("EcalRecHitThresh")) {
algo_.setMissingHcalRescaleFactorForEcal(conf.getParameter<double>("missingHcalRescaleFactorForEcal"));

// register for data access
Expand All @@ -193,6 +199,12 @@ CaloTowersCreator::CaloTowersCreator(const edm::ParameterSet& conf)
if (cutsFromDB) {
hcalCutsToken_ = esConsumes<HcalPFCuts, HcalPFCutsRcd, edm::Transition::BeginRun>(edm::ESInputTag("", "withTopo"));
}

if (ecalRecHitThresh_) {
ecalPFRechitThresholdsToken_ =
esConsumes<EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd, edm::Transition::BeginRun>();
}

const unsigned nLabels = ecalLabels_.size();
for (unsigned i = 0; i != nLabels; i++)
toks_ecal_.push_back(consumes<EcalRecHitCollection>(ecalLabels_[i]));
Expand Down Expand Up @@ -231,7 +243,12 @@ void CaloTowersCreator::beginRun(const edm::Run& run, const edm::EventSetup& es)
if (cutsFromDB) {
paramPF = &es.getData(hcalCutsToken_);
}
algo_.setThresFromDB(paramPF);

if (ecalRecHitThresh_) {
ecalThresholds = &es.getData(ecalPFRechitThresholdsToken_);
}

algo_.setThresFromDB(ecalThresholds, paramPF);
}

void CaloTowersCreator::produce(edm::Event& e, const edm::EventSetup& c) {
Expand Down Expand Up @@ -470,6 +487,6 @@ void CaloTowersCreator::fillDescriptions(edm::ConfigurationDescriptions& descrip
desc.add<std::vector<std::string> >("EcalSeveritiesToBeUsedInBadTowers", {});
desc.add<int>("HcalPhase", 0);
desc.add<bool>("usePFThresholdsFromDB", true);

desc.add<bool>("EcalRecHitThresh", false);
descriptions.addDefault(desc);
}