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) {
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  histCurr->setBinLabel(i, Form("%i", nIdxStart + i - 1), nAxis);
353  }
354  return 0;
355  };
356 
357  int SetLabelForIEta(K key, Int_t nAxis, Int_t nNumBin = -1) { return SetLabelForChambers(key, nAxis, nNumBin); };
358 
359  int SetLabelForVFATs(K key, Int_t nNumEtaPartitions, Int_t nAxis, Int_t nNumBin = -1) {
360  if (!bOperating_)
361  return 0;
362  if (nNumBin <= 0) {
363  if (nAxis == 1)
364  nNumBin = nBinsX_;
365  else if (nAxis == 2)
366  nNumBin = nBinsY_;
367  else
368  return -1;
369  }
371  if (histCurr == nullptr)
372  return -999;
373  if (std::get<1>(key) == 2) {
374  Int_t nNumVFATPerModule = 12; // FIXME: A better way to get this?
375  if (nNumBin > nNumVFATPerModule) {
376  for (Int_t i = 0; i < nNumBin; i++) {
377  Int_t nIModule = i / nNumVFATPerModule + 1;
378  histCurr->setBinLabel(
379  i + 1, Form((nAxis == 1 ? "#splitline{%i}{M%i}" : "%i (M%i)"), i % nNumVFATPerModule, nIModule), nAxis);
380  }
381  } else {
382  for (Int_t i = 0; i < nNumBin; i++) {
383  histCurr->setBinLabel(i + 1, Form("%i", i), nAxis);
384  }
385  }
386  } else {
387  for (Int_t i = 0; i < nNumBin; i++) {
388  Int_t nIEta = pDQMBase_->getIEtaFromVFAT(std::get<1>(key), i);
389  histCurr->setBinLabel(i + 1, Form("%i (%i)", i, nIEta), nAxis);
390  }
391  }
392  return 0;
393  };
394 
395  int Fill(K key, Double_t x) {
396  if (!bOperating_)
397  return 0;
399  if (hist == nullptr)
400  return -999;
402  if (x <= dXL_)
403  x = dXU_;
404  else if (x >= dXH_)
405  x = dXO_;
406  }
407  hist->Fill(x);
408  return 1;
409  };
410 
411  int Fill(K key, Double_t x, Double_t y, Double_t w = 1.0) {
412  if (!bOperating_)
413  return 0;
415  if (hist == nullptr)
416  return -999;
418  if (x <= dXL_)
419  x = dXU_;
420  else if (x >= dXH_)
421  x = dXO_;
422  if (y <= dYL_)
423  y = dYU_;
424  else if (y >= dYH_)
425  y = dYO_;
426  }
427  hist->Fill(x, y, w);
428  return 1;
429  };
430 
431  int FillBits(K key, Double_t x, UInt_t bits, Double_t w = 1.0) {
432  if (!bOperating_)
433  return 0;
435  if (hist == nullptr)
436  return -999;
437 
438  if (nBinsY_ <= 0)
439  return -888;
440  UInt_t unMask = 0x1;
441  for (Int_t i = 1; i <= nBinsY_; i++) {
442  if ((unMask & bits) != 0)
443  hist->Fill(x, i, w);
444  unMask <<= 1;
445  }
446 
447  return 1;
448  };
449 
450  private:
452 
455  Bool_t bOperating_;
456  Bool_t bIsProfile_;
458 
459  std::vector<double> x_binning_;
460  Int_t nBinsX_;
461  Double_t dXL_, dXH_;
462  Int_t nBinsY_;
463  Double_t dYL_, dYH_;
464  Int_t nBinsZ_;
465  Double_t dZL_, dZH_;
466  Double_t dXU_, dXO_;
467  Double_t dYU_, dYO_;
468  Double_t dZU_, dZO_;
469 
471  };
472 
477 
479  public:
481  MEStationInfo(Int_t nRegion,
482  Int_t nStation,
483  Int_t nLayer,
484  Int_t nNumChambers,
485  Int_t nNumModules,
486  Int_t nNumEtaPartitions,
487  Int_t nMaxVFAT,
488  Int_t nFirstStrip,
489  Int_t nNumDigi,
490  Int_t nMinIdxChamber,
491  Int_t nMaxIdxChamber)
492  : nRegion_(nRegion),
493  nStation_(nStation),
494  nLayer_(nLayer),
495  nNumChambers_(nNumChambers),
496  nNumModules_(nNumModules),
497  nNumEtaPartitions_(nNumEtaPartitions),
498  nMaxVFAT_(nMaxVFAT),
499  nFirstStrip_(nFirstStrip),
500  nNumDigi_(nNumDigi),
501  nMinIdxChamber_(nMinIdxChamber),
502  nMaxIdxChamber_(nMaxIdxChamber),
503  fMinPhi_(0){};
504 
505  bool operator==(const MEStationInfo &other) const {
506  return (nRegion_ == other.nRegion_ && nStation_ == other.nStation_ && nLayer_ == other.nLayer_ &&
507  nNumChambers_ == other.nNumChambers_ && nNumModules_ == other.nNumModules_ &&
508  nNumEtaPartitions_ == other.nNumEtaPartitions_ && nMaxVFAT_ == other.nMaxVFAT_ &&
509  nFirstStrip_ == other.nFirstStrip_ && nNumDigi_ == other.nNumDigi_);
510  };
511 
512  Int_t nRegion_; // the region index
513  Int_t nStation_; // the station index
514  Int_t nLayer_; // the layer
515  Int_t nNumChambers_; // the number of chambers in the current station
516  Int_t nNumModules_; // the number of modules in each chamber
517  Int_t nNumEtaPartitions_; // the number of eta partitions of the chambers
518  Int_t nMaxVFAT_; // the number of all VFATs in each chamber (= # of VFATs in eta partition * nNumEtaPartitions_)
519  Int_t nFirstStrip_; // the index of the first strip
520  Int_t nNumDigi_; // the number of digis of each VFAT
521 
524  Float_t fMinPhi_;
525 
526  std::vector<Float_t> listRadiusEvenChamber_;
527  std::vector<Float_t> listRadiusOddChamber_;
528  };
529 
532 
533 public:
534  explicit GEMDQMBase(const edm::ParameterSet &cfg);
535  ~GEMDQMBase() override{};
536 
537  enum {
543  };
544 
545  Int_t nRunType_;
546 
548 
549 protected:
550  int initGeometry(edm::EventSetup const &iSetup);
551  int loadChambers();
552 
554  virtual int ProcessWithMEMap2(BookingHelper &bh, ME2IdsKey key) { return 0; }; // must be overrided
555  virtual int ProcessWithMEMap2WithEta(BookingHelper &bh, ME3IdsKey key) { return 0; }; // must be overrided
556  virtual int ProcessWithMEMap2AbsReWithEta(BookingHelper &bh, ME3IdsKey key) { return 0; }; // must be overrided
557  virtual int ProcessWithMEMap3(BookingHelper &bh, ME3IdsKey key) { return 0; }; // must be overrided
558  virtual int ProcessWithMEMap4(BookingHelper &bh, ME4IdsKey key) { return 0; }; // must be overrided
559  virtual int ProcessWithMEMap5(BookingHelper &bh, ME5IdsKey key) { return 0; }; // must be overrided
560  virtual int ProcessWithMEMap4WithChamber(BookingHelper &bh, ME4IdsKey key) { return 0; }; // must be overrided
561  virtual int ProcessWithMEMap5WithChamber(BookingHelper &bh, ME5IdsKey key) { return 0; }; // must be overrided
562 
563  int keyToRegion(ME2IdsKey key) { return std::get<0>(key); };
564  int keyToRegion(ME3IdsKey key) { return std::get<0>(key); };
565  int keyToRegion(ME4IdsKey key) { return std::get<0>(key); };
566  int keyToRegion(ME5IdsKey key) { return std::get<0>(key); };
567  int keyToStation(ME2IdsKey key) { return std::get<1>(key); };
568  int keyToStation(ME3IdsKey key) { return std::get<1>(key); };
569  int keyToStation(ME4IdsKey key) { return std::get<1>(key); };
570  int keyToStation(ME5IdsKey key) { return std::get<1>(key); };
571  int keyToLayer(ME3IdsKey key) { return std::get<2>(key); };
572  int keyToLayer(ME4IdsKey key) { return std::get<2>(key); };
573  int keyToLayer(ME5IdsKey key) { return std::get<2>(key); };
574  int keyToModule(ME4IdsKey key) { return std::get<3>(key); };
575  int keyToModule(ME5IdsKey key) { return std::get<3>(key); };
576  int keyToChamber(ME4IdsKey key) { return std::get<3>(key); };
577  int keyToChamber(ME5IdsKey key) { return std::get<4>(key); };
578  int keyToIEta(ME4IdsKey key) { return std::get<3>(key); };
579  int keyToIEta(ME5IdsKey key) { return std::get<4>(key); };
580 
582  auto keyNew = ME2IdsKey{keyToRegion(key), keyToStation(key)};
583  return keyNew;
584  };
585 
587  auto keyNew = ME3IdsKey{keyToRegion(key), keyToStation(key), keyToLayer(key)};
588  return keyNew;
589  };
590 
593  return keyNew;
594  };
595 
596  int SortingLayers(std::vector<ME4IdsKey> &listLayers);
598 
599  template <typename T>
600  inline bool checkRefs(const std::vector<T *> &);
601 
602  int getNumEtaPartitions(const GEMStation *);
603  inline int getVFATNumber(const int, const int, const int);
604  inline int getVFATNumberGE11(const int, const int, const int);
605  inline int getVFATNumberByDigi(const int, const int, const int);
606  inline int getIEtaFromVFAT(const int station, const int vfat);
607  inline int getIEtaFromVFATGE0(const int vfat);
608  inline int getIEtaFromVFATGE11(const int vfat);
609  inline int getIEtaFromVFATGE21(const int vfat);
610  inline int getMaxVFAT(const int);
611  inline int getNumModule(const int);
612  inline int getIdxModule(const int, const int);
613  inline int getDetOccXBin(const int, const int, const int);
614  inline Float_t restrictAngle(const Float_t fTheta, const Float_t fStart);
617 
620 
621  std::vector<GEMDetId> listChamberId_;
622  std::map<GEMDetId, std::vector<const GEMEtaPartition *>> mapEtaPartition_;
623 
624  std::map<ME2IdsKey, bool> MEMap2Check_;
625  std::map<ME3IdsKey, bool> MEMap2WithEtaCheck_;
626  std::map<ME3IdsKey, bool> MEMap2AbsReWithEtaCheck_;
627  std::map<ME3IdsKey, bool> MEMap3Check_;
628  std::map<ME4IdsKey, bool> MEMap4Check_;
629  std::map<ME4IdsKey, bool> MEMap4WithChCheck_;
630  std::map<ME5IdsKey, bool> MEMap5WithChCheck_;
631  std::map<ME5IdsKey, bool> MEMap5Check_;
632 
634  std::map<ME3IdsKey, MEStationInfo> mapStationInfo_;
635  std::map<ME4IdsKey, int> mapStationToIdx_;
636 };
637 
638 // Borrwed from DQM/GEM/interface/GEMOfflineDQMBase.h
639 template <typename T>
640 inline bool GEMDQMBase::checkRefs(const std::vector<T *> &refs) {
641  if (refs.empty())
642  return false;
643  if (refs.front() == nullptr)
644  return false;
645  return true;
646 }
647 
648 // The 'get...' functions in the below are borrwed from DQM/GEM/interface/GEMOfflineDQMBase.h
649 inline int GEMDQMBase::getMaxVFAT(const int station) {
650  if (station == 0)
651  return GEMeMap::maxVFatGE0_;
652  if (station == 1)
653  return GEMeMap::maxVFatGE11_;
654  else if (station == 2)
655  return GEMeMap::maxVFatGE21_ / 2;
656  else
657  return -1;
658 }
659 
660 inline int GEMDQMBase::getNumModule(const int station) {
661  if (station == 0)
662  return 1;
663  if (station == 1)
664  return 1;
665  else if (station == 2)
666  return 4;
667  else
668  return -1;
669 }
670 
671 inline int GEMDQMBase::getIdxModule(const int station, const int chamberType) {
672  if (station == 0)
673  return 1;
674  if (station == 1)
675  return 1;
676  else if (station == 2)
677  return chamberType - 20;
678  else
679  return -1;
680 }
681 
682 inline int GEMDQMBase::getVFATNumber(const int station, const int ieta, const int vfat_phi) {
683  if (station == 1)
684  return getVFATNumberGE11(station, ieta, vfat_phi);
685  return getVFATNumberGE11(station, ieta, vfat_phi); // FIXME: What about GE21 and GE0?
686 }
687 
688 inline int GEMDQMBase::getVFATNumberGE11(const int station, const int ieta, const int vfat_phi) {
689  return vfat_phi * GEMeMap::maxiEtaIdGE11_ + (GEMeMap::maxiEtaIdGE11_ - ieta);
690 }
691 
692 inline int GEMDQMBase::getVFATNumberByDigi(const int station, const int ieta, const int digi) {
693  const int vfat_phi = digi / GEMeMap::maxChan_;
694  return getVFATNumber(station, ieta, vfat_phi);
695 }
696 
697 inline int GEMDQMBase::getIEtaFromVFAT(const int station, const int vfat) {
698  if (station == 0)
699  return getIEtaFromVFATGE0(vfat);
700  if (station == 1)
701  return getIEtaFromVFATGE11(vfat);
702  if (station == 2)
703  return getIEtaFromVFATGE21(vfat);
704  return getIEtaFromVFATGE11(vfat); // FIXME: What about GE21 and GE0?
705 }
706 
707 inline int GEMDQMBase::getIEtaFromVFATGE0(const int vfat) {
709 }
710 
711 inline int GEMDQMBase::getIEtaFromVFATGE11(const int vfat) {
713 }
714 
715 inline int GEMDQMBase::getIEtaFromVFATGE21(const int vfat) {
717 }
718 
719 inline int GEMDQMBase::getDetOccXBin(const int chamber, const int layer, const int n_chambers) {
720  return n_chambers * (chamber - 1) + layer;
721 }
722 
723 inline Float_t GEMDQMBase::restrictAngle(const Float_t fTheta, const Float_t fStart) {
724  Float_t fLoop = (fTheta - fStart) / (2 * M_PI);
725  int nLoop = (fLoop >= 0 ? (int)fLoop : (int)fLoop - 1);
726  return fTheta - nLoop * 2 * M_PI;
727 }
728 
730  auto nStation = keyToStation(key3);
731  char cRegion = (keyToRegion(key3) > 0 ? 'P' : 'M');
732  auto nLayer = keyToLayer(key3);
733  return std::string(Form("GE%i1-%c-L%i", nStation, cRegion, nLayer));
734 }
735 
737  auto nStation = keyToStation(key4);
738  char cRegion = (keyToRegion(key4) > 0 ? 'P' : 'M');
739  auto nLayer = keyToLayer(key4);
740  if (nStation == 2) {
741  auto nModule = keyToModule(key4);
742  return std::string(Form("GE%i1-%c-L%i-M%i", nStation, cRegion, nLayer, nModule));
743  }
744  return std::string(Form("GE%i1-%c-L%i", nStation, cRegion, nLayer));
745 }
746 
747 #endif // DQM_GEM_INTERFACE_GEMDQMBase_h
std::map< ME5IdsKey, bool > MEMap5WithChCheck_
Definition: GEMDQMBase.h:630
void SetName(TString strName)
Definition: GEMDQMBase.h:253
int keyToModule(ME4IdsKey key)
Definition: GEMDQMBase.h:574
ME2IdsKey key3Tokey2(ME3IdsKey key)
Definition: GEMDQMBase.h:581
bool checkRefs(const std::vector< T *> &)
Definition: GEMDQMBase.h:640
MEMapInfT< MEMap4Ids, ME4IdsKey > MEMap4Inf
Definition: GEMDQMBase.h:475
void SetBinLowEdgeZ(Double_t dZL)
Definition: GEMDQMBase.h:277
dqm::impl::MonitorElement * CreateSummaryHist(DQMStore::IBooker &ibooker, TString strName)
Definition: GEMDQMBase.cc:150
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:545
int getIdxModule(const int, const int)
Definition: GEMDQMBase.h:671
~GEMDQMBase() override
Definition: GEMDQMBase.h:535
virtual int ProcessWithMEMap4(BookingHelper &bh, ME4IdsKey key)
Definition: GEMDQMBase.h:558
int getIEtaFromVFATGE0(const int vfat)
Definition: GEMDQMBase.h:707
std::tuple< Int_t, Int_t, Int_t, Int_t, Int_t > ME5IdsKey
int keyToIEta(ME5IdsKey key)
Definition: GEMDQMBase.h:579
std::vector< GEMDetId > listChamberId_
Definition: GEMDQMBase.h:621
virtual int ProcessWithMEMap2AbsReWithEta(BookingHelper &bh, ME3IdsKey key)
Definition: GEMDQMBase.h:556
int getVFATNumber(const int, const int, const int)
Definition: GEMDQMBase.h:682
T w() const
int SetLabelForChambers(K key, Int_t nAxis, Int_t nNumBin=-1, Int_t nIdxStart=1)
Definition: GEMDQMBase.h:337
int getVFATNumberByDigi(const int, const int, const int)
Definition: GEMDQMBase.h:692
MEMapInfT< MEMap3Ids, ME3IdsKey > MEMap3Inf
Definition: GEMDQMBase.h:474
int getIEtaFromVFATGE21(const int vfat)
Definition: GEMDQMBase.h:715
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:293
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:457
virtual int ProcessWithMEMap5WithChamber(BookingHelper &bh, ME5IdsKey key)
Definition: GEMDQMBase.h:561
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:660
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:359
void SetBinHighEdgeZ(Double_t dZH)
Definition: GEMDQMBase.h:279
std::map< ME3IdsKey, MEStationInfo > mapStationInfo_
Definition: GEMDQMBase.h:634
int keyToRegion(ME2IdsKey key)
Definition: GEMDQMBase.h:563
int readGeometryPhiInfoChamber(const GEMStation *station, MEStationInfo &stationInfo)
Definition: GEMDQMBase.cc:354
int loadChambers()
Definition: GEMDQMBase.cc:56
Double_t GetBinLowEdgeX()
Definition: GEMDQMBase.h:263
void SetBinHighEdgeX(Double_t dXH)
Definition: GEMDQMBase.h:266
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:571
Log< level::Error, false > LogError
std::vector< Float_t > listRadiusOddChamber_
Definition: GEMDQMBase.h:527
int keyToStation(ME3IdsKey key)
Definition: GEMDQMBase.h:568
int Fill(K key, Double_t x)
Definition: GEMDQMBase.h:395
std::string log_category_
Definition: GEMDQMBase.h:547
void SetTitleX(TString strTitleX)
Definition: GEMDQMBase.h:257
int keyToRegion(ME5IdsKey key)
Definition: GEMDQMBase.h:566
int SortingLayers(std::vector< ME4IdsKey > &listLayers)
Definition: GEMDQMBase.cc:129
std::map< ME3IdsKey, bool > MEMap2AbsReWithEtaCheck_
Definition: GEMDQMBase.h:626
std::map< ME2IdsKey, bool > MEMap2Check_
Definition: GEMDQMBase.h:624
virtual int ProcessWithMEMap3(BookingHelper &bh, ME3IdsKey key)
Definition: GEMDQMBase.h:557
Double_t GetBinLowEdgeY()
Definition: GEMDQMBase.h:271
std::string log_category_own_
Definition: GEMDQMBase.h:470
Double_t GetBinHighEdgeZ()
Definition: GEMDQMBase.h:278
void SetBinLowEdgeX(Double_t dXL)
Definition: GEMDQMBase.h:264
int keyToStation(ME5IdsKey key)
Definition: GEMDQMBase.h:570
int GenerateMEPerChamber(DQMStore::IBooker &ibooker)
Definition: GEMDQMBase.cc:195
std::vector< Float_t > listRadiusEvenChamber_
Definition: GEMDQMBase.h:526
std::map< ME3IdsKey, bool > MEMap3Check_
Definition: GEMDQMBase.h:627
int keyToRegion(ME3IdsKey key)
Definition: GEMDQMBase.h:564
int getIEtaFromVFATGE11(const int vfat)
Definition: GEMDQMBase.h:711
DQMStore::IBooker * ibooker_
Definition: GEMDQMBase.h:97
Float_t restrictAngle(const Float_t fTheta, const Float_t fStart)
Definition: GEMDQMBase.h:723
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:565
int getNumEtaPartitions(const GEMStation *)
Definition: GEMDQMBase.cc:40
static const int maxiEtaIdGE21_
Definition: GEMeMap.h:71
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomToken_
Definition: GEMDQMBase.h:619
virtual int ProcessWithMEMap5(BookingHelper &bh, ME5IdsKey key)
Definition: GEMDQMBase.h:559
std::map< ME5IdsKey, bool > MEMap5Check_
Definition: GEMDQMBase.h:631
void SetBinHighEdgeY(Double_t dYH)
Definition: GEMDQMBase.h:274
key
prepare the HTCondor submission files and eventually submit them
MEMapInfT< MEMap2Ids, ME2IdsKey > MEMap2Inf
Definition: GEMDQMBase.h:473
void SetNbinsY(Int_t nBinsY)
Definition: GEMDQMBase.h:270
std::vector< double > x_binning_
Definition: GEMDQMBase.h:459
int getMaxVFAT(const int)
Definition: GEMDQMBase.h:649
std::map< ME4IdsKey, int > mapStationToIdx_
Definition: GEMDQMBase.h:635
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:567
void SetTitle(TString strTitle)
Definition: GEMDQMBase.h:255
std::map< ME4IdsKey, bool > MEMap4Check_
Definition: GEMDQMBase.h:628
int keyToStation(ME4IdsKey key)
Definition: GEMDQMBase.h:569
virtual int ProcessWithMEMap4WithChamber(BookingHelper &bh, ME4IdsKey key)
Definition: GEMDQMBase.h:560
#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:481
int keyToModule(ME5IdsKey key)
Definition: GEMDQMBase.h:575
void SetOperating(Bool_t bOperating)
Definition: GEMDQMBase.h:244
int keyToChamber(ME5IdsKey key)
Definition: GEMDQMBase.h:577
const GEMGeometry * GEMGeometry_
Definition: GEMDQMBase.h:618
int keyToIEta(ME4IdsKey key)
Definition: GEMDQMBase.h:578
bool operator==(const MEStationInfo &other) const
Definition: GEMDQMBase.h:505
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:357
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
std::map< ME4IdsKey, bool > MEMap4WithChCheck_
Definition: GEMDQMBase.h:629
int getDetOccXBin(const int, const int, const int)
Definition: GEMDQMBase.h:719
virtual int ProcessWithMEMap2WithEta(BookingHelper &bh, ME3IdsKey key)
Definition: GEMDQMBase.h:555
DQMStore::IBooker * getBooker()
Definition: GEMDQMBase.h:94
const TString title_suffix_
Definition: GEMDQMBase.h:99
int keyToChamber(ME4IdsKey key)
Definition: GEMDQMBase.h:576
int getIEtaFromVFAT(const int station, const int vfat)
Definition: GEMDQMBase.h:697
Double_t GetBinHighEdgeY()
Definition: GEMDQMBase.h:273
int Fill(K key, Double_t x, Double_t y, Double_t w=1.0)
Definition: GEMDQMBase.h:411
std::string getNameDirLayer(ME3IdsKey key3)
Definition: GEMDQMBase.h:729
GEMDQMBase(const edm::ParameterSet &cfg)
Definition: GEMDQMBase.cc:7
std::map< ME3IdsKey, bool > MEMap2WithEtaCheck_
Definition: GEMDQMBase.h:625
int bookND(BookingHelper &bh, K key)
Definition: GEMDQMBase.h:307
ME3IdsKey key4Tokey3(ME4IdsKey key)
Definition: GEMDQMBase.h:586
std::map< GEMDetId, std::vector< const GEMEtaPartition * > > mapEtaPartition_
Definition: GEMDQMBase.h:622
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
MEMapInfT< MEMap5Ids, ME5IdsKey > MEMap5Inf
Definition: GEMDQMBase.h:476
int nMaxNumCh_
Definition: GEMDQMBase.h:633
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:688
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:572
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:431
int keyToLayer(ME5IdsKey key)
Definition: GEMDQMBase.h:573
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
dqm::impl::MonitorElement * FindHist(K key)
Definition: GEMDQMBase.h:328
static const int maxVFatGE11_
Definition: GEMeMap.h:67
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
ME4IdsKey key5Tokey4(ME5IdsKey key)
Definition: GEMDQMBase.h:591
void SetBinLowEdgeY(Double_t dYL)
Definition: GEMDQMBase.h:272
virtual int ProcessWithMEMap2(BookingHelper &bh, ME2IdsKey key)
Definition: GEMDQMBase.h:554
GEMDQMBase * pDQMBase_
Definition: GEMDQMBase.h:448