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::OutputModule Class Referenceabstract

#include <OutputModule.h>

Inheritance diagram for edm::OutputModule:
edm::EDConsumerBase edm::GetProductCheckerOutputModule edm::ProvenanceCheckerOutputModule

Public Types

typedef OutputModule 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
 
OutputModuleoperator= (OutputModule const &)=delete
 
 OutputModule (ParameterSet const &pset)
 
 OutputModule (OutputModule const &)=delete
 
std::string const & processName () const
 
int remainingEvents () const
 
bool selected (BranchDescription const &desc) const
 
void selectProducts (ProductRegistry const &preg, ThinnedAssociationsHelper const &)
 
ThinnedAssociationsHelper const * thinnedAssociationsHelper () const
 
bool wantAllEvents () const
 
virtual ~OutputModule ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 & itemsToGetFromEvent () 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, std::vector< std::string > const &iDefaultOutputCommands=ProductSelectorRules::defaultSelectionStrings())
 
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 *mcc)
 
bool doBeginRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *mcc)
 
bool doEndRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
 
bool doEvent (EventPrincipal const &ep, EventSetup const &c, ActivityRegistry *act, ModuleCallingContext const *mcc)
 
void doPreallocate (PreallocationConfiguration const &)
 
std::map< BranchID::value_type, BranchID::value_type > const & droppedBranchIDToKeptBranchID ()
 
Trig getTriggerResults (EDGetTokenT< TriggerResults > const &token, EventForOutput const &e) const
 
ModuleDescription const & moduleDescription () const
 
void preActionBeforeRunEventAsync (WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
 
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 void beginLuminosityBlock (LuminosityBlockForOutput const &)
 
virtual void beginRun (RunForOutput const &)
 
void doCloseFile ()
 Tell the OutputModule that is must end the current file. More...
 
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)
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doWriteLuminosityBlock (LuminosityBlockPrincipal const &lbp, ModuleCallingContext const *mcc)
 
void doWriteRun (RunPrincipal const &rp, ModuleCallingContext const *mcc)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (LuminosityBlockForOutput const &)
 
virtual void endRun (RunForOutput const &)
 
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 preForkReleaseResources ()
 
bool prePrefetchSelection (StreamID id, EventPrincipal const &, ModuleCallingContext const *)
 
virtual void reallyCloseFile ()
 
virtual void reallyOpenFile ()
 
void registerProductsAndCallbacks (OutputModule const *, ProductRegistry const *)
 
virtual void respondToCloseInputFile (FileBlock const &)
 
