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
 
 ~OutputModule () 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
 
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)
 
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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

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 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 &)
 
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 &)
 
bool prePrefetchSelection (StreamID id, EventPrincipal const &, ModuleCallingContext const *)
 
std::vector< ProductResolverIndexAndSkipBitproductsUsedBySelection () const
 
virtual void reallyCloseFile ()
 
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:158
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:174
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
ParameterSet selectEvents_
Definition: OutputModule.h:169
ModuleDescription moduleDescription_
Definition: OutputModule.h:163
ParameterSetID id() const
edm::propagate_const< std::unique_ptr< BranchIDLists > > branchIDLists_
Definition: OutputModule.h:175
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
Definition: OutputModule.h:178
BranchIDLists const * origBranchIDLists_
Definition: OutputModule.h:176
std::string process_name_
Definition: OutputModule.h:160
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:166
SelectedProductsForBranchType keptProducts_
Definition: OutputModule.h:157
ProductSelector productSelector_
Definition: OutputModule.h:162
std::vector< std::string > const & getAllTriggerNames()
ProductSelectorRules productSelectorRules_
Definition: OutputModule.h:161
std::atomic< int > remainingEvents_
Definition: OutputModule.h:140
ParameterSet const & registerIt()
ParameterSetID selector_config_id_
Definition: OutputModule.h:170
edm::OutputModule::~OutputModule ( )
override

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 425 of file OutputModule.cc.

References edm::kBaseType().

425  {
426  return kBaseType;
427  }
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 371 of file OutputModule.cc.

References branchIDLists_, droppedBranchIDToKeptBranchID_, and origBranchIDLists_.

371  {
372  if(!droppedBranchIDToKeptBranchID_.empty()) {
373  // Make a private copy of the BranchIDLists.
375  // Check for branches dropped while an EDAlias was kept.
376  for(BranchIDList& branchIDList : *branchIDLists_) {
377  for(BranchID::value_type& branchID : branchIDList) {
378  // 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.
379  std::map<BranchID::value_type, BranchID::value_type>::const_iterator iter = droppedBranchIDToKeptBranchID_.find(branchID);
380  if(iter != droppedBranchIDToKeptBranchID_.end()) {
381  branchID = iter->second;
382  }
383  }
384  }
385  return branchIDLists_.get();
386  }
387  return origBranchIDLists_;
388  }
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:174
edm::propagate_const< std::unique_ptr< BranchIDLists > > branchIDLists_
Definition: OutputModule.h:175
BranchIDLists const * origBranchIDLists_
Definition: OutputModule.h:176
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:176
std::atomic< int > remainingEvents_
Definition: OutputModule.h:140
ModuleDescription const & edm::OutputModule::description ( ) const
protected

Definition at line 396 of file OutputModule.cc.

References moduleDescription_.

Referenced by setEventSelectionInfo().

