59 #include "TTreeCache.h" 92 checkReleaseVersion(std::vector<ProcessHistory> processHistoryVector,
std::string const&
fileName) {
95 for(
auto const& ph : processHistoryVector) {
96 for(
auto const& pc : ph) {
100 <<
"a release (" << pc.releaseVersion() <<
") used in writing the input file, " << fileName <<
".\n" 101 <<
"Forward compatibility cannot be supported.\n";
116 eventTree_.setEntryNumber(entry);
120 eventTree_.setEntryNumber(saveEntry);
121 return eventAux.
event();
132 std::shared_ptr<InputFile> filePtr,
133 std::shared_ptr<EventSkipperByID> eventSkipperByID,
137 unsigned int nStreams,
138 unsigned int treeCacheSize,
139 int treeMaxVirtualSize,
145 std::shared_ptr<BranchIDListHelper> branchIDListHelper,
146 std::shared_ptr<ThinnedAssociationsHelper> thinnedAssociationsHelper,
147 std::vector<BranchID>
const* associationsFromSecondary,
148 std::shared_ptr<DuplicateChecker> duplicateChecker,
149 bool dropDescendants,
151 std::vector<std::shared_ptr<IndexIntoFile> >
const& indexesIntoFiles,
152 std::vector<std::shared_ptr<IndexIntoFile> >::
size_type currentIndexIntoFile,
153 std::vector<ProcessHistoryID>& orderedProcessHistoryIDs,
154 bool bypassVersionCheck,
155 bool labelRawDataLikeMC,
157 bool enablePrefetching) :
159 logicalFile_(logicalFileName),
160 processConfiguration_(processConfiguration),
161 processHistoryRegistry_(&processHistoryRegistry),
163 eventSkipperByID_(eventSkipperByID),
164 fileFormatVersion_(),
167 indexIntoFile_(*indexIntoFileSharedPtr_),
168 orderedProcessHistoryIDs_(orderedProcessHistoryIDs),
170 indexIntoFileEnd_(indexIntoFileBegin_),
171 indexIntoFileIter_(indexIntoFileBegin_),
172 eventProcessHistoryIDs_(),
173 eventProcessHistoryIter_(eventProcessHistoryIDs_.
begin()),
174 savedRunAuxiliary_(),
175 skipAnyEvents_(skipAnyEvents),
176 noEventSort_(noEventSort),
177 whyNotFastClonable_(0),
178 hasNewlyDroppedBranch_(),
179 branchListIndexesUnchanged_(
false),
188 branchIDListHelper_(branchIDListHelper),
189 fileThinnedAssociationsHelper_(),
190 thinnedAssociationsHelper_(thinnedAssociationsHelper),
191 processingMode_(processingMode),
192 runHelper_(runHelper),
193 newBranchToOldBranch_(),
195 eventSelectionIDs_(),
196 branchListIndexes_(),
199 duplicateChecker_(duplicateChecker),
200 provenanceAdaptor_(),
201 provenanceReaderMaker_(),
202 eventProductProvenanceRetrievers_(),
203 parentageIDLookup_(),
204 daqProvenanceHelper_(),
205 edProductClass_(TClass::GetClass(
"edm::WrapperBase")) {
216 if(
nullptr == metaDataTree.get()) {
218 <<
" in the input file.\n";
227 fft->SetAddress(&fftPtr);
248 typedef std::map<ParameterSetID, ParameterSetBlob> PsetMap;
250 PsetMap *psetMapPtr = &psetMap;
259 if(
nullptr == psetTree.get()) {
261 <<
" in the input file.\n";
264 typedef std::pair<ParameterSetID, ParameterSetBlob> IdToBlobs;
266 IdToBlobs* pIdToBlob = &idToBlob;
270 psetTreeCache->SetEnablePrefetching(
false);
271 filePtr_->SetCacheRead(psetTreeCache.get());
272 for(Long64_t
i = 0;
i != psetTree->GetEntries(); ++
i) {
273 psetTree->GetEntry(
i);
274 psetMap.insert(idToBlob);
299 auto branchIDListsAPtr = std::make_unique<BranchIDLists>();
346 for(
auto const& psetEntry : psetMap) {
348 pset.setID(psetEntry.first);
359 inputProdDescReg, pHistMap, pHistVector, processConfigurations, psetIdConverter,
true);
367 inputProdDescReg, pHistMap, pHistVector, processConfigurations, psetIdConverter,
false);
372 <<
"Failed to find branchIDLists branch in metaData tree.\n";
380 <<
"Failed to find thinnedAssociationsHelper branch in metaData tree.\n";
384 if(!bypassVersionCheck) {
385 checkReleaseVersion(pHistVector,
file());
388 if(labelRawDataLikeMC) {
393 ProductRegistry::ProductList::iterator it = pList.lower_bound(finder);
394 if(it != pList.end() && it->first.friendlyClassName() == rawData && it->first.moduleLabel() ==
source) {
410 it = pList.lower_bound(finder);
411 assert(!(it != pList.end() && it->first.friendlyClassName() == rawData && it->first.moduleLabel() ==
source));
421 for(
auto const& history : pHistVector) {
453 for(
auto& product : pList) {
459 auto newReg = std::make_unique<ProductRegistry>();
464 for(
auto const& product : prodList) {
468 newReg->copyProduct(prod);
472 <<
"Cannot change friendly class name algorithm without more development work\n" 473 <<
"to update BranchIDLists and ThinnedAssociationsHelper. Contact the framework group.\n";
477 newReg->copyProduct(newBD);
481 dropOnInput(*newReg, productSelectorRules, dropDescendants, inputType);
484 *associationsFromSecondary);
495 for(
auto const& product : prodList) {
523 if(
nullptr == entryDescriptionTree.get()) {
525 <<
" in the input file.\n";
541 if(idBuffer != entryDescriptionBuffer.
id()) {
544 entryDescriptionMap.insert(std::make_pair(entryDescriptionBuffer.
id(),entryDescriptionBuffer));
569 if(
nullptr == parentageTree.get()) {
571 <<
" in the input file.\n";
646 std::unique_ptr<FileBlock>
821 phid_(phid), run_(run) {}
825 struct RunItemSortByRun {
826 bool operator()(RunItem
const&
a, RunItem
const&
b)
const {
827 return a.run_ < b.run_;
830 struct RunItemSortByRunPhid {
831 bool operator()(RunItem
const&
a, RunItem
const&
b)
const {
832 return a.run_ < b.run_ || (!(b.run_ < a.run_) && a.phid_ < b.phid_);
838 phid_(phid), run_(run), lumi_(lumi), firstEventEntry_(entry),
846 struct LumiItemSortByRunLumi {
847 bool operator()(LumiItem
const&
a, LumiItem
const&
b)
const {
848 return a.run_ < b.run_ || (!(b.run_ < a.run_) && a.lumi_ < b.lumi_);
851 struct LumiItemSortByRunLumiPhid {
852 bool operator()(LumiItem
const&
a, LumiItem
const&
b)
const {
853 if(a.run_ < b.run_)
return true;
854 if(b.run_ < a.run_)
return false;
855 if(a.lumi_ < b.lumi_)
return true;
856 if(b.lumi_ < a.lumi_)
return false;
857 return a.phid_ < b.phid_;
873 typedef std::list<LumiItem>
LumiList;
876 typedef std::set<LuminosityBlockID> RunLumiSet;
877 RunLumiSet runLumiSet;
879 typedef std::list<RunItem>
RunList;
882 typedef std::set<RunNumber_t> RunSet;
885 typedef std::set<RunItem, RunItemSortByRunPhid> RunItemSet;
886 RunItemSet runItemSet;
888 typedef std::map<RunNumber_t, ProcessHistoryID> PHIDMap;
902 bool newLumi =
false;
913 if(iFirst || prevPhid != reducedPHID || prevRun !=
eventAux().
run()) {
915 newRun = newLumi =
true;
916 }
else if(prevLumi !=
eventAux().luminosityBlock()) {
919 prevPhid = reducedPHID;
923 lumis.emplace_back(reducedPHID,
927 LumiItem& currentLumi = lumis.back();
929 ++currentLumi.lastEventEntry_;
934 if(runItemSet.insert(item).second) {
937 phidMap.insert(std::make_pair(
eventAux().
run(), reducedPHID));
948 typedef std::map<RunNumber_t, IndexIntoFile::EntryNumber_t> RunMap;
951 typedef std::vector<RunItem> RunVector;
961 if(runSet.insert(runAux->run()).
second) {
963 emptyRuns.emplace_back(reducedPHID, runAux->run());
966 phidMap.insert(std::make_pair(runAux->run(), reducedPHID));
973 RunItemSortByRun runItemSortByRun;
976 RunList::iterator itRuns = runs.begin(), endRuns = runs.end();
977 for(
auto const& emptyRun : emptyRuns) {
978 for(; itRuns != endRuns; ++itRuns) {
979 if(runItemSortByRun(emptyRun, *itRuns)) {
983 runs.insert(itRuns, emptyRun);
988 typedef std::vector<LumiItem> LumiVector;
989 LumiVector emptyLumis;
991 typedef std::map<LuminosityBlockID, IndexIntoFile::EntryNumber_t> RunLumiMap;
992 RunLumiMap runLumiMap;
999 if(runLumiSet.insert(lumiID).second) {
1004 PHIDMap::const_iterator iPhidMap = phidMap.find(lumiAux->run());
1005 assert(iPhidMap != phidMap.end());
1015 LumiItemSortByRunLumi lumiItemSortByRunLumi;
1018 LumiList::iterator itLumis = lumis.begin(), endLumis = lumis.end();
1019 for(
auto const& emptyLumi : emptyLumis) {
1020 for(; itLumis != endLumis; ++itLumis) {
1021 if(lumiItemSortByRunLumi(emptyLumi, *itLumis)) {
1025 lumis.insert(itLumis, emptyLumi);
1030 typedef std::map<RunItem, int, RunItemSortByRunPhid> RunCountMap;
1031 RunCountMap runCountMap;
1033 assert(phids.empty());
1035 assert(entries.empty());
1037 for(
auto&
run : runs) {
1038 RunCountMap::const_iterator countMapItem = runCountMap.find(
run);
1039 if(countMapItem == runCountMap.end()) {
1040 countMapItem = runCountMap.insert(std::make_pair(
run, rcount)).first;
1041 assert(countMapItem != runCountMap.end());
1044 std::vector<ProcessHistoryID>::const_iterator phidItem =
find_in_all(phids,
run.phid_);
1045 if(phidItem == phids.end()) {
1046 phids.push_back(
run.phid_);
1047 phidItem = phids.end() - 1;
1049 entries.emplace_back(
1050 countMapItem->second,
1053 phidItem - phids.begin(),
1061 typedef std::map<LumiItem, int, LumiItemSortByRunLumiPhid> LumiCountMap;
1062 LumiCountMap lumiCountMap;
1064 for(
auto&
lumi : lumis) {
1065 RunCountMap::const_iterator runCountMapItem = runCountMap.find(RunItem(
lumi.phid_,
lumi.run_));
1066 assert(runCountMapItem != runCountMap.end());
1067 LumiCountMap::const_iterator countMapItem = lumiCountMap.find(
lumi);
1068 if(countMapItem == lumiCountMap.end()) {
1069 countMapItem = lumiCountMap.insert(std::make_pair(
lumi, lcount)).first;
1070 assert(countMapItem != lumiCountMap.end());
1073 std::vector<ProcessHistoryID>::const_iterator phidItem =
find_in_all(phids,
lumi.phid_);
1074 assert(phidItem != phids.end());
1075 entries.emplace_back(
1076 runCountMapItem->second,
1077 countMapItem->second,
1079 phidItem - phids.begin(),
1082 lumi.firstEventEntry_,
1083 lumi.lastEventEntry_);
1095 "'Events' tree is corrupted or not present\n" <<
"in the input file.\n";
1105 for(
auto& phid : phidVec) {
1122 bool needEventNumbers =
false;
1124 if(inputType !=
InputType::Primary || needIndexesForDuplicateChecker || usingGoToEvent) {
1125 needEventNumbers =
true;
1127 bool needEventEntries =
false;
1130 needEventEntries =
true;
1154 treePointer->close();
1155 treePointer =
nullptr;
1210 if(!eventHistoryBranch) {
1212 <<
"Failed to find history branch in event history tree.\n";
1214 eventHistoryBranch->SetAddress(&pHistory);
1223 assert(eventSelectionIDBranch !=
nullptr);
1227 assert(branchListIndexesBranch !=
nullptr);
1248 std::shared_ptr<LuminosityBlockAuxiliary>
1250 auto lumiAuxiliary = std::make_shared<LuminosityBlockAuxiliary>();
1261 lumiAuxiliary->setProcessHistoryID(
provenanceAdaptor_->convertID(lumiAuxiliary->processHistoryID()));
1264 lumiAuxiliary->setProcessHistoryID(
daqProvenanceHelper_->mapProcessHistoryID(lumiAuxiliary->processHistoryID()));
1269 return lumiAuxiliary;
1272 std::shared_ptr<RunAuxiliary>
1274 auto runAuxiliary = std::make_shared<RunAuxiliary>();
1280 RunAux *pRunAux = &runAux;
1285 runAuxiliary->setProcessHistoryID(
provenanceAdaptor_->convertID(runAuxiliary->processHistoryID()));
1288 runAuxiliary->setProcessHistoryID(
daqProvenanceHelper_->mapProcessHistoryID(runAuxiliary->processHistoryID()));
1290 return runAuxiliary;
1451 std::shared_ptr<RunAuxiliary>
1479 runHelper_->overrideRunNumber(runAuxiliary->id());
1480 filePtr_->reportInputRunNumber(runAuxiliary->run());
1509 runAuxiliary->setProcessHistoryID(
eventAux().processHistoryID());
1514 return runAuxiliary;
1537 std::shared_ptr<LuminosityBlockAuxiliary>
1557 runHelper_->overrideRunNumber(lumiAuxiliary->id());
1558 filePtr_->reportInputLumiSection(lumiAuxiliary->run(), lumiAuxiliary->luminosityBlock());
1572 return lumiAuxiliary;
1635 history_ = std::make_unique<History>();
1637 if(!eventHistoryTree_) {
1639 <<
"Failed to find the event history tree.\n";
1646 std::vector<std::shared_ptr<IndexIntoFile> >
const& indexesIntoFiles,
1647 std::vector<std::shared_ptr<IndexIntoFile> >::
size_type currentIndexIntoFile) {
1654 currentIndexIntoFile);
1662 std::map<BranchID, BranchID>
const& droppedToKeptAlias)
const {
1663 if(dropDescendants) {
1664 branchChildren_->appendToDescendants(branch, branchesToDrop, droppedToKeptAlias);
1666 branchesToDrop.insert(branch.
branchID());
1677 std::vector<BranchDescription const*> associationDescriptions;
1681 std::set<BranchID> branchesToDrop;
1682 std::map<BranchID, BranchID> droppedToKeptAlias;
1683 for(
auto const& product : prodList) {
1689 for(
auto const& product : prodList) {
1694 associationDescriptions.push_back(&prod);
1698 }
else if(!productSelector.
selected(prod)) {
1712 std::set<BranchID> keptProductsInEvent;
1713 for(
auto const& product : prodList) {
1715 if( branchesToDrop.find(prod.
branchID()) == branchesToDrop.end() &&
1718 keptProductsInEvent.insert(prod.
branchID());
1723 std::map<BranchID, bool> keepAssociation;
1725 keptProductsInEvent,
1735 auto temp = std::make_unique<ThinnedAssociationsHelper>();
1737 auto iter = keepAssociation.find(associationBranches.association());
1738 if(iter != keepAssociation.end() && iter->second) {
1739 temp->addAssociation(associationBranches);
1747 std::set<BranchID>::const_iterator branchesToDropEnd = branchesToDrop.end();
1748 for(ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) {
1750 bool drop = branchesToDrop.find(prod.
branchID()) != branchesToDropEnd;
1755 <<
"Branch '" << prod.
branchName() <<
"' is being dropped from the input\n" 1756 <<
"of file '" <<
file_ <<
"' because it is dependent on a branch\n" 1757 <<
"that was explicitly dropped.\n";
1762 ProductRegistry::ProductList::iterator icopy = it;
1764 prodList.erase(icopy);
1773 for(ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) {
1777 void*
p = cp->New();
1780 if(edp->isMergeable()) {
1782 ProductRegistry::ProductList::iterator icopy = it;
1784 prodList.erase(icopy);
1801 std::unique_ptr<MakeProvenanceReader>
1808 return std::make_unique<MakeFullProvenanceReader>();
1810 auto entryDescriptionMap = std::make_unique<EntryDescriptionMap>();
1812 return std::make_unique<MakeOldProvenanceReader>(
std::move(entryDescriptionMap));
1814 return std::make_unique<MakeDummyProvenanceReader>();
1818 std::shared_ptr<ProductProvenanceRetriever>
1835 std::set<ProductProvenance> readProvenance(
unsigned int)
const override;
1839 unsigned int transitionIndex,
1840 std::atomic<
const std::set<ProductProvenance>*>& writeTo
1849 std::shared_ptr<std::recursive_mutex>
mutex_;
1855 std::vector<ParentageID>
const& iParentageIDLookup,
1858 rootTree_(iRootTree),
1859 pProvVector_(&provVector_),
1870 template<
typename R>
1871 void readProvenanceAsyncImpl(
R const* iThis,
1874 unsigned int transitionIndex,
1875 std::atomic<
const std::set<ProductProvenance>*>& writeTo,
1877 SignalType
const* pre,
1878 SignalType
const* post) {
1879 if(
nullptr == writeTo.load()) {
1882 auto pWriteTo = &writeTo;
1886 chain.
push([holder =
std::move(taskHolder), pWriteTo,iThis,transitionIndex, iContext, pre,post, serviceToken]()
mutable {
1888 if(
nullptr == pWriteTo->load()) {
1890 std::unique_ptr<const std::set<ProductProvenance>> prov;
1893 prov = std::make_unique<const std::set<ProductProvenance>>(iThis->readProvenance(transitionIndex));
1899 holder.doneWaiting(std::current_exception());
1902 const std::set<ProductProvenance>* expected =
nullptr;
1904 if(pWriteTo->compare_exchange_strong(expected,prov.get())) {
1908 holder.doneWaiting(std::exception_ptr());
1917 unsigned int transitionIndex,
1918 std::atomic<
const std::set<ProductProvenance>*>& writeTo
1920 readProvenanceAsyncImpl(
this,
1925 moduleCallingContext,
1926 rootTree_->rootDelayedReader()->preEventReadFromSourceSignal(),
1927 rootTree_->rootDelayedReader()->postEventReadFromSourceSignal());
1930 std::set<ProductProvenance>
1933 std::lock_guard<std::recursive_mutex> guard(*
mutex_);
1937 std::set<ProductProvenance> retValue;
1948 <<
"ReducedProvenanceReader::ReadProvenance\n" 1949 <<
"The parentage ID index value " << prov.parentageIDIndex_ <<
" is out of bounds. The maximum value is " <<
parentageIDLookup_.size()-1 <<
".\n" 1950 <<
"This should never happen.\n" 1951 <<
"Please report this to the framework hypernews forum 'hn-cms-edmFramework@cern.ch'.\n";
1963 std::set<ProductProvenance>
readProvenance(
unsigned int transitionIndex)
const override;
1967 unsigned int transitionIndex,
1968 std::atomic<
const std::set<ProductProvenance>*>& writeTo
1975 std::shared_ptr<std::recursive_mutex>
mutex_;
1983 pInfoVector_(&infoVector_),
1993 unsigned int transitionIndex,
1994 std::atomic<
const std::set<ProductProvenance>*>& writeTo
1996 readProvenanceAsyncImpl(
this,
2001 moduleCallingContext,
2006 std::set<ProductProvenance>
2009 std::lock_guard<std::recursive_mutex> guard(*
mutex_);
2012 std::set<ProductProvenance> retValue;
2020 retValue.emplace(
info);
2030 std::set<ProductProvenance>
readProvenance(
unsigned int transitionIndex)
const override;
2034 unsigned int transitionIndex,
2035 std::atomic<
const std::set<ProductProvenance>*>& writeTo
2043 std::shared_ptr<std::recursive_mutex>
mutex_;
2052 entryDescriptionMap_(theMap),
2062 unsigned int transitionIndex,
2063 std::atomic<
const std::set<ProductProvenance>*>& writeTo
2065 readProvenanceAsyncImpl(
this,
2070 moduleCallingContext,
2071 rootTree_->rootDelayedReader()->preEventReadFromSourceSignal(),
2072 rootTree_->rootDelayedReader()->postEventReadFromSourceSignal());
2075 std::set<ProductProvenance>
2078 std::lock_guard<std::recursive_mutex> guard(*
mutex_);
2082 std::set<ProductProvenance> retValue;
2086 Parentage parentage(iter->second.parents());
2091 retValue.emplace(
info.branchID(), parentage.id());
2102 std::set<ProductProvenance>
readProvenance(
unsigned int)
const override;
2105 unsigned int transitionIndex,
2106 std::atomic<
const std::set<ProductProvenance>*>& writeTo
2114 std::set<ProductProvenance>
2117 return std::set<ProductProvenance>{};
2122 unsigned int transitionIndex,
2123 std::atomic<
const std::set<ProductProvenance>*>& writeTo
2125 if(
nullptr == writeTo.load()) {
2126 auto emptyProv = std::make_unique<const std::set<ProductProvenance>>();
2127 const std::set<ProductProvenance>* expected =
nullptr;
2128 if(writeTo.compare_exchange_strong(expected,emptyProv.get())) {
2129 emptyProv.release();
2134 std::unique_ptr<ProvenanceReaderBase>
2136 return std::make_unique<DummyProvenanceReader>();
2139 std::unique_ptr<ProvenanceReaderBase>
2141 return std::make_unique<OldProvenanceReader>(&rootTree, *entryDescriptionMap_, daqProvenanceHelper);
2144 std::unique_ptr<ProvenanceReaderBase>
2146 return std::make_unique<FullProvenanceReader>(&rootTree, daqProvenanceHelper);
2149 std::unique_ptr<ProvenanceReaderBase>
2151 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
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()
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 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_
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
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()
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)