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