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::auto_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  // We do not want to reset here Lumi products, since a dedicated
589  // resetting is done at every lumi transition.
590  if (ME->getLumiFlag()) continue;
591  if ( !(*store).isCollate() )
592  ME->Reset();
593  }
594  }
595  m_lastSeenReducedPHID = m_reducedHistoryIDs.at(runLumiRange.m_historyIDIndex);
596  m_lastSeenRun = runID;
597  }
598 
600 
601  //NOTE: it is possible to have a Run when all we have stored is lumis
602  if(runLumiRange.m_lumi == 0) {
603  readElements();
604  }
605 
606 
608  jr->reportInputRunNumber(rpCache.id().run());
609 
611 }
612 
613 
614 void
616 {
617  assert(m_presentIndexItr != m_orderedIndices.end());
618  RunLumiToRange runLumiRange = m_runlumiToRange[*m_presentIndexItr];
619  assert(runLumiRange.m_run == lbCache.id().run());
620  assert(runLumiRange.m_lumi == lbCache.id().luminosityBlock());
621 
622  //NOTE: need to reset all lumi block elements at this point
623  if( ( m_lastSeenLumi2 != runLumiRange.m_lumi ||
624  m_lastSeenRun2 != runLumiRange.m_run ||
625  m_lastSeenReducedPHID2 != m_reducedHistoryIDs.at(runLumiRange.m_historyIDIndex) )
626  && m_shouldReadMEs) {
627 
629  std::vector<MonitorElement*> allMEs = (*store).getAllContents("");
630  for(auto const& ME : allMEs) {
631  // We do not want to reset Run Products here!
632  if (ME->getLumiFlag()) {
633  ME->Reset();
634  }
635  }
636  m_lastSeenReducedPHID2 = m_reducedHistoryIDs.at(runLumiRange.m_historyIDIndex);
637  m_lastSeenRun2 = runLumiRange.m_run;
638  m_lastSeenLumi2 = runLumiRange.m_lumi;
639  }
640 
642  readElements();
643 
645  jr->reportInputLumiSection(lbCache.id().run(),lbCache.id().luminosityBlock());
646 
648 
649 }
650 
651 std::unique_ptr<edm::FileBlock>
653  auto const numFiles = m_catalog.fileNames().size();
654  while(m_fileIndex < numFiles && not setupFile(m_fileIndex++)) {}
655 
656  if(m_file.get() == nullptr) {
657  //last file in list was bad
659  return std::unique_ptr<edm::FileBlock>(new edm::FileBlock);
660  }
661 
665 
669  std::string(),
670  std::string(),
671  "DQMRootSource",
672  "source",
673  m_file->GetUUID().AsString(),//edm::createGlobalIdentifier(),
674  std::vector<std::string>()
675  );
676 
677  return std::unique_ptr<edm::FileBlock>(new edm::FileBlock);
678 }
679 
680 void
682  if(m_file.get()==nullptr) { return; }
685 }
686 
689  RunLumiToRange runLumiRange = m_runlumiToRange[*m_presentIndexItr];
690  bool shouldContinue = false;
691  do
692  {
693  shouldContinue = false;
697 
698  if(runLumiRange.m_type != kNoTypesStored) {
699  boost::shared_ptr<TreeReaderBase> reader = m_treeReaders[runLumiRange.m_type];
700  ULong64_t index = runLumiRange.m_firstIndex;
701  ULong64_t endIndex = runLumiRange.m_lastIndex+1;
702  for (; index != endIndex; ++index)
703  {
704  bool isLumi = runLumiRange.m_lumi !=0;
705  if (m_shouldReadMEs)
706  reader->read(index,*store,isLumi);
707 
708  //std::cout << runLumiRange.m_run << " " << runLumiRange.m_lumi <<" "<<index<< " " << runLumiRange.m_type << std::endl;
709  }
710  }
711 
712  if (m_presentIndexItr != m_orderedIndices.end())
713  {
714  //are there more parts to this same run/lumi?
715  const RunLumiToRange nextRunLumiRange = m_runlumiToRange[*m_presentIndexItr];
716  //continue to the next item if that item is either
717  if ( (m_reducedHistoryIDs.at(nextRunLumiRange.m_historyIDIndex) == m_reducedHistoryIDs.at(runLumiRange.m_historyIDIndex)) &&
718  (nextRunLumiRange.m_run == runLumiRange.m_run) &&
719  (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) )
720  {
721  shouldContinue= true;
722  runLumiRange = nextRunLumiRange;
723  }
724  }
725  } while(shouldContinue);
726 }
727 
729 {
730  //Do the work of actually figuring out where next to go
731 
732  assert (m_nextIndexItr != m_orderedIndices.end());
733  RunLumiToRange runLumiRange = m_runlumiToRange[*m_nextIndexItr];
734 
736  if (runLumiRange.m_lumi != 0 && m_nextItemType == edm::InputSource::IsRun) {
738  return;
739  }
740  ++m_nextIndexItr;
741  }
742  else
743  {
744  //NOTE: the following makes the iterator not be advanced in the
745  //do while loop below.
746  runLumiRange.m_run=0;
747  }
748 
749  bool shouldContinue = false;
750  do
751  {
752  shouldContinue = false;
754  ++m_nextIndexItr;
755 
756  if (m_nextIndexItr == m_orderedIndices.end())
757  {
758  //go to next file
760  //std::cout <<"going to next file"<<std::endl;
761  if(m_fileIndex == m_catalog.fileNames().size()) {
763  }
764  break;
765  }
766  const RunLumiToRange nextRunLumiRange = m_runlumiToRange[*m_nextIndexItr];
767  //continue to the next item if that item is the same run or lumi as we just did
768  if( (m_reducedHistoryIDs.at(nextRunLumiRange.m_historyIDIndex) == m_reducedHistoryIDs.at(runLumiRange.m_historyIDIndex) ) &&
769  (nextRunLumiRange.m_run == runLumiRange.m_run) &&
770  (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) ) {
771  shouldContinue= true;
772  ++m_nextIndexItr;
773  //std::cout <<"advancing " <<nextRunLumiRange.m_run<<" "<<nextRunLumiRange.m_lumi<<std::endl;
774  }
775  } while(shouldContinue);
776 
777  if(m_nextIndexItr != m_orderedIndices.end()) {
782  } else {
784  }
785  }
786 }
787 
788 bool
789 DQMRootSource::setupFile(unsigned int iIndex)
790 {
791  if(m_file.get() != nullptr && iIndex > 0) {
792  m_file->Close();
793  logFileAction(" Closed file ", m_catalog.fileNames()[iIndex-1].c_str());
794  }
795  logFileAction(" Initiating request to open file ", m_catalog.fileNames()[iIndex].c_str());
796  m_presentlyOpenFileIndex = iIndex;
797  m_file.reset();
798  std::auto_ptr<TFile> newFile;
799  try {
800  // ROOT's context management implicitly assumes that a file is opened and
801  // closed on the same thread. To avoid the problem, we declare a local
802  // TContext object; when it goes out of scope, its destructor unregisters
803  // the context, guaranteeing the context is unregistered in the same thread
804  // it was registered in.
805  TDirectory::TContext contextEraser;
806  newFile = std::auto_ptr<TFile>(TFile::Open(m_catalog.fileNames()[iIndex].c_str()));
807 
808  //Since ROOT6, we can not propagate an exception through ROOT's plugin
809  // system so we trap them and then pull from this function
810  std::exception_ptr e = edm::threadLocalException::getException();
811  if(e != std::exception_ptr()) {
812  edm::threadLocalException::setException(std::exception_ptr());
813  std::rethrow_exception(e);
814  }
815 
816  } catch(cms::Exception const& e) {
817  if(!m_skipBadFiles) {
819  ex.addContext("Opening DQM Root file");
820  ex <<"\nInput file " << m_catalog.fileNames()[iIndex] << " was not found, could not be opened, or is corrupted.\n";
821  throw ex;
822  }
823  return false;
824  }
825  if(not newFile->IsZombie()) {
826  logFileAction(" Successfully opened file ", m_catalog.fileNames()[iIndex].c_str());
827  } else {
828  if(!m_skipBadFiles) {
830  ex<<"Input file "<<m_catalog.fileNames()[iIndex].c_str() <<" could not be opened.\n";
831  ex.addContext("Opening DQM Root file");
832  throw ex;
833  }
834  return false;
835  }
836  //Check file format version, which is encoded in the Title of the TFile
837  if(0 != strcmp(newFile->GetTitle(),"1")) {
839  ex<<"Input file "<<m_catalog.fileNames()[iIndex].c_str() <<" does not appear to be a DQM Root file.\n";
840  }
841 
842  //Get meta Data
843  TDirectory* metaDir = newFile->GetDirectory(kMetaDataDirectoryAbsolute);
844  if(nullptr==metaDir) {
845  if(!m_skipBadFiles) {
847  ex<<"Input file "<<m_catalog.fileNames()[iIndex].c_str() <<" appears to be corrupted since it does not have the proper internal structure.\n"
848  " Check to see if the file was closed properly.\n";
849  ex.addContext("Opening DQM Root file");
850  throw ex;
851  }
852  else {return false;}
853  }
854  m_file = newFile; //passed all tests so now we want to use this file
855  TTree* parameterSetTree = dynamic_cast<TTree*>(metaDir->Get(kParameterSetTree));
856  assert(nullptr!=parameterSetTree);
857 
859  assert(nullptr!=psr);
860  {
861  std::string blob;
862  std::string* pBlob = &blob;
863  parameterSetTree->SetBranchAddress(kParameterSetBranch,&pBlob);
864  for(unsigned int index = 0; index != parameterSetTree->GetEntries();++index)
865  {
866  parameterSetTree->GetEntry(index);
868  }
869  }
870 
871  {
872  TTree* processHistoryTree = dynamic_cast<TTree*>(metaDir->Get(kProcessHistoryTree));
873  assert(nullptr!=processHistoryTree);
874  unsigned int phIndex = 0;
875  processHistoryTree->SetBranchAddress(kPHIndexBranch,&phIndex);
877  std::string* pProcessName = &processName;
878  processHistoryTree->SetBranchAddress(kProcessConfigurationProcessNameBranch,&pProcessName);
879  std::string parameterSetIDBlob;
880  std::string* pParameterSetIDBlob = &parameterSetIDBlob;
881  processHistoryTree->SetBranchAddress(kProcessConfigurationParameterSetIDBranch,&pParameterSetIDBlob);
882  std::string releaseVersion;
883  std::string* pReleaseVersion = &releaseVersion;
884  processHistoryTree->SetBranchAddress(kProcessConfigurationReleaseVersion,&pReleaseVersion);
885  std::string passID;
886  std::string* pPassID = &passID;
887  processHistoryTree->SetBranchAddress(kProcessConfigurationPassID,&pPassID);
888 
890  std::vector<edm::ProcessConfiguration> configs;
891  configs.reserve(5);
892  m_historyIDs.clear();
893  m_reducedHistoryIDs.clear();
894  for(unsigned int i=0; i != processHistoryTree->GetEntries(); ++i) {
895  processHistoryTree->GetEntry(i);
896  if(phIndex==0) {
897  if(not configs.empty()) {
898  edm::ProcessHistory ph(configs);
899  m_historyIDs.push_back(ph.id());
900  phr.registerProcessHistory(ph);
901  m_reducedHistoryIDs.push_back(phr.reducedProcessHistoryID(ph.id()));
902  }
903  configs.clear();
904  }
905  edm::ParameterSetID psetID(parameterSetIDBlob);
906  edm::ProcessConfiguration pc(processName, psetID,releaseVersion,passID);
907  configs.push_back(pc);
908  }
909  if(not configs.empty()) {
910  edm::ProcessHistory ph(configs);
911  m_historyIDs.push_back(ph.id());
912  phr.registerProcessHistory(ph);
913  m_reducedHistoryIDs.push_back(phr.reducedProcessHistoryID(ph.id()));
914  //std::cout <<"inserted "<<ph.id()<<std::endl;
915  }
916  }
917 
918  //Setup the indices
919  TTree* indicesTree = dynamic_cast<TTree*>(m_file->Get(kIndicesTree));
920  assert(nullptr!=indicesTree);
921 
922  m_runlumiToRange.clear();
923  m_runlumiToRange.reserve(indicesTree->GetEntries());
924  m_orderedIndices.clear();
925 
926  RunLumiToRange temp;
927  indicesTree->SetBranchAddress(kRunBranch,&temp.m_run);
928  indicesTree->SetBranchAddress(kLumiBranch,&temp.m_lumi);
929  indicesTree->SetBranchAddress(kBeginTimeBranch,&temp.m_beginTime);
930  indicesTree->SetBranchAddress(kEndTimeBranch,&temp.m_endTime);
931  indicesTree->SetBranchAddress(kProcessHistoryIndexBranch,&temp.m_historyIDIndex);
932  indicesTree->SetBranchAddress(kTypeBranch,&temp.m_type);
933  indicesTree->SetBranchAddress(kFirstIndex,&temp.m_firstIndex);
934  indicesTree->SetBranchAddress(kLastIndex,&temp.m_lastIndex);
935 
936  //Need to reorder items since if there was a merge done the same Run
937  //and/or Lumi can appear multiple times but we want to process them
938  //all at once
939 
940  //We use a std::list for m_orderedIndices since inserting into the
941  //middle of a std::list does not disrupt the iterators to already
942  //existing entries
943 
944  //The Map is used to see if a Run/Lumi pair has appeared before
945  typedef std::map<RunLumiPHIDKey, std::list<unsigned int>::iterator > RunLumiToLastEntryMap;
946  RunLumiToLastEntryMap runLumiToLastEntryMap;
947 
948  //Need to group all lumis for the same run together and move the run
949  //entry to the beginning
950  typedef std::map<RunPHIDKey, std::pair< std::list<unsigned int>::iterator, std::list<unsigned int>::iterator> > RunToFirstLastEntryMap;
951  RunToFirstLastEntryMap runToFirstLastEntryMap;
952 
953  for (Long64_t index = 0; index != indicesTree->GetEntries(); ++index)
954  {
955  indicesTree->GetEntry(index);
956 // std::cout <<"read r:"<<temp.m_run
957 // <<" l:"<<temp.m_lumi
958 // <<" b:"<<temp.m_beginTime
959 // <<" e:"<<temp.m_endTime
960 // <<" fi:" << temp.m_firstIndex
961 // <<" li:" << temp.m_lastIndex
962 // <<" type:" << temp.m_type << std::endl;
963  m_runlumiToRange.push_back(temp);
964 
965  RunLumiPHIDKey runLumi(m_reducedHistoryIDs.at(temp.m_historyIDIndex), temp.m_run, temp.m_lumi);
966  RunPHIDKey runKey(m_reducedHistoryIDs.at(temp.m_historyIDIndex), temp.m_run);
967 
968  RunLumiToLastEntryMap::iterator itFind = runLumiToLastEntryMap.find(runLumi);
969  if (itFind == runLumiToLastEntryMap.end())
970  {
971  //does not already exist
972  //does the run for this already exist?
973  std::list<unsigned int>::iterator itLastOfRun = m_orderedIndices.end();
974 
975  RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(runKey);
976  bool needNewEntryInRunFirstLastEntryMap = true;
977  if (itRunFirstLastEntryFind != runToFirstLastEntryMap.end())
978  {
979  needNewEntryInRunFirstLastEntryMap=false;
980  if (temp.m_lumi!=0)
981  {
982  //lumis go to the end
983  itLastOfRun = itRunFirstLastEntryFind->second.second;
984  //we want to insert after this one so must advance the iterator
985  ++itLastOfRun;
986  }
987  else
988  {
989  //runs go at the beginning
990  itLastOfRun = itRunFirstLastEntryFind->second.first;
991  }
992  }
993  std::list<unsigned int>::iterator iter = m_orderedIndices.insert(itLastOfRun,index);
994  runLumiToLastEntryMap[runLumi]=iter;
995  if (needNewEntryInRunFirstLastEntryMap)
996  runToFirstLastEntryMap[runKey]=std::make_pair(iter,iter);
997  else
998  {
999  if(temp.m_lumi!=0)
1000  {
1001  //lumis go at end
1002  runToFirstLastEntryMap[runKey].second = iter;
1003  }
1004  else
1005  {
1006  //since we haven't yet seen this run/lumi combination it means we haven't yet seen
1007  // a run so we can put this first
1008  runToFirstLastEntryMap[runKey].first = iter;
1009  }
1010  }
1011  }
1012  else
1013  {
1014  //We need to do a merge since the run/lumi already appeared. Put it after the existing entry
1015  //std::cout <<" found a second instance of "<<runLumi.first<<" "<<runLumi.second<<" at "<<index<<std::endl;
1016  std::list<unsigned int>::iterator itNext = itFind->second;
1017  ++itNext;
1018  std::list<unsigned int>::iterator iter = m_orderedIndices.insert(itNext,index);
1019  RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(runKey);
1020  if (itRunFirstLastEntryFind->second.second == itFind->second)
1021  {
1022  //if the previous one was the last in the run, we need to update to make this one the last
1023  itRunFirstLastEntryFind->second.second = iter;
1024  }
1025  itFind->second = iter;
1026  }
1027  }
1028  m_nextIndexItr = m_orderedIndices.begin();
1030 
1031  if(m_nextIndexItr != m_orderedIndices.end()) {
1032  for( size_t index = 0; index < kNIndicies; ++index) {
1033  m_trees[index] = dynamic_cast<TTree*>(m_file->Get(kTypeNames[index]));
1034  assert(nullptr!=m_trees[index]);
1035  m_treeReaders[index]->setTree(m_trees[index]);
1036  }
1037  }
1038  //After a file open, the framework expects to see a new 'IsRun'
1040 
1041  return true;
1042 }
1043 
1044 bool
1046  if(!m_runsToProcess.empty() && edm::search_all(m_runsToProcess, run) && lumi==0) {
1047  return false;
1048  }
1049 
1050  edm::LuminosityBlockID lumiID = edm::LuminosityBlockID(run, lumi);
1051  edm::LuminosityBlockRange lumiRange = edm::LuminosityBlockRange(lumiID, lumiID);
1053  if(!m_lumisToProcess.empty() && !binary_search_all(m_lumisToProcess, lumiRange, lt)) {
1054  return true;
1055  }
1056  return false;
1057 }
1058 
1059 
1060 void
1061 DQMRootSource::logFileAction(char const* msg, char const* fileName) const {
1062  edm::LogAbsolute("fileAction") << std::setprecision(0) << edm::TimeOfDay() << msg << fileName;
1064 }
1065 
1066 //
1067 // const member functions
1068 //
1069 
1070 //
1071 // static member functions
1072 //
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
MonitorElement * book2S(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2S histogram.
Definition: DQMStore.cc:987
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
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:837
edm::RunAuxiliary m_runAux
void FlushMessageLog()
void reportInputRunNumber(unsigned int run)
Definition: JobReport.cc:502
std::vector< edm::RunNumber_t > m_runsToProcess
std::vector< boost::shared_ptr< TreeReaderBase > > m_treeReaders
edm::ProcessHistoryID const & processHistoryID() const
TH1F * getTH1F() const
MonitorElement * book3D(const char *name, const char *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:1118
TH2S * getTH2S() const
MonitorElement * book2DD(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D double histogram.
Definition: DQMStore.cc:1009
static const char *const kIndicesTree
Definition: format.h:40
bool registerProcessHistory(ProcessHistory const &processHistory)
std::set< MonitorElement * > m_lumiElements
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:497
bool operator<(RunPHIDKey const &right) const
std::set< MonitorElement * > m_runElements
static const char *const kFullNameBranch
Definition: format.h:34
MonitorElement * book1DD(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1S histogram.
Definition: DQMStore.cc:869
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
Definition: RunPrincipal.cc:20
#define nullptr
unsigned int LuminosityBlockNumber_t
std::vector< edm::ProcessHistoryID > m_reducedHistoryIDs
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:774
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:341
void Fill(long long x)
~DQMRootSource() override
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1496
Definition: ME.h:11
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
#define DEFINE_FWK_INPUT_SOURCE(type)
std::vector< edm::ProcessHistoryID > m_historyIDs
edm::ProcessHistoryID const & processHistoryID() const
MonitorElement * bookString(const char *name, const char *value)
Book string.
Definition: DQMStore.cc:803
edm::ProcessHistoryID processHistoryID_
void reportInputLumiSection(unsigned int run, unsigned int lumiSectId)
Definition: JobReport.cc:492
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
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
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
std::auto_ptr< TFile > m_file
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
static const char *const kProcessHistoryIndexBranch
Definition: format.h:43
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1170
void setProcessHistoryID(ProcessHistoryID const &phid)
static const char *const kEndTimeBranch
Definition: format.h:45
std::vector< std::string > const & logicalFileNames() const
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
Definition: DQMStore.cc:1610
std::unique_ptr< edm::FileBlock > readFile_() override
std::vector< TTree * > m_trees
TH2F * getTH2F() const
unsigned int run() const
std::size_t Token
Definition: JobReport.h:107
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:69
static void registerFromString(std::string const &rep)
Definition: ParameterSet.cc:95
static const char *const kMetaDataDirectoryAbsolute
Definition: format.h:51
std::vector< std::string > const & fileNames() const
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:46
LuminosityBlockNumber_t luminosityBlock() const
static const char *const kProcessConfigurationReleaseVersion
Definition: format.h:58
void addContext(std::string const &context)
Definition: Exception.cc:227
void readRun_(edm::RunPrincipal &rpCache) override
tuple msg
Definition: mps_check.py:277
void setException(std::exception_ptr e)
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
Definition: InputSource.h:335
static const char *const kProcessConfigurationProcessNameBranch
Definition: format.h:56
edm::ProcessHistoryID m_lastSeenReducedPHID
HLT enums.
static const char *const kBeginTimeBranch
Definition: format.h:44
bool skipIt(edm::RunNumber_t, edm::LuminosityBlockNumber_t) const
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:76
bool lessThan(EventRange const &lh, EventRange const &rh)
Definition: EventRange.cc:67
TH1S * getTH1S() const
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)
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:744
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:965
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:401
edm::ProcessHistoryID processHistoryID_
MonitorElement * book1S(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1S histogram.
Definition: DQMStore.cc:853
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:545
static Registry * instance()
Definition: Registry.cc:13
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.
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")
Definition: DQMStore.cc:1314