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::LuminosityBlockWatcher 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 ()
 
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 &)
 
SubProcessParentageHelper const * subProcessParentageHelper () const
 
ThinnedAssociationsHelper const * thinnedAssociationsHelper () const
 
bool wantAllEvents () const
 
virtual ~OutputModuleBase ()
 
- 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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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, EventSetup const &c, ModuleCallingContext const *)
 
bool doBeginRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)
 
bool doEndRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
 
bool doEvent (EventPrincipal const &ep, EventSetup const &c, ActivityRegistry *, ModuleCallingContext const *)
 
void doPreallocate (PreallocationConfiguration const &)
 
std::map< BranchID::value_type, BranchID::value_type > const & droppedBranchIDToKeptBranchID ()
 
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 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 doPostForkReacquireResources (unsigned int iChildIndex, unsigned int iNumberOfChildren)
 
void doPreForkReleaseResources ()
 
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 *)
 
virtual void endJob ()
 
virtual bool isFileOpen () const
 
void keepThisBranch (BranchDescription const &desc, std::map< BranchID, BranchDescription const * > &trueBranchIDToKeptBranchDesc, std::set< BranchID > &keptProductsInEvent)
 
bool limitReached () const
 
void maybeOpenFile ()
 
virtual void openFile (FileBlock const &)
 
virtual void postForkReacquireResources (unsigned int, unsigned int)
 
virtual void preActionBeforeRunEventAsync (WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
 
virtual void preForkReleaseResources ()
 
bool prePrefetchSelection (StreamID id, EventPrincipal const &, ModuleCallingContext const *)
 
virtual void reallyCloseFile ()
 
virtual void reallyOpenFile ()
 
void registerProductsAndCallbacks (OutputModuleBase const *, ProductRegistry const *)
 
void setModuleDescription (ModuleDescription const &md)
 
SharedResourcesAcquirersharedResourcesAcquirer ()
 
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_
 
int maxEvents_
 
ModuleDescription moduleDescription_
 
BranchIDLists const * origBranchIDLists_
 
std::string process_name_
 
ProductSelector productSelector_
 
ProductSelectorRules productSelectorRules_
 
std::atomic< int > remainingEvents_
 
SharedResourcesAcquirer resourcesAcquirer_
 
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 64 of file OutputModuleBase.h.

Member Typedef Documentation

Definition at line 69 of file OutputModuleBase.h.

Constructor & Destructor Documentation

OutputModuleBase::OutputModuleBase ( ParameterSet const &  pset)
explicit

Definition at line 44 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_.

44  :
45  maxEvents_(-1),
47  keptProducts_(),
49  process_name_(),
50  productSelectorRules_(pset, "outputCommands", "OutputModule"),
53  wantAllEvents_(false),
54  selectors_(),
58  origBranchIDLists_(nullptr),
59  thinnedAssociationsHelper_(new ThinnedAssociationsHelper) {
60 
61  hasNewlyDroppedBranch_.fill(false);
62 
64  process_name_ = tns->getProcessName();
65 
67  pset.getUntrackedParameterSet("SelectEvents", ParameterSet());
68 
69  selectEvents_.registerIt(); // Just in case this PSet is not registered
70 
72 
73  //need to set wantAllEvents_ in constructor
74  // we will make the remaining selectors once we know how many streams
75  selectors_.resize(1);
79  selectors_[0],
81 
82  }
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 ( )
virtual

Definition at line 192 of file OutputModuleBase.cc.

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

Member Function Documentation

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

Definition at line 405 of file OutputModuleBase.cc.

References edm::one::kBaseType().

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

Definition at line 351 of file OutputModuleBase.cc.

References branchIDLists_, droppedBranchIDToKeptBranchID_, and origBranchIDLists_.

Referenced by edm::StreamerOutputModuleBase::serializeRegistry().

351  {
352  if(!droppedBranchIDToKeptBranchID_.empty()) {
353  // Make a private copy of the BranchIDLists.
355  // Check for branches dropped while an EDAlias was kept.
356  for(BranchIDList& branchIDList : *branchIDLists_) {
357  for(BranchID::value_type& branchID : branchIDList) {
358  // 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.
359  std::map<BranchID::value_type, BranchID::value_type>::const_iterator iter = droppedBranchIDToKeptBranchID_.find(branchID);
360  if(iter != droppedBranchIDToKeptBranchID_.end()) {
361  branchID = iter->second;
362  }
363  }
364  }
365  return branchIDLists_.get();
366  }
367  return origBranchIDLists_;
368  }
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 194 of file OutputModuleBase.cc.

Referenced by doBeginJob().

194  {
196  std::vector<std::shared_ptr<SerialTaskQueue>>(1, std::make_shared<SerialTaskQueue>())};
197  }
ModuleDescription const & OutputModuleBase::description ( ) const
protected
void OutputModuleBase::doBeginJob ( )
protected

