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,"8 TeV",2);
85  reportSummaryMap_->setBinLabel(28,"Stable B",2);
86  reportSummaryMap_->setBinLabel(29,"Valid",2);
87  reportSummaryMap_->setAxisTitle("Luminosity Section");
88  reportSummaryMap_->getTH2F()->SetBit(TH1::kCanRebin);
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()->SetBit(TH1::kCanRebin);
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()->SetBit(TH1::kCanRebin);
125 
126  hMomentum_=dbe_->book1D("momentum","Beam Energy [GeV]",XBINS,1.,XBINS+1);
127  hMomentum_->setAxisTitle("Luminosity Section",1);
128  hMomentum_->getTH1F()->SetBit(TH1::kCanRebin);
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()->SetBit(TH1::kCanRebin);
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()->SetBit(TH1::kCanRebin);
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  {
187  {
189  for (int i=0;i<YBINS;i++)
190  {
191  float lastvalue = reportSummaryMap_->getBinContent(lastlumi_,i+1);
192  reportSummaryMap_->setBinContent(l,i+1,lastvalue);
193  }
194  }
195  else
196  {
198  for (int i=0;i<YBINS;i++)
200  }
201  }
202 
203 
204  // fill dcs vs lumi
206  for (int i=0;i<25;i++)
207  {
208  if (dcs25[i])
209  reportSummaryMap_->setBinContent(nlumi,i+1,1.);
210  else
211  reportSummaryMap_->setBinContent(nlumi,i+1,0.);
212 
213  // set next lumi to -1 for better visibility
214  if (nlumi < XBINS)
215  reportSummaryMap_->setBinContent(nlumi+1,i+1,-1.);
216  dcs25[i]=true;
217  }
218 
219  // fill physics decl. bit in y bin 26
220  if (physDecl_)
221  {
222  reportSummary_->Fill(1.);
223  reportSummaryMap_->setBinContent(nlumi,25+1,1.);
224  if (nlumi < XBINS)
225  reportSummaryMap_->setBinContent(nlumi+1,25+1,-1.);
226  }
227  else
228  {
229  reportSummary_->Fill(0.);
230  reportSummaryMap_->setBinContent(nlumi,25+1,0.);
231  if (nlumi < XBINS)
232  reportSummaryMap_->setBinContent(nlumi+1,25+1,-1.);
233  }
234 
235  // fill 7 TeV bit in y bin 27
236  if (momentum_ == 3500 || momentum_ == 4000 )
237  {
238  reportSummary_->Fill(1.);
239  reportSummaryMap_->setBinContent(nlumi,26+1,1.);
240  if (nlumi < XBINS)
241  reportSummaryMap_->setBinContent(nlumi+1,26+1,-1.);
242  }
243  else
244  {
245  reportSummary_->Fill(0.);
246  reportSummaryMap_->setBinContent(nlumi,26+1,0.);
247  if (nlumi < XBINS)
248  reportSummaryMap_->setBinContent(nlumi+1,26+1,-1.);
249  }
250 
251  // fill stable beams bit in y bin 28
252  if (beamMode_ == 11)
253  {
255  reportSummary_->Fill(1.);
256  reportSummaryMap_->setBinContent(nlumi,27+1,1.);
257  if (nlumi < XBINS)
258  reportSummaryMap_->setBinContent(nlumi+1,27+1,-1.);
259  }
260  else
261  {
262  reportSummary_->Fill(0.);
263  reportSummaryMap_->setBinContent(nlumi,27+1,0.);
264  if (nlumi < XBINS)
265  reportSummaryMap_->setBinContent(nlumi+1,27+1,-1.);
266  }
267 
268  // reset
269  physDecl_=true;
270  lastlumi_=nlumi;
271 
272  return;
273 
274 }
275 
276 void
278 {
279  dbe_->cd() ;
281 
282  // if (dbe_->get("ProvInfo/CMSSW")) return ;
283 
284  versCMSSW_ = dbe_->bookString("CMSSW",edm::getReleaseVersion().c_str() );
285  hostName_ = dbe_->bookString("hostName",gSystem->HostName());
286  workingDir_ = dbe_->bookString("workingDir",gSystem->pwd());
287  processId_ = dbe_->bookInt("processID"); processId_->Fill(gSystem->GetPid());
288 
289  //versDataset_ = dbe_->bookString("Dataset",workflow_);
290  versGlobaltag_ = dbe_->bookString("Globaltag",globalTag_);
291  versRuntype_ = dbe_->bookString("Run Type",runType_);
292 
293  isComplete_ = dbe_->bookInt("runIsComplete");
294  //isComplete_->Fill((runIsComplete_?1:0));
295  fileVersion_ = dbe_->bookInt("fileVersion");
296  //fileVersion_->Fill(version_);
297 
298  return ;
299 }
300 void
302 {
303 
305  e.getByToken(dcsStatusCollection_, dcsStatus);
306  for (DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin();
307  dcsStatusItr != dcsStatus->end(); ++dcsStatusItr)
308  {
309  // edm::LogInfo("DQMProvInfo") << "DCS status: 0x" << std::hex << dcsStatusItr->ready() << std::dec << std::endl;
310  if (!dcsStatusItr->ready(DcsStatus::CSCp)) dcs25[0]=false;
311  if (!dcsStatusItr->ready(DcsStatus::CSCm)) dcs25[1]=false;
312  if (!dcsStatusItr->ready(DcsStatus::DT0)) dcs25[2]=false;
313  if (!dcsStatusItr->ready(DcsStatus::DTp)) dcs25[3]=false;
314  if (!dcsStatusItr->ready(DcsStatus::DTm)) dcs25[4]=false;
315  if (!dcsStatusItr->ready(DcsStatus::EBp)) dcs25[5]=false;
316  if (!dcsStatusItr->ready(DcsStatus::EBm)) dcs25[6]=false;
317  if (!dcsStatusItr->ready(DcsStatus::EEp)) dcs25[7]=false;
318  if (!dcsStatusItr->ready(DcsStatus::EEm)) dcs25[8]=false;
319  if (!dcsStatusItr->ready(DcsStatus::ESp)) dcs25[9]=false;
320  if (!dcsStatusItr->ready(DcsStatus::ESm)) dcs25[10]=false;
321  if (!dcsStatusItr->ready(DcsStatus::HBHEa)) dcs25[11]=false;
322  if (!dcsStatusItr->ready(DcsStatus::HBHEb)) dcs25[12]=false;
323  if (!dcsStatusItr->ready(DcsStatus::HBHEc)) dcs25[13]=false;
324  if (!dcsStatusItr->ready(DcsStatus::HF)) dcs25[14]=false;
325  if (!dcsStatusItr->ready(DcsStatus::HO)) dcs25[15]=false;
326  if (!dcsStatusItr->ready(DcsStatus::BPIX)) dcs25[16]=false;
327  if (!dcsStatusItr->ready(DcsStatus::FPIX)) dcs25[17]=false;
328  if (!dcsStatusItr->ready(DcsStatus::RPC)) dcs25[18]=false;
329  if (!dcsStatusItr->ready(DcsStatus::TIBTID)) dcs25[19]=false;
330  if (!dcsStatusItr->ready(DcsStatus::TOB)) dcs25[20]=false;
331  if (!dcsStatusItr->ready(DcsStatus::TECp)) dcs25[21]=false;
332  if (!dcsStatusItr->ready(DcsStatus::TECm)) dcs25[22]=false;
333  if (!dcsStatusItr->ready(DcsStatus::CASTOR)) dcs25[23]=false;
334  if (!dcsStatusItr->ready(DcsStatus::ZDC)) dcs25[24]=false;
335  }
336 
337  return ;
338 }
339 void
341 {
342 
343  std::string hltKey = "";
345  bool changed( true );
346  if ( ! hltConfig.init( r, c, nameProcess_, changed) )
347  {
348  // edm::LogInfo("DQMProvInfo") << "errorHltConfigExtraction" << std::endl;
349  hltKey = "error extraction" ;
350  }
351  else if ( hltConfig.size() <= 0 )
352  {
353  // edm::LogInfo("DQMProvInfo") << "hltConfig" << std::endl;
354  hltKey = "error key of length 0" ;
355  }
356  else
357  {
358  edm::LogInfo("DQMProvInfo") << "HLT key (run) : " << hltConfig.tableName() << std::endl;
359  hltKey = hltConfig.tableName() ;
360  }
361 
362  dbe_->cd() ;
364  hHltKey_= dbe_->bookString("hltKey",hltKey);
365 
366  return ;
367 
368 }
369 void
371 {
372 
374  e.getByToken(L1gt_, gtrr_handle);
375  L1GlobalTriggerReadoutRecord const* gtrr = gtrr_handle.product();
376  L1GtFdlWord fdlWord ;
377  if (gtrr)
378  fdlWord = gtrr->gtFdlWord();
379  else
380  {
381  edm::LogWarning("DQMProvInfo") << " phys decl. bit not accessible !!!" ;
382  physDecl_=false;
383  return;
384  }
385  // cout << "phys decl. bit =" << static_cast<int>(fdlWord.physicsDeclared()) << endl;
386  if (fdlWord.physicsDeclared() !=1) physDecl_=false;
387 
388 
389  //
391  e.getByToken(L1gtEvm_, gtEvm_handle);
392  L1GlobalTriggerEvmReadoutRecord const* gtevm = gtEvm_handle.product();
393 
394  L1GtfeWord gtfeEvmWord;
395  L1GtfeExtWord gtfeEvmExtWord;
396  if (gtevm)
397  {
398  gtfeEvmWord = gtevm->gtfeWord();
399  gtfeEvmExtWord = gtevm->gtfeWord();
400  }
401  else
402  edm::LogInfo("DQMProvInfo") << " gtfeEvmWord inaccessible" ;
403 
404  lhcFill_ = gtfeEvmExtWord.lhcFillNumber();
405  beamMode_ = gtfeEvmExtWord.beamMode();
406  momentum_ = gtfeEvmExtWord.beamMomentum();
407  intensity1_ = gtfeEvmExtWord.totalIntensityBeam1();
408  intensity2_ = gtfeEvmExtWord.totalIntensityBeam2();
409 
410  edm::LogInfo("DQMProvInfo") << lhcFill_ << " " << beamMode_ << " "
411  << momentum_ << " "
412  << intensity1_ << " " << intensity2_
413  << std::endl;
414 
415  return;
416 }
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:91
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:942
MonitorElement * hMomentum_
Definition: DQMProvInfo.h:95
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
MonitorElement * workingDir_
Hostname of the local machine.
Definition: DQMProvInfo.h:88
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:632
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:340
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:301
static const int XBINS
Definition: DQMProvInfo.cc:19
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:879
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:908
MonitorElement * isComplete_
The PID associated with this job.
Definition: DQMProvInfo.h:90
void makeProvInfo()
Definition: DQMProvInfo.cc:277
void makeGtInfo(const edm::Event &e)
Definition: DQMProvInfo.cc:370
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
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
T const * product() const
Definition: Handle.h:81
std::string runType_
Definition: DQMProvInfo.h:61
return(e1-e2)*(e1-e2)+dp *dp
DQMProvInfo(const edm::ParameterSet &ps)
Constructor.
Definition: DQMProvInfo.cc:22
double getBinContent(int binx) const
get content of bin (1-D)
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:849
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:1070
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:655
Definition: Run.h:41
MonitorElement * reportSummaryMap_
Definition: DQMProvInfo.h:103
edm::ParameterSet parameters_
Definition: DQMProvInfo.h:56