CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OccupancyPlotter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: OccupancyPlotter
4 // Class: OccupancyPlotter
5 //
13 //
14 // Original Author: Jason Michael Slaunwhite,512 1-008,`+41227670494,
15 // Created: Fri Aug 5 10:34:47 CEST 2011
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
25 
32 
33 
41 
43 
44 #include "TMath.h"
45 
46 #include "TStyle.h"
47 //
48 // class declaration
49 //
50 
51 using namespace edm;
52 using namespace trigger;
53 using std::vector;
54 using std::string;
55 
56 
58  public:
59  explicit OccupancyPlotter(const edm::ParameterSet&);
61 
62  //static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
63 
64 
65  private:
66  virtual void beginJob() override ;
67  virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
68  virtual void endJob() override ;
69 
70  virtual void beginRun(edm::Run const&, edm::EventSetup const&) override;
71  virtual void endRun(edm::Run const&, edm::EventSetup const&) override;
72  virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
73  virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
74  virtual void setupHltMatrix(std::string, int);
75  virtual void fillHltMatrix(std::string, std::string, double, double, bool);
76 
77  // a method to unpack the dcs info
78  bool checkDcsInfo (const edm::Event & jEvent);
79 
80  void checkLumiInfo (const edm::Event & jEvent);
81 
82  // ----------member data ---------------------------
83 
84 
85  bool debugPrint;
87 
89 
91 
93 
94  vector< vector<string> > PDsVectorPathsVector;
95 
96  // Lumi info
97  float _instLumi;
99  float _pileup;
100 
101  // Store the HV info
102  bool dcs[25];
104 
105  // counters
106  int cntevt;
107  int cntBadHV;
108 
109  // histograms
111  TH1F * hist_PUvsLS;
112 
113  //set Token(-s)
118 };
119 
120 //
121 // constants, enums and typedefs
122 //
123 
124 //
125 // static data member definitions
126 //
127 
128 //
129 // constructors and destructor
130 //
132 
133 {
134  //now do what ever initialization is needed
135 
136  debugPrint = false;
137  outputPrint = false;
138  thisiLumiValue = false;
139  cntevt=0;
140  cntBadHV=0;
141  if (debugPrint) std::cout << "Inside Constructor" << std::endl;
142 
143  plotDirectoryName = iConfig.getUntrackedParameter<std::string>("dirname", "HLT/Test");
144 
145  if (debugPrint) std::cout << "Got plot dirname = " << plotDirectoryName << std::endl;
146 
147  //set Token(-s)
148  triggerResultsToken_ = consumes<edm::TriggerResults>(InputTag("TriggerResults","", "HLT"));
149  aodTriggerToken_ = consumes<trigger::TriggerEvent>(InputTag("hltTriggerSummaryAOD", "", "HLT"));
150  dcsStatusToken_ = consumes<DcsStatusCollection>(std::string("hltScalersRawToDigi"));
151  lumiScalersToken_ = consumes<LumiScalersCollection>(InputTag("hltScalersRawToDigi","",""));
152 }
153 
154 
156 {
157 
158  // do anything here that needs to be done at desctruction time
159  // (e.g. close files, deallocate resources etc.)
160 
161 }
162 
163 
164 //
165 // member functions
166 //
167 
168 // ------------ method called for each event ------------
169 void
171 {
172  using namespace edm;
173  using std::string;
174  int lumisection = (int)iEvent.luminosityBlock();
175 
176  if (debugPrint) std::cout << "Inside analyze" << std::endl;
177  ++cntevt;
178  if (cntevt % 10000 == 0) std::cout << "[OccupancyPlotter::analyze] Received event " << cntevt << std::endl;
179  // === Check the HV and the lumi
180  bool highVoltageOK = checkDcsInfo ( iEvent );
181  if (!highVoltageOK) {
182  if (debugPrint) std::cout << "Skipping event: DCS problem\n";
183  ++cntBadHV;
184  return;
185  }
186  checkLumiInfo( iEvent);
187 
188  if (debugPrint) std::cout << "instantaneous luminosity=" << _instLumi << " ± " << _instLumi_err << std::endl;
189 
190  if (thisiLumiValue){
191  thisiLumiValue = false;
192  std::cout << "LS = " << lumisection << ", Lumi = " << _instLumi << " ± " << _instLumi_err << ", pileup = " << _pileup << std::endl;
193 
194  hist_LumivsLS = dbe->get("HLT/OccupancyPlots/HLT_LumivsLS")->getTH1F();
195  hist_LumivsLS->SetBinContent(lumisection+1,_instLumi);
196  hist_LumivsLS->SetBinError(lumisection+1,_instLumi_err);
197  //
198  hist_PUvsLS = dbe->get("HLT/OccupancyPlots/HLT_PUvsLS")->getTH1F();
199  hist_PUvsLS->SetBinContent(lumisection+1,_pileup);
200 
201  }
202 
203  // Access Trigger Results
206 
207  if (!triggerResults.isValid()) {
208  if (debugPrint) std::cout << "Trigger results not valid" << std::endl;
209  return; }
210 
211  if (debugPrint) std::cout << "Found triggerResults" << std::endl;
212 
213  edm::Handle<trigger::TriggerEvent> aodTriggerEvent;
214  iEvent.getByToken(aodTriggerToken_, aodTriggerEvent);
215 
216  if ( !aodTriggerEvent.isValid() ) {
217  if (debugPrint) std::cout << "No AOD trigger summary found! Returning...";
218  return;
219  }
220 
221  const TriggerObjectCollection objects = aodTriggerEvent->getObjects();
222 
223 
224  vector<string> datasetNames = hltConfig_.streamContent("A");
225 // Loop over PDs
226  for (unsigned int iPD = 0; iPD < datasetNames.size(); iPD++) {
227 
228  // if (datasetNames[iPD] != "SingleMu" && datasetNames[iPD] != "SingleElectron" && datasetNames[iPD] != "Jet") continue;
229 
230  unsigned int keyTracker[1000]; // Array to eliminate double counts by tracking what Keys have already been fired
231  for(unsigned int irreproduceableIterator = 0; irreproduceableIterator < 1000; irreproduceableIterator++) {
232  keyTracker[irreproduceableIterator] = 1001;
233  }
234 // Loop over Paths in each PD
235  for (unsigned int iPath = 0; iPath < PDsVectorPathsVector[iPD].size(); iPath++) { //Andrew - where does PDsVectorPathsVector get defined?
236 
237  std::string pathName = PDsVectorPathsVector[iPD][iPath];
238 
239  if (debugPrint) std::cout << "Looking at path " << pathName << std::endl;
240 
241  unsigned int index = hltConfig_.triggerIndex(pathName);
242 
243  if (debugPrint) std::cout << "Index = " << index << " triggerResults->size() = " << triggerResults->size() << std::endl;
244 
245  if (index < triggerResults->size()) {
246  if(triggerResults->accept(index)) {
247 
248  if (debugPrint) std::cout << "We fired path " << pathName << std::endl;
249 
250  // look up module labels for this path
251 
252  vector<std::string> modulesThisPath = hltConfig_.moduleLabels(pathName);
253 
254  if (debugPrint) std::cout << "Looping over module labels " << std::endl;
255 
256  // Loop backward through module names
257  for ( int iModule = (modulesThisPath.size()-1); iModule >= 0; iModule--) {
258 
259  if (debugPrint) std::cout << "Module name is " << modulesThisPath[iModule] << std::endl;
260 
261  // check to see if you have savetags information
262  if (hltConfig_.saveTags(modulesThisPath[iModule])) {
263 
264  if (debugPrint) std::cout << "For path " << pathName << " this module " << modulesThisPath[iModule] <<" is a saveTags module of type " << hltConfig_.moduleType(modulesThisPath[iModule]) << std::endl;
265 
266  if (hltConfig_.moduleType(modulesThisPath[iModule]) == "HLTLevel1GTSeed") break;
267 
268  InputTag moduleWhoseResultsWeWant(modulesThisPath[iModule], "", "HLT");
269 
270  unsigned int indexOfModuleInAodTriggerEvent = aodTriggerEvent->filterIndex(moduleWhoseResultsWeWant);
271 
272  if ( indexOfModuleInAodTriggerEvent < aodTriggerEvent->sizeFilters() ) {
273  const Keys &keys = aodTriggerEvent->filterKeys( indexOfModuleInAodTriggerEvent );
274  if (debugPrint) std::cout << "Got Keys for index " << indexOfModuleInAodTriggerEvent <<", size of keys is " << keys.size() << std::endl;
275 
276  for ( size_t iKey = 0; iKey < keys.size(); iKey++ ) {
277  TriggerObject foundObject = objects[keys[iKey]];
278  bool first_count = false;
279 
280  if(keyTracker[iKey] != iKey) first_count = true;
281 
282  if (debugPrint || outputPrint) std::cout << "This object has (pt, eta, phi) = "
283  << std::setw(10) << foundObject.pt()
284  << ", " << std::setw(10) << foundObject.eta()
285  << ", " << std::setw(10) << foundObject.phi()
286  << " for path = " << std::setw(20) << pathName
287  << " module " << std::setw(40) << modulesThisPath[iModule]
288  << " iKey " << iKey << std::endl;
289 
290  fillHltMatrix(datasetNames[iPD],pathName,foundObject.eta(),foundObject.phi(),first_count);
291 
292  keyTracker[iKey] = iKey;
293 
294 
295  }// end for each key
296  }// end if filter in aodTriggerEvent
297 
298 
299  // OK, we found the last module. No need to look at the others.
300  // get out of the loop
301 
302  break;
303  }// end if saveTags
304  }//end Loop backward through module names
305  }// end if(triggerResults->accept(index))
306  }// end if (index < triggerResults->size())
307  }// end Loop over Paths in each PD
308  }//end Loop over PDs
309 
310 
311 
312 
313 }
314 
315 
316 // ------------ method called once each job just before starting event loop ------------
317 void
319 {
320 
321  if (debugPrint) std::cout << "Inside begin job" << std::endl;
322 
323  dbe = Service<DQMStore>().operator->();
324 
325  if (dbe) {
326 
327  dbe->setCurrentFolder(plotDirectoryName);
328 
329  }
330 
331 }
332 
333 // ------------ method called once each job just after ending the event loop ------------
334 void
336 {
337 }
338 
339 // ------------ method called when starting to processes a run ------------
340 void
342 {
343 
344  if (debugPrint) std::cout << "Inside beginRun" << std::endl;
345 
346  bool changed = true;
347  if (hltConfig_.init(iRun, iSetup, "HLT", changed)) {
348  if(debugPrint)
349  if(debugPrint) std::cout << "HLT config with process name "
350  << "HLT" << " successfully extracted" << std::endl;
351  } else {
352  if (debugPrint)
353  if (debugPrint) std::cout << "Warning, didn't find process HLT" << std::endl;
354  }
355 
356  vector<string> datasetNames = hltConfig_.streamContent("A");
357  for (unsigned int i=0;i<datasetNames.size();i++) {
358 
359  if (debugPrint) std::cout << "This is dataset " << datasetNames[i] <<std::endl;
360 
361  vector<string> datasetPaths = hltConfig_.datasetContent(datasetNames[i]);
362 
363  if (debugPrint) std::cout << "datasetPaths.size() = " << datasetPaths.size() << std::endl;
364 
365  PDsVectorPathsVector.push_back(datasetPaths);
366 
367  if (debugPrint) std::cout <<"Found PD: " << datasetNames[i] << std::endl;
368  setupHltMatrix(datasetNames[i],i);
369  int maxLumisection=1000;
370  dbe->setCurrentFolder("HLT/OccupancyPlots/");
371  hist_LumivsLS = new TH1F("HLT_LumivsLS", "; Lumisection; Instantaneous Luminosity (cm^{-2} s^{-1})",maxLumisection,0,maxLumisection);
372  dbe->book1D("HLT_LumivsLS", hist_LumivsLS);
373  hist_PUvsLS = new TH1F("HLT_PUvsLS", "; Lumisection; Pileup",maxLumisection,0,maxLumisection);
374  dbe->book1D("HLT_PUvsLS", hist_PUvsLS);
375 
376  }// end of loop over dataset names
377 
378 }// end of beginRun
379 
380 // ------------ method called when ending the processing of a run ------------
382 {
383  std::cout << "[OccupancyPlotter::endRun] Total events received=" << cntevt << ", events with HV problem=" << cntBadHV << std::endl;
384 }
385 
387 
388 std::string h_name;
389 std::string h_title;
390 std::string h_name_1dEta;
391 std::string h_name_1dPhi;
392 std::string h_title_1dEta;
393 std::string h_title_1dPhi;
394 std::string h_name_1dEtaPath;
395 std::string h_name_1dPhiPath;
396 std::string h_title_1dEtaPath;
397 std::string h_title_1dPhiPath;
399 std::string PD_Folder;
400 std::string Path_Folder;
401 
402 PD_Folder = TString("HLT/OccupancyPlots");
403 if (label != "SingleMu" && label != "SingleElectron" && label != "Jet") PD_Folder = TString("HLT/OccupancyPlots/"+label);
404 
405 dbe->setCurrentFolder(PD_Folder.c_str());
406 
407 h_name = "HLT_"+label+"_EtaVsPhi";
408 h_title = "HLT_"+label+"_EtaVsPhi; eta; phi";
409 h_name_1dEta = "HLT_"+label+"_1dEta";
410 h_name_1dPhi = "HLT_"+label+"_1dPhi";
411 h_title_1dEta = label+" Occupancy Vs Eta";
412 h_title_1dPhi = label+" Occupancy Vs Phi";
413 //Int_t numBinsEta = 12;
414 //Int_t numBinsPhi = 8;
415 Int_t numBinsEta = 30;
416 Int_t numBinsPhi = 34;
417 Int_t numBinsEtaFine = 60;
418 Int_t numBinsPhiFine = 66;
419 Double_t EtaMax = 2.610;
420 Double_t PhiMax = 17.0*TMath::Pi()/16.0;
421 Double_t PhiMaxFine = 33.0*TMath::Pi()/32.0;
422 
423  //Double_t eta_bins[] = {-2.610,-2.349,-2.088,-1.827,-1.740,-1.653,-1.566,-1.479,-1.392,-1.305,-1.044,-0.783,-0.522,-0.261,0,0.261,0.522,0.783,1.044,1.305,1.392,1.479,1.566,1.653,1.740,1.827,2.088,2.349,2.610}; //Has narrower bins in Barrel/Endcap border region
424 //Double_t eta_bins[] = {-2.610,-2.175,-1.740,-1.305,-0.870,-0.435,0,0.435,0.870,1.305,1.740,2.175,2.610};
425 //Double_t phi_bins[] = {-TMath::Pi(),-3*TMath::Pi()/4,-TMath::Pi()/2,-TMath::Pi()/4,0,TMath::Pi()/4,TMath::Pi()/2,3*TMath::Pi()/4,TMath::Pi()};
426 
427  TH2F * hist_EtaVsPhi = new TH2F(h_name.c_str(),h_title.c_str(),numBinsEta,-EtaMax,EtaMax,numBinsPhi,-PhiMax,PhiMax);
428  TH1F * hist_1dEta = new TH1F(h_name_1dEta.c_str(),h_title_1dEta.c_str(),numBinsEtaFine,-EtaMax,EtaMax);
429  TH1F * hist_1dPhi = new TH1F(h_name_1dPhi.c_str(),h_title_1dPhi.c_str(),numBinsPhiFine,-PhiMaxFine,PhiMaxFine);
430 
431  hist_EtaVsPhi->SetMinimum(0);
432  hist_1dEta->SetMinimum(0);
433  hist_1dPhi->SetMinimum(0);
434 
435 dbe->book2D(h_name.c_str(),hist_EtaVsPhi);
436 dbe->book1D(h_name_1dEta.c_str(),hist_1dEta);
437 dbe->book1D(h_name_1dPhi.c_str(),hist_1dPhi);
438 
439  for (unsigned int iPath = 0; iPath < PDsVectorPathsVector[iPD].size(); iPath++) {
440  pathName = PDsVectorPathsVector[iPD][iPath];
441  h_name_1dEtaPath = "HLT_"+pathName+"_1dEta";
442  h_name_1dPhiPath = "HLT_"+pathName+"_1dPhi";
443  h_title_1dEtaPath = pathName+" Occupancy Vs Eta";
444  h_title_1dPhiPath = pathName+"Occupancy Vs Phi";
445  Path_Folder = TString("HLT/OccupancyPlots/"+label+"/Paths");
446  dbe->setCurrentFolder(Path_Folder.c_str());
447 
448  dbe->book1D(h_name_1dEtaPath.c_str(),h_title_1dEtaPath.c_str(),numBinsEtaFine,-EtaMax,EtaMax);
449  dbe->book1D(h_name_1dPhiPath.c_str(),h_title_1dPhiPath.c_str(),numBinsPhiFine,-PhiMaxFine,PhiMaxFine);
450 
451  if (debugPrint) std::cout << "book1D for " << pathName << std::endl;
452  }
453 
454  if (debugPrint) std::cout << "Success setupHltMatrix( " << label << " , " << iPD << " )" << std::cout;
455 } //End setupHltMatrix
456 
457 void OccupancyPlotter::fillHltMatrix(std::string label, std::string path,double Eta, double Phi, bool first_count) {
458 
459  if (debugPrint) std::cout << "Inside fillHltMatrix( " << label << " , " << path << " ) " << std::endl;
460 
461  std::string fullPathToME;
462  std::string fullPathToME1dEta;
463  std::string fullPathToME1dPhi;
464  std::string fullPathToME1dEtaPath;
465  std::string fullPathToME1dPhiPath;
466 
467  fullPathToME = "HLT/OccupancyPlots/HLT_"+label+"_EtaVsPhi";
468  fullPathToME1dEta = "HLT/OccupancyPlots/HLT_"+label+"_1dEta";
469  fullPathToME1dPhi = "HLT/OccupancyPlots/HLT_"+label+"_1dPhi";
470 
471 if (label != "SingleMu" && label != "SingleElectron" && label != "Jet") {
472  fullPathToME = "HLT/OccupancyPlots/"+label+"/HLT_"+label+"_EtaVsPhi";
473  fullPathToME1dEta = "HLT/OccupancyPlots/"+label+"/HLT_"+label+"_1dEta";
474  fullPathToME1dPhi = "HLT/OccupancyPlots/"+label+"/HLT_"+label+"_1dPhi";
475  }
476 
477  fullPathToME1dEtaPath = "HLT/OccupancyPlots/"+label+"/Paths/HLT_"+path+"_1dEta";
478  fullPathToME1dPhiPath = "HLT/OccupancyPlots/"+label+"/Paths/HLT_"+path+"_1dPhi";
479 
480  if (debugPrint) std::cout << "fullPathToME = " << std::endl;
481 
482  MonitorElement * ME_2d = dbe->get(fullPathToME);
483  MonitorElement * ME_1dEta = dbe->get(fullPathToME1dEta);
484  MonitorElement * ME_1dPhi = dbe->get(fullPathToME1dPhi);
485  MonitorElement * ME_1dEtaPath = dbe->get(fullPathToME1dEtaPath);
486  MonitorElement * ME_1dPhiPath = dbe->get(fullPathToME1dPhiPath);
487 
488  if (debugPrint) std::cout << "MonitorElement * " << std::endl;
489 
490  TH2F * hist_2d = ME_2d->getTH2F();
491  TH1F * hist_1dEta = ME_1dEta->getTH1F();
492  TH1F * hist_1dPhi = ME_1dPhi->getTH1F();
493  TH1F * hist_1dEtaPath = ME_1dEtaPath->getTH1F();
494  TH1F * hist_1dPhiPath = ME_1dPhiPath->getTH1F();
495 
496  if (debugPrint) std::cout << "TH2F *" << std::endl;
497 
498  //int i=2;
499  //if (Eta>1.305 && Eta<1.872) i=0;
500  //if (Eta<-1.305 && Eta>-1.872) i=0;
501  //for (int ii=i; ii<3; ++ii) hist_2d->Fill(Eta,Phi); //Scales narrow bins in Barrel/Endcap border region
502 
503  if(first_count) {
504  hist_1dEta->Fill(Eta);
505  hist_1dPhi->Fill(Phi);
506  hist_2d->Fill(Eta,Phi); }
507  hist_1dEtaPath->Fill(Eta);
508  hist_1dPhiPath->Fill(Phi);
509 
510  if (debugPrint) std::cout << "hist->Fill" << std::endl;
511 
512 } //End fillHltMatrix
513 
514 //=========================================================
515 
517 
518  //Copy of code from DQMServices/Components/src/DQMDcsInfo.cc
519 
521  if (! jEvent.getByToken(dcsStatusToken_, dcsStatus))
522  {
523  std::cout << "[OccupancyPlotter::checkDcsInfo] Could not get scalersRawToDigi by label\n" ;
524  for (int i=0;i<24;i++) dcs[i]=false;
525  return false;
526  }//if (debugPrint)
527 
528  if ( ! dcsStatus.isValid() )
529  {
530  std::cout << "[OccupancyPlotter::checkDcsInfo] scalersRawToDigi not valid\n" ;
531  for (int i=0;i<24;i++) dcs[i]=false; // info not available: set to false
532  return false;
533  }
534 
535  // initialize all to "true"
536  for (int i=0; i<24; i++) dcs[i]=true;
537 
538  for (DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin();
539  dcsStatusItr != dcsStatus->end(); ++dcsStatusItr)
540  {
541 
542  if (debugPrint) std::cout << (*dcsStatusItr) << std::endl;
543 
544  if (!dcsStatusItr->ready(DcsStatus::CSCp)) dcs[0]=false;
545  if (!dcsStatusItr->ready(DcsStatus::CSCm)) dcs[1]=false;
546  if (!dcsStatusItr->ready(DcsStatus::DT0)) dcs[2]=false;
547  if (!dcsStatusItr->ready(DcsStatus::DTp)) dcs[3]=false;
548  if (!dcsStatusItr->ready(DcsStatus::DTm)) dcs[4]=false;
549  if (!dcsStatusItr->ready(DcsStatus::EBp)) dcs[5]=false;
550  if (!dcsStatusItr->ready(DcsStatus::EBm)) dcs[6]=false;
551  if (!dcsStatusItr->ready(DcsStatus::EEp)) dcs[7]=false;
552  if (!dcsStatusItr->ready(DcsStatus::EEm)) dcs[8]=false;
553  if (!dcsStatusItr->ready(DcsStatus::ESp)) dcs[9]=false;
554  if (!dcsStatusItr->ready(DcsStatus::ESm)) dcs[10]=false;
555  if (!dcsStatusItr->ready(DcsStatus::HBHEa)) dcs[11]=false;
556  if (!dcsStatusItr->ready(DcsStatus::HBHEb)) dcs[12]=false;
557  if (!dcsStatusItr->ready(DcsStatus::HBHEc)) dcs[13]=false;
558  if (!dcsStatusItr->ready(DcsStatus::HF)) dcs[14]=false;
559 // if (!dcsStatusItr->ready(DcsStatus::HO)) dcs[15]=false; // ignore HO
560  if (!dcsStatusItr->ready(DcsStatus::BPIX)) dcs[16]=false;
561  if (!dcsStatusItr->ready(DcsStatus::FPIX)) dcs[17]=false;
562  if (!dcsStatusItr->ready(DcsStatus::RPC)) dcs[18]=false;
563  if (!dcsStatusItr->ready(DcsStatus::TIBTID)) dcs[19]=false;
564  if (!dcsStatusItr->ready(DcsStatus::TOB)) dcs[20]=false;
565  if (!dcsStatusItr->ready(DcsStatus::TECp)) dcs[21]=false;
566  if (!dcsStatusItr->ready(DcsStatus::TECm)) dcs[22]=false;
567 // if (!dcsStatusItr->ready(DcsStatus::CASTOR)) dcs[23]=false;
568  }
569 
570 
571  // now we should add some logic that tests the HV status
572  bool decision = true;
573  for (int i=0; i<24; i++) decision=decision && dcs[i];
574  if (debugPrint) {
575  std::cout << "[OccupancyPlotter::checkDcsInfo] DCS Status:";
576  for (int i=0; i<24; i++) std::cout << dcs[i] << "-";
577  std::cout << "; Decision: " << decision << std::endl;
578  }
579  //std::cout << "; Decision: " << decision << std::endl;
580  return decision;
581 
582 }
583 
585 
586  if (debugPrint) std::cout << "Inside method check lumi info" << std::endl;
587 
589  bool lumiHandleOK = jEvent.getByToken(lumiScalersToken_, lumiScalers);
590 
591  if (!lumiHandleOK || !lumiScalers.isValid()){
592  if (debugPrint) std::cout << "scalers not valid" << std::endl;
593  return;
594  }
595 
596  if (lumiScalers->size() == 0) {
597  if (debugPrint) std::cout << "scalers has size < 0" << std::endl;
598  return;
599  }
600 
601  LumiScalersCollection::const_iterator it3 = lumiScalers->begin();
602  //unsigned int lumisection = it3->sectionNumber();
603 
604  _instLumi = it3->instantLumi();
605  _instLumi_err = it3->instantLumiErr();
606  _pileup = it3->pileup();
607 
608  if (debugPrint) std::cout << "Instanteous Lumi is " << _instLumi << std::endl;
609  if (debugPrint) std::cout << "Instanteous Lumi Error is " << _instLumi_err << std::endl;
610  if (debugPrint) std::cout << "Lumi Fill is " <<it3->lumiFill() << std::endl;
611  if (debugPrint) std::cout << "Lumi Fill is " <<it3->lumiRun() << std::endl;
612  if (debugPrint) std::cout << "Live Lumi Fill is " <<it3->liveLumiFill() << std::endl;
613  if (debugPrint) std::cout << "Live Lumi Run is " <<it3->liveLumiRun() << std::endl;
614  if (debugPrint) std::cout << "Pileup? = " << _pileup << std::endl;
615 
616  return;
617 
618 }
619 
620 //=========================================================
621 
622 // ------------ method called when starting to processes a luminosity block ------------
624 {
625  unsigned int thisLumiSection = 0;
626  thisLumiSection = lb.luminosityBlock();
627  std::cout << "[OccupancyPlotter::beginLuminosityBlock] New luminosity block: " << thisLumiSection << std::endl;
628  thisiLumiValue=true; // add the instantaneous luminosity of the first event to the LS-Lumi plot
629 }
630 
631 // ------------ method called when ending the processing of a luminosity block ------------
632 void
634 {
635 }
636 
637 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
638 // void
639 // OccupancyPlotter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
640 // //The following says we do not know what parameters are allowed so do no validation
641 // // Please change this to state exactly what you do use, even if it is no parameters
642 // edm::ParameterSetDescription desc;
643 // desc.setUnknown();
644 // descriptions.addDefault(desc);
645 // }
646 
647 //define this as a plug-in
const double Pi
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
virtual void setupHltMatrix(std::string, int)
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
virtual void beginJob() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< DcsStatusCollection > dcsStatusToken_
float phi() const
Definition: TriggerObject.h:58
virtual void beginRun(edm::Run const &, edm::EventSetup const &) override
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:59
std::string plotDirectoryName
virtual void endRun(edm::Run const &, edm::EventSetup const &) override
const double EtaMax[kNumberCalorimeter]
float eta() const
Definition: TriggerObject.h:57
DEFINE_FWK_MODULE(HiMixingModule)
bool checkDcsInfo(const edm::Event &jEvent)
edm::EDGetTokenT< trigger::TriggerEvent > aodTriggerToken_
virtual void fillHltMatrix(std::string, std::string, double, double, bool)
void beginJob()
Definition: Breakpoints.cc:15
triggerResultsToken_(consumes< edm::TriggerResults >(edm::InputTag("TriggerResults")))
LuminosityBlockNumber_t luminosityBlock() const
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
int iEvent
Definition: GenABIO.cc:230
tuple path
else: Piece not in the list, fine.
bool isValid() const
Definition: HandleBase.h:76
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
vector< vector< string > > PDsVectorPathsVector
OccupancyPlotter(const edm::ParameterSet &)
std::vector< size_type > Keys
static std::string const triggerResults("TriggerResults")
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
TH1F * getTH1F(void) const
virtual void endJob() override
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
edm::EDGetTokenT< LumiScalersCollection > lumiScalersToken_
tuple cout
Definition: gather_cfg.py:121
TH2F * getTH2F(void) const
HLTConfigProvider hltConfig_
tuple size
Write out results.
Definition: Run.h:41
void checkLumiInfo(const edm::Event &jEvent)