CMS 3D CMS Logo

RPCRollMapHisto.cc
Go to the documentation of this file.
2 #include <fmt/format.h>
3 
5 //typedef DQMEDHarvester::MonitorElement MonitorElement;
7 
9  IBooker& booker, const int wheel, const std::string& name, const std::string& title, const bool useRollInfo) {
10  MonitorElement* me = booker.book2D(name, title, 12, 0.5, 12.5, 21, 0.5, 21.5);
11 
12  TH2* h = dynamic_cast<TH2*>(me->getTH1());
13  h->GetXaxis()->SetNoAlphanumeric(true);
14  // Set x-axis labels
15  for (int i = 1; i <= 12; ++i) {
16  me->setBinLabel(i, fmt::format("Sec{}", i), 1);
17  }
18 
19  // Set y-axis labels
21 
22  return me;
23 }
24 
25 void RPCRollMapHisto::setBarrelRollAxis(MonitorElement* me, const int wheel, const int axis, const bool useRollInfo) {
26  TH1* h = dynamic_cast<TH1*>(me->getTH1());
27  if (axis == 1)
28  h->GetXaxis()->SetNoAlphanumeric(true);
29  else if (axis == 2)
30  h->GetYaxis()->SetNoAlphanumeric(true);
31 
32  const std::array<const std::string, 21> labelsRoll = {
33  {"RB1in_B", "RB1in_F", "RB1out_B", "RB1out_F", "RB2in_B", "RB2in_F", "RB2in_M",
34  "RB2out_B", "RB2out_F", "RB3-_B", "RB3-_F", "RB3+_B", "RB3+_F", "RB4,-_B",
35  "RB4,-_F", "RB4+_B", "RB4+_F", "RB4--_B", "RB4--_F", "RB4++_B", "RB4++_F"}};
36  const std::array<const std::string, 21> labelsCh = {{"RB1in", "", "RB1out", "", "RB2in", "", "",
37  "RB2out", "", "RB3-", "", "RB3+", "", "RB4,-",
38  "", "RB4+", "", "RB4--", "", "RB4++", ""}};
39 
40  for (int i = 0, n = std::min(21, me->getNbinsY()); i < n; ++i) {
41  const std::string label = useRollInfo ? labelsRoll[i] : labelsCh[i];
42  me->setBinLabel(i + 1, label, 2);
43  }
44  if (useRollInfo and std::abs(wheel) == 2) {
45  // We have RB2out_M for the wheel +-2, otherwise, RB2in_M as in the default array
46  me->setBinLabel(7, "RB2out_M", 2);
47  }
48 }
49 
50 void RPCRollMapHisto::setEndcapRollAxis(MonitorElement* me, const int disk, const int axis, const bool useRollInfo) {
51  TH1* h = dynamic_cast<TH1*>(me->getTH1());
52  if (axis == 1)
53  h->GetXaxis()->SetNoAlphanumeric(true);
54  else if (axis == 2)
55  h->GetYaxis()->SetNoAlphanumeric(true);
56 
57  // NOTE: Let us keep only Ring2 and Ring3 for the Run3
58  // There will be Ring1, RE3/1 and RE4/1 only from the phase-2
59  const std::array<const std::string, 6> labelsRoll = {{//"C", "Ring1 B", "A",
60  "C",
61  "Ring2 B",
62  "A",
63  "C",
64  "Ring3 B",
65  "A"}};
66  const std::array<const std::string, 6> labelsCh = {{//"", "Ring1", "",
67  "",
68  "Ring2",
69  "",
70  "",
71  "Ring3",
72  ""}};
73 
74  //const int offset = std::abs(disk) >= 3 ? 0 : 3;
75  for (int i = 0; i < 6; ++i) {
76  const std::string label = useRollInfo ? labelsRoll[i] : labelsCh[i];
77  me->setBinLabel(i + 1, label, 2);
78  }
79 }
80 
82  IBooker& booker, const int disk, const std::string& name, const std::string& title, const bool useRollInfo) {
83  MonitorElement* me = booker.book2D(name, title, 36, 0.5, 36.5, 6, 0.5, 6.5);
84  TH2* h = dynamic_cast<TH2*>(me->getTH1());
85  h->GetXaxis()->SetNoAlphanumeric(true);
86  h->GetYaxis()->SetNoAlphanumeric(true);
87 
88  // Set x-axis labels
89  for (int i = 1; i <= 36; ++i) {
90  me->setBinLabel(i, fmt::format("{}", i), 1);
91  }
92  me->setAxisTitle("Segments", 1);
93 
94  RPCRollMapHisto::setEndcapRollAxis(me, disk, 2, useRollInfo);
95 
96  return me;
97 }
RPCRollMapHisto::setEndcapRollAxis
static void setEndcapRollAxis(MonitorElement *me, const int disk, const int axis, const bool useRollInfo)
Definition: RPCRollMapHisto.cc:50
RPCRollMapHisto::bookBarrel
static MonitorElement * bookBarrel(IBooker &booker, const int wheel, const std::string &prefix, const std::string &title, const bool useRollInfo)
Definition: RPCRollMapHisto.cc:8
dqm::impl::MonitorElement
Definition: MonitorElement.h:98
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
min
T min(T a, T b)
Definition: MathUtil.h:58
IBooker
dqm::reco::DQMStore::IBooker IBooker
Definition: RPCRollMapHisto.cc:6
RPCRollMapHisto::bookEndcap
static MonitorElement * bookEndcap(IBooker &booker, const int disk, const std::string &prefix, const std::string &title, const bool useRollInfo)
Definition: RPCRollMapHisto.cc:81
MonitorElement
dqm::reco::MonitorElement MonitorElement
Definition: RPCRollMapHisto.cc:4
dqm-mbProfile.format
format
Definition: dqm-mbProfile.py:16
h
RPCRollMapHisto.h
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
RPCRollMapHisto::setBarrelRollAxis
static void setBarrelRollAxis(MonitorElement *me, const int wheel, const int axis, const bool useRollInfo)
Definition: RPCRollMapHisto.cc:25
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
dqm::implementation::IBooker::book2D
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:177
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
dqm::implementation::IBooker
Definition: DQMStore.h:43
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
label
const char * label
Definition: PFTauDecayModeTools.cc:11