CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
edm::one::OutputModuleBase Class Referenceabstract

#include <OutputModuleBase.h>

Inheritance diagram for edm::one::OutputModuleBase:
edm::EDConsumerBase edm::one::OutputModule< T > edm::one::outputmodule::InputFileWatcher edm::one::outputmodule::LuminosityBlockCacheHolder< C > edm::one::outputmodule::LuminosityBlockWatcher edm::one::outputmodule::RunCacheHolder< C > edm::one::outputmodule::RunWatcher edm::one::OutputModule< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks > edm::one::OutputModule< one::WatchRuns, one::WatchLuminosityBlocks > edm::one::OutputModule< WatchInputFiles > edm::one::OutputModule<>

Public Types

typedef OutputModuleBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

BranchIDLists const * branchIDLists ()
 
virtual SerialTaskQueueglobalLuminosityBlocksQueue ()
 
virtual SerialTaskQueueglobalRunsQueue ()
 
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch () const
 
SelectedProductsForBranchType const & keptProducts () const
 
int maxEvents () const
 
const ModuleDescriptionmoduleDescription () const
 
OutputModuleBaseoperator= (OutputModuleBase const &)=delete
 
 OutputModuleBase (ParameterSet const &pset)
 
 OutputModuleBase (OutputModuleBase const &)=delete
 
std::string const & processName () const
 
int remainingEvents () const
 
bool selected (BranchDescription const &desc) const
 
void selectProducts (ProductRegistry const &preg, ThinnedAssociationsHelper const &)
 
SharedResourcesAcquirersharedResourcesAcquirer ()
 
SubProcessParentageHelper const * subProcessParentageHelper () const
 
ThinnedAssociationsHelper const * thinnedAssociationsHelper () const
 
bool wantAllEvents () const
 
virtual bool wantsGlobalLuminosityBlocks () const =0
 
virtual bool wantsGlobalRuns () const =0
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~OutputModuleBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static const std::string & baseType ()
 
static void fillDescription (ParameterSetDescription &desc)
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Protected Member Functions

void configure (OutputModuleDescription const &desc)
 
ModuleDescription const & description () const
 
void doBeginJob ()
 
bool doBeginLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)
 
bool doBeginRun (RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)
 
