CMS 3D CMS Logo

DQMRootSource.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FwkIO
4 // Class : DQMRootSource
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Chris Jones
10 // Created: Tue May 3 11:13:47 CDT 2011
11 //
12 
13 // system include files
14 #include <vector>
15 #include <string>
16 #include <map>
17 #include <memory>
18 #include <list>
19 #include <set>
20 #include "TFile.h"
21 #include "TTree.h"
22 #include "TString.h"
23 #include "TH1.h"
24 #include "TH2.h"
25 #include "TProfile.h"
26 
27 // user include files
35 //#include "FWCore/Utilities/interface/GlobalIdentifier.h"
38 
41 
46 
49 
54 
57 
62 
65 
66 #include "format.h"
67 
68 namespace {
69  //adapter functions
70  MonitorElement* createElement(DQMStore& iStore, const char* iName, TH1F* iHist) {
71  //std::cout <<"create: hist size "<<iName <<" "<<iHist->GetEffectiveEntries()<<std::endl;
72  return iStore.book1D(iName, iHist);
73  }
74  //NOTE: the merge logic comes from DataFormats/Histograms/interface/MEtoEDMFormat.h
75  void mergeTogether(TH1* iOriginal,TH1* iToAdd) {
76  if(iOriginal->CanExtendAllAxes() && iToAdd->CanExtendAllAxes()) {
77  TList list;
78  list.Add(iToAdd);
79  if( -1 == iOriginal->Merge(&list)) {
80  edm::LogError("MergeFailure")<<"Failed to merge DQM element "<<iOriginal->GetName();
81  }
82  } else {
83  if (iOriginal->GetNbinsX() == iToAdd->GetNbinsX() &&
84  iOriginal->GetXaxis()->GetXmin() == iToAdd->GetXaxis()->GetXmin() &&
85  iOriginal->GetXaxis()->GetXmax() == iToAdd->GetXaxis()->GetXmax() &&
86  iOriginal->GetNbinsY() == iToAdd->GetNbinsY() &&
87  iOriginal->GetYaxis()->GetXmin() == iToAdd->GetYaxis()->GetXmin() &&
88  iOriginal->GetYaxis()->GetXmax() == iToAdd->GetYaxis()->GetXmax() &&
89  iOriginal->GetNbinsZ() == iToAdd->GetNbinsZ() &&
90  iOriginal->GetZaxis()->GetXmin() == iToAdd->GetZaxis()->GetXmin() &&
91  iOriginal->GetZaxis()->GetXmax() == iToAdd->GetZaxis()->GetXmax() &&
92  MonitorElement::CheckBinLabels(iOriginal->GetXaxis(),iToAdd->GetXaxis()) &&
93  MonitorElement::CheckBinLabels(iOriginal->GetYaxis(),iToAdd->GetYaxis()) &&
94  MonitorElement::CheckBinLabels(iOriginal->GetZaxis(),iToAdd->GetZaxis())) {
95  iOriginal->Add(iToAdd);
96  } else {
97  edm::LogError("MergeFailure")<<"Found histograms with different axis limits or different labels'"<<iOriginal->GetName()<<"' not merged.";
98  }
99  }
100  }
101 
102  void mergeWithElement(MonitorElement* iElement, TH1F* iHist) {
103  //std::cout <<"merge: hist size "<<iElement->getName() <<" "<<iHist->GetEffectiveEntries()<<std::endl;
104  mergeTogether(iElement->getTH1F(),iHist);
105  }
106  MonitorElement* createElement(DQMStore& iStore, const char* iName, TH1S* iHist) {
107  return iStore.book1S(iName, iHist);
108  }
109  void mergeWithElement(MonitorElement* iElement, TH1S* iHist) {
110  mergeTogether(iElement->getTH1S(),iHist);
111  }
112  MonitorElement* createElement(DQMStore& iStore, const char* iName, TH1D* iHist) {
113  return iStore.book1DD(iName, iHist);
114  }
115  void mergeWithElement(MonitorElement* iElement, TH1D* iHist) {
116  mergeTogether(iElement->getTH1D(),iHist);
117  }
118  MonitorElement* createElement(DQMStore& iStore, const char* iName, TH2F* iHist) {
119  return iStore.book2D(iName, iHist);
120  }
121  void mergeWithElement(MonitorElement* iElement, TH2F* iHist) {
122  mergeTogether(iElement->getTH2F(),iHist);
123  }
124  MonitorElement* createElement(DQMStore& iStore, const char* iName, TH2S* iHist) {
125  return iStore.book2S(iName, iHist);
126  }
127  void mergeWithElement(MonitorElement* iElement, TH2S* iHist) {
128  mergeTogether(iElement->getTH2S(),iHist);
129  }
130  MonitorElement* createElement(DQMStore& iStore, const char* iName, TH2D* iHist) {
131  return iStore.book2DD(iName, iHist);
132  }
133  void mergeWithElement(MonitorElement* iElement, TH2D* iHist) {
134  mergeTogether(iElement->getTH2D(),iHist);
135  }
136  MonitorElement* createElement(DQMStore& iStore, const char* iName, TH3F* iHist) {
137  return iStore.book3D(iName, iHist);
138  }
139  void mergeWithElement(MonitorElement* iElement, TH3F* iHist) {
140  mergeTogether(iElement->getTH3F(),iHist);
141  }
142  MonitorElement* createElement(DQMStore& iStore, const char* iName, TProfile* iHist) {
143  return iStore.bookProfile(iName, iHist);
144  }
145  void mergeWithElement(MonitorElement* iElement, TProfile* iHist) {
146  mergeTogether(iElement->getTProfile(),iHist);
147  }
148  MonitorElement* createElement(DQMStore& iStore, const char* iName, TProfile2D* iHist) {
149  return iStore.bookProfile2D(iName, iHist);
150  }
151  void mergeWithElement(MonitorElement* iElement, TProfile2D* iHist) {
152  mergeTogether(iElement->getTProfile2D(),iHist);
153  }
154 
155  MonitorElement* createElement(DQMStore& iStore, const char* iName, Long64_t& iValue) {
156  MonitorElement* e = iStore.bookInt(iName);
157  e->Fill(iValue);
158  return e;
159  }
160 
161  //NOTE: the merge logic comes from DataFormats/Histograms/interface/MEtoEDMFormat.h
162  void mergeWithElement(MonitorElement* iElement, Long64_t& iValue) {
163  const std::string& name = iElement->getFullname();
164  if(name.find("EventInfo/processedEvents") != std::string::npos) {
165  iElement->Fill(iValue+iElement->getIntValue());
166  } else if(name.find("EventInfo/iEvent") != std::string::npos ||
167  name.find("EventInfo/iLumiSection") != std::string::npos) {
168  if(iValue > iElement->getIntValue()) {
169  iElement->Fill(iValue);
170  }
171  }
172  else {
173  iElement->Fill(iValue);
174  }
175  }
176 
177  MonitorElement* createElement(DQMStore& iStore, const char* iName, double& iValue) {
178  MonitorElement* e = iStore.bookFloat(iName);
179  e->Fill(iValue);
180  return e;
181  }
182  void mergeWithElement(MonitorElement* iElement, double& iValue) {
183  //no merging, take the last one
184  iElement->Fill(iValue);
185  }
186  MonitorElement* createElement(DQMStore& iStore, const char* iName, std::string* iValue) {
187  return iStore.bookString(iName,*iValue);
188  }
189  void mergeWithElement(MonitorElement* iElement, std::string* iValue) {
190  //no merging, take the last one
191  iElement->Fill(*iValue);
192  }
193 
194  void splitName(const std::string& iFullName, std::string& oPath,const char*& oName) {
195  oPath = iFullName;
196  size_t index = oPath.find_last_of('/');
197  if(index == std::string::npos) {
198  oPath = std::string();
199  oName = iFullName.c_str();
200  } else {
201  oPath.resize(index);
202  oName = iFullName.c_str()+index+1;
203  }
204  }
205 
206  struct RunLumiToRange {
207  unsigned int m_run, m_lumi,m_historyIDIndex;
208  ULong64_t m_beginTime;
209  ULong64_t m_endTime;
210  ULong64_t m_firstIndex, m_lastIndex; //last is inclusive
211  unsigned int m_type; //A value in TypeIndex
212  };
213 
214  class TreeReaderBase {
215  public:
216  TreeReaderBase() {}
217  virtual ~TreeReaderBase() {}
218 
219  MonitorElement* read(ULong64_t iIndex, DQMStore& iStore, bool iIsLumi){
220  return doRead(iIndex,iStore,iIsLumi);
221  }
222  virtual void setTree(TTree* iTree) =0;
223  protected:
224  TTree* m_tree;
225  private:
226  virtual MonitorElement* doRead(ULong64_t iIndex, DQMStore& iStore, bool iIsLumi)=0;
227  };
228 
229  template<class T>
230  class TreeObjectReader: public TreeReaderBase {
231  public:
232  TreeObjectReader():m_tree(nullptr),m_fullName(nullptr),m_buffer(nullptr),m_tag(0){
233  }
234  MonitorElement* doRead(ULong64_t iIndex, DQMStore& iStore, bool iIsLumi) override {
235  m_tree->GetEntry(iIndex);
236  MonitorElement* element = iStore.get(*m_fullName);
237  if(nullptr == element) {
239  const char* name;
240  splitName(*m_fullName, path,name);
241  iStore.setCurrentFolder(path);
242  element = createElement(iStore,name,m_buffer);
243  if(iIsLumi) { element->setLumiFlag();}
244  } else {
245  mergeWithElement(element,m_buffer);
246  }
247  if(0!= m_tag) {
248  iStore.tag(element,m_tag);
249  }
250  return element;
251  }
252  void setTree(TTree* iTree) override {
253  m_tree = iTree;
254  m_tree->SetBranchAddress(kFullNameBranch,&m_fullName);
255  m_tree->SetBranchAddress(kFlagBranch,&m_tag);
256  m_tree->SetBranchAddress(kValueBranch,&m_buffer);
257  }
258  private:
259  TTree* m_tree;
260  std::string* m_fullName;
261  T* m_buffer;
262  uint32_t m_tag;
263  };
264 
265  template<class T>
266  class TreeSimpleReader : public TreeReaderBase {
267  public:
268  TreeSimpleReader():m_tree(nullptr),m_fullName(nullptr),m_buffer(0),m_tag(0){
269  }
270  MonitorElement* doRead(ULong64_t iIndex, DQMStore& iStore,bool iIsLumi) override {
271  m_tree->GetEntry(iIndex);
272  MonitorElement* element = iStore.get(*m_fullName);
273  if(nullptr == element) {
275  const char* name;
276  splitName(*m_fullName, path,name);
277  iStore.setCurrentFolder(path);
278  element = createElement(iStore,name,m_buffer);
279  if(iIsLumi) { element->setLumiFlag();}
280  } else {
281  mergeWithElement(element, m_buffer);
282  }
283  if(0!=m_tag) {
284  iStore.tag(element,m_tag);
285  }
286  return element;
287  }
288  void setTree(TTree* iTree) override {
289  m_tree = iTree;
290  m_tree->SetBranchAddress(kFullNameBranch,&m_fullName);
291  m_tree->SetBranchAddress(kFlagBranch,&m_tag);
292  m_tree->SetBranchAddress(kValueBranch,&m_buffer);
293  }
294  private:
295  TTree* m_tree;
296  std::string* m_fullName;
297  T m_buffer;
298  uint32_t m_tag;
299  };
300 
301 }
302 
304 {
305 
306  public:
308  ~DQMRootSource() override;
309 
310  // ---------- const member functions ---------------------
311 
312  // ---------- static member functions --------------------
313 
314  // ---------- member functions ---------------------------
315  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
316 
317  private:
318 
319  DQMRootSource(const DQMRootSource&) = delete; // stop default
320 
321  class RunPHIDKey {
322  public:
323  RunPHIDKey(edm::ProcessHistoryID const& phid, unsigned int run) :
324  processHistoryID_(phid), run_(run) { }
325  edm::ProcessHistoryID const& processHistoryID() const { return processHistoryID_; }
326  unsigned int run() const { return run_; }
327  bool operator<(RunPHIDKey const& right) const {
328  if (processHistoryID_ == right.processHistoryID()) {
329  return run_ < right.run();
330  }
331  return processHistoryID_ < right.processHistoryID();
332  }
333  private:
335  unsigned int run_;
336  };
337 
339  public:
340  RunLumiPHIDKey(edm::ProcessHistoryID const& phid, unsigned int run, unsigned int lumi) :
341  processHistoryID_(phid), run_(run), lumi_(lumi) { }
342  edm::ProcessHistoryID const& processHistoryID() const { return processHistoryID_; }
343  unsigned int run() const { return run_; }
344  unsigned int lumi() const { return lumi_; }
345  bool operator<(RunLumiPHIDKey const& right) const {
346  if (processHistoryID_ == right.processHistoryID()) {
347  if (run_ == right.run()) {
348  return lumi_ < right.lumi();
349  }
350  return run_ < right.run();
351  }
352  return processHistoryID_ < right.processHistoryID();
353  }
354  private:
356  unsigned int run_;
357  unsigned int lumi_;
358  };
359 
360  edm::InputSource::ItemType getNextItemType() override;
361  //NOTE: the following is really read next run auxiliary
362  std::shared_ptr<edm::RunAuxiliary> readRunAuxiliary_() override ;
363  std::shared_ptr<edm::LuminosityBlockAuxiliary> readLuminosityBlockAuxiliary_() override ;
364  void readRun_(edm::RunPrincipal& rpCache) override;
365  void readLuminosityBlock_(edm::LuminosityBlockPrincipal& lbCache) override;
366  void readEvent_(edm::EventPrincipal&) override ;
367 
368  std::unique_ptr<edm::FileBlock> readFile_() override;
369  void closeFile_() override;
370 
371  void logFileAction(char const* msg, char const* fileName) const;
372 
373  void readNextItemType();
374  bool setupFile(unsigned int iIndex);
375  void readElements();
377 
378  const DQMRootSource& operator=(const DQMRootSource&) = delete; // stop default
379 
380  // ---------- member data --------------------------------
385 
386  size_t m_fileIndex;
388  std::list<unsigned int>::iterator m_nextIndexItr;
389  std::list<unsigned int>::iterator m_presentIndexItr;
390  std::vector<RunLumiToRange> m_runlumiToRange;
391  std::unique_ptr<TFile> m_file;
392  std::vector<TTree*> m_trees;
393  std::vector<boost::shared_ptr<TreeReaderBase> > m_treeReaders;
394 
395  std::list<unsigned int> m_orderedIndices;
397  unsigned int m_lastSeenRun;
399  unsigned int m_lastSeenRun2;
400  unsigned int m_lastSeenLumi2;
401  unsigned int m_filterOnRun;
403  std::vector<edm::LuminosityBlockRange> m_lumisToProcess;
404  std::vector<edm::RunNumber_t> m_runsToProcess;
405 
408  std::set<MonitorElement*> m_lumiElements;
409  std::set<MonitorElement*> m_runElements;
410  std::vector<edm::ProcessHistoryID> m_historyIDs;
411  std::vector<edm::ProcessHistoryID> m_reducedHistoryIDs;
412 
414 };
415 
416 //
417 // constants, enums and typedefs
418 //
419 
420 //
421 // static data member definitions
422 //
423 
424 void
427  desc.addUntracked<std::vector<std::string> >("fileNames")
428  ->setComment("Names of files to be processed.");
429  desc.addUntracked<unsigned int>("filterOnRun",0)
430  ->setComment("Just limit the process to the selected run.");
431  desc.addUntracked<bool>("skipBadFiles",false)
432  ->setComment("Skip the file if it is not valid");
433  desc.addUntracked<std::string>("overrideCatalog",std::string())
434  ->setComment("An alternate file catalog to use instead of the standard site one.");
435  std::vector<edm::LuminosityBlockRange> defaultLumis;
436  desc.addUntracked<std::vector<edm::LuminosityBlockRange> >("lumisToProcess",defaultLumis)
437  ->setComment("Skip any lumi inside the specified run:lumi range.");
438 
439  descriptions.addDefault(desc);
440 }
441 //
442 // constructors and destructor
443 //
445  edm::InputSource(iPSet,iDesc),
446  m_catalog(iPSet.getUntrackedParameter<std::vector<std::string> >("fileNames"),
447  iPSet.getUntrackedParameter<std::string>("overrideCatalog")),
448  m_nextItemType(edm::InputSource::IsFile),
449  m_fileIndex(0),
450  m_presentlyOpenFileIndex(0),
451  m_trees(kNIndicies,static_cast<TTree*>(nullptr)),
452  m_treeReaders(kNIndicies,boost::shared_ptr<TreeReaderBase>()),
453  m_lastSeenReducedPHID(),
454  m_lastSeenRun(0),
455  m_lastSeenReducedPHID2(),
456  m_lastSeenRun2(0),
457  m_lastSeenLumi2(0),
458  m_filterOnRun(iPSet.getUntrackedParameter<unsigned int>("filterOnRun", 0)),
459  m_skipBadFiles(iPSet.getUntrackedParameter<bool>("skipBadFiles", false)),
460  m_lumisToProcess(iPSet.getUntrackedParameter<std::vector<edm::LuminosityBlockRange> >("lumisToProcess",std::vector<edm::LuminosityBlockRange>())),
461  m_justOpenedFileSoNeedToGenerateRunTransition(false),
462  m_shouldReadMEs(true)
463 {
465  for(std::vector<edm::LuminosityBlockRange>::const_iterator itr = m_lumisToProcess.begin(); itr!=m_lumisToProcess.end(); ++itr)
466  m_runsToProcess.push_back(itr->startRun());
467 
468  if(m_fileIndex ==m_catalog.fileNames().size()) {
470  } else{
471  m_treeReaders[kIntIndex].reset(new TreeSimpleReader<Long64_t>());
472  m_treeReaders[kFloatIndex].reset(new TreeSimpleReader<double>());
473  m_treeReaders[kStringIndex].reset(new TreeObjectReader<std::string>());
474  m_treeReaders[kTH1FIndex].reset(new TreeObjectReader<TH1F>());
475  m_treeReaders[kTH1SIndex].reset(new TreeObjectReader<TH1S>());
476  m_treeReaders[kTH1DIndex].reset(new TreeObjectReader<TH1D>());
477  m_treeReaders[kTH2FIndex].reset(new TreeObjectReader<TH2F>());
478  m_treeReaders[kTH2SIndex].reset(new TreeObjectReader<TH2S>());
479  m_treeReaders[kTH2DIndex].reset(new TreeObjectReader<TH2D>());
480  m_treeReaders[kTH3FIndex].reset(new TreeObjectReader<TH3F>());
481  m_treeReaders[kTProfileIndex].reset(new TreeObjectReader<TProfile>());
482  m_treeReaders[kTProfile2DIndex].reset(new TreeObjectReader<TProfile2D>());
483  }
484 }
485 
486 // DQMRootSource::DQMRootSource(const DQMRootSource& rhs)
487 // {
488 // // do actual copying here;
489 // }
490 
492 {
493  if(m_file.get() != nullptr && m_file->IsOpen()) {
494  m_file->Close();
495  logFileAction(" Closed file ", m_catalog.fileNames()[m_presentlyOpenFileIndex].c_str());
496  }
497 }
498 
499 //
500 // assignment operators
501 //
502 // const DQMRootSource& DQMRootSource::operator=(const DQMRootSource& rhs)
503 // {
504 // //An exception safe implementation is
505 // DQMRootSource temp(rhs);
506 // swap(rhs);
507 //
508 // return *this;
509 // }
510 
511 //
512 // member functions
513 //
515 {
516  //std::cout << "readEvent_" << std::endl;
517 }
518 
520 {
521  //std::cout <<"getNextItemType "<<m_nextItemType<<std::endl;
522  return m_nextItemType;
523 }
524 
525 std::shared_ptr<edm::RunAuxiliary> DQMRootSource::readRunAuxiliary_()
526 {
527  //std::cout <<"readRunAuxiliary_"<<std::endl;
528  assert(m_nextIndexItr != m_orderedIndices.end());
529  RunLumiToRange runLumiRange = m_runlumiToRange[*m_nextIndexItr];
530 
531  //NOTE: the setBeginTime and setEndTime functions of RunAuxiliary only work if the previous value was invalid
532  // therefore we must copy
533  m_runAux = edm::RunAuxiliary(runLumiRange.m_run,edm::Timestamp(runLumiRange.m_beginTime),edm::Timestamp(runLumiRange.m_endTime));
534  assert(m_historyIDs.size() > runLumiRange.m_historyIDIndex);
535  //std::cout <<"readRunAuxiliary_ "<<m_historyIDs[runLumiRange.m_historyIDIndex]<<std::endl;
536  m_runAux.setProcessHistoryID(m_historyIDs[runLumiRange.m_historyIDIndex]);
537  return std::make_shared<edm::RunAuxiliary>(m_runAux);
538 }
539 
540 std::shared_ptr<edm::LuminosityBlockAuxiliary>
542 {
543  //std::cout <<"readLuminosityBlockAuxiliary_"<<std::endl;
544  assert(m_nextIndexItr != m_orderedIndices.end());
545  const RunLumiToRange runLumiRange = m_runlumiToRange[*m_nextIndexItr];
546  m_lumiAux = edm::LuminosityBlockAuxiliary(edm::LuminosityBlockID(runLumiRange.m_run,runLumiRange.m_lumi),
547  edm::Timestamp(runLumiRange.m_beginTime),
548  edm::Timestamp(runLumiRange.m_endTime));
549  assert(m_historyIDs.size() > runLumiRange.m_historyIDIndex);
550  //std::cout <<"lumi "<<m_lumiAux.beginTime().value()<<" "<<runLumiRange.m_beginTime<<std::endl;
551  m_lumiAux.setProcessHistoryID(m_historyIDs[runLumiRange.m_historyIDIndex]);
552 
553  return std::make_shared<edm::LuminosityBlockAuxiliary>(m_lumiAux);
554 }
555 
556 void
558 {
559  assert(m_presentIndexItr != m_orderedIndices.end());
560  RunLumiToRange runLumiRange = m_runlumiToRange[*m_presentIndexItr];
561 
563  unsigned int runID =rpCache.id().run();
564  assert(runID == runLumiRange.m_run);
565 
566  m_shouldReadMEs = (m_filterOnRun == 0 ||
567  (m_filterOnRun != 0 && m_filterOnRun == runID));
568  // std::cout <<"readRun_"<<std::endl;
569  // std::cout <<"m_shouldReadMEs " << m_shouldReadMEs <<std::endl;
570 
581  //NOTE: need to reset all run elements at this point
582  if( m_lastSeenRun != runID ||
583  m_lastSeenReducedPHID != m_reducedHistoryIDs.at(runLumiRange.m_historyIDIndex) ) {
584  if (m_shouldReadMEs) {
586  std::vector<MonitorElement*> allMEs = (*store).getAllContents("");
587  for(auto const& ME : allMEs) {
588  if ( !(*store).isCollate() )
589  ME->Reset();
590  }
591  }
592  m_lastSeenReducedPHID = m_reducedHistoryIDs.at(runLumiRange.m_historyIDIndex);
593  m_lastSeenRun = runID;
594  }
595 
597 
598  //NOTE: it is possible to have a Run when all we have stored is lumis
599  if(runLumiRange.m_lumi == 0) {
600  readElements();
601  }
602 
603 
605  jr->reportInputRunNumber(rpCache.id().run());
606 
608 }
609 
610 
611 void
613 {
614  assert(m_presentIndexItr != m_orderedIndices.end());
615  RunLumiToRange runLumiRange = m_runlumiToRange[*m_presentIndexItr];
616  assert(runLumiRange.m_run == lbCache.id().run());
617  assert(runLumiRange.m_lumi == lbCache.id().luminosityBlock());
618 
619  //NOTE: need to reset all lumi block elements at this point
620  if( ( m_lastSeenLumi2 != runLumiRange.m_lumi ||
621  m_lastSeenRun2 != runLumiRange.m_run ||
622  m_lastSeenReducedPHID2 != m_reducedHistoryIDs.at(runLumiRange.m_historyIDIndex) )
623  && m_shouldReadMEs) {
624 
626  std::vector<MonitorElement*> allMEs = (*store).getAllContents("");
627  //for(auto const& ME : allMEs) {
628  // // We do not want to reset Run Products here!
629  // if (ME->getLumiFlag()) {
630  // ME->Reset();
631  // }
632  //}
633  m_lastSeenReducedPHID2 = m_reducedHistoryIDs.at(runLumiRange.m_historyIDIndex);
634  m_lastSeenRun2 = runLumiRange.m_run;
635  m_lastSeenLumi2 = runLumiRange.m_lumi;
636  }
637 
639  readElements();
640 
642  jr->reportInputLumiSection(lbCache.id().run(),lbCache.id().luminosityBlock());
643 
645 
646 }
647 
648 std::unique_ptr<edm::FileBlock>
650  auto const numFiles = m_catalog.fileNames().size();
651  while(m_fileIndex < numFiles && not setupFile(m_fileIndex++)) {}
652 
653  if(m_file.get() == nullptr) {
654  //last file in list was bad
656  return std::unique_ptr<edm::FileBlock>(new edm::FileBlock);
657  }
658 
662 
666  std::string(),
667  std::string(),
668  "DQMRootSource",
669  "source",
670  m_file->GetUUID().AsString(),//edm::createGlobalIdentifier(),
671  std::vector<std::string>()
672  );
673 
674  return std::unique_ptr<edm::FileBlock>(new edm::FileBlock);
675 }
676 
677 void
679  if(m_file.get()==nullptr) { return; }
682 }
683 
686  RunLumiToRange runLumiRange = m_runlumiToRange[*m_presentIndexItr];
687  bool shouldContinue = false;
688  do
689  {
690  shouldContinue = false;
694 
695  if(runLumiRange.m_type != kNoTypesStored) {
696  boost::shared_ptr<TreeReaderBase> reader = m_treeReaders[runLumiRange.m_type];
697  ULong64_t index = runLumiRange.m_firstIndex;
698  ULong64_t endIndex = runLumiRange.m_lastIndex+1;
699  for (; index != endIndex; ++index)
700  {
701  bool isLumi = runLumiRange.m_lumi !=0;
702  if (m_shouldReadMEs)
703  reader->read(index,*store,isLumi);
704 
705  //std::cout << runLumiRange.m_run << " " << runLumiRange.m_lumi <<" "<<index<< " " << runLumiRange.m_type << std::endl;
706  }
707  }
708 
709  if (m_presentIndexItr != m_orderedIndices.end())
710  {
711  //are there more parts to this same run/lumi?
712  const RunLumiToRange nextRunLumiRange = m_runlumiToRange[*m_presentIndexItr];
713  //continue to the next item if that item is either
714  if ( (m_reducedHistoryIDs.at(nextRunLumiRange.m_historyIDIndex) == m_reducedHistoryIDs.at(runLumiRange.m_historyIDIndex)) &&
715  (nextRunLumiRange.m_run == runLumiRange.m_run) &&
716  (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) )
717  {
718  shouldContinue= true;
719  runLumiRange = nextRunLumiRange;
720  }
721  }
722  } while(shouldContinue);
723 }
724 
726 {
727  //Do the work of actually figuring out where next to go
728 
729  assert (m_nextIndexItr != m_orderedIndices.end());
730  RunLumiToRange runLumiRange = m_runlumiToRange[*m_nextIndexItr];
731 
733  if (runLumiRange.m_lumi != 0 && m_nextItemType == edm::InputSource::IsRun) {
735  return;
736  }
737  ++m_nextIndexItr;
738  }
739  else
740  {
741  //NOTE: the following makes the iterator not be advanced in the
742  //do while loop below.
743  runLumiRange.m_run=0;
744  }
745 
746  bool shouldContinue = false;
747  do
748  {
749  shouldContinue = false;
751  ++m_nextIndexItr;
752 
753  if (m_nextIndexItr == m_orderedIndices.end())
754  {
755  //go to next file
757  //std::cout <<"going to next file"<<std::endl;
758  if(m_fileIndex == m_catalog.fileNames().size()) {
760  }
761  break;
762  }
763  const RunLumiToRange nextRunLumiRange = m_runlumiToRange[*m_nextIndexItr];
764  //continue to the next item if that item is the same run or lumi as we just did
765  if( (m_reducedHistoryIDs.at(nextRunLumiRange.m_historyIDIndex) == m_reducedHistoryIDs.at(runLumiRange.m_historyIDIndex) ) &&
766  (nextRunLumiRange.m_run == runLumiRange.m_run) &&
767  (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) ) {
768  shouldContinue= true;
769  ++m_nextIndexItr;
770  //std::cout <<"advancing " <<nextRunLumiRange.m_run<<" "<<nextRunLumiRange.m_lumi<<std::endl;
771  }
772  } while(shouldContinue);
773 
774  if(m_nextIndexItr != m_orderedIndices.end()) {
779  } else {
781  }
782  }
783 }
784 
785 bool
786 DQMRootSource::setupFile(unsigned int iIndex)
787 {
788  if(m_file.get() != nullptr && iIndex > 0) {
789  m_file->Close();
790  logFileAction(" Closed file ", m_catalog.fileNames()[iIndex-1].c_str());
791  }
792  logFileAction(" Initiating request to open file ", m_catalog.fileNames()[iIndex].c_str());
793  m_presentlyOpenFileIndex = iIndex;
794  m_file.reset();
795  std::unique_ptr<TFile> newFile;
796  try {
797  // ROOT's context management implicitly assumes that a file is opened and
798  // closed on the same thread. To avoid the problem, we declare a local
799  // TContext object; when it goes out of scope, its destructor unregisters
800  // the context, guaranteeing the context is unregistered in the same thread
801  // it was registered in.
802  TDirectory::TContext contextEraser;
803  newFile = std::unique_ptr<TFile>(TFile::Open(m_catalog.fileNames()[iIndex].c_str()));
804 
805  //Since ROOT6, we can not propagate an exception through ROOT's plugin
806  // system so we trap them and then pull from this function
807  std::exception_ptr e = edm::threadLocalException::getException();
808  if(e != std::exception_ptr()) {
809  edm::threadLocalException::setException(std::exception_ptr());
810  std::rethrow_exception(e);
811  }
812 
813  } catch(cms::Exception const& e) {
814  if(!m_skipBadFiles) {
816  ex.addContext("Opening DQM Root file");
817  ex <<"\nInput file " << m_catalog.fileNames()[iIndex] << " was not found, could not be opened, or is corrupted.\n";
818  throw ex;
819  }
820  return false;
821  }
822  if(not newFile->IsZombie()) {
823  logFileAction(" Successfully opened file ", m_catalog.fileNames()[iIndex].c_str());
824  } else {
825  if(!m_skipBadFiles) {
827  ex<<"Input file "<<m_catalog.fileNames()[iIndex].c_str() <<" could not be opened.\n";
828  ex.addContext("Opening DQM Root file");
829  throw ex;
830  }
831  return false;
832  }
833  //Check file format version, which is encoded in the Title of the TFile
834  if(0 != strcmp(newFile->GetTitle(),"1")) {
836  ex<<"Input file "<<m_catalog.fileNames()[iIndex].c_str() <<" does not appear to be a DQM Root file.\n";
837  }
838 
839  //Get meta Data
840  TDirectory* metaDir = newFile->GetDirectory(kMetaDataDirectoryAbsolute);
841  if(nullptr==metaDir) {
842  if(!m_skipBadFiles) {
844  ex<<"Input file "<<m_catalog.fileNames()[iIndex].c_str() <<" appears to be corrupted since it does not have the proper internal structure.\n"
845  " Check to see if the file was closed properly.\n";
846  ex.addContext("Opening DQM Root file");
847  throw ex;
848  }
849  else {return false;}
850  }
851  m_file = std::move(newFile); //passed all tests so now we want to use this file
852  TTree* parameterSetTree = dynamic_cast<TTree*>(metaDir->Get(kParameterSetTree));
853  assert(nullptr!=parameterSetTree);
854 
856  assert(nullptr!=psr);
857  {
858  std::string blob;
859  std::string* pBlob = &blob;
860  parameterSetTree->SetBranchAddress(kParameterSetBranch,&pBlob);
861  for(unsigned int index = 0; index != parameterSetTree->GetEntries();++index)
862  {
863  parameterSetTree->GetEntry(index);
865  }
866  }
867 
868  {
869  TTree* processHistoryTree = dynamic_cast<TTree*>(metaDir->Get(kProcessHistoryTree));
870  assert(nullptr!=processHistoryTree);
871  unsigned int phIndex = 0;
872  processHistoryTree->SetBranchAddress(kPHIndexBranch,&phIndex);
874  std::string* pProcessName = &processName;
875  processHistoryTree->SetBranchAddress(kProcessConfigurationProcessNameBranch,&pProcessName);
876  std::string parameterSetIDBlob;
877  std::string* pParameterSetIDBlob = &parameterSetIDBlob;
878  processHistoryTree->SetBranchAddress(kProcessConfigurationParameterSetIDBranch,&pParameterSetIDBlob);
879  std::string releaseVersion;
880  std::string* pReleaseVersion = &releaseVersion;
881  processHistoryTree->SetBranchAddress(kProcessConfigurationReleaseVersion,&pReleaseVersion);
882  std::string passID;
883  std::string* pPassID = &passID;
884  processHistoryTree->SetBranchAddress(kProcessConfigurationPassID,&pPassID);
885 
887  std::vector<edm::ProcessConfiguration> configs;
888  configs.reserve(5);
889  m_historyIDs.clear();
890  m_reducedHistoryIDs.clear();
891  for(unsigned int i=0; i != processHistoryTree->GetEntries(); ++i) {
892  processHistoryTree->GetEntry(i);
893  if(phIndex==0) {
894  if(not configs.empty()) {
895  edm::ProcessHistory ph(configs);
896  m_historyIDs.push_back(ph.id());
897  phr.registerProcessHistory(ph);
898  m_reducedHistoryIDs.push_back(phr.reducedProcessHistoryID(ph.id()));
899  }
900  configs.clear();
901  }
902  edm::ParameterSetID psetID(parameterSetIDBlob);
903  edm::ProcessConfiguration pc(processName, psetID,releaseVersion,passID);
904  configs.push_back(pc);
905  }
906  if(not configs.empty()) {
907  edm::ProcessHistory ph(configs);
908  m_historyIDs.push_back(ph.id());
909  phr.registerProcessHistory(ph);
910  m_reducedHistoryIDs.push_back(phr.reducedProcessHistoryID(ph.id()));
911  //std::cout <<"inserted "<<ph.id()<<std::endl;
912  }
913  }
914 
915  //Setup the indices
916  TTree* indicesTree = dynamic_cast<TTree*>(m_file->Get(kIndicesTree));
917  assert(nullptr!=indicesTree);
918 
919  m_runlumiToRange.clear();
920  m_runlumiToRange.reserve(indicesTree->GetEntries());
921  m_orderedIndices.clear();
922 
923  RunLumiToRange temp;
924  indicesTree->SetBranchAddress(kRunBranch,&temp.m_run);
925  indicesTree->SetBranchAddress(kLumiBranch,&temp.m_lumi);
926  indicesTree->SetBranchAddress(kBeginTimeBranch,&temp.m_beginTime);
927  indicesTree->SetBranchAddress(kEndTimeBranch,&temp.m_endTime);
928  indicesTree->SetBranchAddress(kProcessHistoryIndexBranch,&temp.m_historyIDIndex);
929  indicesTree->SetBranchAddress(kTypeBranch,&temp.m_type);
930  indicesTree->SetBranchAddress(kFirstIndex,&temp.m_firstIndex);
931  indicesTree->SetBranchAddress(kLastIndex,&temp.m_lastIndex);
932 
933  //Need to reorder items since if there was a merge done the same Run
934  //and/or Lumi can appear multiple times but we want to process them
935  //all at once
936 
937  //We use a std::list for m_orderedIndices since inserting into the
938  //middle of a std::list does not disrupt the iterators to already
939  //existing entries
940 
941  //The Map is used to see if a Run/Lumi pair has appeared before
942  typedef std::map<RunLumiPHIDKey, std::list<unsigned int>::iterator > RunLumiToLastEntryMap;
943  RunLumiToLastEntryMap runLumiToLastEntryMap;
944 
945  //Need to group all lumis for the same run together and move the run
946  //entry to the beginning
947  typedef std::map<RunPHIDKey, std::pair< std::list<unsigned int>::iterator, std::list<unsigned int>::iterator> > RunToFirstLastEntryMap;
948  RunToFirstLastEntryMap runToFirstLastEntryMap;
949 
950  for (Long64_t index = 0; index != indicesTree->GetEntries(); ++index)
951  {
952  indicesTree->GetEntry(index);
953 // std::cout <<"read r:"<<temp.m_run
954 // <<" l:"<<temp.m_lumi
955 // <<" b:"<<temp.m_beginTime
956 // <<" e:"<<temp.m_endTime
957 // <<" fi:" << temp.m_firstIndex
958 // <<" li:" << temp.m_lastIndex
959 // <<" type:" << temp.m_type << std::endl;
960  m_runlumiToRange.push_back(temp);
961 
962  RunLumiPHIDKey runLumi(m_reducedHistoryIDs.at(temp.m_historyIDIndex), temp.m_run, temp.m_lumi);
963  RunPHIDKey runKey(m_reducedHistoryIDs.at(temp.m_historyIDIndex), temp.m_run);
964 
965  RunLumiToLastEntryMap::iterator itFind = runLumiToLastEntryMap.find(runLumi);
966  if (itFind == runLumiToLastEntryMap.end())
967  {
968  //does not already exist
969  //does the run for this already exist?
970  std::list<unsigned int>::iterator itLastOfRun = m_orderedIndices.end();
971 
972  RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(runKey);
973  bool needNewEntryInRunFirstLastEntryMap = true;
974  if (itRunFirstLastEntryFind != runToFirstLastEntryMap.end())
975  {
976  needNewEntryInRunFirstLastEntryMap=false;
977  if (temp.m_lumi!=0)
978  {
979  //lumis go to the end
980  itLastOfRun = itRunFirstLastEntryFind->second.second;
981  //we want to insert after this one so must advance the iterator
982  ++itLastOfRun;
983  }
984  else
985  {
986  //runs go at the beginning
987  itLastOfRun = itRunFirstLastEntryFind->second.first;
988  }
989  }
990  std::list<unsigned int>::iterator iter = m_orderedIndices.insert(itLastOfRun,index);
991  runLumiToLastEntryMap[runLumi]=iter;
992  if (needNewEntryInRunFirstLastEntryMap)
993  runToFirstLastEntryMap[runKey]=std::make_pair(iter,iter);
994  else
995  {
996  if(temp.m_lumi!=0)
997  {
998  //lumis go at end
999  runToFirstLastEntryMap[runKey].second = iter;
1000  }
1001  else
1002  {
1003  //since we haven't yet seen this run/lumi combination it means we haven't yet seen
1004  // a run so we can put this first
1005  runToFirstLastEntryMap[runKey].first = iter;
1006  }
1007  }
1008  }
1009  else
1010  {
1011  //We need to do a merge since the run/lumi already appeared. Put it after the existing entry
1012  //std::cout <<" found a second instance of "<<runLumi.first<<" "<<runLumi.second<<" at "<<index<<std::endl;
1013  std::list<unsigned int>::iterator itNext = itFind->second;
1014  ++itNext;
1015  std::list<unsigned int>::iterator iter = m_orderedIndices.insert(itNext,index);
1016  RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(runKey);
1017  if (itRunFirstLastEntryFind->second.second == itFind->second)
1018  {
1019  //if the previous one was the last in the run, we need to update to make this one the last
1020  itRunFirstLastEntryFind->second.second = iter;
1021  }
1022  itFind->second = iter;
1023  }
1024  }
1025  m_nextIndexItr = m_orderedIndices.begin();
1027 
1028  if(m_nextIndexItr != m_orderedIndices.end()) {
1029  for( size_t index = 0; index < kNIndicies; ++index) {
1030  m_trees[index] = dynamic_cast<TTree*>(m_file->Get(kTypeNames[index]));
1031  assert(nullptr!=m_trees[index]);
1032  m_treeReaders[index]->setTree(m_trees[index]);
1033  }
1034  }
1035  //After a file open, the framework expects to see a new 'IsRun'
1037 
1038  return true;
1039 }
1040 
1041 bool
1043  if(!m_runsToProcess.empty() && edm::search_all(m_runsToProcess, run) && lumi==0) {
1044  return false;
1045  }
1046 
1047  edm::LuminosityBlockID lumiID = edm::LuminosityBlockID(run, lumi);
1048  edm::LuminosityBlockRange lumiRange = edm::LuminosityBlockRange(lumiID, lumiID);
1050  if(!m_lumisToProcess.empty() && !binary_search_all(m_lumisToProcess, lumiRange, lt)) {
1051  return true;
1052  }
1053  return false;
1054 }
1055 
1056 
1057 void
1058 DQMRootSource::logFileAction(char const* msg, char const* fileName) const {
1059  edm::LogAbsolute("fileAction") << std::setprecision(0) << edm::TimeOfDay() << msg << fileName;
1061 }
1062 
1063 //
1064 // const member functions
1065 //
1066 
1067 //
1068 // static member functions
1069 //
MonitorElement * book2D(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1173
MonitorElement * bookProfile2D(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s")
Definition: DQMStore.cc:1379
TProfile * getTProfile() const
edm::InputSource::ItemType m_nextItemType
unsigned int m_lastSeenRun2
static const char *const kProcessHistoryTree
Definition: format.h:54
static const char *const kRunBranch
Definition: format.h:41
unsigned int lumi() const
int64_t getIntValue() const
std::shared_ptr< edm::RunAuxiliary > readRunAuxiliary_() override
static void logFileAction(char const *msg, std::string const &fileName)
Definition: LHEReader.cc:37
static const char *const kTypeNames[]
Definition: format.h:28
edm::JobReport::Token m_jrToken
void readNextItemType()
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
TProfile2D * getTProfile2D() const
Definition: CLHEP.h:16
void closeFile_() override
void logFileAction(char const *msg, char const *fileName) const
RunNumber_t run() const
Definition: RunID.h:39
edm::RunAuxiliary m_runAux
void FlushMessageLog()
void reportInputRunNumber(unsigned int run)
Definition: JobReport.cc:471
std::vector< edm::RunNumber_t > m_runsToProcess
std::vector< boost::shared_ptr< TreeReaderBase > > m_treeReaders
edm::ProcessHistoryID const & processHistoryID() const
TH1F * getTH1F() const
TH2S * getTH2S() const
static const char *const kIndicesTree
Definition: format.h:40
#define nullptr
bool registerProcessHistory(ProcessHistory const &processHistory)
std::set< MonitorElement * > m_lumiElements
MonitorElement * book1DD(char_string const &name, char_string const &title, int nchX, double lowX, double highX)
Book 1S histogram.
Definition: DQMStore.cc:1114
static const char *const kFirstIndex
Definition: format.h:47
static const char *const kLumiBranch
Definition: format.h:42
size_t m_presentlyOpenFileIndex
std::list< unsigned int >::iterator m_presentIndexItr
unsigned int m_filterOnRun
RunNumber_t run() const
Accessor for current run number.
Definition: InputSource.cc:436
bool operator<(RunPHIDKey const &right) const
std::set< MonitorElement * > m_runElements
static const char *const kFullNameBranch
Definition: format.h:34
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
Definition: RunPrincipal.cc:26
MonitorElement * bookInt(char_string const &name)
Book int.
Definition: DQMStore.cc:1027
MonitorElement * book1D(char_string const &name, char_string const &title, int const nchX, double const lowX, double const highX)
Book 1D histogram.
Definition: DQMStore.cc:1098
unsigned int LuminosityBlockNumber_t
std::vector< edm::ProcessHistoryID > m_reducedHistoryIDs
MonitorElement * bookFloat(char_string const &name)
Book float.
Definition: DQMStore.cc:1048
#define DEFINE_FWK_INPUT_SOURCE(type)
unsigned int run() const
Token inputFileOpened(std::string const &physicalFileName, std::string const &logicalFileName, std::string const &catalog, std::string const &inputType, std::string const &inputSourceClassName, std::string const &moduleLabel, std::string const &guid, std::vector< std::string > const &branchNames)
Definition: JobReport.cc:320
void Fill(long long x)
~DQMRootSource() override
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1500
Definition: ME.h:11
MonitorElement * book2DD(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1195
static const char *const kPHIndexBranch
Definition: format.h:55
static const char *const kParameterSetBranch
Definition: format.h:62
edm::InputSource::ItemType getNextItemType() override
void fillLuminosityBlockPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
std::vector< RunLumiToRange > m_runlumiToRange
void addDefault(ParameterSetDescription const &psetDescription)
edm::LuminosityBlockAuxiliary m_lumiAux
void setLumiFlag()
this ME is meant to be stored for each luminosity section
std::vector< edm::ProcessHistoryID > m_historyIDs
edm::ProcessHistoryID const & processHistoryID() const
edm::ProcessHistoryID processHistoryID_
MonitorElement * get(std::string const &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
Definition: DQMStore.cc:1613
void reportInputLumiSection(unsigned int run, unsigned int lumiSectId)
Definition: JobReport.cc:465
bool m_justOpenedFileSoNeedToGenerateRunTransition
std::shared_ptr< edm::LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
edm::InputFileCatalog m_catalog
edm::ProcessHistoryID m_lastSeenReducedPHID2
static const char *const kParameterSetTree
Definition: format.h:61
std::list< unsigned int > m_orderedIndices
TH2D * getTH2D() const
RunNumber_t run() const
static const char *const kFlagBranch
Definition: format.h:35
static const char *const kTypeBranch
Definition: format.h:46
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
static const char *const kProcessHistoryIndexBranch
Definition: format.h:43
void setProcessHistoryID(ProcessHistoryID const &phid)
static const char *const kEndTimeBranch
Definition: format.h:45
std::vector< std::string > const & logicalFileNames() const
std::unique_ptr< edm::FileBlock > readFile_() override
MonitorElement * bookString(char_string const &name, char_string const &value)
Book string.
Definition: DQMStore.cc:1069
std::vector< TTree * > m_trees
TH2F * getTH2F() const
unsigned int run() const
std::size_t Token
Definition: JobReport.h:106
const std::string getFullname() const
get full name of ME including Pathname
static const char *const kProcessConfigurationPassID
Definition: format.h:59
RunID const & id() const
Definition: RunPrincipal.h:64
MonitorElement * book2S(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2S histogram.
Definition: DQMStore.cc:1184
static void registerFromString(std::string const &rep)
Definition: ParameterSet.cc:79
static const char *const kMetaDataDirectoryAbsolute
Definition: format.h:51
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:571
MonitorElement * bookProfile(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, char const *option="s")
Definition: DQMStore.cc:1285
std::vector< std::string > const & fileNames() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
unsigned int m_lastSeenLumi2
TH3F * getTH3F() const
static const char *const kLastIndex
Definition: format.h:48
std::vector< edm::LuminosityBlockRange > m_lumisToProcess
bool operator<(RunLumiPHIDKey const &right) const
bool search_all(ForwardSequence const &s, Datum const &d)
Definition: Algorithms.h:36
LuminosityBlockNumber_t luminosityBlock() const
static const char *const kProcessConfigurationReleaseVersion
Definition: format.h:58
void addContext(std::string const &context)
Definition: Exception.cc:165
void readRun_(edm::RunPrincipal &rpCache) override
tuple msg
Definition: mps_check.py:279
void setException(std::exception_ptr e)
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
Definition: InputSource.h:327
static const char *const kProcessConfigurationProcessNameBranch
Definition: format.h:56
std::unique_ptr< TFile > m_file
edm::ProcessHistoryID m_lastSeenReducedPHID
HLT enums.
static const char *const kBeginTimeBranch
Definition: format.h:44
bool skipIt(edm::RunNumber_t, edm::LuminosityBlockNumber_t) const
MonitorElement * book1S(char_string const &name, char_string const &title, int nchX, double lowX, double highX)
Book 1S histogram.
Definition: DQMStore.cc:1106
std::vector< EventRange > & sortAndRemoveOverlaps(std::vector< EventRange > &eventRange)
Definition: EventRange.cc:102
std::exception_ptr getException()
RunPHIDKey(edm::ProcessHistoryID const &phid, unsigned int run)
TH1D * getTH1D() const
bool binary_search_all(ForwardSequence const &s, Datum const &d)
wrappers for std::binary_search
Definition: Algorithms.h:58
bool lessThan(EventRange const &lh, EventRange const &rh)
Definition: EventRange.cc:67
TH1S * getTH1S() const
MonitorElement * book3D(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ)
Book 3D histogram.
Definition: DQMStore.cc:1253
RunLumiPHIDKey(edm::ProcessHistoryID const &phid, unsigned int run, unsigned int lumi)
std::list< unsigned int >::iterator m_nextIndexItr
void setProcessHistoryID(ProcessHistoryID const &phid)
Definition: RunAuxiliary.h:36
unsigned int RunNumber_t
DQMRootSource(edm::ParameterSet const &, const edm::InputSourceDescription &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void readEvent_(edm::EventPrincipal &) override
long double T
void readLuminosityBlock_(edm::LuminosityBlockPrincipal &lbCache) override
ProcessHistoryID id() const
unsigned int m_lastSeenRun
void inputFileClosed(InputType inputType, Token fileToken)
Definition: JobReport.cc:376
edm::ProcessHistoryID processHistoryID_
def move(src, dest)
Definition: eostools.py:511
static Registry * instance()
Definition: Registry.cc:12
Helper class to handle FWLite file input sources.
static const char *const kValueBranch
Definition: format.h:36
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
static const char *const kProcessConfigurationParameterSetIDBranch
Definition: format.h:57
bool setupFile(unsigned int iIndex)
static bool CheckBinLabels(const TAxis *a1, const TAxis *a2)
Check the consistency of the axis labels.