CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Attributes | Private Attributes
fwlite::EntryFinder Class Reference

#include <EntryFinder.h>

Public Types

typedef
edm::IndexIntoFile::EntryNumber_t 
EntryNumber_t
 

Public Member Functions

bool empty () const
 
 EntryFinder ()
 
void fillIndex (BranchMapReader &branchMap)
 
EntryNumber_t findEvent (edm::RunNumber_t const &run, edm::LuminosityBlockNumber_t const &lumi, edm::EventNumber_t const &event) const
 
EntryNumber_t findLumi (edm::RunNumber_t const &run, edm::LuminosityBlockNumber_t const &lumi) const
 
EntryNumber_t findRun (edm::RunNumber_t const &run) const
 
 ~EntryFinder ()
 

Static Public Attributes

static EntryNumber_t const invalidEntry = -1LL
 

Private Attributes

edm::FileIndex fileIndex_
 
edm::IndexIntoFile indexIntoFile_
 

Detailed Description

Definition at line 29 of file EntryFinder.h.

Member Typedef Documentation

Definition at line 33 of file EntryFinder.h.

Constructor & Destructor Documentation

fwlite::EntryFinder::EntryFinder ( )

Definition at line 53 of file EntryFinder.cc.

53 : indexIntoFile_(), fileIndex_() {}
edm::IndexIntoFile indexIntoFile_
Definition: EntryFinder.h:41
edm::FileIndex fileIndex_
Definition: EntryFinder.h:42
fwlite::EntryFinder::~EntryFinder ( )

Definition at line 54 of file EntryFinder.cc.

54 {}

Member Function Documentation

bool fwlite::EntryFinder::empty ( ) const
inline

Definition at line 34 of file EntryFinder.h.

References edm::FileIndex::empty(), edm::IndexIntoFile::empty(), fileIndex_, and indexIntoFile_.

Referenced by fillIndex().

34 {return indexIntoFile_.empty() && fileIndex_.empty();}
bool empty() const
True if no runs, lumis, or events are in the file.
edm::IndexIntoFile indexIntoFile_
Definition: EntryFinder.h:41
bool empty() const
Definition: FileIndex.h:112
edm::FileIndex fileIndex_
Definition: EntryFinder.h:42
void fwlite::EntryFinder::fillIndex ( BranchMapReader branchMap)

Definition at line 108 of file EntryFinder.cc.

References assert(), b, edm::BranchTypeToAuxiliaryBranchName(), empty(), edm::poolNames::eventTreeName(), Exception, fileIndex_, edm::poolNames::fileIndexBranchName(), fwlite::BranchMapReader::getEventTree(), fwlite::BranchMapReader::getFile(), indexIntoFile_, edm::poolNames::indexIntoFileBranchName(), edm::InEvent, edm::poolNames::metaDataTreeName(), edm::IndexIntoFile::setEventFinder(), and edm::IndexIntoFile::setNumberOfEvents().

