31 class LuminosityBlockID;
33 class ThinnedAssociationsHelper;
36 void checkHistoryConsistency(Principal
const& primary, Principal
const& secondary) {
37 ProcessHistory
const& ph1 = primary.processHistory();
38 ProcessHistory
const& ph2 = secondary.processHistory();
41 "The secondary file is not an ancestor of the primary file\n";
44 void checkConsistency(EventPrincipal
const& primary, EventPrincipal
const& secondary) {
47 primary.id() <<
" has inconsistent EventAuxiliary data in the primary and secondary file\n";
50 void checkConsistency(LuminosityBlockAuxiliary
const& primary, LuminosityBlockAuxiliary
const& secondary) {
51 if(primary.id() != secondary.id()) {
53 primary.id() <<
" has inconsistent LuminosityBlockAuxiliary data in the primary and secondary file\n";
56 void checkConsistency(RunAuxiliary
const& primary, RunAuxiliary
const& secondary) {
57 if(primary.id() != secondary.id()) {
59 primary.id() <<
" has inconsistent RunAuxiliary data in the primary and secondary file\n";
66 rootServiceChecker_(),
67 catalog_(pset.getUntrackedParameter<std::vector<std::
string> >(
"fileNames"),
68 pset.getUntrackedParameter<std::
string>(
"overrideCatalog", std::
string())),
69 secondaryCatalog_(pset.getUntrackedParameter<std::vector<std::
string> >(
"secondaryFileNames", std::vector<std::
string>()),
70 pset.getUntrackedParameter<std::
string>(
"overrideCatalog", std::
string())),
72 secondaryFileSequence_(secondaryCatalog_.
empty() ?
nullptr :
74 secondaryRunPrincipal_(),
75 secondaryLumiPrincipal_(),
76 secondaryEventPrincipals_(),
77 branchIDsToReplace_(),
80 if (secondaryCatalog_.empty() && pset.getUntrackedParameter<
bool>(
"needSecondaryFileNames",
false)) {
83 if(secondaryFileSequence_) {
84 unsigned int nStreams = desc.allocations_->numberOfStreams();
85 secondaryEventPrincipals_.reserve(nStreams);
87 secondaryEventPrincipals_.emplace_back(
new EventPrincipal(secondaryFileSequence_->fileProductRegistry(),
88 secondaryFileSequence_->fileBranchIDListHelper(),
89 std::make_shared<ThinnedAssociationsHelper const>(),
97 std::set<BranchID> associationsFromSecondary;
98 typedef ProductRegistry::ProductList::const_iterator const_iterator;
99 typedef ProductRegistry::ProductList::iterator iterator;
102 for(const_iterator it = secondary.begin(), itEnd = secondary.end(); it != itEnd; ++it) {
103 if(it->second.present()) {
104 idsToReplace[it->second.branchType()].insert(it->second.branchID());
105 if(it->second.branchType() ==
InEvent &&
106 it->second.unwrappedType() ==
typeid(ThinnedAssociation)) {
107 associationsFromSecondary.insert(it->second.branchID());
110 iterator itFound = fullList.find(it->first);
111 if(itFound != fullList.end()) {
112 itFound->second.setDropped(
false);
116 for(const_iterator it = primary.begin(), itEnd = primary.end(); it != itEnd; ++it) {
117 if(it->second.present()) {
118 idsToReplace[it->second.branchType()].erase(it->second.branchID());
119 associationsFromSecondary.erase(it->second.branchID());
123 secondaryFileSequence_.reset();
126 branchIDsToReplace_[
i].reserve(idsToReplace[
i].
size());
127 for(std::set<BranchID>::const_iterator it = idsToReplace[
i].
begin(), itEnd = idsToReplace[
i].
end();
129 branchIDsToReplace_[
i].push_back(*it);
133 secondaryFileSequence_->initAssociationsFromSecondary(associationsFromSecondary);
146 std::unique_ptr<FileBlock>
152 return std::move(fb);
159 std::shared_ptr<RunAuxiliary>
164 std::shared_ptr<LuminosityBlockAuxiliary>
176 checkConsistency(runPrincipal.
aux(), *secondaryAuxiliary);
181 runPrincipal.
index());
183 checkHistoryConsistency(runPrincipal, *secondaryRunPrincipal_);
187 <<
" Run " << runPrincipal.
run()
188 <<
" is not found in the secondary input files\n";
199 std::shared_ptr<LuminosityBlockAuxiliary> secondaryAuxiliary =
secondaryFileSequence_->readLuminosityBlockAuxiliary_();
200 checkConsistency(lumiPrincipal.
aux(), *secondaryAuxiliary);
205 lumiPrincipal.
index());
207 checkHistoryConsistency(lumiPrincipal, *secondaryLumiPrincipal_);
211 <<
" Run " << lumiPrincipal.
run()
213 <<
" is not found in the secondary input files\n";
228 checkConsistency(eventPrincipal, secondaryEventPrincipal);
229 checkHistoryConsistency(eventPrincipal, secondaryEventPrincipal);
235 eventPrincipal.
id() <<
" is not found in the secondary input files\n";
243 if(!found)
return false;
297 std::vector<std::string> defaultStrings;
299 desc.
addUntracked<std::vector<std::string> >(
"fileNames")
300 ->setComment(
"Names of files to be processed.");
301 desc.
addUntracked<std::vector<std::string> >(
"secondaryFileNames", defaultStrings)
302 ->setComment(
"Names of secondary files to be processed.");
303 desc.
addUntracked<
bool>(
"needSecondaryFileNames",
false)
304 ->setComment(
"If True, 'secondaryFileNames' must be specified and be non-empty.");
309 descriptions.
add(
"source", desc);
PoolSource(ParameterSet const &pset, InputSourceDescription const &desc)
EventNumber_t event() const
SharedResourcesAcquirer createAcquirerForSourceDelayedReader()
bool isSameEvent(EventAuxiliary const &a, EventAuxiliary const &b)
std::unique_ptr< SharedResourcesAcquirer > resourceSharedWithDelayedReaderPtr_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
virtual std::unique_ptr< FileBlock > readFile_()
virtual ProcessingController::ForwardState forwardState_() const
virtual bool goToEvent_(EventID const &eventID)
std::shared_ptr< RunPrincipal > secondaryRunPrincipal_
std::map< BranchKey, BranchDescription > ProductList
EventID const & id() const
unsigned long long EventNumber_t
LuminosityBlockAuxiliary const & aux() const
void mergeProvenanceRetrievers(EventPrincipal const &other)
LuminosityBlockIndex index() const
LuminosityBlockNumber_t luminosityBlock() const
static void fillDescription(ParameterSetDescription &desc)
unsigned int LuminosityBlockNumber_t
static EventNumber_t const invalidEvent
std::unique_ptr< RootPrimaryFileSequence > primaryFileSequence_
void setComment(std::string const &value)
std::shared_ptr< LuminosityBlockPrincipal > secondaryLumiPrincipal_
bool isAncestor(ProcessHistory const &a, ProcessHistory const &b)
LuminosityBlockNumber_t luminosityBlock() const
virtual bool randomAccess_() const
static RunNumber_t const invalidRun
virtual ProcessingController::ReverseState reverseState_() const
static SharedResourcesRegistry * instance()
StreamID streamID() const
RunAuxiliary const & aux() const
SharedResourcesAcquirer * resourceSharedWithDelayedReader_() const override
virtual void readRun_(RunPrincipal &runPrincipal)
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
virtual std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_()
static void fillDescriptions(ConfigurationDescriptions &descriptions)
unsigned int value() const
static LuminosityBlockNumber_t const invalidLumi
virtual bool readIt(EventID const &id, EventPrincipal &eventPrincipal, StreamContext &streamContext) override
virtual void readEvent_(EventPrincipal &eventPrincipal)
std::array< std::vector< BranchID >, NumBranchTypes > branchIDsToReplace_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual void closeFile_()
virtual ItemType getNextItemType()
virtual void skip(int offset)
virtual void preForkReleaseResources()
std::unique_ptr< RootSecondaryFileSequence > secondaryFileSequence_
void recombine(Principal &other, std::vector< BranchID > const &bids)
std::vector< std::unique_ptr< EventPrincipal > > secondaryEventPrincipals_
tuple size
Write out results.
virtual std::shared_ptr< RunAuxiliary > readRunAuxiliary_()
virtual void readLuminosityBlock_(LuminosityBlockPrincipal &lumiPrincipal)