45 std::vector<edm::WrapperBase const*>& foundContainers,
46 std::vector<unsigned int>&
keys)
const override {
72 std::vector<std::string>
const& iFileNames2,
73 bool useSecFileMapSorted)
75 event1_ = std::make_shared<ChainEvent>(iFileNames1);
76 event2_ = std::make_shared<ChainEvent>(iFileNames2);
78 getter_ = std::make_shared<internal::MultiProductGetter>(
this);
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;
86 event1_->setGetter(getter_);
87 event2_->setGetter(getter_);
90 useSecFileMapSorted_ = useSecFileMapSorted;
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;
105 if (useSecFileMapSorted_) {
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;
119 TFile * lastFile =
nullptr;
120 std::pair<event_id_range,Long64_t> eventRange;
121 bool firstFile =
true;
123 bool foundAny =
false;
125 for(event2_->toBegin();
129 if (lastFile != event2_->getTFile()) {
136 secFileMapSorted_[
toAdd ] = eventRange.second;
139 eventRange.first.first = event2_->event()->id();
140 lastFile = event2_->getTFile();
146 eventRange.first.second = event2_->event()->id();
147 eventRange.second = event2_->eventIndex();
155 secFileMapSorted_[
toAdd ] = eventRange.second;
204 event1_->operator++();
212 return event1_->to(iIndex);
220 return to(
id.
run(),
id.luminosityBlock(),
id.
event());
227 return event1_->to(run, lumi, event);
234 return to(run, 0
U, event);
242 return event2_->to(iIndex);
250 if (event2_->event_->to(
id))
258 for (sec_file_range_index_map::const_iterator mBegin =
259 secFileMapSorted_.begin(),
260 mEnd = secFileMapSorted_.end(),
265 if (id < mit->
first.first ||
id > mit->first.second)
276 event2_->switchToFile(mit->second);
300 <<
" in secondary list. Exiting." 335 char const* iInstance,
336 char const* iProcess)
const 338 return event1_->getBranchNameFor(iType,iModule,iInstance,iProcess);
341 std::vector<edm::BranchDescription>
const&
344 return event1_->getBranchDescriptions();
347 std::vector<std::string>
const&
350 return event1_->getProcessHistory();
356 return event1_->processHistory();
362 return event1_->eventAuxiliary();
367 std::type_info
const& iType,
369 char const* iInstance,
370 char const* iProcess,
373 bool ret1 = event1_->getByLabel(iType, iModule, iInstance, iProcess, iValue);
376 bool ret2 = event2_->getByLabel(iType,iModule,iInstance,iProcess,iValue);
377 if (!ret2)
return false;
387 if (edp ==
nullptr) {
389 edp = event2_->getByProductID(iID);
398 if (edp ==
nullptr) {
400 edp = event2_->getThinnedProduct(pid, key);
406 std::vector<edm::WrapperBase const*>& wrappers,
407 std::vector<unsigned int>&
keys)
const {
409 event1_->getThinnedProducts(pid, wrappers, keys);
411 if(
std::find(wrappers.begin(), wrappers.end(),
nullptr) != wrappers.end()) {
413 event2_->getThinnedProducts(pid, wrappers, keys);
420 return event1_->isValid();
430 return event1_->atEnd();
436 return event1_->size();
443 if (names !=
nullptr)
return *
names;
445 event1_->fillParameterSetRegistry();
446 names = triggerNames_(triggerResults);
447 if (names !=
nullptr)
return *
names;
451 event2_->to(event1_->id());
452 event2_->fillParameterSetRegistry();
453 names = triggerNames_(triggerResults);
454 if (names !=
nullptr)
return *
names;
457 <<
"TriggerNames not found in ParameterSet registry";
466 if (names ==
nullptr) {
467 event1_->fillParameterSetRegistry();
468 names = triggerNames_(triggerResults);
471 if (names ==
nullptr) {
472 event2_->to(event1_->id());
473 event2_->fillParameterSetRegistry();
474 names = triggerNames_(triggerResults);
482 auto pset = event1_->parameterSet(psID);
484 pset = event2_->parameterSet(psID);
494 char const* iInstance,
495 char const* iProcess) {
const MultiChainEvent & toBegin() override
edm::EventAuxiliary const & eventAuxiliary() const override
std::vector< edm::BranchDescription > const & getBranchDescriptions() const
MultiProductGetter(MultiChainEvent const *iEvent)
MultiChainEvent const * event_
unsigned long long EventNumber_t
~MultiChainEvent() override
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
unsigned int LuminosityBlockNumber_t
const std::string names[nVars_]
static void throwProductNotFoundException(std::type_info const &, char const *, char const *, char const *)
bool to(Long64_t iIndex)
Go to the event at index iIndex.
bool toSec(Long64_t iIndex)
Go to the event from secondary files at index iIndex.
edm::WrapperBase const * getByProductID(edm::ProductID const &) const override
edm::WrapperBase const * getThinnedProduct(edm::ProductID const &pid, unsigned int &key) const
std::vector< std::string > const & getProcessHistory() const
std::string const getBranchNameFor(std::type_info const &, char const *, char const *, char const *) const override
static void throwProductNotFoundException(std::type_info const &, char const *, char const *, char const *)
static std::string const triggerResults
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::TriggerResultsByName triggerResultsByName(edm::TriggerResults const &triggerResults) const override
void getThinnedProducts(edm::ProductID const &pid, std::vector< edm::WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys) const override
void getThinnedProducts(edm::ProductID const &pid, std::vector< edm::WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys) const
bool atEnd() const override
bool getByLabel(std::type_info const &, char const *, char const *, char const *, void *) const override
MultiChainEvent(std::vector< std::string > const &iFileNames1, std::vector< std::string > const &iFileNames2, bool useSecFileMapSorted=false)
std::pair< edm::EventID, edm::EventID > event_id_range
const MultiChainEvent & operator++() override
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
edm::WrapperBase const * getIt(edm::ProductID const &iID) const override
edm::ParameterSet const * parameterSet(edm::ParameterSetID const &psID) const override
unsigned int transitionIndex_() const override
edm::WrapperBase const * getThinnedProduct(edm::ProductID const &pid, unsigned int &key) const override
edm::ProcessHistory const & processHistory() const override