CMS 3D CMS Logo

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

#include <FileIndex.h>

Classes

class  Element
 
struct  Transients
 

Public Types

typedef std::vector< Element >
::const_iterator 
const_iterator
 
typedef long long EntryNumber_t
 
enum  EntryType { kRun, kLumi, kEvent, kEnd }
 
typedef std::vector< Element >
::iterator 
iterator
 
enum  SortState { kNotSorted, kSorted_Run_Lumi_Event, kSorted_Run_Lumi_EventEntry }
 

Public Member Functions

void addEntry (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry)
 
bool allEventsInEntryOrder () const
 
const_iterator begin () const
 
iterator begin ()
 
bool containsEvent (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
 
bool containsItem (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
 
bool containsLumi (RunNumber_t run, LuminosityBlockNumber_t lumi) const
 
bool containsRun (RunNumber_t run) const
 
bool empty () const
 
const_iterator end () const
 
iterator end ()
 
iterator erase (iterator pos)
 
iterator erase (iterator begin, iterator end)
 
 FileIndex ()
 
const_iterator findEventEntryPosition (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry) const
 
const_iterator findEventPosition (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
 
const_iterator findLumiOrRunPosition (RunNumber_t run, LuminosityBlockNumber_t lumi) const
 
const_iterator findLumiPosition (RunNumber_t run, LuminosityBlockNumber_t lumi) const
 
const_iterator findPosition (RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
 
const_iterator findRunPosition (RunNumber_t run) const
 
std::vector< Element >::size_type size () const
 
void sortBy_Run_Lumi_Event ()
 
void sortBy_Run_Lumi_EventEntry ()
 
 ~FileIndex ()
 

Private Member Functions

bool & allInEntryOrder () const
 
bool & resultCached () const
 
SortStatesortState () const
 

Private Attributes

std::vector< Elemententries_
 
Transient< Transientstransients_
 

Detailed Description

Definition at line 20 of file FileIndex.h.

Member Typedef Documentation

Definition at line 53 of file FileIndex.h.

typedef long long edm::FileIndex::EntryNumber_t

Definition at line 23 of file FileIndex.h.

typedef std::vector<Element>::iterator edm::FileIndex::iterator

Definition at line 55 of file FileIndex.h.

Member Enumeration Documentation

Enumerator
kRun 
kLumi 
kEvent 
kEnd 

Definition at line 30 of file FileIndex.h.

Enumerator
kNotSorted 
kSorted_Run_Lumi_Event 
kSorted_Run_Lumi_EventEntry 

Definition at line 116 of file FileIndex.h.

Constructor & Destructor Documentation

edm::FileIndex::FileIndex ( )

Definition at line 10 of file FileIndex.cc.

10 : entries_(), transients_() {}
Transient< Transients > transients_
Definition: FileIndex.h:132
std::vector< Element > entries_
Definition: FileIndex.h:131
edm::FileIndex::~FileIndex ( )
inline

Definition at line 26 of file FileIndex.h.

26 {}

Member Function Documentation

void edm::FileIndex::addEntry ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event,
EntryNumber_t  entry 
)

Definition at line 22 of file FileIndex.cc.

References entries_, kNotSorted, resultCached(), and sortState().

22  {
23  entries_.push_back(FileIndex::Element(run, lumi, event, entry));
24  resultCached() = false;
26  }
tuple lumi
Definition: fjr2json.py:41
SortState & sortState() const
Definition: FileIndex.h:129
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
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
std::vector< Element > entries_
Definition: FileIndex.h:131
bool & resultCached() const
Definition: FileIndex.h:128
bool edm::FileIndex::allEventsInEntryOrder ( ) const

Definition at line 40 of file FileIndex.cc.

References allInEntryOrder(), entries_, edm::FileIndex::Element::invalidEntry, kEvent, and resultCached().

40  {
41  if(!resultCached()) {
42  resultCached() = true;
44  for(std::vector<FileIndex::Element>::const_iterator it = entries_.begin(), itEnd = entries_.end(); it != itEnd; ++it) {
45  if(it->getEntryType() == kEvent) {
46  if(it->entry_ < maxEntry) {
47  allInEntryOrder() = false;
48  return false;
49  }
50  maxEntry = it->entry_;
51  }
52  }
53  allInEntryOrder() = true;
54  return true;
55  }
56  return allInEntryOrder();
57  }
bool & allInEntryOrder() const
Definition: FileIndex.h:127
static EntryNumber_t const invalidEntry
Definition: FileIndex.h:34
long long EntryNumber_t
Definition: FileIndex.h:23
std::vector< Element > entries_
Definition: FileIndex.h:131
bool & resultCached() const
Definition: FileIndex.h:128
bool& edm::FileIndex::allInEntryOrder ( ) const
inlineprivate

Definition at line 127 of file FileIndex.h.

References transients_.

Referenced by allEventsInEntryOrder().

127 {return transients_.get().allInEntryOrder_;}
Transient< Transients > transients_
Definition: FileIndex.h:132
const_iterator edm::FileIndex::begin ( void  ) const
inline

Definition at line 98 of file FileIndex.h.

References entries_.

Referenced by edm::operator<<().

98 {return entries_.begin();}
std::vector< Element > entries_
Definition: FileIndex.h:131
iterator edm::FileIndex::begin ( void  )
inline

Definition at line 102 of file FileIndex.h.

References entries_.

102 {return entries_.begin();}
std::vector< Element > entries_
Definition: FileIndex.h:131
bool edm::FileIndex::containsEvent ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
) const
inline

Definition at line 84 of file FileIndex.h.

References entries_, and findEventPosition().

Referenced by containsItem().

84  {
85  return findEventPosition(run, lumi, event) != entries_.end();
86  }
tuple lumi
Definition: fjr2json.py:41
const_iterator findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: FileIndex.cc:85
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
std::vector< Element > entries_
Definition: FileIndex.h:131
bool edm::FileIndex::containsItem ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
) const
inline

Definition at line 79 of file FileIndex.h.

References containsEvent(), containsLumi(), and containsRun().

79  {
80  return event ? containsEvent(run, lumi, event) : (lumi ? containsLumi(run, lumi) : containsRun(run));
81  }
tuple lumi
Definition: fjr2json.py:41
bool containsRun(RunNumber_t run) const
Definition: FileIndex.h:94
bool containsLumi(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: FileIndex.h:89
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
bool containsEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: FileIndex.h:84
bool edm::FileIndex::containsLumi ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
) const
inline

Definition at line 89 of file FileIndex.h.

References entries_, and findLumiPosition().

Referenced by containsItem().

89  {
90  return findLumiPosition(run, lumi) != entries_.end();
91  }
tuple lumi
Definition: fjr2json.py:41
const_iterator findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: FileIndex.cc:114
std::vector< Element > entries_
Definition: FileIndex.h:131
bool edm::FileIndex::containsRun ( RunNumber_t  run) const
inline

Definition at line 94 of file FileIndex.h.

References entries_, and findRunPosition().

Referenced by containsItem().

94  {
95  return findRunPosition(run) != entries_.end();
96  }
const_iterator findRunPosition(RunNumber_t run) const
Definition: FileIndex.cc:130
std::vector< Element > entries_
Definition: FileIndex.h:131
bool edm::FileIndex::empty ( ) const
inline
const_iterator edm::FileIndex::end ( void  ) const
inline
iterator edm::FileIndex::end ( void  )
inline

Definition at line 104 of file FileIndex.h.

References entries_.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

104 {return entries_.end();}
std::vector< Element > entries_
Definition: FileIndex.h:131
iterator edm::FileIndex::erase ( iterator  pos)
inline

Definition at line 106 of file FileIndex.h.

References entries_.

106 {return entries_.erase(pos);}
std::vector< Element > entries_
Definition: FileIndex.h:131
iterator edm::FileIndex::erase ( iterator  begin,
iterator  end 
)
inline

Definition at line 108 of file FileIndex.h.

References entries_.

108 {return entries_.erase(begin, end);}
const_iterator end() const
Definition: FileIndex.h:100
std::vector< Element > entries_
Definition: FileIndex.h:131
const_iterator begin() const
Definition: FileIndex.h:98
FileIndex::const_iterator edm::FileIndex::findEventEntryPosition ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event,
EntryNumber_t  entry 
) const

