47 class RCDelayedReader;
55 std::shared_ptr<WrapperBase>
getProduct(
unsigned int iStreamIndex,
101 std::shared_ptr<InputFile> filePtr,
102 std::shared_ptr<EventSkipperByID> skipper,
103 std::shared_ptr<DuplicateChecker> duplicateChecker,
104 std::vector<std::shared_ptr<IndexIntoFile>>& indexesIntoFiles);
139 selectorRules_(pset,
"inputCommands",
"InputSource"),
141 cachedWrappers_(pset.getUntrackedParameter<unsigned int>(
"repeatNEvents")),
142 eventAuxs_(cachedWrappers_.
size()),
149 iR.m_streamIndex = index++;
155 auto const& physicalFileName = catalog.fileCatalogItems().front().fileNames().front();
159 auto duplicateChecker = std::make_shared<DuplicateChecker>(
pset);
161 std::vector<std::shared_ptr<IndexIntoFile>> indexesIntoFiles(1);
164 std::make_shared<InputFile>(physicalFileName.c_str(),
" Initiating request to open file ",
InputType::Primary);
166 logicalFileName, physicalFileName, 0 != nEventsToSkip,
input, skipper, duplicateChecker, indexesIntoFiles);
167 rootFile_->reportOpened(
"repeating");
169 auto const& prodList = rootFile_->productRegistry()->productList();
174 std::count_if(prodList.begin(), prodList.end(), [](
auto&& iV) {
return iV.second.branchType() ==
edm::InEvent; });
177 for (
auto& prod : prodList) {
184 cache.resize(nProdsInEvent);
195 std::make_shared<BranchIDListHelper>(),
196 std::make_shared<ThinnedAssociationsHelper>(),
197 processConfiguration,
206 rootFile_->readCurrentEvent(eventPrincipal);
207 auto const&
aux = eventPrincipal.
aux();
211 lumi =
aux.luminosityBlock();
213 if (run !=
aux.run()) {
214 throw cms::Exception(
"EventsWithDifferentRuns") <<
"The requested events to cache are from different Runs";
216 if (lumi !=
aux.luminosityBlock()) {
218 <<
"The requested events to cache are from different LuminosityBlocks";
226 cache[branchToIndex.second] =
reader->getProduct(branchToIndex.first, &eventPrincipal);
237 "Read only a few Events from one EDM/Root file, and repeat them in sequence. The Events are required to be from "
238 "the same Run and LuminosityBlock.");
241 ->setComment(
"Number of events to read from file and then repeat in sequence.");
246 descriptions.
add(
"source", desc);
257 std::shared_ptr<InputFile> filePtr,
258 std::shared_ptr<EventSkipperByID> skipper,
259 std::shared_ptr<DuplicateChecker> duplicateChecker,
260 std::vector<std::shared_ptr<IndexIntoFile>>& indexesIntoFiles) {
261 return std::make_unique<RootFile>(pName,
320 return rootFile_->readLuminosityBlock_(lumiPrincipal);
324 return rootFile_->readLuminosityBlockAuxiliary_();
365 return rootFile_->nextProcessBlock_(processBlockPrincipal);
369 rootFile_->readProcessBlock_(processBlockPrincipal);
std::vector< RCDelayedReader > delayedReaders_
T getUntrackedParameter(std::string const &, T const &) const
void beginJob() override
Begin protected makes it easier to do template programming.
EventSelectionIDVector const & eventSelectionIDs() const
ProcessConfigurationID setProcessConfigurationID()
void readEvent_(EventPrincipal &eventPrincipal) override
bool getMapped(ProcessHistoryID const &key, ProcessHistory &value) const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::map< edm::BranchID, size_t > branchIDToWrapperIndex_
void readRun_(RunPrincipal &runPrincipal) override
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const * postEventReadFromSourceSignal() const final
static std::unique_ptr< EventSkipperByID > create(ParameterSet const &pset)
std::vector< size_t > streamToCacheIndex_
unsigned long long eventIndex_
std::unique_ptr< RootFile > rootFile_
void setParameterSetID(ParameterSetID const &pSetID)
static void fillDescription(ParameterSetDescription &desc, char const *parameterName, std::vector< std::string > const &defaultStrings=defaultSelectionStrings())
void readProcessBlock_(ProcessBlockPrincipal &) override
unsigned int const defaultCacheSize
BranchListIndexes const & branchListIndexes() const
unsigned int LuminosityBlockNumber_t
bool readIt(EventID const &id, EventPrincipal &eventPrincipal, StreamContext &streamContext) override
unsigned int m_streamIndex
std::vector< EventSelectionID > EventSelectionIDVector
static std::string const input
ItemType getNextItemType() override
void setComment(std::string const &value)
std::vector< BranchListIndex > BranchListIndexes
edm::RepeatingCachedRootSource const * m_source
ProductProvenanceRetriever provRetriever_
ProductSelectorRules selectorRules_
BranchListIndexes branchListIndexes_
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
std::shared_ptr< RunAuxiliary > readRunAuxiliary_() override
bool nextProcessBlock_(ProcessBlockPrincipal &) override
StreamID streamID() const
RootServiceChecker rootServiceChecker_
std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
void mergeReaders_(edm::DelayedReader *) final
void readLuminosityBlock_(LuminosityBlockPrincipal &lumiPrincipal) override
edm::propagate_const< std::unique_ptr< RunHelperBase > > runHelper_
void fillProcessBlockHelper_() override
std::shared_ptr< edm::WrapperBase > getProduct_(edm::BranchID const &k, edm::EDProductGetter const *ep) final
DelayedReader * reader() const
unsigned int value() const
std::shared_ptr< WrapperBase > getProduct(unsigned int iStreamIndex, BranchID const &k, EDProductGetter const *ep) const
void skip(int offset) override
std::vector< std::vector< std::shared_ptr< edm::WrapperBase > > > cachedWrappers_
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const * preEventReadFromSourceSignal() const final
void add(std::string const &label, ParameterSetDescription const &psetDescription)
RepeatingCachedRootSource(ParameterSet const &pset, InputSourceDescription const &desc)
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistory const *processHistory, DelayedReader *reader=nullptr)
void updateFromInput(ProductList const &other)
std::unique_ptr< RootFile > makeRootFile(std::string const &logicalFileName, std::string const &pName, bool isSkipping, std::shared_ptr< InputFile > filePtr, std::shared_ptr< EventSkipperByID > skipper, std::shared_ptr< DuplicateChecker > duplicateChecker, std::vector< std::shared_ptr< IndexIntoFile >> &indexesIntoFiles)
std::vector< EventAuxiliary > eventAuxs_
static ParameterSetID emptyParameterSetID()
EventAuxiliary const & aux() const
tuple size
Write out results.
EventSelectionIDVector selectionIDs_
bool goToEvent_(EventID const &eventID) override
static void fillDescriptions(ConfigurationDescriptions &descriptions)