Skip to content

Commit cf6e903

Browse files
authored
Merge pull request #48278 from kyungminparkdrums/151X_SpikeKillerEcalDQM
Add spike killer monitoring plots for ECAL DQM
2 parents 43aeef0 + 61cda8d commit cf6e903

File tree

3 files changed

+160
-2
lines changed

3 files changed

+160
-2
lines changed

DQM/EcalMonitorTasks/interface/TrigPrimTask.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
#include "CondFormats/DataRecord/interface/EcalTPGTowerStatusRcd.h"
1717
#include "CondFormats/DataRecord/interface/EcalTPGStripStatusRcd.h"
1818

19+
#include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h"
20+
#include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h"
21+
1922
namespace ecaldqm {
2023

2124
class TrigPrimTask : public DQWorkerTask {
@@ -34,11 +37,14 @@ namespace ecaldqm {
3437
void runOnEmulTPs(EcalTrigPrimDigiCollection const&);
3538
template <typename DigiCollection>
3639
void runOnDigis(DigiCollection const&);
40+
void runOnRecHits(EcalRecHitCollection const&, Collections);
3741

3842
void setTokens(edm::ConsumesCollector&) override;
3943

4044
enum Constants { nBXBins = 15 };
4145

46+
void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
47+
4248
private:
4349
void setParams(edm::ParameterSet const&) override;
4450

@@ -56,6 +62,9 @@ namespace ecaldqm {
5662
double bxBin_;
5763
double bxBinFine_;
5864

65+
double etSum_;
66+
double etSpikeMatchSum_;
67+
5968
std::map<uint32_t, unsigned> towerReadouts_;
6069

6170
edm::ESGetToken<EcalTPGTowerStatus, EcalTPGTowerStatusRcd> TTStatusRcd_;
@@ -65,10 +74,21 @@ namespace ecaldqm {
6574

6675
edm::InputTag lhcStatusInfoCollectionTag_;
6776
edm::EDGetTokenT<TCDSRecord> lhcStatusInfoRecordToken_;
77+
78+
std::map<EcalTrigTowerDetId, float> mapTowerMaxRecHitEnergy_;
79+
std::map<EcalTrigTowerDetId, int> mapTowerOfflineSpikes_;
80+
edm::ESGetToken<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd> severityToken_;
81+
const EcalSeverityLevelAlgo* sevLevel;
6882
};
6983

7084
inline bool TrigPrimTask::analyze(void const* _p, Collections _collection) {
7185
switch (_collection) {
86+
case kEBRecHit:
87+
case kEERecHit:
88+
if (_p)
89+
runOnRecHits(*static_cast<EcalRecHitCollection const*>(_p), _collection);
90+
return true;
91+
break;
7292
case kTrigPrimDigi:
7393
if (_p)
7494
runOnRealTPs(*static_cast<EcalTrigPrimDigiCollection const*>(_p));

DQM/EcalMonitorTasks/python/TrigPrimTask_cfi.py

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@
213213
btype = cms.untracked.string('TriggerTower'),
214214
description = cms.untracked.string('')
215215
),
216+
TTSpikeOffline = cms.untracked.PSet(
217+
path = cms.untracked.string('%(subdet)s/%(prefix)sSelectiveReadoutTask/%(prefix)sSRT TT LUT for Offline Spikes%(suffix)s'),
218+
kind = cms.untracked.string('TH2F'),
219+
otype = cms.untracked.string('Ecal3P'),
220+
btype = cms.untracked.string('TriggerTower'),
221+
description = cms.untracked.string('')
222+
),
216223
EtSummary = cms.untracked.PSet(
217224
path = cms.untracked.string('%(subdet)s/%(prefix)sSummaryClient/%(prefix)sTTT%(suffix)s Et trigger tower summary'),
218225
kind = cms.untracked.string('TProfile2D'),
@@ -257,14 +264,66 @@
257264
kind = cms.untracked.string('TH1F'),
258265
otype = cms.untracked.string('Ecal3P'),
259266
xaxis = cms.untracked.PSet(
260-
high = cms.untracked.double(256.0),
267+
high = cms.untracked.double(128.0),
261268
nbins = cms.untracked.int32(128),
262269
low = cms.untracked.double(0.0),
263-
title = cms.untracked.string('TP Et')
270+
title = cms.untracked.string('Et threshold (GeV)')
264271
),
265272
btype = cms.untracked.string('User'),
266273
description = cms.untracked.string('Distribution of the trigger primitive Et.')
267274
),
275+
EtRealSpikeMatched = cms.untracked.PSet(
276+
path = cms.untracked.string('%(subdet)s/%(prefix)sTriggerTowerTask/%(prefix)sTTT Et spectrum Real Digis matched to spikes %(suffix)s'),
277+
kind = cms.untracked.string('TH1F'),
278+
otype = cms.untracked.string('Ecal3P'),
279+
xaxis = cms.untracked.PSet(
280+
high = cms.untracked.double(128.0),
281+
nbins = cms.untracked.int32(128),
282+
low = cms.untracked.double(0.0),
283+
title = cms.untracked.string('Et threshold (GeV)')
284+
),
285+
btype = cms.untracked.string('User'),
286+
description = cms.untracked.string('Distribution of the trigger primitive Et. for TT matched to spikes')
287+
),
288+
EffSpikeMatch = cms.untracked.PSet(
289+
path = cms.untracked.string('%(subdet)s/%(prefix)sTriggerTowerTask/%(prefix)sTTT Efficiency of spike killer matching%(suffix)s'),
290+
kind = cms.untracked.string('TH1F'),
291+
otype = cms.untracked.string('Ecal3P'),
292+
xaxis = cms.untracked.PSet(
293+
high = cms.untracked.double(128.0),
294+
nbins = cms.untracked.int32(128),
295+
low = cms.untracked.double(0.0),
296+
title = cms.untracked.string('Et threshold (GeV)')
297+
),
298+
btype = cms.untracked.string('User'),
299+
description = cms.untracked.string('Efficiency of spike killer matching')
300+
),
301+
EtRealIntVsThres = cms.untracked.PSet(
302+
path = cms.untracked.string('%(subdet)s/%(prefix)sTriggerTowerTask/%(prefix)sTTT Rate of TP with Et above threshold vs Et threshold%(suffix)s'),
303+
kind = cms.untracked.string('TH1F'),
304+
otype = cms.untracked.string('Ecal3P'),
305+
xaxis = cms.untracked.PSet(
306+
high = cms.untracked.double(128.0),
307+
nbins = cms.untracked.int32(128),
308+
low = cms.untracked.double(0.0),
309+
title = cms.untracked.string('Et threshold (GeV)'),
310+
),
311+
btype = cms.untracked.string('User'),
312+
description = cms.untracked.string('Rate (TP Et > threshold)')
313+
),
314+
EtRealSpikeMatchedIntVsThres = cms.untracked.PSet(
315+
path = cms.untracked.string('%(subdet)s/%(prefix)sTriggerTowerTask/%(prefix)sTTT Rate of TP with Et above threshold (spike matched) vs Et threshold%(suffix)s'),
316+
kind = cms.untracked.string('TH1F'),
317+
otype = cms.untracked.string('Ecal3P'),
318+
xaxis = cms.untracked.PSet(
319+
high = cms.untracked.double(128.0),
320+
nbins = cms.untracked.int32(128),
321+
low = cms.untracked.double(0.0),
322+
title = cms.untracked.string('Et threshold (GeV)'),
323+
),
324+
btype = cms.untracked.string('User'),
325+
description = cms.untracked.string('Rate (TP Et > threshold) for spike matched')
326+
),
268327
RealvEmulEt = cms.untracked.PSet(
269328
kind = cms.untracked.string('TH2F'),
270329
xaxis = cms.untracked.PSet(
@@ -284,6 +343,20 @@
284343
path = cms.untracked.string('%(subdet)s/%(prefix)sTriggerTowerTask/%(prefix)sTTT Real vs Emulated TP Et%(suffix)s'),
285344
description = cms.untracked.string('Real data VS emulated TP Et (in-time)')
286345
),
346+
TrendEtSum = cms.untracked.PSet(
347+
path = cms.untracked.string('Ecal/Trends/TriggerTowerTask Et sum of TPs above threshold'),
348+
kind = cms.untracked.string('TProfile'),
349+
otype = cms.untracked.string('Ecal2P'),
350+
btype = cms.untracked.string('Trend'),
351+
description = cms.untracked.string('Trend of Et sum of TPs with Et > 30 GeV.')
352+
),
353+
TrendEtSpikeMatchSum = cms.untracked.PSet(
354+
path = cms.untracked.string('Ecal/Trends/TriggerTowerTask Et sum of TPs above threshold (Spike Matched)'),
355+
kind = cms.untracked.string('TProfile'),
356+
otype = cms.untracked.string('Ecal2P'),
357+
btype = cms.untracked.string('Trend'),
358+
description = cms.untracked.string('Trend of Et sum of TPs (spike-matched) with Et > 30 GeV.')
359+
),
287360
LHCStatusByLumi = cms.untracked.PSet(
288361
path = cms.untracked.string('Ecal/Trends/LHC status by lumi'),
289362
kind = cms.untracked.string('REAL'),

DQM/EcalMonitorTasks/src/TrigPrimTask.cc

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ namespace ecaldqm {
3535
MEs_.erase(std::string("FGEmulError"));
3636
MEs_.erase(std::string("RealvEmulEt"));
3737
}
38+
3839
lhcStatusInfoCollectionTag_ = _params.getUntrackedParameter<edm::InputTag>(
3940
"lhcStatusInfoCollectionTag", edm::InputTag("tcdsDigis", "tcdsRecord"));
4041
bxBinEdges_ = _params.getUntrackedParameter<std::vector<int> >("bxBins");
@@ -61,6 +62,8 @@ namespace ecaldqm {
6162
using namespace std;
6263

6364
towerReadouts_.clear();
65+
mapTowerOfflineSpikes_.clear();
66+
mapTowerMaxRecHitEnergy_.clear();
6467

6568
if (ByLumiResetSwitch) {
6669
MEs_.at("EtSummaryByLumi").reset(GetElectronicsMap());
@@ -112,6 +115,8 @@ namespace ecaldqm {
112115
} //masked
113116
} //loop on pseudo-strips
114117

118+
sevLevel = &_es.getData(severityToken_);
119+
115120
// if(HLTCaloPath_.size() || HLTMuonPath_.size()){
116121
// edm::TriggerResultsByName results(_evt.triggerResultsByName("HLT"));
117122
// if(!results.isValid()) results = _evt.triggerResultsByName("RECO");
@@ -180,11 +185,16 @@ namespace ecaldqm {
180185
lhcStatusInfoRecordToken_ = _collector.consumes<TCDSRecord>(lhcStatusInfoCollectionTag_);
181186
TTStatusRcd_ = _collector.esConsumes<edm::Transition::BeginRun>();
182187
StripStatusRcd_ = _collector.esConsumes<edm::Transition::BeginRun>();
188+
severityToken_ = _collector.esConsumes();
183189
}
184190

185191
void TrigPrimTask::runOnRealTPs(EcalTrigPrimDigiCollection const& _tps) {
186192
MESet& meEtVsBx(MEs_.at("EtVsBx"));
187193
MESet& meEtReal(MEs_.at("EtReal"));
194+
MESet& meEtRealIntVsThres(MEs_.at("EtRealIntVsThres"));
195+
MESet& meEtRealSpikeMatched(MEs_.at("EtRealSpikeMatched"));
196+
MESet& meEtRealSpikeMatchedIntVsThres(MEs_.at("EtRealSpikeMatchedIntVsThres"));
197+
MESet& meEffSpikeMatch(MEs_.at("EffSpikeMatch"));
188198
MESet& meEtRealMap(MEs_.at("EtRealMap"));
189199
MESet& meEtSummary(MEs_.at("EtSummary"));
190200
MESet& meEtSummaryByLumi(MEs_.at("EtSummaryByLumi"));
@@ -221,6 +231,17 @@ namespace ecaldqm {
221231
meEtSummary.fill(getEcalDQMSetupObjects(), ttid, et);
222232
meEtSummaryByLumi.fill(getEcalDQMSetupObjects(), ttid, et);
223233

234+
if (et > 30)
235+
etSum_ += et;
236+
237+
if (ttid.subDet() == EcalBarrel) {
238+
if (mapTowerOfflineSpikes_[ttid] == 1) {
239+
meEtRealSpikeMatched.fill(getEcalDQMSetupObjects(), ttid, et);
240+
if (et > 30)
241+
etSpikeMatchSum_ += et;
242+
}
243+
}
244+
224245
int interest(tpItr->ttFlag() & 0x3);
225246

226247
switch (interest) {
@@ -279,6 +300,22 @@ namespace ecaldqm {
279300
meTTMaskMapAll.setBinContent(getEcalDQMSetupObjects(), ttid, 1); // PseudoStrip is masked
280301
} // PseudoStrips
281302

303+
// Integrate Et with Et > thres with threshold scan : FIXME -> more efficienct way?
304+
int nThresEtBin = 128;
305+
306+
for (int thres = 1; thres <= nThresEtBin; thres++) {
307+
int nFiltered = 0;
308+
int nFilteredSpikeMatched = 0;
309+
for (int iBin = thres; iBin <= nThresEtBin; iBin++) {
310+
nFiltered += meEtReal.getBinContent(getEcalDQMSetupObjects(), EcalBarrel, iBin);
311+
nFilteredSpikeMatched += meEtRealSpikeMatched.getBinContent(getEcalDQMSetupObjects(), EcalBarrel, iBin);
312+
}
313+
meEtRealIntVsThres.setBinContent(getEcalDQMSetupObjects(), EcalBarrel, thres, nFiltered);
314+
meEtRealSpikeMatchedIntVsThres.setBinContent(getEcalDQMSetupObjects(), EcalBarrel, thres, nFilteredSpikeMatched);
315+
if (nFiltered != 0)
316+
meEffSpikeMatch.setBinContent(
317+
getEcalDQMSetupObjects(), EcalBarrel, thres, double(nFilteredSpikeMatched) / nFiltered);
318+
}
282319
} // TrigPrimTask::runOnRealTPs()
283320

284321
void TrigPrimTask::runOnEmulTPs(EcalTrigPrimDigiCollection const& _tps) {
@@ -378,5 +415,33 @@ namespace ecaldqm {
378415
}
379416
}
380417

418+
void TrigPrimTask::runOnRecHits(EcalRecHitCollection const& _hits, Collections _collection) {
419+
int iSubdet(_collection == kEBRecHit ? EcalBarrel : EcalEndcap);
420+
std::for_each(_hits.begin(), _hits.end(), [&](EcalRecHitCollection::value_type const& hit) {
421+
DetId id(hit.id());
422+
423+
bool isEB = iSubdet == EcalBarrel;
424+
if (isEB) {
425+
EcalTrigTowerDetId ttid = EBDetId(id).tower();
426+
if (hit.energy() >= mapTowerMaxRecHitEnergy_[ttid]) {
427+
mapTowerMaxRecHitEnergy_[ttid] = hit.energy();
428+
int bitSeverity = sevLevel->severityLevel(EBDetId(id), _hits);
429+
mapTowerOfflineSpikes_[ttid] = ((bitSeverity == 3) || (bitSeverity == 4));
430+
}
431+
} // For spike-killer related plots
432+
});
433+
}
434+
435+
void TrigPrimTask::endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {
436+
MESet& meTrendEtSum(MEs_.at("TrendEtSum"));
437+
MESet& meTrendEtSpikeMatchSum(MEs_.at("TrendEtSpikeMatchSum"));
438+
439+
meTrendEtSum.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), etSum_);
440+
meTrendEtSpikeMatchSum.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), etSpikeMatchSum_);
441+
442+
etSum_ = 0.;
443+
etSpikeMatchSum_ = 0.;
444+
}
445+
381446
DEFINE_ECALDQM_WORKER(TrigPrimTask);
382447
} // namespace ecaldqm

0 commit comments

Comments
 (0)