Skip to content

Commit 979e229

Browse files
committed
migrate calotowers to use EcalPFRecHitThresholds,false by default
1 parent 452f428 commit 979e229

File tree

4 files changed

+44
-12
lines changed

4 files changed

+44
-12
lines changed

RecoLocalCalo/CaloTowersCreator/python/calotowermaker_cfi.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@
149149
HcalPhase = cms.int32(0),
150150

151151
# Read HBHE thresholds from Global Tag
152-
usePFThresholdsFromDB = cms.bool(False)
153-
152+
usePFThresholdsFromDB = cms.bool(False),
153+
# Read ECAL thresholds from Global Tag
154+
EcalRecHitThresh = cms.bool(False)
154155
)
155156

156157
from Configuration.Eras.Modifier_run2_HE_2018_cff import run2_HE_2018

RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreationAlgo.cc

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,10 @@ CaloTowersCreationAlgo::CaloTowersCreationAlgo(double EBthreshold,
353353
// nalgo=N;
354354
}
355355

356-
void CaloTowersCreationAlgo::setThresFromDB(const HcalPFCuts* cuts) { hcalCuts = cuts; }
356+
void CaloTowersCreationAlgo::setThresFromDB(const EcalPFRecHitThresholds* EcalCuts, const HcalPFCuts* HcalCuts) {
357+
ecalCuts = EcalCuts;
358+
hcalCuts = HcalCuts;
359+
}
357360

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

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

12541257
EcalSubdetector subdet = (EcalSubdetector)(detId.subdetId());
12551258
if (subdet == EcalBarrel) {
1256-
threshold = theEBthreshold;
1259+
if (ecalCuts == nullptr) { // this means that ecalRecHitThresh_ is false
1260+
threshold = theEBthreshold;
1261+
} else {
1262+
threshold = (*ecalCuts)[detId];
1263+
}
12571264
weight = theEBweight;
12581265
if (weight <= 0.) {
12591266
ROOT::Math::Interpolator my(theEBGrid, theEBWeights, ROOT::Math::Interpolation::kAKIMA);
12601267
weight = my.Eval(theEBEScale);
12611268
}
12621269
} else if (subdet == EcalEndcap) {
1263-
threshold = theEEthreshold;
1270+
if (ecalCuts == nullptr) {
1271+
threshold = theEEthreshold;
1272+
} else {
1273+
threshold = (*ecalCuts)[detId];
1274+
}
12641275
weight = theEEweight;
12651276
if (weight <= 0.) {
12661277
ROOT::Math::Interpolator my(theEEGrid, theEEWeights, ROOT::Math::Interpolation::kAKIMA);

RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreationAlgo.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include "CondFormats/DataRecord/interface/HcalPFCutsRcd.h"
3131
#include "CondTools/Hcal/interface/HcalPFCutsHandler.h"
3232

33+
#include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h"
34+
3335
class CaloTowerTopology;
3436
class HcalTopology;
3537
class CaloGeometry;
@@ -162,7 +164,7 @@ class CaloTowersCreationAlgo {
162164
const HcalTopology* htopo,
163165
const CaloGeometry* geo);
164166

165-
void setThresFromDB(const HcalPFCuts* cuts);
167+
void setThresFromDB(const EcalPFRecHitThresholds* EcalCuts, const HcalPFCuts* HcalCuts);
166168
// pass the containers of channels status from the event record (stored in DB)
167169
// these are called in CaloTowersCreator
168170
void setHcalChStatusFromDB(const HcalChannelQuality* s) { theHcalChStatus = s; }
@@ -322,6 +324,7 @@ class CaloTowersCreationAlgo {
322324
double theHOEScale;
323325
double theHF1EScale;
324326
double theHF2EScale;
327+
const EcalPFRecHitThresholds* ecalCuts;
325328
const HcalPFCuts* hcalCuts;
326329
const CaloTowerTopology* theTowerTopology;
327330
const HcalTopology* theHcalTopology;

RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.cc

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h"
2727
#include "CondFormats/DataRecord/interface/HcalPFCutsRcd.h"
2828
#include "CondTools/Hcal/interface/HcalPFCutsHandler.h"
29+
#include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h"
30+
#include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h"
2931

3032
class CaloTowersCreator : public edm::stream::EDProducer<> {
3133
public:
@@ -90,6 +92,11 @@ class CaloTowersCreator : public edm::stream::EDProducer<> {
9092
edm::ESGetToken<HcalPFCuts, HcalPFCutsRcd> hcalCutsToken_;
9193
bool cutsFromDB;
9294
HcalPFCuts const* paramPF = nullptr;
95+
96+
// Ecal noise thresholds
97+
edm::ESGetToken<EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd> ecalPFRechitThresholdsToken_;
98+
bool ecalRecHitThresh_;
99+
EcalPFRecHitThresholds const* ecalThresholds = nullptr;
93100
};
94101

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

173180
useRejectedRecoveredHcalHits_(conf.getParameter<bool>("UseRejectedRecoveredHcalHits")),
174181
useRejectedRecoveredEcalHits_(conf.getParameter<bool>("UseRejectedRecoveredEcalHits")),
175-
cutsFromDB(conf.getParameter<bool>("usePFThresholdsFromDB"))
176-
177-
{
182+
cutsFromDB(conf.getParameter<bool>("usePFThresholdsFromDB")),
183+
ecalRecHitThresh_(conf.getParameter<bool>("EcalRecHitThresh")) {
178184
algo_.setMissingHcalRescaleFactorForEcal(conf.getParameter<double>("missingHcalRescaleFactorForEcal"));
179185

180186
// register for data access
@@ -193,6 +199,12 @@ CaloTowersCreator::CaloTowersCreator(const edm::ParameterSet& conf)
193199
if (cutsFromDB) {
194200
hcalCutsToken_ = esConsumes<HcalPFCuts, HcalPFCutsRcd, edm::Transition::BeginRun>(edm::ESInputTag("", "withTopo"));
195201
}
202+
203+
if (ecalRecHitThresh_) {
204+
ecalPFRechitThresholdsToken_ =
205+
esConsumes<EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd, edm::Transition::BeginRun>();
206+
}
207+
196208
const unsigned nLabels = ecalLabels_.size();
197209
for (unsigned i = 0; i != nLabels; i++)
198210
toks_ecal_.push_back(consumes<EcalRecHitCollection>(ecalLabels_[i]));
@@ -231,7 +243,12 @@ void CaloTowersCreator::beginRun(const edm::Run& run, const edm::EventSetup& es)
231243
if (cutsFromDB) {
232244
paramPF = &es.getData(hcalCutsToken_);
233245
}
234-
algo_.setThresFromDB(paramPF);
246+
247+
if (ecalRecHitThresh_) {
248+
ecalThresholds = &es.getData(ecalPFRechitThresholdsToken_);
249+
}
250+
251+
algo_.setThresFromDB(ecalThresholds, paramPF);
235252
}
236253

237254
void CaloTowersCreator::produce(edm::Event& e, const edm::EventSetup& c) {
@@ -470,6 +487,6 @@ void CaloTowersCreator::fillDescriptions(edm::ConfigurationDescriptions& descrip
470487
desc.add<std::vector<std::string> >("EcalSeveritiesToBeUsedInBadTowers", {});
471488
desc.add<int>("HcalPhase", 0);
472489
desc.add<bool>("usePFThresholdsFromDB", true);
473-
490+
desc.add<bool>("EcalRecHitThresh", false);
474491
descriptions.addDefault(desc);
475492
}

0 commit comments

Comments
 (0)