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 Member Functions | Private Member Functions | Private Attributes
fwlite::MultiChainEvent Class Reference

#include <MultiChainEvent.h>

Inheritance diagram for fwlite::MultiChainEvent:
fwlite::EventBase edm::EventBase

Public Types

typedef std::pair
< edm::EventID, edm::EventID
event_id_range
 
typedef std::map< edm::EventID,
Long64_t > 
sec_file_index_map
 
typedef std::map
< event_id_range, Long64_t > 
sec_file_range_index_map
 

Public Member Functions

bool atEnd () const
 
virtual edm::EventAuxiliary const & eventAuxiliary () const
 
Long64_t eventIndex () const
 
Long64_t eventIndexSec () const
 
virtual Long64_t fileIndex () const
 
std::vector
< edm::BranchDescription >
const & 
getBranchDescriptions () const
 
virtual std::string const getBranchNameFor (std::type_info const &, char const *, char const *, char const *) const
 
virtual bool getByLabel (std::type_info const &, char const *, char const *, char const *, void *) const
 
virtual edm::WrapperBase const * getByProductID (edm::ProductID const &) const
 
fwlite::LuminosityBlock const & getLuminosityBlock ()
 
std::vector< std::string > const & getProcessHistory () const
 
fwlite::Run const & getRun ()
 
TFile * getTFile () const
 
TFile * getTFileSec () const
 
edm::WrapperBase const * getThinnedProduct (edm::ProductID const &pid, unsigned int &key) const
 
void getThinnedProducts (edm::ProductID const &pid, std::vector< edm::WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys) const
 
bool isValid () const
 
 MultiChainEvent (std::vector< std::string > const &iFileNames1, std::vector< std::string > const &iFileNames2, bool useSecFileMapSorted=false)
 
 operator bool () const
 
const MultiChainEventoperator++ ()
 
ChainEvent const * primary () const
 
edm::ProcessHistory const & processHistory () const
 
ChainEvent const * secondary () const
 
virtual Long64_t secondaryFileIndex () const
 
Long64_t size () const
 
bool to (Long64_t iIndex)
 Go to the event at index iIndex. More...
 
bool to (edm::EventID id)
 Go to event with event id "id". More...
 
bool to (edm::RunNumber_t run, edm::EventNumber_t event)
 Go to event with given run and event number. More...
 
bool to (edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, edm::EventNumber_t event)
 Go to event with given run , lumi (if non-zero), and event number. More...
 
const MultiChainEventtoBegin ()
 
virtual edm::TriggerNames const & triggerNames (edm::TriggerResults const &triggerResults) const
 
virtual edm::TriggerResultsByName triggerResultsByName (std::string const &process) const
 
virtual ~MultiChainEvent ()
 
- Public Member Functions inherited from fwlite::EventBase
 EventBase ()
 
virtual ~EventBase ()
 
- Public Member Functions inherited from edm::EventBase
int bunchCrossing () const
 
 EventBase ()
 
edm::EventAuxiliary::ExperimentType experimentType () const
 
template<typename T >
bool get (ProductID const &, Handle< T > &) const
 
template<typename T >
bool getByLabel (InputTag const &, Handle< T > &) const
 
template<>
bool getByLabel (edm::InputTag const &tag, Handle< FWGenericObject > &result) const
 Specialize the getByLabel method to work with a Handle<FWGenericObject> More...
 
edm::EventID id () const
 
bool isRealData () const
 
edm::LuminosityBlockNumber_t luminosityBlock () const
 
int orbitNumber () const
 
edm::Timestamp time () const
 

Static Public Member Functions

static void throwProductNotFoundException (std::type_info const &, char const *, char const *, char const *)
 

Private Member Functions

 MultiChainEvent (Event const &)
 
const MultiChainEventoperator= (Event const &)
 
bool toSec (Long64_t iIndex)
 Go to the event from secondary files at index iIndex. More...
 
bool toSec (const edm::EventID &id)
 
bool toSec (edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, edm::EventNumber_t event)
 Go to event with given run, lumi, and event number. More...
 
bool toSec (edm::RunNumber_t run, edm::EventNumber_t event)
 Go to event with given run and event number. More...
 

Private Attributes

