Skip to content

Commit

Permalink
Merge pull request #33827 from lwang046/HcalDQM-CalibChannels
Browse files Browse the repository at this point in the history
HcalDQM - Correct LED Calibration Channels List
  • Loading branch information
cmsbuild committed May 27, 2021
2 parents 7919fd3 + ba7dc4b commit b88fda9
Show file tree
Hide file tree
Showing 11 changed files with 167 additions and 106 deletions.
12 changes: 6 additions & 6 deletions DQM/HcalCommon/src/Container1D.cc
Expand Up @@ -614,7 +614,7 @@ namespace hcaldqm {

_logger.debug(_hashmap.getName(did));
_mes.insert(std::make_pair(
hash, ib.book1D(_hashmap.getName(did), _hashmap.getName(did), _qx->nbins(), _qx->min(), _qx->max())));
hash, ib.book1DD(_hashmap.getName(did), _hashmap.getName(did), _qx->nbins(), _qx->min(), _qx->max())));

// customize
customize(_mes[hash]);
Expand All @@ -633,7 +633,7 @@ namespace hcaldqm {

_logger.debug(_hashmap.getName(eid));
_mes.insert(std::make_pair(
hash, ib.book1D(_hashmap.getName(eid), _hashmap.getName(eid), _qx->nbins(), _qx->min(), _qx->max())));
hash, ib.book1DD(_hashmap.getName(eid), _hashmap.getName(eid), _qx->nbins(), _qx->min(), _qx->max())));

// customize
customize(_mes[hash]);
Expand All @@ -650,7 +650,7 @@ namespace hcaldqm {

_logger.debug(_hashmap.getName(tid));
_mes.insert(std::make_pair(
hash, ib.book1D(_hashmap.getName(tid), _hashmap.getName(tid), _qx->nbins(), _qx->min(), _qx->max())));
hash, ib.book1DD(_hashmap.getName(tid), _hashmap.getName(tid), _qx->nbins(), _qx->min(), _qx->max())));
// customize
customize(_mes[hash]);
}
Expand Down Expand Up @@ -687,7 +687,7 @@ namespace hcaldqm {

_logger.debug(_hashmap.getName(did));
_mes.insert(std::make_pair(
hash, ib.book1D(_hashmap.getName(did), _hashmap.getName(did), _qx->nbins(), _qx->min(), _qx->max())));
hash, ib.book1DD(_hashmap.getName(did), _hashmap.getName(did), _qx->nbins(), _qx->min(), _qx->max())));

// customize
customize(_mes[hash]);
Expand All @@ -708,7 +708,7 @@ namespace hcaldqm {

_logger.debug(_hashmap.getName(eid));
_mes.insert(std::make_pair(
hash, ib.book1D(_hashmap.getName(eid), _hashmap.getName(eid), _qx->nbins(), _qx->min(), _qx->max())));
hash, ib.book1DD(_hashmap.getName(eid), _hashmap.getName(eid), _qx->nbins(), _qx->min(), _qx->max())));

