CMS 3D CMS Logo

DQMDcsInfoClient.cc
Go to the documentation of this file.
1 
2 /*
3  * \file DQMDcsInfoClient.cc
4  * \author Andreas Meyer
5  * Last Update: 2019-03-26 Migrate to DQMEDHarvester
6  *
7 */
8 
9 #include "DQMDcsInfoClient.h"
11 
12 // -----------------------------
13 // constructors and destructor
14 // -----------------------------
15 
17  parameters_ = ps;
18 
19  subsystemname_ = parameters_.getUntrackedParameter<std::string>("subSystemFolder", "Info");
20  dcsinfofolder_ = parameters_.getUntrackedParameter<std::string>("dcsInfoFolder", "DcsInfo");
21 }
22 
24 
26  DCS.clear();
27  DCS.resize(10); // start with 10 LS, resize later
28  processedLS_.clear();
29 }
30 
32  DQMStore::IGetter& igetter,
33  const edm::LuminosityBlock& l,
34  const edm::EventSetup& c) {
35  unsigned int nlumi = l.id().luminosityBlock();
36  processedLS_.insert(nlumi);
37  // cout << " in lumi section " << nlumi << endl;
38 
39  if (nlumi + 1 > DCS.size())
40  DCS.resize(nlumi + 1);
41  // cout << "DCS size: " << DCS.size() << endl;
42 
43  MonitorElement* DCSbyLS_ = igetter.get(subsystemname_ + "/" + dcsinfofolder_ + "/DCSbyLS");
44 
45  if (DCSbyLS_) {
46  if (TH1F* h1 = DCSbyLS_->getTH1F()) {
47  int word = 0;
48  for (int i = 0; i < 25; i++) {
49  if (h1->GetBinContent(i + 1) != 0)
50  word |= (0x0 << i); // set to 0 because HV was off (!)
51  else
52  word |= (0x1 << i); // set to 1 because HV was on (!)
53  }
54  DCS[nlumi] = word;
55  }
56  DCSbyLS_->Reset();
57  }
58  return;
59 }
60 
62  // Fetch GlobalTag information and fill the string/ME.
63  ibooker.cd();
64  ibooker.setCurrentFolder(subsystemname_ + "/CMSSWInfo/");
65  const edm::ParameterSet& globalTagPSet =
67 
68  ibooker.bookString("globalTag_Harvesting", globalTagPSet.getParameter<std::string>("globaltag"));
69 
70  ibooker.cd();
71  ibooker.setCurrentFolder(subsystemname_ + "/EventInfo/");
72 
73  unsigned int nlsmax = DCS.size();
74  reportSummary_ = ibooker.bookFloat("reportSummary");
75  reportSummary_->Fill(1.);
76 
77  reportSummaryMap_ = igetter.get(subsystemname_ + "/EventInfo/reportSummaryMap");
78  assert(!reportSummaryMap_); // this would be a configuration problem
79 
80  reportSummaryMap_ = ibooker.book2D("reportSummaryMap", "HV and GT vs Lumi", nlsmax, 0., nlsmax, 25, 0., 25.);
81  if (processedLS_.empty())
82  return;
83  unsigned int lastProcessedLS = *(--processedLS_.end());
85  ibooker.book1D("ProcessedLS", "Processed Lumisections", lastProcessedLS + 1, 0., lastProcessedLS + 1);
86  reportSummaryMap_->setBinLabel(1, "CSC+", 2);
87  reportSummaryMap_->setBinLabel(2, "CSC-", 2);
88  reportSummaryMap_->setBinLabel(3, "DT0", 2);
89  reportSummaryMap_->setBinLabel(4, "DT+", 2);
90  reportSummaryMap_->setBinLabel(5, "DT-", 2);
91  reportSummaryMap_->setBinLabel(6, "EB+", 2);
92  reportSummaryMap_->setBinLabel(7, "EB-", 2);
93  reportSummaryMap_->setBinLabel(8, "EE+", 2);
94  reportSummaryMap_->setBinLabel(9, "EE-", 2);
95  reportSummaryMap_->setBinLabel(10, "ES+", 2);
96  reportSummaryMap_->setBinLabel(11, "ES-", 2);
97  reportSummaryMap_->setBinLabel(12, "HBHEa", 2);
98  reportSummaryMap_->setBinLabel(13, "HBHEb", 2);
99  reportSummaryMap_->setBinLabel(14, "HBHEc", 2);
100  reportSummaryMap_->setBinLabel(15, "HF", 2);
101  reportSummaryMap_->setBinLabel(16, "HO", 2);
102  reportSummaryMap_->setBinLabel(17, "BPIX", 2);
103  reportSummaryMap_->setBinLabel(18, "FPIX", 2);
104  reportSummaryMap_->setBinLabel(19, "RPC", 2);
105  reportSummaryMap_->setBinLabel(20, "TIBTID", 2);
106  reportSummaryMap_->setBinLabel(21, "TOB", 2);
107  reportSummaryMap_->setBinLabel(22, "TECp", 2);
108  reportSummaryMap_->setBinLabel(23, "TECm", 2);
109  reportSummaryMap_->setBinLabel(24, "CASTOR", 2);
110  reportSummaryMap_->setBinLabel(25, "PhysDecl", 2);
111  reportSummaryMap_->setAxisTitle("Luminosity Section");
112 
113  // fill
114  for (unsigned int i = 0; i < DCS.size(); i++) {
115  for (int j = 0; j < 25; j++) {
116  if (DCS[i] & (0x1 << j))
117  reportSummaryMap_->setBinContent(i, j + 1, 1.);
118  else
119  reportSummaryMap_->setBinContent(i, j + 1, 0.);
120  }
121  }
122 
123  unsigned int lastAccessed = 0;
124 
125  for (auto ls : processedLS_) {
126  while (lastAccessed < ls) {
127  // std::cout << "Filling " << lastAccessed << " with -1" << std::endl;
128  meProcessedLS_->Fill(lastAccessed, -1.);
129  lastAccessed++;
130  }
131  // std::cout << "Filling " << *it << " with 1" << std::endl;
133  lastAccessed = ls + 1;
134  }
135 }
LuminosityBlockID id() const
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
std::string dcsinfofolder_
T getUntrackedParameter(std::string const &, T const &) const
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
std::set< unsigned int > processedLS_
edm::ParameterSet parameters_
std::string subsystemname_
MonitorElement * bookFloat(TString const &name)
Definition: DQMStore.cc:233
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
virtual TH1F * getTH1F() const
MonitorElement * meProcessedLS_
ModuleDescription const & moduleDescription() const
ParameterSet const & getProcessParameterSetContainingModule(ModuleDescription const &moduleDescription)
void Fill(long long x)
virtual void Reset()
reset ME (ie. contents, errors, etc)
uint64_t word
DQMDcsInfoClient(const edm::ParameterSet &ps)
MonitorElement * reportSummary_
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)
~DQMDcsInfoClient() override
def ls(path, rec=False)
Definition: eostools.py:349
std::vector< int > DCS
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
ParameterSet const & getParameterSet(std::string const &) const
LuminosityBlockNumber_t luminosityBlock() const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Definition: DQMStore.cc:266
MonitorElement * bookString(TString const &name, TString const &value)
Definition: DQMStore.cc:235
MonitorElement * reportSummaryMap_
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:437
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, const edm::LuminosityBlock &l, const edm::EventSetup &c) override
Definition: Run.h:45
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)