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:
6  *
7 */
8 
11 
12 // -----------------------------
13 // constructors and destructor
14 // -----------------------------
15 
17 
18  parameters_ = ps;
19 
21 
22  subsystemname_ = parameters_.getUntrackedParameter<std::string>("subSystemFolder", "Info") ;
23  dcsinfofolder_ = parameters_.getUntrackedParameter<std::string>("dcsInfoFolder", "DcsInfo") ;
24 
25 }
26 
27 
29 
30 }
31 
32 void
34 {
35  // Fetch GlobalTag information and fill the string/ME.
36  dbe_->cd();
37  dbe_->setCurrentFolder(subsystemname_ +"/CMSSWInfo/");
38  const edm::ParameterSet &globalTagPSet =
40  .getParameterSet("PoolDBESSource@GlobalTag");
41 
42  dbe_->bookString("globalTag_Harvesting", globalTagPSet.getParameter<std::string>("globaltag"));
43 
44  DCS.clear();
45  DCS.resize(10); // start with 10 LS, resize later
46  processedLS_.clear();
47 }
48 
49 void
51 {
52  return;
53 }
54 
55 void
57 {
58  if (!dbe_) return;
59 
60  unsigned int nlumi = l.id().luminosityBlock() ;
61  processedLS_.insert(nlumi);
62  // cout << " in lumi section " << nlumi << endl;
63 
64  if (nlumi+1 > DCS.size())
65  DCS.resize(nlumi+1);
66  // cout << "DCS size: " << DCS.size() << endl;
67 
68  MonitorElement* DCSbyLS_ =
69  dbe_->get(subsystemname_ + "/" + dcsinfofolder_ + "/DCSbyLS" );
70 
71  if ( DCSbyLS_ )
72  {
73  if ( TH1F * h1 = DCSbyLS_->getTH1F())
74  {
75  int word = 0;
76  for (int i = 0; i < 25 ; i++)
77  {
78 
79  if ( h1->GetBinContent(i+1) != 0 )
80  word |= (0x0 << i); // set to 0 because HV was off (!)
81  else
82  word |= (0x1 << i); // set to 1 because HV was on (!)
83  }
84  DCS[nlumi] = word;
85  }
86  }
87  return;
88 }
89 
90 void
92 {
93 
94  // book
95  dbe_->cd();
96  dbe_->setCurrentFolder(subsystemname_ +"/EventInfo/");
97 
98  unsigned int nlsmax = DCS.size();
99  reportSummary_=dbe_->bookFloat("reportSummary");
100  reportSummary_->Fill(1.);
101 
102  reportSummaryMap_ = dbe_->get(subsystemname_ +"/EventInfo/reportSummaryMap");
104 
105  reportSummaryMap_ = dbe_->book2D("reportSummaryMap",
106  "HV and GT vs Lumi", nlsmax, 0., nlsmax, 25, 0., 25.);
107  unsigned int lastProcessedLS = *(--processedLS_.end());
108  meProcessedLS_ = dbe_->book1D("ProcessedLS",
109  "Processed Lumisections",
110  lastProcessedLS+1,
111  0.,lastProcessedLS+1);
112  reportSummaryMap_->setBinLabel( 1, "CSC+" , 2);
113  reportSummaryMap_->setBinLabel( 2, "CSC-" , 2);
114  reportSummaryMap_->setBinLabel( 3, "DT0" , 2);
115  reportSummaryMap_->setBinLabel( 4, "DT+" , 2);
116  reportSummaryMap_->setBinLabel( 5, "DT-" , 2);
117  reportSummaryMap_->setBinLabel( 6, "EB+" , 2);
118  reportSummaryMap_->setBinLabel( 7, "EB-" , 2);
119  reportSummaryMap_->setBinLabel( 8, "EE+" , 2);
120  reportSummaryMap_->setBinLabel( 9, "EE-" , 2);
121  reportSummaryMap_->setBinLabel(10, "ES+" , 2);
122  reportSummaryMap_->setBinLabel(11, "ES-" , 2);
123  reportSummaryMap_->setBinLabel(12, "HBHEa" , 2);
124  reportSummaryMap_->setBinLabel(13, "HBHEb" , 2);
125  reportSummaryMap_->setBinLabel(14, "HBHEc" , 2);
126  reportSummaryMap_->setBinLabel(15, "HF" , 2);
127  reportSummaryMap_->setBinLabel(16, "HO" , 2);
128  reportSummaryMap_->setBinLabel(17, "BPIX" , 2);
129  reportSummaryMap_->setBinLabel(18, "FPIX" , 2);
130  reportSummaryMap_->setBinLabel(19, "RPC" , 2);
131  reportSummaryMap_->setBinLabel(20, "TIBTID" , 2);
132  reportSummaryMap_->setBinLabel(21, "TOB" , 2);
133  reportSummaryMap_->setBinLabel(22, "TECp" , 2);
134  reportSummaryMap_->setBinLabel(23, "TECm" , 2);
135  reportSummaryMap_->setBinLabel(24, "CASTOR" , 2);
136  reportSummaryMap_->setBinLabel(25, "PhysDecl", 2);
137  reportSummaryMap_->setAxisTitle("Luminosity Section");
138 
139  // fill
140  for (unsigned int i = 0 ; i < DCS.size() ; i++ )
141  {
142  for ( int j = 0 ; j < 25 ; j++ )
143  {
144  if (DCS[i] & (0x1 << j))
146  else
148  }
149  }
150 
151  std::set<unsigned int>::iterator it,ite;
152  it = processedLS_.begin();
153  ite = processedLS_.end();
154  unsigned int lastAccessed = 0;
155 
156  for (; it!=ite; it++)
157  {
158  while (lastAccessed < (*it))
159  {
160  // std::cout << "Filling " << lastAccessed << " with -1" << std::endl;
161  meProcessedLS_->Fill(lastAccessed, -1.);
162  lastAccessed++;
163  }
164  // std::cout << "Filling " << *it << " with 1" << std::endl;
165  meProcessedLS_->Fill(*it);
166  lastAccessed = (*it)+1;
167  }
168 
169 }
LuminosityBlockID id() const
T getParameter(std::string const &) const
std::string dcsinfofolder_
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
void setBinContent(int binx, double content)
set content of bin (1-D)
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
void endLuminosityBlock(const edm::LuminosityBlock &l, const edm::EventSetup &c) override
std::set< unsigned int > processedLS_
edm::ParameterSet parameters_
std::string subsystemname_
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:1035
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:718
MonitorElement * meProcessedLS_
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)
ParameterSet const & getProcessParameterSetContainingModule(ModuleDescription const &moduleDescription)
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:972
void Fill(long long x)
ModuleDescription const & moduleDescription() const
Definition: EDAnalyzer.h:43
MonitorElement * bookString(const char *name, const char *value)
Book string.
Definition: DQMStore.cc:1001
DQMDcsInfoClient(const edm::ParameterSet &ps)
void removeElement(const std::string &name)
Definition: DQMStore.cc:3274
MonitorElement * reportSummary_
void endRun(const edm::Run &r, const edm::EventSetup &c) override
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
Definition: DQMStore.cc:1807
~DQMDcsInfoClient() override
std::vector< int > DCS
void analyze(const edm::Event &e, const edm::EventSetup &c) override
ParameterSet const & getParameterSet(std::string const &) const
TH1F * getTH1F(void) const
LuminosityBlockNumber_t luminosityBlock() const
MonitorElement * reportSummaryMap_
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1163
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:741
Definition: Run.h:43