CMS 3D CMS Logo

GEMDQMBase.h
Go to the documentation of this file.
1 #ifndef DQM_GEM_INTERFACE_GEMDQMBase_h
2 #define DQM_GEM_INTERFACE_GEMDQMBase_h
3 
4 #include <map>
5 #include <tuple>
6 
15 
20 
23 
25 
28 
29 class GEMDQMBase : public DQMEDAnalyzer {
30 public:
31  // Borrwed from DQM/GEM/interface/GEMOfflineDQMBase.h
32  class BookingHelper {
33  public:
34  BookingHelper(DQMStore::IBooker &ibooker, const TString &name_suffix, const TString &title_suffix)
35  : ibooker_(&ibooker), name_suffix_(name_suffix), title_suffix_(title_suffix) {}
36 
38 
40  TString title,
41  int nbinsx,
42  double xlow,
43  double xup,
44  TString x_title = "",
45  TString y_title = "Entries") {
46  name += name_suffix_;
47  title += title_suffix_ + ";" + x_title + ";" + y_title;
48  return ibooker_->book1D(name, title, nbinsx, xlow, xup);
49  }
50 
52  TString title,
53  std::vector<double> &x_binning,
54  TString x_title = "",
55  TString y_title = "Entries") {
56  name += name_suffix_;
57  title += title_suffix_ + ";" + x_title + ";" + y_title;
58  TH1F *h_obj = new TH1F(name, title, x_binning.size() - 1, &x_binning[0]);
59  return ibooker_->book1D(name, h_obj);
60  }
61 
63  TString title,
64  int nbinsx,
65  double xlow,
66  double xup,
67  int nbinsy,
68  double ylow,
69  double yup,
70  TString x_title = "",
71  TString y_title = "") {
72  name += name_suffix_;
73  title += title_suffix_ + ";" + x_title + ";" + y_title;
74  return ibooker_->book2D(name, title, nbinsx, xlow, xup, nbinsy, ylow, yup);
75  }
76 
78  TString title,
79  int nbinsx,
80  double xlow,
81  double xup,
82  int nbinsy,
83  double ylow,
84  double yup,
85  double zlow,
86  double zup,
87  TString x_title = "",
88  TString y_title = "") {
89  name += name_suffix_;
90  title += title_suffix_ + ";" + x_title + ";" + y_title;
91  return ibooker_->bookProfile2D(name, title, nbinsx, xlow, xup, nbinsy, ylow, yup, zlow, zup);
92  }
93 
95 
96  private:
98  const TString name_suffix_;
99  const TString title_suffix_;
100  }; // BookingHelper
101 
102  template <class M, class K>
103  class MEMapInfT {
104  public:
106 
108  GEMDQMBase *pDQMBase, TString strName, TString strTitle, TString strTitleX = "", TString strTitleY = "Entries")
109  : pDQMBase_(pDQMBase),
110  strName_(strName),
111  strTitle_(strTitle),
112  strTitleX_(strTitleX),
113  strTitleY_(strTitleY),
114  log_category_own_(pDQMBase->log_category_){};
115 
117  TString strName,
118  TString strTitle,
119  Int_t nBinsX,
120  Double_t dXL,
121  Double_t dXH,
122  TString strTitleX = "",
123  TString strTitleY = "Entries")
124  : pDQMBase_(pDQMBase),
125  strName_(strName),
126  strTitle_(strTitle),
127  strTitleX_(strTitleX),
128  strTitleY_(strTitleY),
129  bOperating_(true),
132  nBinsX_(nBinsX),
133  dXL_(dXL),
134  dXH_(dXH),
135  nBinsY_(-1),
136  log_category_own_(pDQMBase->log_category_){};
137 
139  TString strName,
140  TString strTitle,
141  std::vector<Double_t> &x_binning,
142  TString strTitleX = "",
143  TString strTitleY = "Entries")
144  : pDQMBase_(pDQMBase),
145  strName_(strName),
146  strTitle_(strTitle),
147  strTitleX_(strTitleX),
148  strTitleY_(strTitleY),
149  bOperating_(true),
152  nBinsX_(-1),
153  nBinsY_(-1),
154  log_category_own_(pDQMBase->log_category_) {
155  for (Int_t i = 0; i < (Int_t)x_binning.size(); i++)
156  x_binning_.push_back(x_binning[i]);
157  };
158 
160  TString strName,
161  TString strTitle,
162  Int_t nBinsX,
163  Double_t dXL,
164  Double_t dXH,
165  Int_t nBinsY,
166  Double_t dYL,
167  Double_t dYH,
168  TString strTitleX = "",
169  TString strTitleY = "")
170  : pDQMBase_(pDQMBase),
171  strName_(strName),
172  strTitle_(strTitle),
173  strTitleX_(strTitleX),
174  strTitleY_(strTitleY),
175  bOperating_(true),
178  nBinsX_(nBinsX),
179  dXL_(dXL),
180  dXH_(dXH),
181  nBinsY_(nBinsY),
182  dYL_(dYL),
183  dYH_(dYH),
184  dZL_(0),
185  dZH_(1024),
186  log_category_own_(pDQMBase->log_category_){};
187 
188  MEMapInfT(GEMDQMBase *pDQMBase, // For TProfile2D
189  TString strName,
190  TString strTitle,
191  Int_t nBinsX,
192  Double_t dXL,
193  Double_t dXH,
194  Int_t nBinsY,
195  Double_t dYL,
196  Double_t dYH,
197  Double_t dZL,
198  Double_t dZH,
199  TString strTitleX = "",
200  TString strTitleY = "")
201  : pDQMBase_(pDQMBase),
202  strName_(strName),
203  strTitle_(strTitle),
204  strTitleX_(strTitleX),
205  strTitleY_(strTitleY),
206  bOperating_(true),
207  bIsProfile_(true),
209  nBinsX_(nBinsX),
210  dXL_(dXL),
211  dXH_(dXH),
212  nBinsY_(nBinsY),
213  dYL_(dYL),
214  dYH_(dYH),
215  dZL_(dZL),
216  dZH_(dZH),
217  log_category_own_(pDQMBase->log_category_){};
218 
219  //MEMapInfT(GEMDQMBase *pDQMBase,
220  // TString strName,
221  // TString strTitle,
222  // std::vector<Double_t> &x_binning,
223  // std::vector<Double_t> &y_binning,
224  // TString strTitleX = "",
225  // TString strTitleY = "")
226  // : pDQMBase_(pDQMBase),
227  // strName_(strName),
228  // strTitle_(strTitle),
229  // strTitleX_(strTitleX),
230  // strTitleY_(strTitleY),
231  // bOperating_(true),
232  // bIsNoUnderOverflowBin_(false),
233  // nBinsX_(nBinsX),
234  // dXL_(dXL),
235  // dXH_(dXH),
236  // nBinsY_(nBinsY),
237  // dYL_(dYL),
238  // dYH_(dYH),
239  // log_category_own_(pDQMBase->log_category_){};
240 
242 
243  Bool_t isOperating() { return bOperating_; };
244  void SetOperating(Bool_t bOperating) { bOperating_ = bOperating; };
245  void TurnOn() { bOperating_ = true; };
246  void TurnOff() { bOperating_ = false; };
248 
249  Bool_t isProfile() { return bIsProfile_; };
250  void SetProfile(Bool_t bIsProfile) { bIsProfile_ = bIsProfile; };
251 
252  TString GetName() { return strName_; };
253  void SetName(TString strName) { strName_ = strName; };
254  TString GetTitle() { return strTitle_; };
255  void SetTitle(TString strTitle) { strTitle_ = strTitle; };
256  TString GetTitleX() { return strTitleX_; };
257  void SetTitleX(TString strTitleX) { strTitleX_ = strTitleX; };
258  TString GetTitleY() { return strTitleY_; };
259  void SetTitleY(TString strTitleY) { strTitleY_ = strTitleY; };
260 
261  Int_t GetNbinsX() { return nBinsX_; };
262  void SetNbinsX(Int_t nBinsX) { nBinsX_ = nBinsX; };
263  Double_t GetBinLowEdgeX() { return dXL_; };
264  void SetBinLowEdgeX(Double_t dXL) { dXL_ = dXL; };
265  Double_t GetBinHighEdgeX() { return dXH_; };
266  void SetBinHighEdgeX(Double_t dXH) { dXH_ = dXH; };
267  // FIXME: x_binning_
268 
269  Int_t GetNbinsY() { return nBinsY_; };
270  void SetNbinsY(Int_t nBinsY) { nBinsY_ = nBinsY; };
271  Double_t GetBinLowEdgeY() { return dYL_; };
272  void SetBinLowEdgeY(Double_t dYL) { dYL_ = dYL; };
273  Double_t GetBinHighEdgeY() { return dYH_; };
274  void SetBinHighEdgeY(Double_t dYH) { dYH_ = dYH; };
275 
276  Double_t GetBinLowEdgeZ() { return dZL_; };
277  void SetBinLowEdgeZ(Double_t dZL) { dZL_ = dZL; };
278  Double_t GetBinHighEdgeZ() { return dZH_; };
279  void SetBinHighEdgeZ(Double_t dZH) { dZH_ = dZH; };
280 
281  void SetBinConfX(Int_t nBins, Double_t dL = 0.5, Double_t dH = -1048576.0) {
282  nBinsX_ = nBins;
283  dXL_ = dL;
284  if (dH <= dL)
285  dH = dL + nBins;
286  dXH_ = dH;
287  };
288 
289  void SetBinConfY(Int_t nBins, Double_t dL = 0.5, Double_t dH = -1048576.0) {
290  nBinsY_ = nBins;
291  dYL_ = dL;
292  if (dH <= dL)
293  dH = dL + nBins;
294  dYH_ = dH;
295  };
296 
297  void SetPointUOFlow() {
298  dXU_ = dXL_ + (dXH_ - dXL_) / nBinsX_ * 0.5;
299  dXO_ = dXL_ + (dXH_ - dXL_) / nBinsX_ * (nBinsX_ - 0.5);
300  dYU_ = dYL_ + (dYH_ - dYL_) / nBinsY_ * 0.5;
301  dYO_ = dYL_ + (dYH_ - dYL_) / nBinsY_ * (nBinsY_ - 0.5);
302  dZU_ = dZL_ + (dZH_ - dZL_) / nBinsZ_ * 0.5;
303  dZO_ = dZL_ + (dZH_ - dZL_) / nBinsZ_ * (nBinsZ_ - 0.5);
304  };
305 
306  M &map() { return mapHist; }
307  int bookND(BookingHelper &bh, K key) {
308  if (!bOperating_)
309  return 0;
310  SetPointUOFlow();
311  if (bIsProfile_) {
312  mapHist[key] = bh.bookProfile2D(
314  } else if (nBinsY_ > 0 && nBinsX_ > 0) {
316  return 0;
317  } else if (!x_binning_.empty()) {
319  return 0;
320  } else if (nBinsX_ > 0) {
322  return 0;
323  }
324 
325  return -1;
326  };
327 
329  if (mapHist.find(key) == mapHist.end()) {
331  << "WARNING: Cannot find the histogram corresponing to the given key\n"; // FIXME: It's about sending a message
332  return nullptr;
333  }
334  return mapHist[key];
335  };
336 
337  int SetLabelForChambers(K key, Int_t nAxis, Int_t nNumBin = -1, Int_t nIdxStart = 1, Int_t nNumModules = 1) {
338  if (!bOperating_)
339  return 0;
340  if (nNumBin <= 0) {
341  if (nAxis == 1)
342  nNumBin = nBinsX_;
343  else if (nAxis == 2)
344  nNumBin = nBinsY_;
345  else
346  return -1;
347  }
349  if (histCurr == nullptr)
350  return -999;
351  for (Int_t i = 1; i <= nNumBin; i++) {
352  Int_t nIdxCh = (nIdxStart + i - 2) / nNumModules + 1;
353  Int_t nIdxMod = (nIdxStart + i - 2) % nNumModules + 1;
354  if (nNumModules > 1) {
355  histCurr->setBinLabel(i, Form("#splitline{%i}{M%i}", nIdxCh, nIdxMod), nAxis);
356  } else {
357  histCurr->setBinLabel(i, Form("%i", nIdxStart + i - 1), nAxis);
358  }
359  }
360  return 0;
361  };
362 
363  int SetLabelForIEta(K key, Int_t nAxis, Int_t nNumBin = -1) { return SetLabelForChambers(key, nAxis, nNumBin); };
364 
365  int SetLabelForVFATs(K key, Int_t nNumEtaPartitions, Int_t nAxis, Int_t nNumBin = -1) {
366  if (!bOperating_)
367  return 0;
368  if (nNumBin <= 0) {
369  if (nAxis == 1)
370  nNumBin = nBinsX_;
371  else if (nAxis == 2)
372  nNumBin = nBinsY_;
373  else
374  return -1;
375  }
377  if (histCurr == nullptr)
378  return -999;
379  if (std::get<1>(key) == 2) {
380  Int_t nNumVFATPerModule = 12; // FIXME: A better way to get this?
381  if (nNumBin > nNumVFATPerModule) {
382  for (Int_t i = 0; i < nNumBin; i++) {
383  Int_t nIModule = i / nNumVFATPerModule + 1;
384  histCurr->setBinLabel(
385  i + 1, Form((nAxis == 1 ? "#splitline{%i}{M%i}" : "%i (M%i)"), i % nNumVFATPerModule, nIModule), nAxis);
386  }
387  } else {
388  for (Int_t i = 0; i < nNumBin; i++) {
389  histCurr->setBinLabel(i + 1, Form("%i", i), nAxis);
390  }
391  }
392  } else {
393  for (Int_t i = 0; i < nNumBin; i++) {
394  Int_t nIEta = pDQMBase_->getIEtaFromVFAT(std::get<1>(key), i);
395  histCurr->setBinLabel(i + 1, Form("%i (%i)", i, nIEta), nAxis);
396  }
397  }
398  return 0;
399  };
400 
401  int Fill(K key, Double_t x) {
402  if (!bOperating_)
403  return 0;
405  if (hist == nullptr)
406  return -999;
408  if (x <= dXL_)
409  x = dXU_;
410  else if (x >= dXH_)
411  x = dXO_;
412  }
413  hist->Fill(x);
414  return 1;
415  };
416 
417  int Fill(K key, Double_t x, Double_t y, Double_t w = 1.0) {
418  if (!bOperating_)
419  return 0;
421  if (hist == nullptr)
422  return -999;
424  if (x <= dXL_)
425  x = dXU_;
426  else if (x >= dXH_)
427  x = dXO_;
428  if (y <= dYL_)
429  y = dYU_;
430  else if (y >= dYH_)
431  y = dYO_;
432  }
433  hist->Fill(x, y, w);
434  return 1;
435  };
436 
437  int FillBits(K key, Double_t x, UInt_t bits, Double_t w = 1.0) {
438  if (!bOperating_)
439  return 0;
441  if (hist == nullptr)
442  return -999;
443 
444  if (nBinsY_ <= 0)
445  return -888;
446  UInt_t unMask = 0x1;
447  for (Int_t i = 1; i <= nBinsY_; i++) {
448  if ((unMask & bits) != 0)
449  hist->Fill(x, i, w);
450  unMask <<= 1;
451  }
452 
453  return 1;
454  };
455 
456  private:
458 
461  Bool_t bOperating_;
462  Bool_t bIsProfile_;
464 
465  std::vector<double> x_binning_;
466  Int_t nBinsX_;
467  Double_t dXL_, dXH_;
468  Int_t nBinsY_;
469  Double_t dYL_, dYH_;
470  Int_t nBinsZ_;
471  Double_t dZL_, dZH_;
472  Double_t dXU_, dXO_;
473  Double_t dYU_, dYO_;
474  Double_t dZU_, dZO_;
475 
477  };
478 
482 
484  public:
486  MEStationInfo(Int_t nRegion,
487  Int_t nStation,
488  Int_t nLayer,
489  Int_t nNumChambers,
490  Int_t nNumModules,
491  Int_t nNumEtaPartitions,
492  Int_t nMaxVFAT,
493  Int_t nFirstStrip,
494  Int_t nNumDigi,
495  Int_t nMinIdxChamber,
496  Int_t nMaxIdxChamber)
497  : nRegion_(nRegion),
498  nStation_(nStation),
499  nLayer_(nLayer),
500  nNumChambers_(nNumChambers),
501  nNumModules_(nNumModules),
502  nNumEtaPartitions_(nNumEtaPartitions),
503  nMaxVFAT_(nMaxVFAT),
504  nFirstStrip_(nFirstStrip),
505  nNumDigi_(nNumDigi),
506  nMinIdxChamber_(nMinIdxChamber),
507  nMaxIdxChamber_(nMaxIdxChamber),
508  fMinPhi_(0){};
509 
510  bool operator==(const MEStationInfo &other) const {
511  return (nRegion_ == other.nRegion_ && nStation_ == other.nStation_ && nLayer_ == other.nLayer_ &&
512  nNumChambers_ == other.nNumChambers_ && nNumModules_ == other.nNumModules_ &&
513  nNumEtaPartitions_ == other.nNumEtaPartitions_ && nMaxVFAT_ == other.nMaxVFAT_ &&
514  nFirstStrip_ == other.nFirstStrip_ && nNumDigi_ == other.nNumDigi_);
515  };
516 
517  Int_t nRegion_; // the region index
518  Int_t nStation_; // the station index
519  Int_t nLayer_; // the layer
520  Int_t nNumChambers_; // the number of chambers in the current station
521  Int_t nNumModules_; // the number of modules in each chamber
522  Int_t nNumEtaPartitions_; // the number of eta partitions of the chambers
523  Int_t nMaxVFAT_; // the number of all VFATs in each chamber (= # of VFATs in eta partition * nNumEtaPartitions_)
524  Int_t nFirstStrip_; // the index of the first strip
525  Int_t nNumDigi_; // the number of digis of each VFAT
526 
529  Float_t fMinPhi_;
530 
531  std::vector<Float_t> listRadiusEvenChamber_;
532  std::vector<Float_t> listRadiusOddChamber_;
533  };
534 
537 
538 public:
539  explicit GEMDQMBase(const edm::ParameterSet &cfg);
540  ~GEMDQMBase() override{};
541 
542  enum {
548  };
549 
550  Int_t nRunType_;
551 
553 
554 protected:
555  int initGeometry(edm::EventSetup const &iSetup);
556  int loadChambers();
557 
559  virtual int ProcessWithMEMap2(BookingHelper &bh, ME2IdsKey key) { return 0; }; // must be overrided
560  virtual int ProcessWithMEMap2WithEta(BookingHelper &bh, ME3IdsKey key) { return 0; }; // must be overrided
561  virtual int ProcessWithMEMap2AbsReWithEta(BookingHelper &bh, ME3IdsKey key) { return 0; }; // must be overrided
562  virtual int ProcessWithMEMap3(BookingHelper &bh, ME3IdsKey key) { return 0; }; // must be overrided
563  virtual int ProcessWithMEMap4(BookingHelper &bh, ME4IdsKey key) { return 0; }; // must be overrided
564  virtual int ProcessWithMEMap3WithChamber(BookingHelper &bh, ME4IdsKey key) { return 0; }; // must be overrided
565 
566  int keyToRegion(ME2IdsKey key) { return std::get<0>(key); };
567  int keyToRegion(ME3IdsKey key) { return std::get<0>(key); };
568  int keyToRegion(ME4IdsKey key) { return std::get<0>(key); };
569  int keyToStation(ME2IdsKey key) { return std::get<1>(key); };
570  int keyToStation(ME3IdsKey key) { return std::get<1>(key); };
571  int keyToStation(ME4IdsKey key) { return std::get<1>(key); };
572  int keyToLayer(ME3IdsKey key) { return std::get<2>(key); };
573  int keyToLayer(ME4IdsKey key) { return std::get<2>(key); };
574  int keyToChamber(ME4IdsKey key) { return std::get<3>(key); };
575  int keyToIEta(ME3IdsKey key) { return std::get<2>(key); };
576  int keyToIEta(ME4IdsKey key) { return std::get<3>(key); };
577 
579  auto keyNew = ME2IdsKey{keyToRegion(key), keyToStation(key)};
580  return keyNew;
581  };
582 
584  auto keyNew = ME3IdsKey{keyToRegion(key), keyToStation(key), keyToLayer(key)};
585  return keyNew;
586  };
587 
588  int SortingLayers(std::vector<ME3IdsKey> &listLayers);
590 
591  template <typename T>
592  inline bool checkRefs(const std::vector<T *> &);
593 
594  int getNumEtaPartitions(const GEMStation *);
595  inline int getVFATNumber(const int, const int, const int);
596  inline int getVFATNumberGE11(const int, const int, const int);
597  inline int getVFATNumberByDigi(const int, const int, const int);
598  inline int getIEtaFromVFAT(const int station, const int vfat);
599  inline int getIEtaFromVFATGE0(const int vfat);
600  inline int getIEtaFromVFATGE11(const int vfat);
601  inline int getIEtaFromVFATGE21(const int vfat);
602  inline int getMaxVFAT(const int);
603  inline int getNumModule(const int);
604  inline int getIdxModule(const int, const int);
605  inline int getDetOccXBin(const int, const int, const int);
606  inline Float_t restrictAngle(const Float_t fTheta, const Float_t fStart);
608 
611 
612  std::vector<GEMDetId> listChamberId_;
613  std::map<GEMDetId, std::vector<const GEMEtaPartition *>> mapEtaPartition_;
614 
615  std::map<ME2IdsKey, bool> MEMap2Check_;
616  std::map<ME3IdsKey, bool> MEMap2WithEtaCheck_;
617  std::map<ME3IdsKey, bool> MEMap2AbsReWithEtaCheck_;
618  std::map<ME3IdsKey, bool> MEMap3Check_;
619  std::map<ME4IdsKey, bool> MEMap3WithChCheck_;
620  std::map<ME4IdsKey, bool> MEMap4Check_;
621 
623  std::map<ME3IdsKey, int> mapStationToIdx_;
624  std::map<ME3IdsKey, MEStationInfo> mapStationInfo_;
625 };
626 
627 // Borrwed from DQM/GEM/interface/GEMOfflineDQMBase.h
628 template <typename T>
629 inline bool GEMDQMBase::checkRefs(const std::vector<T *> &refs) {
630  if (refs.empty())
631  return false;
632  if (refs.front() == nullptr)
633  return false;
634  return true;
635 }
636 
637 // The 'get...' functions in the below are borrwed from DQM/GEM/interface/GEMOfflineDQMBase.h
638 inline int GEMDQMBase::getMaxVFAT(const int station) {
639  if (station == 0)
640  return GEMeMap::maxVFatGE0_;
641  if (station == 1)
642  return GEMeMap::maxVFatGE11_;
643  else if (station == 2)
644  return GEMeMap::maxVFatGE21_ / 2;
645  else
646  return -1;
647 }
648 
649 inline int GEMDQMBase::getNumModule(const int station) {
650  if (station == 0)
651  return 1;
652  if (station == 1)
653  return 1;
654  else if (station == 2)
655  return 4;
656  else
657  return -1;
658 }
659 
660 inline int GEMDQMBase::getIdxModule(const int station, const int chamberType) {
661  if (station == 0)
662  return 1;
663  if (station == 1)
664  return 1;
665  else if (station == 2)
666  return chamberType - 20;
667  else
668  return -1;
669 }
670 
671 inline int GEMDQMBase::getVFATNumber(const int station, const int ieta, const int vfat_phi) {
672  if (station == 1)
673  return getVFATNumberGE11(station, ieta, vfat_phi);
674  return getVFATNumberGE11(station, ieta, vfat_phi); // FIXME: What about GE21 and GE0?
675 }
676 
677 inline int GEMDQMBase::getVFATNumberGE11(const int station, const int ieta, const int vfat_phi) {
678  return vfat_phi * GEMeMap::maxiEtaIdGE11_ + (GEMeMap::maxiEtaIdGE11_ - ieta);
679 }
680 
681 inline int GEMDQMBase::getVFATNumberByDigi(const int station, const int ieta, const int digi) {
682  const int vfat_phi = digi / GEMeMap::maxChan_;
683  return getVFATNumber(station, ieta, vfat_phi);
684 }
685 
686 inline int GEMDQMBase::getIEtaFromVFAT(const int station, const int vfat) {
687  if (station == 0)
688  return getIEtaFromVFATGE0(vfat);
689  if (station == 1)
690  return getIEtaFromVFATGE11(vfat);
691  if (station == 2)
692  return getIEtaFromVFATGE21(vfat);
693  return getIEtaFromVFATGE11(vfat); // FIXME: What about GE21 and GE0?
694 }
695 
696 inline int GEMDQMBase::getIEtaFromVFATGE0(const int vfat) {
698 }
699 
700 inline int GEMDQMBase::getIEtaFromVFATGE11(const int vfat) {
702 }
703 
704 inline int GEMDQMBase::getIEtaFromVFATGE21(const int vfat) {
706 }
707 
708 inline int GEMDQMBase::getDetOccXBin(const int chamber, const int layer, const int n_chambers) {
709  return n_chambers * (chamber - 1) + layer;
710 }
711 
712 inline Float_t GEMDQMBase::restrictAngle(const Float_t fTheta, const Float_t fStart) {
713  Float_t fLoop = (fTheta - fStart) / (2 * M_PI);
714  int nLoop = (fLoop >= 0 ? (int)fLoop : (int)fLoop - 1);
715  return fTheta - nLoop * 2 * M_PI;
716 }
717 
719  auto nStation = keyToStation(key3);
720  char cRegion = (keyToRegion(key3) > 0 ? 'P' : 'M');
721  auto nLayer = keyToLayer(key3);
722  return std::string(Form("GE%i1-%c-L%i", nStation, cRegion, nLayer));
723 }
724 
725 #endif // DQM_GEM_INTERFACE_GEMDQMBase_h
void SetName(TString strName)
Definition: GEMDQMBase.h:253
ME2IdsKey key3Tokey2(ME3IdsKey key)
Definition: GEMDQMBase.h:578
bool checkRefs(const std::vector< T *> &)
Definition: GEMDQMBase.h:629
MEMapInfT< MEMap4Ids, ME4IdsKey > MEMap4Inf
Definition: GEMDQMBase.h:481
void SetBinLowEdgeZ(Double_t dZL)
Definition: GEMDQMBase.h:277
dqm::impl::MonitorElement * CreateSummaryHist(DQMStore::IBooker &ibooker, TString strName)
Definition: GEMDQMBase.cc:148
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:476
Int_t nRunType_
Definition: GEMDQMBase.h:550
int getIdxModule(const int, const int)
Definition: GEMDQMBase.h:660
~GEMDQMBase() override
Definition: GEMDQMBase.h:540
virtual int ProcessWithMEMap4(BookingHelper &bh, ME4IdsKey key)
Definition: GEMDQMBase.h:563
int getIEtaFromVFATGE0(const int vfat)
Definition: GEMDQMBase.h:696
std::vector< GEMDetId > listChamberId_
Definition: GEMDQMBase.h:612
virtual int ProcessWithMEMap2AbsReWithEta(BookingHelper &bh, ME3IdsKey key)
Definition: GEMDQMBase.h:561
int getVFATNumber(const int, const int, const int)
Definition: GEMDQMBase.h:671
T w() const
int getVFATNumberByDigi(const int, const int, const int)
Definition: GEMDQMBase.h:681
MEMapInfT< MEMap3Ids, ME3IdsKey > MEMap3Inf
Definition: GEMDQMBase.h:480
int getIEtaFromVFATGE21(const int vfat)
Definition: GEMDQMBase.h:704
int initGeometry(edm::EventSetup const &iSetup)
Definition: GEMDQMBase.cc:27
std::tuple< Int_t, Int_t, Int_t, Int_t > ME4IdsKey
int readGeometryRadiusInfoChamber(const GEMStation *station, MEStationInfo &stationInfo)
Definition: GEMDQMBase.cc:246
static const int maxVFatGE0_
Definition: GEMeMap.h:66
BookingHelper(DQMStore::IBooker &ibooker, const TString &name_suffix, const TString &title_suffix)
Definition: GEMDQMBase.h:34
Bool_t bIsNoUnderOverflowBin_
Definition: GEMDQMBase.h:463
constexpr uint32_t bits
Definition: gpuClustering.h:25
MEMapInfT(GEMDQMBase *pDQMBase, TString strName, TString strTitle, Int_t nBinsX, Double_t dXL, Double_t dXH, Int_t nBinsY, Double_t dYL, Double_t dYH, TString strTitleX="", TString strTitleY="")
Definition: GEMDQMBase.h:159
static const int maxiEtaIdGE0_
Definition: GEMeMap.h:69
int getNumModule(const int)
Definition: GEMDQMBase.h:649
const TString name_suffix_
Definition: GEMDQMBase.h:98
int SetLabelForVFATs(K key, Int_t nNumEtaPartitions, Int_t nAxis, Int_t nNumBin=-1)
Definition: GEMDQMBase.h:365
void SetBinHighEdgeZ(Double_t dZH)
Definition: GEMDQMBase.h:279
std::map< ME3IdsKey, MEStationInfo > mapStationInfo_
Definition: GEMDQMBase.h:624
int keyToRegion(ME2IdsKey key)
Definition: GEMDQMBase.h:566
int readGeometryPhiInfoChamber(const GEMStation *station, MEStationInfo &stationInfo)
Definition: GEMDQMBase.cc:307
int loadChambers()
Definition: GEMDQMBase.cc:56
Double_t GetBinLowEdgeX()
Definition: GEMDQMBase.h:263
void SetBinHighEdgeX(Double_t dXH)
Definition: GEMDQMBase.h:266
std::map< ME3IdsKey, int > mapStationToIdx_
Definition: GEMDQMBase.h:623
MEMapInfT(GEMDQMBase *pDQMBase, TString strName, TString strTitle, TString strTitleX="", TString strTitleY="Entries")
Definition: GEMDQMBase.h:107
static const int maxChan_
Definition: GEMeMap.h:72
int keyToLayer(ME3IdsKey key)
Definition: GEMDQMBase.h:572
Log< level::Error, false > LogError
std::vector< Float_t > listRadiusOddChamber_
Definition: GEMDQMBase.h:532
int keyToStation(ME3IdsKey key)
Definition: GEMDQMBase.h:570
int Fill(K key, Double_t x)
Definition: GEMDQMBase.h:401
std::string log_category_
Definition: GEMDQMBase.h:552
void SetTitleX(TString strTitleX)
Definition: GEMDQMBase.h:257
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
std::map< ME3IdsKey, bool > MEMap2AbsReWithEtaCheck_
Definition: GEMDQMBase.h:617
std::map< ME2IdsKey, bool > MEMap2Check_
Definition: GEMDQMBase.h:615
virtual int ProcessWithMEMap3(BookingHelper &bh, ME3IdsKey key)
Definition: GEMDQMBase.h:562
Double_t GetBinLowEdgeY()
Definition: GEMDQMBase.h:271
std::string log_category_own_
Definition: GEMDQMBase.h:476
Double_t GetBinHighEdgeZ()
Definition: GEMDQMBase.h:278
void SetBinLowEdgeX(Double_t dXL)
Definition: GEMDQMBase.h:264
int GenerateMEPerChamber(DQMStore::IBooker &ibooker)
Definition: GEMDQMBase.cc:180
std::vector< Float_t > listRadiusEvenChamber_
Definition: GEMDQMBase.h:531
std::map< ME3IdsKey, bool > MEMap3Check_
Definition: GEMDQMBase.h:618
int keyToRegion(ME3IdsKey key)
Definition: GEMDQMBase.h:567
int getIEtaFromVFATGE11(const int vfat)
Definition: GEMDQMBase.h:700
DQMStore::IBooker * ibooker_
Definition: GEMDQMBase.h:97
Float_t restrictAngle(const Float_t fTheta, const Float_t fStart)
Definition: GEMDQMBase.h:712
MEMapInfT(GEMDQMBase *pDQMBase, TString strName, TString strTitle, std::vector< Double_t > &x_binning, TString strTitleX="", TString strTitleY="Entries")
Definition: GEMDQMBase.h:138
int keyToRegion(ME4IdsKey key)
Definition: GEMDQMBase.h:568
int getNumEtaPartitions(const GEMStation *)
Definition: GEMDQMBase.cc:40
static const int maxiEtaIdGE21_
Definition: GEMeMap.h:71
virtual int ProcessWithMEMap3WithChamber(BookingHelper &bh, ME4IdsKey key)
Definition: GEMDQMBase.h:564
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomToken_
Definition: GEMDQMBase.h:610
void SetBinHighEdgeY(Double_t dYH)
Definition: GEMDQMBase.h:274
MEMapInfT< MEMap2Ids, ME2IdsKey > MEMap2Inf
Definition: GEMDQMBase.h:479
void SetNbinsY(Int_t nBinsY)
Definition: GEMDQMBase.h:270
std::vector< double > x_binning_
Definition: GEMDQMBase.h:465
int getMaxVFAT(const int)
Definition: GEMDQMBase.h:638
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)
int keyToStation(ME2IdsKey key)
Definition: GEMDQMBase.h:569
void SetTitle(TString strTitle)
Definition: GEMDQMBase.h:255
std::map< ME4IdsKey, bool > MEMap4Check_
Definition: GEMDQMBase.h:620
int keyToStation(ME4IdsKey key)
Definition: GEMDQMBase.h:571
#define M_PI
MEMapInfT(GEMDQMBase *pDQMBase, TString strName, TString strTitle, Int_t nBinsX, Double_t dXL, Double_t dXH, TString strTitleX="", TString strTitleY="Entries")
Definition: GEMDQMBase.h:116
Double_t GetBinHighEdgeX()
Definition: GEMDQMBase.h:265
MEStationInfo(Int_t nRegion, 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)
Definition: GEMDQMBase.h:486
void SetOperating(Bool_t bOperating)
Definition: GEMDQMBase.h:244
const GEMGeometry * GEMGeometry_
Definition: GEMDQMBase.h:609
int keyToIEta(ME4IdsKey key)
Definition: GEMDQMBase.h:576
bool operator==(const MEStationInfo &other) const
Definition: GEMDQMBase.h:510
void SetNoUnderOverflowBin()
Definition: GEMDQMBase.h:247
MonitorElement * book1D(TString name, TString title, std::vector< double > &x_binning, TString x_title="", TString y_title="Entries")
Definition: GEMDQMBase.h:51
int SetLabelForIEta(K key, Int_t nAxis, Int_t nNumBin=-1)
Definition: GEMDQMBase.h:363
void SetTitleY(TString strTitleY)
Definition: GEMDQMBase.h:259
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
int getDetOccXBin(const int, const int, const int)
Definition: GEMDQMBase.h:708
virtual int ProcessWithMEMap2WithEta(BookingHelper &bh, ME3IdsKey key)
Definition: GEMDQMBase.h:560
DQMStore::IBooker * getBooker()
Definition: GEMDQMBase.h:94
const TString title_suffix_
Definition: GEMDQMBase.h:99
int keyToChamber(ME4IdsKey key)
Definition: GEMDQMBase.h:574
int getIEtaFromVFAT(const int station, const int vfat)
Definition: GEMDQMBase.h:686
Double_t GetBinHighEdgeY()
Definition: GEMDQMBase.h:273
int SortingLayers(std::vector< ME3IdsKey > &listLayers)
Definition: GEMDQMBase.cc:129
int Fill(K key, Double_t x, Double_t y, Double_t w=1.0)
Definition: GEMDQMBase.h:417
std::string getNameDirLayer(ME3IdsKey key3)
Definition: GEMDQMBase.h:718
GEMDQMBase(const edm::ParameterSet &cfg)
Definition: GEMDQMBase.cc:7
std::map< ME3IdsKey, bool > MEMap2WithEtaCheck_
Definition: GEMDQMBase.h:616
int bookND(BookingHelper &bh, K key)
Definition: GEMDQMBase.h:307
ME3IdsKey key4Tokey3(ME4IdsKey key)
Definition: GEMDQMBase.h:583
std::map< GEMDetId, std::vector< const GEMEtaPartition * > > mapEtaPartition_
Definition: GEMDQMBase.h:613
MonitorElement * bookProfile2D(TString name, TString title, int nbinsx, double xlow, double xup, int nbinsy, double ylow, double yup, double zlow, double zup, TString x_title="", TString y_title="")
Definition: GEMDQMBase.h:77
MonitorElement * book1D(TString name, TString title, int nbinsx, double xlow, double xup, TString x_title="", TString y_title="Entries")
Definition: GEMDQMBase.h:39
static const int maxiEtaIdGE11_
Definition: GEMeMap.h:70
int nMaxNumCh_
Definition: GEMDQMBase.h:622
void SetNbinsX(Int_t nBinsX)
Definition: GEMDQMBase.h:262
static const int maxVFatGE21_
Definition: GEMeMap.h:68
int getVFATNumberGE11(const int, const int, const int)
Definition: GEMDQMBase.h:677
std::tuple< Int_t, Int_t > ME2IdsKey
std::tuple< Int_t, Int_t, Int_t > ME3IdsKey
void SetBinConfX(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
Definition: GEMDQMBase.h:281
void SetProfile(Bool_t bIsProfile)
Definition: GEMDQMBase.h:250
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
int keyToLayer(ME4IdsKey key)
Definition: GEMDQMBase.h:573
MonitorElement * book2D(TString name, TString title, int nbinsx, double xlow, double xup, int nbinsy, double ylow, double yup, TString x_title="", TString y_title="")
Definition: GEMDQMBase.h:62
int FillBits(K key, Double_t x, UInt_t bits, Double_t w=1.0)
Definition: GEMDQMBase.h:437
std::map< ME4IdsKey, bool > MEMap3WithChCheck_
Definition: GEMDQMBase.h:619
Double_t GetBinLowEdgeZ()
Definition: GEMDQMBase.h:276
void SetBinConfY(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
Definition: GEMDQMBase.h:289
int keyToIEta(ME3IdsKey key)
Definition: GEMDQMBase.h:575
dqm::impl::MonitorElement * FindHist(K key)
Definition: GEMDQMBase.h:328
static const int maxVFatGE11_
Definition: GEMeMap.h:67
int SetLabelForChambers(K key, Int_t nAxis, Int_t nNumBin=-1, Int_t nIdxStart=1, Int_t nNumModules=1)
Definition: GEMDQMBase.h:337
MEMapInfT(GEMDQMBase *pDQMBase, TString strName, TString strTitle, Int_t nBinsX, Double_t dXL, Double_t dXH, Int_t nBinsY, Double_t dYL, Double_t dYH, Double_t dZL, Double_t dZH, TString strTitleX="", TString strTitleY="")
Definition: GEMDQMBase.h:188
void SetBinLowEdgeY(Double_t dYL)
Definition: GEMDQMBase.h:272
virtual int ProcessWithMEMap2(BookingHelper &bh, ME2IdsKey key)
Definition: GEMDQMBase.h:559
GEMDQMBase * pDQMBase_
Definition: GEMDQMBase.h:454