Skip to content

Commit

Permalink
Merge pull request #39985 from quark2/GEM-DQMOnlineGE21-12_6_X
Browse files Browse the repository at this point in the history
Updates on GE21 online/offlineDQM plots with division on modules
  • Loading branch information
cmsbuild committed Nov 26, 2022
2 parents efd8199 + f61fc9e commit f53aee7
Show file tree
Hide file tree
Showing 11 changed files with 330 additions and 80 deletions.
74 changes: 63 additions & 11 deletions DQM/GEM/interface/GEMDQMBase.h
Expand Up @@ -334,7 +334,7 @@ class GEMDQMBase : public DQMEDAnalyzer {
return mapHist[key];
};

int SetLabelForChambers(K key, Int_t nAxis, Int_t nNumBin = -1, Int_t nIdxStart = 1) {
int SetLabelForChambers(K key, Int_t nAxis, Int_t nNumBin = -1, Int_t nIdxStart = 1, Int_t nNumModules = 1) {
if (!bOperating_)
return 0;
if (nNumBin <= 0) {
Expand All @@ -348,8 +348,14 @@ class GEMDQMBase : public DQMEDAnalyzer {
dqm::impl::MonitorElement *histCurr = FindHist(key);
if (histCurr == nullptr)
return -999;
for (Int_t i = nIdxStart; i <= nNumBin; i++) {
histCurr->setBinLabel(i, Form("%i", i), nAxis);
for (Int_t i = 1; i <= nNumBin; i++) {
Int_t nIdxCh = (nIdxStart + i - 2) / nNumModules + 1;
Int_t nIdxMod = (nIdxStart + i - 2) % nNumModules + 1;
if (nNumModules > 1) {
histCurr->setBinLabel(i, Form("#splitline{%i}{M%i}", nIdxCh, nIdxMod), nAxis);
} else {
histCurr->setBinLabel(i, Form("%i", nIdxStart + i - 1), nAxis);
}
}
return 0;
};
Expand All @@ -370,9 +376,24 @@ class GEMDQMBase : public DQMEDAnalyzer {
dqm::impl::MonitorElement *histCurr = FindHist(key);
if (histCurr == nullptr)
return -999;
for (Int_t i = 0; i < nNumBin; i++) {
Int_t nIEta = pDQMBase_->getIEtaFromVFAT(std::get<1>(key), i);
histCurr->setBinLabel(i + 1, Form("%i (%i)", i, nIEta), nAxis);
if (std::get<1>(key) == 2) {
Int_t nNumVFATPerModule = 12; // FIXME: A better way to get this?
if (nNumBin > nNumVFATPerModule) {
for (Int_t i = 0; i < nNumBin; i++) {
Int_t nIModule = i / nNumVFATPerModule + 1;
histCurr->setBinLabel(
i + 1, Form((nAxis == 1 ? "#splitline{%i}{M%i}" : "%i (M%i)"), i % nNumVFATPerModule, nIModule), nAxis);
}
} else {
for (Int_t i = 0; i < nNumBin; i++) {
histCurr->setBinLabel(i + 1, Form("%i", i), nAxis);
}
}
} else {
for (Int_t i = 0; i < nNumBin; i++) {
Int_t nIEta = pDQMBase_->getIEtaFromVFAT(std::get<1>(key), i);
histCurr->setBinLabel(i + 1, Form("%i (%i)", i, nIEta), nAxis);
}
}
return 0;
};
Expand Down Expand Up @@ -466,35 +487,42 @@ class GEMDQMBase : public DQMEDAnalyzer {
Int_t nStation,
Int_t nLayer,
Int_t nNumChambers,
Int_t nNumModules,
Int_t nNumEtaPartitions,
Int_t nMaxVFAT,
Int_t nFirstStrip,
Int_t nNumDigi,
Int_t nMinIdxChamber,
Int_t nMaxIdxChamber)
: nRegion_(nRegion),
nStation_(nStation),
nLayer_(nLayer),
nNumChambers_(nNumChambers),
nNumModules_(nNumModules),
nNumEtaPartitions_(nNumEtaPartitions),
nMaxVFAT_(nMaxVFAT),
nFirstStrip_(nFirstStrip),
nNumDigi_(nNumDigi),
nMinIdxChamber_(nMinIdxChamber),
nMaxIdxChamber_(nMaxIdxChamber),
fMinPhi_(0){};

bool operator==(const MEStationInfo &other) const {
return (nRegion_ == other.nRegion_ && nStation_ == other.nStation_ && nLayer_ == other.nLayer_ &&
nNumChambers_ == other.nNumChambers_ && nNumEtaPartitions_ == other.nNumEtaPartitions_ &&
nMaxVFAT_ == other.nMaxVFAT_ && nNumDigi_ == other.nNumDigi_);
nNumChambers_ == other.nNumChambers_ && nNumModules_ == other.nNumModules_ &&
nNumEtaPartitions_ == other.nNumEtaPartitions_ && nMaxVFAT_ == other.nMaxVFAT_ &&
nFirstStrip_ == other.nFirstStrip_ && nNumDigi_ == other.nNumDigi_);
};

Int_t nRegion_; // the region index
Int_t nStation_; // the station index
Int_t nLayer_; // the layer
Int_t nNumChambers_; // the number of chambers in the current station
Int_t nNumModules_; // the number of modules in each chamber
Int_t nNumEtaPartitions_; // the number of eta partitions of the chambers
Int_t nMaxVFAT_; // the number of all VFATs in each chamber (= # of VFATs in eta partition * nNumEtaPartitions_)
Int_t nNumDigi_; // the number of digis of each VFAT
Int_t nMaxVFAT_; // the number of all VFATs in each chamber (= # of VFATs in eta partition * nNumEtaPartitions_)
Int_t nFirstStrip_; // the index of the first strip
Int_t nNumDigi_; // the number of digis of each VFAT

Int_t nMinIdxChamber_;
Int_t nMaxIdxChamber_;
Expand Down Expand Up @@ -572,6 +600,8 @@ class GEMDQMBase : public DQMEDAnalyzer {
inline int getIEtaFromVFATGE11(const int vfat);
inline int getIEtaFromVFATGE21(const int vfat);
inline int getMaxVFAT(const int);
inline int getNumModule(const int);
inline int getIdxModule(const int, const int);
inline int getDetOccXBin(const int, const int, const int);
inline Float_t restrictAngle(const Float_t fTheta, const Float_t fStart);
inline std::string getNameDirLayer(ME3IdsKey key3);
Expand Down Expand Up @@ -611,7 +641,29 @@ inline int GEMDQMBase::getMaxVFAT(const int station) {
if (station == 1)
return GEMeMap::maxVFatGE11_;
else if (station == 2)
return GEMeMap::maxVFatGE21_;
return GEMeMap::maxVFatGE21_ / 2;
else
return -1;
}

inline int GEMDQMBase::getNumModule(const int station) {
if (station == 0)
return 1;
if (station == 1)
return 1;
else if (station == 2)
return 4;
else
return -1;
}

inline int GEMDQMBase::getIdxModule(const int station, const int chamberType) {
if (station == 0)
return 1;
if (station == 1)
return 1;
else if (station == 2)
return chamberType - 20;
else
return -1;
}
Expand Down
9 changes: 9 additions & 0 deletions DQM/GEM/interface/GEMDigiSource.h
Expand Up @@ -17,6 +17,8 @@

#include "Validation/MuonGEMHits/interface/GEMValidationUtils.h"

#include "CondFormats/DataRecord/interface/GEMChMapRcd.h"
#include "CondFormats/GEMObjects/interface/GEMChMap.h"
#include "DataFormats/GEMDigi/interface/GEMDigiCollection.h"

#include "DataFormats/Scalers/interface/LumiScalers.h"
Expand All @@ -34,6 +36,8 @@ class GEMDigiSource : public GEMDQMBase {
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

protected:
void LoadROMap(edm::EventSetup const& iSetup);

void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override{};
void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
void analyze(edm::Event const& e, edm::EventSetup const& eSetup) override;
Expand All @@ -46,10 +50,15 @@ class GEMDigiSource : public GEMDQMBase {

const static int nNumBitDigiOcc_ = 16384;

const edm::ESGetToken<GEMChMap, GEMChMapRcd> gemChMapToken_;

edm::EDGetToken tagDigi_;

edm::EDGetTokenT<LumiScalersCollection> lumiScalers_;

std::map<ME4IdsKey, Int_t> mapChamberType_;
std::map<ME3IdsKey, Int_t> mapStripToVFAT_;

MEMap3Inf mapTotalDigi_layer_;
MEMap3Inf mapDigiWheel_layer_;
MEMap3Inf mapDigiOcc_ieta_;
Expand Down
104 changes: 62 additions & 42 deletions DQM/GEM/plugins/GEMDAQStatusSource.cc
Expand Up @@ -248,27 +248,31 @@ int GEMDAQStatusSource::ProcessWithMEMap3(BookingHelper &bh, ME3IdsKey key) {
MEStationInfo &stationInfo = mapStationInfo_[key];

Int_t nNewNumCh = stationInfo.nMaxIdxChamber_ - stationInfo.nMinIdxChamber_ + 1;
Int_t nNewMinIdxChamber = stationInfo.nNumModules_ * (stationInfo.nMinIdxChamber_ - 1) + 1;
Int_t nNewMaxIdxChamber = stationInfo.nNumModules_ * stationInfo.nMaxIdxChamber_;

mapStatusOH_.SetBinConfX(nNewNumCh, stationInfo.nMinIdxChamber_ - 0.5, stationInfo.nMaxIdxChamber_ + 0.5);
nNewNumCh *= stationInfo.nNumModules_;

mapStatusOH_.SetBinConfX(nNewNumCh, nNewMinIdxChamber - 0.5, nNewMaxIdxChamber + 0.5);
mapStatusOH_.bookND(bh, key);
mapStatusOH_.SetLabelForChambers(key, 1, -1, stationInfo.nMinIdxChamber_);
mapStatusOH_.SetLabelForChambers(key, 1, -1, nNewMinIdxChamber, stationInfo.nNumModules_);

if (mapStatusOH_.isOperating()) {
SetLabelOHStatus(mapStatusOH_.FindHist(key));
}

mapStatusWarnVFATPerLayer_.SetBinConfX(
nNewNumCh, stationInfo.nMinIdxChamber_ - 0.5, stationInfo.nMaxIdxChamber_ + 0.5);
mapStatusWarnVFATPerLayer_.SetBinConfY(stationInfo.nMaxVFAT_, -0.5);
Int_t nNumVFATPerModule = stationInfo.nMaxVFAT_ / stationInfo.nNumModules_;

mapStatusWarnVFATPerLayer_.SetBinConfX(nNewNumCh, nNewMinIdxChamber - 0.5, nNewMaxIdxChamber + 0.5);
mapStatusWarnVFATPerLayer_.SetBinConfY(nNumVFATPerModule, -0.5);
mapStatusWarnVFATPerLayer_.bookND(bh, key);
mapStatusWarnVFATPerLayer_.SetLabelForChambers(key, 1, -1, stationInfo.nMinIdxChamber_);
mapStatusWarnVFATPerLayer_.SetLabelForChambers(key, 1, -1, nNewMinIdxChamber, stationInfo.nNumModules_);
mapStatusWarnVFATPerLayer_.SetLabelForVFATs(key, stationInfo.nNumEtaPartitions_, 2);

mapStatusErrVFATPerLayer_.SetBinConfX(
nNewNumCh, stationInfo.nMinIdxChamber_ - 0.5, stationInfo.nMaxIdxChamber_ + 0.5);
mapStatusErrVFATPerLayer_.SetBinConfY(stationInfo.nMaxVFAT_, -0.5);
mapStatusErrVFATPerLayer_.SetBinConfX(nNewNumCh, nNewMinIdxChamber - 0.5, nNewMaxIdxChamber + 0.5);
mapStatusErrVFATPerLayer_.SetBinConfY(nNumVFATPerModule, -0.5);
mapStatusErrVFATPerLayer_.bookND(bh, key);
mapStatusErrVFATPerLayer_.SetLabelForChambers(key, 1, -1, stationInfo.nMinIdxChamber_);
mapStatusErrVFATPerLayer_.SetLabelForChambers(key, 1, -1, nNewMinIdxChamber, stationInfo.nNumModules_);
mapStatusErrVFATPerLayer_.SetLabelForVFATs(key, stationInfo.nNumEtaPartitions_, 2);

return 0;
Expand Down Expand Up @@ -448,95 +452,111 @@ void GEMDAQStatusSource::analyze(edm::Event const &event, edm::EventSetup const
GEMDetId gid = (*ohIt).first;
ME3IdsKey key3{gid.region(), gid.station(), gid.layer()};
ME4IdsKey key4{gid.region(), gid.station(), gid.layer(), gid.chamber()}; // WARNING: Chamber, not iEta
MEStationInfo &stationInfo = mapStationInfo_[key3];

const GEMOHStatusCollection::Range &range = (*ohIt).second;
for (auto OHStatus = range.first; OHStatus != range.second; ++OHStatus) {
Int_t nIdxModule = getIdxModule(gid.station(), OHStatus->chamberType());
Int_t nCh = (gid.chamber() - 1) * stationInfo.nNumModules_ + nIdxModule;
ME4IdsKey key4Mod{gid.region(), gid.station(), gid.layer(), nCh}; // WARNING: Chamber+Module, not iEta

GEMOHStatus::Warnings warnings{OHStatus->warnings()};
if (warnings.EvtNF)
mapStatusOH_.Fill(key3, gid.chamber(), 2);
mapStatusOH_.Fill(key3, nCh, 2);
if (warnings.InNF)
mapStatusOH_.Fill(key3, gid.chamber(), 3);
mapStatusOH_.Fill(key3, nCh, 3);
if (warnings.L1aNF)
mapStatusOH_.Fill(key3, gid.chamber(), 4);
mapStatusOH_.Fill(key3, nCh, 4);
if (warnings.EvtSzW)
mapStatusOH_.Fill(key3, gid.chamber(), 5);
mapStatusOH_.Fill(key3, nCh, 5);
if (warnings.InValidVFAT)
mapStatusOH_.Fill(key3, gid.chamber(), 6);
mapStatusOH_.Fill(key3, nCh, 6);

GEMOHStatus::Errors errors{OHStatus->errors()};
if (errors.EvtF)
mapStatusOH_.Fill(key3, gid.chamber(), 7);
mapStatusOH_.Fill(key3, nCh, 7);
if (errors.InF)
mapStatusOH_.Fill(key3, gid.chamber(), 8);
mapStatusOH_.Fill(key3, nCh, 8);
if (errors.L1aF)
mapStatusOH_.Fill(key3, gid.chamber(), 9);
mapStatusOH_.Fill(key3, nCh, 9);
if (errors.EvtSzOFW)
mapStatusOH_.Fill(key3, gid.chamber(), 10);
mapStatusOH_.Fill(key3, nCh, 10);
if (errors.Inv)
mapStatusOH_.Fill(key3, gid.chamber(), 11);
mapStatusOH_.Fill(key3, nCh, 11);
if (errors.OOScAvV)
mapStatusOH_.Fill(key3, gid.chamber(), 12);
mapStatusOH_.Fill(key3, nCh, 12);
if (errors.OOScVvV)
mapStatusOH_.Fill(key3, gid.chamber(), 13);
mapStatusOH_.Fill(key3, nCh, 13);
if (errors.BxmAvV)
mapStatusOH_.Fill(key3, gid.chamber(), 14);
mapStatusOH_.Fill(key3, nCh, 14);
if (errors.BxmVvV)
mapStatusOH_.Fill(key3, gid.chamber(), 15);
mapStatusOH_.Fill(key3, nCh, 15);
if (errors.InUfw)
mapStatusOH_.Fill(key3, gid.chamber(), 16);
mapStatusOH_.Fill(key3, nCh, 16);
if (errors.badVFatCount)
mapStatusOH_.Fill(key3, gid.chamber(), 17);
mapStatusOH_.Fill(key3, nCh, 17);

Bool_t bWarn = warnings.wcodes != 0;
Bool_t bErr = errors.codes != 0;
if (!bWarn && !bErr)
mapStatusOH_.Fill(key3, gid.chamber(), 1);
mapStatusOH_.Fill(key3, nCh, 1);
if (bWarn)
mapChamberOHWarning[key4] = false;
mapChamberOHWarning[key4Mod] = false;
if (bErr)
mapChamberOHError[key4] = false;
mapChamberAll[key4] = true;
mapChamberOHError[key4Mod] = false;
mapChamberAll[key4Mod] = true;
}
}

for (auto vfatIt = gemVFAT->begin(); vfatIt != gemVFAT->end(); ++vfatIt) {
GEMDetId gid = (*vfatIt).first;
ME3IdsKey key3{gid.region(), gid.station(), gid.layer()};
ME4IdsKey key4Ch{gid.region(), gid.station(), gid.layer(), gid.chamber()}; // WARNING: Chamber, not iEta
MEStationInfo &stationInfo = mapStationInfo_[key3];
Int_t nNumVFATPerModule = stationInfo.nMaxVFAT_ / stationInfo.nNumModules_;

const GEMVFATStatusCollection::Range &range = (*vfatIt).second;

for (auto vfatStat = range.first; vfatStat != range.second; ++vfatStat) {
Int_t nIdxModule = getIdxModule(gid.station(), vfatStat->chamberType());
Int_t nCh = (gid.chamber() - 1) * stationInfo.nNumModules_ + nIdxModule;
ME4IdsKey key4Mod{gid.region(), gid.station(), gid.layer(), nCh}; // WARNING: Chamber+Module, not iEta

Int_t nIdxVFAT = vfatStat->vfatPosition();
Int_t nIdxVFATMod = nIdxVFAT;
if (stationInfo.nNumModules_ > 1) {
nIdxVFATMod = nIdxVFAT + nNumVFATPerModule * (nIdxModule - 1);
}

GEMVFATStatus::Warnings warnings{vfatStat->warnings()};
if (warnings.basicOFW)
mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFAT, 2);
mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFATMod, 2);
if (warnings.zeroSupOFW)
mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFAT, 3);
mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFATMod, 3);

GEMVFATStatus::Errors errors{(uint8_t)vfatStat->errors()};
if (errors.vc)
mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFAT, 4);
mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFATMod, 4);
if (errors.InValidHeader)
mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFAT, 5);
mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFATMod, 5);
if (errors.EC)
mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFAT, 6);
mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFATMod, 6);
if (errors.BC)
mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFAT, 7);
mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFATMod, 7);

Bool_t bWarn = warnings.wcodes != 0;
Bool_t bErr = errors.codes != 0;
if (!bWarn && !bErr)
mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFAT, 1);
mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFATMod, 1);
if (bWarn)
mapChamberVFATWarning[key4Ch] = false;
mapChamberVFATWarning[key4Mod] = false;
if (bErr)
mapChamberVFATError[key4Ch] = false;
mapChamberVFATError[key4Mod] = false;
if (bWarn)
mapStatusWarnVFATPerLayer_.Fill(key3, gid.chamber(), nIdxVFAT);
mapStatusWarnVFATPerLayer_.Fill(key3, nCh, nIdxVFAT);
if (bErr)
mapStatusErrVFATPerLayer_.Fill(key3, gid.chamber(), nIdxVFAT);
mapChamberAll[key4Ch] = true;
mapStatusErrVFATPerLayer_.Fill(key3, nCh, nIdxVFAT);
mapChamberAll[key4Mod] = true;
}
}

Expand Down

0 comments on commit f53aee7

Please sign in to comment.