1 #ifndef IOPool_Input_RootFile_h 2 #define IOPool_Input_RootFile_h 48 class BranchIDListHelper;
49 class ProductProvenanceRetriever;
50 struct DaqProvenanceHelper;
51 class DuplicateChecker;
52 class EventSkipperByID;
53 class ProcessHistoryRegistry;
54 class ProductSelectorRules;
56 class ProvenanceReaderBase;
57 class ProvenanceAdaptor;
58 class StoredMergeableRunProductMetadata;
60 class ThinnedAssociationsHelper;
77 std::shared_ptr<InputFile> filePtr,
78 std::shared_ptr<EventSkipperByID> eventSkipperByID,
82 unsigned int nStreams,
83 unsigned int treeCacheSize,
84 int treeMaxVirtualSize,
93 std::shared_ptr<ThinnedAssociationsHelper> thinnedAssociationsHelper,
94 std::vector<BranchID>
const* associationsFromSecondary,
95 std::shared_ptr<DuplicateChecker> duplicateChecker,
96 bool dropDescendantsOfDroppedProducts,
98 std::vector<std::shared_ptr<IndexIntoFile>>
const& indexesIntoFiles,
100 std::vector<ProcessHistoryID>& orderedProcessHistoryIDs,
101 bool bypassVersionCheck,
102 bool labelRawDataLikeMC,
104 bool enablePrefetching,
105 bool enforceGUIDInFileName);
111 std::shared_ptr<InputFile> filePtr,
112 unsigned int nStreams,
113 int treeMaxVirtualSize,
119 std::shared_ptr<ThinnedAssociationsHelper> thinnedAssociationsHelper,
120 std::vector<BranchID>
const* associationsFromSecondary,
121 bool dropDescendantsOfDroppedProducts,
123 std::vector<std::shared_ptr<IndexIntoFile>>
const& indexesIntoFiles,
125 std::vector<ProcessHistoryID>& orderedProcessHistoryIDs,
126 bool bypassVersionCheck,
127 bool labelRawDataLikeMC,
128 bool enablePrefetching,
129 bool enforceGUIDInFileName)
131 processConfiguration,
145 productSelectorRules,
149 thinnedAssociationsHelper,
150 associationsFromSecondary,
152 dropDescendantsOfDroppedProducts,
153 processHistoryRegistry,
155 currentIndexIntoFile,
156 orderedProcessHistoryIDs,
161 enforceGUIDInFileName) {}
167 std::shared_ptr<InputFile> filePtr,
168 unsigned int nStreams,
169 unsigned int treeCacheSize,
170 int treeMaxVirtualSize,
175 std::vector<std::shared_ptr<IndexIntoFile>>
const& indexesIntoFiles,
177 std::vector<ProcessHistoryID>& orderedProcessHistoryIDs,
178 bool bypassVersionCheck,
179 bool enablePrefetching,
180 bool enforceGUIDInFileName)
182 processConfiguration,
196 productSelectorRules,
204 processHistoryRegistry,
206 currentIndexIntoFile,
207 orderedProcessHistoryIDs,
212 enforceGUIDInFileName) {}
270 processBlockTree->rewindToInvalid();
300 int treeMaxVirtualSize,
301 bool enablePrefetching,
314 bool assertOnFailure =
true);
321 std::set<BranchID>& branchesToDrop,
322 std::map<BranchID, BranchID>
const& droppedToKeptAlias)
const;
325 bool dropDescendants,
330 std::set<std::string>
const& processesWithKeptProcessBlockProducts,
bool setEntryAtItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > fileThinnedAssociationsHelper_
EventToProcessBlockIndexes eventToProcessBlockIndexes_
std::shared_ptr< BranchIDLists const > branchIDLists_
bool skipEvents(int &offset)
std::shared_ptr< IndexIntoFile const > indexIntoFileSharedPtr() const
edm::propagate_const< std::shared_ptr< DuplicateChecker > > duplicateChecker_
std::shared_ptr< LuminosityBlockAuxiliary > fillLumiAuxiliary()
bool wasLastEventJustRead() const
RootFile & operator=(RootFile const &)=delete
void readEntryDescriptionTree(EntryDescriptionMap &entryDescriptionMap, InputType inputType)
virtual ~MakeProvenanceReader()=default
EventAuxiliary fillEventAuxiliary(IndexIntoFile::EntryNumber_t entry)
bool setEntryAtNextEventInLumi(RunNumber_t run, LuminosityBlockNumber_t lumi)
bool enforceGUIDInFileName_
std::shared_ptr< RunAuxiliary const > savedRunAuxiliary() const
FileFormatVersion fileFormatVersion() const
edm::propagate_const< std::shared_ptr< EventSkipperByID > > eventSkipperByID_
edm::propagate_const< std::shared_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch() const
std::map< std::string, std::string > newBranchToOldBranch_
edm::propagate_const< std::shared_ptr< IndexIntoFile > > indexIntoFileSharedPtr_
std::string const & newBranchToOldBranch(std::string const &newBranch) const
std::shared_ptr< ProductRegistry const > productRegistry() const
bool setEntryAtRun(RunNumber_t run)
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
void dropProcessesAndReorder(StoredProcessBlockHelper &, std::set< std::string > const &processesWithKeptProcessBlockProducts, ProcessBlockHelper const *)
EventAuxiliary eventAuxCache_
std::shared_ptr< ProductProvenanceRetriever const > eventProductProvenanceRetriever(size_t index) const
bool initializeFirstProcessBlockEntry()
RootTree const & lumiTree() const
RootTree const & eventTree() const
void initializeDuplicateChecker(std::vector< std::shared_ptr< IndexIntoFile >> const &indexesIntoFiles, std::vector< std::shared_ptr< IndexIntoFile >>::size_type currentIndexIntoFile)
InputSource::ProcessingMode processingMode_
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
bool skipEntries(unsigned int &offset)
void markBranchToBeDropped(bool dropDescendants, BranchDescription const &branch, std::set< BranchID > &branchesToDrop, std::map< BranchID, BranchID > const &droppedToKeptAlias) const
bool fillEventHistory(EventAuxiliary &evtAux, EventSelectionIDVector &eventSelectionIDs, BranchListIndexes &branchListIndexes, bool assertOnFailure=true)
IndexIntoFile::IndexIntoFileItr indexIntoFileIter() const
std::shared_ptr< IndexIntoFile > & indexIntoFileSharedPtr()
unsigned int LuminosityBlockNumber_t
edm::propagate_const< ProcessBlockHelper * > processBlockHelper_
std::shared_ptr< BranchChildren const > branchChildren() const
std::vector< EventSelectionID > EventSelectionIDVector
edm::propagate_const< TClass * > edProductClass_
FileFormatVersion fileFormatVersion_
unsigned int currentProcessBlockTree_
void fillEventToProcessBlockIndexes()
void setPosition(IndexIntoFile::IndexIntoFileItr const &position)
RootFile(std::string const &fileName, ProcessConfiguration const &processConfiguration, std::string const &logicalFileName, std::shared_ptr< InputFile > filePtr, unsigned int nStreams, unsigned int treeCacheSize, int treeMaxVirtualSize, RunHelperBase *runHelper, ProductSelectorRules const &productSelectorRules, InputType inputType, 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 enablePrefetching, bool enforceGUIDInFileName)
void updateFileBlock(FileBlock &)
std::vector< edm::propagate_const< std::shared_ptr< ProductProvenanceRetriever > > > eventProductProvenanceRetrievers_
std::vector< EventProcessHistoryID >::const_iterator eventProcessHistoryIter_
std::string const logicalFile_
std::vector< BranchListIndex > BranchListIndexes
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
void readParentageTree(InputType inputType)
edm::propagate_const< std::unique_ptr< StoredMergeableRunProductMetadata > > storedMergeableRunProductMetadata_
bool setEntryAtLumi(RunNumber_t run, LuminosityBlockNumber_t lumi)
RootFile(std::string const &fileName, ProcessConfiguration const &processConfiguration, std::string const &logicalFileName, std::shared_ptr< InputFile > filePtr, unsigned int nStreams, int treeMaxVirtualSize, InputSource::ProcessingMode processingMode, RunHelperBase *runHelper, ProductSelectorRules const &productSelectorRules, InputType inputType, std::shared_ptr< BranchIDListHelper > branchIDListHelper, std::shared_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper, std::vector< BranchID > const *associationsFromSecondary, 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 enablePrefetching, bool enforceGUIDInFileName)
void setPresenceInProductRegistry(ProductRegistry &, StoredProcessBlockHelper const &)
virtual std::unique_ptr< ProvenanceReaderBase > makeReader(RootTree &eventTree, DaqProvenanceHelper const *daqProvenanceHelper) const =0
IndexIntoFile::EntryNumber_t lastEventEntryNumberRead_
std::shared_ptr< RunAuxiliary > readFakeRunAuxiliary_()
std::shared_ptr< RunAuxiliary > readRunAuxiliary_()
std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_()
bool containsItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
void fillProcessBlockHelper_()
edm::propagate_const< std::unique_ptr< ProvenanceAdaptor > > provenanceAdaptor_
std::shared_ptr< ProductProvenanceRetriever > & eventProductProvenanceRetriever(size_t index)
edm::propagate_const< TBranch * > eventToProcessBlockIndexesBranch_
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::shared_ptr< FileBlock > createFileBlock()
std::vector< edm::propagate_const< RootTree * > > treePointers_
IndexIntoFile::EntryType getNextItemType(RunNumber_t &run, LuminosityBlockNumber_t &lumi, EventNumber_t &event)
EventAuxiliary const & fillThisEventAuxiliary()
bool nextProcessBlock_(ProcessBlockPrincipal &)
edm::propagate_const< std::unique_ptr< History > > history_
IndexIntoFile & indexIntoFile_
std::shared_ptr< BranchIDListHelper > & branchIDListHelper()
edm::propagate_const< std::unique_ptr< MakeProvenanceReader > > provenanceReaderMaker_
std::string const & file() const
bool goToEvent(EventID const &eventID)
void setAtEventEntry(IndexIntoFile::EntryNumber_t entry)
std::shared_ptr< BranchIDListHelper const > branchIDListHelper() const
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
bool wasFirstEventJustRead() const
std::shared_ptr< RunAuxiliary > & savedRunAuxiliary()
ProcessConfiguration const & processConfiguration_
std::shared_ptr< ProductRegistry const > productRegistry_
void setIfFastClonable(int remainingEvents, int remainingLumis)
int whyNotFastClonable() const
bool readLuminosityBlock_(LuminosityBlockPrincipal &lumiPrincipal)
edm::propagate_const< std::shared_ptr< BranchChildren > > branchChildren_
edm::propagate_const< std::shared_ptr< InputFile > > filePtr_
void dropOnInputAndReorder(ProductRegistry &, ProductSelectorRules const &, bool dropDescendants, InputType, StoredProcessBlockHelper &, ProcessBlockHelper const *)
std::vector< edm::propagate_const< std::unique_ptr< RootTree > > > processBlockTrees_
std::shared_ptr< BranchChildren > & branchChildren()
bool readRun_(RunPrincipal &runPrincipal)
std::shared_ptr< ProductProvenanceRetriever > makeProductProvenanceRetriever(unsigned int iStreamIndex)
void readProcessBlock_(ProcessBlockPrincipal &)
IndexIntoFile::IndexIntoFileItr indexIntoFileBegin_
edm::propagate_const< RunHelperBase * > runHelper_
bool branchListIndexesUnchanged_
edm::propagate_const< TTree * > eventHistoryTree_
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 noRunLumiSort, bool noEventSort, ProductSelectorRules const &productSelectorRules, InputType inputType, std::shared_ptr< BranchIDListHelper > branchIDListHelper, ProcessBlockHelper *, 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, bool enforceGUIDInFileName)
static int position[264][3]
bool branchListIndexesUnchanged() const
bool skipEntries(unsigned int &offset)
RootTree const & runTree() const
std::tuple< bool, bool > readCurrentEvent(EventPrincipal &cache, bool assertOnFailure=true)
std::vector< ProcessHistoryID > & orderedProcessHistoryIDs_
void initAssociationsFromSecondary(std::vector< BranchID > const &)
void makeProcessBlockRootTrees(std::shared_ptr< InputFile > filePtr, int treeMaxVirtualSize, bool enablePrefetching, InputType inputType, StoredProcessBlockHelper const &storedProcessBlockHelper)
std::unique_ptr< MakeProvenanceReader > makeProvenanceReaderMaker(InputType inputType)
bool readEvent(EventPrincipal &cache)
std::vector< ParentageID > parentageIDLookup_
bool setEntryAtEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
std::map< EntryDescriptionID, EventEntryDescription > EntryDescriptionMap
edm::propagate_const< std::shared_ptr< BranchIDListHelper > > branchIDListHelper_
bool endOfProcessBlocksReached() const
void validateFile(InputType inputType, bool usingGoToEvent)
edm::propagate_const< std::unique_ptr< StoredProcessBlockHelper > > storedProcessBlockHelper_
void readFakeRun_(RunPrincipal &runPrincipal)
std::vector< EventProcessHistoryID > eventProcessHistoryIDs_
void readEventHistoryTree()
void reportOpened(std::string const &inputType)