Skip to content

Commit d831f8e

Browse files
author
Sunanda
committed
Code check
1 parent c215fcf commit d831f8e

File tree

2 files changed

+39
-34
lines changed

2 files changed

+39
-34
lines changed

Validation/EcalDigis/test/EcalDigiStudy.cc

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
//#define EDM_ML_DEBUG
3838

3939
class EcalDigiStudy : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::SharedResources> {
40-
4140
public:
4241
EcalDigiStudy(const edm::ParameterSet& ps);
4342
~EcalDigiStudy() override = default;
@@ -110,21 +109,19 @@ EcalDigiStudy::EcalDigiStudy(const edm::ParameterSet& ps)
110109
gainConv_[0] = 12.; // saturated channels
111110
barrelADCtoGeV_ = 0.035;
112111
endcapADCtoGeV_ = 0.06;
113-
114112
}
115113

116114
void EcalDigiStudy::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
117115
edm::ParameterSetDescription desc;
118-
desc.add<edm::InputTag>("EBdigiCollection", edm::InputTag("simEcalDigis","ebDigis"));
119-
desc.add<edm::InputTag>("EEdigiCollection", edm::InputTag("simEcalDigis","eeDigis"));
116+
desc.add<edm::InputTag>("EBdigiCollection", edm::InputTag("simEcalDigis", "ebDigis"));
117+
desc.add<edm::InputTag>("EEdigiCollection", edm::InputTag("simEcalDigis", "eeDigis"));
120118
desc.addUntracked<bool>("verbose", "false");
121119
descriptions.add("ecalDigiStudy", desc);
122120
}
123121

124122
void EcalDigiStudy::beginRun(const edm::Run&, const edm::EventSetup& es) {
125-
126123
checkCalibrations(es);
127-
124+
128125
edm::Service<TFileService> fs;
129126
Char_t histo[200];
130127

@@ -201,15 +198,15 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
201198
#ifdef EDM_ML_DEBUG
202199
edm::LogVerbatim("EcalDigiStudy") << " EB collection " << EcalDigiEB.isValid();
203200
#endif
204-
201+
205202
if (EcalDigiEB.isValid()) {
206203
// BARREL: Loop over Digis
207204

208205
const EBDigiCollection* barrelDigi = EcalDigiEB.product();
209206
#ifdef EDM_ML_DEBUG
210207
edm::LogVerbatim("EcalDigiStudy") << " EB Digi size " << EcalDigiEB->size();
211208
#endif
212-
209+
213210
std::vector<double> ebAnalogSignal, ebADCCounts, ebADCGains;
214211
ebAnalogSignal.reserve(EBDataFrame::MAXSAMPLES);
215212
ebADCCounts.reserve(EBDataFrame::MAXSAMPLES);
@@ -263,7 +260,7 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
263260
if ((higherGain > 1 && (higherGainSample != sample) && (ebADCGains[sample] == higherGain)) ||
264261
(higherGain == 3 && (higherGainSample != sample) && (ebADCGains[sample] == 0)) ||
265262
(higherGain == 0 && (higherGainSample != sample) &&
266-
((ebADCGains[sample] == 3) || (ebADCGains[sample] == 0)))) {
263+
((ebADCGains[sample] == 3) || (ebADCGains[sample] == 0)))) {
267264
countsAfterGainSwitch++;
268265
}
269266
}
@@ -273,18 +270,23 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
273270

274271
#ifdef EDM_ML_DEBUG
275272
if (verbose_) {
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;
273+
edm::LogVerbatim("EcalDigiStudy")
274+
<< "Barrel Digi for EBDetId = " << ebid.rawId() << " eta,phi " << ebid.ieta() << " " << ebid.iphi();
275+
for (int i = 0; i < 10; i++)
276+
edm::LogVerbatim("EcalDigiSTudy") << "sample " << i << " ADC = " << ebADCCounts[i]
277+
<< " gain = " << ebADCGains[i] << " Analog = " << ebAnalogSignal[i];
278+
edm::LogVerbatim("EcalDigiStudy") << "Maximum energy = " << Emax << " in sample " << Pmax
279+
<< " Pedestal from pre-sample = " << pedestalPreSampleAnalog;
280+
if (countsAfterGainSwitch > 0)
281+
edm::LogVerbatim("EcalDigiStudy") << "Counts after switch " << countsAfterGainSwitch;
282282
}
283283
#endif
284284
if (countsAfterGainSwitch > 0 && countsAfterGainSwitch < 5) {
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];
285+
edm::LogWarning("EcalDigiStudy") << "Wrong number of counts after gain switch before next switch! "
286+
<< countsAfterGainSwitch;
287+
for (int i = 0; i < 10; i++)
288+
edm::LogWarning("EcalDigiStudy") << "sample " << i << " ADC = " << ebADCCounts[i]
289+
<< " gain = " << ebADCGains[i] << " Analog = " << ebAnalogSignal[i];
288290
}
289291

290292
for (int i = 0; i < 10; i++) {
@@ -310,16 +312,15 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
310312
meEBnADCafterSwitch_->Fill(countsAfterGainSwitch);
311313
}
312314
meEBDigiMultiplicity_->Fill(nDigis);
313-
}
314-
315-
edm:: Handle<EEDigiCollection> EcalDigiEE;
315+
}
316+
317+
edm::Handle<EEDigiCollection> EcalDigiEE;
316318
e.getByToken(EEdigiCollection_, EcalDigiEE);
317319
#ifdef EDM_ML_DEBUG
318320
edm::LogVerbatim("EcalDigiStudy") << " EE collection " << EcalDigiEE.isValid();
319321
#endif
320322

