32 class LuminosityBlockID;
34 class ThinnedAssociationsHelper;
37 void checkHistoryConsistency(Principal
const& primary, Principal
const& secondary) {
42 <<
"The secondary file is not an ancestor of the primary file\n";
45 void checkConsistency(EventPrincipal
const& primary, EventPrincipal
const& secondary) {
48 << primary.id() <<
" has inconsistent EventAuxiliary data in the primary and secondary file\n";
51 void checkConsistency(LuminosityBlockAuxiliary
const& primary, LuminosityBlockAuxiliary
const& secondary) {
52 if (primary.id() != secondary.id()) {
54 << primary.id() <<
" has inconsistent LuminosityBlockAuxiliary data in the primary and secondary file\n";
57 void checkConsistency(RunAuxiliary
const& primary, RunAuxiliary
const& secondary) {
58 if (primary.id() != secondary.id()) {
60 << primary.id() <<
" has inconsistent RunAuxiliary data in the primary and secondary file\n";
67 rootServiceChecker_(),
73 secondaryRunPrincipal_(),
74 secondaryLumiPrincipal_(),
75 secondaryEventPrincipals_(),
76 branchIDsToReplace_(),
78 skipBadFiles_(
pset.getUntrackedParameter<
bool>(
"skipBadFiles")),
79 bypassVersionCheck_(
pset.getUntrackedParameter<
bool>(
"bypassVersionCheck")),
80 treeMaxVirtualSize_(
pset.getUntrackedParameter<
int>(
"treeMaxVirtualSize")),
81 productSelectorRules_(
pset,
"inputCommands",
"InputSource"),
82 dropDescendants_(
pset.getUntrackedParameter<
bool>(
"dropDescendantsOfDroppedBranches")),
83 labelRawDataLikeMC_(
pset.getUntrackedParameter<
bool>(
"labelRawDataLikeMC")),
84 delayReadingEventProducts_(
pset.getUntrackedParameter<
bool>(
"delayReadingEventProducts")),
86 resourceSharedWithDelayedReaderPtr_(),
90 secondaryFileSequence_(
104 std::make_shared<ThinnedAssociationsHelper const>(),
112 std::set<BranchID> associationsFromSecondary;
115 for (
auto const&
item : secondary) {
116 if (
item.second.present()) {
117 idsToReplace[
item.second.branchType()].insert(
item.second.branchID());
119 associationsFromSecondary.insert(
item.second.branchID());
122 auto itFound = fullList.find(
item.first);
123 if (itFound != fullList.end()) {
125 if (itFound->second.dropped()) {
126 itFound->second.initFromDictionary();
128 itFound->second.setDropped(
false);
132 for (
auto const&
item : primary) {
133 if (
item.second.present()) {
134 idsToReplace[
item.second.branchType()].erase(
item.second.branchID());
135 associationsFromSecondary.erase(
item.second.branchID());
143 for (
auto const&
id : idsToReplace[
i]) {
193 checkConsistency(runPrincipal.
aux(), *secondaryAuxiliary);
202 <<
" Run " << runPrincipal.
run() <<
" is not found in the secondary input files\n";
212 std::shared_ptr<LuminosityBlockAuxiliary> secondaryAuxiliary =
214 checkConsistency(lumiPrincipal.
aux(), *secondaryAuxiliary);
223 <<
" Run " << lumiPrincipal.
run() <<
" LuminosityBlock " << lumiPrincipal.
luminosityBlock()
224 <<
" is not found in the secondary input files\n";
231 assert(readEventSucceeded);
238 checkConsistency(eventPrincipal, secondaryEventPrincipal);
239 checkHistoryConsistency(eventPrincipal, secondaryEventPrincipal);
240 assert(readEventSucceeded);
246 << eventPrincipal.
id() <<
" is not found in the secondary input files\n";
293 std::vector<std::string> defaultStrings;
294 desc.setComment(
"Reads EDM/Root files.");
295 desc.addUntracked<std::vector<std::string> >(
"fileNames")->setComment(
"Names of files to be processed.");
296 desc.addUntracked<std::vector<std::string> >(
"secondaryFileNames", defaultStrings)
297 ->setComment(
"Names of secondary files to be processed.");
298 desc.addUntracked<
bool>(
"needSecondaryFileNames",
false)
299 ->setComment(
"If True, 'secondaryFileNames' must be specified and be non-empty.");
301 desc.addUntracked<
bool>(
"skipBadFiles",
false)
303 "True: Ignore any missing or unopenable input file.\n" 304 "False: Throw exception if missing or unopenable input file.");
305 desc.addUntracked<
bool>(
"bypassVersionCheck",
false)
307 "True: Bypass release version check.\n" 308 "False: Throw exception if reading file in a release prior to the release in which the file was written.");
309 desc.addUntracked<
int>(
"treeMaxVirtualSize", -1)
310 ->setComment(
"Size of ROOT TTree TBasket cache. Affects performance.");
311 desc.addUntracked<
bool>(
"dropDescendantsOfDroppedBranches",
true)
312 ->setComment(
"If True, also drop on input any descendent of any branch dropped on input.");
313 desc.addUntracked<
bool>(
"labelRawDataLikeMC",
true)
314 ->setComment(
"If True: replace module label for raw data to match MC. Also use 'LHC' as process.");
315 desc.addUntracked<
bool>(
"delayReadingEventProducts",
true)
317 "If True: do not read a data product from the file until it is requested. If False: all event data " 318 "products are read upfront.");
324 descriptions.
add(
"source",
desc);
LuminosityBlockNumber_t luminosityBlock() const
void fillProcessBlockHelper_() override
edm::propagate_const< std::unique_ptr< RootSecondaryFileSequence > > secondaryFileSequence_
PoolSource(ParameterSet const &pset, InputSourceDescription const &desc)
bool goToEvent_(EventID const &eventID) override
bool isSameEvent(EventAuxiliary const &a, EventAuxiliary const &b)
std::unique_ptr< SharedResourcesAcquirer > resourceSharedWithDelayedReaderPtr_
bool nextProcessBlock_(ProcessBlockPrincipal &) override
edm::propagate_const< std::unique_ptr< RunHelperBase > > runHelper_
std::map< BranchKey, BranchDescription > ProductList
static void fillDescription(ParameterSetDescription &desc)
edm::propagate_const< std::shared_ptr< RunPrincipal > > secondaryRunPrincipal_
unsigned long long EventNumber_t
void readProcessBlock_(ProcessBlockPrincipal &) override
void readLuminosityBlock_(LuminosityBlockPrincipal &lumiPrincipal) override
static void fillDescription(ParameterSetDescription &desc, char const *parameterName, std::vector< std::string > const &defaultStrings=defaultSelectionStrings())
static void fillDescription(ParameterSetDescription &desc)
StreamID streamID() const
unsigned int LuminosityBlockNumber_t
static constexpr EventNumber_t invalidEvent
std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
LuminosityBlockNumber_t luminosityBlock() const
std::pair< SharedResourcesAcquirer *, std::recursive_mutex * > resourceSharedWithDelayedReader_() override
bool randomAccess_() const override
void mergeProvenanceRetrievers(EventPrincipal &other)
ProcessingController::ReverseState reverseState_() const override
bool delayReadingEventProducts_
void readRun_(RunPrincipal &runPrincipal) override
std::vector< edm::propagate_const< std::unique_ptr< EventPrincipal > > > secondaryEventPrincipals_
bool isAncestor(ProcessHistory const &a, ProcessHistory const &b)
void readEvent_(EventPrincipal &eventPrincipal) override
static constexpr RunNumber_t invalidRun
static SharedResourcesRegistry * instance()
std::shared_ptr< RunAuxiliary > readRunAuxiliary_() override
ItemType getNextItemType() override
std::unique_ptr< RunHelperBase > makeRunHelper(ParameterSet const &pset)
InputFileCatalog secondaryCatalog_
static void fillDescriptions(ConfigurationDescriptions &descriptions)
ProcessingController::ForwardState forwardState_() const override
static constexpr LuminosityBlockNumber_t invalidLumi
bool readIt(EventID const &id, EventPrincipal &eventPrincipal, StreamContext &streamContext) override
std::array< std::vector< BranchID >, NumBranchTypes > branchIDsToReplace_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
ProductList & productListUpdator()
void skip(int offset) override
void readAllFromSourceAndMergeImmediately(MergeableRunProductMetadata const *mergeableRunProductMetadata=nullptr)
LuminosityBlockIndex index() const
std::shared_ptr< std::recursive_mutex > mutexSharedWithDelayedReader_
RunAuxiliary const & aux() const
LuminosityBlockAuxiliary const & aux() const
unsigned int value() const
std::pair< SharedResourcesAcquirer, std::shared_ptr< std::recursive_mutex > > createAcquirerForSourceDelayedReader()
edm::propagate_const< std::shared_ptr< LuminosityBlockPrincipal > > secondaryLumiPrincipal_
EventID const & id() const
void recombine(Principal &other, std::vector< BranchID > const &bids)
edm::propagate_const< std::unique_ptr< RootPrimaryFileSequence > > primaryFileSequence_
EventNumber_t event() const
std::shared_ptr< FileBlock > readFile_() override
void closeFile_() override