CMS 3D CMS Logo

RPCDCSSummary.cc
Go to the documentation of this file.
2 
7 
8 //#include "DQMServices/Core/interface/DQMStore.h"
9 
10 //CondFormats
13 
15  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
16 
17  FEDRange_.first = ps.getUntrackedParameter<unsigned int>("MinimumRPCFEDId", 790);
18  FEDRange_.second = ps.getUntrackedParameter<unsigned int>("MaximumRPCFEDId", 792);
19 
20  offlineDQM_ = ps.getUntrackedParameter<bool>("OfflineDQM", true);
21 
22  NumberOfFeds_ = FEDRange_.second - FEDRange_.first + 1;
23  init_ = false;
24  defaultValue_ = 1.;
25 }
26 
28 
30 
32  DQMStore::IGetter& igetter,
33  edm::LuminosityBlock const& lumiB,
34  edm::EventSetup const& setup) {
35  if (!init_) {
36  this->checkDCSbit(setup);
37  if (!offlineDQM_) {
38  this->myBooker(ibooker);
39  }
40  }
41 }
42 
44  if (offlineDQM_) {
45  this->myBooker(ibooker);
46  }
47 }
48 
50  defaultValue_ = 1.;
51 
52  if (auto runInfoRec = setup.tryToGet<RunInfoRcd>()) {
53  defaultValue_ = -1.;
54  //get fed summary information
56  runInfoRec->get(sumFED);
57  std::vector<int> FedsInIds = sumFED->m_fed_in;
58  unsigned int f = 0;
59  bool flag = false;
60  while (!flag && f < FedsInIds.size()) {
61  int fedID = FedsInIds[f];
62  //make sure fed id is in allowed range
63  if (fedID >= FEDRange_.first && fedID <= FEDRange_.second) {
64  defaultValue_ = 1.;
65  flag = true;
66  }
67  f++;
68  }
69  }
70  init_ = true;
71 }
72 
74  ibooker.setCurrentFolder("RPC/EventInfo");
75  // global fraction
76  totalDCSFraction = ibooker.bookFloat("DCSSummary");
78 
79  DCSMap_ = ibooker.book2D("DCSSummaryMap", "RPC DCS Summary Map", 15, -7.5, 7.5, 12, 0.5, 12.5);
80 
81  //customize the 2d histo
82  std::stringstream BinLabel;
83  for (int i = 1; i < 13; i++) {
84  BinLabel.str("");
85  BinLabel << "Sec" << i;
86  DCSMap_->setBinLabel(i, BinLabel.str(), 2);
87  }
88 
89  for (int i = -2; i <= 2; i++) {
90  BinLabel.str("");
91  BinLabel << "Wheel" << i;
92  DCSMap_->setBinLabel((i + 8), BinLabel.str(), 1);
93  }
94 
95  for (int i = 1; i <= numberOfDisks_; i++) {
96  BinLabel.str("");
97  BinLabel << "Disk" << i;
98  DCSMap_->setBinLabel((i + 11), BinLabel.str(), 1);
99  BinLabel.str("");
100  BinLabel << "Disk" << -i;
101  DCSMap_->setBinLabel((-i + 5), BinLabel.str(), 1);
102  }
103 
104  //fill the histo with "1" --- just for the moment
105  for (int i = 1; i <= 15; i++) {
106  for (int j = 1; j <= 12; j++) {
107  if (i == 5 || i == 11 || (j > 6 && (i < 6 || i > 10)))
108  DCSMap_->setBinContent(i, j, -1); //bins that not correspond to subdetector parts
109  else
111  }
112  }
113 
114  if (numberOfDisks_ < 4) {
115  for (int j = 1; j <= 12; j++) {
116  DCSMap_->setBinContent(1, j, -1); //bins that not correspond to subdetector parts
117  DCSMap_->setBinContent(15, j, -1);
118  }
119  }
120 
121  // book the ME
122  ibooker.setCurrentFolder("RPC/EventInfo/DCSContents");
123 
124  int limit = numberOfDisks_;
125  if (numberOfDisks_ < 2)
126  limit = 2;
127 
128  for (int i = -1 * limit; i <= limit; i++) { //loop on wheels and disks
129  if (i > -3 && i < 3) { //wheels
130  std::stringstream streams;
131  streams << "RPC_Wheel" << i;
132  dcsWheelFractions[i + 2] = ibooker.bookFloat(streams.str());
134  }
135 
136  if (i == 0 || i > numberOfDisks_ || i < (-1 * numberOfDisks_))
137  continue;
138 
139  int offset = numberOfDisks_;
140  if (i > 0)
141  offset--; //used to skip case equale to zero
142  std::stringstream streams;
143  streams << "RPC_Disk" << i;
144  dcsDiskFractions[i + 2] = ibooker.bookFloat(streams.str());
146  }
147 }
T getUntrackedParameter(std::string const &, T const &) const
std::optional< T > tryToGet() const
Definition: EventSetup.h:94
MonitorElement * DCSMap_
Definition: RPCDCSSummary.h:35
MonitorElement * bookFloat(TString const &name)
Definition: DQMStore.cc:233
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
void myBooker(DQMStore::IBooker &)
RPCDCSSummary(const edm::ParameterSet &)
Constructor.
double defaultValue_
Definition: RPCDCSSummary.h:31
void beginJob() override
MonitorElement * totalDCSFraction
Definition: RPCDCSSummary.h:36
void Fill(long long x)
MonitorElement * dcsDiskFractions[10]
Definition: RPCDCSSummary.h:38
std::vector< int > m_fed_in
Definition: RunInfo.h:25
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
double f[11][100]
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)
void checkDCSbit(edm::EventSetup const &)
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Definition: DQMStore.cc:266
~RPCDCSSummary() override
Destructor.
MonitorElement * dcsWheelFractions[5]
Definition: RPCDCSSummary.h:37
std::pair< int, int > FEDRange_
Definition: RPCDCSSummary.h:39