CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
GEMDQMStatusDigi Class Reference
Inheritance diagram for GEMDQMStatusDigi:

Public Member Functions

 GEMDQMStatusDigi (const edm::ParameterSet &cfg)
 
 ~GEMDQMStatusDigi () override
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Protected Member Functions

void analyze (edm::Event const &e, edm::EventSetup const &eSetup) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void bookHistogramsAMCPart (DQMStore::IBooker &)
 
void bookHistogramsChamberPart (DQMStore::IBooker &, GEMDetId &)
 
void bookHistogramsStationPart (DQMStore::IBooker &, GEMDetId &)
 
void bookHistogramsTimeRecordPart (DQMStore::IBooker &)
 
int LoadPrevData ()
 
Int_t seekIdx (std::vector< GEMDetId > &listLayers, UInt_t unId)
 
void seekIdxSummary (GEMDetId gid, Int_t &nIdxLayer, Int_t &nIdxChamber)
 
int SetConfigTimeRecord ()
 
int SetInfoChambers ()
 

Private Member Functions

void AddLabel ()
 
Bool_t FillBits (MonitorElement *monitor, uint64_t unVal, int nNumBits)
 
Bool_t FillBits (MonitorElement *monitor, uint64_t unVal, int nNumBits, int nY)
 
const GEMGeometryinitGeometry (edm::EventSetup const &iSetup)
 
std::string suffixChamber (GEMDetId &id)
 
std::string suffixLayer (GEMDetId &id)
 

Private Attributes

int amcStatusBit_ = 6
 
bool bFlipSummary_
 
bool bPerSuperchamber_
 
int cBit_ = 9
 
int eBit_ = 16
 
int fVFATBit_ = 4
 
std::vector< GEMChambergemChambers_
 
const GEMGeometryGEMGeometry_
 
std::shared_ptr< GEMROMappingGEMROMapping_
 
MonitorElementh1_amc_buffState_
 
MonitorElementh1_amc_chTimeOut_
 
MonitorElementh1_amc_davCnt_
 
MonitorElementh1_amc_oosGlib_
 
MonitorElementh1_amc_ttsState_
 
MonitorElementh1_vfat_qualityflag_
 
MonitorElementh2_vfat_qualityflag_
 
MonitorElementh2AMCStatus_
 
MonitorElementh3SummaryStatusPre_
 
std::vector< Int_t > listAMCSlots_
 
std::unordered_map< UInt_t, MonitorElement * > listGEBbcOH_
 
std::unordered_map< UInt_t, MonitorElement * > listGEBecOH_
 
std::unordered_map< UInt_t, MonitorElement * > listGEBInputID_
 
std::unordered_map< UInt_t, MonitorElement * > listGEBInputStatus_
 
std::unordered_map< UInt_t, MonitorElement * > listGEBOHCRC_
 
std::unordered_map< UInt_t, MonitorElement * > listGEBVFATWordCnt_
 
std::unordered_map< UInt_t, MonitorElement * > listGEBVFATWordCntT_
 
std::unordered_map< UInt_t, MonitorElement * > listGEBZeroSupWordsCnt_
 
std::map< UInt_t, TimeStoreItemlistTimeStore_
 
std::unordered_map< UInt_t, MonitorElement * > listVFATBC_
 
std::unordered_map< UInt_t, MonitorElement * > listVFATEC_
 
std::unordered_map< UInt_t, MonitorElement * > listVFATQualityFlag_
 
std::vector< GEMDetIdm_listChambers
 
std::vector< GEMDetIdm_listLayers
 
std::unordered_map< UInt_t, Bool_t > m_mapStatusErr
 
std::unordered_map< UInt_t, Bool_t > m_mapStatusFill
 
const Int_t m_nIdxSummaryErr = 2
 
const Int_t m_nIdxSummaryFill = 1
 
MonitorElementm_summaryReport_
 
int nIdxFirstStrip_
 
int nNBxBin_
 
int nNBxRange_
 
int nNCh_
 
int nNEvtPerSec_
 
int nNSecPerBin_
 
int nNTimeBinPrimitive_
 
int nNTimeBinTotal_
 
Int_t nStackedBin_
 
Int_t nStackedEvt_
 
int qVFATBit_ = 5
 
std::string strFmtSummaryLabel_
 
std::string strPathPrevDQMRoot_
 
edm::EDGetToken tagAMC_
 
edm::EDGetToken tagDigi_
 
edm::EDGetToken tagGEB_
 
edm::EDGetToken tagVFAT_
 

Detailed Description

Definition at line 44 of file GEMDQMStatusDigi.cc.

Constructor & Destructor Documentation

GEMDQMStatusDigi::GEMDQMStatusDigi ( const edm::ParameterSet cfg)

Definition at line 168 of file GEMDQMStatusDigi.cc.

References edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

168  {
169  tagVFAT_ = consumes<GEMVfatStatusDigiCollection>(cfg.getParameter<edm::InputTag>("VFATInputLabel"));
170  tagGEB_ = consumes<GEMGEBdataCollection>(cfg.getParameter<edm::InputTag>("GEBInputLabel"));
171  tagAMC_ = consumes<GEMAMCdataCollection>(cfg.getParameter<edm::InputTag>("AMCInputLabel"));
172  tagDigi_ = consumes<GEMDigiCollection>(cfg.getParameter<edm::InputTag>("digisInputLabel"));
173 
174  listAMCSlots_ = cfg.getParameter<std::vector<int>>("AMCSlots");
175 
176  strFmtSummaryLabel_ = cfg.getParameter<std::string>("summaryLabelFmt");
177  bFlipSummary_ = cfg.getParameter<bool>("flipSummary");
178  bPerSuperchamber_ = cfg.getParameter<bool>("perSuperchamber");
179 
180  strPathPrevDQMRoot_ = cfg.getParameter<std::string>("pathOfPrevDQMRoot");
181  nNEvtPerSec_ = cfg.getParameter<int>("numOfEvtPerSec");
182  nNSecPerBin_ = cfg.getParameter<int>("secOfEvtPerBin");
183  nNTimeBinPrimitive_ = cfg.getParameter<int>("totalTimeInterval");
184 
185  nIdxFirstStrip_ = cfg.getParameter<int>("idxFirstStrip");
186 
187  nNBxRange_ = cfg.getParameter<int>("bxRange");
188  nNBxBin_ = cfg.getParameter<int>("bxBin");
189 }
edm::EDGetToken tagDigi_
T getParameter(std::string const &) const
edm::EDGetToken tagVFAT_
std::string strFmtSummaryLabel_
edm::EDGetToken tagGEB_
std::string strPathPrevDQMRoot_
std::vector< Int_t > listAMCSlots_
edm::EDGetToken tagAMC_
GEMDQMStatusDigi::~GEMDQMStatusDigi ( )
inlineoverride

Member Function Documentation

void GEMDQMStatusDigi::AddLabel ( )
private
void GEMDQMStatusDigi::analyze ( edm::Event const &  e,
edm::EventSetup const &  eSetup 
)
overrideprotected

Definition at line 772 of file GEMDQMStatusDigi.cc.

References MuonDigiCollection< IndexType, DigiType >::begin(), l1GtPatternGenerator_cfi::bx, GEMDetId::chamber(), GEMDetId::chamberId(), ztail::d, DEFINE_FWK_MODULE, MuonDigiCollection< IndexType, DigiType >::end(), dqm::impl::MonitorElement::getBinContent(), tagTimeStoreItem::h2Histo, mps_fire::i, GEMDetId::layer(), GEMeMap::maxEtaPartition_, GEMeMap::maxVFatGE11_, GEMeMap::maxVFatGE21_, FastTimerService_cff::range, GEMDetId::region(), GEMDetId::ring(), GEMDetId::roll(), dqm::impl::MonitorElement::setBinContent(), GEMDetId::station(), and testProducerWithPsetDescEmpty_cfi::x1.