std::shared_ptr< ChainEventevent1_
 
std::shared_ptr< ChainEventevent2_
 
std::shared_ptr
< internal::MultiProductGetter
getter_
 
sec_file_range_index_map secFileMapSorted_
 
bool useSecFileMapSorted_
 

Additional Inherited Members

- Static Protected Member Functions inherited from edm::EventBase
static TriggerNames const * triggerNames_ (edm::TriggerResults const &triggerResults)
 

Detailed Description

Definition at line 50 of file MultiChainEvent.h.

Member Typedef Documentation

Definition at line 56 of file MultiChainEvent.h.

Definition at line 55 of file MultiChainEvent.h.

Definition at line 57 of file MultiChainEvent.h.

Constructor & Destructor Documentation

MultiChainEvent::MultiChainEvent ( std::vector< std::string > const &  iFileNames1,
std::vector< std::string > const &  iFileNames2,
bool  useSecFileMapSorted = false 
)

Definition at line 71 of file MultiChainEvent.cc.

References gather_cfg::cout, event1_, event2_, getter_, secFileMapSorted_, makeLayoutFileForGui::toAdd, and useSecFileMapSorted_.

74 {
75  event1_ = std::shared_ptr<ChainEvent> (new ChainEvent(iFileNames1));
76  event2_ = std::shared_ptr<ChainEvent> (new ChainEvent(iFileNames2));
77 
78  getter_ = std::shared_ptr<internal::MultiProductGetter>(new internal::MultiProductGetter(this));
79 
80  if (event1_->size() == 0) {
81  std::cout << "------------------------------------------------------------------------" << std::endl;
82  std::cout << "WARNING! MultiChainEvent: all primary files have zero events." << std::endl;
83  std::cout << "Trying to access the events may lead to a crash. " << std::endl;
84  std::cout << "------------------------------------------------------------------------" << std::endl;
85  } else {
86  event1_->setGetter(getter_);
87  event2_->setGetter(getter_);
88  }
89 
90  useSecFileMapSorted_ = useSecFileMapSorted;
91 
92  if (!useSecFileMapSorted_) {
93  std::cout << "------------------------------------------------------------------------" << std::endl;
94  std::cout << "WARNING! What you are about to do may be very slow." << std::endl;
95  std::cout << "The 2-file solution in FWLite works with very simple assumptions." << std::endl;
96  std::cout << "It will linearly search through the files in the secondary file list for Products." << std::endl;
97  std::cout << "There are speed improvements available to make this run faster." << std::endl;
98  std::cout << "***If your secondary files are sorted with a run-range within a file, (almost always the case) " << std::endl;
99  std::cout << "***please use the option useSecFileMapSorted=true in this constructor. " << std::endl;
100  std::cout << " > usage: MultiChainEvent(primaryFiles, secondaryFiles, true);" << std::endl;
101  std::cout << "------------------------------------------------------------------------" << std::endl;
102 
103  }
104 
105  if (useSecFileMapSorted_) {
106 
107  std::cout << "------------------------------------------------------------------------" << std::endl;
108  std::cout << "This MultiChainEvent is now creating a (run_range)_2 ---> file_index_2 map" << std::endl;
109  std::cout << "for the 2-file solution. " << std::endl;
110  std::cout << "This is assuming the files you are giving me are sorted by run,event pairs within each secondary file." << std::endl;
111  std::cout << "If this is not true (rarely the case), set this option to false." << std::endl;
112  std::cout << " > usage: MultiChainEvent(primaryFiles, secondaryFiles, false);" << std::endl;
113  std::cout << "------------------------------------------------------------------------" << std::endl;
114  // speed up secondary file access with a (run,event)_1 ---> index_2 map
115 
116 
117  // Loop over events, when a new file is encountered, store the first run number from this file,
118  // and the last run number from the last file.
119  TFile * lastFile = 0;
120  std::pair<event_id_range,Long64_t> eventRange;
121  bool firstFile = true;
122 
123  bool foundAny = false;
124 
125  for(event2_->toBegin();
126  ! event2_->atEnd();
127  ++(*event2_)) {
128  // if we have a new file, cache the "first"
129  if (lastFile != event2_->getTFile()) {
130 
131  // if this is not the first file, we have an entry.
132  // Add it to the list.
133  if (!firstFile) {
134  foundAny = true;
135  event_id_range toAdd = eventRange.first;
136  secFileMapSorted_[ toAdd ] = eventRange.second;
137  }
138  // always add the "first" event id to the cached event range
139  eventRange.first.first = event2_->event()->id();
140  lastFile = event2_->getTFile();
141  }
142  // otherwise, cache the "second" event id in the cached event range.
143  // Upon the discovery of a new file, this will be used as the
144  // "last" event id in the cached event range.
145  else {
146  eventRange.first.second = event2_->event()->id();
147  eventRange.second = event2_->eventIndex();
148  }
149  firstFile = false;
150  }
151  // due to the invailability of a "look ahead" operation, we have one additional "put" to make
152  // after the loop (which puts the "last" event, not "this" event.
153  if (foundAny) {
154  event_id_range toAdd = eventRange.first;
155  secFileMapSorted_[ toAdd ] = eventRange.second;
156  }
157 // std::cout << "Dumping run range to event id list:" << std::endl;
158 // for (sec_file_range_index_map::const_iterator mBegin = secFileMapSorted_.begin(),
159 // mEnd = secFileMapSorted_.end(),
160 // mit = mBegin;
161 // mit != mEnd; ++mit) {
162 // char buff[1000];
163 // event2_->to(mit->second);
164 // sprintf(buff, "[%10d,%10d - %10d,%10d] ---> %10d",
165 // mit->first.first.run(),
166 // mit->first.first.event(),
167 // mit->first.second.run(),
168 // mit->first.second.event(),
169 // mit->second);
170 // std::cout << buff << std::endl;
171 // }
172  }
173 
174 }
std::shared_ptr< internal::MultiProductGetter > getter_
sec_file_range_index_map secFileMapSorted_
std::pair< edm::EventID, edm::EventID > event_id_range
std::shared_ptr< ChainEvent > event2_
tuple cout
Definition: gather_cfg.py:121
std::shared_ptr< ChainEvent > event1_
MultiChainEvent::~MultiChainEvent ( )
virtual

