Skip to content

Commit c215fcf

Browse files
author
Sunanda
committed
Equip the digi study with a few diagostic statements
1 parent 88ee799 commit c215fcf

File tree

4 files changed

+51
-38
lines changed

4 files changed

+51
-38
lines changed

Validation/EcalDigis/test/EcalDigiStudy.cc

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/*
23
* \file EcalDigiStudy.h
34
*
@@ -36,6 +37,7 @@
3637
//#define EDM_ML_DEBUG
3738

3839
class EcalDigiStudy : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::SharedResources> {
40+
3941
public:
4042
EcalDigiStudy(const edm::ParameterSet& ps);
4143
~EcalDigiStudy() override = default;
@@ -108,19 +110,21 @@ EcalDigiStudy::EcalDigiStudy(const edm::ParameterSet& ps)
108110
gainConv_[0] = 12.; // saturated channels
109111
barrelADCtoGeV_ = 0.035;
110112
endcapADCtoGeV_ = 0.06;
113+
111114
}
112115

113116
void EcalDigiStudy::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
114117
edm::ParameterSetDescription desc;
115-
desc.add<edm::InputTag>("EBdigiCollection", edm::InputTag("simEcalDigis", "ebDigis"));
116-
desc.add<edm::InputTag>("EEdigiCollection", edm::InputTag("simEcalDigis", "eeDigis"));
118+
desc.add<edm::InputTag>("EBdigiCollection", edm::InputTag("simEcalDigis","ebDigis"));
119+
desc.add<edm::InputTag>("EEdigiCollection", edm::InputTag("simEcalDigis","eeDigis"));
117120
desc.addUntracked<bool>("verbose", "false");
118121
descriptions.add("ecalDigiStudy", desc);
119122
}
120123

121124
void EcalDigiStudy::beginRun(const edm::Run&, const edm::EventSetup& es) {
122-
checkCalibrations(es);
123125

126+
checkCalibrations(es);
127+
124128
edm::Service<TFileService> fs;
125129
Char_t histo[200];
126130

@@ -197,15 +201,15 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
197201
#ifdef EDM_ML_DEBUG
198202
edm::LogVerbatim("EcalDigiStudy") << " EB collection " << EcalDigiEB.isValid();
199203
#endif
200-
204+
201205
if (EcalDigiEB.isValid()) {
202206
// BARREL: Loop over Digis
203207

204208
const EBDigiCollection* barrelDigi = EcalDigiEB.product();
205209
#ifdef EDM_ML_DEBUG
206210
edm::LogVerbatim("EcalDigiStudy") << " EB Digi size " << EcalDigiEB->size();
207211
#endif
208-
212+
209213
std::vector<double> ebAnalogSignal, ebADCCounts, ebADCGains;
210214
ebAnalogSignal.reserve(EBDataFrame::MAXSAMPLES);
211215
ebADCCounts.reserve(EBDataFrame::MAXSAMPLES);
@@ -259,31 +263,28 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
259263
if ((higherGain > 1 && (higherGainSample != sample) && (ebADCGains[sample] == higherGain)) ||
260264
(higherGain == 3 && (higherGainSample != sample) && (ebADCGains[sample] == 0)) ||
261265
(higherGain == 0 && (higherGainSample != sample) &&
262-
((ebADCGains[sample] == 3) || (ebADCGains[sample] == 0)))) {
266+
((ebADCGains[sample] == 3) || (ebADCGains[sample] == 0)))) {
263267
countsAfterGainSwitch++;
264268
}
265269
}
266270

267271
pedestalPreSample /= 3.;
268272
pedestalPreSampleAnalog /= 3.;
269273

274+
#ifdef EDM_ML_DEBUG
270275
if (verbose_) {
271-
edm::LogVerbatim("EcalDigiStudy")
272-
<< "Barrel Digi for EBDetId = " << ebid.rawId() << " eta,phi " << ebid.ieta() << " " << ebid.iphi();
273-
for (int i = 0; i < 10; i++)
274-
edm::LogVerbatim("EcalDigiSTudy") << "sample " << i << " ADC = " << ebADCCounts[i]
275-
<< " gain = " << ebADCGains[i] << " Analog = " << ebAnalogSignal[i];
276-
edm::LogVerbatim("EcalDigiStudy") << "Maximum energy = " << Emax << " in sample " << Pmax
277-
<< " Pedestal from pre-sample = " << pedestalPreSampleAnalog;
278-
if (countsAfterGainSwitch > 0)
279-
edm::LogVerbatim("EcalDigiStudy") << "Counts after switch " << countsAfterGainSwitch;
276+
edm::LogVerbatim("EcalDigiStudy") << "Barrel Digi for EBDetId = " << ebid.rawId() << " eta,phi " << ebid.ieta() << " " << ebid.iphi();
277+
for (int i = 0; i < 10; i++)
278+
edm::LogVerbatim("EcalDigiSTudy") << "sample " << i << " ADC = " << ebADCCounts[i] << " gain = " << ebADCGains[i] << " Analog = " << ebAnalogSignal[i];
279+
edm::LogVerbatim("EcalDigiStudy") << "Maximum energy = " << Emax << " in sample " << Pmax << " Pedestal from pre-sample = " << pedestalPreSampleAnalog;
280+
if (countsAfterGainSwitch > 0)
281+
edm::LogVerbatim("EcalDigiStudy") << "Counts after switch " << countsAfterGainSwitch;
280282
}
283+
#endif
281284
if (countsAfterGainSwitch > 0 && countsAfterGainSwitch < 5) {
282-
edm::LogWarning("EcalDigiStudy") << "Wrong number of counts after gain switch before next switch! "
283-
<< countsAfterGainSwitch;
284-
for (int i = 0; i < 10; i++)
285-
edm::LogWarning("EcalDigiStudy") << "sample " << i << " ADC = " << ebADCCounts[i]
286-
<< " gain = " << ebADCGains[i] << " Analog = " << ebAnalogSignal[i];
285+
edm::LogWarning("EcalDigiStudy") << "Wrong number of counts after gain switch before next switch! " << countsAfterGainSwitch;
286+
for (int i = 0; i < 10; i++)
287+
edm::LogWarning("EcalDigiStudy") << "sample " << i << " ADC = " << ebADCCounts[i] << " gain = " << ebADCGains[i] << " Analog = " << ebAnalogSignal[i];
287288
}
288289

289290
for (int i = 0; i < 10; i++) {
@@ -309,15 +310,16 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
309310
meEBnADCafterSwitch_->Fill(countsAfterGainSwitch);
310311
}
311312
meEBDigiMultiplicity_->Fill(nDigis);
312-
}
313-
314-
edm::Handle<EEDigiCollection> EcalDigiEE;
313+
}
314+
315+
edm:: Handle<EEDigiCollection> EcalDigiEE;
315316
e.getByToken(EEdigiCollection_, EcalDigiEE);
316317
#ifdef EDM_ML_DEBUG
317318
edm::LogVerbatim("EcalDigiStudy") << " EE collection " << EcalDigiEE.isValid();
318319
#endif
319320

320321
if (EcalDigiEE.isValid()) {
322+
321323
// ENDCAP: Loop over Digis
322324
const EEDigiCollection* endcapDigi = EcalDigiEE.product();
323325
#ifdef EDM_ML_DEBUG
@@ -384,29 +386,28 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
384386

385387
if ((higherGain > 1 && (higherGainSample != sample) && (eeADCGains[sample] == higherGain)) ||
386388
(higherGain == 3 && (higherGainSample != sample) && (eeADCGains[sample] == 0)) ||
387-
(higherGain == 0 && (higherGainSample != sample) &&
388-
((eeADCGains[sample] == 0) || (eeADCGains[sample] == 3))))
389+
(higherGain == 0 && (higherGainSample != sample) && ((eeADCGains[sample] == 0) || (eeADCGains[sample] == 3))))
389390
countsAfterGainSwitch++;
390391
}
391392
pedestalPreSample /= 3.;
392393
pedestalPreSampleAnalog /= 3.;
393394

394-
edm::LogVerbatim("EcalDigiStudy") << "Endcap Digi for EEDetId = " << eeid.rawId() << " x,y " << eeid.ix() << " "
395-
<< eeid.iy();
395+
#ifdef EDM_ML_DEBUG
396+
edm::LogVerbatim("EcalDigiStudy") << "Endcap Digi for EEDetId = " << eeid.rawId() << " x,y " << eeid.ix() << " " << eeid.iy();
396397
for (int i = 0; i < 10; i++)
397-
edm::LogVerbatim("EcalDigiStudy") << "sample " << i << " ADC = " << eeADCCounts[i]
398-
<< " gain = " << eeADCGains[i] << " Analog = " << eeAnalogSignal[i];
398+
edm::LogVerbatim("EcalDigiStudy") << "sample " << i << " ADC = " << eeADCCounts[i] << " gain = " << eeADCGains[i]
399+
<< " Analog = " << eeAnalogSignal[i];
399400
edm::LogVerbatim("EcalDigiStudy") << "Maximum energy = " << Emax << " in sample " << Pmax
400401
<< " Pedestal from pre-sample = " << pedestalPreSampleAnalog;
401402
if (countsAfterGainSwitch > 0)
402403
edm::LogVerbatim("EcalDigiStudy") << "Counts after switch " << countsAfterGainSwitch;
403-
404+
#endif
404405
if (countsAfterGainSwitch > 0 && countsAfterGainSwitch < 5) {
405406
edm::LogWarning("EcalDigiStudy") << "Wrong number of counts after gain switch before next switch! "
406407
<< countsAfterGainSwitch;
407408
for (int i = 0; i < 10; i++)
408-
edm::LogWarning("EcalDigiStudy") << "sample " << i << " ADC = " << eeADCCounts[i]
409-
<< " gain = " << eeADCGains[i] << " Analog = " << eeAnalogSignal[i];
409+
edm::LogWarning("EcalDigiStudy") << "sample " << i << " ADC = " << eeADCCounts[i] << " gain = " << eeADCGains[i]
410+
<< " Analog = " << eeAnalogSignal[i];
410411
}
411412

412413
for (int i = 0; i < 10; i++) {
@@ -455,7 +456,7 @@ void EcalDigiStudy::checkCalibrations(edm::EventSetup const& eventSetup) {
455456
<< " g3 = " << gainConv_[3];
456457

457458
delete defaultRatios;
458-
459+
459460
edm::LogVerbatim("EcalDigiStudy") << " Barrel GeV/ADC = " << agc->getEBValue();
460461
edm::LogVerbatim("EcalDigiStudy") << " Endcap GeV/ADC = " << agc->getEEValue();
461462
}

Validation/EcalDigis/test/runEcalDigiStudy_cfg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
process = cms.Process('DigiStudy')
2323

24-
fileInput = "file:/eos/user/s/sarkar/Simulation/PUMixing/" + options.IPType + ".root"
24+
fileInput = "file:/eos/user/s/sarkar/Simulation/PUMixing/CMSSW_151X/" + options.IPType + ".root"
2525
fileName = "EC" + options.IPType + ".root"
2626

2727
print("Input file: ", fileInput)

Validation/HcalDigis/test/HcalDigiStudy.cc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
#include "TH1D.h"
5656
#include "TProfile.h"
5757

58+
//#define EDM_ML_DEBUG
59+
5860
class HcalDigiStudy : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::SharedResources> {
5961
public:
6062
explicit HcalDigiStudy(const edm::ParameterSet&);
@@ -835,7 +837,9 @@ void HcalDigiStudy::reco(const edm::Event& iEvent,
835837

836838
// CYCLE OVER CELLS ========================================================
837839
int Ndig = 0;
838-
840+
#ifdef EDM_ML_DEBUG
841+
edm::LogVerbatim("HcalDiguStudy") << "Subdet " << subdet_ << " with " << digiCollection->size() << " entries in DigiCollection";
842+
#endif
839843
for (digiItr = digiCollection->begin(); digiItr != digiCollection->end(); digiItr++) {
840844
HcalDetId cell(digiItr->id());
841845
int depth = cell.depth();
@@ -1151,6 +1155,9 @@ void HcalDigiStudy::reco(const edm::Event& iEvent,
11511155

11521156
// CYCLE OVER CELLS ========================================================
11531157
int Ndig = 0;
1158+
#ifdef EDM_ML_DEBUG
1159+
edm::LogVerbatim("HcalDiguStudy") << "Subdet " << subdet_ << " with " << digiCollection->size() << " entries in DigiCollection";
1160+
#endif
11541161

11551162
for (typename HcalDataFrameContainer<dataFrameType>::const_iterator digiItr = digiCollection->begin();
11561163
digiItr != digiCollection->end();
@@ -1202,8 +1209,9 @@ void HcalDigiStudy::reco(const edm::Event& iEvent,
12021209
pedWidth->getWidth(0));
12031210

12041211
} // end of event #1
1205-
//edm::LogVerbatim("OutputInfo") << "==== End of event noise block in cell cycle";
1206-
1212+
//#ifdef EDM_ML_DEBUG
1213+
// edm::LogVerbatim("HcalDigiStudy") << "==== End of event noise block in cell cycle";
1214+
//#endif
12071215
if (sub == isubdet)
12081216
Ndig++; // subdet number of digi
12091217

Validation/HcalDigis/test/runHcalDigiStudy_cfg.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121

2222
process = cms.Process('DigiStudy')
2323

24-
fileInput = "file:/eos/user/s/sarkar/Simulation/PUMixing/" + options.IPType + ".root"
24+
fileInput = "file:/eos/user/s/sarkar/Simulation/PUMixing/CMSSW_151X/" + options.IPType + ".root"
25+
#fileInput = "file:/eos/user/s/sarkar/Simulation/PUMixing/" + options.IPType + ".root"
2526
fileName = "HC" + options.IPType + ".root"
2627

2728
print("Input file: ", fileInput)
@@ -37,6 +38,8 @@
3738
from Configuration.AlCa.GlobalTag import GlobalTag
3839
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2023_realistic', '')
3940

41+
process.MessageLogger.HcalDigiStudy=dict()
42+
4043
process.source = cms.Source("PoolSource",
4144
fileNames = cms.untracked.vstring(fileInput) )
4245

@@ -51,6 +54,7 @@
5154
process.analysis_step = cms.Path(process.hcalDigiStudy)
5255
process.hcalDigiStudy.TestNumber = True
5356
#process.hcalDigiStudy.simHits = "fastSimProducer:HcalHits"
57+
process.hcalDigiStudy.mc = "no"
5458

5559
# Schedule definition
5660
process.schedule = cms.Schedule(

0 commit comments

Comments
 (0)