321323
if (EcalDigiEE.isValid()) {
322-
323324
// ENDCAP: Loop over Digis
324325
const EEDigiCollection* endcapDigi = EcalDigiEE.product();
325326
#ifdef EDM_ML_DEBUG
@@ -386,17 +387,19 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
386387

387388
if ((higherGain > 1 && (higherGainSample != sample) && (eeADCGains[sample] == higherGain)) ||
388389
(higherGain == 3 && (higherGainSample != sample) && (eeADCGains[sample] == 0)) ||
389-
(higherGain == 0 && (higherGainSample != sample) && ((eeADCGains[sample] == 0) || (eeADCGains[sample] == 3))))
390+
(higherGain == 0 && (higherGainSample != sample) &&
391+
((eeADCGains[sample] == 0) || (eeADCGains[sample] == 3))))
390392
countsAfterGainSwitch++;
391393
}
392394
pedestalPreSample /= 3.;
393395
pedestalPreSampleAnalog /= 3.;
394396

395397
#ifdef EDM_ML_DEBUG
396-
edm::LogVerbatim("EcalDigiStudy") << "Endcap Digi for EEDetId = " << eeid.rawId() << " x,y " << eeid.ix() << " " << eeid.iy();
398+
edm::LogVerbatim("EcalDigiStudy") << "Endcap Digi for EEDetId = " << eeid.rawId() << " x,y " << eeid.ix() << " "
399+
<< eeid.iy();
397400
for (int i = 0; i < 10; i++)
398-
edm::LogVerbatim("EcalDigiStudy") << "sample " << i << " ADC = " << eeADCCounts[i] << " gain = " << eeADCGains[i]
399-
<< " Analog = " << eeAnalogSignal[i];
401+
edm::LogVerbatim("EcalDigiStudy") << "sample " << i << " ADC = " << eeADCCounts[i]
402+
<< " gain = " << eeADCGains[i] << " Analog = " << eeAnalogSignal[i];
400403
edm::LogVerbatim("EcalDigiStudy") << "Maximum energy = " << Emax << " in sample " << Pmax
401404
<< " Pedestal from pre-sample = " << pedestalPreSampleAnalog;
402405
if (countsAfterGainSwitch > 0)
@@ -406,8 +409,8 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
406409
edm::LogWarning("EcalDigiStudy") << "Wrong number of counts after gain switch before next switch! "
407410
<< countsAfterGainSwitch;
408411
for (int i = 0; i < 10; i++)
409-
edm::LogWarning("EcalDigiStudy") << "sample " << i << " ADC = " << eeADCCounts[i] << " gain = " << eeADCGains[i]
410-
<< " Analog = " << eeAnalogSignal[i];
412+
edm::LogWarning("EcalDigiStudy") << "sample " << i << " ADC = " << eeADCCounts[i]
413+
<< " gain = " << eeADCGains[i] << " Analog = " << eeAnalogSignal[i];
411414
}
412415

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

458461
delete defaultRatios;
459-
462+
460463
edm::LogVerbatim("EcalDigiStudy") << " Barrel GeV/ADC = " << agc->getEBValue();
461464
edm::LogVerbatim("EcalDigiStudy") << " Endcap GeV/ADC = " << agc->getEEValue();
462465
}

Validation/HcalDigis/test/HcalDigiStudy.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,8 @@ void HcalDigiStudy::reco(const edm::Event& iEvent,
838838
// CYCLE OVER CELLS ========================================================
839839
int Ndig = 0;
840840
#ifdef EDM_ML_DEBUG
841-
edm::LogVerbatim("HcalDiguStudy") << "Subdet " << subdet_ << " with " << digiCollection->size() << " entries in DigiCollection";
841+
edm::LogVerbatim("HcalDiguStudy") << "Subdet " << subdet_ << " with " << digiCollection->size()
842+
<< " entries in DigiCollection";
842843
#endif
843844
for (digiItr = digiCollection->begin(); digiItr != digiCollection->end(); digiItr++) {
844845
HcalDetId cell(digiItr->id());
@@ -1156,7 +1157,8 @@ void HcalDigiStudy::reco(const edm::Event& iEvent,
11561157
// CYCLE OVER CELLS ========================================================
11571158
int Ndig = 0;
11581159
#ifdef EDM_ML_DEBUG
1159-
edm::LogVerbatim("HcalDiguStudy") << "Subdet " << subdet_ << " with " << digiCollection->size() << " entries in DigiCollection";
1160+
edm::LogVerbatim("HcalDiguStudy") << "Subdet " << subdet_ << " with " << digiCollection->size()
1161+
<< " entries in DigiCollection";
11601162
#endif
11611163

11621164
for (typename HcalDataFrameContainer<dataFrameType>::const_iterator digiItr = digiCollection->begin();
@@ -1209,9 +1211,9 @@ void HcalDigiStudy::reco(const edm::Event& iEvent,
12091211
pedWidth->getWidth(0));
12101212

12111213
} // end of event #1
1212-
//#ifdef EDM_ML_DEBUG
1213-
// edm::LogVerbatim("HcalDigiStudy") << "==== End of event noise block in cell cycle";
1214-
//#endif
1214+
//#ifdef EDM_ML_DEBUG
1215+
// edm::LogVerbatim("HcalDigiStudy") << "==== End of event noise block in cell cycle";
1216+
//#endif
12151217
if (sub == isubdet)
12161218
Ndig++; // subdet number of digi
12171219

0 commit comments

Comments
 (0)