Definition at line 217 of file OutputModuleBase.cc.

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

217  {
219  this->beginJob();
220  }
SharedResourcesAcquirer resourcesAcquirer_
virtual SharedResourcesAcquirer createAcquirer()
bool OutputModuleBase::doBeginLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 281 of file OutputModuleBase.cc.

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

283  {
285  lb.setConsumer(this);
287  return true;
288  }
ModuleDescription moduleDescription_
virtual void doBeginLuminosityBlock_(LuminosityBlockForOutput const &)
virtual void edm::one::OutputModuleBase::doBeginLuminosityBlock_ ( LuminosityBlockForOutput const &  )
inlineprivatevirtual
bool OutputModuleBase::doBeginRun ( RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 253 of file OutputModuleBase.cc.

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

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

Reimplemented in edm::one::outputmodule::RunWatcher.

Definition at line 244 of file OutputModuleBase.h.

Referenced by doBeginRun().

244 {}
void OutputModuleBase::doCloseFile ( )
private

Tell the OutputModule that is must end the current file.

Definition at line 341 of file OutputModuleBase.cc.

References isFileOpen(), and reallyCloseFile().

341  {
342  if(isFileOpen()) {
343  reallyCloseFile();
344  }
345  }
virtual bool isFileOpen() const
void OutputModuleBase::doEndJob ( )
protected

Definition at line 222 of file OutputModuleBase.cc.

References endJob().

222  {
223  endJob();
224  }
bool OutputModuleBase::doEndLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 291 of file OutputModuleBase.cc.

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

293  {
295  lb.setConsumer(this);
297 
298  return true;
299  }
ModuleDescription moduleDescription_
virtual void doEndLuminosityBlock_(LuminosityBlockForOutput const &)
virtual void edm::one::OutputModuleBase::doEndLuminosityBlock_ ( LuminosityBlockForOutput const &  )
inlineprivatevirtual
bool OutputModuleBase::doEndRun ( RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 263 of file OutputModuleBase.cc.

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

265  {
267  r.setConsumer(this);
268  doEndRun_(r);
269  return true;
270  }
ModuleDescription moduleDescription_
virtual void doEndRun_(RunForOutput const &)
virtual void edm::one::OutputModuleBase::doEndRun_ ( RunForOutput const &  )
inlineprivatevirtual

Reimplemented in edm::one::outputmodule::RunWatcher.

Definition at line 245 of file OutputModuleBase.h.

Referenced by doEndRun().

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

Definition at line 235 of file OutputModuleBase.cc.

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

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

Definition at line 308 of file OutputModuleBase.cc.

References openFile().

308  {
309  openFile(fb);
310  }
virtual void openFile(FileBlock const &)
void OutputModuleBase::doPostForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
)
private

Definition at line 326 of file OutputModuleBase.cc.

References postForkReacquireResources().

326  {
327  postForkReacquireResources(iChildIndex, iNumberOfChildren);
328  }
virtual void postForkReacquireResources(unsigned int, unsigned int)
void OutputModuleBase::doPreallocate ( PreallocationConfiguration const &  iPC)
protected

Definition at line 199 of file OutputModuleBase.cc.

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

199  {
200  auto nstreams = iPC.numberOfStreams();
201  selectors_.resize(nstreams);
202 
203  bool seenFirst = false;
204  for(auto& s : selectors_) {
205  if(seenFirst) {
209  s,
211  } else {
212  seenFirst = true;
213  }
214  }
215  }
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 OutputModuleBase::doPreForkReleaseResources ( )
private

Definition at line 321 of file OutputModuleBase.cc.

References preForkReleaseResources().

321  {
323  }
virtual void preForkReleaseResources()
void edm::one::OutputModuleBase::doRegisterThinnedAssociations ( ProductRegistry const &  ,
ThinnedAssociationsHelper  
)
inlineprivate

Definition at line 202 of file OutputModuleBase.h.

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

Definition at line 316 of file OutputModuleBase.cc.

References doRespondToCloseInputFile_().

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

Definition at line 312 of file OutputModuleBase.cc.

References doRespondToOpenInputFile_().

312  {
314  }
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 301 of file OutputModuleBase.cc.

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

302  {
304  lb.setConsumer(this);
306  }
ModuleDescription moduleDescription_
virtual void writeLuminosityBlock(LuminosityBlockForOutput const &)=0
void OutputModuleBase::doWriteRun ( RunPrincipal const &  rp,
ModuleCallingContext const *  mcc 
)
private

Definition at line 273 of file OutputModuleBase.cc.

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

274  {
276  r.setConsumer(this);
277  writeRun(r);
278  }
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 137 of file OutputModuleBase.h.

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

Reimplemented in edm::StreamerOutputModuleBase.

Definition at line 234 of file OutputModuleBase.h.

Referenced by doEndJob().

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

Definition at line 393 of file OutputModuleBase.cc.

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

393  {
394  ProductSelectorRules::fillDescription(desc, "outputCommands");
396  }
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 386 of file OutputModuleBase.cc.

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

386  {
388  desc.setUnknown();
389  descriptions.addDefault(desc);
390  }
std::array<bool, NumBranchTypes> const& edm::one::OutputModuleBase::hasNewlyDroppedBranch ( ) const
inline

Definition at line 90 of file OutputModuleBase.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

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

Reimplemented in DQMRootOutputModule, and edm::PoolOutputModule.

Definition at line 238 of file OutputModuleBase.h.

Referenced by doCloseFile(), and maybeOpenFile().

238 { 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 
144  trueBranchIDToKeptBranchDesc);
145 
146  EDGetToken token;
147 
148  std::vector<std::string> missingDictionaries;
149  if (!checkDictionary(missingDictionaries, desc.className(), desc.unwrappedType())) {
150  std::string context("Calling OutputModuleBase::keepThisBranch, checking dictionaries for kept types");
151  throwMissingDictionariesException(missingDictionaries, context);
152  }
153 
154  switch (desc.branchType()) {
155  case InEvent:
156  {
157  if(desc.produced()) {
158  keptProductsInEvent.insert(desc.originalBranchID());
159  } else {
160  keptProductsInEvent.insert(desc.branchID());
161  }
162  token = consumes(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
163  InputTag{desc.moduleLabel(),
164  desc.productInstanceName(),
165  desc.processName()});
166  break;
167  }
168  case InLumi:
169  {
170  token = consumes<InLumi>(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
171  InputTag(desc.moduleLabel(),
172  desc.productInstanceName(),
173  desc.processName()));
174  break;
175  }
176  case InRun:
177  {
178  token = consumes<InRun>(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
179  InputTag(desc.moduleLabel(),
180  desc.productInstanceName(),
181  desc.processName()));
182  break;
183  }
184  default:
185  assert(false);
186  break;
187  }
188  // Now put it in the list of selected branches.
189  keptProducts_[desc.branchType()].push_back(std::make_pair(&desc, token));
190  }
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