772  {
773  Bool_t bIsNotEmpty = true;
774 
779 
780  event.getByToken(tagVFAT_, gemVFAT);
781  event.getByToken(tagGEB_, gemGEB);
782  event.getByToken(tagAMC_, gemAMC);
783  event.getByToken(tagDigi_, gemDigis);
784 
785  auto fillTimeHisto = [](TimeStoreItem &listCurr, int nStackedBin, int nIdx, bool bFill) -> void {
786  Int_t nX = nStackedBin + 1;
787  Int_t nY = nIdx + 1;
788 
789  listCurr.h2Histo->setBinContent(nX, 0, listCurr.h2Histo->getBinContent(nX, 0) + 1);
790  if (bFill)
791  listCurr.h2Histo->setBinContent(nX, nY, listCurr.h2Histo->getBinContent(nX, nY) + 1);
792  };
793 
794  for (GEMVfatStatusDigiCollection::DigiRangeIterator vfatIt = gemVFAT->begin(); vfatIt != gemVFAT->end(); ++vfatIt) {
795  GEMDetId gemid = (*vfatIt).first;
796  GEMDetId gemchId = gemid.chamberId();
797  GEMDetId gemOnlychId(0, 1, 1, (bPerSuperchamber_ ? 0 : gemid.layer()), gemid.chamber(), 0);
798 
799  int nIdx = seekIdx(m_listChambers, gemOnlychId);
800  int nRoll = gemid.roll();
801  const GEMVfatStatusDigiCollection::Range &range = (*vfatIt).second;
802 
803  GEMDetId chIdStatus(gemid.region(), gemid.ring(), gemid.station(), gemid.layer(), gemid.chamber(), 1);
804  if (listTimeStore_.find((UInt_t)chIdStatus) == listTimeStore_.end()) {
805  edm::LogError("BadGeometry") << "Wrong detId which is not in the current geometry (VFAT status): " << gemchId
806  << std::endl;
807  continue;
808  }
809 
810  auto &listCurr = listTimeStore_[chIdStatus];
811 
812  for (auto vfatStat = range.first; vfatStat != range.second; ++vfatStat) {
813  bIsNotEmpty = true;
814 
815  uint64_t unQFVFAT = vfatStat->quality() /* | (vfatStat->flag() << qVFATBit_)*/;
816  if ((unQFVFAT & ~0x1) == 0) {
817  unQFVFAT |= 0x1; // If no error, then it should be 'Good'
818  } else { // Error!!
819  Int_t nIdxLayer, nIdxChamber;
820  seekIdxSummary(gemchId, nIdxLayer, nIdxChamber);
821  h3SummaryStatusPre_->setBinContent(nIdxChamber, nIdxLayer, m_nIdxSummaryErr, 1.0);
822  }
823 
825  FillBits(h2_vfat_qualityflag_, unQFVFAT, qVFATBit_ + fVFATBit_, nIdx); // They could be there
826 
827  int nVFAT = (GEMeMap::maxEtaPartition_ - nRoll) + GEMeMap::maxEtaPartition_ * vfatStat->phi();
828  bIsNotEmpty = FillBits(listVFATQualityFlag_[gemchId], unQFVFAT, qVFATBit_ + fVFATBit_, nVFAT);
829 
830  if (!bIsNotEmpty) {
831  edm::LogError("BadGeometry") << "Wrong detId which is not in the current geometry (VFAT status): " << gemchId
832  << std::endl;
833  continue;
834  }
835 
836  listVFATEC_[gemchId]->Fill(vfatStat->ec(), nVFAT);
837 
838  fillTimeHisto(listCurr, nStackedBin_, nVFAT, (unQFVFAT & ~0x1) != 0);
839  }
840  }
841 
842  for (GEMGEBdataCollection::DigiRangeIterator gebIt = gemGEB->begin(); gebIt != gemGEB->end(); ++gebIt) {
843  GEMDetId gemid = (*gebIt).first;
844  GEMDetId lid(gemid.region(), gemid.ring(), gemid.station(), (bPerSuperchamber_ ? gemid.layer() : 0), 0, 0);
845  GEMDetId chid(0, 1, 1, (bPerSuperchamber_ ? 0 : gemid.layer()), gemid.chamber(), 0);
846 
847  Int_t nCh = seekIdx(m_listChambers, chid);
848 
849  if (listTimeStore_.find((UInt_t)lid) == listTimeStore_.end()) {
850  edm::LogError("BadGeometry") << "Wrong detId which is not in the current geometry (GEB status): " << lid
851  << std::endl;
852  continue;
853  }
854 
855  auto &listCurr = listTimeStore_[lid];
856 
857  const GEMGEBdataCollection::Range &range = (*gebIt).second;
858  for (auto GEBStatus = range.first; GEBStatus != range.second; ++GEBStatus) {
859  bIsNotEmpty = true;
860 
861  uint64_t unBit = 0;
862  uint64_t unStatus = 0;
863 
864  unStatus |= (GEBStatus->bxmVvV() << unBit++);
865  unStatus |= (GEBStatus->bxmAvV() << unBit++);
866  unStatus |= (GEBStatus->oOScVvV() << unBit++);
867  unStatus |= (GEBStatus->oOScAvV() << unBit++);
868  unStatus |= (GEBStatus->noVFAT() << unBit++);
869  unStatus |= (GEBStatus->evtSzW() << unBit++);
870  unStatus |= (GEBStatus->l1aNF() << unBit++);
871  unStatus |= (GEBStatus->inNF() << unBit++);
872  unStatus |= (GEBStatus->evtNF() << unBit++);
873  unStatus |= (GEBStatus->evtSzOFW() << unBit++);
874  unStatus |= (GEBStatus->l1aF() << unBit++);
875  unStatus |= (GEBStatus->inF() << unBit++);
876  unStatus |= (GEBStatus->evtF() << unBit++);
877  unStatus |= (GEBStatus->inUfw() << unBit++);
878  unStatus |= (GEBStatus->stuckData() << unBit++);
879  unStatus |= (GEBStatus->evUfw() << unBit++);
880 
881  if (unStatus != 0) { // Error!
882  Int_t nIdxLayer, nIdxChamber;
883  seekIdxSummary(gemid, nIdxLayer, nIdxChamber);
884  h3SummaryStatusPre_->setBinContent(nIdxChamber, nIdxLayer, m_nIdxSummaryErr, 1.0);
885  }
886 
887  bIsNotEmpty = FillBits(listGEBInputStatus_[lid], unStatus, eBit_, nCh);
888 
889  if (!bIsNotEmpty) {
890  edm::LogError("BadGeometry") << "Wrong detId which is not in the current geometry (GEB status): " << lid
891  << std::endl;
892  continue;
893  }
894 
895  listGEBInputID_[lid]->Fill(nCh, GEBStatus->inputID());
896  listGEBVFATWordCnt_[lid]->Fill(nCh, GEBStatus->vfatWordCnt() / 3);
897  listGEBVFATWordCntT_[lid]->Fill(nCh, GEBStatus->vfatWordCntT() / 3);
898  listGEBZeroSupWordsCnt_[lid]->Fill(nCh, GEBStatus->zeroSupWordsCnt());
899 
900  listGEBbcOH_[lid]->Fill(nCh, GEBStatus->bcOH());
901  listGEBecOH_[lid]->Fill(nCh, GEBStatus->ecOH());
902  listGEBOHCRC_[lid]->Fill(nCh, GEBStatus->crc());
903 
904  fillTimeHisto(listCurr, nStackedBin_, nCh, unStatus != 0);
905  }
906  }
907 
908  auto findAMCIdx = [this](Int_t nAMCnum) -> Int_t {
909  for (Int_t i = 0; i < (Int_t)listAMCSlots_.size(); i++)
910  if (listAMCSlots_[i] == nAMCnum)
911  return i;
912  return -1;
913  };
914 
915  for (GEMAMCdataCollection::DigiRangeIterator amcIt = gemAMC->begin(); amcIt != gemAMC->end(); ++amcIt) {
916  const GEMAMCdataCollection::Range &range = (*amcIt).second;
917  auto &listCurr = listTimeStore_[0];
918  for (auto amc = range.first; amc != range.second; ++amc) {
919  Int_t nIdAMC = findAMCIdx(amc->amcNum());
920  uint64_t unBit = 0;
921  uint64_t unStatus = 0;
922 
923  unStatus |= (!amc->bc0locked() << unBit++);
924  unStatus |= (!amc->daqReady() << unBit++);
925  unStatus |= (!amc->daqClockLocked() << unBit++);
926  unStatus |= (!amc->mmcmLocked() << unBit++);
927  unStatus |= (amc->backPressure() << unBit++);
928  unStatus |= (amc->oosGlib() << unBit++);
929 
930  FillBits(h2AMCStatus_, unStatus, amcStatusBit_, nIdAMC);
931 
932  h1_amc_ttsState_->Fill(amc->ttsState());
933  h1_amc_davCnt_->Fill(amc->davCnt());
934  h1_amc_buffState_->Fill(amc->buffState());
935  h1_amc_oosGlib_->Fill(amc->oosGlib());
936  h1_amc_chTimeOut_->Fill(amc->linkTo());
937 
938  fillTimeHisto(listCurr, nStackedBin_, nIdAMC, unStatus != 0);
939  }
940  }
941 
942  auto findVFATByStrip = [](GEMDetId gid, Int_t nIdxStrip, Int_t nNumStrips) -> Int_t {
943  Int_t nNumEtaPart = GEMeMap::maxEtaPartition_;
944 
945  // Strip: Start at 0
946  if (gid.station() == 1) { // GE1/1
947  Int_t nNumVFAT = GEMeMap::maxVFatGE11_;
948  return nNumEtaPart * ((Int_t)(nIdxStrip / (nNumStrips / nNumVFAT)) + 1) - gid.roll();
949  } else if (gid.station() == 2) { // GE2/1
950  Int_t nNumVFAT = GEMeMap::maxVFatGE21_;
951  return nNumEtaPart * ((Int_t)(nIdxStrip / (nNumStrips / nNumVFAT)) + 1) - gid.roll();
952  }
953 
954  return -1;
955  };
956 
957  // Checking if there is a fire (data)
958  for (auto ch : gemChambers_) {
959  GEMDetId cId = ch.id();
960  Bool_t bIsHit = false;
961 
962  // Because every fired strip in a same VFAT shares a same bx, we keep bx from only one strip
963  std::unordered_map<Int_t, Int_t> mapBXVFAT;
964 
965  GEMDetId chIdDigi(cId.region(), cId.ring(), cId.station(), cId.layer(), cId.chamber(), 2);
966  GEMDetId chIdBx(cId.region(), cId.ring(), cId.station(), cId.layer(), cId.chamber(), 3);
967 
968  auto &listCurrDigi = listTimeStore_[chIdDigi];
969  auto &listCurrBx = listTimeStore_[chIdBx];
970 
971  for (auto roll : ch.etaPartitions()) {
972  GEMDetId rId = roll->id();
973  const auto &digis_in_det = gemDigis->get(rId);
974 
975  for (auto d = digis_in_det.first; d != digis_in_det.second; ++d) {
976  Int_t nIdxStrip = d->strip() - nIdxFirstStrip_;
977  Int_t nVFAT = findVFATByStrip(rId, nIdxStrip, roll->nstrips());
978 
979  bIsHit = true;
980  mapBXVFAT[nVFAT] = d->bx();
981  fillTimeHisto(listCurrDigi, nStackedBin_, nVFAT, true);
982 
983  Int_t nIdxBx;
984 
985  if (d->bx() < listCurrBx.nNbinMin)
986  nIdxBx = 0;
987  else if (d->bx() >= listCurrBx.nNbinMax)
988  nIdxBx = listCurrBx.nNbinY - 1;
989  else
990  nIdxBx = (Int_t)(listCurrBx.nNbinY * 1.0 * (d->bx() - listCurrBx.nNbinMin) /
991  (listCurrBx.nNbinMax - listCurrBx.nNbinMin));
992 
993  fillTimeHisto(listCurrBx, nStackedBin_, nIdxBx, true);
994  }
995  }
996 
997  for (auto bx : mapBXVFAT)
998  listVFATBC_[cId]->Fill(bx.second, bx.first);
999 
1000  if (bIsHit) { // Data occur!
1001  Int_t nIdxLayer, nIdxChamber;
1002  seekIdxSummary(cId, nIdxLayer, nIdxChamber);
1003  h3SummaryStatusPre_->setBinContent(nIdxChamber, nIdxLayer, m_nIdxSummaryFill, 1.0);
1004  }
1005  }
1006 
1007  // Counting the time tables
1008  nStackedEvt_++;
1009  if (nStackedEvt_ >= nNSecPerBin_ * nNEvtPerSec_) { // Time to jump!
1010  nStackedBin_++;
1011  nStackedEvt_ = 0;
1012  }
1013 }
MonitorElement * h2Histo
edm::EDGetToken tagDigi_
MonitorElement * h1_amc_buffState_
static const int maxEtaPartition_
Definition: GEMeMap.h:71
std::unordered_map< UInt_t, MonitorElement * > listGEBVFATWordCntT_
const Int_t m_nIdxSummaryErr
edm::EDGetToken tagVFAT_
std::unordered_map< UInt_t, MonitorElement * > listVFATEC_
int roll() const
Definition: GEMDetId.h:188
int ring() const
Definition: GEMDetId.h:170
std::unordered_map< UInt_t, MonitorElement * > listGEBZeroSupWordsCnt_
int chamber() const
Definition: GEMDetId.h:177
std::unordered_map< UInt_t, MonitorElement * > listGEBInputStatus_
MonitorElement * h1_vfat_qualityflag_
MonitorElement * h1_amc_chTimeOut_
GEMDetId chamberId() const
Definition: GEMDetId.h:193
std::unordered_map< UInt_t, MonitorElement * > listGEBVFATWordCnt_
void Fill(long long x)
MonitorElement * h2_vfat_qualityflag_
MonitorElement * h1_amc_oosGlib_
std::unordered_map< UInt_t, MonitorElement * > listGEBInputID_
int layer() const
Definition: GEMDetId.h:184
int station() const
Definition: GEMDetId.h:173
MonitorElement * h3SummaryStatusPre_
std::vector< GEMChamber > gemChambers_
Bool_t FillBits(MonitorElement *monitor, uint64_t unVal, int nNumBits)
virtual double getBinContent(int binx) const
get content of bin (1-D)
int region() const
Definition: GEMDetId.h:165
d
Definition: ztail.py:151
Int_t seekIdx(std::vector< GEMDetId > &listLayers, UInt_t unId)
std::unordered_map< UInt_t, MonitorElement * > listVFATQualityFlag_
std::unordered_map< UInt_t, MonitorElement * > listGEBbcOH_
std::vector< GEMDetId > m_listChambers
std::unordered_map< UInt_t, MonitorElement * > listGEBOHCRC_
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
unsigned long long uint64_t
Definition: Time.h:13
std::map< UInt_t, TimeStoreItem > listTimeStore_
std::pair< const_iterator, const_iterator > Range
MonitorElement * h2AMCStatus_
static const int maxVFatGE21_
Definition: GEMeMap.h:68
MonitorElement * h1_amc_ttsState_
edm::EDGetToken tagGEB_
Definition: AMCSpec.h:8
std::vector< Int_t > listAMCSlots_
DigiRangeIterator end() const
std::unordered_map< UInt_t, MonitorElement * > listGEBecOH_
edm::EDGetToken tagAMC_
MonitorElement * h1_amc_davCnt_
std::unordered_map< UInt_t, MonitorElement * > listVFATBC_
const Int_t m_nIdxSummaryFill
static const int maxVFatGE11_
Definition: GEMeMap.h:67
DigiRangeIterator begin() const
void seekIdxSummary(GEMDetId gid, Int_t &nIdxLayer, Int_t &nIdxChamber)
void GEMDQMStatusDigi::bookHistograms ( DQMStore::IBooker &  ibooker,
edm::Run const &  ,
edm::EventSetup const &  iSetup 
)
overrideprotected