396  {
397  return moduleDescription_;
398  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:163
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:181
SharedResourcesAcquirer createAcquirer(std::vector< std::string > const &) const
Definition: Electron.h:6
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 320 of file OutputModule.cc.

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

322  {
323  FDEBUG(2) << "beginLuminosityBlock called\n";
325  lb.setConsumer(this);
327  return true;
328  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:163
#define FDEBUG(lev)
Definition: DebugMacros.h:20
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 289 of file OutputModule.cc.

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

291  {
292  FDEBUG(2) << "beginRun called\n";
294  r.setConsumer(this);
295  beginRun(r);
296  return true;
297  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:163
virtual void beginRun(RunForOutput const &)
Definition: OutputModule.h:219
#define FDEBUG(lev)
Definition: DebugMacros.h:20
void edm::OutputModule::doCloseFile ( )
private

Tell the OutputModule that is must end the current file.

Definition at line 361 of file OutputModule.cc.

References isFileOpen(), and reallyCloseFile().

361  {
362  if(isFileOpen()) {
363  reallyCloseFile();
364  }
365  }
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 331 of file OutputModule.cc.

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

333  {
334  FDEBUG(2) << "endLuminosityBlock called\n";
336  lb.setConsumer(this);
337  endLuminosityBlock(lb);
338  return true;
339  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:163
#define FDEBUG(lev)
Definition: DebugMacros.h:20
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 300 of file OutputModule.cc.

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

302  {
303  FDEBUG(2) << "endRun called\n";
305  r.setConsumer(this);
306  endRun(r);
307  return true;
308  }
virtual void endRun(RunForOutput const &)
Definition: OutputModule.h:220
ModuleDescription moduleDescription_
Definition: OutputModule.h:163
#define FDEBUG(lev)
Definition: DebugMacros.h:20
bool edm::OutputModule::doEvent ( EventPrincipal const &  ep,
EventSetup const &  c,
ActivityRegistry act,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 253 of file OutputModule.cc.

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

256  {
257 
258  FDEBUG(2) << "writeEvent called\n";
259 
260  {
262  e.setConsumer(this);
263  EventSignalsSentry sentry(act,mcc);
264  write(e);
265  }
266  if(remainingEvents_ > 0) {
268  }
269  return true;
270  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:163
#define FDEBUG(lev)
Definition: DebugMacros.h:20
std::atomic< int > remainingEvents_
Definition: OutputModule.h:140
virtual void write(EventForOutput const &)=0
void edm::OutputModule::doOpenFile ( FileBlock const &  fb)
private

Definition at line 349 of file OutputModule.cc.

References openFile().

349  {
350  openFile(fb);
351  }
virtual void openFile(FileBlock const &)
Definition: OutputModule.h:225
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:169
std::string process_name_
Definition: OutputModule.h:160
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:166
std::vector< std::string > const & getAllTriggerNames()
void edm::OutputModule::doRegisterThinnedAssociations ( ProductRegistry const &  ,
ThinnedAssociationsHelper  
)
inlineprivate

Definition at line 191 of file OutputModule.h.

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

Definition at line 357 of file OutputModule.cc.

References respondToCloseInputFile().

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

Definition at line 353 of file OutputModule.cc.

References respondToOpenInputFile().

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

Definition at line 341 of file OutputModule.cc.

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

342  {
343  FDEBUG(2) << "writeLuminosityBlock called\n";
345  lb.setConsumer(this);
347  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:163
virtual void writeLuminosityBlock(LuminosityBlockForOutput const &)=0
#define FDEBUG(lev)
Definition: DebugMacros.h:20
void edm::OutputModule::doWriteRun ( RunPrincipal const &  rp,
ModuleCallingContext const *  mcc 
)
private

Definition at line 311 of file OutputModule.cc.

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

312  {
313  FDEBUG(2) << "writeRun called\n";
315  r.setConsumer(this);
316  writeRun(r);
317  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:163
#define FDEBUG(lev)
Definition: DebugMacros.h:20
virtual void writeRun(RunForOutput const &)=0
std::map<BranchID::value_type, BranchID::value_type> const& edm::OutputModule::droppedBranchIDToKeptBranchID ( )
inlineprotected

Definition at line 133 of file OutputModule.h.

133  {
135  }
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:174
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 413 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(), NanoAODOutputModule::fillDescriptions(), and DQMRootOutputModule::fillDescriptions().

413  {
414  ProductSelectorRules::fillDescription(desc, "outputCommands",defaultOutputCommands);
416  }
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 406 of file OutputModule.cc.

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

406  {
408  desc.setUnknown();
409  descriptions.addDefault(desc);
410  }
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
bool edm::OutputModule::hasAcquire ( ) const
inlineprivate

Definition at line 229 of file OutputModule.h.

229 { return false; }
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:158
virtual bool edm::OutputModule::isFileOpen ( ) const
inlineprivatevirtual

Definition at line 231 of file OutputModule.h.

Referenced by doCloseFile().

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:157
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 241 of file OutputModule.h.

241 {return remainingEvents_ == 0;}
std::atomic< int > remainingEvents_
Definition: OutputModule.h:140
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_;}
ModuleDescription const& edm::OutputModule::moduleDescription ( ) const
inlineprotected

Definition at line 104 of file OutputModule.h.

104  { return moduleDescription_;
105  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:163
bool edm::OutputModule::needToRunSelection ( ) const
private

Definition at line 227 of file OutputModule.cc.

References wantAllEvents_.

227  {
228  return !wantAllEvents_;
229  }
virtual void edm::OutputModule::openFile ( FileBlock const &  )
inlineprivatevirtual
OutputModule& edm::OutputModule::operator= ( OutputModule const &  )
delete
void edm::OutputModule::preActionBeforeRunEventAsync ( WaitingTask iTask,
ModuleCallingContext const &  iModuleCallingContext,
Principal const &  iPrincipal 
) const
inlineprotected

Definition at line 117 of file OutputModule.h.

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

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

Definition at line 244 of file OutputModule.cc.

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

244  {
245  if(wantAllEvents_) return true;
246  auto& s = selectors_[id.value()];
248  e.setConsumer(this);
249  return s.wantEvent(e);
250  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:163
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
Definition: OutputModule.h:166
void edm::OutputModule::prevalidate ( ConfigurationDescriptions )
static

Definition at line 419 of file OutputModule.cc.

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

419  {
420  }
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:160
std::vector< ProductResolverIndexAndSkipBit > edm::OutputModule::productsUsedBySelection ( ) const
private

Definition at line 232 of file OutputModule.cc.

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

232  {
233  std::vector<ProductResolverIndexAndSkipBit> returnValue;
234  auto const& s = selectors_[0];
235  auto const n = s.numberOfTokens();
236  returnValue.reserve(n);
237 
238  for(unsigned int i=0; i< n;++i) {
239  returnValue.emplace_back(uncheckedIndexFrom(s.token(i)));
240  }
241  return returnValue;
242  }
ProductResolverIndexAndSkipBit uncheckedIndexFrom(EDGetToken) const
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
Definition: OutputModule.h:166
void edm::OutputModule::reallyCloseFile ( )
privatevirtual

Definition at line 367 of file OutputModule.cc.

Referenced by doCloseFile().

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

Definition at line 207 of file OutputModule.h.

207 {}
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:140
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 401 of file OutputModule.cc.

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

Referenced by selectProducts().

401  {
402  return productSelector_.selected(desc);
403  }
bool selected(BranchDescription const &desc) const
ProductSelector productSelector_
Definition: OutputModule.h:162
ParameterSetID edm::OutputModule::selectorConfig ( ) const
inlineprotected

Definition at line 107 of file OutputModule.h.

References EnergyCorrector::c.

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

107 { return selector_config_id_; }
ParameterSetID selector_config_id_
Definition: OutputModule.h:170
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:158
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:174
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:179
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
Definition: OutputModule.h:178
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:162
bool initialized() const
void initialize(ProductSelectorRules const &rules, std::vector< BranchDescription const * > const &branchDescriptions)
ProductSelectorRules productSelectorRules_
Definition: OutputModule.h:161
void edm::OutputModule::setEventSelectionInfo ( std::map< std::string, std::vector< std::pair< std::string, int > > > const &  outputModulePathPositions,
bool  anyProductProduced 
)
protected

Definition at line 430 of file OutputModule.cc.

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

431  {
433  description().moduleLabel(),
434  outputModulePathPositions,
435  anyProductProduced);
436  }
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:170
void edm::OutputModule::setModuleDescription ( ModuleDescription const &  md)
inlineprivate

Definition at line 237 of file OutputModule.h.

237  {
238  moduleDescription_ = md;
239  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:163
SharedResourcesAcquirer& edm::OutputModule::sharedResourcesAcquirer ( )
inlineprivate

Definition at line 196 of file OutputModule.h.

196  {
197  return resourceAcquirer_;
198  }
SharedResourcesAcquirer resourceAcquirer_
Definition: OutputModule.h:181
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 391 of file OutputModule.cc.

References thinnedAssociationsHelper_.

391  {
392  return thinnedAssociationsHelper_.get();
393  }
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
Definition: OutputModule.h:178
bool edm::OutputModule::wantAllEvents ( ) const
inline

Definition at line 89 of file OutputModule.h.

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

89 {return wantAllEvents_;}
static bool edm::OutputModule::wantsGlobalLuminosityBlocks ( )
inlinestatic

Definition at line 85 of file OutputModule.h.

85 {return true;}
static bool edm::OutputModule::wantsGlobalRuns ( )
inlinestatic

Definition at line 84 of file OutputModule.h.

84 {return true;}
static bool edm::OutputModule::wantsStreamLuminosityBlocks ( )
inlinestatic

Definition at line 87 of file OutputModule.h.

87 {return false;};
static bool edm::OutputModule::wantsStreamRuns ( )
inlinestatic

Definition at line 86 of file OutputModule.h.

86 {return false;}
std::string edm::OutputModule::workerType ( ) const
inlineprivate

Definition at line 194 of file OutputModule.h.

194 {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 175 of file OutputModule.h.

Referenced by branchIDLists().

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

Definition at line 174 of file OutputModule.h.

Referenced by branchIDLists(), and selectProducts().

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

Definition at line 158 of file OutputModule.h.

Referenced by OutputModule(), and selectProducts().

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

Definition at line 179 of file OutputModule.h.

Referenced by selectProducts().

SelectedProductsForBranchType edm::OutputModule::keptProducts_
private

Definition at line 157 of file OutputModule.h.

Referenced by keepThisBranch().

int edm::OutputModule::maxEvents_
private

Definition at line 139 of file OutputModule.h.

Referenced by configure().

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

Definition at line 176 of file OutputModule.h.

Referenced by branchIDLists(), and configure().

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

Definition at line 160 of file OutputModule.h.

Referenced by doPreallocate(), and OutputModule().

ProductSelector edm::OutputModule::productSelector_
private

Definition at line 162 of file OutputModule.h.

Referenced by selected(), and selectProducts().

ProductSelectorRules edm::OutputModule::productSelectorRules_
private

Definition at line 161 of file OutputModule.h.

Referenced by selectProducts().

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

Definition at line 140 of file OutputModule.h.

Referenced by configure(), and doEvent().

SharedResourcesAcquirer edm::OutputModule::resourceAcquirer_
private

Definition at line 181 of file OutputModule.h.

Referenced by doBeginJob().

ParameterSet edm::OutputModule::selectEvents_
private

Definition at line 169 of file OutputModule.h.

Referenced by doPreallocate(), and OutputModule().

ParameterSetID edm::OutputModule::selector_config_id_
private

Definition at line 170 of file OutputModule.h.

Referenced by OutputModule(), and setEventSelectionInfo().

std::vector<detail::TriggerResultsBasedEventSelector> edm::OutputModule::selectors_
private
edm::propagate_const<std::unique_ptr<ThinnedAssociationsHelper> > edm::OutputModule::thinnedAssociationsHelper_
private

Definition at line 178 of file OutputModule.h.

Referenced by selectProducts(), and thinnedAssociationsHelper().

bool edm::OutputModule::wantAllEvents_
private

Definition at line 165 of file OutputModule.h.

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