From 3f818c15d049930aa07ab11543de02fa496d9b59 Mon Sep 17 00:00:00 2001 From: Long Date: Wed, 1 Mar 2023 15:35:02 +0100 Subject: [PATCH] Fix event type for HFRaddam calibration events --- DQM/HcalCommon/interface/Constants.h | 39 ++++--- DQM/HcalCommon/interface/ValueQuantity.h | 6 +- DQM/HcalCommon/src/Utilities.cc | 10 +- DQM/HcalTasks/interface/HFRaddamTask.h | 2 +- DQM/HcalTasks/interface/UMNioTask.h | 30 +++--- DQM/HcalTasks/plugins/HFRaddamTask.cc | 39 ++++--- DQM/HcalTasks/plugins/LEDTask.cc | 1 + DQM/HcalTasks/plugins/UMNioTask.cc | 126 ++++++++++++++++------- 8 files changed, 162 insertions(+), 91 deletions(-) diff --git a/DQM/HcalCommon/interface/Constants.h b/DQM/HcalCommon/interface/Constants.h index c9494a31c5409..0a5f534c3ea84 100644 --- a/DQM/HcalCommon/interface/Constants.h +++ b/DQM/HcalCommon/interface/Constants.h @@ -289,28 +289,33 @@ namespace hcaldqm { /* * Orbit Gap Operations enum */ + uint8_t const EVENTTYPE_PHYSICS = 0; uint8_t const EVENTTYPE_PEDESTAL = 1; + uint8_t const EVENTTYPE_HFRADDAM = 13; uint8_t const EVENTTYPE_LASER = 14; uint8_t const EVENTTYPE_LED = 15; enum OrbitGapType { tNull = 0, - tPedestal = 1, - tLED = 2, - tHFRaddam = 3, - tHBHEHPD = 4, - tHO = 5, - tHF = 6, - tZDC = 7, - tHEPMega = 8, - tHEMMega = 9, - tHBPMega = 10, - tHBMMega = 11, - tSomething = 12, - tCRF = 13, - tCalib = 14, - tSafe = 15, - tUnknown = 16, - nOrbitGapType = 17 + tPhysics = 1, + tPedestal = 2, + tLED = 3, + tHFRaddam = 4, + tHBHEHPD = 5, + tHO = 6, + tHF = 7, + tZDC = 8, + tHEPMega = 9, + tHEMMega = 10, + tHBPMega = 11, + tHBMMega = 12, + tSomething = 13, + tCRF = 14, + tCalib = 15, + tSafe = 16, + tSiPMPMT = 17, + tMegatile = 18, + tUnknown = 19, + nOrbitGapType = 20, }; } // namespace constants } // namespace hcaldqm diff --git a/DQM/HcalCommon/interface/ValueQuantity.h b/DQM/HcalCommon/interface/ValueQuantity.h index 61fd5a9c5beab..3d61cf27a4ed7 100644 --- a/DQM/HcalCommon/interface/ValueQuantity.h +++ b/DQM/HcalCommon/interface/ValueQuantity.h @@ -84,9 +84,9 @@ namespace hcaldqm { {fADC_256, "ADC"}, {fQIE10ADC_256, "ADC (QIE10/11)"}, {fQIE10ADC_16, "ADC (QIE10/11)"}, - {ffC_1000, "fC (QIE8)"}, - {ffC_3000, "fC (QIE8)"}, - {ffC_10000, "fC (QIE8)"}, + {ffC_1000, "fC (QIE8/10/11)"}, + {ffC_3000, "fC (QIE8/10/11)"}, + {ffC_10000, "fC (QIE8/10/11)"}, {fQIE8fC_1000_50, "fC"}, {fQIE10fC_2000, "fC"}, {fQIE10fC_10000, "fC"}, diff --git a/DQM/HcalCommon/src/Utilities.cc b/DQM/HcalCommon/src/Utilities.cc index 1bbce43e525b1..aacd9501d78a9 100644 --- a/DQM/HcalCommon/src/Utilities.cc +++ b/DQM/HcalCommon/src/Utilities.cc @@ -198,6 +198,8 @@ namespace hcaldqm { switch (type) { case tNull: return "Null"; + case tPhysics: + return "Physics"; case tPedestal: return "Pedestal"; case tLED: @@ -226,8 +228,14 @@ namespace hcaldqm { return "Calib"; case tSafe: return "Safe"; - default: + case tSiPMPMT: + return "SiPM-PMT"; + case tMegatile: + return "Megatile"; + case tUnknown: return "Unknown"; + default: + return "Null"; } } diff --git a/DQM/HcalTasks/interface/HFRaddamTask.h b/DQM/HcalTasks/interface/HFRaddamTask.h index 62bc9c8124248..fab5007592aa7 100644 --- a/DQM/HcalTasks/interface/HFRaddamTask.h +++ b/DQM/HcalTasks/interface/HFRaddamTask.h @@ -30,7 +30,7 @@ class HFRaddamTask : public hcaldqm::DQTask { // Tags and Tokens edm::InputTag _tagHF; edm::InputTag _taguMN; - edm::EDGetTokenT _tokHF; + edm::EDGetTokenT _tokHF; edm::EDGetTokenT _tokuMN; // vector of Detector Ids for RadDam diff --git a/DQM/HcalTasks/interface/UMNioTask.h b/DQM/HcalTasks/interface/UMNioTask.h index 8d91033acd90f..be71fa813accd 100644 --- a/DQM/HcalTasks/interface/UMNioTask.h +++ b/DQM/HcalTasks/interface/UMNioTask.h @@ -22,21 +22,23 @@ class UMNioTask : public hcaldqm::DQTask { public: - UMNioTask(edm::ParameterSet const&); + UMNioTask(edm::ParameterSet const &); ~UMNioTask() override {} - void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; - void dqmEndRun(edm::Run const& r, edm::EventSetup const&) override { + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + void dqmEndRun(edm::Run const &r, edm::EventSetup const &) override { if (_ptype == hcaldqm::fLocal) { if (r.runAuxiliary().run() == 1) return; } } - void globalEndLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; + std::shared_ptr globalBeginLuminosityBlock(edm::LuminosityBlock const &, + edm::EventSetup const &) const override; + void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override; protected: // funcs - void _process(edm::Event const&, edm::EventSetup const&) override; + void _process(edm::Event const &, edm::EventSetup const &) override; // Get index of a particular OrbitGapType in the vector, which is used as the value for filling the histogram int getOrbitGapIndex(uint8_t eventType, uint32_t laserType); @@ -44,18 +46,18 @@ class UMNioTask : public hcaldqm::DQTask { std::vector _eventtypes; // tags and tokens - edm::InputTag _taguMN; - edm::InputTag _tagHBHE; - edm::InputTag _tagHO; - edm::InputTag _tagHF; - edm::EDGetTokenT _tokHBHE; - edm::EDGetTokenT _tokHO; - edm::EDGetTokenT _tokHF; - edm::EDGetTokenT _tokuMN; + edm::InputTag taguMN_; + edm::InputTag tagHBHE_; + edm::InputTag tagHO_; + edm::InputTag tagHF_; + edm::EDGetTokenT tokHBHE_; + edm::EDGetTokenT tokHO_; + edm::EDGetTokenT tokHF_; + edm::EDGetTokenT tokuMN_; edm::ESGetToken hcalDbServiceToken_; // cuts - double _lowHBHE, _lowHO, _lowHF; + double lowHBHE_, lowHO_, lowHF_; // emap hcaldqm::electronicsmap::ElectronicsMap _ehashmap; diff --git a/DQM/HcalTasks/plugins/HFRaddamTask.cc b/DQM/HcalTasks/plugins/HFRaddamTask.cc index 1aca941fab06c..678ac6f6923ad 100644 --- a/DQM/HcalTasks/plugins/HFRaddamTask.cc +++ b/DQM/HcalTasks/plugins/HFRaddamTask.cc @@ -68,7 +68,7 @@ HFRaddamTask::HFRaddamTask(edm::ParameterSet const& ps) : DQTask(ps) { // tags _tagHF = ps.getUntrackedParameter("tagHF", edm::InputTag("hcalDigis")); _taguMN = ps.getUntrackedParameter("taguMN", edm::InputTag("hcalDigis")); - _tokHF = consumes(_tagHF); + _tokHF = consumes(_tagHF); _tokuMN = consumes(_taguMN); } @@ -90,16 +90,26 @@ HFRaddamTask::HFRaddamTask(edm::ParameterSet const& ps) : DQTask(ps) { } /* virtual */ void HFRaddamTask::_process(edm::Event const& e, edm::EventSetup const& es) { - edm::Handle chf; - if (!e.getByToken(_tokHF, chf)) - _logger.dqmthrow("Collection HFDigiCollection isn't avalaible" + _tagHF.label() + " " + _tagHF.instance()); + auto const chf = e.getHandle(_tokHF); + if (not(chf.isValid())) { + edm::LogWarning("HFRaddamTask") << "QIE10 collection not valid for HF"; + return; + } + + for (QIE10DigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) { + const QIE10DataFrame digi = static_cast(*it); + HcalDetId const& did = digi.detid(); + if (did.subdet() != HcalForward) + continue; + + CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); - for (HFDigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) { - const HFDataFrame digi = (const HFDataFrame)(*it); for (unsigned int i = 0; i < _vDetIds.size(); i++) - if (digi.id() == _vDetIds[i]) { - for (int j = 0; j < digi.size(); j++) - _vcShape[i].fill(j, digi.sample(j).nominal_fC() - 2.5); + if (did == _vDetIds[i]) { + for (int j = 0; j < digi.samples(); j++) { + double q = hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, digi, j); + _vcShape[i].fill(j, q); + } } } } @@ -110,16 +120,11 @@ HFRaddamTask::HFRaddamTask(edm::ParameterSet const& ps) : DQTask(ps) { if (!e.getByToken(_tokuMN, cumn)) return false; - // event type check first + // event type check uint8_t eventType = cumn->eventType(); - if (eventType != constants::EVENTTYPE_LASER) - return false; - - // check if this analysis task is of the right laser type - uint32_t laserType = cumn->valueUserWord(0); - if (laserType == constants::tHFRaddam) + if (eventType == constants::EVENTTYPE_HFRADDAM) return true; - } else { + } else if (_ptype == fLocal) { // local, just return true as all the settings will be done in cfg return true; } diff --git a/DQM/HcalTasks/plugins/LEDTask.cc b/DQM/HcalTasks/plugins/LEDTask.cc index 789be95e200ab..40e913b01f8d2 100644 --- a/DQM/HcalTasks/plugins/LEDTask.cc +++ b/DQM/HcalTasks/plugins/LEDTask.cc @@ -481,6 +481,7 @@ LEDTask::LEDTask(edm::ParameterSet const& ps) } } } + continue; } HcalElectronicsId eid = digi.elecId(); //double sumQ = hcaldqm::utilities::sumQ(digi, 8.5, 0, digi.size()-1); diff --git a/DQM/HcalTasks/plugins/UMNioTask.cc b/DQM/HcalTasks/plugins/UMNioTask.cc index dcfb5d1b6648c..0d2273a356c14 100644 --- a/DQM/HcalTasks/plugins/UMNioTask.cc +++ b/DQM/HcalTasks/plugins/UMNioTask.cc @@ -5,19 +5,19 @@ using namespace hcaldqm; using namespace hcaldqm::constants; UMNioTask::UMNioTask(edm::ParameterSet const& ps) : DQTask(ps), hcalDbServiceToken_(esConsumes()) { - _tagHBHE = ps.getUntrackedParameter("tagHBHE", edm::InputTag("hcalDigis")); - _tagHO = ps.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis")); - _tagHF = ps.getUntrackedParameter("tagHF", edm::InputTag("hcalDigis")); - _taguMN = ps.getUntrackedParameter("taguMN", edm::InputTag("hcalDigis")); + tagHBHE_ = ps.getUntrackedParameter("tagHBHE", edm::InputTag("hcalDigis")); + tagHO_ = ps.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis")); + tagHF_ = ps.getUntrackedParameter("tagHF", edm::InputTag("hcalDigis")); + taguMN_ = ps.getUntrackedParameter("taguMN", edm::InputTag("hcalDigis")); - _tokHBHE = consumes(_tagHBHE); - _tokHO = consumes(_tagHO); - _tokHF = consumes(_tagHF); - _tokuMN = consumes(_taguMN); + tokHBHE_ = consumes(tagHBHE_); + tokHO_ = consumes(tagHO_); + tokHF_ = consumes(tagHF_); + tokuMN_ = consumes(taguMN_); - _lowHBHE = ps.getUntrackedParameter("lowHBHE", 20); - _lowHO = ps.getUntrackedParameter("lowHO", 20); - _lowHF = ps.getUntrackedParameter("lowHF", 20); + lowHBHE_ = ps.getUntrackedParameter("lowHBHE", 20); + lowHO_ = ps.getUntrackedParameter("lowHO", 20); + lowHF_ = ps.getUntrackedParameter("lowHF", 20); // push all the event types to monitor - whole range basically // This corresponds to all enum values in hcaldqm::constants::OrbitGapType @@ -61,10 +61,14 @@ UMNioTask::UMNioTask(edm::ParameterSet const& ps) int UMNioTask::getOrbitGapIndex(uint8_t eventType, uint32_t laserType) { constants::OrbitGapType orbitGapType; - if (eventType == constants::EVENTTYPE_PEDESTAL) { + if (eventType == constants::EVENTTYPE_PHYSICS) { + orbitGapType = tPhysics; + } else if (eventType == constants::EVENTTYPE_PEDESTAL) { orbitGapType = tPedestal; } else if (eventType == constants::EVENTTYPE_LED) { orbitGapType = tLED; + } else if (eventType == constants::EVENTTYPE_HFRADDAM) { + orbitGapType = tHFRaddam; } else if (eventType == constants::EVENTTYPE_LASER) { switch (laserType) { //case tNull : return "Null"; @@ -86,7 +90,12 @@ int UMNioTask::getOrbitGapIndex(uint8_t eventType, uint32_t laserType) { return tHBMMega; //case tCRF : return "CRF"; //case tCalib : return "Calib"; - //case tSafe : return "Safe"; + case 14: + return tSafe; + case 23: + return tSiPMPMT; + case 24: + return tMegatile; default: return tUnknown; } @@ -95,42 +104,83 @@ int UMNioTask::getOrbitGapIndex(uint8_t eventType, uint32_t laserType) { } /* virtual */ void UMNioTask::_process(edm::Event const& e, edm::EventSetup const& es) { - edm::Handle cumn; - if (!e.getByToken(_tokuMN, cumn)) + auto lumiCache = luminosityBlockCache(e.getLuminosityBlock().index()); + _currentLS = lumiCache->currentLS; + _xQuality.reset(); + _xQuality = lumiCache->xQuality; + + auto const cumn = e.getHandle(tokuMN_); + if (not(cumn.isValid())) { + edm::LogWarning("UMNioTask") << "HcalUMNioDigi isn't available, calling return"; return; + } uint8_t eventType = cumn->eventType(); uint32_t laserType = cumn->valueUserWord(0); _cEventType.fill(_currentLS, getOrbitGapIndex(eventType, laserType)); // Compute the Total Charge in the Detector... - edm::Handle chbhe; - edm::Handle cho; - edm::Handle chf; - - if (!e.getByToken(_tokHBHE, chbhe)) - _logger.dqmthrow("Collection HBHEDigiCollection isn't available " + _tagHBHE.label() + " " + _tagHBHE.instance()); - if (!e.getByToken(_tokHO, cho)) - _logger.dqmthrow("Collection HODigiCollection isn't available " + _tagHO.label() + " " + _tagHO.instance()); - if (!e.getByToken(_tokHF, chf)) - _logger.dqmthrow("Collection HFDigiCollection isn't available " + _tagHF.label() + " " + _tagHF.instance()); - - for (HBHEDigiCollection::const_iterator it = chbhe->begin(); it != chbhe->end(); ++it) { - double sumQ = hcaldqm::utilities::sumQ(*it, 2.5, 0, it->size() - 1); - _cTotalCharge.fill(it->id(), _currentLS, sumQ); - _cTotalChargeProfile.fill(it->id(), _currentLS, sumQ); + auto const chbhe = e.getHandle(tokHBHE_); + if (chbhe.isValid()) { + for (QIE11DigiCollection::const_iterator it = chbhe->begin(); it != chbhe->end(); ++it) { + const QIE11DataFrame digi = static_cast(*it); + HcalDetId const& did = digi.detid(); + if ((did.subdet() != HcalBarrel) && (did.subdet() != HcalEndcap)) + continue; + if (_xQuality.exists(did)) { + HcalChannelStatus cs(did.rawId(), _xQuality.get(did)); + if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || cs.isBitSet(HcalChannelStatus::HcalCellDead)) + continue; + } + CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); + double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.samples() - 1); + _cTotalCharge.fill(did, _currentLS, sumQ); + _cTotalChargeProfile.fill(did, _currentLS, sumQ); + } } - for (HODigiCollection::const_iterator it = cho->begin(); it != cho->end(); ++it) { - double sumQ = hcaldqm::utilities::sumQ(*it, 8.5, 0, it->size() - 1); - _cTotalCharge.fill(it->id(), _currentLS, sumQ); - _cTotalChargeProfile.fill(it->id(), _currentLS, sumQ); + auto const cho = e.getHandle(tokHO_); + if (cho.isValid()) { + for (HODigiCollection::const_iterator it = cho->begin(); it != cho->end(); ++it) { + const HODataFrame digi = (const HODataFrame)(*it); + HcalDetId did = digi.id(); + if (did.subdet() != HcalOuter) + continue; + if (_xQuality.exists(did)) { + HcalChannelStatus cs(did.rawId(), _xQuality.get(did)); + if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || cs.isBitSet(HcalChannelStatus::HcalCellDead)) + continue; + } + CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); + double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.size() - 1); + _cTotalCharge.fill(did, _currentLS, sumQ); + _cTotalChargeProfile.fill(did, _currentLS, sumQ); + } } - for (HFDigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) { - double sumQ = hcaldqm::utilities::sumQ(*it, 2.5, 0, it->size() - 1); - _cTotalCharge.fill(it->id(), _currentLS, sumQ); - _cTotalChargeProfile.fill(it->id(), _currentLS, sumQ); + auto const chf = e.getHandle(tokHF_); + if (chf.isValid()) { + for (QIE10DigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) { + const QIE10DataFrame digi = static_cast(*it); + HcalDetId did = digi.detid(); + if (did.subdet() != HcalForward) + continue; + if (_xQuality.exists(did)) { + HcalChannelStatus cs(did.rawId(), _xQuality.get(did)); + if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || cs.isBitSet(HcalChannelStatus::HcalCellDead)) + continue; + } + CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); + double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.samples() - 1); + _cTotalCharge.fill(did, _currentLS, sumQ); + _cTotalChargeProfile.fill(did, _currentLS, sumQ); + } } } + +std::shared_ptr UMNioTask::globalBeginLuminosityBlock(edm::LuminosityBlock const& lb, + edm::EventSetup const& es) const { + return DQTask::globalBeginLuminosityBlock(lb, es); +} + /* virtual */ void UMNioTask::globalEndLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { DQTask::globalEndLuminosityBlock(lb, es); }