virtual void respondToOpenInputFile (FileBlock 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 resourceAcquirer_
 
ParameterSet selectEvents_
 
ParameterSetID selector_config_id_
 
std::vector< detail::TriggerResultsBasedEventSelectorselectors_
 
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
 
bool wantAllEvents_
 

Friends

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

Detailed Description

Definition at line 51 of file OutputModule.h.

Member Typedef Documentation

Definition at line 56 of file OutputModule.h.

Constructor & Destructor Documentation

edm::OutputModule::OutputModule ( ParameterSet const &  pset)
explicit

Definition at line 39 of file OutputModule.cc.

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

39  :
40  maxEvents_(-1),
42  keptProducts_(),
44  process_name_(),
45  productSelectorRules_(pset, "outputCommands", "OutputModule"),
48  wantAllEvents_(false),
49  selectors_(),
53  origBranchIDLists_(nullptr),
54  thinnedAssociationsHelper_(new ThinnedAssociationsHelper) {
55 
56  hasNewlyDroppedBranch_.fill(false);
57 
59  process_name_ = tns->getProcessName();
60 
62  pset.getUntrackedParameterSet("SelectEvents", ParameterSet());
63 
64  selectEvents_.registerIt(); // Just in case this PSet is not registered
65 
67  selectors_.resize(1);
68  //need to set wantAllEvents_ in constructor
69  // we will make the remaining selectors once we know how many streams
73  selectors_[0],
75 
78 
79  }
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: OutputModule.h:153
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:169
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
ParameterSet selectEvents_
Definition: OutputModule.h:164
ModuleDescription moduleDescription_
Definition: OutputModule.h:158
ParameterSetID id() const
edm::propagate_const< std::unique_ptr< BranchIDLists > > branchIDLists_
Definition: OutputModule.h:170
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
Definition: OutputModule.h:173
BranchIDLists const * origBranchIDLists_
Definition: OutputModule.h:171
std::string process_name_
Definition: OutputModule.h:155
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
static SharedResourcesRegistry * instance()
bool configureEventSelector(edm::ParameterSet const &iPSet, std::string const &iProcessName, std::vector< std::string > const &iAllTriggerNames, edm::detail::TriggerResultsBasedEventSelector &oSelector, ConsumesCollector &&iC)
void registerSharedResource(const std::string &)
A resource name must be registered before it can be used in the createAcquirer call.
static const std::string kLegacyModuleResourceName
All legacy modules share this resource.
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
Definition: OutputModule.h:161
SelectedProductsForBranchType keptProducts_
Definition: OutputModule.h:152
ProductSelector productSelector_
Definition: OutputModule.h:157
std::vector< std::string > const & getAllTriggerNames()
ProductSelectorRules productSelectorRules_
Definition: OutputModule.h:156
std::atomic< int > remainingEvents_
Definition: OutputModule.h:135
ParameterSet const & registerIt()
ParameterSetID selector_config_id_
Definition: OutputModule.h:165
edm::OutputModule::~OutputModule ( )
virtual

Definition at line 188 of file OutputModule.cc.

188 { }
edm::OutputModule::OutputModule ( OutputModule const &  )
delete

Member Function Documentation

const std::string & edm::OutputModule::baseType ( )
static

Definition at line 422 of file OutputModule.cc.

References edm::kBaseType().

422  {
423  return kBaseType;
424  }
static const std::string kBaseType("EDAnalyzer")
virtual void edm::OutputModule::beginJob ( void  )
inlineprivatevirtual

Definition at line 217 of file OutputModule.h.

Referenced by doBeginJob().

217 {}
virtual void edm::OutputModule::beginLuminosityBlock ( LuminosityBlockForOutput const &  )
inlineprivatevirtual

Definition at line 222 of file OutputModule.h.

Referenced by doBeginLuminosityBlock().

222 {}
virtual void edm::OutputModule::beginRun ( RunForOutput const &  )
inlineprivatevirtual

Definition at line 219 of file OutputModule.h.

Referenced by doBeginRun().

219 {}
BranchIDLists const * edm::OutputModule::branchIDLists ( )

Definition at line 368 of file OutputModule.cc.

References branchIDLists_, droppedBranchIDToKeptBranchID_, and origBranchIDLists_.

368  {
369  if(!droppedBranchIDToKeptBranchID_.empty()) {
370  // Make a private copy of the BranchIDLists.
372  // Check for branches dropped while an EDAlias was kept.
373  for(BranchIDList& branchIDList : *branchIDLists_) {
374  for(BranchID::value_type& branchID : branchIDList) {
375  // 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.
376  std::map<BranchID::value_type, BranchID::value_type>::const_iterator iter = droppedBranchIDToKeptBranchID_.find(branchID);
377  if(iter != droppedBranchIDToKeptBranchID_.end()) {
378  branchID = iter->second;
379  }
380  }
381  }
382  return branchIDLists_.get();
383  }
384  return origBranchIDLists_;
385  }
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:169
edm::propagate_const< std::unique_ptr< BranchIDLists > > branchIDLists_
Definition: OutputModule.h:170
BranchIDLists const * origBranchIDLists_
Definition: OutputModule.h:171
unsigned int value_type
Definition: BranchID.h:16
std::vector< BranchID::value_type > BranchIDList
Definition: BranchIDList.h:18
void edm::OutputModule::configure ( OutputModuleDescription const &  desc)
protected

Definition at line 81 of file OutputModule.cc.

References edm::OutputModuleDescription::branchIDLists_, edm::OutputModuleDescription::maxEvents_, maxEvents_, origBranchIDLists_, and remainingEvents_.

81  {
82  remainingEvents_ = maxEvents_ = desc.maxEvents_;
83  origBranchIDLists_ = desc.branchIDLists_;
84  }
BranchIDLists const * origBranchIDLists_
Definition: OutputModule.h:171
std::atomic< int > remainingEvents_
Definition: OutputModule.h:135
ModuleDescription const & edm::OutputModule::description ( ) const
protected

Definition at line 393 of file OutputModule.cc.

References moduleDescription_.

Referenced by setEventSelectionInfo().

393  {
394  return moduleDescription_;
395  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:158
void edm::OutputModule::doBeginJob ( )
protected

Definition at line 208 of file OutputModule.cc.

References beginJob(), edm::SharedResourcesRegistry::createAcquirer(), edm::SharedResourcesRegistry::instance(), edm::SharedResourcesRegistry::kLegacyModuleResourceName, and resourceAcquirer_.

208  {
209  std::vector<std::string> res = {SharedResourcesRegistry::kLegacyModuleResourceName};
211 
212  this->beginJob();
213  }
SharedResourcesAcquirer resourceAcquirer_
Definition: OutputModule.h:176
SharedResourcesAcquirer createAcquirer(std::vector< std::string > const &) const
Definition: Electron.h:4
static SharedResourcesRegistry * instance()
static const std::string kLegacyModuleResourceName
All legacy modules share this resource.
virtual void beginJob()
Definition: OutputModule.h:217
bool edm::OutputModule::doBeginLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 303 of file OutputModule.cc.

References beginLuminosityBlock(), FDEBUG, moduleDescription_, and edm::OccurrenceForOutput::setConsumer().

305  {
306  FDEBUG(2) << "beginLuminosityBlock called\n";
308  lb.setConsumer(this);
310  return true;
311  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:158
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void beginLuminosityBlock(LuminosityBlockForOutput const &)
Definition: OutputModule.h:222
bool edm::OutputModule::doBeginRun ( RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 272 of file OutputModule.cc.

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

274  {
275  FDEBUG(2) << "beginRun called\n";
277  r.setConsumer(this);
278  beginRun(r);
279  return true;
280  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:158
virtual void beginRun(RunForOutput const &)
Definition: OutputModule.h:219
#define FDEBUG(lev)
Definition: DebugMacros.h:18
void edm::OutputModule::doCloseFile ( )
private

Tell the OutputModule that is must end the current file.

Definition at line 358 of file OutputModule.cc.

References isFileOpen(), and reallyCloseFile().

358  {
359  if(isFileOpen()) {
360  reallyCloseFile();
361  }
362  }
virtual void reallyCloseFile()
virtual bool isFileOpen() const
Definition: OutputModule.h:231
void edm::OutputModule::doEndJob ( )
protected

Definition at line 215 of file OutputModule.cc.

References endJob().

215  {
216  endJob();
217  }
virtual void endJob()
Definition: OutputModule.h:218
bool edm::OutputModule::doEndLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 314 of file OutputModule.cc.

References endLuminosityBlock(), FDEBUG, moduleDescription_, and edm::OccurrenceForOutput::setConsumer().

316  {
317  FDEBUG(2) << "endLuminosityBlock called\n";
319  lb.setConsumer(this);
320  endLuminosityBlock(lb);
321  return true;
322  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:158
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void endLuminosityBlock(LuminosityBlockForOutput const &)
Definition: OutputModule.h:223
bool edm::OutputModule::doEndRun ( RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 283 of file OutputModule.cc.

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

285  {
286  FDEBUG(2) << "endRun called\n";
288  r.setConsumer(this);
289  endRun(r);
290  return true;
291  }
virtual void endRun(RunForOutput const &)
Definition: OutputModule.h:220
ModuleDescription moduleDescription_
Definition: OutputModule.h:158
#define FDEBUG(lev)
Definition: DebugMacros.h:18
bool edm::OutputModule::doEvent ( EventPrincipal const &  ep,
EventSetup const &  c,
ActivityRegistry act,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 236 of file OutputModule.cc.

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

239  {
240 
241  FDEBUG(2) << "writeEvent called\n";
242 
243  {
245  e.setConsumer(this);
246  EventSignalsSentry sentry(act,mcc);
247  write(e);
248  }
249  if(remainingEvents_ > 0) {
251  }
252  return true;
253  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:158
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::atomic< int > remainingEvents_
Definition: OutputModule.h:135
virtual void write(EventForOutput const &)=0
void edm::OutputModule::doOpenFile ( FileBlock const &  fb)
private

Definition at line 332 of file OutputModule.cc.

References openFile().

332  {
333  openFile(fb);
334  }
virtual void openFile(FileBlock const &)
Definition: OutputModule.h:225
void edm::OutputModule::doPostForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
)
private

Definition at line 350 of file OutputModule.cc.

References postForkReacquireResources().

350  {
351  postForkReacquireResources(iChildIndex, iNumberOfChildren);
352  }
virtual void postForkReacquireResources(unsigned int, unsigned int)
Definition: OutputModule.h:229
void edm::OutputModule::doPreallocate ( PreallocationConfiguration const &  iPC)
protected

Definition at line 190 of file OutputModule.cc.

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

190  {
191  auto nstreams = iPC.numberOfStreams();
192  selectors_.resize(nstreams);
193 
194  bool seenFirst = false;
195  for(auto& s : selectors_) {
196  if(seenFirst) {
200  s,
202  }
203  seenFirst = true;
204  }
205  }
ParameterSet selectEvents_
Definition: OutputModule.h:164
std::string process_name_
Definition: OutputModule.h:155
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_
Definition: OutputModule.h:161
std::vector< std::string > const & getAllTriggerNames()
void edm::OutputModule::doPreForkReleaseResources ( )
private

Definition at line 345 of file OutputModule.cc.

References preForkReleaseResources().

345  {
347  }
virtual void preForkReleaseResources()
Definition: OutputModule.h:228
void edm::OutputModule::doRegisterThinnedAssociations ( ProductRegistry const &  ,
ThinnedAssociationsHelper  
)
inlineprivate

Definition at line 188 of file OutputModule.h.

189  { }
void edm::OutputModule::doRespondToCloseInputFile ( FileBlock const &  fb)
private

Definition at line 340 of file OutputModule.cc.

References respondToCloseInputFile().

340  {
342  }
virtual void respondToCloseInputFile(FileBlock const &)
Definition: OutputModule.h:227
void edm::OutputModule::doRespondToOpenInputFile ( FileBlock const &  fb)
private

Definition at line 336 of file OutputModule.cc.

References respondToOpenInputFile().

336  {
338  }
virtual void respondToOpenInputFile(FileBlock const &)
Definition: OutputModule.h:226
void edm::OutputModule::doWriteLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
ModuleCallingContext const *  mcc 
)
private

Definition at line 324 of file OutputModule.cc.

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

325  {
326  FDEBUG(2) << "writeLuminosityBlock called\n";
328  lb.setConsumer(this);
330  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:158
virtual void writeLuminosityBlock(LuminosityBlockForOutput const &)=0
#define FDEBUG(lev)
Definition: DebugMacros.h:18
void edm::OutputModule::doWriteRun ( RunPrincipal const &  rp,
ModuleCallingContext const *  mcc 
)
private

Definition at line 294 of file OutputModule.cc.

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

295  {
296  FDEBUG(2) << "writeRun called\n";
298  r.setConsumer(this);
299  writeRun(r);
300  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:158
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void writeRun(RunForOutput const &)=0
std::map<BranchID::value_type, BranchID::value_type> const& edm::OutputModule::droppedBranchIDToKeptBranchID ( )
inlineprotected

Definition at line 128 of file OutputModule.h.

128  {
130  }
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:169
virtual void edm::OutputModule::endJob ( void  )
inlineprivatevirtual

Definition at line 218 of file OutputModule.h.

Referenced by doEndJob().

218 {}
virtual void edm::OutputModule::endLuminosityBlock ( LuminosityBlockForOutput const &  )
inlineprivatevirtual

Definition at line 223 of file OutputModule.h.

Referenced by doEndLuminosityBlock().

223 {}
virtual void edm::OutputModule::endRun ( RunForOutput const &  )
inlineprivatevirtual

Definition at line 220 of file OutputModule.h.

Referenced by doEndRun().

220 {}
void edm::OutputModule::fillDescription ( ParameterSetDescription desc,
std::vector< std::string > const &  iDefaultOutputCommands = ProductSelectorRules::defaultSelectionStrings() 
)
static

Definition at line 410 of file OutputModule.cc.

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

Referenced by edm::StreamerOutputModuleBase::fillDescription(), edm::PoolOutputModule::fillDescription(), edm::AsciiOutputModule::fillDescriptions(), edm::GetProductCheckerOutputModule::fillDescriptions(), edm::ProvenanceCheckerOutputModule::fillDescriptions(), and DQMRootOutputModule::fillDescriptions().

410  {
411  ProductSelectorRules::fillDescription(desc, "outputCommands",defaultOutputCommands);
413  }
static void fillDescription(ParameterSetDescription &desc, char const *parameterName, std::vector< std::string > const &defaultStrings=defaultSelectionStrings())
static void fillDescription(ParameterSetDescription &desc)
void edm::OutputModule::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 403 of file OutputModule.cc.

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

403  {
405  desc.setUnknown();
406  descriptions.addDefault(desc);
407  }
Trig edm::OutputModule::getTriggerResults ( EDGetTokenT< TriggerResults > const &  token,
EventForOutput const &  e 
) const
protected

Definition at line 220 of file OutputModule.cc.

References edm::OccurrenceForOutput::getByToken(), and mps_fire::result.

220  {
221  //This cast is safe since we only call const functions of the EventForOutputafter this point
222  Trig result;
223  e.getByToken<TriggerResults>(token, result);
224  return result;
225  }
detail::TriggerResultsBasedEventSelector::handle_t Trig
Definition: OutputModule.h:49
std::array<bool, NumBranchTypes> const& edm::OutputModule::hasNewlyDroppedBranch ( ) const
inline

Definition at line 77 of file OutputModule.h.

References edm::ProductSelectorRules::defaultSelectionStrings(), and AlCaHLTBitMon_QueryRunRegistry::string.

77 {return hasNewlyDroppedBranch_;}
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: OutputModule.h:153
virtual bool edm::OutputModule::isFileOpen ( ) const
inlineprivatevirtual

Definition at line 231 of file OutputModule.h.

Referenced by doCloseFile(), and maybeOpenFile().

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

Definition at line 135 of file OutputModule.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().

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

Definition at line 243 of file OutputModule.h.

243 {return remainingEvents_ == 0;}
std::atomic< int > remainingEvents_
Definition: OutputModule.h:135
int edm::OutputModule::maxEvents ( ) const
inline

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

Definition at line 66 of file OutputModule.h.

66 {return maxEvents_;}
void edm::OutputModule::maybeOpenFile ( )
private

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

Definition at line 354 of file OutputModule.cc.

References isFileOpen(), and reallyOpenFile().

354  {
355  if(!isFileOpen()) reallyOpenFile();
356  }
virtual void reallyOpenFile()
Definition: OutputModule.h:233
virtual bool isFileOpen() const
Definition: OutputModule.h:231
ModuleDescription const& edm::OutputModule::moduleDescription ( ) const
inlineprotected

Definition at line 99 of file OutputModule.h.

99  { return moduleDescription_;
100  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:158
virtual void edm::OutputModule::openFile ( FileBlock const &  )
inlineprivatevirtual
OutputModule& edm::OutputModule::operator= ( OutputModule const &  )
delete
virtual void edm::OutputModule::postForkReacquireResources ( unsigned  int,
unsigned  int 
)
inlineprivatevirtual

Definition at line 229 of file OutputModule.h.

Referenced by doPostForkReacquireResources().

229 {}
void edm::OutputModule::preActionBeforeRunEventAsync ( WaitingTask iTask,
ModuleCallingContext const &  iModuleCallingContext,
Principal const &  iPrincipal 
) const
inlineprotected

Definition at line 112 of file OutputModule.h.

References genParticles_cff::map, and AlCaHLTBitMon_QueryRunRegistry::string.

112 {}
virtual void edm::OutputModule::preForkReleaseResources ( )
inlineprivatevirtual

Definition at line 228 of file OutputModule.h.

Referenced by doPreForkReleaseResources().

228 {}
bool edm::OutputModule::prePrefetchSelection ( StreamID  id,
EventPrincipal const &  ep,
ModuleCallingContext const *  mcc 
)
private

Definition at line 227 of file OutputModule.cc.

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

227  {
228  if(wantAllEvents_) return true;
229  auto& s = selectors_[id.value()];
231  e.setConsumer(this);
232  return s.wantEvent(e);
233  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:158
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
Definition: OutputModule.h:161
void edm::OutputModule::prevalidate ( ConfigurationDescriptions )
static

Definition at line 416 of file OutputModule.cc.

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

416  {
417  }
std::string const& edm::OutputModule::processName ( ) const
inline

Definition at line 75 of file OutputModule.h.

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

75 {return process_name_;}
std::string process_name_
Definition: OutputModule.h:155
void edm::OutputModule::reallyCloseFile ( )
privatevirtual

Definition at line 364 of file OutputModule.cc.

Referenced by doCloseFile().

364  {
365  }
virtual void edm::OutputModule::reallyOpenFile ( )
inlineprivatevirtual

Definition at line 233 of file OutputModule.h.

Referenced by maybeOpenFile().

233 {}
void edm::OutputModule::registerProductsAndCallbacks ( OutputModule const *  ,
ProductRegistry const *   
)
inlineprivate

Definition at line 209 of file OutputModule.h.

209 {}
int edm::OutputModule::remainingEvents ( ) const
inline

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

Definition at line 70 of file OutputModule.h.

70 {return remainingEvents_;}
std::atomic< int > remainingEvents_
Definition: OutputModule.h:135
virtual void edm::OutputModule::respondToCloseInputFile ( FileBlock const &  )
inlineprivatevirtual

Definition at line 227 of file OutputModule.h.

Referenced by doRespondToCloseInputFile().

227 {}
virtual void edm::OutputModule::respondToOpenInputFile ( FileBlock const &  )
inlineprivatevirtual

Definition at line 226 of file OutputModule.h.

Referenced by doRespondToOpenInputFile().

226 {}
bool edm::OutputModule::selected ( BranchDescription const &  desc) const

Definition at line 398 of file OutputModule.cc.

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

Referenced by selectProducts().

398  {
399  return productSelector_.selected(desc);
400  }
bool selected(BranchDescription const &desc) const
ProductSelector productSelector_
Definition: OutputModule.h:157
ParameterSetID edm::OutputModule::selectorConfig ( ) const
inlineprotected

Definition at line 102 of file OutputModule.h.

References EnergyCorrector::c.

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

102 { return selector_config_id_; }
ParameterSetID selector_config_id_
Definition: OutputModule.h:165
void edm::OutputModule::selectProducts ( ProductRegistry const &  preg,
ThinnedAssociationsHelper const &  thinnedAssociationsHelper 
)

Definition at line 86 of file OutputModule.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().

87  {
88  if(productSelector_.initialized()) 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 
99  for(auto const& it : preg.productList()) {
100  BranchDescription const& desc = it.second;
101  if(desc.transient()) {
102  // if the class of the branch is marked transient, output nothing
103  } else if(!desc.present() && !desc.produced()) {
104  // else if the branch containing the product has been previously dropped,
105  // output nothing
106  } else if(desc.unwrappedType() == typeid(ThinnedAssociation)) {
107  associationDescriptions.push_back(&desc);
108  } else if(selected(desc)) {
109  keepThisBranch(desc, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
110  } else {
111  // otherwise, output nothing,
112  // and mark the fact that there is a newly dropped branch of this type.
113  hasNewlyDroppedBranch_[desc.branchType()] = true;
114  }
115  }
116 
118  keptProductsInEvent,
120 
121  for(auto association : associationDescriptions) {
122  if(keepAssociation_[association->branchID()]) {
123  keepThisBranch(*association, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
124  } else {
125  hasNewlyDroppedBranch_[association->branchType()] = true;
126  }
127  }
128 
129  // Now fill in a mapping needed in the case that a branch was dropped while its EDAlias was kept.
130  ProductSelector::fillDroppedToKept(preg, trueBranchIDToKeptBranchDesc, droppedBranchIDToKeptBranchID_);
131 
133  }
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: OutputModule.h:153
void keepThisBranch(BranchDescription const &desc, std::map< BranchID, BranchDescription const * > &trueBranchIDToKeptBranchDesc, std::set< BranchID > &keptProductsInEvent)
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:169
static void fillDroppedToKept(ProductRegistry const &preg, std::map< BranchID, BranchDescription const * > const &trueBranchIDToKeptBranchDesc, std::map< BranchID::value_type, BranchID::value_type > &droppedBranchIDToKeptBranchID_)
std::map< BranchID, bool > keepAssociation_
Definition: OutputModule.h:174
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
Definition: OutputModule.h:173
bool selected(BranchDescription const &desc) const
void selectAssociationProducts(std::vector< BranchDescription const * > const &associationDescriptions, std::set< BranchID > const &keptProductsInEvent, std::map< BranchID, bool > &keepAssociation) const
ThinnedAssociationsHelper const * thinnedAssociationsHelper() const
ProductSelector productSelector_
Definition: OutputModule.h:157
bool initialized() const
void initialize(ProductSelectorRules const &rules, std::vector< BranchDescription const * > const &branchDescriptions)
ProductSelectorRules productSelectorRules_
Definition: OutputModule.h:156
void edm::OutputModule::setEventSelectionInfo ( std::map< std::string, std::vector< std::pair< std::string, int > > > const &  outputModulePathPositions,
bool  anyProductProduced 
)
protected

Definition at line 427 of file OutputModule.cc.

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

428  {
430  description().moduleLabel(),
431  outputModulePathPositions,
432  anyProductProduced);
433  }
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)
ModuleDescription const & description() const
ParameterSetID selector_config_id_
Definition: OutputModule.h:165
void edm::OutputModule::setModuleDescription ( ModuleDescription const &  md)
inlineprivate

Definition at line 239 of file OutputModule.h.

239  {
240  moduleDescription_ = md;
241  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:158
SharedResourcesAcquirer& edm::OutputModule::sharedResourcesAcquirer ( )
inlineprivate

Definition at line 193 of file OutputModule.h.

193  {
194  return resourceAcquirer_;
195  }
SharedResourcesAcquirer resourceAcquirer_
Definition: OutputModule.h:176
virtual bool edm::OutputModule::shouldWeCloseFile ( ) const
inlineprivatevirtual

Ask the OutputModule if we should end the current file.

Definition at line 214 of file OutputModule.h.

References TriggerAnalyzer::write().

214 {return false;}
ThinnedAssociationsHelper const * edm::OutputModule::thinnedAssociationsHelper ( ) const

Definition at line 388 of file OutputModule.cc.

References thinnedAssociationsHelper_.

388  {
389  return thinnedAssociationsHelper_.get();
390  }
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
Definition: OutputModule.h:173
bool edm::OutputModule::wantAllEvents ( ) const
inline

Definition at line 84 of file OutputModule.h.

References heppy_report::description, and MillePedeFileConverter_cfg::e.

84 {return wantAllEvents_;}
std::string edm::OutputModule::workerType ( ) const
inlineprivate

Definition at line 191 of file OutputModule.h.

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

Friends And Related Function Documentation

template<typename T >
friend class maker::ModuleHolderT
friend

Definition at line 53 of file OutputModule.h.

template<typename T >
friend class OutputModuleCommunicatorT
friend

Definition at line 55 of file OutputModule.h.

template<typename T >
friend class WorkerT
friend

Definition at line 54 of file OutputModule.h.

Member Data Documentation

edm::propagate_const<std::unique_ptr<BranchIDLists> > edm::OutputModule::branchIDLists_
private

Definition at line 170 of file OutputModule.h.

Referenced by branchIDLists().

std::map<BranchID::value_type, BranchID::value_type> edm::OutputModule::droppedBranchIDToKeptBranchID_
private

Definition at line 169 of file OutputModule.h.

Referenced by branchIDLists(), and selectProducts().

std::array<bool, NumBranchTypes> edm::OutputModule::hasNewlyDroppedBranch_
private

Definition at line 153 of file OutputModule.h.

Referenced by OutputModule(), and selectProducts().

std::map<BranchID, bool> edm::OutputModule::keepAssociation_
private

Definition at line 174 of file OutputModule.h.

Referenced by selectProducts().

SelectedProductsForBranchType edm::OutputModule::keptProducts_
private

Definition at line 152 of file OutputModule.h.

Referenced by keepThisBranch().

int edm::OutputModule::maxEvents_
private

Definition at line 134 of file OutputModule.h.

Referenced by configure().

ModuleDescription edm::OutputModule::moduleDescription_
private
BranchIDLists const* edm::OutputModule::origBranchIDLists_
private

Definition at line 171 of file OutputModule.h.

Referenced by branchIDLists(), and configure().

std::string edm::OutputModule::process_name_
private

Definition at line 155 of file OutputModule.h.

Referenced by doPreallocate(), and OutputModule().

ProductSelector edm::OutputModule::productSelector_
private

Definition at line 157 of file OutputModule.h.

Referenced by selected(), and selectProducts().

ProductSelectorRules edm::OutputModule::productSelectorRules_
private

Definition at line 156 of file OutputModule.h.

Referenced by selectProducts().

std::atomic<int> edm::OutputModule::remainingEvents_
private

Definition at line 135 of file OutputModule.h.

Referenced by configure(), and doEvent().

SharedResourcesAcquirer edm::OutputModule::resourceAcquirer_
private

Definition at line 176 of file OutputModule.h.

Referenced by doBeginJob().

ParameterSet edm::OutputModule::selectEvents_
private

Definition at line 164 of file OutputModule.h.

Referenced by doPreallocate(), and OutputModule().

ParameterSetID edm::OutputModule::selector_config_id_
private

Definition at line 165 of file OutputModule.h.

Referenced by OutputModule(), and setEventSelectionInfo().

std::vector<detail::TriggerResultsBasedEventSelector> edm::OutputModule::selectors_
private

Definition at line 161 of file OutputModule.h.

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

edm::propagate_const<std::unique_ptr<ThinnedAssociationsHelper> > edm::OutputModule::thinnedAssociationsHelper_
private

Definition at line 173 of file OutputModule.h.

Referenced by selectProducts(), and thinnedAssociationsHelper().

bool edm::OutputModule::wantAllEvents_
private

Definition at line 160 of file OutputModule.h.

Referenced by OutputModule(), and prePrefetchSelection().