42 std::vector<edm::WrapperBase const*>& foundContainers,
43 std::vector<unsigned int>&
keys)
const override {
72 std::vector<std::string>
const& iFileNames2,
73 bool useSecFileMapSorted) {
74 event1_ = std::make_shared<ChainEvent>(iFileNames1);
75 event2_ = std::make_shared<ChainEvent>(iFileNames2);
77 getter_ = std::make_shared<internal::MultiProductGetter>(
this);
80 std::cout <<
"------------------------------------------------------------------------" << std::endl;
81 std::cout <<
"WARNING! MultiChainEvent: all primary files have zero events." << std::endl;
82 std::cout <<
"Trying to access the events may lead to a crash. " << std::endl;
83 std::cout <<
"------------------------------------------------------------------------" << std::endl;
92 std::cout <<
"------------------------------------------------------------------------" << std::endl;
93 std::cout <<
"WARNING! What you are about to do may be very slow." << std::endl;
94 std::cout <<
"The 2-file solution in FWLite works with very simple assumptions." << std::endl;
95 std::cout <<
"It will linearly search through the files in the secondary file list for Products." << std::endl;
96 std::cout <<
"There are speed improvements available to make this run faster." << std::endl;
97 std::cout <<
"***If your secondary files are sorted with a run-range within a file, (almost always the case) " 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 std::cout <<
"------------------------------------------------------------------------" << std::endl;
106 std::cout <<
"This MultiChainEvent is now creating a (run_range)_2 ---> file_index_2 map" << std::endl;
107 std::cout <<
"for the 2-file solution. " << std::endl;
109 <<
"This is assuming the files you are giving me are sorted by run,event pairs within each secondary file." 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;
118 TFile* lastFile =
nullptr;
119 std::pair<event_id_range, Long64_t>
eventRange;
120 bool firstFile =
true;
122 bool foundAny =
false;
126 if (lastFile !=
event2_->getTFile()) {
136 lastFile =
event2_->getTFile();
226 for (sec_file_range_index_map::const_iterator mBegin =
secFileMapSorted_.begin(),
231 if (id < mit->
first.first ||
id > mit->first.second) {
241 event2_->switchToFile(mit->second);
261 <<
"Cannot find id " <<
id.run() <<
", " <<
id.event() <<
" in secondary list. Exiting." << std::endl;
288 char const* iInstance,
289 char const* iProcess)
const {
290 return event1_->getBranchNameFor(iType, iModule, iInstance, iProcess);
294 return event1_->getBranchDescriptions();
305 char const* iInstance,
306 char const* iProcess,
307 void* iValue)
const {
308 bool ret1 =
event1_->getByLabel(iType, iModule, iInstance, iProcess, iValue);
311 bool ret2 =
event2_->getByLabel(iType, iModule, iInstance, iProcess, iValue);
319 bool ret1 =
event1_->getByTokenImp(iToken, iValue);
322 bool ret2 =
event2_->getByTokenImp(iToken, iValue);
333 if (edp ==
nullptr) {
335 edp =
event2_->getByProductID(iID);
343 auto edp =
event1_->getThinnedProduct(pid,
key);
345 if (not edp.has_value()) {
353 std::vector<edm::WrapperBase const*>& wrappers,
354 std::vector<unsigned int>&
keys)
const {
358 if (
std::find(wrappers.begin(), wrappers.end(),
nullptr) != wrappers.end()) {
370 if (std::holds_alternative<std::monostate>(edp)) {
386 if (
names !=
nullptr)
389 event1_->fillParameterSetRegistry();
391 if (
names !=
nullptr)
397 event2_->fillParameterSetRegistry();
399 if (
names !=
nullptr)
402 throw cms::Exception(
"TriggerNamesNotFound") <<
"TriggerNames not found in ParameterSet registry";
409 if (
names ==
nullptr) {
410 event1_->fillParameterSetRegistry();
414 if (
names ==
nullptr) {
416 event2_->fillParameterSetRegistry();
425 if (
nullptr ==
pset) {
435 char const* iInstance,
436 char const* iProcess) {
std::optional< std::tuple< edm::WrapperBase const *, unsigned int > > getThinnedProduct(edm::ProductID const &pid, unsigned int key) const
const MultiChainEvent & toBegin() override
edm::ParameterSet const * parameterSet(edm::ParameterSetID const &psID) const override
void getThinnedProducts(edm::ProductID const &pid, std::vector< edm::WrapperBase const *> &foundContainers, std::vector< unsigned int > &keys) const override
std::string const getBranchNameFor(std::type_info const &, char const *, char const *, char const *) const override
std::variant< unsigned int, detail::GetThinnedKeyFromExceptionFactory, std::monostate > OptionalThinnedKey
bool getByTokenImp(edm::EDGetToken, edm::WrapperBase const *&) const override
MultiProductGetter(MultiChainEvent const *iEvent)
MultiChainEvent const * event_
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
static TriggerNames const * triggerNames_(edm::TriggerResults const &triggerResults)
edm::WrapperBase const * getIt(edm::ProductID const &iID) const override
unsigned long long EventNumber_t
edm::EventAuxiliary const & eventAuxiliary() const override
~MultiChainEvent() override
edm::ProcessHistory const & processHistory() const override
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
unsigned int LuminosityBlockNumber_t
edm::LuminosityBlockNumber_t luminosityBlock() const
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::OptionalThinnedKey getThinnedKeyFrom(edm::ProductID const &parent, unsigned int key, edm::ProductID const &thinned) const
bool atEnd() const override
bool useSecFileMapSorted_
std::vector< edm::BranchDescription > const & getBranchDescriptions() const
key
prepare the HTCondor submission files and eventually submit them
void getThinnedProducts(edm::ProductID const &pid, std::vector< edm::WrapperBase const *> &foundContainers, std::vector< unsigned int > &keys) const
edm::OptionalThinnedKey getThinnedKeyFrom(edm::ProductID const &parent, unsigned int key, edm::ProductID const &thinned) const override
static void throwProductNotFoundException(std::type_info const &, char const *, char const *, char const *)
static std::string const triggerResults
edm::TriggerResultsByName triggerResultsByName(edm::TriggerResults const &triggerResults) const override
sec_file_range_index_map secFileMapSorted_
std::shared_ptr< internal::MultiProductGetter const > getter_
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
std::vector< std::string > const & getProcessHistory() const
std::optional< std::tuple< edm::WrapperBase const *, unsigned int > > getThinnedProduct(edm::ProductID const &pid, unsigned int key) const override
std::shared_ptr< ChainEvent > event2_
const MultiChainEvent & operator++() override
unsigned int transitionIndex_() const override
std::shared_ptr< ChainEvent > event1_