108  {
109  if (empty()) {
110  TTree* meta = dynamic_cast<TTree*>(branchMap.getFile()->Get(edm::poolNames::metaDataTreeName().c_str()));
111  if (nullptr == meta) {
112  throw cms::Exception("NoMetaTree") << "The TFile does not contain a TTree named "
114  }
115  if (meta->FindBranch(edm::poolNames::indexIntoFileBranchName().c_str()) != 0) {
116  edm::IndexIntoFile* indexPtr = &indexIntoFile_;
117  TBranch* b = meta->GetBranch(edm::poolNames::indexIntoFileBranchName().c_str());
118  b->SetAddress(&indexPtr);
119  b->GetEntry(0);
120  TTree* eventTree = branchMap.getEventTree();
121  TBranch* auxBranch = eventTree->GetBranch(edm::BranchTypeToAuxiliaryBranchName(edm::InEvent).c_str());
122  if(nullptr == auxBranch) {
123  throw cms::Exception("NoEventAuxilliary") << "The TTree "
125  << " does not contain a branch named 'EventAuxiliary'";
126  }
127 
128  indexIntoFile_.setNumberOfEvents(auxBranch->GetEntries());
129  indexIntoFile_.setEventFinder(std::shared_ptr<edm::IndexIntoFile::EventFinder>(std::make_shared<FWLiteEventFinder>(auxBranch)));
130 
131  } else if (meta->FindBranch(edm::poolNames::fileIndexBranchName().c_str()) != 0) {
132  edm::FileIndex* findexPtr = &fileIndex_;
133  TBranch* b = meta->GetBranch(edm::poolNames::fileIndexBranchName().c_str());
134  b->SetAddress(&findexPtr);
135  b->GetEntry(0);
136  } else {
137  // TBD: fill the FileIndex for old file formats (prior to CMSSW 2_0_0)
138  throw cms::Exception("NoIndexBranch") << "The TFile does not contain a TBranch named " <<
140  }
141  }
142  assert(!empty());
143  }
void setEventFinder(std::shared_ptr< EventFinder > ptr) const
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const &branchType)
Definition: BranchType.cc:115
assert(m_qm.get())
edm::IndexIntoFile indexIntoFile_
Definition: EntryFinder.h:41
std::string const & fileIndexBranchName()
Definition: BranchType.cc:228
std::string const & indexIntoFileBranchName()
Definition: BranchType.cc:233
std::string const & metaDataTreeName()
Definition: BranchType.cc:168
bool empty() const
Definition: EntryFinder.h:34
double b
Definition: hdecay.h:120
edm::FileIndex fileIndex_
Definition: EntryFinder.h:42
void setNumberOfEvents(EntryNumber_t nevents) const
std::string const & eventTreeName()
Definition: BranchType.cc:260
EntryFinder::EntryNumber_t fwlite::EntryFinder::findEvent ( edm::RunNumber_t const &  run,
edm::LuminosityBlockNumber_t const &  lumi,
edm::EventNumber_t const &  event 
) const

Definition at line 57 of file EntryFinder.cc.

References edm::IndexIntoFile::empty(), edm::FileIndex::end(), edm::IndexIntoFile::end(), edm::IndexIntoFile::IndexIntoFileItr::entry(), fileIndex_, edm::FileIndex::findEventPosition(), edm::IndexIntoFile::findEventPosition(), i, indexIntoFile_, invalidEntry, edm::IndexIntoFile::numericalOrder, and runTheMatrix::ret.

57  {
59  if (!indexIntoFile_.empty()) {
62  ret = i.entry();
63  }
64  } else {
66  if (fileIndex_.end() != i) {
67  ret = i->entry_;
68  }
69  }
70  return ret;
71  }
int i
Definition: DBlmapReader.cc:9
tuple ret
prodAgent to be discontinued
tuple lumi
Definition: fjr2json.py:35
bool empty() const
True if no runs, lumis, or events are in the file.
edm::IndexIntoFile indexIntoFile_
Definition: EntryFinder.h:41
std::vector< Element >::const_iterator const_iterator
Definition: FileIndex.h:53
const_iterator findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: FileIndex.cc:91
edm::IndexIntoFile::EntryNumber_t EntryNumber_t
Definition: EntryFinder.h:33
IndexIntoFileItr end(SortOrder sortOrder) const
Used to end an iteration over the Runs, Lumis, and Events in a file.
const_iterator end() const
Definition: FileIndex.h:100
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 but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
static EntryNumber_t const invalidEntry
Definition: EntryFinder.h:39
edm::FileIndex fileIndex_
Definition: EntryFinder.h:42
IndexIntoFileItr findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
EntryFinder::EntryNumber_t fwlite::EntryFinder::findLumi ( edm::RunNumber_t const &  run,
edm::LuminosityBlockNumber_t const &  lumi 
) const

Definition at line 74 of file EntryFinder.cc.

