39 std::shared_ptr<ProductRegistry const> parentProductRegistry,
40 std::shared_ptr<BranchIDListHelper const> parentBranchIDListHelper,
49 parentPreg_(parentProductRegistry),
51 branchIDListHelper_(),
53 processConfiguration_(),
55 historyRunOffset_(historyLumiOffset_+preallocConfig.numberOfLuminosityBlocks()),
56 processHistoryRegistries_(historyRunOffset_+ preallocConfig.numberOfRuns()),
57 historyAppenders_(historyRunOffset_+preallocConfig.numberOfRuns()),
63 processParameterSet_(),
64 productSelectorRules_(parameterSet,
"outputCommands",
"OutputModule"),
66 wantAllEvents_(
true) {
76 tns->getProcessName(),
79 std::map<std::string, std::vector<std::pair<std::string, int> > > outputModulePathPositions;
82 outputModulePathPositions,
83 parentProductRegistry->anyProductProduced());
85 std::map<BranchID, bool> keepAssociation;
86 selectProducts(*parentProductRegistry, parentThinnedAssociationsHelper, keepAssociation);
103 if(topLevelParameterSet.
exists(maxEvents)) {
106 if(topLevelParameterSet.
exists(maxLumis)) {
164 auto ep = std::make_shared<EventPrincipal>(
preg_,
170 ep->preModuleDelayedGetSignal_.connect(std::cref(items.
actReg_->preModuleEventDelayedGetSignal_));
171 ep->postModuleDelayedGetSignal_.connect(std::cref(items.
actReg_->postModuleEventDelayedGetSignal_));
174 if(hasSubProcesses) {
176 subProcesses_ = std::make_unique<std::vector<SubProcess> >();
179 for(
auto& subProcessPSet : *subProcessVParameterSet) {
181 topLevelParameterSet,
184 *thinnedAssociationsHelper_,
219 subProcess.doBeginJob();
227 ExceptionCollector c(
"Multiple exceptions were thrown while executing endJob. An exception message follows for each.");
231 c.
call([&subProcess](){ subProcess.doEndJob();});
242 std::map<BranchID, bool>& keepAssociation) {
250 std::map<BranchID, BranchDescription const*> trueBranchIDToKeptBranchDesc;
251 std::vector<BranchDescription const*> associationDescriptions;
252 std::set<BranchID> keptProductsInEvent;
262 associationDescriptions.push_back(&desc);
264 keepThisBranch(desc, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
272 for(
auto association : associationDescriptions) {
273 if(keepAssociation[association->branchID()]) {
274 keepThisBranch(*association, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
283 std::map<BranchID, BranchDescription const*>& trueBranchIDToKeptBranchDesc,
284 std::set<BranchID>& keptProductsInEvent) {
287 trueBranchIDToKeptBranchDesc);
293 keptProductsInEvent.insert(desc.
branchID());
306 std::map<BranchID::value_type, BranchID::value_type>::const_iterator iter = droppedBranchIDToKeptBranchID.find(branchID);
307 if(iter != droppedBranchIDToKeptBranchID.end()) {
308 branchID = iter->second;
314 subProcess.fixBranchIDListsForEDAliases(droppedBranchIDToKeptBranchID);
346 processHistoryRegistry.registerProcessHistory(principal.
processHistory());
350 processHistoryRegistry,
361 subProcess.doEvent(ep);
375 auto aux = std::make_shared<RunAuxiliary>(principal.
aux());
379 processHistoryRegistry.registerProcessHistory(principal.
processHistory());
380 rpp->fillRunPrincipal(processHistoryRegistry, principal.
reader());
391 schedule_->processOneGlobal<Traits>(rp,
esp_->eventSetupForInstance(ts));
394 subProcess.doBeginRun(rp, ts);
402 endRun(principal,ts,cleaningUpAfterException);
410 schedule_->processOneGlobal<Traits>(rp,
esp_->eventSetupForInstance(ts), cleaningUpAfterException);
413 subProcess.doEndRun(rp, ts, cleaningUpAfterException);
421 std::map<ProcessHistoryID, ProcessHistoryID>::const_iterator it =
parentToChildPhID_.find(parentPhID);
426 subProcess.writeRun(it->second, runNumber);
433 std::map<ProcessHistoryID, ProcessHistoryID>::const_iterator it =
parentToChildPhID_.find(parentPhID);
438 subProcess.deleteRunFromCache(it->second, runNumber);
451 auto aux = std::make_shared<LuminosityBlockAuxiliary>(principal.
aux());
455 processHistoryRegistry.registerProcessHistory(principal.
processHistory());
456 lbpp->fillLuminosityBlockPrincipal(processHistoryRegistry, principal.
reader());
462 schedule_->processOneGlobal<Traits>(lbp,
esp_->eventSetupForInstance(ts));
465 subProcess.doBeginLuminosityBlock(lbp, ts);
481 schedule_->processOneGlobal<Traits>(lbp,
esp_->eventSetupForInstance(ts), cleaningUpAfterException);
484 subProcess.doEndLuminosityBlock(lbp, ts, cleaningUpAfterException);
492 std::map<ProcessHistoryID, ProcessHistoryID>::const_iterator it =
parentToChildPhID_.find(parentPhID);
497 subProcess.writeLumi(it->second, runNumber, lumiNumber);
504 std::map<ProcessHistoryID, ProcessHistoryID>::const_iterator it =
parentToChildPhID_.find(parentPhID);
509 subProcess.deleteLumiFromCache(it->second, runNumber, lumiNumber);
520 subProcess.doBeginStream(iID);
531 subProcess.doEndStream(iID);
542 schedule_->processOneStream<Traits>(id,rp,
esp_->eventSetupForInstance(ts));
545 subProcess.doStreamBeginRun(
id,rp, ts);
557 schedule_->processOneStream<Traits>(id,rp,
esp_->eventSetupForInstance(ts),cleaningUpAfterException);
560 subProcess.doStreamEndRun(
id,rp, ts,cleaningUpAfterException);
572 schedule_->processOneStream<Traits>(id,lbp,
esp_->eventSetupForInstance(ts));
575 subProcess.doStreamBeginLuminosityBlock(
id,lbp, ts);
587 schedule_->processOneStream<Traits>(id,lbp,
esp_->eventSetupForInstance(ts),cleaningUpAfterException);
590 subProcess.doStreamEndLuminosityBlock(
id,lbp, ts,cleaningUpAfterException);
600 for(
auto const& item : keptVector) {
602 if(parentProductHolder !=
nullptr) {
605 if(productHolder !=
nullptr) {
633 subProcess.respondToOpenInputFile(fb);
639 std::unique_ptr<std::vector<ParameterSet> >
641 std::vector<std::string> subProcesses = parameterSet.
getUntrackedParameter<std::vector<std::string> >(
"@all_subprocesses");
642 if(!subProcesses.empty()) {
645 return std::unique_ptr<std::vector<ParameterSet> >(
nullptr);
unsigned int historyRunOffset_
unsigned int historyLumiOffset_
ParameterSetID selector_config_id_
std::shared_ptr< ActivityRegistry > actReg_
void insert(std::shared_ptr< RunPrincipal > rp)
ProductRegistry const & productRegistry() const
T getUntrackedParameter(std::string const &, T const &) const
bool selected(BranchDescription const &desc) const
std::unique_ptr< std::vector< ParameterSet > > popVParameterSet(std::string const &name)
std::shared_ptr< EventSetupProvider > makeProvider(ParameterSet &)
void setLuminosityBlockPrincipal(std::shared_ptr< LuminosityBlockPrincipal > const &lbp)
EventSelectionIDVector const & eventSelectionIDs() const
void respondToOpenInputFile(FileBlock const &fb)
void doStreamEndLuminosityBlock(unsigned int iID, LuminosityBlockPrincipal const &principal, IOVSyncValue const &ts, bool cleaningUpAfterException)
BranchType const & branchType() const
std::vector< BranchIDList > BranchIDLists
ProcessHistoryID const & reducedProcessHistoryID() const
ConstProductHolderPtr getProductHolder(BranchID const &oid) const
void doBeginRun(RunPrincipal const &principal, IOVSyncValue const &ts)
void deleteLumi(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi)
void writeLumi(ProcessHistoryID const &parentPhID, int runNumber, int lumiNumber)
std::unique_ptr< ParameterSet > popParameterSet(std::string const &name)
static void fillDroppedToKept(ProductRegistry const &preg, std::map< BranchID, BranchDescription const * > const &trueBranchIDToKeptBranchDesc, std::map< BranchID::value_type, BranchID::value_type > &droppedBranchIDToKeptBranchID_)
void setNumberOfConcurrentPrincipals(PreallocationConfiguration const &)
std::unique_ptr< ExceptionToActionTable const > act_table_
std::shared_ptr< BranchIDListHelper const > branchIDListHelper() const
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper() const
std::vector< ProcessHistoryRegistry > processHistoryRegistries_
edm::propagate_const< std::shared_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
void beginRun(RunPrincipal const &r, IOVSyncValue const &ts)
PathsAndConsumesOfModules pathsAndConsumesOfModules_
LuminosityBlockPrincipal & lumiPrincipal(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi) const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void updateBranchIDListHelper(BranchIDLists const &)
LuminosityBlockAuxiliary const & aux() const
std::unique_ptr< std::vector< ParameterSet > > popSubProcessVParameterSet(ParameterSet ¶meterSet)
SelectedProductsForBranchType const & keptProducts() const
ProductHolderBase * getModifiableProductHolder(BranchID const &oid)
LuminosityBlockIndex index() const
void doEndStream(unsigned int)
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
void doEvent(EventPrincipal const &principal)
void setParentProcessContext(ProcessContext const *parentProcessContext)
edm::propagate_const< std::unique_ptr< std::vector< SubProcess > > > subProcesses_
void doBeginLuminosityBlock(LuminosityBlockPrincipal const &principal, IOVSyncValue const &ts)
std::map< BranchID::value_type, BranchID::value_type > const & droppedBranchIDToKeptBranchID()
BranchListIndexes const & branchListIndexes() const
edm::propagate_const< std::unique_ptr< Schedule > > schedule_
ProcessHistory const & processHistory() const
std::vector< EventSelectionID > EventSelectionIDVector
std::auto_ptr< Schedule > initSchedule(ParameterSet ¶meterSet, bool hasSubprocesses, PreallocationConfiguration const &iAllocConfig, ProcessContext const *)
ProductList const & productList() const
void selectAssociationProducts(std::vector< BranchDescription const * > const &associationDescriptions, std::set< BranchID > const &keptProductsInEvent, std::map< BranchID, bool > &keepAssociation) const
void initialize(Schedule const *, std::shared_ptr< ProductRegistry const >)
ServiceToken serviceToken_
void deleteRunFromCache(ProcessHistoryID const &parentPhID, int runNumber)
std::vector< BranchListIndex > BranchListIndexes
ProcessHistoryID const & processHistoryID() const
std::shared_ptr< CommonParams > initMisc(ParameterSet ¶meterSet)
SelectedProductsForBranchType keptProducts_
void selectProducts(ProductRegistry const &preg, ThinnedAssociationsHelper const &parentThinnedAssociationsHelper, std::map< BranchID, bool > &keepAssociation)
static void setThrowAnException(bool v)
void process(EventPrincipal const &e)
ProductSelectorRules productSelectorRules_
StreamID streamID() const
edm::propagate_const< std::shared_ptr< eventsetup::EventSetupProvider > > esp_
std::vector< BranchDescription const * > allBranchDescriptions() const
edm::propagate_const< std::unique_ptr< ParameterSet > > processParameterSet_
BranchID const & branchID() const
TypeWithDict const & unwrappedType() const
RunAuxiliary const & aux() const
void keepThisBranch(BranchDescription const &desc, std::map< BranchID, BranchDescription const * > &trueBranchIDToKeptBranchDesc, std::set< BranchID > &keptProductsInEvent)
ProductData const & productData() const
ProductProvenanceRetriever const * productProvenanceRetrieverPtr() const
void beginLuminosityBlock(LuminosityBlockPrincipal const &lb, IOVSyncValue const &ts)
void setProcessConfiguration(ProcessConfiguration const *processConfiguration)
EventPrincipal & eventPrincipal(unsigned int iStreamIndex) const
std::unique_ptr< ExceptionToActionTable const > act_table_
void setProcessHistoryRegistry(ProcessHistoryRegistry const &phr)
DelayedReader * reader() const
void doEndRun(RunPrincipal const &principal, IOVSyncValue const &ts, bool cleaningUpAfterException)
std::shared_ptr< ProcessConfiguration const > processConfiguration() const
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
ProductSelector productSelector_
unsigned int value() const
detail::TriggerResultsBasedEventSelector selectors_
void doStreamBeginLuminosityBlock(unsigned int iID, LuminosityBlockPrincipal const &principal, IOVSyncValue const &ts)
ServiceToken initServices(std::vector< ParameterSet > &servicePSets, ParameterSet &processPSet, ServiceToken const &iToken, serviceregistry::ServiceLegacy iLegacy, bool associate)
void doStreamEndRun(unsigned int iID, RunPrincipal const &principal, IOVSyncValue const &ts, bool cleaningUpAfterException)
void clearEventPrincipal()
void connectToSubProcess(ActivityRegistry &iOther)
std::map< ProcessHistoryID, ProcessHistoryID > parentToChildPhID_
void deleteRun(ProcessHistoryID const &phid, RunNumber_t run)
std::shared_ptr< ActivityRegistry > actReg_
void deleteLumiFromCache(ProcessHistoryID const &parentPhID, int runNumber, int lumiNumber)
ServiceToken addCPRandTNS(ParameterSet const ¶meterSet, ServiceToken const &token)
edm::propagate_const< std::shared_ptr< BranchIDListHelper > > branchIDListHelper_
std::shared_ptr< RunPrincipal > const & runPrincipalPtr(ProcessHistoryID const &phid, RunNumber_t run) const
void endRun(RunPrincipal const &r, IOVSyncValue const &ts, bool cleaningUpAfterException)
bool anyProductProduced() const
bool wantEvent(EventPrincipal const &e, ModuleCallingContext const *)
std::vector< HistoryAppender > historyAppenders_
std::vector< BranchID::value_type > BranchIDList
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
void endLuminosityBlock(LuminosityBlockPrincipal const &lb, IOVSyncValue const &ts, bool cleaningUpAfterException)
std::vector< std::string > const & getAllTriggerNames()
void initialize(ProductSelectorRules const &rules, std::vector< BranchDescription const * > const &branchDescriptions)
std::vector< BranchDescription const * > SelectedProducts
void propagateProducts(BranchType type, Principal const &parentPrincipal, Principal &principal) const
void doBeginStream(unsigned int)
bool hasSubProcesses() const
unsigned int numberOfStreams() const
std::shared_ptr< SignallingProductRegistry const > preg() const
std::shared_ptr< LuminosityBlockPrincipal > const & lumiPrincipalPtr(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi) const
void fixBranchIDListsForEDAliases(std::map< BranchID::value_type, BranchID::value_type > const &droppedBranchIDToKeptBranchID)
ProcessContext processContext_
void writeRun(ProcessHistoryID const &parentPhID, int runNumber)
BranchID const & originalBranchID() const
void call(std::function< void(void)>)
std::shared_ptr< BranchIDListHelper const > branchIDListHelper() const
ParameterSetID registerProperSelectionInfo(edm::ParameterSet const &iInitial, std::string const &iLabel, std::map< std::string, std::vector< std::pair< std::string, int > > > const &outputModulePathPositions, bool anyProductProduced)
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper() const
SubProcess(ParameterSet ¶meterSet, ParameterSet const &topLevelParameterSet, std::shared_ptr< ProductRegistry const > parentProductRegistry, std::shared_ptr< BranchIDListHelper const > parentBranchIDListHelper, ThinnedAssociationsHelper const &parentThinnedAssociationsHelper, eventsetup::EventSetupsController &esController, ActivityRegistry &parentActReg, ServiceToken const &token, serviceregistry::ServiceLegacy iLegacy, PreallocationConfiguration const &preallocConfig, ProcessContext const *parentProcessContext)
EventAuxiliary const & aux() const
void connectTo(ProductData const &iOther)
bool configureEventSelector(edm::ParameterSet const &iPSet, std::string const &iProcessName, std::vector< std::string > const &iAllTriggerNames, edm::detail::TriggerResultsBasedEventSelector &oSelector)
ParameterSet const & registerIt()
std::shared_ptr< ProductRegistry const > preg_
PrincipalCache principalCache_
ParameterSet const & parameterSet(Provenance const &provenance)
void doStreamBeginRun(unsigned int iID, RunPrincipal const &principal, IOVSyncValue const &ts)
void doEndLuminosityBlock(LuminosityBlockPrincipal const &principal, IOVSyncValue const &ts, bool cleaningUpAfterException)
static void checkForDuplicateKeptBranch(BranchDescription const &desc, std::map< BranchID, BranchDescription const * > &trueBranchIDToKeptBranchDesc)
std::shared_ptr< ProcessConfiguration const > processConfiguration_
RunPrincipal & runPrincipal(ProcessHistoryID const &phid, RunNumber_t run) const
bool productUnavailable() const