Definition at line 650 of file GEMDQMStatusDigi.cc.

References mps_fire::i, and printfWithMap().

650  {
651  // Start: Loading the GEM geometry
652 
653  GEMGeometry_ = initGeometry(iSetup);
654  if (GEMGeometry_ == nullptr)
655  return;
656 
657  SetInfoChambers();
658 
659  // End: Set the configurations
660 
661  // Start: Setting books
662 
663  ibooker.cd();
664  ibooker.setCurrentFolder("GEM/StatusDigi");
665 
666  for (auto ch : gemChambers_) {
667  GEMDetId gid = ch.id();
668  bookHistogramsChamberPart(ibooker, gid);
669  }
670 
671  for (auto lid : m_listLayers) {
672  bookHistogramsStationPart(ibooker, lid);
673  }
674 
675  bookHistogramsAMCPart(ibooker);
676 
677  // Setting the informations for time histograms
680  LoadPrevData();
681 
682  h1_vfat_qualityflag_ = ibooker.book1D("vfat_quality_flag", "quality and flag", 9, 0, 9);
683  h2_vfat_qualityflag_ = ibooker.book2D("vfat_quality_flag_per_geb", "quality and flag", nNCh_, 0, nNCh_, 9, 0, 9);
684 
685  h1_amc_ttsState_ = ibooker.book1D("amc_ttsState", "ttsState", 10, 0, 10);
686  h1_amc_davCnt_ = ibooker.book1D("amc_davCnt", "davCnt", 10, 0, 10);
687  h1_amc_buffState_ = ibooker.book1D("amc_buffState", "buffState", 10, 0, 10);
688  h1_amc_oosGlib_ = ibooker.book1D("amc_oosGlib", "oosGlib", 10, 0, 10);
689  h1_amc_chTimeOut_ = ibooker.book1D("amc_chTimeOut", "chTimeOut", 10, 0, 10);
690 
691  ibooker.cd();
692  ibooker.setCurrentFolder("GEM/EventInfo");
693 
694  h3SummaryStatusPre_ = ibooker.book3D(
695  "reportSummaryMapPreliminary", ";Chamber;", nNCh_, 0, nNCh_, m_listLayers.size(), 0, m_listLayers.size(), 2, 0, 1);
696 
697  for (Int_t i = 0; i < nNCh_; i++) {
698  auto &gid = this->m_listChambers[i];
699  Int_t nCh = gid.chamber() + (bPerSuperchamber_ ? 0 : gid.layer() - 1);
700  h3SummaryStatusPre_->setBinLabel(i + 1, std::to_string(nCh), 1);
701  }
702 
703  Int_t nIdxLayer = 0;
704  std::unordered_map<std::string, Int_t> mapArg;
705 
706  // Start: Labeling section
707 
708  for (auto lid : m_listLayers) {
709  mapArg["station_signed"] = lid.region() * lid.station();
710  mapArg["region"] = lid.region();
711  mapArg["station"] = lid.station();
712  mapArg["layer"] = lid.layer();
713  mapArg["chamber"] = lid.chamber();
714 
716  nIdxLayer++;
717  }
718 }
void bookHistogramsStationPart(DQMStore::IBooker &, GEMDetId &)
MonitorElement * h1_amc_buffState_
std::string printfWithMap(std::string strFmt, std::unordered_map< std::string, Int_t > mapArg)
const GEMGeometry * GEMGeometry_
int chamber() const
Definition: GEMDetId.h:177
MonitorElement * h1_vfat_qualityflag_
MonitorElement * h1_amc_chTimeOut_
MonitorElement * h2_vfat_qualityflag_
MonitorElement * h1_amc_oosGlib_
void bookHistogramsAMCPart(DQMStore::IBooker &)
int layer() const
Definition: GEMDetId.h:184
MonitorElement * h3SummaryStatusPre_
std::vector< GEMChamber > gemChambers_
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
std::string strFmtSummaryLabel_
std::vector< GEMDetId > m_listChambers
void bookHistogramsChamberPart(DQMStore::IBooker &, GEMDetId &)
const GEMGeometry * initGeometry(edm::EventSetup const &iSetup)
void bookHistogramsTimeRecordPart(DQMStore::IBooker &)
std::vector< GEMDetId > m_listLayers
MonitorElement * h1_amc_ttsState_
MonitorElement * h1_amc_davCnt_
void GEMDQMStatusDigi::bookHistogramsAMCPart ( DQMStore::IBooker &  ibooker)
protected

