Skip to content

Commit 9b89607

Browse files
author
Sven Dildick
authored
Merge branch 'master' into from-CMSSW_12_0_X_2021-05-28-1100
2 parents a43263e + c9e232b commit 9b89607

File tree

103 files changed

+10359
-7897
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+10359
-7897
lines changed

Calibration/HcalAlCaRecoProducers/plugins/AlCaLowPUHBHEMuonFilter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ bool AlCaLowPUHBHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const&
179179
<< RecMuon->innerTrack().isNonnull() << " outerTrack " << RecMuon->outerTrack().isNonnull()
180180
<< " globalTrack " << RecMuon->globalTrack().isNonnull();
181181
#endif
182-
if ((RecMuon->pt() < minimumMuonpT_) || fabs(RecMuon->eta() < minimumMuoneta_))
182+
if ((RecMuon->pt() < minimumMuonpT_) || std::abs(RecMuon->eta()) < minimumMuoneta_)
183183
continue;
184184
if ((RecMuon->track().isNonnull()) && (RecMuon->innerTrack().isNonnull()) &&
185185
(RecMuon->outerTrack().isNonnull()) && (RecMuon->globalTrack().isNonnull())) {

Calibration/HcalCalibAlgos/test/HcalHBHEMuonSimAnalyzer.cc

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929

3030
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
3131
#include "Geometry/Records/interface/CaloGeometryRecord.h"
32-
#include "Geometry/Records/interface/CaloTopologyRecord.h"
3332
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
33+
#include "Geometry/Records/interface/CaloTopologyRecord.h"
3434
#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
3535
#include "Geometry/CaloTopology/interface/HcalTopology.h"
3636
#include "Geometry/CaloTopology/interface/CaloTopology.h"
@@ -43,15 +43,15 @@
4343
class HcalHBHEMuonSimAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::SharedResources> {
4444
public:
4545
explicit HcalHBHEMuonSimAnalyzer(const edm::ParameterSet&);
46-
~HcalHBHEMuonSimAnalyzer();
46+
~HcalHBHEMuonSimAnalyzer() override {}
4747

4848
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
4949

5050
private:
51-
virtual void beginJob() override;
52-
virtual void analyze(edm::Event const&, edm::EventSetup const&) override;
53-
virtual void beginRun(edm::Run const&, edm::EventSetup const&) override;
54-
virtual void endRun(edm::Run const&, edm::EventSetup const&) override {}
51+
void beginJob() override;
52+
void analyze(edm::Event const&, edm::EventSetup const&) override;
53+
void beginRun(edm::Run const&, edm::EventSetup const&) override;
54+
void endRun(edm::Run const&, edm::EventSetup const&) override {}
5555
virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {}
5656
virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {}
5757
void clearVectors();
@@ -70,12 +70,14 @@ class HcalHBHEMuonSimAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns,
7070
edm::EDGetTokenT<edm::SimVertexContainer> tok_SimVtx_;
7171
edm::EDGetTokenT<edm::PCaloHitContainer> tok_caloEB_, tok_caloEE_;
7272
edm::EDGetTokenT<edm::PCaloHitContainer> tok_caloHH_;
73-
edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_HRNDC_;
74-
edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_hdcons_;
73+
74+
edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_ddrec_;
7575
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> tok_geom_;
76+
edm::ESGetToken<CaloTopology, CaloTopologyRecord> tok_caloTopology_;
77+
edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> tok_topo_;
7678
edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> tok_magField_;
77-
edm::ESGetToken<CaloTopology, CaloTopologyRecord> tok_topo_;
78-
edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> tok_htopo_;
79+
80+
const HcalDDDRecConstants* hcons_;
7981

8082
static const int depthMax_ = 7;
8183
const int idMuon_ = 13;
@@ -117,32 +119,24 @@ HcalHBHEMuonSimAnalyzer::HcalHBHEMuonSimAnalyzer(const edm::ParameterSet& iConfi
117119
maxDepth_ = depthMax_;
118120
else if (maxDepth_ < 1)
119121
maxDepth_ = 4;
120-
#ifdef EDM_ML_DEBUG
121-
std::cout << "Labels: " << g4Label_ << ":" << ebLabel_ << ":" << eeLabel_ << ":" << hcLabel_ << "\nVerbosity "
122-
<< verbosity_ << " MaxDepth " << maxDepth_ << " Maximum Eta " << etaMax_ << " tMin|tMax " << tMinE_ << ":"
123-
<< tMaxE_ << ":" << tMinH_ << ":" << tMaxH_ << std::endl;
124-
#endif
125-
tok_HRNDC_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>();
126-
tok_hdcons_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord>();
122+
123+
edm::LogVerbatim("HBHEMuon") << "Labels: " << g4Label_ << ":" << ebLabel_ << ":" << eeLabel_ << ":" << hcLabel_
124+
<< "\nVerbosity " << verbosity_ << " MaxDepth " << maxDepth_ << " Maximum Eta "
125+
<< etaMax_ << " tMin|tMax " << tMinE_ << ":" << tMaxE_ << ":" << tMinH_ << ":" << tMaxH_;
126+
127+
tok_ddrec_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>();
127128
tok_geom_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
129+
tok_caloTopology_ = esConsumes<CaloTopology, CaloTopologyRecord>();
130+
tok_topo_ = esConsumes<HcalTopology, HcalRecNumberingRecord>();
128131
tok_magField_ = esConsumes<MagneticField, IdealMagneticFieldRecord>();
129-
tok_topo_ = esConsumes<CaloTopology, CaloTopologyRecord>();
130-
tok_htopo_ = esConsumes<HcalTopology, HcalRecNumberingRecord>();
131132
}
132133

133-
HcalHBHEMuonSimAnalyzer::~HcalHBHEMuonSimAnalyzer() {}
134-
135134
void HcalHBHEMuonSimAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
136135
clearVectors();
137136
bool debug(false);
138137
#ifdef EDM_ML_DEBUG
139138
debug = ((verbosity_ / 10) > 0);
140139
#endif
141-
// depthHE is the first depth index for HE for |ieta| = 16
142-
// It used to be 3 for all runs preceding 2017 and 4 beyond that
143-
int depthHE = (maxDepth_ <= 6) ? 3 : 4;
144-
145-
const HcalDDDRecConstants* hcons = &iSetup.getData(tok_hdcons_);
146140

147141
runNumber_ = iEvent.id().run();
148142
eventNumber_ = iEvent.id().event();
@@ -177,9 +171,9 @@ void HcalHBHEMuonSimAnalyzer::analyze(const edm::Event& iEvent, const edm::Event
177171
if (testN) {
178172
for (edm::PCaloHitContainer::const_iterator itr = pcalohh->begin(); itr != pcalohh->end(); ++itr) {
179173
PCaloHit hit(*itr);
180-
DetId newid = HcalHitRelabeller::relabel(hit.id(), hcons);
174+
DetId newid = HcalHitRelabeller::relabel(hit.id(), hcons_);
181175
#ifdef EDM_ML_DEBUG
182-
std::cout << "Old ID " << std::hex << hit.id() << std::dec << " New " << HcalDetId(newid) << std::endl;
176+
edm::LogVerbatim("HBHEMuon") << "Old ID " << std::hex << hit.id() << std::dec << " New " << HcalDetId(newid);
183177
#endif
184178
hit.setID(newid.rawId());
185179
calohh.push_back(hit);
@@ -191,8 +185,8 @@ void HcalHBHEMuonSimAnalyzer::analyze(const edm::Event& iEvent, const edm::Event
191185
// get handles to calogeometry and calotopology
192186
const CaloGeometry* geo = &iSetup.getData(tok_geom_);
193187
const MagneticField* bField = &iSetup.getData(tok_magField_);
194-
const CaloTopology* caloTopology = &iSetup.getData(tok_topo_);
195-
const HcalTopology* theHBHETopology = &iSetup.getData(tok_htopo_);
188+
const CaloTopology* caloTopology = &iSetup.getData(tok_caloTopology_);
189+
const HcalTopology* theHBHETopology = &iSetup.getData(tok_topo_);
196190

197191
// Loop over all SimTracks
198192
for (edm::SimTrackContainer::const_iterator simTrkItr = SimTk->begin(); simTrkItr != SimTk->end(); simTrkItr++) {
@@ -211,12 +205,13 @@ void HcalHBHEMuonSimAnalyzer::analyze(const edm::Event& iEvent, const edm::Event
211205

212206
#ifdef EDM_ML_DEBUG
213207
if ((verbosity_ % 10) > 0)
214-
std::cout << "Track Type " << simTrkItr->type() << " Vertex " << simTrkItr->vertIndex() << " Charge "
215-
<< simTrkItr->charge() << " Momentum " << simTrkItr->momentum().P() << ":"
216-
<< simTrkItr->momentum().eta() << ":" << simTrkItr->momentum().phi() << " ECAL|HCAL " << trkD.okECAL
217-
<< ":" << trkD.okHCAL << " Point " << trkD.pointECAL << ":" << trkD.pointHCAL << " Direction "
218-
<< trkD.directionECAL.eta() << ":" << trkD.directionECAL.phi() << " | " << trkD.directionHCAL.eta()
219-
<< ":" << trkD.directionHCAL.phi() << std::endl;
208+
edm::LogVerbatim("HBHEMuon") << "Track Type " << simTrkItr->type() << " Vertex " << simTrkItr->vertIndex()
209+
<< " Charge " << simTrkItr->charge() << " Momentum " << simTrkItr->momentum().P()
210+
<< ":" << simTrkItr->momentum().eta() << ":" << simTrkItr->momentum().phi()
211+
<< " ECAL|HCAL " << trkD.okECAL << ":" << trkD.okHCAL << " Point "
212+
<< trkD.pointECAL << ":" << trkD.pointHCAL << " Direction "
213+
<< trkD.directionECAL.eta() << ":" << trkD.directionECAL.phi() << " | "
214+
<< trkD.directionHCAL.eta() << ":" << trkD.directionHCAL.phi();
220215
#endif
221216
bool propageback(false);
222217
spr::propagatedTrackDirection trkD_back = spr::propagateHCALBack(thisTrk, SimTk, SimVtx, geo, bField, debug);
@@ -234,11 +229,10 @@ void HcalHBHEMuonSimAnalyzer::analyze(const edm::Event& iEvent, const edm::Event
234229
pMuon_.push_back(tkvx.momentum.mag());
235230
#ifdef EDM_ML_DEBUG
236231
if ((verbosity_ % 10) > 0)
237-
std::cout << "Track at vertex " << tkvx.ok << " position " << tkvx.position << " Momentum "
238-
<< tkvx.momentum.mag() << ":" << tkvx.momentum.eta() << ":" << tkvx.momentum.phi() << " Charge "
239-
<< tkvx.charge << std::endl;
232+
edm::LogVerbatim("HBHEMuon") << "Track at vertex " << tkvx.ok << " position " << tkvx.position << " Momentum "
233+
<< tkvx.momentum.mag() << ":" << tkvx.momentum.eta() << ":"
234+
<< tkvx.momentum.phi() << " Charge " << tkvx.charge;
240235
#endif
241-
242236
// Energy in ECAL
243237
DetId isoCell;
244238
if (trkD.okECAL) {
@@ -257,16 +251,27 @@ void HcalHBHEMuonSimAnalyzer::analyze(const edm::Event& iEvent, const edm::Event
257251
theHBHETopology, closestCell, calohh, 0, 0, false, -100.0, -100.0, -100.0, -100.0, tMinH_, tMaxH_, debug);
258252
#ifdef EDM_ML_DEBUG
259253
if ((verbosity_ % 10) > 0)
260-
std::cout << "eEcal " << trkD.okECAL << ":" << eEcal << " eHcal " << eHcal << std::endl;
254+
edm::LogVerbatim("HBHEMuon") << "eEcal " << trkD.okECAL << ":" << eEcal << " eHcal " << eHcal;
261255
#endif
262-
263256
HcalSubdetector subdet = HcalDetId(closestCell).subdet();
264257
int ieta = HcalDetId(closestCell).ieta();
265258
int iphi = HcalDetId(closestCell).iphi();
259+
int zside = HcalDetId(closestCell).zside();
266260
bool hbhe = (std::abs(ieta) == 16);
261+
int depthHE = hcons_->getMinDepth(1, 16, iphi, zside);
267262
std::vector<std::pair<double, int> > ehdepth;
268-
spr::energyHCALCell(
269-
(HcalDetId)closestCell, calohh, ehdepth, maxDepth_, -100.0, -100.0, -100.0, -100.0, -500.0, 500.0, debug);
263+
spr::energyHCALCell((HcalDetId)closestCell,
264+
calohh,
265+
ehdepth,
266+
maxDepth_,
267+
-100.0,
268+
-100.0,
269+
-100.0,
270+
-100.0,
271+
-500.0,
272+
500.0,
273+
depthHE,
274+
debug);
270275
for (unsigned int i = 0; i < ehdepth.size(); ++i) {
271276
eHcalDepth[ehdepth[i].second - 1] = ehdepth[i].first;
272277
HcalSubdetector subdet0 = (hbhe) ? ((ehdepth[i].second >= depthHE) ? HcalEndcap : HcalBarrel) : subdet;
@@ -276,31 +281,26 @@ void HcalHBHEMuonSimAnalyzer::analyze(const edm::Event& iEvent, const edm::Event
276281
activeLengthTot += actL;
277282
#ifdef EDM_ML_DEBUG
278283
if ((verbosity_ % 10) > 0)
279-
std::cout << hcid0 << " E " << ehdepth[i].first << " L " << actL << std::endl;
284+
edm::LogVerbatim("HBHEMuon") << hcid0 << " E " << ehdepth[i].first << " L " << actL;
280285
#endif
281286
}
282287

283288
HcalDetId hotCell;
284-
#ifdef EDM_ML_DEBUG
285-
double h3x3 =
286-
#endif
287-
spr::eHCALmatrix(geo, theHBHETopology, closestCell, calohh, 1, 1, hotCell, debug);
289+
double h3x3 = spr::eHCALmatrix(geo, theHBHETopology, closestCell, calohh, 1, 1, hotCell, debug);
288290
isHot = matchId(closestCell, hotCell);
289-
#ifdef EDM_ML_DEBUG
290291
if ((verbosity_ % 10) > 0)
291-
std::cout << "hcal 3X3 < " << h3x3 << ">"
292-
<< " ClosestCell <" << (HcalDetId)(closestCell) << "> hotCell id < " << hotCell << "> isHot"
293-
<< isHot << std::endl;
294-
#endif
295-
292+
edm::LogVerbatim("HBHEMuon") << "hcal 3X3 < " << h3x3 << "> ClosestCell <" << (HcalDetId)(closestCell)
293+
<< "> hotCell id < " << hotCell << "> isHot" << isHot;
296294
if (hotCell != HcalDetId()) {
297295
subdet = HcalDetId(hotCell).subdet();
298296
ieta = HcalDetId(hotCell).ieta();
299297
iphi = HcalDetId(hotCell).iphi();
298+
zside = HcalDetId(hotCell).zside();
300299
hbhe = (std::abs(ieta) == 16);
300+
depthHE = hcons_->getMinDepth(1, 16, iphi, zside);
301301
std::vector<std::pair<double, int> > ehdepth;
302302
spr::energyHCALCell(
303-
hotCell, calohh, ehdepth, maxDepth_, -100.0, -100.0, -100.0, -100.0, tMinH_, tMaxH_, debug);
303+
hotCell, calohh, ehdepth, maxDepth_, -100.0, -100.0, -100.0, -100.0, tMinH_, tMaxH_, depthHE, debug);
304304
for (unsigned int i = 0; i < ehdepth.size(); ++i) {
305305
eHcalDepthHot[ehdepth[i].second - 1] = ehdepth[i].first;
306306
HcalSubdetector subdet0 = (hbhe) ? ((ehdepth[i].second >= depthHE) ? HcalEndcap : HcalBarrel) : subdet;
@@ -310,14 +310,14 @@ void HcalHBHEMuonSimAnalyzer::analyze(const edm::Event& iEvent, const edm::Event
310310
activeLengthHotTot += actL;
311311
#ifdef EDM_ML_DEBUG
312312
if ((verbosity_ % 10) > 0)
313-
std::cout << hcid0 << " E " << ehdepth[i].first << " L " << actL << std::endl;
313+
edm::LogVerbatim("HBHEMuon") << hcid0 << " E " << ehdepth[i].first << " L " << actL;
314314
#endif
315315
}
316316
}
317317
#ifdef EDM_ML_DEBUG
318318
if ((verbosity_ % 10) > 0) {
319319
for (int k = 0; k < depthMax_; ++k)
320-
std::cout << "Depth " << k << " E " << eHcalDepth[k] << ":" << eHcalDepthHot[k] << std::endl;
320+
edm::LogVerbatim("HBHEMuon") << "Depth " << k << " E " << eHcalDepth[k] << ":" << eHcalDepthHot[k];
321321
}
322322
#endif
323323
matchedId_.push_back(tmpmatch);
@@ -336,7 +336,7 @@ void HcalHBHEMuonSimAnalyzer::analyze(const edm::Event& iEvent, const edm::Event
336336
}
337337
}
338338
}
339-
if (hcalHot_.size() > 0)
339+
if (!hcalHot_.empty())
340340
tree_->Fill();
341341
}
342342

@@ -373,11 +373,11 @@ void HcalHBHEMuonSimAnalyzer::beginJob() {
373373
}
374374

375375
void HcalHBHEMuonSimAnalyzer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {
376-
const HcalDDDRecConstants& hdc = iSetup.getData(tok_HRNDC_);
376+
hcons_ = &iSetup.getData(tok_ddrec_);
377377
actHB_.clear();
378378
actHE_.clear();
379-
actHB_ = hdc.getThickActive(0);
380-
actHE_ = hdc.getThickActive(1);
379+
actHB_ = hcons_->getThickActive(0);
380+
actHE_ = hcons_->getThickActive(1);
381381
}
382382

383383
void HcalHBHEMuonSimAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {

Calibration/IsolatedParticles/plugins/BuildFile.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,3 @@
6969

7070
<library name="CalibrationHcalRaddamMuon" file="HcalRaddamMuon.cc">
7171
</library>
72-
73-
<library name="CalibrationHcalHBHEMuonSimAnalyzer" file="HcalHBHEMuonSimAnalyzer.cc">
74-
</library>

0 commit comments

Comments
 (0)