Definition at line 89 of file OutputModuleBase.h.

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

89 {return keptProducts_;}
SelectedProductsForBranchType keptProducts_
bool edm::one::OutputModuleBase::limitReached ( ) const
inlineprivate

Definition at line 259 of file OutputModuleBase.h.

259 {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 79 of file OutputModuleBase.h.

void OutputModuleBase::maybeOpenFile ( )
private

Tell the OutputModule to open an output file, if one is not already open.

Definition at line 337 of file OutputModuleBase.cc.

References isFileOpen(), and reallyOpenFile().

337  {
338  if(!isFileOpen()) reallyOpenFile();
339  }
virtual bool isFileOpen() const
const ModuleDescription& edm::one::OutputModuleBase::moduleDescription ( ) const
inline

Definition at line 107 of file OutputModuleBase.h.

References heppy_report::description.

Referenced by edm::StreamerOutputModuleBase::serializeRegistry().

107  {
108  return moduleDescription_;
109  }
ModuleDescription moduleDescription_
virtual void edm::one::OutputModuleBase::openFile ( FileBlock const &  )
inlineprivatevirtual
OutputModuleBase& edm::one::OutputModuleBase::operator= ( OutputModuleBase const &  )
delete
void OutputModuleBase::postForkReacquireResources ( unsigned int  ,
unsigned int   
)
privatevirtual

Reimplemented in DQMRootOutputModule, and edm::PoolOutputModule.

Definition at line 334 of file OutputModuleBase.cc.

Referenced by doPostForkReacquireResources().

334 {}
virtual void edm::one::OutputModuleBase::preActionBeforeRunEventAsync ( WaitingTask iTask,
ModuleCallingContext const &  iModuleCallingContext,
Principal const &  iPrincipal 
) const
inlineprivatevirtual

Reimplemented in edm::PoolOutputModule.

Definition at line 231 of file OutputModuleBase.h.

231 {}
void OutputModuleBase::preForkReleaseResources ( )
privatevirtual

Definition at line 331 of file OutputModuleBase.cc.

Referenced by doPreForkReleaseResources().

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

Definition at line 226 of file OutputModuleBase.cc.

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

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

Definition at line 399 of file OutputModuleBase.cc.

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

399  {
400  }
std::string const& edm::one::OutputModuleBase::processName ( ) const
inline
void OutputModuleBase::reallyCloseFile ( )
privatevirtual

Reimplemented in DQMRootOutputModule, and edm::PoolOutputModule.

Definition at line 347 of file OutputModuleBase.cc.

Referenced by doCloseFile().

347  {
348  }
virtual void edm::one::OutputModuleBase::reallyOpenFile ( )
inlineprivatevirtual

Reimplemented in edm::PoolOutputModule.

Definition at line 239 of file OutputModuleBase.h.

Referenced by maybeOpenFile().

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

Definition at line 218 of file OutputModuleBase.h.

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

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

Definition at line 83 of file OutputModuleBase.h.

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

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

Definition at line 381 of file OutputModuleBase.cc.

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

Referenced by selectProducts().

381  {
382  return productSelector_.selected(desc);
383  }
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 90 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(), keepAssociation_, keepThisBranch(), edm::BranchDescription::present(), edm::BranchDescription::produced(), edm::ProductRegistry::productList(), productSelector_, productSelectorRules_, edm::ThinnedAssociationsHelper::selectAssociationProducts(), selected(), thinnedAssociationsHelper_, edm::BranchDescription::transient(), and edm::BranchDescription::unwrappedType().

91  {
92  if(productSelector_.initialized()) return;
93  productSelector_.initialize(productSelectorRules_, preg.allBranchDescriptions());
94 
95  // TODO: See if we can collapse keptProducts_ and productSelector_ into a
96  // single object. See the notes in the header for ProductSelector
97  // for more information.
98 
99  std::map<BranchID, BranchDescription const*> trueBranchIDToKeptBranchDesc;
100  std::vector<BranchDescription const*> associationDescriptions;
101  std::set<BranchID> keptProductsInEvent;
102 
103  for(auto const& it : preg.productList()) {
104  BranchDescription const& desc = it.second;
105  if(desc.transient()) {
106  // if the class of the branch is marked transient, output nothing
107  } else if(!desc.present() && !desc.produced()) {
108  // else if the branch containing the product has been previously dropped,
109  // output nothing
110  } else if(desc.unwrappedType() == typeid(ThinnedAssociation)) {
111  associationDescriptions.push_back(&desc);
112  } else if(selected(desc)) {
113  keepThisBranch(desc, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
114  } else {
115  // otherwise, output nothing,
116  // and mark the fact that there is a newly dropped branch of this type.
117  hasNewlyDroppedBranch_[desc.branchType()] = true;
118  }
119  }
120 
122  keptProductsInEvent,
124 
125  for(auto association : associationDescriptions) {
126  if(keepAssociation_[association->branchID()]) {
127  keepThisBranch(*association, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
128  } else {
129  hasNewlyDroppedBranch_[association->branchType()] = true;
130  }
131  }
132 
133  // Now fill in a mapping needed in the case that a branch was dropped while its EDAlias was kept.
134  ProductSelector::fillDroppedToKept(preg, trueBranchIDToKeptBranchDesc, droppedBranchIDToKeptBranchID_);
135 
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)
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 410 of file OutputModuleBase.cc.

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

411  {
413  description().moduleLabel(),
414  outputModulePathPositions,
415  anyProductProduced);
416  }
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 255 of file OutputModuleBase.h.

255  {
256  moduleDescription_ = md;
257  }
ModuleDescription moduleDescription_
SharedResourcesAcquirer& edm::one::OutputModuleBase::sharedResourcesAcquirer ( )
inlineprivate

Definition at line 207 of file OutputModuleBase.h.

207  {
208  return resourcesAcquirer_;
209  }
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 228 of file OutputModuleBase.h.

References TriggerAnalyzer::write().

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

Definition at line 103 of file OutputModuleBase.h.

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

103  {
105  }
SubProcessParentageHelper const * subProcessParentageHelper_
ThinnedAssociationsHelper const * OutputModuleBase::thinnedAssociationsHelper ( ) const

Definition at line 371 of file OutputModuleBase.cc.

References thinnedAssociationsHelper_.

Referenced by edm::StreamerOutputModuleBase::serializeRegistry().

371  {
372  return thinnedAssociationsHelper_.get();
373  }
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
bool edm::one::OutputModuleBase::wantAllEvents ( ) const
inline

Definition at line 97 of file OutputModuleBase.h.

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

std::string edm::one::OutputModuleBase::workerType ( ) const
inlineprivate

Definition at line 205 of file OutputModuleBase.h.

205 {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 68 of file OutputModuleBase.h.

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

Definition at line 67 of file OutputModuleBase.h.

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

Definition at line 66 of file OutputModuleBase.h.

Member Data Documentation

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

Definition at line 179 of file OutputModuleBase.h.

Referenced by branchIDLists().

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

Definition at line 178 of file OutputModuleBase.h.

Referenced by branchIDLists(), and selectProducts().

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

Definition at line 162 of file OutputModuleBase.h.

Referenced by OutputModuleBase(), and selectProducts().

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

Definition at line 185 of file OutputModuleBase.h.

Referenced by selectProducts().

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

Definition at line 161 of file OutputModuleBase.h.

Referenced by keepThisBranch().

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

Definition at line 143 of file OutputModuleBase.h.

Referenced by configure().

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

Definition at line 180 of file OutputModuleBase.h.

Referenced by branchIDLists(), and configure().

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

Definition at line 164 of file OutputModuleBase.h.

Referenced by doPreallocate(), and OutputModuleBase().

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

Definition at line 166 of file OutputModuleBase.h.

Referenced by selected(), and selectProducts().

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

Definition at line 165 of file OutputModuleBase.h.

Referenced by selectProducts().

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

Definition at line 144 of file OutputModuleBase.h.

Referenced by configure(), and doEvent().

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

Definition at line 187 of file OutputModuleBase.h.

Referenced by doBeginJob().

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

Definition at line 171 of file OutputModuleBase.h.

Referenced by doPreallocate(), and OutputModuleBase().

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

Definition at line 174 of file OutputModuleBase.h.

Referenced by OutputModuleBase(), and setEventSelectionInfo().

std::vector<detail::TriggerResultsBasedEventSelector> edm::one::OutputModuleBase::selectors_
private

Definition at line 170 of file OutputModuleBase.h.

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

SubProcessParentageHelper const* edm::one::OutputModuleBase::subProcessParentageHelper_
private

Definition at line 182 of file OutputModuleBase.h.

Referenced by configure().

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

Definition at line 184 of file OutputModuleBase.h.

Referenced by selectProducts(), and thinnedAssociationsHelper().

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

Definition at line 169 of file OutputModuleBase.h.

Referenced by OutputModuleBase(), and prePrefetchSelection().