CMS 3D CMS Logo

DQMDcsInfo.cc
Go to the documentation of this file.
1 /*
2  * \file DQMDcsInfo.cc
3  * \author A.Meyer - DESY
4  * Last Update:
5  *
6  */
7 
8 #include "DQMDcsInfo.h"
13 
14 // Framework
15 
17  parameters_ = ps;
18 
19  subsystemname_ = parameters_.getUntrackedParameter<std::string>("subSystemFolder", "Info");
20  dcsinfofolder_ = parameters_.getUntrackedParameter<std::string>("dcsInfoFolder", "DcsInfo");
22  consumes<L1GlobalTriggerReadoutRecord>(parameters_.getUntrackedParameter<std::string>("gtCollection", "gtDigis"));
23  dcsStatusCollection_ = consumes<DcsStatusCollection>(
24  parameters_.getUntrackedParameter<std::string>("dcsStatusCollection", "scalersRawToDigi"));
25 
26  // initialize
27  for (bool& dc : dcs)
28  dc = true;
29 }
30 
31 DQMDcsInfo::~DQMDcsInfo() = default;
32 
34  edm::Run const& /* iRun */,
35  edm::EventSetup const& /* iSetup */) {
36  // Fetch GlobalTag information and fill the string/ME.
37  ibooker.cd();
38  ibooker.setCurrentFolder(subsystemname_ + "/CMSSWInfo/");
39 
40  const edm::ParameterSet& globalTagPSet =
42 
43  ibooker.bookString("globalTag_Step1", globalTagPSet.getParameter<std::string>("globaltag"));
44 
45  ibooker.cd();
47 
48  DCSbyLS_ = ibooker.book1D("DCSbyLS", "DCS", 25, 0., 25.);
50 
51  // initialize
52  for (bool& dc : dcs)
53  dc = true;
54 }
55 
57  makeDcsInfo(e);
58  makeGtInfo(e);
59 
60  return;
61 }
62 
64  // int nlumi = l.id().luminosityBlock();
65 
66  // fill dcs vs lumi
67  /* set those bins 0 for which bits are ON
68  needed for merge off lumi histograms across files */
69  for (int i = 0; i < 25; i++) {
70  if (dcs[i])
71  DCSbyLS_->setBinContent(i + 1, 0.);
72  else
73  DCSbyLS_->setBinContent(i + 1, 1.);
74 
75  dcs[i] = true;
76  }
77 
78  return;
79 }
80 
83  if (!e.getByToken(dcsStatusCollection_, dcsStatus)) {
84  for (int i = 0; i < 24; i++)
85  dcs[i] = false;
86  return;
87  }
88 
89  if (!dcsStatus.isValid()) {
90  edm::LogWarning("DQMDcsInfo") << "scalersRawToDigi not found";
91  for (int i = 0; i < 24; i++)
92  dcs[i] = false; // info not available: set to false
93  return;
94  }
95 
96  for (auto const& dcsStatusItr : *dcsStatus) {
97  if (!dcsStatusItr.ready(DcsStatus::CSCp))
98  dcs[0] = false;
99  if (!dcsStatusItr.ready(DcsStatus::CSCm))
100  dcs[1] = false;
101  if (!dcsStatusItr.ready(DcsStatus::DT0))
102  dcs[2] = false;
103  if (!dcsStatusItr.ready(DcsStatus::DTp))
104  dcs[3] = false;
105  if (!dcsStatusItr.ready(DcsStatus::DTm))
106  dcs[4] = false;
107  if (!dcsStatusItr.ready(DcsStatus::EBp))
108  dcs[5] = false;
109  if (!dcsStatusItr.ready(DcsStatus::EBm))
110  dcs[6] = false;
111  if (!dcsStatusItr.ready(DcsStatus::EEp))
112  dcs[7] = false;
113  if (!dcsStatusItr.ready(DcsStatus::EEm))
114  dcs[8] = false;
115  if (!dcsStatusItr.ready(DcsStatus::ESp))
116  dcs[9] = false;
117  if (!dcsStatusItr.ready(DcsStatus::ESm))
118  dcs[10] = false;
119  if (!dcsStatusItr.ready(DcsStatus::HBHEa))
120  dcs[11] = false;
121  if (!dcsStatusItr.ready(DcsStatus::HBHEb))
122  dcs[12] = false;
123  if (!dcsStatusItr.ready(DcsStatus::HBHEc))
124  dcs[13] = false;
125  if (!dcsStatusItr.ready(DcsStatus::HF))
126  dcs[14] = false;
127  if (!dcsStatusItr.ready(DcsStatus::HO))
128  dcs[15] = false;
129  if (!dcsStatusItr.ready(DcsStatus::BPIX))
130  dcs[16] = false;
131  if (!dcsStatusItr.ready(DcsStatus::FPIX))
132  dcs[17] = false;
133  if (!dcsStatusItr.ready(DcsStatus::RPC))
134  dcs[18] = false;
135  if (!dcsStatusItr.ready(DcsStatus::TIBTID))
136  dcs[19] = false;
137  if (!dcsStatusItr.ready(DcsStatus::TOB))
138  dcs[20] = false;
139  if (!dcsStatusItr.ready(DcsStatus::TECp))
140  dcs[21] = false;
141  if (!dcsStatusItr.ready(DcsStatus::TECm))
142  dcs[22] = false;
143  if (!dcsStatusItr.ready(DcsStatus::CASTOR))
144  dcs[23] = false;
145  }
146 
147  return;
148 }
149 
152  if (!e.getByToken(gtCollection_, gtrr_handle)) {
153  dcs[24] = false; // info not available: set to false
154  return;
155  }
156 
157  if (!gtrr_handle.isValid()) {
158  edm::LogWarning("DQMDcsInfo") << " gtDigis not found";
159  dcs[24] = false; // info not available: set to false
160  return;
161  }
162 
163  L1GlobalTriggerReadoutRecord const* gtrr = gtrr_handle.product();
164  L1GtFdlWord fdlWord;
165  if (gtrr)
166  fdlWord = gtrr->gtFdlWord();
167  else {
168  edm::LogWarning("DQMDcsInfo") << " phys decl. bit not accessible !!!";
169  dcs[24] = false; // info not available: set to false
170  return;
171  }
172 
173  if (fdlWord.physicsDeclared() != 1)
174  dcs[24] = false;
175 
176  return;
177 }
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
Definition: DQMStore.cc:239
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
void setLumiFlag()
this ME is meant to be stored for each luminosity section
ModuleDescription const & moduleDescription() const
ParameterSet const & getProcessParameterSetContainingModule(ModuleDescription const &moduleDescription)
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > gtCollection_
Definition: DQMDcsInfo.h:45
void dqmEndLuminosityBlock(const edm::LuminosityBlock &l, const edm::EventSetup &c) override
Definition: DQMDcsInfo.cc:63
edm::ParameterSet parameters_
Definition: DQMDcsInfo.h:42
bool dcs[25]
Definition: DQMDcsInfo.h:48
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
Definition: DQMDcsInfo.cc:56
T const * product() const
Definition: Handle.h:69
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: DQMDcsInfo.cc:33
const L1GtFdlWord gtFdlWord(int bxInEventValue) const
get / set FDL word (record) in the GT readout record
ParameterSet const & getParameterSet(std::string const &) const
std::string dcsinfofolder_
Definition: DQMDcsInfo.h:44
const cms_uint16_t physicsDeclared() const
get/set "physics declared" bit
Definition: L1GtFdlWord.h:169
void makeDcsInfo(const edm::Event &e)
Definition: DQMDcsInfo.cc:81
std::string subsystemname_
Definition: DQMDcsInfo.h:43
MonitorElement * bookString(TString const &name, TString const &value)
Definition: DQMStore.cc:235
DQMDcsInfo(const edm::ParameterSet &ps)
Constructor.
Definition: DQMDcsInfo.cc:16
~DQMDcsInfo() override
Destructor.
MonitorElement * DCSbyLS_
Definition: DQMDcsInfo.h:50
edm::EDGetTokenT< DcsStatusCollection > dcsStatusCollection_
Definition: DQMDcsInfo.h:46
void makeGtInfo(const edm::Event &e)
Definition: DQMDcsInfo.cc:150
Definition: Run.h:45