// customize
customize(_mes[hash]);
Expand All @@ -727,7 +727,7 @@ namespace hcaldqm {

_logger.debug(_hashmap.getName(tid));
_mes.insert(std::make_pair(
hash, ib.book1D(_hashmap.getName(tid), _hashmap.getName(tid), _qx->nbins(), _qx->min(), _qx->max())));
hash, ib.book1DD(_hashmap.getName(tid), _hashmap.getName(tid), _qx->nbins(), _qx->min(), _qx->max())));
// customize
customize(_mes[hash]);
}
Expand Down
10 changes: 5 additions & 5 deletions DQM/HcalCommon/src/ContainerSingle1D.cc
Expand Up @@ -56,11 +56,11 @@ namespace hcaldqm {

/* virtual */ void ContainerSingle1D::book(DQMStore::IBooker &ib, std::string subsystem, std::string aux) {
ib.setCurrentFolder(subsystem + "/" + _folder + "/" + _qname);
_me = ib.book1D(_qname + (aux.empty() ? aux : "_" + aux),
_qname + (aux.empty() ? aux : " " + aux),
_qx->nbins(),
_qx->min(),
_qx->max());
_me = ib.book1DD(_qname + (aux.empty() ? aux : "_" + aux),
_qname + (aux.empty() ? aux : " " + aux),
_qx->nbins(),
_qx->min(),
_qx->max());
customize();
}

Expand Down
120 changes: 81 additions & 39 deletions DQM/HcalTasks/plugins/DigiTask.cc
Expand Up @@ -42,38 +42,6 @@ DigiTask::DigiTask(edm::ParameterSet const& ps)
_capidmbx[HcalEndcap] = 1;
_capidmbx[HcalOuter] = 1;
_capidmbx[HcalForward] = 1;

// LED calibration channels
std::vector<edm::ParameterSet> vLedCalibChannels =
ps.getParameter<std::vector<edm::ParameterSet>>("ledCalibrationChannels");
for (int i = 0; i <= 3; ++i) {
HcalSubdetector this_subdet = HcalEmpty;
switch (i) {
case 0:
this_subdet = HcalBarrel;
break;
case 1:
this_subdet = HcalEndcap;
break;
case 2:
this_subdet = HcalOuter;
break;
case 3:
this_subdet = HcalForward;
break;
default:
this_subdet = HcalEmpty;
break;
}
std::vector<int32_t> subdet_calib_ietas = vLedCalibChannels[i].getUntrackedParameter<std::vector<int32_t>>("ieta");
std::vector<int32_t> subdet_calib_iphis = vLedCalibChannels[i].getUntrackedParameter<std::vector<int32_t>>("iphi");
std::vector<int32_t> subdet_calib_depths =
vLedCalibChannels[i].getUntrackedParameter<std::vector<int32_t>>("depth");
for (unsigned int ichannel = 0; ichannel < subdet_calib_ietas.size(); ++ichannel) {
_ledCalibrationChannels[this_subdet].push_back(HcalDetId(
HcalOther, subdet_calib_ietas[ichannel], subdet_calib_iphis[ichannel], subdet_calib_depths[ichannel]));
}
}
}

/* virtual */ void DigiTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
Expand All @@ -82,6 +50,39 @@ DigiTask::DigiTask(edm::ParameterSet const& ps)
// GET WHAT YOU NEED
edm::ESHandle<HcalDbService> dbs = es.getHandle(hcalDbServiceToken_);
_emap = dbs->getHcalMapping();

// Book LED calibration channels from emap
std::vector<HcalElectronicsId> eids = _emap->allElectronicsId();
for (unsigned i = 0; i < eids.size(); i++) {
HcalElectronicsId eid = eids[i];
DetId id = _emap->lookup(eid);
if (HcalGenericDetId(id.rawId()).isHcalCalibDetId()) {
HcalCalibDetId calibId(id);
if (calibId.calibFlavor() == HcalCalibDetId::CalibrationBox) {
HcalSubdetector this_subdet = HcalEmpty;
switch (calibId.hcalSubdet()) {
case HcalBarrel:
this_subdet = HcalBarrel;
break;
case HcalEndcap:
this_subdet = HcalEndcap;
break;
case HcalOuter:
this_subdet = HcalOuter;
break;
case HcalForward:
this_subdet = HcalForward;
break;
default:
this_subdet = HcalEmpty;
break;
}
_ledCalibrationChannels[this_subdet].push_back(
HcalDetId(HcalOther, calibId.ieta(), calibId.iphi(), calibId.cboxChannel()));
}
}
}

