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