CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RPCDCSSummary.cc
Go to the documentation of this file.
2 
7 
8 #include <fmt/format.h>
9 
11  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
12 
13  FEDRange_.first = ps.getUntrackedParameter<unsigned int>("MinimumRPCFEDId", 790);
14  FEDRange_.second = ps.getUntrackedParameter<unsigned int>("MaximumRPCFEDId", 792);
15 
16  offlineDQM_ = ps.getUntrackedParameter<bool>("OfflineDQM", true);
17 
18  NumberOfFeds_ = FEDRange_.second - FEDRange_.first + 1;
19  init_ = false;
20  defaultValue_ = 1.;
21 
22  runInfoToken_ = esConsumes<edm::Transition::EndLuminosityBlock>();
23 }
24 
26 
28  DQMStore::IGetter& igetter,
29  edm::LuminosityBlock const& lumiB,
30  edm::EventSetup const& setup) {
31  if (!init_) {
32  this->checkDCSbit(setup);
33  if (!offlineDQM_) {
34  this->myBooker(ibooker);
35  }
36  }
37 }
38 
40  if (offlineDQM_) {
41  this->myBooker(ibooker);
42  }
43 }
44 
46  defaultValue_ = 1.;
47 
48  if (auto runInfoRec = setup.tryToGet<RunInfoRcd>()) {
49  defaultValue_ = -1.;
50  //get fed summary information
51  auto sumFED = runInfoRec->get(runInfoToken_);
52  const std::vector<int> FedsInIds = sumFED.m_fed_in;
53  unsigned int f = 0;
54  bool flag = false;
55  while (!flag && f < FedsInIds.size()) {
56  int fedID = FedsInIds[f];
57  //make sure fed id is in allowed range
58  if (fedID >= FEDRange_.first && fedID <= FEDRange_.second) {
59  defaultValue_ = 1.;
60  flag = true;
61  }
62  f++;
63  }
64  }
65  init_ = true;
66 }
67 
69  ibooker.setCurrentFolder("RPC/EventInfo");
70  // global fraction
71  totalDCSFraction = ibooker.bookFloat("DCSSummary");
73 
74  DCSMap_ = RPCSummaryMapHisto::book(ibooker, "DCSSummaryMap", "RPC DCS Summary Map");
75 
76  //fill the histo with "1" --- just for the moment
79 
80  // book the ME
81  ibooker.setCurrentFolder("RPC/EventInfo/DCSContents");
82 
83  const int limit = std::max(2, numberOfDisks_);
84 
85  for (int i = -1 * limit; i <= limit; i++) { //loop on wheels and disks
86  if (i > -3 && i < nWheels_ - 2) { //wheels
87  const std::string s = fmt::format("RPC_Wheel{}", i);
88  dcsWheelFractions[i + 2] = ibooker.bookFloat(s);
90  }
91 
92  if (i == 0 || i > numberOfDisks_ || i < -numberOfDisks_)
93  continue;
94 
95  if (i > -3 && i < nDisks_ - 2) {
96  const std::string s = fmt::format("RPC_Disk{}", i);
97  dcsDiskFractions[i + 2] = ibooker.bookFloat(s);
99  }
100  }
101 }
T getUntrackedParameter(std::string const &, T const &) const
static constexpr int nDisks_
Definition: RPCDCSSummary.h:39
std::optional< T > tryToGet() const
Definition: EventSetup.h:103
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
MonitorElement * DCSMap_
Definition: RPCDCSSummary.h:35
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
void myBooker(DQMStore::IBooker &)
RPCDCSSummary(const edm::ParameterSet &)
static void setBinsEndcap(MonitorElement *me, const double value)
double defaultValue_
Definition: RPCDCSSummary.h:31
void beginJob() override
MonitorElement * totalDCSFraction
Definition: RPCDCSSummary.h:36
MonitorElement * dcsDiskFractions[nDisks_]
Definition: RPCDCSSummary.h:40
void Fill(long long x)
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
MonitorElement * dcsWheelFractions[nWheels_]
Definition: RPCDCSSummary.h:38
void checkDCSbit(edm::EventSetup const &)
static MonitorElement * book(IBooker &booker, const std::string &name, const std::string &title)
static constexpr int nWheels_
Definition: RPCDCSSummary.h:37
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
edm::ESGetToken< RunInfo, RunInfoRcd > runInfoToken_
Definition: RPCDCSSummary.h:28
static void setBinsBarrel(MonitorElement *me, const double value)
std::pair< int, int > FEDRange_
Definition: RPCDCSSummary.h:41