Definition at line 156 of file FileIndex.cc.

References entries_, findEventPosition(), kNotSorted, kSorted_Run_Lumi_EventEntry, edm::lower_bound_all(), and sortState().

156  {
157  assert(sortState() != kNotSorted);
158  const_iterator it;
159  const_iterator itEnd = entries_.end();
161  assert(lumi != 0U);
162  Element el(run, lumi, event, entry);
163  it = lower_bound_all(entries_, el, Compare_Run_Lumi_EventEntry());
164  } else {
166  while(it != itEnd && it->entry_ != entry && it->event_ == event) {
167  ++it;
168  }
169  }
170  if(it == itEnd) return itEnd;
171  if(lumi == 0) lumi = it->lumi_;
172  if(it->run_ != run || it->lumi_ != lumi || it->event_ != event || it->entry_ != entry) return itEnd;
173  return it;
174  }
ForwardSequence::const_iterator lower_bound_all(ForwardSequence const &s, Datum const &d)
wrappers for std::lower_bound
Definition: Algorithms.h:91
tuple lumi
Definition: fjr2json.py:41
SortState & sortState() const
Definition: FileIndex.h:129
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:85
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
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
std::vector< Element > entries_
Definition: FileIndex.h:131
FileIndex::const_iterator edm::FileIndex::findEventPosition ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
) const