std::vector<uint32_t> vVME;
std::vector<uint32_t> vuTCA;
vVME.push_back(
Expand Down Expand Up @@ -787,11 +788,11 @@ DigiTask::DigiTask(edm::ParameterSet const& ps)

// book Number of Events vs LS histogram
ib.setCurrentFolder(_subsystem + "/RunInfo");
meNumEvents1LS = ib.book1D("NumberOfEvents", "NumberOfEvents", 1, 0, 1);
meNumEvents1LS = ib.book1DD("NumberOfEvents", "NumberOfEvents", 1, 0, 1);

// book the flag for unknown ids and the online guy as well
ib.setCurrentFolder(_subsystem + "/" + _name);
meUnknownIds1LS = ib.book1D("UnknownIds", "UnknownIds", 1, 0, 1);
meUnknownIds1LS = ib.book1DD("UnknownIds", "UnknownIds", 1, 0, 1);
_unknownIdsPresent = false;
}
}
Expand Down Expand Up @@ -867,7 +868,6 @@ DigiTask::DigiTask(edm::ParameterSet const& ps)
if (did.subdet() == HcalOther) {
HcalOtherDetId hodid(digi.detid());
if (hodid.subdet() == HcalCalibration) {
// New method: use configurable list of channels
if (std::find(_ledCalibrationChannels[HcalEndcap].begin(),
_ledCalibrationChannels[HcalEndcap].end(),
did) != _ledCalibrationChannels[HcalEndcap].end()) {
Expand All @@ -885,6 +885,23 @@ DigiTask::DigiTask(edm::ParameterSet const& ps)
_LED_CUCountvsLSmod60_Subdet.fill(HcalDetId(HcalEndcap, 16, 1, 1), _currentLS % 60);
}
}
} else if (std::find(_ledCalibrationChannels[HcalBarrel].begin(),
_ledCalibrationChannels[HcalBarrel].end(),
did) != _ledCalibrationChannels[HcalBarrel].end()) {
bool channelLEDSignalPresent = false;
for (int i = 0; i < digi.samples(); i++) {
_LED_ADCvsBX_Subdet.fill(HcalDetId(HcalBarrel, 1, 1, 1), bx, digi[i].adc());

if (digi[i].adc() > _thresh_led) {
channelLEDSignalPresent = true;
}
}
if (channelLEDSignalPresent) {
_LED_CUCountvsLS_Subdet.fill(HcalDetId(HcalBarrel, 1, 1, 1), _currentLS);
if (_ptype == fOnline) {
_LED_CUCountvsLSmod60_Subdet.fill(HcalDetId(HcalBarrel, 1, 1, 1), _currentLS % 60);
}
}
}
}
}
Expand Down Expand Up @@ -1072,9 +1089,35 @@ DigiTask::DigiTask(edm::ParameterSet const& ps)

