60 #include "TTreeCache.h" 93 checkReleaseVersion(std::vector<ProcessHistory> processHistoryVector,
std::string const&
fileName) {
96 for(
auto const& ph : processHistoryVector) {
97 for(
auto const& pc : ph) {
101 <<
"a release (" << pc.releaseVersion() <<
") used in writing the input file, " << fileName <<
".\n" 102 <<
"Forward compatibility cannot be supported.\n";
117 eventTree_.setEntryNumber(entry);
121 eventTree_.setEntryNumber(saveEntry);
122 return eventAux.
event();
133 std::shared_ptr<InputFile> filePtr,
134 std::shared_ptr<EventSkipperByID> eventSkipperByID,
138 unsigned int nStreams,
139 unsigned int treeCacheSize,
140 int treeMaxVirtualSize,
146 std::shared_ptr<BranchIDListHelper> branchIDListHelper,
147 std::shared_ptr<ThinnedAssociationsHelper> thinnedAssociationsHelper,
148 std::vector<BranchID>
const* associationsFromSecondary,
149 std::shared_ptr<DuplicateChecker> duplicateChecker,
150 bool dropDescendants,
152 std::vector<std::shared_ptr<IndexIntoFile> >
const& indexesIntoFiles,
153 std::vector<std::shared_ptr<IndexIntoFile> >::
size_type currentIndexIntoFile,
154 std::vector<ProcessHistoryID>& orderedProcessHistoryIDs,
155 bool bypassVersionCheck,
156 bool labelRawDataLikeMC,
158 bool enablePrefetching) :
160 logicalFile_(logicalFileName),
161 processConfiguration_(processConfiguration),
162 processHistoryRegistry_(&processHistoryRegistry),
164 eventSkipperByID_(eventSkipperByID),
165 fileFormatVersion_(),
168 indexIntoFile_(*indexIntoFileSharedPtr_),
169 orderedProcessHistoryIDs_(orderedProcessHistoryIDs),
171 indexIntoFileEnd_(indexIntoFileBegin_),
172 indexIntoFileIter_(indexIntoFileBegin_),
173 eventProcessHistoryIDs_(),
174 eventProcessHistoryIter_(eventProcessHistoryIDs_.
begin()),
175 savedRunAuxiliary_(),
176 skipAnyEvents_(skipAnyEvents),
177 noEventSort_(noEventSort),
178 whyNotFastClonable_(0),
179 hasNewlyDroppedBranch_(),
180 branchListIndexesUnchanged_(
false),
189 branchIDListHelper_(branchIDListHelper),
190 fileThinnedAssociationsHelper_(),
191 thinnedAssociationsHelper_(thinnedAssociationsHelper),
192 processingMode_(processingMode),
193 runHelper_(runHelper),
194 newBranchToOldBranch_(),
196 eventSelectionIDs_(),
197 branchListIndexes_(),
200 duplicateChecker_(duplicateChecker),
201 provenanceAdaptor_(),
202 provenanceReaderMaker_(),
203 eventProductProvenanceRetrievers_(),
204 parentageIDLookup_(),
205 daqProvenanceHelper_(),
206 edProductClass_(TClass::GetClass(
"edm::WrapperBase")) {
217 if(
nullptr == metaDataTree.get()) {
219 <<
" in the input file.\n";
228 fft->SetAddress(&fftPtr);
249 typedef std::map<ParameterSetID, ParameterSetBlob> PsetMap;
251 PsetMap *psetMapPtr = &psetMap;
260 if(
nullptr == psetTree.get()) {
262 <<
" in the input file.\n";
265 typedef std::pair<ParameterSetID, ParameterSetBlob> IdToBlobs;
267 IdToBlobs* pIdToBlob = &idToBlob;
271 psetTreeCache->SetEnablePrefetching(
false);
272 filePtr_->SetCacheRead(psetTreeCache.get());
273 for(Long64_t
i = 0;
i != psetTree->GetEntries(); ++
i) {
274 psetTree->GetEntry(
i);
275 psetMap.insert(idToBlob);
300 auto branchIDListsAPtr = std::make_unique<BranchIDLists>();
347 for(
auto const& psetEntry : psetMap) {
349 pset.setID(psetEntry.first);
360 inputProdDescReg, pHistMap, pHistVector, processConfigurations, psetIdConverter,
true);
368 inputProdDescReg, pHistMap, pHistVector, processConfigurations, psetIdConverter,
false);
373 <<
"Failed to find branchIDLists branch in metaData tree.\n";
381 <<
"Failed to find thinnedAssociationsHelper branch in metaData tree.\n";
385 if(!bypassVersionCheck) {
386 checkReleaseVersion(pHistVector,
file());
389 if(labelRawDataLikeMC) {
394 ProductRegistry::ProductList::iterator it = pList.lower_bound(finder);
395 if(it != pList.end() && it->first.friendlyClassName() == rawData && it->first.moduleLabel() ==
source) {
411 it = pList.lower_bound(finder);
412 assert(!(it != pList.end() && it->first.friendlyClassName() == rawData && it->first.moduleLabel() ==
source));
422 for(
auto const& history : pHistVector) {
454 for(
auto& product : pList) {
460 auto newReg = std::make_unique<ProductRegistry>();
465 for(
auto const& product : prodList) {
469 newReg->copyProduct(prod);
473 <<
"Cannot change friendly class name algorithm without more development work\n" 474 <<
"to update BranchIDLists and ThinnedAssociationsHelper. Contact the framework group.\n";
478 newReg->copyProduct(newBD);
482 dropOnInput(*newReg, productSelectorRules, dropDescendants, inputType);
485 *associationsFromSecondary);
496 for(
auto const& product : prodList) {
526 if(
nullptr == entryDescriptionTree.get()) {
528 <<
" in the input file.\n";
544 if(idBuffer != entryDescriptionBuffer.
id()) {
547 entryDescriptionMap.insert(std::make_pair(entryDescriptionBuffer.
id(),entryDescriptionBuffer));
572 if(
nullptr == parentageTree.get()) {
574 <<
" in the input file.\n";
649 std::unique_ptr<FileBlock>
824 phid_(phid), run_(run) {}
828 struct RunItemSortByRun {
829 bool operator()(RunItem
const&
a, RunItem
const&
b)
const {
830 return a.run_ < b.run_;
833 struct RunItemSortByRunPhid {
834 bool operator()(RunItem
const&
a, RunItem
const&
b)
const {
835 return a.run_ < b.run_ || (!(b.run_ < a.run_) && a.phid_ < b.phid_);
841 phid_(phid), run_(run), lumi_(lumi), firstEventEntry_(entry),
849 struct LumiItemSortByRunLumi {
850 bool operator()(LumiItem
const&
a, LumiItem
const&
b)
const {
851 return a.run_ < b.run_ || (!(b.run_ < a.run_) && a.lumi_ < b.lumi_);
854 struct LumiItemSortByRunLumiPhid {
855 bool operator()(LumiItem
const&
a, LumiItem
const&
b)
const {
856 if(a.run_ < b.run_)
return true;
857 if(b.run_ < a.run_)
return false;
858 if(a.lumi_ < b.lumi_)
return true;
859 if(b.lumi_ < a.lumi_)
return false;
860 return a.phid_ < b.phid_;
876 typedef std::list<LumiItem>
LumiList;
879 typedef std::set<LuminosityBlockID> RunLumiSet;
880 RunLumiSet runLumiSet;
882 typedef std::list<RunItem>
RunList;
885 typedef std::set<RunNumber_t> RunSet;
888 typedef std::set<RunItem, RunItemSortByRunPhid> RunItemSet;
889 RunItemSet runItemSet;
891 typedef std::map<RunNumber_t, ProcessHistoryID> PHIDMap;
905 bool newLumi =
false;
916 if(iFirst || prevPhid != reducedPHID || prevRun !=
eventAux().
run()) {
918 newRun = newLumi =
true;
919 }
else if(prevLumi !=
eventAux().luminosityBlock()) {
922 prevPhid = reducedPHID;
926 lumis.emplace_back(reducedPHID,
930 LumiItem& currentLumi = lumis.back();
932 ++currentLumi.lastEventEntry_;
937 if(runItemSet.insert(item).second) {
940 phidMap.insert(std::make_pair(
eventAux().
run(), reducedPHID));
951 typedef std::map<RunNumber_t, IndexIntoFile::EntryNumber_t> RunMap;
954 typedef std::vector<RunItem> RunVector;
964 if(runSet.insert(runAux->run()).
second) {
966 emptyRuns.emplace_back(reducedPHID, runAux->run());
969 phidMap.insert(std::make_pair(runAux->run(), reducedPHID));
976 RunItemSortByRun runItemSortByRun;
979 RunList::iterator itRuns = runs.begin(), endRuns = runs.end();
980 for(
auto const& emptyRun : emptyRuns) {
981 for(; itRuns != endRuns; ++itRuns) {
982 if(runItemSortByRun(emptyRun, *itRuns)) {
986 runs.insert(itRuns, emptyRun);
991 typedef std::vector<LumiItem> LumiVector;
992 LumiVector emptyLumis;
994 typedef std::map<LuminosityBlockID, IndexIntoFile::EntryNumber_t> RunLumiMap;
995 RunLumiMap runLumiMap;
1002 if(runLumiSet.insert(lumiID).second) {
1007 PHIDMap::const_iterator iPhidMap = phidMap.find(lumiAux->run());
1008 assert(iPhidMap != phidMap.end());
1018 LumiItemSortByRunLumi lumiItemSortByRunLumi;
1021 LumiList::iterator itLumis = lumis.begin(), endLumis = lumis.end();
1022 for(
auto const& emptyLumi : emptyLumis) {
1023 for(; itLumis != endLumis; ++itLumis) {
1024 if(lumiItemSortByRunLumi(emptyLumi, *itLumis)) {
1028 lumis.insert(itLumis, emptyLumi);
1033 typedef std::map<RunItem, int, RunItemSortByRunPhid> RunCountMap;
1034 RunCountMap runCountMap;
1036 assert(phids.empty());
1038 assert(entries.empty());
1040 for(
auto&
run : runs) {
1041 RunCountMap::const_iterator countMapItem = runCountMap.find(
run);
1042 if(countMapItem == runCountMap.end()) {
1043 countMapItem = runCountMap.insert(std::make_pair(
run, rcount)).first;
1044 assert(countMapItem != runCountMap.end());
1047 std::vector<ProcessHistoryID>::const_iterator phidItem =
find_in_all(phids,
run.phid_);
1048 if(phidItem == phids.end()) {
1049 phids.push_back(
run.phid_);
1050 phidItem = phids.end() - 1;
1052 entries.emplace_back(
1053 countMapItem->second,
1056 phidItem - phids.begin(),
1064 typedef std::map<LumiItem, int, LumiItemSortByRunLumiPhid> LumiCountMap;
1065 LumiCountMap lumiCountMap;
1067 for(
auto&
lumi : lumis) {
1068 RunCountMap::const_iterator runCountMapItem = runCountMap.find(RunItem(
lumi.phid_,
lumi.run_));
1069 assert(runCountMapItem != runCountMap.end());
1070 LumiCountMap::const_iterator countMapItem = lumiCountMap.find(
lumi);
1071 if(countMapItem == lumiCountMap.end()) {
1072 countMapItem = lumiCountMap.insert(std::make_pair(
lumi, lcount)).first;
1073 assert(countMapItem != lumiCountMap.end());
1076 std::vector<ProcessHistoryID>::const_iterator phidItem =
find_in_all(phids,
lumi.phid_);
1077 assert(phidItem != phids.end());
1078 entries.emplace_back(
1079 runCountMapItem->second,
1080 countMapItem->second,
1082 phidItem - phids.begin(),
1085 lumi.firstEventEntry_,
1086 lumi.lastEventEntry_);
1098 "'Events' tree is corrupted or not present\n" <<
"in the input file.\n";
1108 for(
auto& phid : phidVec) {
1125 bool needEventNumbers =
false;
1127 if(inputType !=
InputType::Primary || needIndexesForDuplicateChecker || usingGoToEvent) {
1128 needEventNumbers =
true;
1130 bool needEventEntries =
false;
1133 needEventEntries =
true;
1157 treePointer->close();
1158 treePointer =
nullptr;
1213 if(!eventHistoryBranch) {
1215 <<
"Failed to find history branch in event history tree.\n";
1217 eventHistoryBranch->SetAddress(&pHistory);
1226 assert(eventSelectionIDBranch !=
nullptr);
1230 assert(branchListIndexesBranch !=
nullptr);
1251 std::shared_ptr<LuminosityBlockAuxiliary>
1253 auto lumiAuxiliary = std::make_shared<LuminosityBlockAuxiliary>();
1264 lumiAuxiliary->setProcessHistoryID(
provenanceAdaptor_->convertID(lumiAuxiliary->processHistoryID()));
1267 lumiAuxiliary->setProcessHistoryID(
daqProvenanceHelper_->mapProcessHistoryID(lumiAuxiliary->processHistoryID()));
1272 return lumiAuxiliary;
1275 std::shared_ptr<RunAuxiliary>
1277 auto runAuxiliary = std::make_shared<RunAuxiliary>();
1283 RunAux *pRunAux = &runAux;
1288 runAuxiliary->setProcessHistoryID(
provenanceAdaptor_->convertID(runAuxiliary->processHistoryID()));
1291 runAuxiliary->setProcessHistoryID(
daqProvenanceHelper_->mapProcessHistoryID(runAuxiliary->processHistoryID()));
1293 return runAuxiliary;
1454 std::shared_ptr<RunAuxiliary>
1482 runHelper_->overrideRunNumber(runAuxiliary->id());
1483 filePtr_->reportInputRunNumber(runAuxiliary->run());
1512 runAuxiliary->setProcessHistoryID(
eventAux().processHistoryID());
1517 return runAuxiliary;
1539 std::shared_ptr<LuminosityBlockAuxiliary>
1559 runHelper_->overrideRunNumber(lumiAuxiliary->id());
1560 filePtr_->reportInputLumiSection(lumiAuxiliary->run(), lumiAuxiliary->luminosityBlock());
1574 return lumiAuxiliary;
1636 history_ = std::make_unique<History>();
1638 if(!eventHistoryTree_) {
1640 <<
"Failed to find the event history tree.\n";
1647 std::vector<std::shared_ptr<IndexIntoFile> >
const& indexesIntoFiles,
1648 std::vector<std::shared_ptr<IndexIntoFile> >::
size_type currentIndexIntoFile) {
1655 currentIndexIntoFile);
1663 std::map<BranchID, BranchID>
const& droppedToKeptAlias)
const {
1664 if(dropDescendants) {
1665 branchChildren_->appendToDescendants(branch, branchesToDrop, droppedToKeptAlias);
1667 branchesToDrop.insert(branch.
branchID());
1678 std::vector<BranchDescription const*> associationDescriptions;
1682 std::set<BranchID> branchesToDrop;
1683 std::map<BranchID, BranchID> droppedToKeptAlias;
1684 for(
auto const& product : prodList) {
1690 for(
auto const& product : prodList) {
1695 associationDescriptions.push_back(&prod);
1699 }
else if(!productSelector.
selected(prod)) {
1713 std::set<BranchID> keptProductsInEvent;
1714 for(
auto const& product : prodList) {
1716 if( branchesToDrop.find(prod.
branchID()) == branchesToDrop.end() &&
1719 keptProductsInEvent.insert(prod.
branchID());
1724 std::map<BranchID, bool> keepAssociation;
1726 keptProductsInEvent,
1736 auto temp = std::make_unique<ThinnedAssociationsHelper>();
1738 auto iter = keepAssociation.find(associationBranches.association());
1739 if(iter != keepAssociation.end() && iter->second) {
1740 temp->addAssociation(associationBranches);
1748 std::set<BranchID>::const_iterator branchesToDropEnd = branchesToDrop.end();
1749 for(ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) {
1751 bool drop = branchesToDrop.find(prod.
branchID()) != branchesToDropEnd;
1756 <<
"Branch '" << prod.
branchName() <<
"' is being dropped from the input\n" 1757 <<
"of file '" <<
file_ <<
"' because it is dependent on a branch\n" 1758 <<
"that was explicitly dropped.\n";
1763 ProductRegistry::ProductList::iterator icopy = it;
1765 prodList.erase(icopy);
1774 for(ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) {
1778 void*
p = cp->New();
1781 if(edp->isMergeable()) {
1783 ProductRegistry::ProductList::iterator icopy = it;
1785 prodList.erase(icopy);
1802 std::unique_ptr<MakeProvenanceReader>
1809 return std::make_unique<MakeFullProvenanceReader>();
1811 auto entryDescriptionMap = std::make_unique<EntryDescriptionMap>();
1813 return std::make_unique<MakeOldProvenanceReader>(
std::move(entryDescriptionMap));
1815 return std::make_unique<MakeDummyProvenanceReader>();
1819 std::shared_ptr<ProductProvenanceRetriever>
1836 std::set<ProductProvenance> readProvenance(
unsigned int)
const override;
1840 unsigned int transitionIndex,
1841 std::atomic<
const std::set<ProductProvenance>*>& writeTo
1850 std::shared_ptr<std::recursive_mutex>
mutex_;
1856 std::vector<ParentageID>
const& iParentageIDLookup,
1859 rootTree_(iRootTree),
1860 pProvVector_(&provVector_),
1871 template<
typename R>
1872 void readProvenanceAsyncImpl(
R const* iThis,
1875 unsigned int transitionIndex,
1876 std::atomic<
const std::set<ProductProvenance>*>& writeTo,
1878 SignalType
const* pre,
1879 SignalType
const* post) {
1880 if(
nullptr == writeTo.load()) {
1882 task->increment_ref_count();
1883 auto pWriteTo = &writeTo;
1887 chain.
push([task,pWriteTo,iThis,transitionIndex, iContext, pre,post, serviceToken]() {
1891 task->decrement_ref_count();
1895 if(
nullptr == pWriteTo->load()) {
1896 std::unique_ptr<const std::set<ProductProvenance>> prov;
1899 prov = std::make_unique<const std::set<ProductProvenance>>(iThis->readProvenance(transitionIndex));
1908 const std::set<ProductProvenance>* expected =
nullptr;
1910 if(pWriteTo->compare_exchange_strong(expected,prov.get())) {
1923 unsigned int transitionIndex,
1924 std::atomic<
const std::set<ProductProvenance>*>& writeTo
1926 readProvenanceAsyncImpl(
this,
1931 moduleCallingContext,
1932 rootTree_->rootDelayedReader()->preEventReadFromSourceSignal(),
1933 rootTree_->rootDelayedReader()->postEventReadFromSourceSignal());
1936 std::set<ProductProvenance>
1939 std::lock_guard<std::recursive_mutex> guard(*
mutex_);
1944 std::set<ProductProvenance> retValue;
1955 <<
"ReducedProvenanceReader::ReadProvenance\n" 1956 <<
"The parentage ID index value " << prov.parentageIDIndex_ <<
" is out of bounds. The maximum value is " <<
parentageIDLookup_.size()-1 <<
".\n" 1957 <<
"This should never happen.\n" 1958 <<
"Please report this to the framework hypernews forum 'hn-cms-edmFramework@cern.ch'.\n";
1970 std::set<ProductProvenance>
readProvenance(
unsigned int transitionIndex)
const override;
1974 unsigned int transitionIndex,
1975 std::atomic<
const std::set<ProductProvenance>*>& writeTo
1982 std::shared_ptr<std::recursive_mutex>
mutex_;
1990 pInfoVector_(&infoVector_),
2000 unsigned int transitionIndex,
2001 std::atomic<
const std::set<ProductProvenance>*>& writeTo
2003 readProvenanceAsyncImpl(
this,
2008 moduleCallingContext,
2013 std::set<ProductProvenance>
2016 std::lock_guard<std::recursive_mutex> guard(*
mutex_);
2020 std::set<ProductProvenance> retValue;
2028 retValue.emplace(
info);
2038 std::set<ProductProvenance>
readProvenance(
unsigned int transitionIndex)
const override;
2042 unsigned int transitionIndex,
2043 std::atomic<
const std::set<ProductProvenance>*>& writeTo
2051 std::shared_ptr<std::recursive_mutex>
mutex_;
2060 entryDescriptionMap_(theMap),
2070 unsigned int transitionIndex,
2071 std::atomic<
const std::set<ProductProvenance>*>& writeTo
2073 readProvenanceAsyncImpl(
this,
2078 moduleCallingContext,
2079 rootTree_->rootDelayedReader()->preEventReadFromSourceSignal(),
2080 rootTree_->rootDelayedReader()->postEventReadFromSourceSignal());
2083 std::set<ProductProvenance>
2086 std::lock_guard<std::recursive_mutex> guard(*
mutex_);
2091 std::set<ProductProvenance> retValue;
2095 Parentage parentage(iter->second.parents());
2100 retValue.emplace(
info.branchID(), parentage.id());
2111 std::set<ProductProvenance>
readProvenance(
unsigned int)
const override;
2114 unsigned int transitionIndex,
2115 std::atomic<
const std::set<ProductProvenance>*>& writeTo
2123 std::set<ProductProvenance>
2126 return std::set<ProductProvenance>{};
2131 unsigned int transitionIndex,
2132 std::atomic<
const std::set<ProductProvenance>*>& writeTo
2134 if(
nullptr == writeTo.load()) {
2135 auto emptyProv = std::make_unique<const std::set<ProductProvenance>>();
2136 const std::set<ProductProvenance>* expected =
nullptr;
2137 if(writeTo.compare_exchange_strong(expected,emptyProv.get())) {
2138 emptyProv.release();
2143 std::unique_ptr<ProvenanceReaderBase>
2145 return std::make_unique<DummyProvenanceReader>();
2148 std::unique_ptr<ProvenanceReaderBase>
2150 return std::make_unique<OldProvenanceReader>(&rootTree, *entryDescriptionMap_, daqProvenanceHelper);
2153 std::unique_ptr<ProvenanceReaderBase>
2155 return std::make_unique<FullProvenanceReader>(&rootTree, daqProvenanceHelper);
2158 std::unique_ptr<ProvenanceReaderBase>
2160 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 int const 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_
void push(const T &iAction)
asynchronously pushes functor iAction into queue
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)
void setRefCoreStreamer(bool resetAll=false)
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_
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
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)
void readAllFromSourceAndMergeImmediately()
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()
void doneWaiting(std::exception_ptr iExcept)
std::vector< ProcessHistoryID > & setProcessHistoryIDs()
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 RunNumber_t const 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_
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 EntryNumber_t const 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
void fillBranchEntry(TBranch *branch, T *&pbuf)
static LuminosityBlockNumber_t const 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()
std::string const & wrappedName() const
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()
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)