CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DQMProvInfo.cc
Go to the documentation of this file.
1 /*
2  * \file DQMProvInfo.cc
3  * \author A.Raval / A.Meyer - DESY
4  * Last Update:
5  *
6  */
7 
8 #include "DQMProvInfo.h"
9 #include <TSystem.h>
18 
19 const static int XBINS=2500;
20 const static int YBINS=28;
21 
23 
24  parameters_ = ps;
25 
27  globalTag_ = "MODULE::DEFAULT";
28  runType_ = parameters_.getUntrackedParameter<std::string>("runType", "No run type selected") ;
29  provinfofolder_ = parameters_.getUntrackedParameter<std::string>("provInfoFolder", "ProvInfo") ;
30  subsystemname_ = parameters_.getUntrackedParameter<std::string>("subSystemFolder", "Info") ;
31  L1gt_ = consumes<L1GlobalTriggerReadoutRecord>(parameters_.getUntrackedParameter<std::string>("L1gt","gtDigis"));
32  L1gtEvm_ = consumes<L1GlobalTriggerEvmReadoutRecord>(parameters_.getUntrackedParameter<std::string>("L1gtEvm","gtEvmDigis"));
33  dcsStatusCollection_ = consumes<DcsStatusCollection>(parameters_.getUntrackedParameter<std::string>("dcsStatusCollection","scalersRawToDigi"));
34 
35  // initialize
36  nameProcess_ = "HLT"; // the process name is not contained in this ps
38  physDecl_=true; // set true and switch off in case a single event in a given LS does not have it set.
39  for (int i=0;i<25;i++) dcs25[i]=true;
40  lastlumi_=0;
41 }
42 
44 }
45 
46 void
48 
49  makeProvInfo();
50  makeHLTKeyInfo(r,c);
51 
52  dbe_->cd();
53  dbe_->setCurrentFolder(subsystemname_ +"/EventInfo/");
54 
55  reportSummary_=dbe_->bookFloat("reportSummary");
56  reportSummaryMap_ = dbe_->book2D("reportSummaryMap",
57  "HV and Beam Status vs Lumi", XBINS, 1., XBINS+1, YBINS+1, 0., YBINS+1);
58  reportSummaryMap_->setBinLabel(1," CSC+",2);
59  reportSummaryMap_->setBinLabel(2," CSC-",2);
60  reportSummaryMap_->setBinLabel(3," DT0",2);
61  reportSummaryMap_->setBinLabel(4," DT+",2);
62  reportSummaryMap_->setBinLabel(5," DT-",2);
63  reportSummaryMap_->setBinLabel(6," EB+",2);
64  reportSummaryMap_->setBinLabel(7," EB-",2);
65  reportSummaryMap_->setBinLabel(8," EE+",2);
66  reportSummaryMap_->setBinLabel(9," EE-",2);
67  reportSummaryMap_->setBinLabel(10,"ES+",2);
68  reportSummaryMap_->setBinLabel(11,"ES-",2);
69  reportSummaryMap_->setBinLabel(12,"HBHEa",2);
70  reportSummaryMap_->setBinLabel(13,"HBHEb",2);
71  reportSummaryMap_->setBinLabel(14,"HBHEc",2);
72  reportSummaryMap_->setBinLabel(15,"HF",2);
73  reportSummaryMap_->setBinLabel(16,"HO",2);
74  reportSummaryMap_->setBinLabel(17,"BPIX",2);
75  reportSummaryMap_->setBinLabel(18,"FPIX",2);
76  reportSummaryMap_->setBinLabel(19,"RPC",2);
77  reportSummaryMap_->setBinLabel(20,"TIBTID",2);
78  reportSummaryMap_->setBinLabel(21,"TOB",2);
79  reportSummaryMap_->setBinLabel(22,"TECp",2);
80  reportSummaryMap_->setBinLabel(23,"TECm",2);
81  reportSummaryMap_->setBinLabel(24,"CASTOR",2);
82  reportSummaryMap_->setBinLabel(25,"ZDC",2);
83  reportSummaryMap_->setBinLabel(26,"PhysDecl",2);
84  reportSummaryMap_->setBinLabel(27,"13 TeV",2);
85  reportSummaryMap_->setBinLabel(28,"Stable B",2);
86  reportSummaryMap_->setBinLabel(29,"Valid",2);
87  reportSummaryMap_->setAxisTitle("Luminosity Section");
88  reportSummaryMap_->getTH2F()->SetCanExtend(TH1::kAllAxes);
89 
90  dbe_->cd();
91  dbe_->setCurrentFolder(subsystemname_ +"/LhcInfo/");
92  hBeamMode_=dbe_->book1D("beamMode","beamMode",XBINS,1.,XBINS+1);
93  hBeamMode_->getTH1F()->GetYaxis()->Set(21,0.5,21.5);
94  hBeamMode_->getTH1F()->SetMaximum(21.5);
95  hBeamMode_->getTH1F()->SetCanExtend(TH1::kAllAxes);
96 
97  hBeamMode_->setAxisTitle("Luminosity Section",1);
98  hBeamMode_->setBinLabel(1,"no mode",2);
99  hBeamMode_->setBinLabel(2,"setup",2);
100  hBeamMode_->setBinLabel(3,"inj pilot",2);
101  hBeamMode_->setBinLabel(4,"inj intr",2);
102  hBeamMode_->setBinLabel(5,"inj nomn",2);
103  hBeamMode_->setBinLabel(6,"pre ramp",2);
104  hBeamMode_->setBinLabel(7,"ramp",2);
105  hBeamMode_->setBinLabel(8,"flat top",2);
106  hBeamMode_->setBinLabel(9,"squeeze",2);
107  hBeamMode_->setBinLabel(10,"adjust",2);
108  hBeamMode_->setBinLabel(11,"stable",2);
109  hBeamMode_->setBinLabel(12,"unstable",2);
110  hBeamMode_->setBinLabel(13,"beam dump",2);
111  hBeamMode_->setBinLabel(14,"ramp down",2);
112  hBeamMode_->setBinLabel(15,"recovery",2);
113  hBeamMode_->setBinLabel(16,"inj dump",2);
114  hBeamMode_->setBinLabel(17,"circ dump",2);
115  hBeamMode_->setBinLabel(18,"abort",2);
116  hBeamMode_->setBinLabel(19,"cycling",2);
117  hBeamMode_->setBinLabel(20,"warn b-dump",2);
118  hBeamMode_->setBinLabel(21,"no beam",2);
119  hBeamMode_->setBinContent(0.,22.);
120 
121 
122  hLhcFill_=dbe_->book1D("lhcFill","LHC Fill Number",XBINS,1.,XBINS+1);
123  hLhcFill_->setAxisTitle("Luminosity Section",1);
124  hLhcFill_->getTH1F()->SetCanExtend(TH1::kAllAxes);
125 
126  hMomentum_=dbe_->book1D("momentum","Beam Energy [GeV]",XBINS,1.,XBINS+1);
127  hMomentum_->setAxisTitle("Luminosity Section",1);
128  hMomentum_->getTH1F()->SetCanExtend(TH1::kAllAxes);
129 
130  hIntensity1_=dbe_->book1D("intensity1","Intensity Beam 1",XBINS,1.,XBINS+1);
131  hIntensity1_->setAxisTitle("Luminosity Section",1);
132  hIntensity1_->setAxisTitle("N [E10]",2);
133  hIntensity1_->getTH1F()->SetCanExtend(TH1::kAllAxes);
134  hIntensity2_=dbe_->book1D("intensity2","Intensity Beam 2",XBINS,1.,XBINS+1);
135  hIntensity2_->setAxisTitle("Luminosity Section",1);
136  hIntensity2_->setAxisTitle("N [E10]",2);
137  hIntensity2_->getTH1F()->SetCanExtend(TH1::kAllAxes);
138 
139  dbe_->cd();
140  dbe_->setCurrentFolder(subsystemname_ +"/ProvInfo/");
141  hIsCollisionsRun_ = dbe_->bookInt("isCollisionsRun");
143 
144  // initialize
145  physDecl_=true;
146  for (int i=0;i<25;i++) dcs25[i]=true;
147  lastlumi_=0;
148 }
149 
154  //fetch the real process name
155  nameProcess_ = e.processHistory()[e.processHistory().size()-1].processName();
157  globalTag_ = ps.getParameterSet("PoolDBESSource@GlobalTag").getParameter<std::string>("globaltag");
159  }
160 
161  makeDcsInfo(e);
162  makeGtInfo(e);
163 
164  return;
165 }
166 
167 void
169 {
170 
171  int nlumi = l.id().luminosityBlock();
172 
173  edm::LogInfo("DQMProvInfo") << "nlumi: " << nlumi << " / number of bins: " << hBeamMode_->getTH1F()->GetNbinsX() << std::endl;
174 
175  if (nlumi <= lastlumi_ ) return;
176 
182 
183  // set to previous in case there was a jump or no previous fill
184  for (int l=lastlumi_+1;l<nlumi;l++)
185  {
186  // setting valid flag to zero for missed LSs
188  // setting all other bins to -1 for missed LSs
189  for (int i=0;i<YBINS;i++)
191  }
192 
193 
194  // fill dcs vs lumi
196  for (int i=0;i<25;i++)
197  {
198  if (dcs25[i])
199  reportSummaryMap_->setBinContent(nlumi,i+1,1.);
200  else
201  reportSummaryMap_->setBinContent(nlumi,i+1,0.);
202 
203  // set next lumi to -1 for better visibility
204  if (nlumi < XBINS)
205  reportSummaryMap_->setBinContent(nlumi+1,i+1,-1.);
206  dcs25[i]=true;
207  }
208 
209  // fill physics decl. bit in y bin 26
210  if (physDecl_)
211  {
212  reportSummary_->Fill(1.);
213  reportSummaryMap_->setBinContent(nlumi,25+1,1.);
214  if (nlumi < XBINS)
215  reportSummaryMap_->setBinContent(nlumi+1,25+1,-1.);
216  }
217  else
218  {
219  reportSummary_->Fill(0.);
220  reportSummaryMap_->setBinContent(nlumi,25+1,0.);
221  if (nlumi < XBINS)
222  reportSummaryMap_->setBinContent(nlumi+1,25+1,-1.);
223  }
224 
225  // fill 7 TeV bit in y bin 27
226  if (momentum_ == 3500 || momentum_ == 4000 )
227  {
228  reportSummary_->Fill(1.);
229  reportSummaryMap_->setBinContent(nlumi,26+1,1.);
230  if (nlumi < XBINS)
231  reportSummaryMap_->setBinContent(nlumi+1,26+1,-1.);
232  }
233  else
234  {
235  reportSummary_->Fill(0.);
236  reportSummaryMap_->setBinContent(nlumi,26+1,0.);
237  if (nlumi < XBINS)
238  reportSummaryMap_->setBinContent(nlumi+1,26+1,-1.);
239  }
240 
241  // fill stable beams bit in y bin 28
242  if (beamMode_ == 11)
243  {
245  reportSummary_->Fill(1.);
246  reportSummaryMap_->setBinContent(nlumi,27+1,1.);
247  if (nlumi < XBINS)
248  reportSummaryMap_->setBinContent(nlumi+1,27+1,-1.);
249  }
250  else
251  {
252  reportSummary_->Fill(0.);
253  reportSummaryMap_->setBinContent(nlumi,27+1,0.);
254  if (nlumi < XBINS)
255  reportSummaryMap_->setBinContent(nlumi+1,27+1,-1.);
256  }
257 
258  // reset
259  physDecl_=true;
260  lastlumi_=nlumi;
261 
262  return;
263 
264 }
265 
266 void
268 {
269  dbe_->cd() ;
271 
272  // if (dbe_->get("ProvInfo/CMSSW")) return ;
273 
274  versCMSSW_ = dbe_->bookString("CMSSW",edm::getReleaseVersion().c_str() );
275  hostName_ = dbe_->bookString("hostName",gSystem->HostName());
276  workingDir_ = dbe_->bookString("workingDir",gSystem->pwd());
277  processId_ = dbe_->bookInt("processID"); processId_->Fill(gSystem->GetPid());
278 
279  //versDataset_ = dbe_->bookString("Dataset",workflow_);
280  versGlobaltag_ = dbe_->bookString("Globaltag",globalTag_);
281  versRuntype_ = dbe_->bookString("Run Type",runType_);
282 
283  isComplete_ = dbe_->bookInt("runIsComplete");
284  //isComplete_->Fill((runIsComplete_?1:0));
285  fileVersion_ = dbe_->bookInt("fileVersion");
286  //fileVersion_->Fill(version_);
287 
288  return ;
289 }
290 void
292 {
293 
295  e.getByToken(dcsStatusCollection_, dcsStatus);
296  for (DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin();
297  dcsStatusItr != dcsStatus->end(); ++dcsStatusItr)
298  {
299  // edm::LogInfo("DQMProvInfo") << "DCS status: 0x" << std::hex << dcsStatusItr->ready() << std::dec << std::endl;
300  if (!dcsStatusItr->ready(DcsStatus::CSCp)) dcs25[0]=false;
301  if (!dcsStatusItr->ready(DcsStatus::CSCm)) dcs25[1]=false;
302  if (!dcsStatusItr->ready(DcsStatus::DT0)) dcs25[2]=false;
303  if (!dcsStatusItr->ready(DcsStatus::DTp)) dcs25[3]=false;
304  if (!dcsStatusItr->ready(DcsStatus::DTm)) dcs25[4]=false;
305  if (!dcsStatusItr->ready(DcsStatus::EBp)) dcs25[5]=false;
306  if (!dcsStatusItr->ready(DcsStatus::EBm)) dcs25[6]=false;
307  if (!dcsStatusItr->ready(DcsStatus::EEp)) dcs25[7]=false;
308  if (!dcsStatusItr->ready(DcsStatus::EEm)) dcs25[8]=false;
309  if (!dcsStatusItr->ready(DcsStatus::ESp)) dcs25[9]=false;
310  if (!dcsStatusItr->ready(DcsStatus::ESm)) dcs25[10]=false;
311  if (!dcsStatusItr->ready(DcsStatus::HBHEa)) dcs25[11]=false;
312  if (!dcsStatusItr->ready(DcsStatus::HBHEb)) dcs25[12]=false;
313  if (!dcsStatusItr->ready(DcsStatus::HBHEc)) dcs25[13]=false;
314  if (!dcsStatusItr->ready(DcsStatus::HF)) dcs25[14]=false;
315  if (!dcsStatusItr->ready(DcsStatus::HO)) dcs25[15]=false;
316  if (!dcsStatusItr->ready(DcsStatus::BPIX)) dcs25[16]=false;
317  if (!dcsStatusItr->ready(DcsStatus::FPIX)) dcs25[17]=false;
318  if (!dcsStatusItr->ready(DcsStatus::RPC)) dcs25[18]=false;
319  if (!dcsStatusItr->ready(DcsStatus::TIBTID)) dcs25[19]=false;
320  if (!dcsStatusItr->ready(DcsStatus::TOB)) dcs25[20]=false;
321  if (!dcsStatusItr->ready(DcsStatus::TECp)) dcs25[21]=false;
322  if (!dcsStatusItr->ready(DcsStatus::TECm)) dcs25[22]=false;
323  if (!dcsStatusItr->ready(DcsStatus::CASTOR)) dcs25[23]=false;
324  if (!dcsStatusItr->ready(DcsStatus::ZDC)) dcs25[24]=false;
325  }
326 
327  return ;
328 }
329 void
331 {
332 
333  std::string hltKey = "";
335  bool changed( true );
336  if ( ! hltConfig.init( r, c, nameProcess_, changed) )
337  {
338  // edm::LogInfo("DQMProvInfo") << "errorHltConfigExtraction" << std::endl;
339  hltKey = "error extraction" ;
340  }
341  else if ( hltConfig.size() <= 0 )
342  {
343  // edm::LogInfo("DQMProvInfo") << "hltConfig" << std::endl;
344  hltKey = "error key of length 0" ;
345  }
346  else
347  {
348  edm::LogInfo("DQMProvInfo") << "HLT key (run) : " << hltConfig.tableName() << std::endl;
349  hltKey = hltConfig.tableName() ;
350  }
351 
352  dbe_->cd() ;
354  hHltKey_= dbe_->bookString("hltKey",hltKey);
355 
356  return ;
357 
358 }
359 void
361 {
362 
364  e.getByToken(L1gt_, gtrr_handle);
365  L1GlobalTriggerReadoutRecord const* gtrr = gtrr_handle.product();
366  L1GtFdlWord fdlWord ;
367  if (gtrr)
368  fdlWord = gtrr->gtFdlWord();
369  else
370  {
371  edm::LogWarning("DQMProvInfo") << " phys decl. bit not accessible !!!" ;
372  physDecl_=false;
373  return;
374  }
375  // cout << "phys decl. bit =" << static_cast<int>(fdlWord.physicsDeclared()) << endl;
376  if (fdlWord.physicsDeclared() !=1) physDecl_=false;
377 
378 
379  //
381  e.getByToken(L1gtEvm_, gtEvm_handle);
382  L1GlobalTriggerEvmReadoutRecord const* gtevm = gtEvm_handle.product();
383 
384  L1GtfeWord gtfeEvmWord;
385  L1GtfeExtWord gtfeEvmExtWord;
386  if (gtevm)
387  {
388  gtfeEvmWord = gtevm->gtfeWord();
389  gtfeEvmExtWord = gtevm->gtfeWord();
390  }
391  else
392  edm::LogInfo("DQMProvInfo") << " gtfeEvmWord inaccessible" ;
393 
394  lhcFill_ = gtfeEvmExtWord.lhcFillNumber();
395  beamMode_ = gtfeEvmExtWord.beamMode();
396  momentum_ = gtfeEvmExtWord.beamMomentum();
397  intensity1_ = gtfeEvmExtWord.totalIntensityBeam1();
398  intensity2_ = gtfeEvmExtWord.totalIntensityBeam2();
399 
400  edm::LogInfo("DQMProvInfo") << lhcFill_ << " " << beamMode_ << " "
401  << momentum_ << " "
402  << intensity1_ << " " << intensity2_
403  << std::endl;
404 
405  return;
406 }
unsigned int size() const
number of trigger paths in trigger table
LuminosityBlockID id() const
bool getProcessParameterSet(std::string const &processName, ParameterSet &ps) const
Definition: Event.cc:93
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * hBeamMode_
Definition: DQMProvInfo.h:93
size_type size() const
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * hIntensity2_
Definition: DQMProvInfo.h:97
MonitorElement * reportSummary_
Definition: DQMProvInfo.h:102
MonitorElement * fileVersion_
Definition: DQMProvInfo.h:91
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:1006
MonitorElement * hMomentum_
Definition: DQMProvInfo.h:95
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
MonitorElement * workingDir_
Hostname of the local machine.
Definition: DQMProvInfo.h:88
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:696
edm::EDGetTokenT< DcsStatusCollection > dcsStatusCollection_
Definition: DQMProvInfo.h:65
const L1GtfeExtWord gtfeWord() const
get / set GTFE word (record) in the GT readout record
void makeHLTKeyInfo(const edm::Run &r, const edm::EventSetup &c)
Definition: DQMProvInfo.cc:330
int intensity2_
Definition: DQMProvInfo.h:76
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)
bool gotProcessParameterSet_
Definition: DQMProvInfo.h:69
void endLuminosityBlock(const edm::LuminosityBlock &l, const edm::EventSetup &c)
Definition: DQMProvInfo.cc:168
const std::string & tableName() const
HLT ConfDB table name.
MonitorElement * processId_
Current working directory of the job.
Definition: DQMProvInfo.h:89
static const int YBINS
Definition: DQMProvInfo.cc:20
MonitorElement * hHltKey_
Definition: DQMProvInfo.h:100
MonitorElement * versGlobaltag_
Definition: DQMProvInfo.h:84
std::string nameProcess_
Definition: DQMProvInfo.h:62
void makeDcsInfo(const edm::Event &e)
Definition: DQMProvInfo.cc:291
static const int XBINS
Definition: DQMProvInfo.cc:19
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:943
return((rh^lh)&mask)
void Fill(long long x)
const cms_uint16_t beamMomentum() const
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
Definition: DQMProvInfo.cc:150
std::string globalTag_
Definition: DQMProvInfo.h:60
MonitorElement * versRuntype_
Definition: DQMProvInfo.h:85
MonitorElement * bookString(const char *name, const char *value)
Book string.
Definition: DQMStore.cc:972
MonitorElement * isComplete_
The PID associated with this job.
Definition: DQMProvInfo.h:90
void makeProvInfo()
Definition: DQMProvInfo.cc:267
void makeGtInfo(const edm::Event &e)
Definition: DQMProvInfo.cc:360
std::string subsystemname_
Definition: DQMProvInfo.h:59
const cms_uint32_t totalIntensityBeam2() const
virtual ProcessHistory const & processHistory() const
Definition: Event.cc:185
int intensity1_
Definition: DQMProvInfo.h:75
MonitorElement * hLhcFill_
Definition: DQMProvInfo.h:94
const cms_uint32_t totalIntensityBeam1() const
std::string getReleaseVersion()
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > L1gtEvm_
Definition: DQMProvInfo.h:64
DQMStore * dbe_
Definition: DQMProvInfo.h:54
virtual ~DQMProvInfo()
Destructor.
Definition: DQMProvInfo.cc:43
T const * product() const
Definition: Handle.h:81
const L1GtFdlWord gtFdlWord(int bxInEventValue) const
get / set FDL word (record) in the GT readout record
const cms_uint32_t lhcFillNumber() const
ParameterSet const & getParameterSet(std::string const &) const
bool physDecl_
Definition: DQMProvInfo.h:67
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
MonitorElement * hIntensity1_
Definition: DQMProvInfo.h:96
const cms_uint16_t physicsDeclared() const
get/set &quot;physics declared&quot; bit
Definition: L1GtFdlWord.h:227
TH1F * getTH1F(void) const
LuminosityBlockNumber_t luminosityBlock() const
MonitorElement * versCMSSW_
Definition: DQMProvInfo.h:81
MonitorElement * hIsCollisionsRun_
Definition: DQMProvInfo.h:99
std::string runType_
Definition: DQMProvInfo.h:61
DQMProvInfo(const edm::ParameterSet &ps)
Constructor.
Definition: DQMProvInfo.cc:22
void beginRun(const edm::Run &r, const edm::EventSetup &c)
Definition: DQMProvInfo.cc:47
std::string provinfofolder_
Definition: DQMProvInfo.h:58
TH2F * getTH2F(void) const
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:913
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:1134
bool dcs25[25]
Definition: DQMProvInfo.h:68
MonitorElement * hostName_
Definition: DQMProvInfo.h:86
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
const cms_uint16_t beamMode() const
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > L1gt_
Definition: DQMProvInfo.h:63
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:719
Definition: Run.h:41
MonitorElement * reportSummaryMap_
Definition: DQMProvInfo.h:103
edm::ParameterSet parameters_
Definition: DQMProvInfo.h:56