Skip to content

Commit 511d742

Browse files
author
Kyungmin Park
committed
Add spike killer monitoring plots for ECAL DQM
1 parent e04f43e commit 511d742

File tree

3 files changed

+161
-6
lines changed

3 files changed

+161
-6
lines changed

DQM/EcalMonitorTasks/interface/TrigPrimTask.h

Lines changed: 22 additions & 2 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&);
37-
40+
void runOnRecHits(EcalRecHitCollection const&, Collections);
41+
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));
@@ -89,7 +109,7 @@ namespace ecaldqm {
89109
runOnDigis(*static_cast<EEDigiCollection const*>(_p));
90110
return true;
91111
break;
92-
default:
112+
default:
93113
break;
94114
}
95115
return false;

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: 64 additions & 2 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,12 +62,14 @@ 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());
6770
MEs_.at("TTFlags4ByLumi").reset(GetElectronicsMap());
68-
MEs_.at("LHCStatusByLumi").reset(GetElectronicsMap(), -1);
69-
}
71+
MEs_.at("LHCStatusByLumi").reset(GetElectronicsMap(), -1);
72+
}
7073

7174
if (!lhcStatusSet) {
7275
// Update LHC status once each LS
@@ -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,15 @@ namespace ecaldqm {
221231
meEtSummary.fill(getEcalDQMSetupObjects(), ttid, et);
222232
meEtSummaryByLumi.fill(getEcalDQMSetupObjects(), ttid, et);
223233

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

226245
switch (interest) {
@@ -279,6 +298,21 @@ namespace ecaldqm {
279298
meTTMaskMapAll.setBinContent(getEcalDQMSetupObjects(), ttid, 1); // PseudoStrip is masked
280299
} // PseudoStrips
281300

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

284318
void TrigPrimTask::runOnEmulTPs(EcalTrigPrimDigiCollection const& _tps) {
@@ -378,5 +412,33 @@ namespace ecaldqm {
378412
}
379413
}
380414

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

0 commit comments

Comments
 (0)