Definition at line 181 of file MultiChainEvent.cc.

182 {
183 }
fwlite::MultiChainEvent::MultiChainEvent ( Event const &  )
private

Member Function Documentation

bool MultiChainEvent::atEnd ( ) const
virtual

Implements fwlite::EventBase.

Definition at line 428 of file MultiChainEvent.cc.

References event1_.

429 {
430  return event1_->atEnd();
431 }
std::shared_ptr< ChainEvent > event1_
edm::EventAuxiliary const & MultiChainEvent::eventAuxiliary ( ) const
virtual

Implements edm::EventBase.

Definition at line 360 of file MultiChainEvent.cc.

References event1_.

361 {
362  return event1_->eventAuxiliary();
363 }
std::shared_ptr< ChainEvent > event1_
Long64_t fwlite::MultiChainEvent::eventIndex ( ) const
inline

Definition at line 108 of file MultiChainEvent.h.

References event1_.

108 { return event1_->eventIndex(); }
std::shared_ptr< ChainEvent > event1_
Long64_t fwlite::MultiChainEvent::eventIndexSec ( ) const
inline

Definition at line 109 of file MultiChainEvent.h.

References event2_.

109 { return event2_->eventIndex(); }
std::shared_ptr< ChainEvent > event2_
virtual Long64_t fwlite::MultiChainEvent::fileIndex ( ) const
inlinevirtual

Reimplemented from fwlite::EventBase.

Definition at line 120 of file MultiChainEvent.h.

References event1_.

Referenced by python.Events::fileIndicies().

121  { return event1_->eventIndex(); }
std::shared_ptr< ChainEvent > event1_
std::vector< edm::BranchDescription > const & MultiChainEvent::getBranchDescriptions ( ) const

Definition at line 342 of file MultiChainEvent.cc.

References event1_.

343 {
344  return event1_->getBranchDescriptions();
345 }
std::shared_ptr< ChainEvent > event1_
std::string const MultiChainEvent::getBranchNameFor ( std::type_info const &  iType,
char const *  iModule,
char const *  iInstance,
char const *  iProcess 
) const
virtual

