CMS 3D CMS Logo

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