Definition at line 558 of file GEMDQMStatusDigi.cc.

558  {
559  h2AMCStatus_ = ibooker.book2D("amc_statusflag",
560  "Status of AMC slots;AMC slot;",
561  listAMCSlots_.size(),
562  0,
563  listAMCSlots_.size(),
565  0,
566  amcStatusBit_);
567 
568  uint32_t unBinPos = 1;
569  h2AMCStatus_->setBinLabel(unBinPos++, "BC0 not locked", 2);
570  h2AMCStatus_->setBinLabel(unBinPos++, "DAQ not ready", 2);
571  h2AMCStatus_->setBinLabel(unBinPos++, "DAQ clock not locked", 2);
572  h2AMCStatus_->setBinLabel(unBinPos++, "MMCM not locked", 2);
573  h2AMCStatus_->setBinLabel(unBinPos++, "Back pressure", 2);
574  h2AMCStatus_->setBinLabel(unBinPos++, "GLIB out-of-sync", 2);
575 }
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * h2AMCStatus_
std::vector< Int_t > listAMCSlots_
void GEMDQMStatusDigi::bookHistogramsChamberPart ( DQMStore::IBooker &  ibooker,
GEMDetId gid 
)
protected

Definition at line 439 of file GEMDQMStatusDigi.cc.

References GEMDetId::chamber(), GEMDetId::layer(), GEMeMap::maxEtaPartition_, GEMeMap::maxVFatGE11_, GEMeMap::maxVFatGE21_, GEMDetId::region(), GEMDetId::station(), and AlCaHLTBitMon_QueryRunRegistry::string.

439  {
440  std::string hName, hTitle;
441 
442  UInt_t unBinPos;
443 
444  std::string strIdxName = suffixChamber(gid);
445  std::string strIdxTitle = "GEMINIm" + to_string(gid.chamber()) + " in GE" + (gid.region() > 0 ? "+" : "-") +
446  to_string(gid.station()) + "/" + to_string(gid.layer());
447 
448  Int_t nVFAT = 0;
449  if (gid.station() == 1)
451  if (gid.station() == 2)
453 
454  hName = "vfatStatus_QualityFlag_" + strIdxName;
455  hTitle = "VFAT quality " + strIdxTitle;
456  hTitle += ";VFAT;";
457  listVFATQualityFlag_[gid] = ibooker.book2D(hName, hTitle, nVFAT, 0, nVFAT, 9, 0, 9);
458 
459  hName = "vfatStatus_BC_" + strIdxName;
460  hTitle = "VFAT bunch crossing " + strIdxTitle;
461  hTitle += ";Bunch crossing;VFAT";
462  listVFATBC_[gid] = ibooker.book2D(hName, hTitle, nNBxBin_, -nNBxRange_, nNBxRange_, nVFAT, 0, nVFAT);
463 
464  hName = "vfatStatus_EC_" + strIdxName;
465  hTitle = "VFAT event counter " + strIdxTitle;
466  hTitle += ";Event counter;VFAT";
467  listVFATEC_[gid] = ibooker.book2D(hName, hTitle, 256, 0, 256, nVFAT, 0, nVFAT);
468 
469  unBinPos = 1;
470  listVFATQualityFlag_[gid]->setBinLabel(unBinPos++, "Good", 2);
471  listVFATQualityFlag_[gid]->setBinLabel(unBinPos++, "CRC fail", 2);
472  listVFATQualityFlag_[gid]->setBinLabel(unBinPos++, "b1010 fail", 2);
473  listVFATQualityFlag_[gid]->setBinLabel(unBinPos++, "b1100 fail", 2);
474  listVFATQualityFlag_[gid]->setBinLabel(unBinPos++, "b1110 fail", 2);
475  listVFATQualityFlag_[gid]->setBinLabel(unBinPos++, "Hamming error", 2);
476  listVFATQualityFlag_[gid]->setBinLabel(unBinPos++, "AFULL", 2);
477  listVFATQualityFlag_[gid]->setBinLabel(unBinPos++, "SEUlogic", 2);
478  listVFATQualityFlag_[gid]->setBinLabel(unBinPos++, "SUEI2C", 2);
479 
480  m_mapStatusFill[gid] = false;
481  m_mapStatusErr[gid] = false;
482 }
std::unordered_map< UInt_t, Bool_t > m_mapStatusFill
static const int maxEtaPartition_
Definition: GEMeMap.h:71
std::unordered_map< UInt_t, MonitorElement * > listVFATEC_
int chamber() const
Definition: GEMDetId.h:177
std::string suffixChamber(GEMDetId &id)
int layer() const
Definition: GEMDetId.h:184
int station() const
Definition: GEMDetId.h:173
int region() const
Definition: GEMDetId.h:165
std::unordered_map< UInt_t, MonitorElement * > listVFATQualityFlag_
static const int maxVFatGE21_
Definition: GEMeMap.h:68
std::unordered_map< UInt_t, Bool_t > m_mapStatusErr
std::unordered_map< UInt_t, MonitorElement * > listVFATBC_
static const int maxVFatGE11_
Definition: GEMeMap.h:67
void GEMDQMStatusDigi::bookHistogramsStationPart ( DQMStore::IBooker &  ibooker,
GEMDetId lid 
)
protected

Definition at line 484 of file GEMDQMStatusDigi.cc.

