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

175 {
176 }
fwlite::MultiChainEvent::MultiChainEvent ( Event const &  )
private

Member Function Documentation

bool MultiChainEvent::atEnd ( ) const
virtual

Implements fwlite::EventBase.

Definition at line 421 of file MultiChainEvent.cc.

References event1_.

422 {
423  return event1_->atEnd();
424 }
std::shared_ptr< ChainEvent > event1_
edm::EventAuxiliary const & MultiChainEvent::eventAuxiliary ( ) const
virtual

Implements edm::EventBase.

Definition at line 353 of file MultiChainEvent.cc.

References event1_.

354 {
355  return event1_->eventAuxiliary();
356 }
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 335 of file MultiChainEvent.cc.

References event1_.

336 {
337  return event1_->getBranchDescriptions();
338 }
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 326 of file MultiChainEvent.cc.

References event1_.

330 {
331  return event1_->getBranchNameFor(iType,iModule,iInstance,iProcess);
332 }
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 359 of file MultiChainEvent.cc.

References event1_, and event2_.

365 {
366  bool ret1 = event1_->getByLabel(iType, iModule, iInstance, iProcess, iValue);
367  if (!ret1) {
368  (const_cast<MultiChainEvent*>(this))->toSec(event1_->id());
369  bool ret2 = event2_->getByLabel(iType,iModule,iInstance,iProcess,iValue);
370  if (!ret2) return false;
371  }
372  return true;
373 }
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 375 of file MultiChainEvent.cc.

References event1_, and event2_.

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

376 {
377  // First try the first file
378  edm::WrapperBase const* edp = event1_->getByProductID(iID);
379  // Did not find the product, try secondary file
380  if (edp == nullptr) {
381  (const_cast<MultiChainEvent*>(this))->toSec(event1_->id());
382  edp = event2_->getByProductID(iID);
383  }
384  return edp;
385 }
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 341 of file MultiChainEvent.cc.

References event1_.

342 {
343  return event1_->getProcessHistory();
344 }
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 387 of file MultiChainEvent.cc.

References event1_, and event2_.

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

387  {
388  // First try the first file
389  edm::WrapperBase const* edp = event1_->getThinnedProduct(pid, key);
390  // Did not find the product, try secondary file
391  if (edp == nullptr) {
392  (const_cast<MultiChainEvent*>(this))->toSec(event1_->id());
393  edp = event2_->getThinnedProduct(pid, key);
394  }
395  return edp;
396 }
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 398 of file MultiChainEvent.cc.

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

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

400  {
401  // First try the first file
402  event1_->getThinnedProducts(pid, wrappers, keys);
403  // Did not find all the products, try secondary file
404  if(std::find(wrappers.begin(), wrappers.end(), nullptr) != wrappers.end()) {
405  (const_cast<MultiChainEvent*>(this))->toSec(event1_->id());
406  event2_->getThinnedProducts(pid, wrappers, keys);
407  }
408 }
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 411 of file MultiChainEvent.cc.

References event1_.

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

412 {
413  return event1_->isValid();
414 }
std::shared_ptr< ChainEvent > event1_
MultiChainEvent::operator bool ( ) const

Definition at line 415 of file MultiChainEvent.cc.

416 {
417  return *event1_;
418 }
std::shared_ptr< ChainEvent > event1_
const MultiChainEvent & MultiChainEvent::operator++ ( )
virtual

Implements fwlite::EventBase.

Definition at line 195 of file MultiChainEvent.cc.

References event1_.

196 {
197  event1_->operator++();
198  return *this;
199 }
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 347 of file MultiChainEvent.cc.

References event1_.

348 {
349  return event1_->processHistory();
350 }
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 427 of file MultiChainEvent.cc.

References event1_.

428 {
429  return event1_->size();
430 }
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 483 of file MultiChainEvent.cc.

References fwlite::ChainEvent::throwProductNotFoundException().

486  {
487  ChainEvent::throwProductNotFoundException(iType,iModule,iInstance,iProcess);
488 }
static void throwProductNotFoundException(std::type_info const &, char const *, char const *, char const *)
Definition: ChainEvent.cc:337
bool MultiChainEvent::to ( Long64_t  iIndex)

Go to the event at index iIndex.

Definition at line 203 of file MultiChainEvent.cc.

References event1_.

Referenced by to().

204 {
205  return event1_->to(iIndex);
206 }
std::shared_ptr< ChainEvent > event1_
bool MultiChainEvent::to ( edm::EventID  id)

Go to event with event id "id".

Definition at line 211 of file MultiChainEvent.cc.

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

212 {
213  return to(id.run(), id.luminosityBlock(), id.event());
214 }
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 225 of file MultiChainEvent.cc.

References to().

226 {
227  return to(run, 0U, event);
228 }
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 218 of file MultiChainEvent.cc.

References event1_.

219 {
220  return event1_->to(run, lumi, event);
221 }
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 316 of file MultiChainEvent.cc.

References event1_.

317 {
318  event1_->toBegin();
319  return *this;
320 }
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 233 of file MultiChainEvent.cc.

References event2_.

Referenced by toSec().

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

Definition at line 240 of file MultiChainEvent.cc.

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

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

References toSec().

302 {
303  return toSec(edm::EventID(run, lumi, event));
304 }
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 309 of file MultiChainEvent.cc.

References toSec().

310 {
311  return toSec(edm::EventID(run, 0U, event));
312 }
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 433 of file MultiChainEvent.cc.

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

434 {
436  if (names != 0) return *names;
437 
438  event1_->fillParameterSetRegistry();
439  names = triggerNames_(triggerResults);
440  if (names != 0) return *names;
441 
442  // If we cannot find it in the primary file, this probably will
443  // not help but try anyway
444  event2_->to(event1_->id());
445  event2_->fillParameterSetRegistry();
446  names = triggerNames_(triggerResults);
447  if (names != 0) return *names;
448 
449  throw cms::Exception("TriggerNamesNotFound")
450  << "TriggerNames not found in ParameterSet registry";
451  return *names;
452 }
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 455 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_().

455  {
456 
457  fwlite::Handle<edm::TriggerResults> hTriggerResults;
458  hTriggerResults.getByLabel(*this,"TriggerResults","",process.c_str());
459  if (!hTriggerResults.isValid()) {
460  return edm::TriggerResultsByName(0,0);
461  }
462 
463  edm::TriggerNames const* names = triggerNames_(*hTriggerResults);
464 
465  if (names == 0) {
466  event1_->fillParameterSetRegistry();
467  names = triggerNames_(*hTriggerResults);
468  }
469 
470  if (names == 0) {
471  event2_->to(event1_->id());
472  event2_->fillParameterSetRegistry();
473  names = triggerNames_(*hTriggerResults);
474  }
475 
476  return edm::TriggerResultsByName(hTriggerResults.product(), names);
477 }
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().