References edm::IndexIntoFile::empty(), edm::FileIndex::end(), edm::IndexIntoFile::end(), edm::IndexIntoFile::IndexIntoFileItr::entry(), fileIndex_, edm::FileIndex::findLumiPosition(), edm::IndexIntoFile::findLumiPosition(), i, indexIntoFile_, invalidEntry, edm::IndexIntoFile::numericalOrder, and runTheMatrix::ret.

74  {
76  if (!indexIntoFile_.empty()) {
79  ret = i.entry();
80  }
81  } else {
83  if (fileIndex_.end() != i) {
84  ret = i->entry_;
85  }
86  }
87  return ret;
88  }
int i
Definition: DBlmapReader.cc:9
tuple ret
prodAgent to be discontinued
tuple lumi
Definition: fjr2json.py:35
bool empty() const
True if no runs, lumis, or events are in the file.
edm::IndexIntoFile indexIntoFile_
Definition: EntryFinder.h:41
std::vector< Element >::const_iterator const_iterator
Definition: FileIndex.h:53
edm::IndexIntoFile::EntryNumber_t EntryNumber_t
Definition: EntryFinder.h:33
IndexIntoFileItr end(SortOrder sortOrder) const
Used to end an iteration over the Runs, Lumis, and Events in a file.
const_iterator end() const
Definition: FileIndex.h:100
static EntryNumber_t const invalidEntry
Definition: EntryFinder.h:39
const_iterator findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: FileIndex.cc:120
IndexIntoFileItr findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
edm::FileIndex fileIndex_
Definition: EntryFinder.h:42
EntryFinder::EntryNumber_t fwlite::EntryFinder::findRun ( edm::RunNumber_t const &  run) const

Definition at line 91 of file EntryFinder.cc.

References edm::IndexIntoFile::empty(), edm::FileIndex::end(), edm::IndexIntoFile::end(), edm::IndexIntoFile::IndexIntoFileItr::entry(), fileIndex_, edm::FileIndex::findRunPosition(), edm::IndexIntoFile::findRunPosition(), i, indexIntoFile_, invalidEntry, edm::IndexIntoFile::numericalOrder, and runTheMatrix::ret.

91  {
93  if (!indexIntoFile_.empty()) {
96  ret = i.entry();
97  }
98  } else {
100  if (fileIndex_.end() != i) {
101  ret = i->entry_;
102  }
103  }
104  return ret;
105  }
int i
Definition: DBlmapReader.cc:9
tuple ret
prodAgent to be discontinued
bool empty() const
True if no runs, lumis, or events are in the file.
edm::IndexIntoFile indexIntoFile_
Definition: EntryFinder.h:41
IndexIntoFileItr findRunPosition(RunNumber_t run) const
Same as findPosition.
std::vector< Element >::const_iterator const_iterator
Definition: FileIndex.h:53
edm::IndexIntoFile::EntryNumber_t EntryNumber_t
Definition: EntryFinder.h:33
const_iterator findRunPosition(RunNumber_t run) const
Definition: FileIndex.cc:136
IndexIntoFileItr end(SortOrder sortOrder) const
Used to end an iteration over the Runs, Lumis, and Events in a file.
const_iterator end() const
Definition: FileIndex.h:100
static EntryNumber_t const invalidEntry
Definition: EntryFinder.h:39
edm::FileIndex fileIndex_
Definition: EntryFinder.h:42

Member Data Documentation

edm::FileIndex fwlite::EntryFinder::fileIndex_
private

Definition at line 42 of file EntryFinder.h.

Referenced by empty(), fillIndex(), findEvent(), findLumi(), and findRun().

edm::IndexIntoFile fwlite::EntryFinder::indexIntoFile_
private

Definition at line 41 of file EntryFinder.h.

Referenced by empty(), fillIndex(), findEvent(), findLumi(), and findRun().

EntryNumber_t const fwlite::EntryFinder::invalidEntry = -1LL
static

Definition at line 39 of file EntryFinder.h.

Referenced by findEvent(), findLumi(), and findRun().