References mps_fire::i, GEMDetId::layer(), PFElectronDQMAnalyzer_cfi::nBin, GEMDetId::region(), GEMDetId::station(), and AlCaHLTBitMon_QueryRunRegistry::string.

484  {
485  UInt_t unBinPos;
486 
487  Int_t re = lid.region();
488  UInt_t st = lid.station();
489  UInt_t la = lid.layer();
490 
491  auto newbookGEB = [this](DQMStore::IBooker &ibooker,
492  std::string strName,
493  std::string strTitle,
494  std::string strAxis,
495  GEMDetId &lid,
496  int nLayer,
497  int nStation,
498  int re,
499  int nBin,
500  float fMin,
501  float fMax) -> MonitorElement * {
502  strName = strName + "_" + suffixLayer(lid);
503  strTitle = strTitle + ", station: " + (re >= 0 ? "+" : "-") + std::to_string(nStation);
504 
505  if (bPerSuperchamber_) {
506  strTitle += ", layer: " + std::to_string(nLayer);
507  }
508 
509  strTitle += ";Chamber;" + strAxis;
510 
511  auto hNew = ibooker.book2D(strName, strTitle, this->nNCh_, 0, this->nNCh_, nBin, fMin, fMax);
512 
513  for (Int_t i = 0; i < this->nNCh_; i++) {
514  auto &gid = this->m_listChambers[i];
515  Int_t nCh = gid.chamber() + (this->bPerSuperchamber_ ? 0 : gid.layer() - 1);
516  hNew->setBinLabel(i + 1, std::to_string(nCh), 1);
517  }
518 
519  return hNew;
520  };
521 
522  listGEBInputStatus_[lid] =
523  newbookGEB(ibooker, "geb_input_status", "inputStatus", "", lid, la, st, re, eBit_, 0, eBit_);
524  listGEBInputID_[lid] = newbookGEB(ibooker, "geb_input_ID", "inputID", "Input ID", lid, la, st, re, 32, 0, 32);
525  listGEBVFATWordCnt_[lid] =
526  newbookGEB(ibooker, "geb_no_vfats", "nvfats in header", "Number of VFATs in header", lid, la, st, re, 25, 0, 25);
527  listGEBVFATWordCntT_[lid] = newbookGEB(
528  ibooker, "geb_no_vfatsT", "nvfats in trailer", "Number of VFATs in trailer", lid, la, st, re, 25, 0, 25);
529  listGEBZeroSupWordsCnt_[lid] = newbookGEB(
530  ibooker, "geb_zeroSupWordsCnt", "zeroSupWordsCnt", "Zero sup. words count", lid, la, st, re, 10, 0, 10);
531 
532  listGEBbcOH_[lid] =
533  newbookGEB(ibooker, "geb_bcOH", "OH bunch crossing", "OH bunch crossing", lid, la, st, re, 3600, 0, 3600);
534  listGEBecOH_[lid] =
535  newbookGEB(ibooker, "geb_ecOH", "OH event coounter", "OH event counter", lid, la, st, re, 256, 0, 256);
536  listGEBOHCRC_[lid] =
537  newbookGEB(ibooker, "geb_OHCRC", "CRC of OH data", "CRC of OH data", lid, la, st, re, 65536, 0, 65536);
538 
539  unBinPos = 1;
540  listGEBInputStatus_[lid]->setBinLabel(unBinPos++, "BX mismatch GLIB OH", 2);
541  listGEBInputStatus_[lid]->setBinLabel(unBinPos++, "BX mismatch GLIB VFAT", 2);
542  listGEBInputStatus_[lid]->setBinLabel(unBinPos++, "OOS GLIB OH", 2);
543  listGEBInputStatus_[lid]->setBinLabel(unBinPos++, "OOS GLIB VFAT", 2);
544  listGEBInputStatus_[lid]->setBinLabel(unBinPos++, "No VFAT marker", 2);
545  listGEBInputStatus_[lid]->setBinLabel(unBinPos++, "Event size warn", 2);
546  listGEBInputStatus_[lid]->setBinLabel(unBinPos++, "L1AFIFO near full", 2);
547  listGEBInputStatus_[lid]->setBinLabel(unBinPos++, "InFIFO near full", 2);
548  listGEBInputStatus_[lid]->setBinLabel(unBinPos++, "EvtFIFO near full", 2);
549  listGEBInputStatus_[lid]->setBinLabel(unBinPos++, "Event size overflow", 2);
550  listGEBInputStatus_[lid]->setBinLabel(unBinPos++, "L1AFIFO full", 2);
551  listGEBInputStatus_[lid]->setBinLabel(unBinPos++, "InFIFO full", 2);
552  listGEBInputStatus_[lid]->setBinLabel(unBinPos++, "EvtFIFO full", 2);
553  listGEBInputStatus_[lid]->setBinLabel(unBinPos++, "Input FIFO underflow", 2);
554  listGEBInputStatus_[lid]->setBinLabel(unBinPos++, "Stuck data", 2);
555  listGEBInputStatus_[lid]->setBinLabel(unBinPos++, "Event FIFO underflow", 2);
556 }
std::unordered_map< UInt_t, MonitorElement * > listGEBVFATWordCntT_
std::string suffixLayer(GEMDetId &id)
std::unordered_map< UInt_t, MonitorElement * > listGEBZeroSupWordsCnt_
std::unordered_map< UInt_t, MonitorElement * > listGEBInputStatus_
std::unordered_map< UInt_t, MonitorElement * > listGEBVFATWordCnt_
std::unordered_map< UInt_t, MonitorElement * > listGEBInputID_
int layer() const
Definition: GEMDetId.h:184
int station() const
Definition: GEMDetId.h:173
int region() const
Definition: GEMDetId.h:165
std::unordered_map< UInt_t, MonitorElement * > listGEBbcOH_
std::vector< GEMDetId > m_listChambers
std::unordered_map< UInt_t, MonitorElement * > listGEBOHCRC_
std::unordered_map< UInt_t, MonitorElement * > listGEBecOH_
void GEMDQMStatusDigi::bookHistogramsTimeRecordPart ( DQMStore::IBooker &  ibooker)
protected

Definition at line 577 of file GEMDQMStatusDigi.cc.

References mps_fire::i.

577  {
578  for (auto &itStore : listTimeStore_) {
579  auto &infoCurr = itStore.second;
580 
581  Float_t fMin = -0.5, fMax = infoCurr.nNbinY - 0.5;
582 
583  if (infoCurr.nNbinMin < infoCurr.nNbinMax) {
584  fMin = infoCurr.nNbinMin;
585  fMax = infoCurr.nNbinMax;
586  }
587 
588  infoCurr.h2Histo = ibooker.book2D(
589  infoCurr.strName,
590  infoCurr.strTitle + ";Per " + std::to_string(nNSecPerBin_ * nNEvtPerSec_) + " events;" + infoCurr.strAxisX,
592  0,
594  infoCurr.nNbinY,
595  fMin,
596  fMax);
597 
598  if (seekIdx(m_listLayers, itStore.first) >= 0) {
599  for (Int_t i = 0; i < nNCh_; i++) {
600  auto &gid = m_listChambers[i];
601  Int_t nCh = gid.chamber() + (bPerSuperchamber_ ? 0 : gid.layer() - 1);
602  infoCurr.h2Histo->setBinLabel(i + 1, std::to_string(nCh), 2);
603  }
604  }
605  }
606 }
Int_t seekIdx(std::vector< GEMDetId > &listLayers, UInt_t unId)
std::vector< GEMDetId > m_listChambers
std::map< UInt_t, TimeStoreItem > listTimeStore_
std::vector< GEMDetId > m_listLayers
Bool_t GEMDQMStatusDigi::FillBits ( MonitorElement monitor,
uint64_t  unVal,
int  nNumBits 
)
private

Definition at line 720 of file GEMDQMStatusDigi.cc.

References dqm::impl::MonitorElement::Fill(), and mps_fire::i.

720  {
721  int i = 0;
722  uint64_t unFlag = 1;
723 
724  if (monitor == nullptr)
725  return false;
726 
727  for (; i < nNumBits; i++, unFlag <<= 1) {
728  if ((unVal & unFlag) != 0) {
729  monitor->Fill(i);
730  }
731  }
732 
733  return true;
734 }
void Fill(long long x)
unsigned long long uint64_t
Definition: Time.h:13
Bool_t GEMDQMStatusDigi::FillBits ( MonitorElement monitor,
uint64_t  unVal,
int  nNumBits,
int  nY 
)
private

