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