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  /********************/
561  virtual int ProcessWithMEMap2WithChamber(BookingHelper &bh, ME3IdsKey key) { return 0; };
562  /*********************/
563  /********************/
564  virtual int ProcessWithMEMap2WithEtaCh(BookingHelper &bh, ME4IdsKey key) { return 0; };
565  /*********************/
566 
567  virtual int ProcessWithMEMap4WithChamber(BookingHelper &bh, ME4IdsKey key) { return 0; }; // must be overrided
568  virtual int ProcessWithMEMap5WithChamber(BookingHelper &bh, ME5IdsKey key) { return 0; }; // must be overrided
569 
570  int keyToRegion(ME2IdsKey key) { return std::get<0>(key); };
571  int keyToRegion(ME3IdsKey key) { return std::get<0>(key); };
572  int keyToRegion(ME4IdsKey key) { return std::get<0>(key); };
573  int keyToRegion(ME5IdsKey key) { return std::get<0>(key); };
574  int keyToStation(ME2IdsKey key) { return std::get<1>(key); };
575  int keyToStation(ME3IdsKey key) { return std::get<1>(key); };
576  int keyToStation(ME4IdsKey key) { return std::get<1>(key); };
577  int keyToStation(ME5IdsKey key) { return std::get<1>(key); };
578  int keyToLayer(ME3IdsKey key) { return std::get<2>(key); };
579  int keyToLayer(ME4IdsKey key) { return std::get<2>(key); };
580  int keyToLayer(ME5IdsKey key) { return std::get<2>(key); };
581  int keyToModule(ME4IdsKey key) { return std::get<3>(key); };
582  int keyToModule(ME5IdsKey key) { return std::get<3>(key); };
583  int keyToChamber(ME4IdsKey key) { return std::get<3>(key); };
584  int keyToChamber(ME5IdsKey key) { return std::get<4>(key); };
585  /**********/
586  int keyToChamber(ME3IdsKey key) { return std::get<2>(key); };
587  /*************/
588  int keyToIEta(ME4IdsKey key) { return std::get<3>(key); };
589  int keyToIEta(ME5IdsKey key) { return std::get<4>(key); };
590 
592  auto keyNew = ME2IdsKey{keyToRegion(key), keyToStation(key)};
593  return keyNew;
594  };
595 
597  auto keyNew = ME3IdsKey{keyToRegion(key), keyToStation(key), keyToLayer(key)};
598  return keyNew;
599  };
600 
603  return keyNew;
604  };
605 
606  int SortingLayers(std::vector<ME4IdsKey> &listLayers);
608 
609  template <typename T>
610  inline bool checkRefs(const std::vector<T *> &);
611 
612  int getNumEtaPartitions(const GEMStation *);
613  inline int getVFATNumber(const int, const int, const int);
614  inline int getVFATNumberGE11(const int, const int, const int);
615  inline int getVFATNumberByDigi(const int, const int, const int);
616  inline int getIEtaFromVFAT(const int station, const int vfat);
617  inline int getIEtaFromVFATGE0(const int vfat);
618  inline int getIEtaFromVFATGE11(const int vfat);
619  inline int getIEtaFromVFATGE21(const int vfat);
620  inline int getMaxVFAT(const int);
621  inline int getNumModule(const int);
622  inline int getIdxModule(const int, const int);
623  inline int getDetOccXBin(const int, const int, const int);
624  inline Float_t restrictAngle(const Float_t fTheta, const Float_t fStart);
628 
631 
632  std::vector<GEMDetId> listChamberId_;
633  std::map<GEMDetId, std::vector<const GEMEtaPartition *>> mapEtaPartition_;
634 
635  std::map<ME2IdsKey, bool> MEMap2Check_;
636  std::map<ME3IdsKey, bool> MEMap2WithEtaCheck_;
637  std::map<ME3IdsKey, bool> MEMap2AbsReWithEtaCheck_;
638  /************/
639  std::map<ME3IdsKey, bool> MEMap2WithChCheck_;
640  /************/
641  /************/
642  std::map<ME4IdsKey, bool> MEMap2WithEtaChCheck_;
643  /************/
644  std::map<ME3IdsKey, bool> MEMap3Check_;
645  std::map<ME4IdsKey, bool> MEMap4Check_;
646  std::map<ME4IdsKey, bool> MEMap4WithChCheck_;
647  std::map<ME5IdsKey, bool> MEMap5WithChCheck_;
648  std::map<ME5IdsKey, bool> MEMap5Check_;
649 
651  std::map<ME3IdsKey, MEStationInfo> mapStationInfo_;
652  std::map<ME4IdsKey, int> mapStationToIdx_;
653 };
654 
655 // Borrwed from DQM/GEM/interface/GEMOfflineDQMBase.h
656 template <typename T>
657 inline bool GEMDQMBase::checkRefs(const std::vector<T *> &refs) {
658  if (refs.empty())
659  return false;
660  if (refs.front() == nullptr)
661  return false;
662  return true;
663 }
664 
665 // The 'get...' functions in the below are borrwed from DQM/GEM/interface/GEMOfflineDQMBase.h
666 inline int GEMDQMBase::getMaxVFAT(const int station) {
667  if (station == 0)
668  return GEMeMap::maxVFatGE0_;
669  if (station == 1)
670  return GEMeMap::maxVFatGE11_;
671  else if (station == 2)
672  return GEMeMap::maxVFatGE21_ / 2;
673  else
674  return -1;
675 }
676 
677 inline int GEMDQMBase::getNumModule(const int station) {
678  if (station == 0)
679  return 1;
680  if (station == 1)
681  return 1;
682  else if (station == 2)
683  return 4;
684  else
685  return -1;
686 }
687 
688 inline int GEMDQMBase::getIdxModule(const int station, const int chamberType) {
689  if (station == 0)
690  return 1;
691  if (station == 1)
692  return 1;
693  else if (station == 2)
694  return chamberType - 20;
695  else
696  return -1;
697 }
698 
699 inline int GEMDQMBase::getVFATNumber(const int station, const int ieta, const int vfat_phi) {
700  if (station == 1)
701  return getVFATNumberGE11(station, ieta, vfat_phi);
702  return getVFATNumberGE11(station, ieta, vfat_phi); // FIXME: What about GE21 and GE0?
703 }
704 
705 inline int GEMDQMBase::getVFATNumberGE11(const int station, const int ieta, const int vfat_phi) {
706  return vfat_phi * GEMeMap::maxiEtaIdGE11_ + (GEMeMap::maxiEtaIdGE11_ - ieta);
707 }
708 
709 inline int GEMDQMBase::getVFATNumberByDigi(const int station, const int ieta, const int digi) {
710  const int vfat_phi = digi / GEMeMap::maxChan_;
711  return getVFATNumber(station, ieta, vfat_phi);
712 }
713 
714 inline int GEMDQMBase::getIEtaFromVFAT(const int station, const int vfat) {
715  if (station == 0)
716  return getIEtaFromVFATGE0(vfat);
717  if (station == 1)
718  return getIEtaFromVFATGE11(vfat);
719  if (station == 2)
720  return getIEtaFromVFATGE21(vfat);
721  return getIEtaFromVFATGE11(vfat); // FIXME: What about GE21 and GE0?
722 }
723 
724 inline int GEMDQMBase::getIEtaFromVFATGE0(const int vfat) {
726 }
727 
728 inline int GEMDQMBase::getIEtaFromVFATGE11(const int vfat) {
730 }
731 
732 inline int GEMDQMBase::getIEtaFromVFATGE21(const int vfat) {
734 }
735 
736 inline int GEMDQMBase::getDetOccXBin(const int chamber, const int layer, const int n_chambers) {
737  return n_chambers * (chamber - 1) + layer;
738 }
739 
740 inline Float_t GEMDQMBase::restrictAngle(const Float_t fTheta, const Float_t fStart) {
741  Float_t fLoop = (fTheta - fStart) / (2 * M_PI);
742  int nLoop = (fLoop >= 0 ? (int)fLoop : (int)fLoop - 1);
743  return fTheta - nLoop * 2 * M_PI;
744 }
745 
747  auto nStation = keyToStation(key3);
748  char cRegion = (keyToRegion(key3) > 0 ? 'P' : 'M');
749  auto nLayer = keyToLayer(key3);
750  return std::string(Form("GE%i1-%c-L%i", nStation, cRegion, nLayer));
751 }
752 
754  auto nStation = keyToStation(key4);
755  char cRegion = (keyToRegion(key4) > 0 ? 'P' : 'M');
756  auto nLayer = keyToLayer(key4);
757  if (nStation == 2) {
758  auto nModule = keyToModule(key4);
759  return std::string(Form("GE%i1-%c-L%i-M%i", nStation, cRegion, nLayer, nModule));
760  }
761  return std::string(Form("GE%i1-%c-L%i", nStation, cRegion, nLayer));
762 }
763 
765  auto nStation = keyToStation(key4);
766  char cRegion = (keyToRegion(key4) > 0 ? 'P' : 'M');
767  auto nChamber = keyToChamber(key4);
768  return std::string(Form("GE%i1-%c-Ch%i", nStation, cRegion, nChamber));
769 }
770 #endif // DQM_GEM_INTERFACE_GEMDQMBase_h
std::map< ME5IdsKey, bool > MEMap5WithChCheck_
Definition: GEMDQMBase.h:647
virtual int ProcessWithMEMap2WithEtaCh(BookingHelper &bh, ME4IdsKey key)
Definition: GEMDQMBase.h:564
void SetName(TString strName)
Definition: GEMDQMBase.h:253
int keyToModule(ME4IdsKey key)
Definition: GEMDQMBase.h:581
ME2IdsKey key3Tokey2(ME3IdsKey key)
Definition: GEMDQMBase.h:591
std::map< ME3IdsKey, bool > MEMap2WithChCheck_
Definition: GEMDQMBase.h:639
bool checkRefs(const std::vector< T *> &)
Definition: GEMDQMBase.h:657
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
int keyToChamber(ME3IdsKey key)
Definition: GEMDQMBase.h:586
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:485
Int_t nRunType_
Definition: GEMDQMBase.h:545
int getIdxModule(const int, const int)
Definition: GEMDQMBase.h:688
~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:724
std::tuple< Int_t, Int_t, Int_t, Int_t, Int_t > ME5IdsKey
int keyToIEta(ME5IdsKey key)
Definition: GEMDQMBase.h:589
std::vector< GEMDetId > listChamberId_
Definition: GEMDQMBase.h:632
virtual int ProcessWithMEMap2AbsReWithEta(BookingHelper &bh, ME3IdsKey key)
Definition: GEMDQMBase.h:556
int getVFATNumber(const int, const int, const int)
Definition: GEMDQMBase.h:699
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:709
MEMapInfT< MEMap3Ids, ME3IdsKey > MEMap3Inf
Definition: GEMDQMBase.h:474
int getIEtaFromVFATGE21(const int vfat)
Definition: GEMDQMBase.h:732
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:326
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:568
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:677
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:651
int keyToRegion(ME2IdsKey key)
Definition: GEMDQMBase.h:570
int readGeometryPhiInfoChamber(const GEMStation *station, MEStationInfo &stationInfo)
Definition: GEMDQMBase.cc:387
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:578
Log< level::Error, false > LogError
std::vector< Float_t > listRadiusOddChamber_
Definition: GEMDQMBase.h:527
int keyToStation(ME3IdsKey key)
Definition: GEMDQMBase.h:575
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:573
int SortingLayers(std::vector< ME4IdsKey > &listLayers)
Definition: GEMDQMBase.cc:129
std::map< ME3IdsKey, bool > MEMap2AbsReWithEtaCheck_
Definition: GEMDQMBase.h:637
std::map< ME2IdsKey, bool > MEMap2Check_
Definition: GEMDQMBase.h:635
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:577
int GenerateMEPerChamber(DQMStore::IBooker &ibooker)
Definition: GEMDQMBase.cc:197
std::string getNameDirChamber(ME4IdsKey key4)
Definition: GEMDQMBase.h:764
std::vector< Float_t > listRadiusEvenChamber_
Definition: GEMDQMBase.h:526
std::map< ME3IdsKey, bool > MEMap3Check_
Definition: GEMDQMBase.h:644
int keyToRegion(ME3IdsKey key)
Definition: GEMDQMBase.h:571
int getIEtaFromVFATGE11(const int vfat)
Definition: GEMDQMBase.h:728
DQMStore::IBooker * ibooker_
Definition: GEMDQMBase.h:97
Float_t restrictAngle(const Float_t fTheta, const Float_t fStart)
Definition: GEMDQMBase.h:740
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:572
int getNumEtaPartitions(const GEMStation *)
Definition: GEMDQMBase.cc:40
static const int maxiEtaIdGE21_
Definition: GEMeMap.h:71
virtual int ProcessWithMEMap2WithChamber(BookingHelper &bh, ME3IdsKey key)
Definition: GEMDQMBase.h:561
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomToken_
Definition: GEMDQMBase.h:630
virtual int ProcessWithMEMap5(BookingHelper &bh, ME5IdsKey key)
Definition: GEMDQMBase.h:559
std::map< ME5IdsKey, bool > MEMap5Check_
Definition: GEMDQMBase.h:648
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:666
std::map< ME4IdsKey, int > mapStationToIdx_
Definition: GEMDQMBase.h:652
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:574
void SetTitle(TString strTitle)
Definition: GEMDQMBase.h:255
std::map< ME4IdsKey, bool > MEMap4Check_
Definition: GEMDQMBase.h:645
int keyToStation(ME4IdsKey key)
Definition: GEMDQMBase.h:576
virtual int ProcessWithMEMap4WithChamber(BookingHelper &bh, ME4IdsKey key)
Definition: GEMDQMBase.h:567
#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:582
void SetOperating(Bool_t bOperating)
Definition: GEMDQMBase.h:244
int keyToChamber(ME5IdsKey key)
Definition: GEMDQMBase.h:584
const GEMGeometry * GEMGeometry_
Definition: GEMDQMBase.h:629
int keyToIEta(ME4IdsKey key)
Definition: GEMDQMBase.h:588
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:221
std::map< ME4IdsKey, bool > MEMap4WithChCheck_
Definition: GEMDQMBase.h:646
int getDetOccXBin(const int, const int, const int)
Definition: GEMDQMBase.h:736
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:583
int getIEtaFromVFAT(const int station, const int vfat)
Definition: GEMDQMBase.h:714
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:746
GEMDQMBase(const edm::ParameterSet &cfg)
Definition: GEMDQMBase.cc:7
std::map< ME3IdsKey, bool > MEMap2WithEtaCheck_
Definition: GEMDQMBase.h:636
int bookND(BookingHelper &bh, K key)
Definition: GEMDQMBase.h:307
ME3IdsKey key4Tokey3(ME4IdsKey key)
Definition: GEMDQMBase.h:596
std::map< GEMDetId, std::vector< const GEMEtaPartition * > > mapEtaPartition_
Definition: GEMDQMBase.h:633
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
std::map< ME4IdsKey, bool > MEMap2WithEtaChCheck_
Definition: GEMDQMBase.h:642
static const int maxiEtaIdGE11_
Definition: GEMeMap.h:70
MEMapInfT< MEMap5Ids, ME5IdsKey > MEMap5Inf
Definition: GEMDQMBase.h:476
int nMaxNumCh_
Definition: GEMDQMBase.h:650
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:705
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:579
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:580
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:601
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