Definition at line 85 of file FileIndex.cc.

References entries_, findPosition(), kEvent, kSorted_Run_Lumi_Event, and sortState().

Referenced by containsEvent(), fwlite::EntryFinder::findEvent(), and findEventEntryPosition().

85  {
86 
88  const_iterator itEnd = entries_.end();
89  while(it != itEnd && it->getEntryType() != FileIndex::kEvent) {
90  ++it;
91  }
92  if(it == itEnd) {
93  return itEnd;
94  }
95  if(lumi == 0) {
96  lumi = it->lumi_;
97  }
98  if(it->run_ != run || it->lumi_ != lumi || it->event_ != event) {
100  return itEnd;
101  }
102  // not sorted by event, so we need to do a linear search
103  while (it != itEnd && it->run_ == run && it->lumi_ == lumi && it->event_ != event) {
104  ++it;
105  }
106  if(it->run_ != run || it->lumi_ != lumi || it->event_ != event) {
107  return itEnd;
108  }
109  }
110  return it;
111  }
tuple lumi
Definition: fjr2json.py:41
SortState & sortState() const
Definition: FileIndex.h:129
std::vector< Element >::const_iterator const_iterator
Definition: FileIndex.h:53
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
std::vector< Element > entries_
Definition: FileIndex.h:131
const_iterator findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
Definition: FileIndex.cc:60
FileIndex::const_iterator edm::FileIndex::findLumiOrRunPosition ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
) const

Definition at line 146 of file FileIndex.cc.

References entries_, findPosition(), kLumi, and kRun.

146  {
147  const_iterator it = findPosition(run, lumi, 0U);
148  const_iterator itEnd = entries_.end();
149  while(it != itEnd && it->getEntryType() != FileIndex::kLumi && it->getEntryType() != FileIndex::kRun) {
150  ++it;
151  }
152  return it;
153  }
tuple lumi
Definition: fjr2json.py:41
std::vector< Element >::const_iterator const_iterator
Definition: FileIndex.h:53
std::vector< Element > entries_
Definition: FileIndex.h:131
const_iterator findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
Definition: FileIndex.cc:60
FileIndex::const_iterator edm::FileIndex::findLumiPosition ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
) const

Definition at line 114 of file FileIndex.cc.

References entries_, findPosition(), and kLumi.

Referenced by containsLumi(), and fwlite::EntryFinder::findLumi().

114  {
115  const_iterator it = findPosition(run, lumi, 0U);
116  const_iterator itEnd = entries_.end();
117  while(it != itEnd && it->getEntryType() != FileIndex::kLumi) {
118  ++it;
119  }
120  if(it == itEnd) {
121  return itEnd;
122  }
123  if(it->run_ != run || it->lumi_ != lumi) {
124  return itEnd;
125  }
126  return it;
127  }
tuple lumi
Definition: fjr2json.py:41
std::vector< Element >::const_iterator const_iterator
Definition: FileIndex.h:53
std::vector< Element > entries_
Definition: FileIndex.h:131
const_iterator findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
Definition: FileIndex.cc:60
FileIndex::const_iterator edm::FileIndex::findPosition ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi = 0U,
EventNumber_t  event = 0U 
) const

Definition at line 60 of file FileIndex.cc.

References entries_, kNotSorted, kSorted_Run_Lumi_Event, edm::lower_bound_all(), and sortState().

Referenced by findEventPosition(), findLumiOrRunPosition(), findLumiPosition(), and findRunPosition().

