|
|
Go to the documentation of this file.
46 class RCDelayedReader;
54 std::shared_ptr<WrapperBase>
getProduct(
unsigned int iStreamIndex,
96 std::shared_ptr<InputFile> filePtr,
97 std::shared_ptr<EventSkipperByID> skipper,
98 std::shared_ptr<DuplicateChecker> duplicateChecker,
99 std::vector<std::shared_ptr<IndexIntoFile>>& indexesIntoFiles);
134 selectorRules_(
pset,
"inputCommands",
"InputSource"),
136 cachedWrappers_(
pset.getUntrackedParameter<unsigned
int>(
"repeatNEvents")),
137 eventAuxs_(cachedWrappers_.
size()),
144 iR.m_streamIndex =
index++;
148 auto logicalFileName =
pset.getUntrackedParameter<
std::string>(
"fileName");
150 auto const& physicalFileName =
catalog.fileCatalogItems().front().fileNames().front();
151 auto const nEventsToSkip =
pset.getUntrackedParameter<
unsigned int>(
"skipEvents");
154 auto duplicateChecker = std::make_shared<DuplicateChecker>(
pset);
156 std::vector<std::shared_ptr<IndexIntoFile>> indexesIntoFiles(1);
159 std::make_shared<InputFile>(physicalFileName.c_str(),
" Initiating request to open file ",
InputType::Primary);
161 logicalFileName, physicalFileName, 0 != nEventsToSkip,
input, skipper, duplicateChecker, indexesIntoFiles);
164 auto const& prodList =
rootFile_->productRegistry()->productList();
169 std::count_if(prodList.begin(), prodList.end(), [](
auto&& iV) {
return iV.second.branchType() ==
edm::InEvent; });
172 for (
auto&
prod : prodList) {
179 cache.resize(nProdsInEvent);
190 std::make_shared<BranchIDListHelper>(),
191 std::make_shared<ThinnedAssociationsHelper>(),
201 rootFile_->readCurrentEvent(eventPrincipal);
202 auto const&
aux = eventPrincipal.
aux();
209 throw cms::Exception(
"EventsWithDifferentRuns") <<
"The requested events to cache are from different Runs";
211 if (
lumi !=
aux.luminosityBlock()) {
213 <<
"The requested events to cache are from different LuminosityBlocks";
221 cache[branchToIndex.second] =
reader->getProduct(branchToIndex.first, &eventPrincipal);
232 "Read only a few Events from one EDM/Root file, and repeat them in sequence. The Events are required to be from "
233 "the same Run and LuminosityBlock.");
234 desc.addUntracked<
std::string>(
"fileName")->setComment(
"Name of file to be processed.");
235 desc.addUntracked<
unsigned int>(
"repeatNEvents", 10
U)
236 ->setComment(
"Number of events to read from file and then repeat in sequence.");
237 desc.addUntracked<
unsigned int>(
"skipEvents", 0);
241 descriptions.
add(
"source",
desc);
252 std::shared_ptr<InputFile> filePtr,
253 std::shared_ptr<EventSkipperByID> skipper,
254 std::shared_ptr<DuplicateChecker> duplicateChecker,
255 std::vector<std::shared_ptr<IndexIntoFile>>& indexesIntoFiles) {
256 return std::make_unique<RootFile>(pName,
313 return rootFile_->readLuminosityBlock_(lumiPrincipal);
317 return rootFile_->readLuminosityBlockAuxiliary_();
void readEvent_(EventPrincipal &eventPrincipal) override
EventAuxiliary const & aux() const
std::vector< std::vector< std::shared_ptr< edm::WrapperBase > > > cachedWrappers_
static const std::string input
std::unique_ptr< RootFile > rootFile_
unsigned long long eventIndex_
ItemType getNextItemType() override
RepeatingCachedRootSource(ParameterSet const &pset, InputSourceDescription const &desc)
std::shared_ptr< edm::WrapperBase > getProduct_(edm::BranchID const &k, edm::EDProductGetter const *ep) final
std::vector< BranchListIndex > BranchListIndexes
void updateFromInput(ProductList const &other)
std::shared_ptr< RunAuxiliary > readRunAuxiliary_() override
static ParameterSetID emptyParameterSetID()
void beginJob() override
Begin protected makes it easier to do template programming.
unsigned int value() const
bool readIt(EventID const &id, EventPrincipal &eventPrincipal, StreamContext &streamContext) override
unsigned int LuminosityBlockNumber_t
static std::unique_ptr< EventSkipperByID > create(ParameterSet const &pset)
void mergeReaders_(edm::DelayedReader *) final
BranchListIndexes const & branchListIndexes() const
static void fillDescriptions(ConfigurationDescriptions &descriptions)
edm::propagate_const< std::unique_ptr< RunHelperBase > > runHelper_
bool goToEvent_(EventID const &eventID) override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
DelayedReader * reader() const
BranchListIndexes branchListIndexes_
std::vector< size_t > streamToCacheIndex_
std::shared_ptr< WrapperBase > getProduct(unsigned int iStreamIndex, BranchID const &k, EDProductGetter const *ep) const
unsigned const int defaultCacheSize
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const * preEventReadFromSourceSignal() const final
unsigned int m_streamIndex
void readRun_(RunPrincipal &runPrincipal) override
void setParameterSetID(ParameterSetID const &pSetID)
edm::RepeatingCachedRootSource const * m_source
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
static void fillDescription(ParameterSetDescription &desc, char const *parameterName, std::vector< std::string > const &defaultStrings=defaultSelectionStrings())
ProductSelectorRules selectorRules_
EventSelectionIDVector const & eventSelectionIDs() const
std::vector< RCDelayedReader > delayedReaders_
StreamID streamID() const
ProductProvenanceRetriever provRetriever_
EventSelectionIDVector selectionIDs_
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistory const *processHistory, DelayedReader *reader=nullptr)
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const * postEventReadFromSourceSignal() const final
std::vector< EventAuxiliary > eventAuxs_
ProcessConfigurationID setProcessConfigurationID()
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)
RootServiceChecker rootServiceChecker_
bool getMapped(ProcessHistoryID const &key, ProcessHistory &value) const
TEMPL(T2) struct Divides void
std::map< edm::BranchID, size_t > branchIDToWrapperIndex_
std::vector< EventSelectionID > EventSelectionIDVector
void skip(int offset) override
std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
void readLuminosityBlock_(LuminosityBlockPrincipal &lumiPrincipal) override