bool doEndRun (RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
 
bool doEvent (EventPrincipal const &ep, EventSetupImpl const &c, ActivityRegistry *, ModuleCallingContext const *)
 
void doPreallocate (PreallocationConfiguration const &)
 
std::map< BranchID::value_type, BranchID::value_type > const & droppedBranchIDToKeptBranchID ()
 
virtual void preallocLumis (unsigned int)
 
ParameterSetID selectorConfig () const
 
void setEventSelectionInfo (std::map< std::string, std::vector< std::pair< std::string, int >>> const &outputModulePathPositions, bool anyProductProduced)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Member Functions

virtual void beginJob ()
 
virtual SharedResourcesAcquirer createAcquirer ()
 
virtual void doBeginLuminosityBlock_ (LuminosityBlockForOutput const &)
 
virtual void doBeginRun_ (RunForOutput const &)
 
void doCloseFile ()
 Tell the OutputModule that is must end the current file. More...
 
virtual void doEndLuminosityBlock_ (LuminosityBlockForOutput const &)
 
virtual void doEndRun_ (RunForOutput const &)
 
void doOpenFile (FileBlock const &fb)
 
void doRegisterThinnedAssociations (ProductRegistry const &, ThinnedAssociationsHelper &)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
virtual void doRespondToCloseInputFile_ (FileBlock const &)
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
virtual void doRespondToOpenInputFile_ (FileBlock const &)
 
void doWriteLuminosityBlock (LuminosityBlockPrincipal const &lbp, ModuleCallingContext const *)
 
void doWriteRun (RunPrincipal const &rp, ModuleCallingContext const *, MergeableRunProductMetadata const *)
 
virtual void endJob ()
 
bool hasAccumulator () const
 
bool hasAcquire () const
 
virtual bool isFileOpen () const
 
void keepThisBranch (BranchDescription const &desc, std::map< BranchID, BranchDescription const * > &trueBranchIDToKeptBranchDesc, std::set< BranchID > &keptProductsInEvent)
 
bool limitReached () const
 
bool needToRunSelection () const
 
virtual void openFile (FileBlock const &)
 
virtual void preActionBeforeRunEventAsync (WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
 
bool prePrefetchSelection (StreamID id, EventPrincipal const &, ModuleCallingContext const *)
 
std::vector< ProductResolverIndexAndSkipBitproductsUsedBySelection () const
 
virtual void reallyCloseFile ()
 
void registerProductsAndCallbacks (OutputModuleBase const *, ProductRegistry const *)
 
void setModuleDescription (ModuleDescription const &md)
 
virtual void setProcessesWithSelectedMergeableRunProducts (std::set< std::string > const &)
 
virtual bool shouldWeCloseFile () const
 Ask the OutputModule if we should end the current file. More...
 
std::string workerType () const
 
virtual void write (EventForOutput const &)=0
 
virtual void writeLuminosityBlock (LuminosityBlockForOutput const &)=0
 
virtual void writeRun (RunForOutput const &)=0
 

Private Attributes

edm::propagate_const< std::unique_ptr< BranchIDLists > > branchIDLists_
 
std::map< BranchID::value_type, BranchID::value_typedroppedBranchIDToKeptBranchID_
 
std::array< bool, NumBranchTypeshasNewlyDroppedBranch_
 
std::map< BranchID, bool > keepAssociation_
 
SelectedProductsForBranchType keptProducts_
 
SerialTaskQueue luminosityBlockQueue_
 
int maxEvents_
 
ModuleDescription moduleDescription_
 
BranchIDLists const * origBranchIDLists_
 
std::string process_name_
 
ProductSelector productSelector_
 
ProductSelectorRules productSelectorRules_
 
std::atomic< int > remainingEvents_
 
SharedResourcesAcquirer resourcesAcquirer_
 
SerialTaskQueue runQueue_
 
ParameterSet selectEvents_
 
ParameterSetID selector_config_id_
 
std::vector< detail::TriggerResultsBasedEventSelectorselectors_
 
SubProcessParentageHelper const * subProcessParentageHelper_
 
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
 
bool wantAllEvents_
 

Friends

template<typename T >
class ::edm::OutputModuleCommunicatorT
 
template<typename T >
class ::edm::WorkerT
 
template<typename U >
class edm::maker::ModuleHolderT
 

Detailed Description

Definition at line 68 of file OutputModuleBase.h.

Member Typedef Documentation

Definition at line 76 of file OutputModuleBase.h.

Constructor & Destructor Documentation

OutputModuleBase::OutputModuleBase ( ParameterSet const &  pset)
explicit

Definition at line 45 of file OutputModuleBase.cc.

References edm::detail::configureEventSelector(), edm::EDConsumerBase::consumesCollector(), edm::getAllTriggerNames(), edm::ParameterSet::getUntrackedParameterSet(), hasNewlyDroppedBranch_, edm::ParameterSet::id(), process_name_, edm::ParameterSet::registerIt(), selectEvents_, selector_config_id_, selectors_, and wantAllEvents_.

46  : maxEvents_(-1),
48  keptProducts_(),
50  process_name_(),
51  productSelectorRules_(pset, "outputCommands", "OutputModule"),
54  wantAllEvents_(false),
55  selectors_(),
59  origBranchIDLists_(nullptr),
60  thinnedAssociationsHelper_(new ThinnedAssociationsHelper) {
61  hasNewlyDroppedBranch_.fill(false);
62 
64  process_name_ = tns->getProcessName();
65 
66  selectEvents_ = pset.getUntrackedParameterSet("SelectEvents", ParameterSet());
67 
68  selectEvents_.registerIt(); // Just in case this PSet is not registered
69 
71 
72  //need to set wantAllEvents_ in constructor
73  // we will make the remaining selectors once we know how many streams
74  selectors_.resize(1);
77  }
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
SelectedProductsForBranchType keptProducts_
ModuleDescription moduleDescription_
ParameterSetID id() const
ProductSelectorRules productSelectorRules_
std::atomic< int > remainingEvents_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
bool configureEventSelector(edm::ParameterSet const &iPSet, std::string const &iProcessName, std::vector< std::string > const &iAllTriggerNames, edm::detail::TriggerResultsBasedEventSelector &oSelector, ConsumesCollector &&iC)
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
std::vector< std::string > const & getAllTriggerNames()
BranchIDLists const * origBranchIDLists_
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
ProductSelector productSelector_
ParameterSet const & registerIt()
ParameterSetID selector_config_id_
edm::propagate_const< std::unique_ptr< BranchIDLists > > branchIDLists_
OutputModuleBase::~OutputModuleBase ( )
override

Definition at line 181 of file OutputModuleBase.cc.

181 {}
edm::one::OutputModuleBase::OutputModuleBase ( OutputModuleBase const &  )
delete

Member Function Documentation

const std::string & OutputModuleBase::baseType ( )
static

Definition at line 358 of file OutputModuleBase.cc.

References edm::one::kBaseType().

358 { return kBaseType; }
static const std::string kBaseType("EDAnalyzer")
virtual void edm::one::OutputModuleBase::beginJob ( void  )
inlineprivatevirtual
BranchIDLists const * OutputModuleBase::branchIDLists ( )

Definition at line 316 of file OutputModuleBase.cc.

References branchIDLists_, droppedBranchIDToKeptBranchID_, and origBranchIDLists_.

Referenced by edm::StreamerOutputModuleBase::beginRun(), and evf::EvFOutputModule::beginRun().

316  {
317  if (!droppedBranchIDToKeptBranchID_.empty()) {
318  // Make a private copy of the BranchIDLists.
320  // Check for branches dropped while an EDAlias was kept.
321  for (BranchIDList& branchIDList : *branchIDLists_) {
322  for (BranchID::value_type& branchID : branchIDList) {
323  // Replace BranchID of each dropped branch with that of the kept alias, so the alias branch will have the product ID of the original branch.
324  std::map<BranchID::value_type, BranchID::value_type>::const_iterator iter =
325  droppedBranchIDToKeptBranchID_.find(branchID);
326  if (iter != droppedBranchIDToKeptBranchID_.end()) {
327  branchID = iter->second;
328  }
329  }
330  }
331  return branchIDLists_.get();
332  }
333  return origBranchIDLists_;
334  }
unsigned int value_type
Definition: BranchID.h:16
std::vector< BranchID::value_type > BranchIDList
Definition: BranchIDList.h:18
BranchIDLists const * origBranchIDLists_
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
edm::propagate_const< std::unique_ptr< BranchIDLists > > branchIDLists_
void OutputModuleBase::configure ( OutputModuleDescription const &  desc)
protected
SharedResourcesAcquirer OutputModuleBase::createAcquirer ( )
privatevirtual

Definition at line 183 of file OutputModuleBase.cc.

Referenced by doBeginJob().

183  {
185  std::vector<std::shared_ptr<SerialTaskQueue>>(1, std::make_shared<SerialTaskQueue>())};
186  }
ModuleDescription const & OutputModuleBase::description ( ) const
protected
void OutputModuleBase::doBeginJob ( )
protected

Definition at line 206 of file OutputModuleBase.cc.

References beginJob(), createAcquirer(), and resourcesAcquirer_.

206  {
208  this->beginJob();
209  }
SharedResourcesAcquirer resourcesAcquirer_
virtual SharedResourcesAcquirer createAcquirer()
bool OutputModuleBase::doBeginLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetupImpl const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 276 of file OutputModuleBase.cc.

References doBeginLuminosityBlock_(), moduleDescription_, and edm::OccurrenceForOutput::setConsumer().

278  {
279  LuminosityBlockForOutput lb(lbp, moduleDescription_, mcc, false);
280  lb.setConsumer(this);
282  return true;
283  }
ModuleDescription moduleDescription_
virtual void doBeginLuminosityBlock_(LuminosityBlockForOutput const &)
virtual void edm::one::OutputModuleBase::doBeginLuminosityBlock_ ( LuminosityBlockForOutput const &  )
inlineprivatevirtual
bool OutputModuleBase::doBeginRun ( RunPrincipal const &  rp,
EventSetupImpl const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 254 of file OutputModuleBase.cc.

References doBeginRun_(), moduleDescription_, alignCSCRings::r, and edm::OccurrenceForOutput::setConsumer().

254  {
255  RunForOutput r(rp, moduleDescription_, mcc, false);
256  r.setConsumer(this);
257  doBeginRun_(r);
258  return true;
259  }
ModuleDescription moduleDescription_
virtual void doBeginRun_(RunForOutput const &)
virtual void edm::one::OutputModuleBase::doBeginRun_ ( RunForOutput const &  )
inlineprivatevirtual

Reimplemented in edm::one::outputmodule::RunCacheHolder< C >, and edm::one::outputmodule::RunWatcher.

Definition at line 246 of file OutputModuleBase.h.

Referenced by doBeginRun().

246 {}
void OutputModuleBase::doCloseFile ( )
private

Tell the OutputModule that is must end the current file.

Definition at line 308 of file OutputModuleBase.cc.

References isFileOpen(), and reallyCloseFile().

308  {
309  if (isFileOpen()) {
310  reallyCloseFile();
311  }
312  }
virtual bool isFileOpen() const
void OutputModuleBase::doEndJob ( )
protected

Definition at line 211 of file OutputModuleBase.cc.

References endJob().

211 { endJob(); }
bool OutputModuleBase::doEndLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetupImpl const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 285 of file OutputModuleBase.cc.

References doEndLuminosityBlock_(), moduleDescription_, and edm::OccurrenceForOutput::setConsumer().

287  {
288  LuminosityBlockForOutput lb(lbp, moduleDescription_, mcc, true);
289  lb.setConsumer(this);
291 
292  return true;
293  }
ModuleDescription moduleDescription_
virtual void doEndLuminosityBlock_(LuminosityBlockForOutput const &)
virtual void edm::one::OutputModuleBase::doEndLuminosityBlock_ ( LuminosityBlockForOutput const &  )
inlineprivatevirtual
bool OutputModuleBase::doEndRun ( RunPrincipal const &  rp,
EventSetupImpl const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 261 of file OutputModuleBase.cc.

References doEndRun_(), moduleDescription_, alignCSCRings::r, and edm::OccurrenceForOutput::setConsumer().

261  {
262  RunForOutput r(rp, moduleDescription_, mcc, true);
263  r.setConsumer(this);
264  doEndRun_(r);
265  return true;
266  }
ModuleDescription moduleDescription_
virtual void doEndRun_(RunForOutput const &)
virtual void edm::one::OutputModuleBase::doEndRun_ ( RunForOutput const &  )
inlineprivatevirtual

Reimplemented in edm::one::outputmodule::RunCacheHolder< C >, and edm::one::outputmodule::RunWatcher.

Definition at line 247 of file OutputModuleBase.h.

Referenced by doEndRun().

247 {}
bool OutputModuleBase::doEvent ( EventPrincipal const &  ep,
EventSetupImpl const &  c,
ActivityRegistry act,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 238 of file OutputModuleBase.cc.

References MillePedeFileConverter_cfg::e, moduleDescription_, remainingEvents_, edm::OccurrenceForOutput::setConsumer(), and write().

241  {
242  {
244  e.setConsumer(this);
245  EventSignalsSentry sentry(act, mcc);
246  write(e);
247  }
248  if (remainingEvents_ > 0) {
250  }
251  return true;
252  }
ModuleDescription moduleDescription_
virtual void write(EventForOutput const &)=0
std::atomic< int > remainingEvents_
void OutputModuleBase::doOpenFile ( FileBlock const &  fb)
private

Definition at line 302 of file OutputModuleBase.cc.

References openFile().

302 { openFile(fb); }
virtual void openFile(FileBlock const &)
void OutputModuleBase::doPreallocate ( PreallocationConfiguration const &  iPC)
protected

Definition at line 188 of file OutputModuleBase.cc.

References edm::detail::configureEventSelector(), edm::EDConsumerBase::consumesCollector(), edm::getAllTriggerNames(), edm::PreallocationConfiguration::numberOfLuminosityBlocks(), edm::PreallocationConfiguration::numberOfStreams(), preallocLumis(), process_name_, alignCSCRings::s, selectEvents_, and selectors_.

188  {
189  auto nstreams = iPC.numberOfStreams();
190  selectors_.resize(nstreams);
191 
192  preallocLumis(iPC.numberOfLuminosityBlocks());
193 
194  bool seenFirst = false;
195  for (auto& s : selectors_) {
196  if (seenFirst) {
198  } else {
199  seenFirst = true;
200  }
201  }
202  }
virtual void preallocLumis(unsigned int)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
bool configureEventSelector(edm::ParameterSet const &iPSet, std::string const &iProcessName, std::vector< std::string > const &iAllTriggerNames, edm::detail::TriggerResultsBasedEventSelector &oSelector, ConsumesCollector &&iC)
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
std::vector< std::string > const & getAllTriggerNames()
void edm::one::OutputModuleBase::doRegisterThinnedAssociations ( ProductRegistry const &  ,
ThinnedAssociationsHelper  
)
inlineprivate

Definition at line 214 of file OutputModuleBase.h.

214 {}
void OutputModuleBase::doRespondToCloseInputFile ( FileBlock const &  fb)
private

Definition at line 306 of file OutputModuleBase.cc.

References doRespondToCloseInputFile_().

virtual void doRespondToCloseInputFile_(FileBlock const &)
virtual void edm::one::OutputModuleBase::doRespondToCloseInputFile_ ( FileBlock const &  )
inlineprivatevirtual
void OutputModuleBase::doRespondToOpenInputFile ( FileBlock const &  fb)
private

Definition at line 304 of file OutputModuleBase.cc.

References doRespondToOpenInputFile_().

virtual void doRespondToOpenInputFile_(FileBlock const &)
virtual void edm::one::OutputModuleBase::doRespondToOpenInputFile_ ( FileBlock const &  )
inlineprivatevirtual
void OutputModuleBase::doWriteLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
ModuleCallingContext const *  mcc 
)
private

Definition at line 295 of file OutputModuleBase.cc.

References moduleDescription_, edm::OccurrenceForOutput::setConsumer(), and writeLuminosityBlock().

296  {
297  LuminosityBlockForOutput lb(lbp, moduleDescription_, mcc, true);
298  lb.setConsumer(this);
300  }
ModuleDescription moduleDescription_
virtual void writeLuminosityBlock(LuminosityBlockForOutput const &)=0
void OutputModuleBase::doWriteRun ( RunPrincipal const &  rp,
ModuleCallingContext const *  mcc,
MergeableRunProductMetadata const *  mrpm 
)
private

Definition at line 268 of file OutputModuleBase.cc.

References moduleDescription_, alignCSCRings::r, edm::OccurrenceForOutput::setConsumer(), and writeRun().

270  {
271  RunForOutput r(rp, moduleDescription_, mcc, true, mrpm);
272  r.setConsumer(this);
273  writeRun(r);
274  }
ModuleDescription moduleDescription_
virtual void writeRun(RunForOutput const &)=0
std::map<BranchID::value_type, BranchID::value_type> const& edm::one::OutputModuleBase::droppedBranchIDToKeptBranchID ( )
inlineprotected

Definition at line 150 of file OutputModuleBase.h.

150  {
152  }
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
virtual void edm::one::OutputModuleBase::endJob ( void  )
inlineprivatevirtual

Reimplemented in edm::StreamerOutputModuleBase.

Definition at line 240 of file OutputModuleBase.h.

Referenced by doEndJob().

240 {}
void OutputModuleBase::fillDescription ( ParameterSetDescription desc)
static

Definition at line 350 of file OutputModuleBase.cc.

References edm::ProductSelectorRules::fillDescription(), and edm::EventSelector::fillDescription().

Referenced by evf::EvFOutputModule::fillDescriptions().

350  {
351  ProductSelectorRules::fillDescription(desc, "outputCommands");
353  }
static void fillDescription(ParameterSetDescription &desc, char const *parameterName, std::vector< std::string > const &defaultStrings=defaultSelectionStrings())
static void fillDescription(ParameterSetDescription &desc)
void OutputModuleBase::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 344 of file OutputModuleBase.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

344  {
346  desc.setUnknown();
347  descriptions.addDefault(desc);
348  }
virtual SerialTaskQueue* edm::one::OutputModuleBase::globalLuminosityBlocksQueue ( )
inlinevirtual
virtual SerialTaskQueue* edm::one::OutputModuleBase::globalRunsQueue ( )
inlinevirtual
bool edm::one::OutputModuleBase::hasAccumulator ( ) const
inlineprivate

Definition at line 256 of file OutputModuleBase.h.

256 { return false; }
bool edm::one::OutputModuleBase::hasAcquire ( ) const
inlineprivate

Definition at line 255 of file OutputModuleBase.h.

255 { return false; }
std::array<bool, NumBranchTypes> const& edm::one::OutputModuleBase::hasNewlyDroppedBranch ( ) const
inline

Definition at line 97 of file OutputModuleBase.h.

References fillDescriptions(), and AlCaHLTBitMon_QueryRunRegistry::string.

97 { return hasNewlyDroppedBranch_; }
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
virtual bool edm::one::OutputModuleBase::isFileOpen ( ) const
inlineprivatevirtual

Reimplemented in DQMRootOutputModule, edm::PoolOutputModule, and NanoAODOutputModule.

Definition at line 244 of file OutputModuleBase.h.

Referenced by doCloseFile().

244 { return true; }
void OutputModuleBase::keepThisBranch ( BranchDescription const &  desc,
std::map< BranchID, BranchDescription const * > &  trueBranchIDToKeptBranchDesc,
std::set< BranchID > &  keptProductsInEvent 
)
private

Definition at line 139 of file OutputModuleBase.cc.

References edm::BranchDescription::branchID(), edm::BranchDescription::branchType(), edm::checkDictionary(), edm::ProductSelector::checkForDuplicateKeptBranch(), edm::BranchDescription::className(), edm::EDConsumerBase::consumes(), edm::InEvent, edm::InLumi, edm::InRun, keptProducts_, edm::BranchDescription::moduleLabel(), edm::BranchDescription::originalBranchID(), edm::BranchDescription::processName(), edm::BranchDescription::produced(), edm::PRODUCT_TYPE, edm::BranchDescription::productInstanceName(), AlCaHLTBitMon_QueryRunRegistry::string, edm::throwMissingDictionariesException(), edm::BranchDescription::unwrappedType(), and edm::BranchDescription::unwrappedTypeID().

Referenced by selectProducts().

141  {
142  ProductSelector::checkForDuplicateKeptBranch(desc, trueBranchIDToKeptBranchDesc);
143 
144  EDGetToken token;
145 
146  std::vector<std::string> missingDictionaries;
147  if (!checkDictionary(missingDictionaries, desc.className(), desc.unwrappedType())) {
148  std::string context("Calling OutputModuleBase::keepThisBranch, checking dictionaries for kept types");
149  throwMissingDictionariesException(missingDictionaries, context);
150  }
151 
152  switch (desc.branchType()) {
153  case InEvent: {
154  if (desc.produced()) {
155  keptProductsInEvent.insert(desc.originalBranchID());
156  } else {
157  keptProductsInEvent.insert(desc.branchID());
158  }
159  token = consumes(TypeToGet{desc.unwrappedTypeID(), PRODUCT_TYPE},
160  InputTag{desc.moduleLabel(), desc.productInstanceName(), desc.processName()});
161  break;
162  }
163  case InLumi: {
164  token = consumes<InLumi>(TypeToGet{desc.unwrappedTypeID(), PRODUCT_TYPE},
165  InputTag(desc.moduleLabel(), desc.productInstanceName(), desc.processName()));
166  break;
167  }
168  case InRun: {
169  token = consumes<InRun>(TypeToGet{desc.unwrappedTypeID(), PRODUCT_TYPE},
170  InputTag(desc.moduleLabel(), desc.productInstanceName(), desc.processName()));
171  break;
172  }
173  default:
174  assert(false);
175  break;
176  }
177  // Now put it in the list of selected branches.
178  keptProducts_[desc.branchType()].push_back(std::make_pair(&desc, token));
179  }
void throwMissingDictionariesException(std::vector< std::string > &missingDictionaries, std::string const &context)
SelectedProductsForBranchType keptProducts_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
bool checkDictionary(std::vector< std::string > &missingDictionaries, TypeID const &typeID)
static void checkForDuplicateKeptBranch(BranchDescription const &desc, std::map< BranchID, BranchDescription const * > &trueBranchIDToKeptBranchDesc)
SelectedProductsForBranchType const& edm::one::OutputModuleBase::keptProducts ( ) const
inline
bool edm::one::OutputModuleBase::limitReached ( ) const
inlineprivate

Definition at line 264 of file OutputModuleBase.h.

264 { return remainingEvents_ == 0; }
std::atomic< int > remainingEvents_
int edm::one::OutputModuleBase::maxEvents ( ) const
inline

Accessor for maximum number of events to be written. -1 is used for unlimited.

Definition at line 86 of file OutputModuleBase.h.

const ModuleDescription& edm::one::OutputModuleBase::moduleDescription ( ) const
inline
bool OutputModuleBase::needToRunSelection ( ) const
private

Definition at line 213 of file OutputModuleBase.cc.

References wantAllEvents_.

virtual void edm::one::OutputModuleBase::openFile ( FileBlock const &  )
inlineprivatevirtual
OutputModuleBase& edm::one::OutputModuleBase::operator= ( OutputModuleBase const &  )
delete
virtual void edm::one::OutputModuleBase::preActionBeforeRunEventAsync ( WaitingTask iTask,
ModuleCallingContext const &  iModuleCallingContext,
Principal const &  iPrincipal 
) const
inlineprivatevirtual

Reimplemented in edm::PoolOutputModule.

Definition at line 235 of file OutputModuleBase.h.

237  {}
void OutputModuleBase::preallocLumis ( unsigned int  )
protectedvirtual

Reimplemented in edm::one::outputmodule::LuminosityBlockCacheHolder< C >.

Definition at line 204 of file OutputModuleBase.cc.

Referenced by doPreallocate().

204 {}
bool OutputModuleBase::prePrefetchSelection ( StreamID  id,
EventPrincipal const &  ep,
ModuleCallingContext const *  mcc 
)
private

Definition at line 227 of file OutputModuleBase.cc.

References MillePedeFileConverter_cfg::e, moduleDescription_, alignCSCRings::s, selectors_, edm::OccurrenceForOutput::setConsumer(), and wantAllEvents_.

229  {
230  if (wantAllEvents_)
231  return true;
232  auto& s = selectors_[id.value()];
234  e.setConsumer(this);
235  return s.wantEvent(e);
236  }
ModuleDescription moduleDescription_
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
void OutputModuleBase::prevalidate ( ConfigurationDescriptions )
static

Definition at line 355 of file OutputModuleBase.cc.

References edm::one::kBaseType(), and AlCaHLTBitMon_QueryRunRegistry::string.

355 {}
std::string const& edm::one::OutputModuleBase::processName ( ) const
inline

Definition at line 95 of file OutputModuleBase.h.

Referenced by DQMRootOutputModule::startEndFile().

95 { return process_name_; }
std::vector< ProductResolverIndexAndSkipBit > OutputModuleBase::productsUsedBySelection ( ) const
private

Definition at line 215 of file OutputModuleBase.cc.

References mps_fire::i, gen::n, alignCSCRings::s, selectors_, and edm::EDConsumerBase::uncheckedIndexFrom().

215  {
216  std::vector<ProductResolverIndexAndSkipBit> returnValue;
217  auto const& s = selectors_[0];
218  auto const n = s.numberOfTokens();
219  returnValue.reserve(n);
220 
221  for (unsigned int i = 0; i < n; ++i) {
222  returnValue.emplace_back(uncheckedIndexFrom(s.token(i)));
223  }
224  return returnValue;
225  }
ProductResolverIndexAndSkipBit uncheckedIndexFrom(EDGetToken) const
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
void OutputModuleBase::reallyCloseFile ( )
privatevirtual

Reimplemented in DQMRootOutputModule, edm::PoolOutputModule, and NanoAODOutputModule.

Definition at line 314 of file OutputModuleBase.cc.

Referenced by doCloseFile().

314 {}
void edm::one::OutputModuleBase::registerProductsAndCallbacks ( OutputModuleBase const *  ,
ProductRegistry const *   
)
inlineprivate

Definition at line 221 of file OutputModuleBase.h.

221 {}
int edm::one::OutputModuleBase::remainingEvents ( ) const
inline

Accessor for remaining number of events to be written. -1 is used for unlimited.

Definition at line 90 of file OutputModuleBase.h.

Referenced by edm::PoolOutputModule::beginInputFile().

90 { return remainingEvents_; }
std::atomic< int > remainingEvents_
bool OutputModuleBase::selected ( BranchDescription const &  desc) const

Definition at line 342 of file OutputModuleBase.cc.

References productSelector_, and edm::ProductSelector::selected().

Referenced by selectProducts().

342 { return productSelector_.selected(desc); }
bool selected(BranchDescription const &desc) const
ProductSelector productSelector_
ParameterSetID edm::one::OutputModuleBase::selectorConfig ( ) const
inlineprotected
void OutputModuleBase::selectProducts ( ProductRegistry const &  preg,
ThinnedAssociationsHelper const &  thinnedAssociationsHelper 
)

Definition at line 85 of file OutputModuleBase.cc.

References edm::ProductRegistry::allBranchDescriptions(), TrackValidation_cff::association, edm::BranchDescription::branchType(), droppedBranchIDToKeptBranchID_, edm::ProductSelector::fillDroppedToKept(), hasNewlyDroppedBranch_, edm::ProductSelector::initialize(), edm::ProductSelector::initialized(), edm::insertSelectedProcesses(), keepAssociation_, keepThisBranch(), edm::BranchDescription::present(), edm::BranchDescription::produced(), edm::ProductRegistry::productList(), productSelector_, productSelectorRules_, edm::ThinnedAssociationsHelper::selectAssociationProducts(), selected(), setProcessesWithSelectedMergeableRunProducts(), thinnedAssociationsHelper_, edm::BranchDescription::transient(), and edm::BranchDescription::unwrappedType().

86  {
88  return;
89  productSelector_.initialize(productSelectorRules_, preg.allBranchDescriptions());
90 
91  // TODO: See if we can collapse keptProducts_ and productSelector_ into a
92  // single object. See the notes in the header for ProductSelector
93  // for more information.
94 
95  std::map<BranchID, BranchDescription const*> trueBranchIDToKeptBranchDesc;
96  std::vector<BranchDescription const*> associationDescriptions;
97  std::set<BranchID> keptProductsInEvent;
98  std::set<std::string> processesWithSelectedMergeableRunProducts;
99 
100  for (auto const& it : preg.productList()) {
101  BranchDescription const& desc = it.second;
102  if (desc.transient()) {
103  // if the class of the branch is marked transient, output nothing
104  } else if (!desc.present() && !desc.produced()) {
105  // else if the branch containing the product has been previously dropped,
106  // output nothing
107  } else if (desc.unwrappedType() == typeid(ThinnedAssociation)) {
108  associationDescriptions.push_back(&desc);
109  } else if (selected(desc)) {
110  keepThisBranch(desc, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
111  insertSelectedProcesses(desc, processesWithSelectedMergeableRunProducts);
112  } else {
113  // otherwise, output nothing,
114  // and mark the fact that there is a newly dropped branch of this type.
115  hasNewlyDroppedBranch_[desc.branchType()] = true;
116  }
117  }
118 
119  setProcessesWithSelectedMergeableRunProducts(processesWithSelectedMergeableRunProducts);
120 
122  associationDescriptions, keptProductsInEvent, keepAssociation_);
123 
124  for (auto association : associationDescriptions) {
125  if (keepAssociation_[association->branchID()]) {
126  keepThisBranch(*association, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
127  } else {
128  hasNewlyDroppedBranch_[association->branchType()] = true;
129  }
130  }
131 
132  // Now fill in a mapping needed in the case that a branch was dropped while its EDAlias was kept.
133  ProductSelector::fillDroppedToKept(preg, trueBranchIDToKeptBranchDesc, droppedBranchIDToKeptBranchID_);
134 
135  thinnedAssociationsHelper_->updateFromParentProcess(
137  }
ThinnedAssociationsHelper const * thinnedAssociationsHelper() const
static void fillDroppedToKept(ProductRegistry const &preg, std::map< BranchID, BranchDescription const * > const &trueBranchIDToKeptBranchDesc, std::map< BranchID::value_type, BranchID::value_type > &droppedBranchIDToKeptBranchID_)
void keepThisBranch(BranchDescription const &desc, std::map< BranchID, BranchDescription const * > &trueBranchIDToKeptBranchDesc, std::set< BranchID > &keptProductsInEvent)
ProductSelectorRules productSelectorRules_
void selectAssociationProducts(std::vector< BranchDescription const * > const &associationDescriptions, std::set< BranchID > const &keptProductsInEvent, std::map< BranchID, bool > &keepAssociation) const
bool selected(BranchDescription const &desc) const
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
bool initialized() const
void initialize(ProductSelectorRules const &rules, std::vector< BranchDescription const * > const &branchDescriptions)
void insertSelectedProcesses(BranchDescription const &desc, std::set< std::string > &processes)
virtual void setProcessesWithSelectedMergeableRunProducts(std::set< std::string > const &)
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
ProductSelector productSelector_
std::map< BranchID, bool > keepAssociation_
void OutputModuleBase::setEventSelectionInfo ( std::map< std::string, std::vector< std::pair< std::string, int >>> const &  outputModulePathPositions,
bool  anyProductProduced 
)
protected

Definition at line 360 of file OutputModuleBase.cc.

References description(), edm::getParameterSet(), edm::detail::registerProperSelectionInfo(), and selector_config_id_.

362  {
364  description().moduleLabel(),
365  outputModulePathPositions,
366  anyProductProduced);
367  }
ModuleDescription const & description() const
ParameterSet const & getParameterSet(ParameterSetID const &id)
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)
ParameterSetID selector_config_id_
void edm::one::OutputModuleBase::setModuleDescription ( ModuleDescription const &  md)
inlineprivate

Definition at line 262 of file OutputModuleBase.h.

262 { moduleDescription_ = md; }
ModuleDescription moduleDescription_
virtual void edm::one::OutputModuleBase::setProcessesWithSelectedMergeableRunProducts ( std::set< std::string > const &  )
inlineprivatevirtual

Reimplemented in edm::PoolOutputModule.

Definition at line 253 of file OutputModuleBase.h.

Referenced by selectProducts().

253 {}
SharedResourcesAcquirer& edm::one::OutputModuleBase::sharedResourcesAcquirer ( )
inline

Definition at line 112 of file OutputModuleBase.h.

112 { return resourcesAcquirer_; }
SharedResourcesAcquirer resourcesAcquirer_
virtual bool edm::one::OutputModuleBase::shouldWeCloseFile ( ) const
inlineprivatevirtual

Ask the OutputModule if we should end the current file.

Reimplemented in edm::PoolOutputModule, and edm::TimeoutPoolOutputModule.

Definition at line 232 of file OutputModuleBase.h.

References TriggerAnalyzer::write().

232 { return false; }
SubProcessParentageHelper const* edm::one::OutputModuleBase::subProcessParentageHelper ( ) const
inline

Definition at line 120 of file OutputModuleBase.h.

Referenced by edm::PoolOutputModule::updateBranchParents().

120 { return subProcessParentageHelper_; }
SubProcessParentageHelper const * subProcessParentageHelper_
ThinnedAssociationsHelper const * OutputModuleBase::thinnedAssociationsHelper ( ) const

Definition at line 336 of file OutputModuleBase.cc.

References thinnedAssociationsHelper_.

Referenced by edm::StreamerOutputModuleBase::beginRun(), and evf::EvFOutputModule::beginRun().

336  {
337  return thinnedAssociationsHelper_.get();
338  }
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
bool edm::one::OutputModuleBase::wantAllEvents ( ) const
inline

Definition at line 114 of file OutputModuleBase.h.

Referenced by edm::PoolOutputModule::PoolOutputModule().

virtual bool edm::one::OutputModuleBase::wantsGlobalLuminosityBlocks ( ) const
pure virtual
virtual bool edm::one::OutputModuleBase::wantsGlobalRuns ( ) const
pure virtual
bool edm::one::OutputModuleBase::wantsStreamLuminosityBlocks ( ) const
inline

Definition at line 108 of file OutputModuleBase.h.

108 { return false; };
bool edm::one::OutputModuleBase::wantsStreamRuns ( ) const
inline

Definition at line 107 of file OutputModuleBase.h.

107 { return false; }
std::string edm::one::OutputModuleBase::workerType ( ) const
inlineprivate

Definition at line 216 of file OutputModuleBase.h.

216 { return "WorkerT<edm::one::OutputModuleBase>"; }
virtual void edm::one::OutputModuleBase::write ( EventForOutput const &  )
privatepure virtual
virtual void edm::one::OutputModuleBase::writeLuminosityBlock ( LuminosityBlockForOutput const &  )
privatepure virtual
virtual void edm::one::OutputModuleBase::writeRun ( RunForOutput const &  )
privatepure virtual

Friends And Related Function Documentation

template<typename T >
friend class ::edm::OutputModuleCommunicatorT
friend

Definition at line 75 of file OutputModuleBase.h.

template<typename T >
friend class ::edm::WorkerT
friend

Definition at line 73 of file OutputModuleBase.h.

template<typename U >
friend class edm::maker::ModuleHolderT
friend

Definition at line 71 of file OutputModuleBase.h.

Member Data Documentation

edm::propagate_const<std::unique_ptr<BranchIDLists> > edm::one::OutputModuleBase::branchIDLists_
private

Definition at line 191 of file OutputModuleBase.h.

Referenced by branchIDLists().

std::map<BranchID::value_type, BranchID::value_type> edm::one::OutputModuleBase::droppedBranchIDToKeptBranchID_
private

Definition at line 190 of file OutputModuleBase.h.

Referenced by branchIDLists(), and selectProducts().

std::array<bool, NumBranchTypes> edm::one::OutputModuleBase::hasNewlyDroppedBranch_
private

Definition at line 174 of file OutputModuleBase.h.

Referenced by OutputModuleBase(), and selectProducts().

std::map<BranchID, bool> edm::one::OutputModuleBase::keepAssociation_
private

Definition at line 197 of file OutputModuleBase.h.

Referenced by selectProducts().

SelectedProductsForBranchType edm::one::OutputModuleBase::keptProducts_
private

Definition at line 173 of file OutputModuleBase.h.

Referenced by keepThisBranch().

SerialTaskQueue edm::one::OutputModuleBase::luminosityBlockQueue_
private

Definition at line 201 of file OutputModuleBase.h.

int edm::one::OutputModuleBase::maxEvents_
private

Definition at line 155 of file OutputModuleBase.h.

Referenced by configure().

ModuleDescription edm::one::OutputModuleBase::moduleDescription_
private
BranchIDLists const* edm::one::OutputModuleBase::origBranchIDLists_
private

Definition at line 192 of file OutputModuleBase.h.

Referenced by branchIDLists(), and configure().

std::string edm::one::OutputModuleBase::process_name_
private

Definition at line 176 of file OutputModuleBase.h.

Referenced by doPreallocate(), and OutputModuleBase().

ProductSelector edm::one::OutputModuleBase::productSelector_
private

Definition at line 178 of file OutputModuleBase.h.

Referenced by selected(), and selectProducts().

ProductSelectorRules edm::one::OutputModuleBase::productSelectorRules_
private

Definition at line 177 of file OutputModuleBase.h.

Referenced by selectProducts().

std::atomic<int> edm::one::OutputModuleBase::remainingEvents_
private

Definition at line 156 of file OutputModuleBase.h.

Referenced by configure(), and doEvent().

SharedResourcesAcquirer edm::one::OutputModuleBase::resourcesAcquirer_
private

Definition at line 199 of file OutputModuleBase.h.

Referenced by doBeginJob().

SerialTaskQueue edm::one::OutputModuleBase::runQueue_
private

Definition at line 200 of file OutputModuleBase.h.

ParameterSet edm::one::OutputModuleBase::selectEvents_
private

Definition at line 183 of file OutputModuleBase.h.

Referenced by doPreallocate(), and OutputModuleBase().

ParameterSetID edm::one::OutputModuleBase::selector_config_id_
private

Definition at line 186 of file OutputModuleBase.h.

Referenced by OutputModuleBase(), and setEventSelectionInfo().

std::vector<detail::TriggerResultsBasedEventSelector> edm::one::OutputModuleBase::selectors_
private
SubProcessParentageHelper const* edm::one::OutputModuleBase::subProcessParentageHelper_
private

Definition at line 194 of file OutputModuleBase.h.

Referenced by configure().

edm::propagate_const<std::unique_ptr<ThinnedAssociationsHelper> > edm::one::OutputModuleBase::thinnedAssociationsHelper_
private

Definition at line 196 of file OutputModuleBase.h.

Referenced by selectProducts(), and thinnedAssociationsHelper().

bool edm::one::OutputModuleBase::wantAllEvents_
private

Definition at line 181 of file OutputModuleBase.h.

Referenced by needToRunSelection(), OutputModuleBase(), and prePrefetchSelection().