62 #include "TTreeCache.h" 95 checkReleaseVersion(std::vector<ProcessHistory> processHistoryVector,
std::string const&
fileName) {
98 for(
auto const& ph : processHistoryVector) {
99 for(
auto const& pc : ph) {
103 <<
"a release (" << pc.releaseVersion() <<
") used in writing the input file, " << fileName <<
".\n" 104 <<
"Forward compatibility cannot be supported.\n";
119 eventTree_.setEntryNumber(entry);
123 eventTree_.setEntryNumber(saveEntry);
124 return eventAux.
event();
135 std::shared_ptr<InputFile> filePtr,
136 std::shared_ptr<EventSkipperByID> eventSkipperByID,
140 unsigned int nStreams,
141 unsigned int treeCacheSize,
142 int treeMaxVirtualSize,
148 std::shared_ptr<BranchIDListHelper> branchIDListHelper,
149 std::shared_ptr<ThinnedAssociationsHelper> thinnedAssociationsHelper,
150 std::vector<BranchID>
const* associationsFromSecondary,
151 std::shared_ptr<DuplicateChecker> duplicateChecker,
152 bool dropDescendants,
154 std::vector<std::shared_ptr<IndexIntoFile> >
const& indexesIntoFiles,
155 std::vector<std::shared_ptr<IndexIntoFile> >::
size_type currentIndexIntoFile,
156 std::vector<ProcessHistoryID>& orderedProcessHistoryIDs,
157 bool bypassVersionCheck,
158 bool labelRawDataLikeMC,
160 bool enablePrefetching) :
162 logicalFile_(logicalFileName),
163 processConfiguration_(processConfiguration),
164 processHistoryRegistry_(&processHistoryRegistry),
166 eventSkipperByID_(eventSkipperByID),
167 fileFormatVersion_(),
170 indexIntoFile_(*indexIntoFileSharedPtr_),
171 orderedProcessHistoryIDs_(orderedProcessHistoryIDs),
173 indexIntoFileEnd_(indexIntoFileBegin_),
174 indexIntoFileIter_(indexIntoFileBegin_),
176 eventProcessHistoryIDs_(),
177 eventProcessHistoryIter_(eventProcessHistoryIDs_.
begin()),
178 savedRunAuxiliary_(),
179 skipAnyEvents_(skipAnyEvents),
180 noEventSort_(noEventSort),
181 whyNotFastClonable_(0),
182 hasNewlyDroppedBranch_(),
183 branchListIndexesUnchanged_(
false),
192 branchIDListHelper_(branchIDListHelper),
193 fileThinnedAssociationsHelper_(),
194 thinnedAssociationsHelper_(thinnedAssociationsHelper),
195 processingMode_(processingMode),
196 runHelper_(runHelper),
197 newBranchToOldBranch_(),
199 eventSelectionIDs_(),
200 branchListIndexes_(),
203 duplicateChecker_(duplicateChecker),
204 provenanceAdaptor_(),
205 provenanceReaderMaker_(),
206 eventProductProvenanceRetrievers_(),
207 parentageIDLookup_(),
208 daqProvenanceHelper_(),
210 inputType_(inputType) {
221 if(
nullptr == metaDataTree.get()) {
223 <<
" in the input file.\n";
232 fft->SetAddress(&fftPtr);
261 typedef std::map<ParameterSetID, ParameterSetBlob> PsetMap;
263 PsetMap *psetMapPtr = &psetMap;
272 if(
nullptr == psetTree.get()) {
274 <<
" in the input file.\n";
277 typedef std::pair<ParameterSetID, ParameterSetBlob> IdToBlobs;
279 IdToBlobs* pIdToBlob = &idToBlob;
283 psetTreeCache->SetEnablePrefetching(
false);
284 filePtr_->SetCacheRead(psetTreeCache.get());
285 for(Long64_t
i = 0;
i != psetTree->GetEntries(); ++
i) {
286 psetTree->GetEntry(
i);
287 psetMap.insert(idToBlob);
312 auto branchIDListsAPtr = std::make_unique<BranchIDLists>();
359 for(
auto const& psetEntry : psetMap) {
361 pset.setID(psetEntry.first);
372 inputProdDescReg, pHistMap, pHistVector, processConfigurations, psetIdConverter,
true);
380 inputProdDescReg, pHistMap, pHistVector, processConfigurations, psetIdConverter,
false);
385 <<
"Failed to find branchIDLists branch in metaData tree.\n";
393 <<
"Failed to find thinnedAssociationsHelper branch in metaData tree.\n";
397 if(!bypassVersionCheck) {
398 checkReleaseVersion(pHistVector,
file());
401 if(labelRawDataLikeMC) {
406 ProductRegistry::ProductList::iterator it = pList.lower_bound(finder);
407 if(it != pList.end() && it->first.friendlyClassName() == rawData && it->first.moduleLabel() ==
source) {
423 it = pList.lower_bound(finder);
424 assert(!(it != pList.end() && it->first.friendlyClassName() == rawData && it->first.moduleLabel() ==
source));
434 for(
auto const& history : pHistVector) {
466 for(
auto& product : pList) {
472 auto newReg = std::make_unique<ProductRegistry>();
477 for(
auto const& product : prodList) {
481 newReg->copyProduct(prod);
485 <<
"Cannot change friendly class name algorithm without more development work\n" 486 <<
"to update BranchIDLists and ThinnedAssociationsHelper. Contact the framework group.\n";
490 newReg->copyProduct(newBD);
494 dropOnInput(*newReg, productSelectorRules, dropDescendants, inputType);
497 *associationsFromSecondary);
503 for(
auto & product : newReg->productListUpdator()) {
517 std::array<size_t,NumBranchTypes> nBranches;
519 for(
auto const& product : prodList) {
520 ++nBranches[product.second.branchType()];
525 t->numberOfBranchesToAdd(nBranches[i]);
529 for(
auto const& product : prodList) {
557 if(
nullptr == entryDescriptionTree.get()) {
559 <<
" in the input file.\n";
575 if(idBuffer != entryDescriptionBuffer.
id()) {
578 entryDescriptionMap.insert(std::make_pair(entryDescriptionBuffer.
id(),entryDescriptionBuffer));
603 if(
nullptr == parentageTree.get()) {
605 <<
" in the input file.\n";
680 std::unique_ptr<FileBlock>
855 phid_(phid), run_(run) {}
859 struct RunItemSortByRun {
860 bool operator()(RunItem
const&
a, RunItem
const&
b)
const {
861 return a.run_ < b.run_;
864 struct RunItemSortByRunPhid {
865 bool operator()(RunItem
const&
a, RunItem
const&
b)
const {
866 return a.run_ < b.run_ || (!(b.run_ < a.run_) && a.phid_ < b.phid_);
872 phid_(phid), run_(run), lumi_(lumi), firstEventEntry_(entry),
880 struct LumiItemSortByRunLumi {
881 bool operator()(LumiItem
const&
a, LumiItem
const&
b)
const {
882 return a.run_ < b.run_ || (!(b.run_ < a.run_) && a.lumi_ < b.lumi_);
885 struct LumiItemSortByRunLumiPhid {
886 bool operator()(LumiItem
const&
a, LumiItem
const&
b)
const {
887 if(a.run_ < b.run_)
return true;
888 if(b.run_ < a.run_)
return false;
889 if(a.lumi_ < b.lumi_)
return true;
890 if(b.lumi_ < a.lumi_)
return false;
891 return a.phid_ < b.phid_;
907 typedef std::list<LumiItem>
LumiList;
910 typedef std::set<LuminosityBlockID> RunLumiSet;
911 RunLumiSet runLumiSet;
913 typedef std::list<RunItem>
RunList;
916 typedef std::set<RunNumber_t> RunSet;
919 typedef std::set<RunItem, RunItemSortByRunPhid> RunItemSet;
920 RunItemSet runItemSet;
922 typedef std::map<RunNumber_t, ProcessHistoryID> PHIDMap;
936 bool newLumi =
false;
947 if(iFirst || prevPhid != reducedPHID || prevRun !=
eventAux().
run()) {
949 newRun = newLumi =
true;
950 }
else if(prevLumi !=
eventAux().luminosityBlock()) {
953 prevPhid = reducedPHID;
957 lumis.emplace_back(reducedPHID,
961 LumiItem& currentLumi = lumis.back();
963 ++currentLumi.lastEventEntry_;
968 if(runItemSet.insert(item).second) {
971 phidMap.insert(std::make_pair(
eventAux().
run(), reducedPHID));
982 typedef std::map<RunNumber_t, IndexIntoFile::EntryNumber_t> RunMap;
985 typedef std::vector<RunItem> RunVector;
995 if(runSet.insert(runAux->run()).
second) {
997 emptyRuns.emplace_back(reducedPHID, runAux->run());
1000 phidMap.insert(std::make_pair(runAux->run(), reducedPHID));
1007 RunItemSortByRun runItemSortByRun;
1010 RunList::iterator itRuns = runs.begin(), endRuns = runs.end();
1011 for(
auto const& emptyRun : emptyRuns) {
1012 for(; itRuns != endRuns; ++itRuns) {
1013 if(runItemSortByRun(emptyRun, *itRuns)) {
1017 runs.insert(itRuns, emptyRun);
1022 typedef std::vector<LumiItem> LumiVector;
1023 LumiVector emptyLumis;
1025 typedef std::map<LuminosityBlockID, IndexIntoFile::EntryNumber_t> RunLumiMap;
1026 RunLumiMap runLumiMap;
1033 if(runLumiSet.insert(lumiID).second) {
1038 PHIDMap::const_iterator iPhidMap = phidMap.find(lumiAux->run());
1039 assert(iPhidMap != phidMap.end());
1049 LumiItemSortByRunLumi lumiItemSortByRunLumi;
1052 LumiList::iterator itLumis = lumis.begin(), endLumis = lumis.end();
1053 for(
auto const& emptyLumi : emptyLumis) {
1054 for(; itLumis != endLumis; ++itLumis) {
1055 if(lumiItemSortByRunLumi(emptyLumi, *itLumis)) {
1059 lumis.insert(itLumis, emptyLumi);
1064 typedef std::map<RunItem, int, RunItemSortByRunPhid> RunCountMap;
1065 RunCountMap runCountMap;
1067 assert(phids.empty());
1069 assert(entries.empty());
1071 for(
auto&
run : runs) {
1072 RunCountMap::const_iterator countMapItem = runCountMap.find(
run);
1073 if(countMapItem == runCountMap.end()) {
1074 countMapItem = runCountMap.insert(std::make_pair(
run, rcount)).first;
1075 assert(countMapItem != runCountMap.end());
1078 std::vector<ProcessHistoryID>::const_iterator phidItem =
find_in_all(phids,
run.phid_);
1079 if(phidItem == phids.end()) {
1080 phids.push_back(
run.phid_);
1081 phidItem = phids.end() - 1;
1083 entries.emplace_back(
1084 countMapItem->second,
1087 phidItem - phids.begin(),
1095 typedef std::map<LumiItem, int, LumiItemSortByRunLumiPhid> LumiCountMap;
1096 LumiCountMap lumiCountMap;
1098 for(
auto&
lumi : lumis) {
1099 RunCountMap::const_iterator runCountMapItem = runCountMap.find(RunItem(
lumi.phid_,
lumi.run_));
1100 assert(runCountMapItem != runCountMap.end());
1101 LumiCountMap::const_iterator countMapItem = lumiCountMap.find(
lumi);
1102 if(countMapItem == lumiCountMap.end()) {
1103 countMapItem = lumiCountMap.insert(std::make_pair(
lumi, lcount)).first;
1104 assert(countMapItem != lumiCountMap.end());
1107 std::vector<ProcessHistoryID>::const_iterator phidItem =
find_in_all(phids,
lumi.phid_);
1108 assert(phidItem != phids.end());
1109 entries.emplace_back(
1110 runCountMapItem->second,
1111 countMapItem->second,
1113 phidItem - phids.begin(),
1116 lumi.firstEventEntry_,
1117 lumi.lastEventEntry_);
1129 "'Events' tree is corrupted or not present\n" <<
"in the input file.\n";
1139 for(
auto& phid : phidVec) {
1156 bool needEventNumbers =
false;
1158 if(inputType !=
InputType::Primary || needIndexesForDuplicateChecker || usingGoToEvent) {
1159 needEventNumbers =
true;
1161 bool needEventEntries =
false;
1164 needEventEntries =
true;
1188 treePointer->close();
1189 treePointer =
nullptr;
1244 if(!eventHistoryBranch) {
1246 <<
"Failed to find history branch in event history tree.\n";
1248 eventHistoryBranch->SetAddress(&pHistory);
1257 assert(eventSelectionIDBranch !=
nullptr);
1261 assert(branchListIndexesBranch !=
nullptr);
1282 std::shared_ptr<LuminosityBlockAuxiliary>
1284 auto lumiAuxiliary = std::make_shared<LuminosityBlockAuxiliary>();
1295 lumiAuxiliary->setProcessHistoryID(
provenanceAdaptor_->convertID(lumiAuxiliary->processHistoryID()));
1298 lumiAuxiliary->setProcessHistoryID(
daqProvenanceHelper_->mapProcessHistoryID(lumiAuxiliary->processHistoryID()));
1303 return lumiAuxiliary;
1306 std::shared_ptr<RunAuxiliary>
1308 auto runAuxiliary = std::make_shared<RunAuxiliary>();
1314 RunAux *pRunAux = &runAux;
1319 runAuxiliary->setProcessHistoryID(
provenanceAdaptor_->convertID(runAuxiliary->processHistoryID()));
1322 runAuxiliary->setProcessHistoryID(
daqProvenanceHelper_->mapProcessHistoryID(runAuxiliary->processHistoryID()));
1324 return runAuxiliary;
1485 std::shared_ptr<RunAuxiliary>
1513 runHelper_->overrideRunNumber(runAuxiliary->id());
1514 filePtr_->reportInputRunNumber(runAuxiliary->run());
1543 runAuxiliary->setProcessHistoryID(
eventAux().processHistoryID());
1548 return runAuxiliary;
1558 assert(entryNumber >= 0);
1581 std::shared_ptr<LuminosityBlockAuxiliary>
1601 runHelper_->overrideRunNumber(lumiAuxiliary->id());
1602 filePtr_->reportInputLumiSection(lumiAuxiliary->run(), lumiAuxiliary->luminosityBlock());
1616 return lumiAuxiliary;
1679 history_ = std::make_unique<History>();
1681 if(!eventHistoryTree_) {
1683 <<
"Failed to find the event history tree.\n";
1690 std::vector<std::shared_ptr<IndexIntoFile> >
const& indexesIntoFiles,
1691 std::vector<std::shared_ptr<IndexIntoFile> >::
size_type currentIndexIntoFile) {
1698 currentIndexIntoFile);
1706 std::map<BranchID, BranchID>
const& droppedToKeptAlias)
const {
1707 if(dropDescendants) {
1708 branchChildren_->appendToDescendants(branch, branchesToDrop, droppedToKeptAlias);
1710 branchesToDrop.insert(branch.
branchID());
1721 std::vector<BranchDescription const*> associationDescriptions;
1725 std::set<BranchID> branchesToDrop;
1726 std::map<BranchID, BranchID> droppedToKeptAlias;
1727 for(
auto const& product : prodList) {
1733 for(
auto const& product : prodList) {
1738 associationDescriptions.push_back(&prod);
1742 }
else if(!productSelector.
selected(prod)) {
1756 std::set<BranchID> keptProductsInEvent;
1757 for(
auto const& product : prodList) {
1759 if( branchesToDrop.find(prod.
branchID()) == branchesToDrop.end() &&
1762 keptProductsInEvent.insert(prod.
branchID());
1767 std::map<BranchID, bool> keepAssociation;
1769 keptProductsInEvent,
1779 auto temp = std::make_unique<ThinnedAssociationsHelper>();
1781 auto iter = keepAssociation.find(associationBranches.association());
1782 if(iter != keepAssociation.end() && iter->second) {
1783 temp->addAssociation(associationBranches);
1791 std::set<BranchID>::const_iterator branchesToDropEnd = branchesToDrop.end();
1792 for(ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) {
1794 bool drop = branchesToDrop.find(prod.
branchID()) != branchesToDropEnd;
1799 <<
"Branch '" << prod.
branchName() <<
"' is being dropped from the input\n" 1800 <<
"of file '" <<
file_ <<
"' because it is dependent on a branch\n" 1801 <<
"that was explicitly dropped.\n";
1806 ProductRegistry::ProductList::iterator icopy = it;
1808 prodList.erase(icopy);
1817 for(ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) {
1821 void*
p = cp->New();
1824 if(edp->isMergeable()) {
1826 ProductRegistry::ProductList::iterator icopy = it;
1828 prodList.erase(icopy);
1845 std::unique_ptr<MakeProvenanceReader>
1852 return std::make_unique<MakeFullProvenanceReader>();
1854 auto entryDescriptionMap = std::make_unique<EntryDescriptionMap>();
1856 return std::make_unique<MakeOldProvenanceReader>(
std::move(entryDescriptionMap));
1858 return std::make_unique<MakeDummyProvenanceReader>();
1862 std::shared_ptr<ProductProvenanceRetriever>
1879 std::set<ProductProvenance> readProvenance(
unsigned int)
const override;
1883 unsigned int transitionIndex,
1884 std::atomic<
const std::set<ProductProvenance>*>& writeTo
1893 std::shared_ptr<std::recursive_mutex>
mutex_;
1899 std::vector<ParentageID>
const& iParentageIDLookup,
1902 rootTree_(iRootTree),
1903 pProvVector_(&provVector_),
1914 template<
typename R>
1915 void readProvenanceAsyncImpl(
R const* iThis,
1918 unsigned int transitionIndex,
1919 std::atomic<
const std::set<ProductProvenance>*>& writeTo,
1921 SignalType
const* pre,
1922 SignalType
const* post) {
1923 if(
nullptr == writeTo.load()) {
1926 auto pWriteTo = &writeTo;
1930 chain.
push([holder =
std::move(taskHolder), pWriteTo,iThis,transitionIndex, iContext, pre,post, serviceToken]()
mutable {
1932 if(
nullptr == pWriteTo->load()) {
1934 std::unique_ptr<const std::set<ProductProvenance>> prov;
1937 prov = std::make_unique<const std::set<ProductProvenance>>(iThis->readProvenance(transitionIndex));
1943 holder.doneWaiting(std::current_exception());
1946 const std::set<ProductProvenance>* expected =
nullptr;
1948 if(pWriteTo->compare_exchange_strong(expected,prov.get())) {
1952 holder.doneWaiting(std::exception_ptr());
1961 unsigned int transitionIndex,
1962 std::atomic<
const std::set<ProductProvenance>*>& writeTo
1964 readProvenanceAsyncImpl(
this,
1969 moduleCallingContext,
1970 rootTree_->rootDelayedReader()->preEventReadFromSourceSignal(),
1971 rootTree_->rootDelayedReader()->postEventReadFromSourceSignal());
1974 std::set<ProductProvenance>
1977 std::lock_guard<std::recursive_mutex> guard(*
mutex_);
1981 std::set<ProductProvenance> retValue;
1992 <<
"ReducedProvenanceReader::ReadProvenance\n" 1993 <<
"The parentage ID index value " << prov.parentageIDIndex_ <<
" is out of bounds. The maximum value is " <<
parentageIDLookup_.size()-1 <<
".\n" 1994 <<
"This should never happen.\n" 1995 <<
"Please report this to the framework hypernews forum 'hn-cms-edmFramework@cern.ch'.\n";
2007 std::set<ProductProvenance>
readProvenance(
unsigned int transitionIndex)
const override;
2011 unsigned int transitionIndex,
2012 std::atomic<
const std::set<ProductProvenance>*>& writeTo
2019 std::shared_ptr<std::recursive_mutex>
mutex_;
2027 pInfoVector_(&infoVector_),
2037 unsigned int transitionIndex,
2038 std::atomic<
const std::set<ProductProvenance>*>& writeTo
2040 readProvenanceAsyncImpl(
this,
2045 moduleCallingContext,
2050 std::set<ProductProvenance>
2053 std::lock_guard<std::recursive_mutex> guard(*
mutex_);
2056 std::set<ProductProvenance> retValue;
2064 retValue.emplace(
info);
2074 std::set<ProductProvenance>
readProvenance(
unsigned int transitionIndex)
const override;
2078 unsigned int transitionIndex,
2079 std::atomic<
const std::set<ProductProvenance>*>& writeTo
2087 std::shared_ptr<std::recursive_mutex>
mutex_;
2096 entryDescriptionMap_(theMap),
2106 unsigned int transitionIndex,
2107 std::atomic<
const std::set<ProductProvenance>*>& writeTo
2109 readProvenanceAsyncImpl(
this,
2114 moduleCallingContext,
2115 rootTree_->rootDelayedReader()->preEventReadFromSourceSignal(),
2116 rootTree_->rootDelayedReader()->postEventReadFromSourceSignal());
2119 std::set<ProductProvenance>
2122 std::lock_guard<std::recursive_mutex> guard(*
mutex_);
2126 std::set<ProductProvenance> retValue;
2130 Parentage parentage(iter->second.parents());
2135 retValue.emplace(
info.branchID(), parentage.id());
2146 std::set<ProductProvenance>
readProvenance(
unsigned int)
const override;
2149 unsigned int transitionIndex,
2150 std::atomic<
const std::set<ProductProvenance>*>& writeTo
2158 std::set<ProductProvenance>
2161 return std::set<ProductProvenance>{};
2166 unsigned int transitionIndex,
2167 std::atomic<
const std::set<ProductProvenance>*>& writeTo
2169 if(
nullptr == writeTo.load()) {
2170 auto emptyProv = std::make_unique<const std::set<ProductProvenance>>();
2171 const std::set<ProductProvenance>* expected =
nullptr;
2172 if(writeTo.compare_exchange_strong(expected,emptyProv.get())) {
2173 emptyProv.release();
2178 std::unique_ptr<ProvenanceReaderBase>
2180 return std::make_unique<DummyProvenanceReader>();
2183 std::unique_ptr<ProvenanceReaderBase>
2185 return std::make_unique<OldProvenanceReader>(&rootTree, *entryDescriptionMap_, daqProvenanceHelper);
2188 std::unique_ptr<ProvenanceReaderBase>
2190 return std::make_unique<FullProvenanceReader>(&rootTree, daqProvenanceHelper);
2193 std::unique_ptr<ProvenanceReaderBase>
2195 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)
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)
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 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
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]
void initializeDuplicateChecker(std::vector< std::shared_ptr< IndexIntoFile > > const &indexesIntoFiles, std::vector< std::shared_ptr< IndexIntoFile > >::size_type currentIndexIntoFile)
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