From 60b77525103630604b4216eebe0430a6c01656f8 Mon Sep 17 00:00:00 2001 From: Emanuele Di Marco Date: Thu, 16 Apr 2015 12:46:07 +0200 Subject: [PATCH] backport the fix of the gain switch errors to 74X branch --- EventFilter/EcalRawToDigi/src/DCCTowerBlock.cc | 18 ++++++++---------- .../test/testEcalUnpackerData_cfg.py | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/EventFilter/EcalRawToDigi/src/DCCTowerBlock.cc b/EventFilter/EcalRawToDigi/src/DCCTowerBlock.cc index 77f6b92884733..2f368807d5872 100755 --- a/EventFilter/EcalRawToDigi/src/DCCTowerBlock.cc +++ b/EventFilter/EcalRawToDigi/src/DCCTowerBlock.cc @@ -221,18 +221,16 @@ int DCCTowerBlock::unpackXtalData(unsigned int expStripID, unsigned int expXtalI // from here on, care about gain switches - short firstGainWrong=-1; - short numGainWrong=0; - + short numGain=1; + bool gainSwitchError = false; + for (unsigned int i=1; i0 && xtalGains_[i-1]>xtalGains_[i]) { - numGainWrong++; - if (firstGainWrong == -1) { firstGainWrong=i;} - } + if (xtalGains_[i-1] > xtalGains_[i] && numGain<5) gainSwitchError = true; + if (xtalGains_[i-1] == xtalGains_[i]) numGain++; + else numGain=1; } - - - if (numGainWrong > 0) { + + if (gainSwitchError) { if (! DCCDataUnpacker::silentMode_) { edm::LogWarning("IncorrectGain") << "A wrong gain transition switch was found for Tower Block in strip " << stripId << " and xtal " << xtalId diff --git a/EventFilter/EcalRawToDigi/test/testEcalUnpackerData_cfg.py b/EventFilter/EcalRawToDigi/test/testEcalUnpackerData_cfg.py index d253082f21ba7..3583a3059c36e 100644 --- a/EventFilter/EcalRawToDigi/test/testEcalUnpackerData_cfg.py +++ b/EventFilter/EcalRawToDigi/test/testEcalUnpackerData_cfg.py @@ -7,7 +7,7 @@ process.source = cms.Source("PoolSource", fileNames = #cms.untracked.vstring('file:/tmp/nalmeida/1A1C4478-5866-DE11-A907-001D09F27067.root') - cms.untracked.vstring('/store/relval/CMSSW_3_8_0/RelValProdTTbar/GEN-SIM-RAW/MC_38Y_V7-v1/0004/306D1971-0C95-DF11-942B-002618943984.root') + cms.untracked.vstring('/store/relval/CMSSW_7_4_0/RelValProdTTbar/GEN-SIM-RAW/MCRUN1_74_V4-v1/00000/2C6CC5C9-D0DA-E411-ABF3-0025905B85EE.root') )