62 #include "TTreeCache.h" 93 : parentageIDLookup_(parentageIDLookup) {}
102 void checkReleaseVersion(std::vector<ProcessHistory> processHistoryVector,
std::string const&
fileName) {
105 for (
auto const& ph : processHistoryVector) {
106 for (
auto const& pc : ph) {
110 <<
"a release (" << pc.releaseVersion() <<
") used in writing the input file, " << fileName <<
".\n" 111 <<
"Forward compatibility cannot be supported.\n";
126 eventTree_.setEntryNumber(entry);
130 eventTree_.setEntryNumber(saveEntry);
131 return eventAux.
event();
142 std::shared_ptr<InputFile> filePtr,
143 std::shared_ptr<EventSkipperByID> eventSkipperByID,
147 unsigned int nStreams,
148 unsigned int treeCacheSize,
149 int treeMaxVirtualSize,
155 std::shared_ptr<BranchIDListHelper> branchIDListHelper,
156 std::shared_ptr<ThinnedAssociationsHelper> thinnedAssociationsHelper,
157 std::vector<BranchID>
const* associationsFromSecondary,
158 std::shared_ptr<DuplicateChecker> duplicateChecker,
159 bool dropDescendants,
161 std::vector<std::shared_ptr<IndexIntoFile>>
const& indexesIntoFiles,
162 std::vector<std::shared_ptr<IndexIntoFile>>::
size_type currentIndexIntoFile,
163 std::vector<ProcessHistoryID>& orderedProcessHistoryIDs,
164 bool bypassVersionCheck,
165 bool labelRawDataLikeMC,
167 bool enablePrefetching)
169 logicalFile_(logicalFileName),
170 processConfiguration_(processConfiguration),
171 processHistoryRegistry_(&processHistoryRegistry),
173 eventSkipperByID_(eventSkipperByID),
174 fileFormatVersion_(),
177 indexIntoFile_(*indexIntoFileSharedPtr_),
178 orderedProcessHistoryIDs_(orderedProcessHistoryIDs),
181 indexIntoFileEnd_(indexIntoFileBegin_),
182 indexIntoFileIter_(indexIntoFileBegin_),
185 eventProcessHistoryIDs_(),
186 eventProcessHistoryIter_(eventProcessHistoryIDs_.
begin()),
187 savedRunAuxiliary_(),
188 skipAnyEvents_(skipAnyEvents),
189 noEventSort_(noEventSort),
190 whyNotFastClonable_(0),
191 hasNewlyDroppedBranch_(),
192 branchListIndexesUnchanged_(
false),
222 branchIDListHelper_(branchIDListHelper),
223 fileThinnedAssociationsHelper_(),
224 thinnedAssociationsHelper_(thinnedAssociationsHelper),
225 processingMode_(processingMode),
226 runHelper_(runHelper),
227 newBranchToOldBranch_(),
229 eventSelectionIDs_(),
230 branchListIndexes_(),
233 duplicateChecker_(duplicateChecker),
234 provenanceAdaptor_(),
235 provenanceReaderMaker_(),
236 eventProductProvenanceRetrievers_(),
237 parentageIDLookup_(),
238 daqProvenanceHelper_(),
240 inputType_(inputType) {
250 if (
nullptr == metaDataTree.get()) {
261 fft->SetAddress(&fftPtr);
290 typedef std::map<ParameterSetID, ParameterSetBlob> PsetMap;
292 PsetMap* psetMapPtr = &psetMap;
301 if (
nullptr == psetTree.get()) {
306 typedef std::pair<ParameterSetID, ParameterSetBlob> IdToBlobs;
308 IdToBlobs* pIdToBlob = &idToBlob;
311 std::unique_ptr<TTreeCache> psetTreeCache =
313 psetTreeCache->SetEnablePrefetching(
false);
314 filePtr_->SetCacheRead(psetTreeCache.get());
315 for (Long64_t
i = 0;
i != psetTree->GetEntries(); ++
i) {
316 psetTree->GetEntry(
i);
317 psetMap.insert(idToBlob);
342 auto branchIDListsAPtr = std::make_unique<BranchIDLists>();
350 std::make_unique<ThinnedAssociationsHelper>();
354 &thinnedAssociationsHelperPtr);
391 for (
auto const& psetEntry : psetMap) {
393 pset.setID(psetEntry.first);
404 inputProdDescReg, pHistMap, pHistVector, processConfigurations, psetIdConverter,
true);
412 inputProdDescReg, pHistMap, pHistVector, processConfigurations, psetIdConverter,
false);
424 <<
"Failed to find thinnedAssociationsHelper branch in metaData tree.\n";
428 if (!bypassVersionCheck) {
429 checkReleaseVersion(pHistVector,
file());
432 if (labelRawDataLikeMC) {
437 ProductRegistry::ProductList::iterator it = pList.lower_bound(finder);
438 if (it != pList.end() && it->first.friendlyClassName() == rawData && it->first.moduleLabel() ==
source) {
454 it = pList.lower_bound(finder);
455 assert(!(it != pList.end() && it->first.friendlyClassName() == rawData && it->first.moduleLabel() ==
source));
465 for (
auto const& history : pHistVector) {
499 for (
auto& product : pList) {
505 auto newReg = std::make_unique<ProductRegistry>();
510 for (
auto const& product : prodList) {
514 newReg->copyProduct(prod);
518 <<
"Cannot change friendly class name algorithm without more development work\n" 519 <<
"to update BranchIDLists and ThinnedAssociationsHelper. Contact the framework group.\n";
523 newReg->copyProduct(newBD);
527 dropOnInput(*newReg, productSelectorRules, dropDescendants, inputType);
530 *associationsFromSecondary);
536 for (
auto& product : newReg->productListUpdator()) {
550 std::array<size_t, NumBranchTypes> nBranches;
552 for (
auto const& product : prodList) {
553 ++nBranches[product.second.branchType()];
558 t->numberOfBranchesToAdd(nBranches[i]);
562 for (
auto const& product : prodList) {
586 std::unique_ptr<TTree> entryDescriptionTree(
588 if (
nullptr == entryDescriptionTree.get()) {
606 if (idBuffer != entryDescriptionBuffer.
id()) {
609 entryDescriptionMap.insert(std::make_pair(entryDescriptionBuffer.
id(), entryDescriptionBuffer));
616 if (newID != oldID) {
633 if (
nullptr == parentageTree.get()) {
651 if (newID != oldID) {
866 struct RunItemSortByRun {
867 bool operator()(RunItem
const&
a, RunItem
const&
b)
const {
return a.run_ < b.run_; }
869 struct RunItemSortByRunPhid {
870 bool operator()(RunItem
const&
a, RunItem
const&
b)
const {
871 return a.run_ < b.run_ || (!(b.run_ < a.run_) && a.phid_ < b.phid_);
882 firstEventEntry_(entry),
890 struct LumiItemSortByRunLumi {
891 bool operator()(LumiItem
const&
a, LumiItem
const&
b)
const {
892 return a.run_ < b.run_ || (!(b.run_ < a.run_) && a.lumi_ < b.lumi_);
895 struct LumiItemSortByRunLumiPhid {
896 bool operator()(LumiItem
const&
a, LumiItem
const&
b)
const {
901 if (a.lumi_ < b.lumi_)
903 if (b.lumi_ < a.lumi_)
905 return a.phid_ < b.phid_;
920 typedef std::list<LumiItem>
LumiList;
923 typedef std::set<LuminosityBlockID> RunLumiSet;
924 RunLumiSet runLumiSet;
926 typedef std::list<RunItem>
RunList;
929 typedef std::set<RunNumber_t> RunSet;
932 typedef std::set<RunItem, RunItemSortByRunPhid> RunItemSet;
933 RunItemSet runItemSet;
935 typedef std::map<RunNumber_t, ProcessHistoryID> PHIDMap;
949 bool newLumi =
false;
960 if (iFirst || prevPhid != reducedPHID || prevRun !=
eventAux().
run()) {
962 newRun = newLumi =
true;
963 }
else if (prevLumi !=
eventAux().luminosityBlock()) {
966 prevPhid = reducedPHID;
974 LumiItem& currentLumi = lumis.back();
976 ++currentLumi.lastEventEntry_;
981 if (runItemSet.insert(item).second) {
984 phidMap.insert(std::make_pair(
eventAux().
run(), reducedPHID));
995 typedef std::map<RunNumber_t, IndexIntoFile::EntryNumber_t> RunMap;
998 typedef std::vector<RunItem> RunVector;
1008 if (runSet.insert(runAux->run()).
second) {
1010 emptyRuns.emplace_back(reducedPHID, runAux->run());
1013 phidMap.insert(std::make_pair(runAux->run(), reducedPHID));
1020 RunItemSortByRun runItemSortByRun;
1023 RunList::iterator itRuns = runs.begin(), endRuns = runs.end();
1024 for (
auto const& emptyRun : emptyRuns) {
1025 for (; itRuns != endRuns; ++itRuns) {
1026 if (runItemSortByRun(emptyRun, *itRuns)) {
1030 runs.insert(itRuns, emptyRun);
1035 typedef std::vector<LumiItem> LumiVector;
1036 LumiVector emptyLumis;
1038 typedef std::map<LuminosityBlockID, IndexIntoFile::EntryNumber_t> RunLumiMap;
1039 RunLumiMap runLumiMap;
1046 if (runLumiSet.insert(lumiID).second) {
1051 PHIDMap::const_iterator iPhidMap = phidMap.find(lumiAux->run());
1052 assert(iPhidMap != phidMap.end());
1053 emptyLumis.emplace_back(
1063 LumiItemSortByRunLumi lumiItemSortByRunLumi;
1066 LumiList::iterator itLumis = lumis.begin(), endLumis = lumis.end();
1067 for (
auto const& emptyLumi : emptyLumis) {
1068 for (; itLumis != endLumis; ++itLumis) {
1069 if (lumiItemSortByRunLumi(emptyLumi, *itLumis)) {
1073 lumis.insert(itLumis, emptyLumi);
1078 typedef std::map<RunItem, int, RunItemSortByRunPhid> RunCountMap;
1079 RunCountMap runCountMap;
1081 assert(phids.empty());
1083 assert(entries.empty());
1085 for (
auto&
run : runs) {
1086 RunCountMap::const_iterator countMapItem = runCountMap.find(
run);
1087 if (countMapItem == runCountMap.end()) {
1088 countMapItem = runCountMap.insert(std::make_pair(
run, rcount)).first;
1089 assert(countMapItem != runCountMap.end());
1092 std::vector<ProcessHistoryID>::const_iterator phidItem =
find_in_all(phids,
run.phid_);
1093 if (phidItem == phids.end()) {
1094 phids.push_back(
run.phid_);
1095 phidItem = phids.end() - 1;
1097 entries.emplace_back(countMapItem->second,
1100 phidItem - phids.begin(),
1108 typedef std::map<LumiItem, int, LumiItemSortByRunLumiPhid> LumiCountMap;
1109 LumiCountMap lumiCountMap;
1111 for (
auto&
lumi : lumis) {
1112 RunCountMap::const_iterator runCountMapItem = runCountMap.find(RunItem(
lumi.phid_,
lumi.run_));
1113 assert(runCountMapItem != runCountMap.end());
1114 LumiCountMap::const_iterator countMapItem = lumiCountMap.find(
lumi);
1115 if (countMapItem == lumiCountMap.end()) {
1116 countMapItem = lumiCountMap.insert(std::make_pair(
lumi, lcount)).first;
1117 assert(countMapItem != lumiCountMap.end());
1120 std::vector<ProcessHistoryID>::const_iterator phidItem =
find_in_all(phids,
lumi.phid_);
1121 assert(phidItem != phids.end());
1122 entries.emplace_back(runCountMapItem->second,
1123 countMapItem->second,
1125 phidItem - phids.begin(),
1128 lumi.firstEventEntry_,
1129 lumi.lastEventEntry_);
1140 <<
"in the input file.\n";
1144 if (
runTree().entries() > 0) {
1150 for (
auto& phid : phidVec) {
1164 std::shared_ptr<IndexIntoFile::EventFinder>(std::make_shared<RootFileEventFinder>(
eventTree_)));
1167 bool needEventNumbers =
false;
1168 bool needIndexesForDuplicateChecker =
1170 if (inputType !=
InputType::Primary || needIndexesForDuplicateChecker || usingGoToEvent) {
1171 needEventNumbers =
true;
1173 bool needEventEntries =
false;
1176 needEventEntries =
true;
1192 treePointer->close();
1193 treePointer =
nullptr;
1245 if (!eventHistoryBranch) {
1248 eventHistoryBranch->SetAddress(&pHistory);
1257 assert(eventSelectionIDBranch !=
nullptr);
1261 assert(branchListIndexesBranch !=
nullptr);
1283 auto lumiAuxiliary = std::make_shared<LuminosityBlockAuxiliary>();
1294 lumiAuxiliary->setProcessHistoryID(
provenanceAdaptor_->convertID(lumiAuxiliary->processHistoryID()));
1297 lumiAuxiliary->setProcessHistoryID(
daqProvenanceHelper_->mapProcessHistoryID(lumiAuxiliary->processHistoryID()));
1302 return lumiAuxiliary;
1306 auto runAuxiliary = std::make_shared<RunAuxiliary>();
1312 RunAux* pRunAux = &runAux;
1317 runAuxiliary->setProcessHistoryID(
provenanceAdaptor_->convertID(runAuxiliary->processHistoryID()));
1320 runAuxiliary->setProcessHistoryID(
daqProvenanceHelper_->mapProcessHistoryID(runAuxiliary->processHistoryID()));
1322 return runAuxiliary;
1333 phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1355 while (offset < 0) {
1493 runHelper_->overrideRunNumber(runAuxiliary->id());
1494 filePtr_->reportInputRunNumber(runAuxiliary->run());
1522 runAuxiliary->setProcessHistoryID(
eventAux().processHistoryID());
1527 return runAuxiliary;
1535 assert(entryNumber >= 0);
1536 mergeableRunProductMetadata->
readRun(
1569 return std::make_shared<LuminosityBlockAuxiliary>(
1577 runHelper_->overrideRunNumber(lumiAuxiliary->id());
1578 filePtr_->reportInputLumiSection(lumiAuxiliary->run(), lumiAuxiliary->luminosityBlock());
1592 return lumiAuxiliary;
1655 history_ = std::make_unique<History>();
1657 if (!eventHistoryTree_) {
1664 std::vector<std::shared_ptr<IndexIntoFile>>
const& indexesIntoFiles,
1665 std::vector<std::shared_ptr<IndexIntoFile>>::
size_type currentIndexIntoFile) {
1678 std::set<BranchID>& branchesToDrop,
1679 std::map<BranchID, BranchID>
const& droppedToKeptAlias)
const {
1680 if (dropDescendants) {
1681 branchChildren_->appendToDescendants(branch, branchesToDrop, droppedToKeptAlias);
1683 branchesToDrop.insert(branch.
branchID());
1689 bool dropDescendants,
1695 std::vector<BranchDescription const*> associationDescriptions;
1699 std::set<BranchID> branchesToDrop;
1700 std::map<BranchID, BranchID> droppedToKeptAlias;
1701 for (
auto const& product : prodList) {
1707 for (
auto const& product : prodList) {
1712 associationDescriptions.push_back(&prod);
1716 }
else if (!productSelector.
selected(prod)) {
1729 std::set<BranchID> keptProductsInEvent;
1730 for (
auto const& product : prodList) {
1732 if (branchesToDrop.find(prod.
branchID()) == branchesToDrop.end() && prod.
present() &&
1734 keptProductsInEvent.insert(prod.
branchID());
1739 std::map<BranchID, bool> keepAssociation;
1741 associationDescriptions, keptProductsInEvent, keepAssociation);
1743 for (
auto association : associationDescriptions) {
1750 auto temp = std::make_unique<ThinnedAssociationsHelper>();
1752 auto iter = keepAssociation.find(associationBranches.association());
1753 if (iter != keepAssociation.end() && iter->second) {
1754 temp->addAssociation(associationBranches);
1762 std::set<BranchID>::const_iterator branchesToDropEnd = branchesToDrop.end();
1763 for (ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) {
1765 bool drop = branchesToDrop.find(prod.
branchID()) != branchesToDropEnd;
1769 LogWarning(
"RootFile") <<
"Branch '" << prod.
branchName() <<
"' is being dropped from the input\n" 1770 <<
"of file '" <<
file_ <<
"' because it is dependent on a branch\n" 1771 <<
"that was explicitly dropped.\n";
1776 ProductRegistry::ProductList::iterator icopy = it;
1778 prodList.erase(icopy);
1787 for (ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) {
1791 void*
p = cp->New();
1794 if (edp->isMergeable()) {
1796 ProductRegistry::ProductList::iterator icopy = it;
1798 prodList.erase(icopy);
1820 return std::make_unique<MakeFullProvenanceReader>();
1822 auto entryDescriptionMap = std::make_unique<EntryDescriptionMap>();
1824 return std::make_unique<MakeOldProvenanceReader>(
std::move(entryDescriptionMap));
1826 return std::make_unique<MakeDummyProvenanceReader>();
1846 std::vector<ParentageID>
const& iParentageIDLookup,
1849 std::set<ProductProvenance> readProvenance(
unsigned int)
const override;
1854 unsigned int transitionIndex,
1855 std::atomic<
const std::set<ProductProvenance>*>& writeTo)
const override;
1863 std::shared_ptr<std::recursive_mutex>
mutex_;
1868 std::vector<ParentageID>
const& iParentageIDLookup,
1871 rootTree_(iRootTree),
1872 pProvVector_(&provVector_),
1883 template <
typename R>
1884 void readProvenanceAsyncImpl(
R const* iThis,
1887 unsigned int transitionIndex,
1888 std::atomic<
const std::set<ProductProvenance>*>& writeTo,
1890 SignalType
const* pre,
1891 SignalType
const* post) {
1892 if (
nullptr == writeTo.load()) {
1895 auto pWriteTo = &writeTo;
1906 serviceToken]()
mutable {
1907 if (
nullptr == pWriteTo->load()) {
1909 std::unique_ptr<const std::set<ProductProvenance>> prov;
1914 prov = std::make_unique<const std::set<ProductProvenance>>(iThis->readProvenance(transitionIndex));
1924 holder.doneWaiting(std::current_exception());
1927 const std::set<ProductProvenance>* expected =
nullptr;
1929 if (pWriteTo->compare_exchange_strong(expected, prov.get())) {
1933 holder.doneWaiting(std::exception_ptr());
1941 unsigned int transitionIndex,
1942 std::atomic<
const std::set<ProductProvenance>*>& writeTo)
const {
1943 readProvenanceAsyncImpl(
this,
1948 moduleCallingContext,
1949 rootTree_->rootDelayedReader()->preEventReadFromSourceSignal(),
1950 rootTree_->rootDelayedReader()->postEventReadFromSourceSignal());
1955 std::lock_guard<std::recursive_mutex> guard(*
mutex_);
1960 std::set<ProductProvenance> retValue;
1971 <<
"ReducedProvenanceReader::ReadProvenance\n" 1972 <<
"The parentage ID index value " << prov.parentageIDIndex_
1973 <<
" is out of bounds. The maximum value is " <<
parentageIDLookup_.size() - 1 <<
".\n" 1974 <<
"This should never happen.\n" 1975 <<
"Please report this to the framework hypernews forum 'hn-cms-edmFramework@cern.ch'.\n";
1987 std::set<ProductProvenance>
readProvenance(
unsigned int transitionIndex)
const override;
1992 unsigned int transitionIndex,
1993 std::atomic<
const std::set<ProductProvenance>*>& writeTo)
const override;
1999 std::shared_ptr<std::recursive_mutex>
mutex_;
2007 pInfoVector_(&infoVector_),
2014 unsigned int transitionIndex,
2015 std::atomic<
const std::set<ProductProvenance>*>& writeTo)
const {
2016 readProvenanceAsyncImpl(
this,
2021 moduleCallingContext,
2028 std::lock_guard<std::recursive_mutex> guard(*
mutex_);
2032 std::set<ProductProvenance> retValue;
2040 retValue.emplace(
info);
2052 std::set<ProductProvenance>
readProvenance(
unsigned int transitionIndex)
const override;
2057 unsigned int transitionIndex,
2058 std::atomic<
const std::set<ProductProvenance>*>& writeTo)
const override;
2065 std::shared_ptr<std::recursive_mutex>
mutex_;
2076 entryDescriptionMap_(theMap),
2083 unsigned int transitionIndex,
2084 std::atomic<
const std::set<ProductProvenance>*>& writeTo)
const {
2085 readProvenanceAsyncImpl(
this,
2090 moduleCallingContext,
2091 rootTree_->rootDelayedReader()->preEventReadFromSourceSignal(),
2092 rootTree_->rootDelayedReader()->postEventReadFromSourceSignal());
2097 std::lock_guard<std::recursive_mutex> guard(*
mutex_);
2101 std::set<ProductProvenance> retValue;
2105 Parentage parentage(iter->second.parents());
2110 retValue.emplace(
info.branchID(), parentage.id());
2122 std::set<ProductProvenance>
readProvenance(
unsigned int)
const override;
2125 unsigned int transitionIndex,
2126 std::atomic<
const std::set<ProductProvenance>*>& writeTo)
const override;
2133 return std::set<ProductProvenance>{};
2137 unsigned int transitionIndex,
2138 std::atomic<
const std::set<ProductProvenance>*>& writeTo)
const {
2139 if (
nullptr == writeTo.load()) {
2140 auto emptyProv = std::make_unique<const std::set<ProductProvenance>>();
2141 const std::set<ProductProvenance>* expected =
nullptr;
2142 if (writeTo.compare_exchange_strong(expected, emptyProv.get())) {
2143 emptyProv.release();
2150 return std::make_unique<DummyProvenanceReader>();
2155 return std::make_unique<OldProvenanceReader>(&rootTree, *entryDescriptionMap_, daqProvenanceHelper);
2160 return std::make_unique<FullProvenanceReader>(&rootTree, daqProvenanceHelper);
2165 return std::make_unique<ReducedProvenanceReader>(&rootTree, parentageIDLookup_, daqProvenanceHelper);
void dropOnInput(ProductRegistry ®, ProductSelectorRules const &rules, bool dropDescendants, InputType inputType)
EventID const & eventID() const
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
void fillEventNumbersOrEntries(bool needEventNumbers, bool needEventEntries) const
EventNumber_t event() const
std::string const & idToParameterSetBlobsBranchName()
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > fileThinnedAssociationsHelper_
std::vector< ProcessConfiguration > ProcessConfigurationVector
void setEventFinder(std::shared_ptr< EventFinder > ptr) const
std::string const & branchName() const
StoredProductProvenanceVector provVector_
bool selected(BranchDescription const &desc) const
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const &branchType)
unsigned int const defaultNonEventLearningEntries
EntryNumber_t firstEventEntryThisRun()
void doneFileInitialization() const
Clears the temporary vector of event numbers to reduce memory usage.
static constexpr int invalidIndex
BranchType const & branchType() const
std::string const & parentageTreeName()
std::vector< BranchIDList > BranchIDLists
std::shared_ptr< BranchIDLists const > branchIDLists_
std::string const & entryDescriptionBranchName()
bool skipEvents(int &offset)
StreamContext const * getStreamContext() const
edm::propagate_const< std::shared_ptr< DuplicateChecker > > duplicateChecker_
FileFormatVersion fileFormatVersion() const
std::shared_ptr< LuminosityBlockAuxiliary > fillLumiAuxiliary()
ProductProvenanceVector infoVector_
static std::string const source("source")
static Timestamp invalidTimestamp()
ForwardSequence::const_iterator lower_bound_all(ForwardSequence const &s, Datum const &d)
wrappers for std::lower_bound
void readEntryDescriptionTree(EntryDescriptionMap &entryDescriptionMap, InputType inputType)
bool branchListIndexesUnchanged() const
std::vector< std::string > const & branchNames() const
bool setEntryAtNextEventInLumi(RunNumber_t run, LuminosityBlockNumber_t lumi)
static PFTauRenderPlugin instance
MakeOldProvenanceReader(std::unique_ptr< EntryDescriptionMap > &&entryDescriptionMap)
std::vector< BranchID > & parentsForUpdate()
edm::propagate_const< std::shared_ptr< EventSkipperByID > > eventSkipperByID_
edm::propagate_const< std::shared_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
DaqProvenanceHelper const * daqProvenanceHelper_
std::map< std::string, std::string > newBranchToOldBranch_
bool empty() const
True if no runs, lumis, or events are in the file.
std::map< BranchKey, BranchDescription > ProductList
BranchID const & mapBranchID(BranchID const &branchID) const
EntryType getEntryType() const
bool registerProcessHistory(ProcessHistory const &processHistory)
bool setEntryAtRun(RunNumber_t run)
void readRun_(RunPrincipal &runPrincipal)
ProductProvenanceVector * pInfoVector_
Timestamp const & time() const
edm::propagate_const< ProcessHistoryRegistry * > processHistoryRegistry_
edm::propagate_const< std::unique_ptr< DaqProvenanceHelper > > daqProvenanceHelper_
edm::propagate_const< std::shared_ptr< RunAuxiliary > > savedRunAuxiliary_
unsigned long long EventNumber_t
EntryNumber const & entries() const
void setSignals(signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const *preEventReadSource, signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const *postEventReadSource)
std::string const & fileFormatVersionBranchName()
IndexIntoFileItr begin(SortOrder sortOrder) const
FullProvenanceReader(RootTree *rootTree, DaqProvenanceHelper const *daqProvenanceHelper)
EntryDescriptionMap const & entryDescriptionMap_
std::vector< BranchID > const & parents() const
std::string const & eventSelectionsBranchName()
edm::propagate_const< std::unique_ptr< EntryDescriptionMap > > entryDescriptionMap_
void initializeDuplicateChecker(std::vector< std::shared_ptr< IndexIntoFile >> const &indexesIntoFiles, std::vector< std::shared_ptr< IndexIntoFile >>::size_type currentIndexIntoFile)
void push(T &&iAction)
asynchronously pushes functor iAction into queue
InputSource::ProcessingMode processingMode_
~RootFileEventFinder() override
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
std::shared_ptr< ProductProvenanceRetriever const > eventProductProvenanceRetriever(size_t index) const
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
void stable_sort_all(RandomAccessSequence &s)
wrappers for std::stable_sort
std::shared_ptr< std::recursive_mutex > mutex_
LuminosityBlockNumber_t lumi() const
void fillBranchEntryMeta(TBranch *branch, T *&pbuf)
std::unique_ptr< FileBlock > createFileBlock() const
LuminosityBlockNumber_t luminosityBlock() const
void trainCache(char const *branchNames)
bool readCurrentEvent(EventPrincipal &cache)
SharedResourcesAcquirer acquirer_
~FullProvenanceReader() override
ServiceToken presentToken() const
std::shared_ptr< ProductRegistry const > productRegistry() const
unsigned int LuminosityBlockNumber_t
IndexIntoFileItr findRunPosition(RunNumber_t run) const
Same as findPosition.
void readProvenanceAsync(WaitingTask *task, ModuleCallingContext const *moduleCallingContext, unsigned int transitionIndex, std::atomic< const std::set< ProductProvenance > * > &writeTo) const override
void readAllFromSourceAndMergeImmediately(MergeableRunProductMetadata const *mergeableRunProductMetadata=0)
TBranch * branchEntryInfoBranch() const
void advanceToNextLumiOrRun()
bool fillEventAuxiliary(IndexIntoFile::EntryNumber_t entry)
MakeReducedProvenanceReader(std::vector< ParentageID > const &parentageIDLookup)
IndexIntoFileItr findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
std::vector< EventSelectionID > EventSelectionIDVector
edm::propagate_const< TClass * > edProductClass_
LuminosityBlockNumber_t luminosityBlock() const
FileFormatVersion fileFormatVersion_
TTree const * metaTree() const
RootFile(std::string const &fileName, ProcessConfiguration const &processConfiguration, std::string const &logicalFileName, std::shared_ptr< InputFile > filePtr, std::shared_ptr< EventSkipperByID > eventSkipperByID, bool skipAnyEvents, int remainingEvents, int remainingLumis, unsigned int nStreams, unsigned int treeCacheSize, int treeMaxVirtualSize, InputSource::ProcessingMode processingMode, RunHelperBase *runHelper, bool noEventSort, ProductSelectorRules const &productSelectorRules, InputType inputType, std::shared_ptr< BranchIDListHelper > branchIDListHelper, std::shared_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper, std::vector< BranchID > const *associationsFromSecondary, std::shared_ptr< DuplicateChecker > duplicateChecker, bool dropDescendantsOfDroppedProducts, ProcessHistoryRegistry &processHistoryRegistry, std::vector< std::shared_ptr< IndexIntoFile >> const &indexesIntoFiles, std::vector< std::shared_ptr< IndexIntoFile >>::size_type currentIndexIntoFile, std::vector< ProcessHistoryID > &orderedProcessHistoryIDs, bool bypassVersionCheck, bool labelRawDataLikeMC, bool usingGoToEvent, bool enablePrefetching)
std::string const & parameterSetsTreeName()
void setPosition(IndexIntoFile::IndexIntoFileItr const &position)
std::vector< edm::propagate_const< std::shared_ptr< ProductProvenanceRetriever > > > eventProductProvenanceRetrievers_
edm::propagate_const< RootTree * > rootTree_
ProductList const & productList() const
U second(std::pair< T, U > const &p)
std::vector< EventProcessHistoryID >::const_iterator eventProcessHistoryIter_
void reduceProcessHistoryIDs(ProcessHistoryRegistry const &processHistoryRegistry)
TTree const * tree() const
bool containsItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
void setParents(std::vector< BranchID > const &parents)
DaqProvenanceHelper const * daqProvenanceHelper_
std::string const logicalFile_
std::vector< BranchListIndex > BranchListIndexes
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
std::string moduleName(Provenance const &provenance)
void fillLuminosityBlockPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
void readParentageTree(InputType inputType)
std::string const & processHistoryMapBranchName()
std::vector< ProcessHistoryID > & setProcessHistoryIDs()
edm::propagate_const< std::unique_ptr< StoredMergeableRunProductMetadata > > storedMergeableRunProductMetadata_
TClass * getClass() const
std::string const & className() const
bool wasLastEventJustRead() const
void insertEntryForIndex(unsigned int index)
DelayedReader * resetAndGetRootDelayedReader() const
bool setEntryAtLumi(RunNumber_t run, LuminosityBlockNumber_t lumi)
std::string friendlyName(std::string const &iFullName)
static constexpr RunNumber_t invalidRun
std::string const & entryDescriptionTreeName()
virtual signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const * postEventReadFromSourceSignal() const =0
std::string const & fid() const
std::shared_ptr< std::recursive_mutex > mutex_
std::string const & mergeableRunProductMetadataBranchName()
RootTree const & runTree() const
IndexIntoFile::EntryNumber_t lastEventEntryNumberRead_
void copyPosition(IndexIntoFileItr const &position)
Copy the position without modifying the pointer to the IndexIntoFile or size.
std::string const & indexIntoFileBranchName()
IndexIntoFileItr end(SortOrder sortOrder) const
Used to end an iteration over the Runs, Lumis, and Events in a file.
std::string const & eventHistoryBranchName()
std::set< ProductProvenance > readProvenance(unsigned int transitionIndex) const override
void skipEventBackward(int &phIndexOfEvent, RunNumber_t &runOfEvent, LuminosityBlockNumber_t &lumiOfEvent, EntryNumber_t &eventEntry)
Long64_t numEntries(TFile *hdl, std::string const &trname)
EntryNumber_t firstEventEntryThisLumi()
edm::propagate_const< RootTree * > rootTree_
std::shared_ptr< RunAuxiliary > readRunAuxiliary_()
EventAuxiliary const & eventAux() const
EventSelectionIDVector eventSelectionIDs_
int processHistoryIDIndex() const
std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_()
bool isEarlierRelease(std::string const &a, std::string const &b)
StoredProductProvenanceVector const * pProvVector_
int whyNotFastClonable() const
edm::propagate_const< std::unique_ptr< ProvenanceAdaptor > > provenanceAdaptor_
StreamID streamID() const
static ServiceRegistry & instance()
std::shared_ptr< RunAuxiliary > fillRunAuxiliary()
void setSignals(signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const *preEventReadSource, signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const *postEventReadSource)
std::vector< BranchDescription const * > allBranchDescriptions() const
EventNumber_t getEventNumberOfEntry(roottree::EntryNumber entry) const override
std::map< ParameterSetID, ParameterSetID > ParameterSetIdConverter
bool iterationWillBeInEntryOrder(SortOrder sortOrder) const
Used to determine whether or not to disable fast cloning.
std::string const & friendlyClassName() const
BranchID const & branchID() const
TypeWithDict const & unwrappedType() const
bool insertMapped(value_type const &v, bool forceUpdate=false)
void updateFriendlyClassName()
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch() const
IndexIntoFile::EntryType getNextItemType(RunNumber_t &run, LuminosityBlockNumber_t &lumi, EventNumber_t &event)
BranchListIndexes branchListIndexes_
std::string const & metaDataTreeName()
virtual signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const * preEventReadFromSourceSignal() const =0
LuminosityBlockNumber_t oldLuminosityBlock() const
EntryDescriptionID id() const
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
IndexIntoFile::EntryNumber_t EntryNumber
bool wasFirstEventJustRead() const
std::string const & parameterSetMapBranchName()
Hash< ProcessHistoryType > ProcessHistoryID
std::unique_ptr< ProvenanceReaderBase > makeReader(RootTree &eventTree, DaqProvenanceHelper const *daqProvenanceHelper) const override
edm::propagate_const< std::unique_ptr< History > > history_
ProcessHistoryVector vector_type
SerialTaskQueueChain & serialQueueChain() const
std::vector< ProductProvenance > ProductProvenanceVector
std::string const & processHistoryBranchName()
IndexIntoFile & indexIntoFile_
void readEvent(EventPrincipal &cache)
SharedResourcesAcquirer acquirer_
edm::propagate_const< std::unique_ptr< MakeProvenanceReader > > provenanceReaderMaker_
EntryNumber const & entryNumber() const
ProcessHistoryMap collection_type
bool containsItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
bool goToEvent(EventID const &eventID)
std::string getReleaseVersion()
std::shared_ptr< RunAuxiliary const > savedRunAuxiliary() const
std::set< ProductProvenance > readProvenance(unsigned int) const override
void setAtEventEntry(IndexIntoFile::EntryNumber_t entry)
void fixIndexes(std::vector< ProcessHistoryID > &processHistoryIDs)
DelayedReader * rootDelayedReader() const
std::vector< RunOrLumiEntry > & setRunOrLumiEntries()
EntryNumber const & entryNumberForIndex(unsigned int index) const
void conversion(EventAux const &from, EventAuxiliary &to)
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
std::vector< EventNumber_t > & unsortedEventNumbers() const
unsigned int value() const
static constexpr EntryNumber_t invalidEntry
ForwardSequence::const_iterator find_in_all(ForwardSequence const &s, Datum const &d)
wrappers for std::find
std::shared_ptr< ProductRegistry const > productRegistry_
void setIfFastClonable(int remainingEvents, int remainingLumis)
std::unique_ptr< ProvenanceReaderBase > makeReader(RootTree &eventTree, DaqProvenanceHelper const *daqProvenanceHelper) const override
MergeableRunProductMetadata * mergeableRunProductMetadata()
void fillBranchEntry(TBranch *branch, T *&pbuf)
static constexpr LuminosityBlockNumber_t invalidLumi
IndexIntoFileItr findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
std::map< EntryDescriptionID, EventEntryDescription > EntryDescriptionMap
edm::propagate_const< std::shared_ptr< BranchChildren > > branchChildren_
std::string const & parentageBranchName()
edm::propagate_const< std::shared_ptr< InputFile > > filePtr_
std::shared_ptr< BranchChildren const > branchChildren() const
LuminosityBlockNumber_t luminosityBlock() const
ProcessHistoryID const & processHistoryID(int i) const
ProductList & productListUpdator()
void setProcessHistoryID(ProcessHistoryID const &phid)
unsigned int transitionIndex() const
void readProvenanceAsync(WaitingTask *task, ModuleCallingContext const *moduleCallingContext, unsigned int transitionIndex, std::atomic< const std::set< ProductProvenance > * > &writeTo) const override
void readProvenanceAsync(WaitingTask *task, ModuleCallingContext const *moduleCallingContext, unsigned int transitionIndex, std::atomic< const std::set< ProductProvenance > * > &writeTo) const override
std::vector< ParentageID > const & parentageIDLookup_
std::shared_ptr< std::recursive_mutex > mutex_
std::unique_ptr< ProvenanceReaderBase > makeReader(RootTree &eventTree, DaqProvenanceHelper const *daqProvenanceHelper) const override
~OldProvenanceReader() override
std::shared_ptr< ProductProvenanceRetriever > makeProductProvenanceRetriever(unsigned int iStreamIndex)
std::vector< StoredProductProvenance > StoredProductProvenanceVector
std::string const & file() const
std::string const & productDescriptionBranchName()
std::string const & processConfigurationBranchName()
IndexIntoFile::IndexIntoFileItr indexIntoFileBegin_
ProcessHistoryID const & processHistoryID() const
EventID const & id() const
edm::propagate_const< RunHelperBase * > runHelper_
bool branchListIndexesUnchanged_
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
edm::propagate_const< TTree * > eventHistoryTree_
void readLuminosityBlock_(LuminosityBlockPrincipal &lumiPrincipal)
std::vector< EventEntryInfo > * pInfoVector_
std::unique_ptr< ProvenanceReaderBase > makeReader(RootTree &eventTree, DaqProvenanceHelper const *daqProvenanceHelper) const override
unsigned int const defaultNonEventCacheSize
RootTreePtrArray treePointers_
void fillEventNumbers() const
void initialize(ProductSelectorRules const &rules, std::vector< BranchDescription const * > const &branchDescriptions)
static int position[264][3]
std::string const & BranchTypeToProductProvenanceBranchName(BranchType const &BranchType)
std::vector< ProcessHistoryID > & orderedProcessHistoryIDs_
std::string const & productDependenciesBranchName()
void setNumberOfEvents(EntryNumber_t nevents) const
void initAssociationsFromSecondary(std::vector< BranchID > const &)
std::string const & thinnedAssociationsHelperBranchName()
std::string const & entryDescriptionIDBranchName()
~DummyProvenanceReader() override
edm::propagate_const< TBranch * > provBranch_
std::unique_ptr< MakeProvenanceReader > makeProvenanceReaderMaker(InputType inputType)
std::unique_ptr< WrapperBase > getWrapperBasePtr(void *p, int offset)
std::string const & branchIDListBranchName()
BranchID const & originalBranchID() const
std::string const & branchListIndexesBranchName()
std::vector< ParentageID > parentageIDLookup_
void readProvenanceAsync(WaitingTask *task, ModuleCallingContext const *moduleCallingContext, unsigned int transitionIndex, std::atomic< const std::set< ProductProvenance > * > &writeTo) const override
void fillThisEventAuxiliary()
bool setEntryAtEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
std::vector< ParentageID > const & parentageIDLookup_
ReducedProvenanceReader(RootTree *iRootTree, std::vector< ParentageID > const &iParentageIDLookup, DaqProvenanceHelper const *daqProvenanceHelper)
std::string const & eventHistoryTreeName()
RootFileEventFinder(RootTree &eventTree)
ParentageID const & mapParentageID(ParentageID const &phid) const
edm::propagate_const< std::shared_ptr< BranchIDListHelper > > branchIDListHelper_
void validateFile(InputType inputType, bool usingGoToEvent)
IndexIntoFile::IndexIntoFileItr indexIntoFileIter() const
std::string const & newBranchToOldBranch(std::string const &newBranch) const
T first(std::pair< T, U > const &p)
std::unique_ptr< TTreeCache > trainCache(TTree *tree, InputFile &file, unsigned int cacheSize, char const *branchNames)
static ParentageRegistry * instance()
OldProvenanceReader(RootTree *rootTree, EntryDescriptionMap const &theMap, DaqProvenanceHelper const *daqProvenanceHelper)
SharedResourcesAcquirer acquirer_
IndexIntoFileItr findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
unsigned int const defaultLearningEntries
EntryNumber_t entry() const
std::vector< EventEntryInfo > infoVector_
void markBranchToBeDropped(bool dropDescendants, BranchDescription const &branch, std::set< BranchID > &branchesToDrop, std::map< BranchID, BranchID > const &droppedToKeptAlias) const
LuminosityBlockNumber_t peekAheadAtLumi() const
std::string const & fileIdentifierBranchName()
void setIsMergeable(BranchDescription &)
EventNumber_t event() const
std::string const & moduleDescriptionMapBranchName()
bool insertMapped(value_type const &v)
void skipEventForward(int &phIndexOfSkippedEvent, RunNumber_t &runOfSkippedEvent, LuminosityBlockNumber_t &lumiOfSkippedEvent, EntryNumber_t &skippedEventEntry)
std::vector< EventProcessHistoryID > eventProcessHistoryIDs_
static Registry * instance()
std::set< ProductProvenance > readProvenance(unsigned int transitionIndex) const override
DaqProvenanceHelper const * daqProvenanceHelper_
std::string createGlobalIdentifier()
TypeWithDict const & wrappedType() const
void copyProduct(BranchDescription const &productdesc)
void readEventHistoryTree()
std::set< ProductProvenance > readProvenance(unsigned int) const override
void setEntryNumber(EntryNumber theEntryNumber)
void reportOpened(std::string const &inputType)
def operate(timelog, memlog, json_f, num)
roottree::EntryNumber EntryNumber