Implements fwlite::EventBase.

Definition at line 333 of file MultiChainEvent.cc.

References event1_.

337 {
338  return event1_->getBranchNameFor(iType,iModule,iInstance,iProcess);
339 }
std::shared_ptr< ChainEvent > event1_
bool MultiChainEvent::getByLabel ( std::type_info const &  iType,
char const *  iModule,
char const *  iInstance,
char const *  iProcess,
void *  iValue 
) const
virtual

This function should only be called by fwlite::Handle<>

Implements fwlite::EventBase.

Definition at line 366 of file MultiChainEvent.cc.

References event1_, and event2_.

372 {
373  bool ret1 = event1_->getByLabel(iType, iModule, iInstance, iProcess, iValue);
374  if (!ret1) {
375  (const_cast<MultiChainEvent*>(this))->toSec(event1_->id());
376  bool ret2 = event2_->getByLabel(iType,iModule,iInstance,iProcess,iValue);
377  if (!ret2) return false;
378  }
379  return true;
380 }
std::shared_ptr< ChainEvent > event2_
std::shared_ptr< ChainEvent > event1_
edm::WrapperBase const * MultiChainEvent::getByProductID ( edm::ProductID const &  iID) const
virtual

Implements fwlite::EventBase.

Definition at line 382 of file MultiChainEvent.cc.

References event1_, and event2_.

Referenced by fwlite::internal::MultiProductGetter::getIt().

383 {
384  // First try the first file
385  edm::WrapperBase const* edp = event1_->getByProductID(iID);
386  // Did not find the product, try secondary file
387  if (edp == nullptr) {
388  (const_cast<MultiChainEvent*>(this))->toSec(event1_->id());
389  edp = event2_->getByProductID(iID);
390  }
391  return edp;
392 }
std::shared_ptr< ChainEvent > event2_
std::shared_ptr< ChainEvent > event1_
fwlite::LuminosityBlock const& fwlite::MultiChainEvent::getLuminosityBlock ( )
inline

Definition at line 111 of file MultiChainEvent.h.

References event1_.

111  {
112  return event1_->getLuminosityBlock();
113  }
std::shared_ptr< ChainEvent > event1_
std::vector< std::string > const & MultiChainEvent::getProcessHistory ( ) const

Definition at line 348 of file MultiChainEvent.cc.

References event1_.

349 {
350  return event1_->getProcessHistory();
351 }
std::shared_ptr< ChainEvent > event1_
fwlite::Run const& fwlite::MultiChainEvent::getRun ( )
inline

Definition at line 115 of file MultiChainEvent.h.

References event1_.

115  {
116  return event1_->getRun();
117  }
std::shared_ptr< ChainEvent > event1_
TFile* fwlite::MultiChainEvent::getTFile ( ) const
inline

Definition at line 101 of file MultiChainEvent.h.

References event1_.

101  {
102  return event1_->getTFile();
103  }
std::shared_ptr< ChainEvent > event1_
TFile* fwlite::MultiChainEvent::getTFileSec ( ) const
inline

Definition at line 104 of file MultiChainEvent.h.

References event2_.

104  {
105  return event2_->getTFile();
106  }
std::shared_ptr< ChainEvent > event2_
edm::WrapperBase const * MultiChainEvent::getThinnedProduct ( edm::ProductID const &  pid,
unsigned int &  key 
) const

Definition at line 394 of file MultiChainEvent.cc.

References event1_, and event2_.

Referenced by fwlite::internal::MultiProductGetter::getThinnedProduct().

394  {
395  // First try the first file
396  edm::WrapperBase const* edp = event1_->getThinnedProduct(pid, key);
397  // Did not find the product, try secondary file
398  if (edp == nullptr) {
399  (const_cast<MultiChainEvent*>(this))->toSec(event1_->id());
400  edp = event2_->getThinnedProduct(pid, key);
401  }
402  return edp;
403 }
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
tuple pid
Definition: sysUtil.py:22
std::shared_ptr< ChainEvent > event2_
std::shared_ptr< ChainEvent > event1_
void MultiChainEvent::getThinnedProducts ( edm::ProductID const &  pid,
std::vector< edm::WrapperBase const * > &  foundContainers,
std::vector< unsigned int > &  keys 
) const