Definition at line 736 of file GEMDQMStatusDigi.cc.

References dqm::impl::MonitorElement::Fill(), and mps_fire::i.

736  {
737  int i = 0;
738  uint64_t unFlag = 1;
739 
740  if (monitor == nullptr)
741  return false;
742 
743  for (; i < nNumBits; i++, unFlag <<= 1) {
744  if ((unVal & unFlag) != 0) {
745  monitor->Fill(nX, i);
746  }
747  }
748 
749  return true;
750 }
void Fill(long long x)
unsigned long long uint64_t
Definition: Time.h:13
void GEMDQMStatusDigi::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 191 of file GEMDQMStatusDigi.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), HLT_2018_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

191  {
193  desc.add<edm::InputTag>("VFATInputLabel", edm::InputTag("muonGEMDigis", "vfatStatus"));
194  desc.add<edm::InputTag>("GEBInputLabel", edm::InputTag("muonGEMDigis", "gebStatus"));
195  desc.add<edm::InputTag>("AMCInputLabel", edm::InputTag("muonGEMDigis", "AMCdata"));
196  desc.add<edm::InputTag>("digisInputLabel", edm::InputTag("muonGEMDigis", ""));
197 
198  std::vector<int> listAMCSlotsDef = {0, 1, 2, 3, 4, 5, 6, 7};
199  desc.add<std::vector<int>>("AMCSlots", listAMCSlotsDef); // TODO: Find how to get this from the geometry
200 
201  desc.add<std::string>("summaryLabelFmt", "GE%(station_signed)+i/%(layer)i");
202  desc.add<bool>("flipSummary", false);
203  desc.add<bool>("perSuperchamber", true);
204 
205  desc.add<std::string>("pathOfPrevDQMRoot", "");
206  desc.add<int>("numOfEvtPerSec", 100);
207  desc.add<int>("secOfEvtPerBin", 10);
208  desc.add<int>("totalTimeInterval", 50000);
209 
210  desc.add<int>("idxFirstStrip", 0);
211 
212  desc.add<int>("bxRange", 10);
213  desc.add<int>("bxBin", 20);
214 
215  descriptions.add("GEMDQMStatusDigi", desc);
216 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const GEMGeometry * GEMDQMStatusDigi::initGeometry ( edm::EventSetup const &  iSetup)
private

Definition at line 152 of file GEMDQMStatusDigi.cc.

References MillePedeFileConverter_cfg::e, and edm::EventSetup::get().

152  {
153  const GEMGeometry *GEMGeometry_ = nullptr;
154  try {
156  iSetup.get<MuonGeometryRecord>().get(hGeom);
157  GEMGeometry_ = &*hGeom;
159  edm::LogError("MuonGEMBaseValidation") << "+++ Error : GEM geometry is unavailable on event loop. +++\n";
160  return nullptr;
161  }
162  return GEMGeometry_;
163 }
const GEMGeometry * GEMGeometry_
int GEMDQMStatusDigi::LoadPrevData ( )
protected

Definition at line 376 of file GEMDQMStatusDigi.cc.

References beam_dqm_sourceclient-live_cfg::cerr, gather_cfg::cout, mps_fire::i, dqmiolumiharvest::j, and AlCaHLTBitMon_QueryRunRegistry::string.

376  {
377  TFile *fPrev;
378  Bool_t bSync = true;
379 
380  nStackedBin_ = 0;
381  nStackedEvt_ = 0;
382 
383  if (strPathPrevDQMRoot_.empty())
384  return 0;
385 
386  std::ifstream fExist(strPathPrevDQMRoot_.c_str());
387  if (!fExist.good())
388  return 0;
389  fExist.close();
390 
391  fPrev = new TFile(strPathPrevDQMRoot_.c_str());
392  if (fPrev == nullptr)
393  return 1;
394 
395  std::cout << strPathPrevDQMRoot_ << " is being loaded" << std::endl;
396  std::string strRunnum = ((TDirectoryFile *)fPrev->Get("DQMData"))->GetListOfKeys()->At(0)->GetName();
397 
398  // In this stage, we need to use them to check the consistence of time-histograms
399  nStackedBin_ = -1;
400  nStackedEvt_ = -1;
401 
402  for (auto &itStore : listTimeStore_) {
403  std::string strNameStore = "DQMData/" + strRunnum + "/GEM/Run summary/StatusDigi/" + itStore.second.strName;
404  TH2F *h2Prev = (TH2F *)fPrev->Get(strNameStore.c_str());
405 
406  Int_t nNBinX = h2Prev->GetNbinsX();
407  Int_t nNBinY = h2Prev->GetNbinsY();
408 
409  // Including all under/overflow bins (they contain important infos)
410  nStackedEvt_ = 0;
411  for (Int_t i = 0; i <= nNBinX + 1; i++) {
412  if (i > 0)
413  nStackedEvt_ += h2Prev->GetBinContent(i, 0);
414  for (Int_t j = 0; j <= nNBinY + 1; j++) {
415  itStore.second.h2Histo->setBinContent(i, j, h2Prev->GetBinContent(i, j));
416  }
417  }
418 
419  Int_t nStackedBinCurr = nStackedEvt_ / (nNSecPerBin_ * nNEvtPerSec_);
420  Int_t nStackedEvtCurr = nStackedEvt_ % (nNSecPerBin_ * nNEvtPerSec_);
421 
422  if (nStackedBin_ < 0) {
423  nStackedBin_ = nStackedBinCurr;
424  nStackedEvt_ = nStackedEvtCurr;
425  } else {
426  bSync = (nStackedBin_ == nStackedBinCurr && nStackedEvt_ == nStackedEvtCurr);
427  }
428  }
429 
430  if (!bSync) { // No sync...!
431  std::cerr << "WARNING: No sync on time histograms" << std::endl;
432  }
433 
434  fPrev->Close();
435 
436  return 0;
437 }
std::map< UInt_t, TimeStoreItem > listTimeStore_
std::string strPathPrevDQMRoot_
Int_t GEMDQMStatusDigi::seekIdx ( std::vector< GEMDetId > &  listLayers,
UInt_t  unId 
)
protected

Definition at line 752 of file GEMDQMStatusDigi.cc.

References triggerObjects_cff::id.

752  {
753  if (unId < 256)
754  return -1;
755 
756  GEMDetId id(unId);
757  for (Int_t nIdx = 0; nIdx < (Int_t)listLayers.size(); nIdx++)
758  if (id == listLayers[nIdx])
759  return nIdx;
760  return -1;
761 }
void GEMDQMStatusDigi::seekIdxSummary ( GEMDetId  gid,
Int_t &  nIdxLayer,
Int_t &  nIdxChamber 
)
protected

Definition at line 763 of file GEMDQMStatusDigi.cc.

References GEMDetId::chamber(), GEMDetId::layer(), GEMDetId::region(), GEMDetId::ring(), and GEMDetId::station().

763  {
764  Int_t nLayer = (bPerSuperchamber_ ? gid.layer() : 0);
765  GEMDetId layerId(gid.region(), gid.ring(), gid.station(), nLayer, 0, 0);
766  GEMDetId chamberId(0, 1, 1, gid.layer() - nLayer, gid.chamber(), 0);
767 
768  nIdxLayer = seekIdx(m_listLayers, layerId) + 1;
769  nIdxChamber = seekIdx(m_listChambers, chamberId) + 1;
770 }
int ring() const
Definition: GEMDetId.h:170
int chamber() const
Definition: GEMDetId.h:177
int layer() const
Definition: GEMDetId.h:184
int station() const
Definition: GEMDetId.h:173
int region() const
Definition: GEMDetId.h:165
Int_t seekIdx(std::vector< GEMDetId > &listLayers, UInt_t unId)
std::vector< GEMDetId > m_listChambers
std::vector< GEMDetId > m_listLayers
int GEMDQMStatusDigi::SetConfigTimeRecord ( )
protected

Definition at line 305 of file GEMDQMStatusDigi.cc.

References GEMeMap::maxEtaPartition_, GEMeMap::maxVFatGE11_, GEMeMap::maxVFatGE21_, tagTimeStoreItem::nNbinMax, tagTimeStoreItem::nNbinMin, tagTimeStoreItem::nNbinY, tagTimeStoreItem::strAxisX, AlCaHLTBitMon_QueryRunRegistry::string, tagTimeStoreItem::strName, and tagTimeStoreItem::strTitle.

305  {
306  TimeStoreItem newTimeStore;
307 
308  newTimeStore.nNbinMin = 0;
309  newTimeStore.nNbinMax = 0;
310 
311  std::string strCommonName = "per_time_";
312 
313  // Very general GEMDetId
314  newTimeStore.strName = strCommonName + "status_AMCslots";
315  newTimeStore.strTitle = "Status of AMC slots per time";
316  newTimeStore.strAxisX = "AMC slot";
317  newTimeStore.nNbinY = listAMCSlots_.size();
318  listTimeStore_[0] = newTimeStore;
319 
320  for (auto layerId : m_listLayers) {
321  std::string strSuffix =
322  (layerId.region() > 0 ? "p" : "m") + std::to_string(layerId.station()) + "_" + std::to_string(layerId.layer());
323 
324  newTimeStore.strName = strCommonName + "status_GEB_" + suffixLayer(layerId);
325  newTimeStore.strTitle = "";
326  newTimeStore.strAxisX = "Chamber";
327 
328  newTimeStore.nNbinY = nNCh_;
329  listTimeStore_[layerId] = newTimeStore;
330  }
331 
332  for (auto ch : gemChambers_) {
333  auto chId = ch.id();
334  GEMDetId chIdStatus(chId.region(), chId.ring(), chId.station(), chId.layer(), chId.chamber(), 1);
335  GEMDetId chIdDigi(chId.region(), chId.ring(), chId.station(), chId.layer(), chId.chamber(), 2);
336  GEMDetId chIdBx(chId.region(), chId.ring(), chId.station(), chId.layer(), chId.chamber(), 3);
337 
338  std::string strSuffix = suffixChamber(chId);
339 
340  Int_t nVFAT = 0;
341  if (chId.station() == 1)
343  if (chId.station() == 2)
345 
346  newTimeStore.strName = strCommonName + "status_chamber_" + strSuffix;
347  newTimeStore.strTitle = "";
348  newTimeStore.strAxisX = "VFAT";
349 
350  newTimeStore.nNbinY = nVFAT;
351  listTimeStore_[chIdStatus] = newTimeStore;
352 
353  newTimeStore.strName = strCommonName + "digi_chamber_" + strSuffix;
354  newTimeStore.strTitle = "";
355  newTimeStore.strAxisX = "VFAT";
356 
357  newTimeStore.nNbinY = nVFAT;
358  listTimeStore_[chIdDigi] = newTimeStore;
359 
360  newTimeStore.strName = strCommonName + "bx_chamber_" + strSuffix;
361  newTimeStore.strTitle = "";
362  newTimeStore.strAxisX = "Bunch crossing";
363 
364  newTimeStore.nNbinY = nNBxBin_;
365  newTimeStore.nNbinMin = -nNBxRange_;
366  newTimeStore.nNbinMax = nNBxRange_;
367 
368  listTimeStore_[chIdBx] = newTimeStore;
369 
370  newTimeStore.nNbinMin = newTimeStore.nNbinMax = 0;
371  }
372 
373  return 0;
374 }
static const int maxEtaPartition_
Definition: GEMeMap.h:71
std::string strTitle
std::string suffixLayer(GEMDetId &id)
std::string strAxisX
std::string suffixChamber(GEMDetId &id)
std::vector< GEMChamber > gemChambers_
std::map< UInt_t, TimeStoreItem > listTimeStore_
std::vector< GEMDetId > m_listLayers
static const int maxVFatGE21_
Definition: GEMeMap.h:68
std::vector< Int_t > listAMCSlots_
static const int maxVFatGE11_
Definition: GEMeMap.h:67
int GEMDQMStatusDigi::SetInfoChambers ( )
protected

Definition at line 228 of file GEMDQMStatusDigi.cc.

References a, b, GEMDetId::chamber(), cscd2r::chamberID(), createfilelist::int, cmsLHEtoEOSManager::l, GEMDetId::layer(), GEMDetId::region(), GEMDetId::ring(), and GEMDetId::station().

228  {
229  const std::vector<const GEMSuperChamber *> &superChambers_ = GEMGeometry_->superChambers();
230  for (auto sch : superChambers_) {
231  int nLayer = sch->nChambers();
232  for (int l = 0; l < nLayer; l++) {
233  Bool_t bExist = false;
234  for (auto ch : gemChambers_)
235  if (ch.id() == sch->chamber(l + 1)->id())
236  bExist = true;
237  if (bExist)
238  continue;
239 
240  gemChambers_.push_back(*sch->chamber(l + 1));
241  }
242  }
243 
244  // End: Loading the GEM geometry
245 
246  // Start: Set the configurations
247 
248  m_listLayers.clear();
249 
250  // Summarizing geometry configurations
251  for (auto ch : gemChambers_) {
252  GEMDetId gid = ch.id();
253 
254  GEMDetId layerID(gid.region(), gid.ring(), gid.station(), (bPerSuperchamber_ ? gid.layer() : 0), 0, 0);
255  Bool_t bOcc = false;
256 
257  for (auto lid : m_listLayers) {
258  if (lid == layerID) {
259  bOcc = true;
260  break;
261  }
262  }
263 
264  if (!bOcc)
265  m_listLayers.push_back(layerID);
266 
267  GEMDetId chamberID(0, 1, 1, (bPerSuperchamber_ ? 0 : gid.layer()), gid.chamber(), 0);
268  bOcc = false;
269 
270  for (auto cid : m_listChambers) {
271  if (cid == chamberID) {
272  bOcc = true;
273  break;
274  }
275  }
276 
277  if (!bOcc)
278  m_listChambers.push_back(chamberID);
279  }
280 
281  // Preliminary for sorting the summaries
282  auto lambdaLayer = [this](GEMDetId a, GEMDetId b) -> Bool_t {
283  Int_t nFlipSign = (this->bFlipSummary_ ? -1 : 1);
284  Int_t nA = nFlipSign * a.region() * (20 * a.station() + a.layer());
285  Int_t nB = nFlipSign * b.region() * (20 * b.station() + b.layer());
286  return nA > nB;
287  };
288 
289  auto lambdaChamber = [](GEMDetId a, GEMDetId b) -> Bool_t {
290  Int_t nA = 20 * a.chamber() + a.layer();
291  Int_t nB = 20 * b.chamber() + b.layer();
292  return nA < nB;
293  };
294 
295  // Sorting the summaries
296  std::sort(m_listLayers.begin(), m_listLayers.end(), lambdaLayer);
297  std::sort(m_listChambers.begin(), m_listChambers.end(), lambdaChamber);
298 
299  nNCh_ = (int)m_listChambers.size();
300 
301  return 0;
302 }
int ring() const
Definition: GEMDetId.h:170
const GEMGeometry * GEMGeometry_
int chamber() const
Definition: GEMDetId.h:177
int layer() const
Definition: GEMDetId.h:184
int station() const
Definition: GEMDetId.h:173
std::vector< GEMChamber > gemChambers_
CSCDetId chamberID(const CSCDetId &cscDetId)
takes layer ID, converts to chamber ID, switching ME1A to ME11
Definition: CSCDigiToRaw.cc:29
int region() const
Definition: GEMDetId.h:165
const std::vector< const GEMSuperChamber * > & superChambers() const
Return a vector of all GEM super chambers.
Definition: GEMGeometry.cc:36
std::vector< GEMDetId > m_listChambers
double b
Definition: hdecay.h:118
std::vector< GEMDetId > m_listLayers
double a
Definition: hdecay.h:119
std::string GEMDQMStatusDigi::suffixChamber ( GEMDetId id)
private

Definition at line 218 of file GEMDQMStatusDigi.cc.

References relativeConstraints::chamber, and relativeConstraints::station.

218  {
219  return "Gemini_" + to_string(id.chamber()) + "_GE" + (id.region() > 0 ? "p" : "m") + to_string(id.station()) + "_" +
220  to_string(id.layer());
221 }
std::string GEMDQMStatusDigi::suffixLayer ( GEMDetId id)
private

Definition at line 223 of file GEMDQMStatusDigi.cc.

References relativeConstraints::station, and AlCaHLTBitMon_QueryRunRegistry::string.

223  {
224  return std::string("st_") + (id.region() >= 0 ? "p" : "m") + std::to_string(id.station()) +
225  (bPerSuperchamber_ ? "_la_" + std::to_string(id.layer()) : "");
226 }

Member Data Documentation

int GEMDQMStatusDigi::amcStatusBit_ = 6
private

Definition at line 87 of file GEMDQMStatusDigi.cc.

bool GEMDQMStatusDigi::bFlipSummary_
private

Definition at line 100 of file GEMDQMStatusDigi.cc.

bool GEMDQMStatusDigi::bPerSuperchamber_
private

Definition at line 101 of file GEMDQMStatusDigi.cc.

int GEMDQMStatusDigi::cBit_ = 9
private

Definition at line 83 of file GEMDQMStatusDigi.cc.

int GEMDQMStatusDigi::eBit_ = 16
private

Definition at line 86 of file GEMDQMStatusDigi.cc.

int GEMDQMStatusDigi::fVFATBit_ = 4
private

Definition at line 85 of file GEMDQMStatusDigi.cc.

std::vector<GEMChamber> GEMDQMStatusDigi::gemChambers_
private

Definition at line 79 of file GEMDQMStatusDigi.cc.

const GEMGeometry* GEMDQMStatusDigi::GEMGeometry_
private

Definition at line 77 of file GEMDQMStatusDigi.cc.

std::shared_ptr<GEMROMapping> GEMDQMStatusDigi::GEMROMapping_
private

Definition at line 78 of file GEMDQMStatusDigi.cc.

MonitorElement* GEMDQMStatusDigi::h1_amc_buffState_
private

Definition at line 139 of file GEMDQMStatusDigi.cc.

MonitorElement* GEMDQMStatusDigi::h1_amc_chTimeOut_
private

Definition at line 141 of file GEMDQMStatusDigi.cc.

MonitorElement* GEMDQMStatusDigi::h1_amc_davCnt_
private

Definition at line 138 of file GEMDQMStatusDigi.cc.

MonitorElement* GEMDQMStatusDigi::h1_amc_oosGlib_
private

Definition at line 140 of file GEMDQMStatusDigi.cc.

MonitorElement* GEMDQMStatusDigi::h1_amc_ttsState_
private

Definition at line 137 of file GEMDQMStatusDigi.cc.

MonitorElement* GEMDQMStatusDigi::h1_vfat_qualityflag_
private

Definition at line 115 of file GEMDQMStatusDigi.cc.

MonitorElement* GEMDQMStatusDigi::h2_vfat_qualityflag_
private

Definition at line 116 of file GEMDQMStatusDigi.cc.

MonitorElement* GEMDQMStatusDigi::h2AMCStatus_
private

Definition at line 142 of file GEMDQMStatusDigi.cc.

MonitorElement* GEMDQMStatusDigi::h3SummaryStatusPre_
private

Definition at line 134 of file GEMDQMStatusDigi.cc.

std::vector<Int_t> GEMDQMStatusDigi::listAMCSlots_
private

Definition at line 110 of file GEMDQMStatusDigi.cc.

std::unordered_map<UInt_t, MonitorElement *> GEMDQMStatusDigi::listGEBbcOH_
private

Definition at line 127 of file GEMDQMStatusDigi.cc.

std::unordered_map<UInt_t, MonitorElement *> GEMDQMStatusDigi::listGEBecOH_
private

Definition at line 128 of file GEMDQMStatusDigi.cc.

std::unordered_map<UInt_t, MonitorElement *> GEMDQMStatusDigi::listGEBInputID_
private

Definition at line 123 of file GEMDQMStatusDigi.cc.

std::unordered_map<UInt_t, MonitorElement *> GEMDQMStatusDigi::listGEBInputStatus_
private

Definition at line 122 of file GEMDQMStatusDigi.cc.

std::unordered_map<UInt_t, MonitorElement *> GEMDQMStatusDigi::listGEBOHCRC_
private

Definition at line 129 of file GEMDQMStatusDigi.cc.

std::unordered_map<UInt_t, MonitorElement *> GEMDQMStatusDigi::listGEBVFATWordCnt_
private

Definition at line 124 of file GEMDQMStatusDigi.cc.

std::unordered_map<UInt_t, MonitorElement *> GEMDQMStatusDigi::listGEBVFATWordCntT_
private

Definition at line 125 of file GEMDQMStatusDigi.cc.

std::unordered_map<UInt_t, MonitorElement *> GEMDQMStatusDigi::listGEBZeroSupWordsCnt_
private

Definition at line 126 of file GEMDQMStatusDigi.cc.

std::map<UInt_t, TimeStoreItem> GEMDQMStatusDigi::listTimeStore_
private

Definition at line 147 of file GEMDQMStatusDigi.cc.

std::unordered_map<UInt_t, MonitorElement *> GEMDQMStatusDigi::listVFATBC_
private

Definition at line 119 of file GEMDQMStatusDigi.cc.

std::unordered_map<UInt_t, MonitorElement *> GEMDQMStatusDigi::listVFATEC_
private

Definition at line 120 of file GEMDQMStatusDigi.cc.

std::unordered_map<UInt_t, MonitorElement *> GEMDQMStatusDigi::listVFATQualityFlag_
private

Definition at line 118 of file GEMDQMStatusDigi.cc.

std::vector<GEMDetId> GEMDQMStatusDigi::m_listChambers
private

Definition at line 113 of file GEMDQMStatusDigi.cc.

std::vector<GEMDetId> GEMDQMStatusDigi::m_listLayers
private

Definition at line 112 of file GEMDQMStatusDigi.cc.

std::unordered_map<UInt_t, Bool_t> GEMDQMStatusDigi::m_mapStatusErr
private

Definition at line 132 of file GEMDQMStatusDigi.cc.

std::unordered_map<UInt_t, Bool_t> GEMDQMStatusDigi::m_mapStatusFill
private

Definition at line 131 of file GEMDQMStatusDigi.cc.

const Int_t GEMDQMStatusDigi::m_nIdxSummaryErr = 2
private

Definition at line 135 of file GEMDQMStatusDigi.cc.

const Int_t GEMDQMStatusDigi::m_nIdxSummaryFill = 1
private

Definition at line 135 of file GEMDQMStatusDigi.cc.

MonitorElement* GEMDQMStatusDigi::m_summaryReport_
private

Definition at line 144 of file GEMDQMStatusDigi.cc.

int GEMDQMStatusDigi::nIdxFirstStrip_
private

Definition at line 94 of file GEMDQMStatusDigi.cc.

int GEMDQMStatusDigi::nNBxBin_
private

Definition at line 96 of file GEMDQMStatusDigi.cc.

int GEMDQMStatusDigi::nNBxRange_
private

Definition at line 97 of file GEMDQMStatusDigi.cc.

int GEMDQMStatusDigi::nNCh_
private

Definition at line 81 of file GEMDQMStatusDigi.cc.

int GEMDQMStatusDigi::nNEvtPerSec_
private

Definition at line 89 of file GEMDQMStatusDigi.cc.

int GEMDQMStatusDigi::nNSecPerBin_
private

Definition at line 90 of file GEMDQMStatusDigi.cc.

int GEMDQMStatusDigi::nNTimeBinPrimitive_
private

Definition at line 92 of file GEMDQMStatusDigi.cc.

int GEMDQMStatusDigi::nNTimeBinTotal_
private

Definition at line 91 of file GEMDQMStatusDigi.cc.

Int_t GEMDQMStatusDigi::nStackedBin_
private

Definition at line 148 of file GEMDQMStatusDigi.cc.

Int_t GEMDQMStatusDigi::nStackedEvt_
private

Definition at line 149 of file GEMDQMStatusDigi.cc.

int GEMDQMStatusDigi::qVFATBit_ = 5
private

Definition at line 84 of file GEMDQMStatusDigi.cc.

std::string GEMDQMStatusDigi::strFmtSummaryLabel_
private

Definition at line 99 of file GEMDQMStatusDigi.cc.

std::string GEMDQMStatusDigi::strPathPrevDQMRoot_
private

Definition at line 103 of file GEMDQMStatusDigi.cc.

edm::EDGetToken GEMDQMStatusDigi::tagAMC_
private

Definition at line 107 of file GEMDQMStatusDigi.cc.

edm::EDGetToken GEMDQMStatusDigi::tagDigi_
private

Definition at line 108 of file GEMDQMStatusDigi.cc.

edm::EDGetToken GEMDQMStatusDigi::tagGEB_
private

Definition at line 106 of file GEMDQMStatusDigi.cc.

edm::EDGetToken GEMDQMStatusDigi::tagVFAT_
private

Definition at line 105 of file GEMDQMStatusDigi.cc.