Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13_0_X] HcalDQM: Fix HFRaddam event type for online DQM deployment #40920

Merged
merged 1 commit into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 22 additions & 17 deletions DQM/HcalCommon/interface/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions DQM/HcalCommon/interface/ValueQuantity.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
10 changes: 9 additions & 1 deletion DQM/HcalCommon/src/Utilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ namespace hcaldqm {
switch (type) {
case tNull:
return "Null";
case tPhysics:
return "Physics";
case tPedestal:
return "Pedestal";
case tLED:
Expand Down Expand Up @@ -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";
}
}

Expand Down
2 changes: 1 addition & 1 deletion DQM/HcalTasks/interface/HFRaddamTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class HFRaddamTask : public hcaldqm::DQTask {
// Tags and Tokens
edm::InputTag _tagHF;
edm::InputTag _taguMN;
edm::EDGetTokenT<HFDigiCollection> _tokHF;
edm::EDGetTokenT<QIE10DigiCollection> _tokHF;
edm::EDGetTokenT<HcalUMNioDigi> _tokuMN;

// vector of Detector Ids for RadDam
Expand Down
30 changes: 16 additions & 14 deletions DQM/HcalTasks/interface/UMNioTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,42 @@

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<hcaldqm::Cache> 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);

std::vector<uint32_t> _eventtypes;

// tags and tokens
edm::InputTag _taguMN;
edm::InputTag _tagHBHE;
edm::InputTag _tagHO;
edm::InputTag _tagHF;
edm::EDGetTokenT<HBHEDigiCollection> _tokHBHE;
edm::EDGetTokenT<HODigiCollection> _tokHO;
edm::EDGetTokenT<HFDigiCollection> _tokHF;
edm::EDGetTokenT<HcalUMNioDigi> _tokuMN;
edm::InputTag taguMN_;
edm::InputTag tagHBHE_;
edm::InputTag tagHO_;
edm::InputTag tagHF_;
edm::EDGetTokenT<QIE11DigiCollection> tokHBHE_;
edm::EDGetTokenT<HODigiCollection> tokHO_;
edm::EDGetTokenT<QIE10DigiCollection> tokHF_;
edm::EDGetTokenT<HcalUMNioDigi> tokuMN_;
edm::ESGetToken<HcalDbService, HcalDbRecord> hcalDbServiceToken_;

// cuts
double _lowHBHE, _lowHO, _lowHF;
double lowHBHE_, lowHO_, lowHF_;

// emap
hcaldqm::electronicsmap::ElectronicsMap _ehashmap;
Expand Down
39 changes: 22 additions & 17 deletions DQM/HcalTasks/plugins/HFRaddamTask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ HFRaddamTask::HFRaddamTask(edm::ParameterSet const& ps) : DQTask(ps) {
// tags
_tagHF = ps.getUntrackedParameter<edm::InputTag>("tagHF", edm::InputTag("hcalDigis"));
_taguMN = ps.getUntrackedParameter<edm::InputTag>("taguMN", edm::InputTag("hcalDigis"));
_tokHF = consumes<HFDigiCollection>(_tagHF);
_tokHF = consumes<QIE10DigiCollection>(_tagHF);
_tokuMN = consumes<HcalUMNioDigi>(_taguMN);
}

Expand All @@ -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<HFDigiCollection> 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<const QIE10DataFrame>(*it);
HcalDetId const& did = digi.detid();
if (did.subdet() != HcalForward)
continue;

CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<QIE10DataFrame>(_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<QIE10DataFrame>(_dbService, digi_fC, did, digi, j);
_vcShape[i].fill(j, q);
}
}
}
}
Expand All @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions DQM/HcalTasks/plugins/LEDTask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ LEDTask::LEDTask(edm::ParameterSet const& ps)
}
}
}
continue;
}
HcalElectronicsId eid = digi.elecId();
//double sumQ = hcaldqm::utilities::sumQ<HODataFrame>(digi, 8.5, 0, digi.size()-1);
Expand Down
126 changes: 88 additions & 38 deletions DQM/HcalTasks/plugins/UMNioTask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ using namespace hcaldqm;
using namespace hcaldqm::constants;
UMNioTask::UMNioTask(edm::ParameterSet const& ps)
: DQTask(ps), hcalDbServiceToken_(esConsumes<HcalDbService, HcalDbRecord, edm::Transition::BeginRun>()) {
_tagHBHE = ps.getUntrackedParameter<edm::InputTag>("tagHBHE", edm::InputTag("hcalDigis"));
_tagHO = ps.getUntrackedParameter<edm::InputTag>("tagHO", edm::InputTag("hcalDigis"));
_tagHF = ps.getUntrackedParameter<edm::InputTag>("tagHF", edm::InputTag("hcalDigis"));
_taguMN = ps.getUntrackedParameter<edm::InputTag>("taguMN", edm::InputTag("hcalDigis"));
tagHBHE_ = ps.getUntrackedParameter<edm::InputTag>("tagHBHE", edm::InputTag("hcalDigis"));
tagHO_ = ps.getUntrackedParameter<edm::InputTag>("tagHO", edm::InputTag("hcalDigis"));
tagHF_ = ps.getUntrackedParameter<edm::InputTag>("tagHF", edm::InputTag("hcalDigis"));
taguMN_ = ps.getUntrackedParameter<edm::InputTag>("taguMN", edm::InputTag("hcalDigis"));

_tokHBHE = consumes<HBHEDigiCollection>(_tagHBHE);
_tokHO = consumes<HODigiCollection>(_tagHO);
_tokHF = consumes<HFDigiCollection>(_tagHF);
_tokuMN = consumes<HcalUMNioDigi>(_taguMN);
tokHBHE_ = consumes<QIE11DigiCollection>(tagHBHE_);
tokHO_ = consumes<HODigiCollection>(tagHO_);
tokHF_ = consumes<QIE10DigiCollection>(tagHF_);
tokuMN_ = consumes<HcalUMNioDigi>(taguMN_);

_lowHBHE = ps.getUntrackedParameter<double>("lowHBHE", 20);
_lowHO = ps.getUntrackedParameter<double>("lowHO", 20);
_lowHF = ps.getUntrackedParameter<double>("lowHF", 20);
lowHBHE_ = ps.getUntrackedParameter<double>("lowHBHE", 20);
lowHO_ = ps.getUntrackedParameter<double>("lowHO", 20);
lowHF_ = ps.getUntrackedParameter<double>("lowHF", 20);

// push all the event types to monitor - whole range basically
// This corresponds to all enum values in hcaldqm::constants::OrbitGapType
Expand Down Expand Up @@ -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";
Expand All @@ -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;
}
Expand All @@ -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<HcalUMNioDigi> 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<HBHEDigiCollection> chbhe;
edm::Handle<HODigiCollection> cho;
edm::Handle<HFDigiCollection> 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<HBHEDataFrame>(*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<const QIE11DataFrame>(*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<QIE11DataFrame>(_dbService, did, digi);
double sumQ = hcaldqm::utilities::sumQDB<QIE11DataFrame>(_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<HODataFrame>(*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<HODataFrame>(_dbService, did, digi);
double sumQ = hcaldqm::utilities::sumQDB<HODataFrame>(_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<HFDataFrame>(*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<const QIE10DataFrame>(*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<QIE10DataFrame>(_dbService, did, digi);
double sumQ = hcaldqm::utilities::sumQDB<QIE10DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples() - 1);
_cTotalCharge.fill(did, _currentLS, sumQ);
_cTotalChargeProfile.fill(did, _currentLS, sumQ);
}
}
}

std::shared_ptr<hcaldqm::Cache> 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);
}
Expand Down