60  {
61  assert(sortState() != kNotSorted);
62 
63  const_iterator itEnd = entries_.end();
64  const_iterator it;
65  Element el(run, lumi, event);
67  it = lower_bound_all(entries_, el);
68  bool lumiMissing = (lumi == 0 && event != 0);
69  if(lumiMissing) {
70  while(it != itEnd && it->run_ < run) {
71  ++it;
72  }
73  while(it != itEnd && (it->run_ == run && it->event_ < event)) {
74  ++it;
75  }
76  }
77  } else {
78  it = lower_bound_all(entries_, el, Compare_Run_Lumi_EventEntry());
79  }
80 
81  return it;
82  }
ForwardSequence::const_iterator lower_bound_all(ForwardSequence const &s, Datum const &d)
wrappers for std::lower_bound
Definition: Algorithms.h:91
tuple lumi
Definition: fjr2json.py:41
SortState & sortState() const
Definition: FileIndex.h:129
std::vector< Element >::const_iterator const_iterator
Definition: FileIndex.h:53
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
std::vector< Element > entries_
Definition: FileIndex.h:131
FileIndex::const_iterator edm::FileIndex::findRunPosition ( RunNumber_t  run) const

Definition at line 130 of file FileIndex.cc.

References entries_, findPosition(), and kRun.

Referenced by containsRun(), and fwlite::EntryFinder::findRun().

130  {
131  const_iterator it = findPosition(run, 0U, 0U);
132  const_iterator itEnd = entries_.end();
133  while(it != itEnd && it->getEntryType() != FileIndex::kRun) {
134  ++it;
135  }
136  if(it == itEnd) {
137  return itEnd;
138  }
139  if(it->run_ != run) {
140  return itEnd;
141  }
142  return it;
143  }
std::vector< Element >::const_iterator const_iterator
Definition: FileIndex.h:53
std::vector< Element > entries_
Definition: FileIndex.h:131
const_iterator findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
Definition: FileIndex.cc:60
bool& edm::FileIndex::resultCached ( ) const
inlineprivate

Definition at line 128 of file FileIndex.h.

References transients_.

Referenced by addEntry(), allEventsInEntryOrder(), sortBy_Run_Lumi_Event(), and sortBy_Run_Lumi_EventEntry().

128 {return transients_.get().resultCached_;}
Transient< Transients > transients_
Definition: FileIndex.h:132
std::vector<Element>::size_type edm::FileIndex::size ( void  ) const
inline

Definition at line 110 of file FileIndex.h.

References entries_.

110 {return entries_.size();}
std::vector< Element > entries_
Definition: FileIndex.h:131
void edm::FileIndex::sortBy_Run_Lumi_Event ( )

Definition at line 28 of file FileIndex.cc.

References entries_, kSorted_Run_Lumi_Event, resultCached(), sortState(), and edm::stable_sort_all().

28  {
30  resultCached() = false;
32  }
SortState & sortState() const
Definition: FileIndex.h:129
void stable_sort_all(RandomAccessSequence &s)
wrappers for std::stable_sort
Definition: Algorithms.h:135
std::vector< Element > entries_
Definition: FileIndex.h:131
bool & resultCached() const
Definition: FileIndex.h:128
void edm::FileIndex::sortBy_Run_Lumi_EventEntry ( )

Definition at line 34 of file FileIndex.cc.

References entries_, kSorted_Run_Lumi_EventEntry, resultCached(), sortState(), and edm::stable_sort_all().

34  {
35  stable_sort_all(entries_, Compare_Run_Lumi_EventEntry());
36  resultCached() = false;
38  }
SortState & sortState() const
Definition: FileIndex.h:129
void stable_sort_all(RandomAccessSequence &s)
wrappers for std::stable_sort
Definition: Algorithms.h:135
std::vector< Element > entries_
Definition: FileIndex.h:131
bool & resultCached() const
Definition: FileIndex.h:128
SortState& edm::FileIndex::sortState ( ) const
inlineprivate

Definition at line 129 of file FileIndex.h.

References transients_.

Referenced by addEntry(), findEventEntryPosition(), findEventPosition(), findPosition(), sortBy_Run_Lumi_Event(), and sortBy_Run_Lumi_EventEntry().

129 {return transients_.get().sortState_;}
Transient< Transients > transients_
Definition: FileIndex.h:132

Member Data Documentation

std::vector<Element> edm::FileIndex::entries_
private
Transient<Transients> edm::FileIndex::transients_
mutableprivate

Definition at line 132 of file FileIndex.h.

Referenced by allInEntryOrder(), resultCached(), and sortState().