Definition at line 405 of file MultiChainEvent.cc.

References event1_, event2_, and spr::find().

Referenced by fwlite::internal::MultiProductGetter::getThinnedProducts().

407  {
408  // First try the first file
409  event1_->getThinnedProducts(pid, wrappers, keys);
410  // Did not find all the products, try secondary file
411  if(std::find(wrappers.begin(), wrappers.end(), nullptr) != wrappers.end()) {
412  (const_cast<MultiChainEvent*>(this))->toSec(event1_->id());
413  event2_->getThinnedProducts(pid, wrappers, keys);
414  }
415 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
tuple pid
Definition: sysUtil.py:22
std::shared_ptr< ChainEvent > event2_
std::shared_ptr< ChainEvent > event1_
bool MultiChainEvent::isValid ( void  ) const

Definition at line 418 of file MultiChainEvent.cc.

References event1_.

Referenced by core.AutoHandle.AutoHandle::ReallyLoad().

419 {
420  return event1_->isValid();
421 }
std::shared_ptr< ChainEvent > event1_
MultiChainEvent::operator bool ( ) const

Definition at line 422 of file MultiChainEvent.cc.

423 {
424  return *event1_;
425 }
std::shared_ptr< ChainEvent > event1_
const MultiChainEvent & MultiChainEvent::operator++ ( )
virtual

Implements fwlite::EventBase.

Definition at line 202 of file MultiChainEvent.cc.

References event1_.

203 {
204  event1_->operator++();
205  return *this;
206 }
std::shared_ptr< ChainEvent > event1_
const MultiChainEvent& fwlite::MultiChainEvent::operator= ( Event const &  )
private
ChainEvent const* fwlite::MultiChainEvent::primary ( ) const
inline

Definition at line 132 of file MultiChainEvent.h.

References event1_.

132 { return &*event1_;}
std::shared_ptr< ChainEvent > event1_
edm::ProcessHistory const & MultiChainEvent::processHistory ( ) const
virtual

Implements edm::EventBase.

Definition at line 354 of file MultiChainEvent.cc.

References event1_.

355 {
356  return event1_->processHistory();
357 }
std::shared_ptr< ChainEvent > event1_
ChainEvent const* fwlite::MultiChainEvent::secondary ( ) const
inline

Definition at line 133 of file MultiChainEvent.h.

References event2_.

133 { return &*event2_;}
std::shared_ptr< ChainEvent > event2_
virtual Long64_t fwlite::MultiChainEvent::secondaryFileIndex ( ) const
inlinevirtual

Reimplemented from fwlite::EventBase.

Definition at line 122 of file MultiChainEvent.h.

References event2_.

Referenced by python.Events::fileIndicies().

123  { return event2_->eventIndex(); }
std::shared_ptr< ChainEvent > event2_
Long64_t MultiChainEvent::size ( void  ) const

Definition at line 434 of file MultiChainEvent.cc.

References event1_.

435 {
436  return event1_->size();
437 }
std::shared_ptr< ChainEvent > event1_
void MultiChainEvent::throwProductNotFoundException ( std::type_info const &  iType,
char const *  iModule,
char const *  iInstance,
char const *  iProcess 
)
static

Definition at line 490 of file MultiChainEvent.cc.

References fwlite::ChainEvent::throwProductNotFoundException().

493  {
494  ChainEvent::throwProductNotFoundException(iType,iModule,iInstance,iProcess);
495 }
static void throwProductNotFoundException(std::type_info const &, char const *, char const *, char const *)
Definition: ChainEvent.cc:339
bool MultiChainEvent::to ( Long64_t  iIndex)

Go to the event at index iIndex.

Definition at line 210 of file MultiChainEvent.cc.

References event1_.

Referenced by to().

211 {
212  return event1_->to(iIndex);
213 }
std::shared_ptr< ChainEvent > event1_
bool MultiChainEvent::to ( edm::EventID  id)

Go to event with event id "id".

Definition at line 218 of file MultiChainEvent.cc.

References event(), edm::EventBase::luminosityBlock(), DTTTrigCorrFirst::run, and to().

219 {
220  return to(id.run(), id.luminosityBlock(), id.event());
221 }
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:63
bool to(Long64_t iIndex)
Go to the event at index iIndex.
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 MultiChainEvent::to ( edm::RunNumber_t  run,
edm::EventNumber_t  event 
)

Go to event with given run and event number.

Definition at line 232 of file MultiChainEvent.cc.

References to().

233 {
234  return to(run, 0U, event);
235 }
bool to(Long64_t iIndex)
Go to the event at index iIndex.
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 MultiChainEvent::to ( edm::RunNumber_t  run,
edm::LuminosityBlockNumber_t  lumi,
edm::EventNumber_t  event 
)

Go to event with given run , lumi (if non-zero), and event number.

Definition at line 225 of file MultiChainEvent.cc.

References event1_.

226 {
227  return event1_->to(run, lumi, event);
228 }
tuple lumi
Definition: fjr2json.py:35
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::shared_ptr< ChainEvent > event1_
const MultiChainEvent & MultiChainEvent::toBegin ( )
virtual

Implements fwlite::EventBase.

Definition at line 323 of file MultiChainEvent.cc.

References event1_.

324 {
325  event1_->toBegin();
326  return *this;
327 }
std::shared_ptr< ChainEvent > event1_
bool MultiChainEvent::toSec ( Long64_t  iIndex)
private

Go to the event from secondary files at index iIndex.

Go to the event at index iIndex.

Definition at line 240 of file MultiChainEvent.cc.

References event2_.

Referenced by toSec().

241 {
242  return event2_->to(iIndex);
243 }
std::shared_ptr< ChainEvent > event2_
bool MultiChainEvent::toSec ( const edm::EventID id)
private

Definition at line 247 of file MultiChainEvent.cc.

References event2_, Exception, plotBeamSpotDB::first, and secFileMapSorted_.

248 {
249  // First try this file.
250  if (event2_->event_->to(id))
251  {
252  // Found it, return.
253  return true;
254  }
255  // Second, assume that the secondary files are each in run/event
256  // order. So, let's loop over all files and see if we can figure
257  // out where the event ought to be.
258  for (sec_file_range_index_map::const_iterator mBegin =
259  secFileMapSorted_.begin(),
260  mEnd = secFileMapSorted_.end(),
261  mit = mBegin;
262  mit != mEnd;
263  ++mit)
264  {
265  if (id < mit->first.first || id > mit->first.second)
266  {
267  // We don't expect this event to be in this file, so don't
268  // bother checking it right now.
269  continue;
270  }
271  // If we're here, then we have a reasonable belief that this
272  // event is in this secondary file. This part is
273  // expensive. switchToFile does memory allocations and opens the
274  // files which becomes very time consuming. This should be done
275  // as infrequently as possible.
276  event2_->switchToFile(mit->second);
277  // Is it here?
278  if (event2_->to(id))
279  {
280  // Yes!
281  return true;
282  }
283  // if we assumed that the secondary files were not each in
284  // order, but were non-overlapping, we could break here. But at
285  // this point, we might as well keep going.
286  } // for loop over files
287 
288  // if we are still here, then we did not find the id in question,
289  // do it the old fashioned way. This will open up each secondary
290  // file and explicitly check to see if the event is there.
291  if (event2_->to(id))
292  {
293  return true;
294  }
295  // if we're still here, then there really is no matching event in
296  // the secondary files. Throw.
297  throw cms::Exception("ProductNotFound") << "Cannot find id "
298  << id.run() << ", "
299  << id.event()
300  << " in secondary list. Exiting."
301  << std::endl;
302  // to make the compiler happy
303  return false;
304 }
sec_file_range_index_map secFileMapSorted_
std::shared_ptr< ChainEvent > event2_
bool MultiChainEvent::toSec ( edm::RunNumber_t  run,
edm::LuminosityBlockNumber_t  lumi,
edm::EventNumber_t  event 
)
private

Go to event with given run, lumi, and event number.

Definition at line 308 of file MultiChainEvent.cc.

References toSec().

309 {
310  return toSec(edm::EventID(run, lumi, event));
311 }
tuple lumi
Definition: fjr2json.py:35
bool toSec(Long64_t iIndex)
Go to the event from secondary files at index iIndex.
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 MultiChainEvent::toSec ( edm::RunNumber_t  run,
edm::EventNumber_t  event 
)
private

Go to event with given run and event number.

Definition at line 316 of file MultiChainEvent.cc.

References toSec().

317 {
318  return toSec(edm::EventID(run, 0U, event));
319 }
bool toSec(Long64_t iIndex)
Go to the event from secondary files at index iIndex.
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
edm::TriggerNames const & MultiChainEvent::triggerNames ( edm::TriggerResults const &  triggerResults) const
virtual

Implements edm::EventBase.

Definition at line 440 of file MultiChainEvent.cc.

References event1_, event2_, Exception, cscdqm::h::names, and edm::EventBase::triggerNames_().

441 {
443  if (names != 0) return *names;
444 
445  event1_->fillParameterSetRegistry();
446  names = triggerNames_(triggerResults);
447  if (names != 0) return *names;
448 
449  // If we cannot find it in the primary file, this probably will
450  // not help but try anyway
451  event2_->to(event1_->id());
452  event2_->fillParameterSetRegistry();
453  names = triggerNames_(triggerResults);
454  if (names != 0) return *names;
455 
456  throw cms::Exception("TriggerNamesNotFound")
457  << "TriggerNames not found in ParameterSet registry";
458  return *names;
459 }
static const HistoName names[]
static std::string const triggerResults
Definition: EdmProvDump.cc:40
static TriggerNames const * triggerNames_(edm::TriggerResults const &triggerResults)
Definition: EventBase.cc:48
std::shared_ptr< ChainEvent > event2_
std::shared_ptr< ChainEvent > event1_
edm::TriggerResultsByName MultiChainEvent::triggerResultsByName ( std::string const &  process) const
virtual

Implements edm::EventBase.

Definition at line 462 of file MultiChainEvent.cc.

References event1_, event2_, fwlite::Handle< T >::getByLabel(), fwlite::Handle< T >::isValid(), cscdqm::h::names, fwlite::Handle< T >::product(), and edm::EventBase::triggerNames_().

462  {
463 
464  fwlite::Handle<edm::TriggerResults> hTriggerResults;
465  hTriggerResults.getByLabel(*this,"TriggerResults","",process.c_str());
466  if (!hTriggerResults.isValid()) {
467  return edm::TriggerResultsByName(0,0);
468  }
469 
470  edm::TriggerNames const* names = triggerNames_(*hTriggerResults);
471 
472  if (names == 0) {
473  event1_->fillParameterSetRegistry();
474  names = triggerNames_(*hTriggerResults);
475  }
476 
477  if (names == 0) {
478  event2_->to(event1_->id());
479  event2_->fillParameterSetRegistry();
480  names = triggerNames_(*hTriggerResults);
481  }
482 
483  return edm::TriggerResultsByName(hTriggerResults.product(), names);
484 }
static const HistoName names[]
bool isValid() const
Definition: Handle.h:64
void getByLabel(const P &iP, const char *iModuleLabel, const char *iProductInstanceLabel=0, const char *iProcessLabel=0)
Definition: Handle.h:94
static TriggerNames const * triggerNames_(edm::TriggerResults const &triggerResults)
Definition: EventBase.cc:48
std::shared_ptr< ChainEvent > event2_
T const * product() const
Definition: Handle.h:69
tuple process
Definition: LaserDQM_cfg.py:3
std::shared_ptr< ChainEvent > event1_

Member Data Documentation

std::shared_ptr<ChainEvent> fwlite::MultiChainEvent::event1_
private
std::shared_ptr<ChainEvent> fwlite::MultiChainEvent::event2_
private
std::shared_ptr<internal::MultiProductGetter> fwlite::MultiChainEvent::getter_
private

Definition at line 164 of file MultiChainEvent.h.

Referenced by MultiChainEvent().

sec_file_range_index_map fwlite::MultiChainEvent::secFileMapSorted_
private

Definition at line 171 of file MultiChainEvent.h.

Referenced by MultiChainEvent(), and toSec().

bool fwlite::MultiChainEvent::useSecFileMapSorted_
private

Definition at line 170 of file MultiChainEvent.h.

Referenced by MultiChainEvent().