// HO collection
for (HODigiCollection::const_iterator it = c_ho->begin(); it != c_ho->end(); ++it) {
const HODataFrame digi = (const HODataFrame)(*it);
// Explicit check on the DetIds present in the Collection
HcalDetId const& did = it->id();
if (did.subdet() != HcalOuter) {
// LED monitoring from calibration channels
if (_ptype != fLocal) {
if (did.subdet() == HcalOther) {
HcalOtherDetId hodid(did);
if (hodid.subdet() == HcalCalibration) {
if (std::find(_ledCalibrationChannels[HcalOuter].begin(), _ledCalibrationChannels[HcalOuter].end(), did) !=
_ledCalibrationChannels[HcalOuter].end()) {
bool channelLEDSignalPresent = false;
for (int i = 0; i < digi.size(); i++) {
_LED_ADCvsBX_Subdet.fill(HcalDetId(HcalOuter, 1, 1, 4), bx, digi[i].adc());

if (digi[i].adc() > _thresh_led) {
channelLEDSignalPresent = true;
}
}
if (channelLEDSignalPresent) {
_LED_CUCountvsLS_Subdet.fill(HcalDetId(HcalOuter, 1, 1, 4), _currentLS);
if (_ptype == fOnline) {
_LED_CUCountvsLSmod60_Subdet.fill(HcalDetId(HcalOuter, 1, 1, 4), _currentLS % 60);
}
}
}
}
}
}
continue;
}
uint32_t rawid = _ehashmap.lookup(did);
Expand Down Expand Up @@ -1220,22 +1263,21 @@ DigiTask::DigiTask(edm::ParameterSet const& ps)
if (did.subdet() == HcalOther) {
HcalOtherDetId hodid(digi.detid());
if (hodid.subdet() == HcalCalibration) {
// New method: use configurable list of channels
if (std::find(_ledCalibrationChannels[HcalForward].begin(),
_ledCalibrationChannels[HcalForward].end(),
did) != _ledCalibrationChannels[HcalForward].end()) {
bool channelLEDSignalPresent = false;
for (int i = 0; i < digi.samples(); i++) {
_LED_ADCvsBX_Subdet.fill(HcalDetId(HcalForward, 16, 1, 1), bx, digi[i].adc());
_LED_ADCvsBX_Subdet.fill(HcalDetId(HcalForward, 29, 1, 1), bx, digi[i].adc());

if (digi[i].adc() > _thresh_led) {
channelLEDSignalPresent = true;
}
}
if (channelLEDSignalPresent) {
_LED_CUCountvsLS_Subdet.fill(HcalDetId(HcalForward, 16, 1, 1), _currentLS);
_LED_CUCountvsLS_Subdet.fill(HcalDetId(HcalForward, 29, 1, 1), _currentLS);
if (_ptype == fOnline) {
_LED_CUCountvsLSmod60_Subdet.fill(HcalDetId(HcalForward, 16, 1, 1), _currentLS % 60);
_LED_CUCountvsLSmod60_Subdet.fill(HcalDetId(HcalForward, 29, 1, 1), _currentLS % 60);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions DQM/HcalTasks/plugins/FCDTask.cc
Expand Up @@ -50,7 +50,7 @@ FCDTask::FCDTask(edm::ParameterSet const& ps)
histoname = std::to_string(it_eid.crateId()) + "-" + std::to_string(it_eid.slot()) + "-" +
std::to_string(it_eid.fiberIndex()) + "-" + std::to_string(it_eid.fiberChanId());
ib.setCurrentFolder("Hcal/FCDTask/ADC");
_cADC[it_eid] = ib.book1D(histoname.c_str(), histoname.c_str(), 256, 0, 256);
_cADC[it_eid] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256);
_cADC[it_eid]->setAxisTitle("ADC", 1);
_cADC[it_eid]->setAxisTitle("N", 2);

Expand All @@ -60,11 +60,11 @@ FCDTask::FCDTask(edm::ParameterSet const& ps)
_cADC_vs_TS[it_eid]->setAxisTitle("ADC", 2);

ib.setCurrentFolder("Hcal/FCDTask/TDCTime");
_cTDCTime[it_eid] = ib.book1D(histoname.c_str(), histoname.c_str(), 500, 0., 250.);
_cTDCTime[it_eid] = ib.book1DD(histoname.c_str(), histoname.c_str(), 500, 0., 250.);
_cTDCTime[it_eid]->setAxisTitle("TDC time [ns]", 1);

ib.setCurrentFolder("Hcal/FCDTask/TDC");
_cTDC[it_eid] = ib.book1D(histoname.c_str(), histoname.c_str(), 64, -0.5, 63.5);
_cTDC[it_eid] = ib.book1DD(histoname.c_str(), histoname.c_str(), 64, -0.5, 63.5);
_cTDC[it_eid]->setAxisTitle("TDC", 1);
}
}
Expand Down
8 changes: 4 additions & 4 deletions DQM/HcalTasks/plugins/HcalOnlineHarvesting.cc
Expand Up @@ -136,19 +136,19 @@ HcalOnlineHarvesting::HcalOnlineHarvesting(edm::ParameterSet const& ps)
if (meOccupancy_HF_depth && meOccupancyNoTDC_HF_depth && meOccupancy_HF_ieta && meOccupancyNoTDC_HF_ieta) {
TH2F* hOccupancy_HF_depth = meOccupancy_HF_depth->getTH2F();
TH2F* hOccupancyNoTDC_HF_depth = meOccupancyNoTDC_HF_depth->getTH2F();
TH1F* hOccupancy_HF_ieta = meOccupancy_HF_ieta->getTH1F();
TH1F* hOccupancyNoTDC_HF_ieta = meOccupancyNoTDC_HF_ieta->getTH1F();
TH1D* hOccupancy_HF_ieta = meOccupancy_HF_ieta->getTH1D();
TH1D* hOccupancyNoTDC_HF_ieta = meOccupancyNoTDC_HF_ieta->getTH1D();

TH2F* hEfficiency_HF_depth = (TH2F*)hOccupancy_HF_depth->Clone();
hEfficiency_HF_depth->Divide(hOccupancyNoTDC_HF_depth);
TH1F* hEfficiency_HF_ieta = (TH1F*)hOccupancy_HF_ieta->Clone();
TH1D* hEfficiency_HF_ieta = (TH1D*)hOccupancy_HF_ieta->Clone();
hEfficiency_HF_ieta->Divide(hOccupancyNoTDC_HF_ieta);

ib.setCurrentFolder("Hcal/TPTask");

MonitorElement* meEfficiency_HF_depth = ib.book2D("TDCCutEfficiency_depth", hEfficiency_HF_depth);
meEfficiency_HF_depth->setEfficiencyFlag();
MonitorElement* meEfficiency_HF_ieta = ib.book1D("TDCCutEfficiency_ieta", hEfficiency_HF_ieta);
MonitorElement* meEfficiency_HF_ieta = ib.book1DD("TDCCutEfficiency_ieta", hEfficiency_HF_ieta);
meEfficiency_HF_ieta->setEfficiencyFlag();

delete hEfficiency_HF_depth;
Expand Down

0 comments on commit b88fda9

Please sign in to comment.