CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
edm::OutputModule Class Referenceabstract

#include <OutputModule.h>

Inheritance diagram for edm::OutputModule:
edm::EDConsumerBase edm::AsciiOutputModule edm::GetProductCheckerOutputModule edm::ProvenanceCheckerOutputModule edm::StreamerOutputModuleBase FRDEventOutputModule< Consumer > RawEventOutputModuleForBU< Consumer > edm::StreamerOutputModule< Consumer > evf::RecoEventOutputModuleForFU< Consumer >

Public Types

typedef OutputModule ModuleType
 

Public Member Functions

BranchChildren const & branchChildren () const
 
BranchIDLists const * branchIDLists () const
 
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)
 
bool wantAllEvents () const
 
virtual ~OutputModule ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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 *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 (EventPrincipal const &ep, ModuleCallingContext const *) const
 
ModuleDescription const & moduleDescription () 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 Types

typedef std::map< BranchID,
std::set< ParentageID > > 
BranchParents
 

Private Member Functions

virtual void beginJob ()
 
virtual void beginLuminosityBlock (LuminosityBlockPrincipal const &, ModuleCallingContext const *)
 
virtual void beginRun (RunPrincipal const &, ModuleCallingContext 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 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 (LuminosityBlockPrincipal const &, ModuleCallingContext const *)
 
virtual void endRun (RunPrincipal const &, ModuleCallingContext const *)
 
void fillDependencyGraph ()
 
virtual bool isFileOpen () const
 
bool limitReached () const
 
void maybeOpenFile ()
 
virtual void openFile (FileBlock const &)
 
virtual void postForkReacquireResources (unsigned int, unsigned int)
 
virtual void preForkReleaseResources ()
 
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)
 
virtual bool shouldWeCloseFile () const
 Ask the OutputModule if we should end the current file. More...
 
void updateBranchParents (EventPrincipal const &ep)
 
std::string workerType () const
 
virtual void write (EventPrincipal const &e, ModuleCallingContext const *)=0
 
virtual void writeLuminosityBlock (LuminosityBlockPrincipal const &, ModuleCallingContext const *)=0
 
virtual void writeRun (RunPrincipal const &, ModuleCallingContext const *)=0
 

Private Attributes

BranchChildren branchChildren_
 
std::unique_ptr< BranchIDListsbranchIDLists_
 
BranchParents branchParents_
 
std::map< BranchID::value_type,
BranchID::value_type
droppedBranchIDToKeptBranchID_
 
std::array< bool, NumBranchTypeshasNewlyDroppedBranch_
 
SelectedProductsForBranchType keptProducts_
 
int maxEvents_
 
ModuleDescription moduleDescription_
 
std::mutex mutex_
 
BranchIDLists const * origBranchIDLists_
 
std::string process_name_
 
ProductSelector productSelector_
 
ProductSelectorRules productSelectorRules_
 
std::atomic< int > remainingEvents_
 
SharedResourcesAcquirer resourceAcquirer_
 
ParameterSetID selector_config_id_
 
detail::TriggerResultsBasedEventSelector selectors_
 
bool wantAllEvents_
 

Friends

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

Detailed Description

Definition at line 47 of file OutputModule.h.

Member Typedef Documentation

typedef std::map<BranchID, std::set<ParentageID> > edm::OutputModule::BranchParents
private

Definition at line 165 of file OutputModule.h.

Definition at line 52 of file OutputModule.h.

Constructor & Destructor Documentation

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

Definition at line 31 of file OutputModule.cc.

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

31  :
32  maxEvents_(-1),
34  keptProducts_(),
36  process_name_(),
37  productSelectorRules_(pset, "outputCommands", "OutputModule"),
40  wantAllEvents_(false),
41  selectors_(),
45  origBranchIDLists_(nullptr),
47  branchChildren_() {
48 
49  hasNewlyDroppedBranch_.fill(false);
50 
52  process_name_ = tns->getProcessName();
53 
54  ParameterSet selectevents =
55  pset.getUntrackedParameterSet("SelectEvents", ParameterSet());
56 
57  selectevents.registerIt(); // Just in case this PSet is not registered
58 
59  selector_config_id_ = selectevents.id();
63  selectors_);
66 
67  }
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: OutputModule.h:146
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:161
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
ModuleDescription moduleDescription_
Definition: OutputModule.h:151
BranchIDLists const * origBranchIDLists_
Definition: OutputModule.h:163
std::string process_name_
Definition: OutputModule.h:148
static SharedResourcesRegistry * instance()
std::unique_ptr< BranchIDLists > branchIDLists_
Definition: OutputModule.h:162
detail::TriggerResultsBasedEventSelector selectors_
Definition: OutputModule.h:154
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.
SelectedProductsForBranchType keptProducts_
Definition: OutputModule.h:145
ProductSelector productSelector_
Definition: OutputModule.h:150
std::vector< std::string > const & getAllTriggerNames()
BranchChildren branchChildren_
Definition: OutputModule.h:168
ProductSelectorRules productSelectorRules_
Definition: OutputModule.h:149
std::atomic< int > remainingEvents_
Definition: OutputModule.h:128
bool configureEventSelector(edm::ParameterSet const &iPSet, std::string const &iProcessName, std::vector< std::string > const &iAllTriggerNames, edm::detail::TriggerResultsBasedEventSelector &oSelector)
BranchParents branchParents_
Definition: OutputModule.h:166
ParameterSetID selector_config_id_
Definition: OutputModule.h:157
edm::OutputModule::~OutputModule ( )
virtual

Definition at line 161 of file OutputModule.cc.

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

Member Function Documentation

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

Definition at line 364 of file OutputModule.cc.

References edm::kBaseType().

364  {
365  return kBaseType;
366  }
static const std::string kBaseType("EDAnalyzer")
virtual void edm::OutputModule::beginJob ( void  )
inlineprivatevirtual

Reimplemented in edm::StreamerOutputModuleBase.

Definition at line 204 of file OutputModule.h.

Referenced by doBeginJob().

204 {}
virtual void edm::OutputModule::beginLuminosityBlock ( LuminosityBlockPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual
virtual void edm::OutputModule::beginRun ( RunPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual
BranchChildren const& edm::OutputModule::branchChildren ( ) const
inline

Definition at line 80 of file OutputModule.h.

References branchChildren_.

80 {return branchChildren_;}
BranchChildren branchChildren_
Definition: OutputModule.h:168
BranchIDLists const * edm::OutputModule::branchIDLists ( ) const

Definition at line 315 of file OutputModule.cc.

References branchIDLists_, droppedBranchIDToKeptBranchID_, and origBranchIDLists_.

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

315  {
316  if(!droppedBranchIDToKeptBranchID_.empty()) {
317  // Make a private copy of the BranchIDLists.
319  // Check for branches dropped while an EDAlias was kept.
320  for(BranchIDList& branchIDList : *branchIDLists_) {
321  for(BranchID::value_type& branchID : branchIDList) {
322  // 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.
323  std::map<BranchID::value_type, BranchID::value_type>::const_iterator iter = droppedBranchIDToKeptBranchID_.find(branchID);
324  if(iter != droppedBranchIDToKeptBranchID_.end()) {
325  branchID = iter->second;
326  }
327  }
328  }
329  return branchIDLists_.get();
330  }
331  return origBranchIDLists_;
332  }
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:161
BranchIDLists const * origBranchIDLists_
Definition: OutputModule.h:163
unsigned int value_type
Definition: BranchID.h:16
std::unique_ptr< BranchIDLists > branchIDLists_
Definition: OutputModule.h:162
std::vector< BranchID::value_type > BranchIDList
Definition: BranchIDList.h:18
void edm::OutputModule::configure ( OutputModuleDescription const &  desc)
protected

Definition at line 69 of file OutputModule.cc.

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

69  {
70  remainingEvents_ = maxEvents_ = desc.maxEvents_;
71  origBranchIDLists_ = desc.branchIDLists_;
72  }
BranchIDLists const * origBranchIDLists_
Definition: OutputModule.h:163
std::atomic< int > remainingEvents_
Definition: OutputModule.h:128
ModuleDescription const & edm::OutputModule::description ( ) const
protected

Definition at line 335 of file OutputModule.cc.

References moduleDescription_.

Referenced by edm::StreamerOutputModuleBase::serializeRegistry(), and setEventSelectionInfo().

335  {
336  return moduleDescription_;
337  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:151
void edm::OutputModule::doBeginJob ( )
protected

Definition at line 163 of file OutputModule.cc.

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

163  {
164  std::vector<std::string> res = {SharedResourcesRegistry::kLegacyModuleResourceName};
166 
167  this->beginJob();
168  }
SharedResourcesAcquirer resourceAcquirer_
Definition: OutputModule.h:170
SharedResourcesAcquirer createAcquirer(std::vector< std::string > const &) const
static SharedResourcesRegistry * instance()
static const std::string kLegacyModuleResourceName
All legacy modules share this resource.
virtual void beginJob()
Definition: OutputModule.h:204
bool edm::OutputModule::doBeginLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 253 of file OutputModule.cc.

References beginLuminosityBlock(), and FDEBUG.

255  {
256  FDEBUG(2) << "beginLuminosityBlock called\n";
257  beginLuminosityBlock(lbp, mcc);
258  return true;
259  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void beginLuminosityBlock(LuminosityBlockPrincipal const &, ModuleCallingContext const *)
Definition: OutputModule.h:209
bool edm::OutputModule::doBeginRun ( RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 228 of file OutputModule.cc.

References beginRun(), and FDEBUG.

230  {
231  FDEBUG(2) << "beginRun called\n";
232  beginRun(rp, mcc);
233  return true;
234  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void beginRun(RunPrincipal const &, ModuleCallingContext const *)
Definition: OutputModule.h:206
void edm::OutputModule::doCloseFile ( )
private

Tell the OutputModule that is must end the current file.

Definition at line 302 of file OutputModule.cc.

References branchChildren_, branchParents_, edm::BranchChildren::clear(), fillDependencyGraph(), isFileOpen(), and reallyCloseFile().

302  {
303  if(isFileOpen()) {
305  reallyCloseFile();
306  branchParents_.clear();
308  }
309  }
virtual void reallyCloseFile()
virtual bool isFileOpen() const
Definition: OutputModule.h:218
void fillDependencyGraph()
BranchChildren branchChildren_
Definition: OutputModule.h:168
BranchParents branchParents_
Definition: OutputModule.h:166
void edm::OutputModule::doEndJob ( )
protected

Definition at line 170 of file OutputModule.cc.

References endJob().

170  {
171  endJob();
172  }
virtual void endJob()
Definition: OutputModule.h:205
bool edm::OutputModule::doEndLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 262 of file OutputModule.cc.

References endLuminosityBlock(), and FDEBUG.

264  {
265  FDEBUG(2) << "endLuminosityBlock called\n";
266  endLuminosityBlock(lbp, mcc);
267  return true;
268  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void endLuminosityBlock(LuminosityBlockPrincipal const &, ModuleCallingContext const *)
Definition: OutputModule.h:210
bool edm::OutputModule::doEndRun ( RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 237 of file OutputModule.cc.

References endRun(), and FDEBUG.

239  {
240  FDEBUG(2) << "endRun called\n";
241  endRun(rp, mcc);
242  return true;
243  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void endRun(RunPrincipal const &, ModuleCallingContext const *)
Definition: OutputModule.h:207
bool edm::OutputModule::doEvent ( EventPrincipal const &  ep,
EventSetup const &  c,
ActivityRegistry act,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 182 of file OutputModule.cc.

References FDEBUG, mutex_, remainingEvents_, resourceAcquirer_, selectors_, updateBranchParents(), wantAllEvents_, edm::detail::TriggerResultsBasedEventSelector::wantEvent(), and write().

185  {
186 
187  FDEBUG(2) << "writeEvent called\n";
188 
189  {
190  std::lock_guard<std::mutex> guard(mutex_);
191  detail::TRBESSentry products_sentry(selectors_);
192  if(!wantAllEvents_) {
193  if(!selectors_.wantEvent(ep, mcc)) {
194  return true;
195  }
196  }
197 
198  {
199  std::lock_guard<SharedResourcesAcquirer> guardAcq(resourceAcquirer_);
200  EventSignalsSentry signals(act,mcc);
201  write(ep, mcc);
202  }
204  }
205  if(remainingEvents_ > 0) {
207  }
208  return true;
209  }
virtual void write(EventPrincipal const &e, ModuleCallingContext const *)=0
SharedResourcesAcquirer resourceAcquirer_
Definition: OutputModule.h:170
void updateBranchParents(EventPrincipal const &ep)
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::mutex mutex_
Definition: OutputModule.h:171
detail::TriggerResultsBasedEventSelector selectors_
Definition: OutputModule.h:154
bool wantEvent(EventPrincipal const &e, ModuleCallingContext const *)
std::atomic< int > remainingEvents_
Definition: OutputModule.h:128
void edm::OutputModule::doOpenFile ( FileBlock const &  fb)
private

Definition at line 276 of file OutputModule.cc.

References openFile().

276  {
277  openFile(fb);
278  }
virtual void openFile(FileBlock const &)
Definition: OutputModule.h:212
void edm::OutputModule::doPostForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
)
private

Definition at line 294 of file OutputModule.cc.

References postForkReacquireResources().

294  {
295  postForkReacquireResources(iChildIndex, iNumberOfChildren);
296  }
virtual void postForkReacquireResources(unsigned int, unsigned int)
Definition: OutputModule.h:216
void edm::OutputModule::doPreallocate ( PreallocationConfiguration const &  )
inlineprotected

Definition at line 100 of file OutputModule.h.

100 {}
void edm::OutputModule::doPreForkReleaseResources ( )
private

Definition at line 289 of file OutputModule.cc.

References preForkReleaseResources().

289  {
291  }
virtual void preForkReleaseResources()
Definition: OutputModule.h:215
void edm::OutputModule::doRespondToCloseInputFile ( FileBlock const &  fb)
private

Definition at line 284 of file OutputModule.cc.

References respondToCloseInputFile().

284  {
286  }
virtual void respondToCloseInputFile(FileBlock const &)
Definition: OutputModule.h:214
void edm::OutputModule::doRespondToOpenInputFile ( FileBlock const &  fb)
private

Definition at line 280 of file OutputModule.cc.

References respondToOpenInputFile().

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

Definition at line 270 of file OutputModule.cc.

References FDEBUG, and writeLuminosityBlock().

271  {
272  FDEBUG(2) << "writeLuminosityBlock called\n";
273  writeLuminosityBlock(lbp, mcc);
274  }
virtual void writeLuminosityBlock(LuminosityBlockPrincipal const &, ModuleCallingContext const *)=0
#define FDEBUG(lev)
Definition: DebugMacros.h:18
void edm::OutputModule::doWriteRun ( RunPrincipal const &  rp,
ModuleCallingContext const *  mcc 
)
private

Definition at line 246 of file OutputModule.cc.

References FDEBUG, and writeRun().

247  {
248  FDEBUG(2) << "writeRun called\n";
249  writeRun(rp, mcc);
250  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void writeRun(RunPrincipal const &, ModuleCallingContext const *)=0
std::map<BranchID::value_type, BranchID::value_type> const& edm::OutputModule::droppedBranchIDToKeptBranchID ( )
inlineprotected

Definition at line 121 of file OutputModule.h.

References droppedBranchIDToKeptBranchID_.

121  {
123  }
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:161
virtual void edm::OutputModule::endJob ( void  )
inlineprivatevirtual

Reimplemented in edm::StreamerOutputModuleBase.

Definition at line 205 of file OutputModule.h.

Referenced by doEndJob().

205 {}
virtual void edm::OutputModule::endLuminosityBlock ( LuminosityBlockPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual

Reimplemented in evf::RecoEventOutputModuleForFU< Consumer >, and RawEventOutputModuleForBU< Consumer >.

Definition at line 210 of file OutputModule.h.

Referenced by doEndLuminosityBlock().

210 {}
virtual void edm::OutputModule::endRun ( RunPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual
void edm::OutputModule::fillDependencyGraph ( )
private

Definition at line 393 of file OutputModule.cc.

References branchChildren_, branchParents_, edm::ParentageRegistry::getMapped(), i, edm::BranchChildren::insertChild(), edm::ParentageRegistry::instance(), j, parents, and edm::Parentage::parents().

Referenced by doCloseFile().

393  {
394  for(BranchParents::const_iterator i = branchParents_.begin(), iEnd = branchParents_.end();
395  i != iEnd; ++i) {
396  BranchID const& child = i->first;
397  std::set<ParentageID> const& eIds = i->second;
398  for(std::set<ParentageID>::const_iterator it = eIds.begin(), itEnd = eIds.end();
399  it != itEnd; ++it) {
400  Parentage entryDesc;
401  ParentageRegistry::instance()->getMapped(*it, entryDesc);
402  std::vector<BranchID> const& parents = entryDesc.parents();
403  for(std::vector<BranchID>::const_iterator j = parents.begin(), jEnd = parents.end();
404  j != jEnd; ++j) {
405  branchChildren_.insertChild(*j, child);
406  }
407  }
408  }
409  }
int i
Definition: DBlmapReader.cc:9
TPRegexp parents
Definition: eve_filter.cc:24
void insertChild(BranchID parent, BranchID child)
bool getMapped(key_type const &k, value_type &result) const
int j
Definition: DBlmapReader.cc:9
BranchChildren branchChildren_
Definition: OutputModule.h:168
static ParentageRegistry * instance()
BranchParents branchParents_
Definition: OutputModule.h:166
void edm::OutputModule::fillDescription ( ParameterSetDescription desc)
static
void edm::OutputModule::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 345 of file OutputModule.cc.

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

345  {
347  desc.setUnknown();
348  descriptions.addDefault(desc);
349  }
Trig edm::OutputModule::getTriggerResults ( EventPrincipal const &  ep,
ModuleCallingContext const *  mcc 
) const
protected

Definition at line 175 of file OutputModule.cc.

References edm::detail::TriggerResultsBasedEventSelector::getOneTriggerResults(), and selectors_.

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

175  {
176  return selectors_.getOneTriggerResults(ep, mcc); }
detail::TriggerResultsBasedEventSelector selectors_
Definition: OutputModule.h:154
handle_t getOneTriggerResults(EventPrincipal const &e, ModuleCallingContext const *)
std::array<bool, NumBranchTypes> const& edm::OutputModule::hasNewlyDroppedBranch ( ) const
inline

Definition at line 73 of file OutputModule.h.

References hasNewlyDroppedBranch_.

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

Definition at line 218 of file OutputModule.h.

Referenced by doCloseFile(), and maybeOpenFile().

218 { return true; }
SelectedProductsForBranchType const& edm::OutputModule::keptProducts ( ) const
inline

Definition at line 72 of file OutputModule.h.

References keptProducts_.

72 {return keptProducts_;}
SelectedProductsForBranchType keptProducts_
Definition: OutputModule.h:145
bool edm::OutputModule::limitReached ( ) const
inlineprivate

Definition at line 229 of file OutputModule.h.

References remainingEvents_.

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

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

Definition at line 62 of file OutputModule.h.

References maxEvents_.

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

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

Definition at line 298 of file OutputModule.cc.

References isFileOpen(), and reallyOpenFile().

298  {
299  if(!isFileOpen()) reallyOpenFile();
300  }
virtual void reallyOpenFile()
Definition: OutputModule.h:220
virtual bool isFileOpen() const
Definition: OutputModule.h:218
ModuleDescription const& edm::OutputModule::moduleDescription ( ) const
inlineprotected

Definition at line 95 of file OutputModule.h.

References moduleDescription_.

95  { return moduleDescription_;
96  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:151
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 216 of file OutputModule.h.

Referenced by doPostForkReacquireResources().

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

Definition at line 215 of file OutputModule.h.

Referenced by doPreForkReleaseResources().

215 {}
void edm::OutputModule::prevalidate ( ConfigurationDescriptions )
static

Definition at line 358 of file OutputModule.cc.

358  {
359  }
std::string const& edm::OutputModule::processName ( ) const
inline

Definition at line 71 of file OutputModule.h.

References process_name_.

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

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

Definition at line 311 of file OutputModule.cc.

Referenced by doCloseFile().

311  {
312  }
virtual void edm::OutputModule::reallyOpenFile ( )
inlineprivatevirtual

Definition at line 220 of file OutputModule.h.

Referenced by maybeOpenFile().

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

Definition at line 198 of file OutputModule.h.

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

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

Definition at line 66 of file OutputModule.h.

References remainingEvents_.

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

Definition at line 214 of file OutputModule.h.

Referenced by doRespondToCloseInputFile().

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

Definition at line 213 of file OutputModule.h.

Referenced by doRespondToOpenInputFile().

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

Definition at line 340 of file OutputModule.cc.

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

Referenced by selectProducts(), and edm::AsciiOutputModule::write().

340  {
341  return productSelector_.selected(desc);
342  }
bool selected(BranchDescription const &desc) const
ProductSelector productSelector_
Definition: OutputModule.h:150
ParameterSetID edm::OutputModule::selectorConfig ( ) const
inlineprotected

Definition at line 98 of file OutputModule.h.

References selector_config_id_.

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

98 { return selector_config_id_; }
ParameterSetID selector_config_id_
Definition: OutputModule.h:157
void edm::OutputModule::selectProducts ( ProductRegistry const &  preg)

Definition at line 74 of file OutputModule.cc.

References edm::ProductRegistry::allBranchDescriptions(), edm::BranchDescription::branchID(), edm::BranchDescription::branchType(), edm::errors::Configuration, edm::EDConsumerBase::consumes(), droppedBranchIDToKeptBranchID_, edm::hlt::Exception, hasNewlyDroppedBranch_, edm::BranchID::id(), edm::InEvent, edm::ProductSelector::initialize(), edm::ProductSelector::initialized(), edm::InLumi, edm::InRun, edm::BranchDescription::isAlias(), keptProducts_, edm::BranchDescription::moduleLabel(), edm::BranchDescription::originalBranchID(), edm::BranchDescription::present(), edm::BranchDescription::processName(), edm::BranchDescription::produced(), edm::PRODUCT_TYPE, edm::BranchDescription::productInstanceName(), edm::ProductRegistry::productList(), productSelector_, productSelectorRules_, selected(), edm::BranchDescription::transient(), and edm::BranchDescription::unwrappedTypeID().

74  {
75  if(productSelector_.initialized()) return;
76  productSelector_.initialize(productSelectorRules_, preg.allBranchDescriptions());
77 
78  // TODO: See if we can collapse keptProducts_ and productSelector_ into a
79  // single object. See the notes in the header for ProductSelector
80  // for more information.
81 
82  std::map<BranchID, BranchDescription const*> trueBranchIDToKeptBranchDesc;
83 
84  for(auto const& it : preg.productList()) {
85  BranchDescription const& desc = it.second;
86  if(desc.transient()) {
87  // if the class of the branch is marked transient, output nothing
88  } else if(!desc.present() && !desc.produced()) {
89  // else if the branch containing the product has been previously dropped,
90  // output nothing
91  } else if(selected(desc)) {
92  // else if the branch has been selected, put it in the list of selected branches.
93  if(desc.produced()) {
94  // First we check if an equivalent branch has already been selected due to an EDAlias.
95  // We only need the check for products produced in this process.
96  BranchID const& trueBranchID = desc.originalBranchID();
97  std::map<BranchID, BranchDescription const*>::const_iterator iter = trueBranchIDToKeptBranchDesc.find(trueBranchID);
98  if(iter != trueBranchIDToKeptBranchDesc.end()) {
99  throw edm::Exception(errors::Configuration, "Duplicate Output Selection")
100  << "Two (or more) equivalent branches have been selected for output.\n"
101  << "#1: " << BranchKey(desc) << "\n"
102  << "#2: " << BranchKey(*iter->second) << "\n"
103  << "Please drop at least one of them.\n";
104  }
105  trueBranchIDToKeptBranchDesc.insert(std::make_pair(trueBranchID, &desc));
106  }
107  switch (desc.branchType()) {
108  case InEvent:
109  {
110  consumes(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
111  InputTag{desc.moduleLabel(),
112  desc.productInstanceName(),
113  desc.processName()});
114  break;
115  }
116  case InLumi:
117  {
118  consumes<InLumi>(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
119  InputTag(desc.moduleLabel(),
120  desc.productInstanceName(),
121  desc.processName()));
122  break;
123  }
124  case InRun:
125  {
126  consumes<InRun>(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
127  InputTag(desc.moduleLabel(),
128  desc.productInstanceName(),
129  desc.processName()));
130  break;
131  }
132  default:
133  assert(false);
134  break;
135  }
136  // Now put it in the list of selected branches.
137  keptProducts_[desc.branchType()].push_back(&desc);
138  } else {
139  // otherwise, output nothing,
140  // and mark the fact that there is a newly dropped branch of this type.
141  hasNewlyDroppedBranch_[desc.branchType()] = true;
142  }
143  }
144  // Now fill in a mapping needed in the case that a branch was dropped while its EDAlias was kept.
145  for(auto const& it : preg.productList()) {
146  BranchDescription const& desc = it.second;
147  if(!desc.produced() || desc.isAlias()) continue;
148  BranchID const& branchID = desc.branchID();
149  std::map<BranchID, BranchDescription const*>::const_iterator iter = trueBranchIDToKeptBranchDesc.find(branchID);
150  if(iter != trueBranchIDToKeptBranchDesc.end()) {
151  // This branch, produced in this process, or an alias of it, was persisted.
152  BranchID const& keptBranchID = iter->second->branchID();
153  if(keptBranchID != branchID) {
154  // An EDAlias branch was persisted.
155  droppedBranchIDToKeptBranchID_.insert(std::make_pair(branchID.id(), keptBranchID.id()));
156  }
157  }
158  }
159  }
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: OutputModule.h:146
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:161
bool selected(BranchDescription const &desc) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
SelectedProductsForBranchType keptProducts_
Definition: OutputModule.h:145
ProductSelector productSelector_
Definition: OutputModule.h:150
bool initialized() const
void initialize(ProductSelectorRules const &rules, std::vector< BranchDescription const * > const &branchDescriptions)
ProductSelectorRules productSelectorRules_
Definition: OutputModule.h:149
preg
Definition: Schedule.cc:369
void edm::OutputModule::setEventSelectionInfo ( std::map< std::string, std::vector< std::pair< std::string, int > > > const &  outputModulePathPositions,
bool  anyProductProduced 
)
protected

Definition at line 369 of file OutputModule.cc.

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

370  {
372  description().moduleLabel(),
373  outputModulePathPositions,
374  anyProductProduced);
375  }
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:157
void edm::OutputModule::setModuleDescription ( ModuleDescription const &  md)
inlineprivate

Definition at line 222 of file OutputModule.h.

References moduleDescription_.

222  {
223  moduleDescription_ = md;
224  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:151
virtual bool edm::OutputModule::shouldWeCloseFile ( ) const
inlineprivatevirtual

Ask the OutputModule if we should end the current file.

Definition at line 201 of file OutputModule.h.

201 {return false;}
void edm::OutputModule::updateBranchParents ( EventPrincipal const &  ep)
private

Definition at line 378 of file OutputModule.cc.

References edm::Principal::begin(), branchChildren_, branchParents_, edm::Principal::end(), i, and edm::BranchChildren::insertEmpty().

Referenced by doEvent().

378  {
379  for(EventPrincipal::const_iterator i = ep.begin(), iEnd = ep.end(); i != iEnd; ++i) {
380  if((*i) && (*i)->productProvenancePtr() != 0) {
381  BranchID const& bid = (*i)->branchDescription().branchID();
382  BranchParents::iterator it = branchParents_.find(bid);
383  if(it == branchParents_.end()) {
384  it = branchParents_.insert(std::make_pair(bid, std::set<ParentageID>())).first;
385  }
386  it->second.insert((*i)->productProvenancePtr()->parentageID());
388  }
389  }
390  }
int i
Definition: DBlmapReader.cc:9
void insertEmpty(BranchID parent)
BranchChildren branchChildren_
Definition: OutputModule.h:168
boost::filter_iterator< FilledProductPtr, ProductHolderCollection::const_iterator > const_iterator
Definition: Principal.h:58
BranchParents branchParents_
Definition: OutputModule.h:166
bool edm::OutputModule::wantAllEvents ( ) const
inline

Definition at line 82 of file OutputModule.h.

References wantAllEvents_.

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

Definition at line 184 of file OutputModule.h.

184 {return "WorkerT<OutputModule>";}
virtual void edm::OutputModule::write ( EventPrincipal const &  e,
ModuleCallingContext const *   
)
privatepure virtual
virtual void edm::OutputModule::writeLuminosityBlock ( LuminosityBlockPrincipal const &  ,
ModuleCallingContext const *   
)
privatepure virtual
virtual void edm::OutputModule::writeRun ( RunPrincipal const &  ,
ModuleCallingContext const *   
)
privatepure virtual

Friends And Related Function Documentation

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

Definition at line 49 of file OutputModule.h.

template<typename T >
friend class OutputModuleCommunicatorT
friend

Definition at line 51 of file OutputModule.h.

template<typename T >
friend class WorkerT
friend

Definition at line 50 of file OutputModule.h.

Member Data Documentation

BranchChildren edm::OutputModule::branchChildren_
private
std::unique_ptr<BranchIDLists> edm::OutputModule::branchIDLists_
private

Definition at line 162 of file OutputModule.h.

Referenced by branchIDLists().

BranchParents edm::OutputModule::branchParents_
private

Definition at line 166 of file OutputModule.h.

Referenced by doCloseFile(), fillDependencyGraph(), and updateBranchParents().

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

Definition at line 161 of file OutputModule.h.

Referenced by branchIDLists(), droppedBranchIDToKeptBranchID(), and selectProducts().

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

Definition at line 146 of file OutputModule.h.

Referenced by hasNewlyDroppedBranch(), OutputModule(), and selectProducts().

SelectedProductsForBranchType edm::OutputModule::keptProducts_
private

Definition at line 145 of file OutputModule.h.

Referenced by keptProducts(), and selectProducts().

int edm::OutputModule::maxEvents_
private

Definition at line 127 of file OutputModule.h.

Referenced by configure(), and maxEvents().

ModuleDescription edm::OutputModule::moduleDescription_
private

Definition at line 151 of file OutputModule.h.

Referenced by description(), moduleDescription(), and setModuleDescription().

std::mutex edm::OutputModule::mutex_
private

Definition at line 171 of file OutputModule.h.

Referenced by doEvent().

BranchIDLists const* edm::OutputModule::origBranchIDLists_
private

Definition at line 163 of file OutputModule.h.

Referenced by branchIDLists(), and configure().

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

Definition at line 148 of file OutputModule.h.

Referenced by OutputModule(), and processName().

ProductSelector edm::OutputModule::productSelector_
private

Definition at line 150 of file OutputModule.h.

Referenced by selected(), and selectProducts().

ProductSelectorRules edm::OutputModule::productSelectorRules_
private

Definition at line 149 of file OutputModule.h.

Referenced by selectProducts().

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

Definition at line 128 of file OutputModule.h.

Referenced by configure(), doEvent(), limitReached(), and remainingEvents().

SharedResourcesAcquirer edm::OutputModule::resourceAcquirer_
private

Definition at line 170 of file OutputModule.h.

Referenced by doBeginJob(), and doEvent().

ParameterSetID edm::OutputModule::selector_config_id_
private

Definition at line 157 of file OutputModule.h.

Referenced by OutputModule(), selectorConfig(), and setEventSelectionInfo().

detail::TriggerResultsBasedEventSelector edm::OutputModule::selectors_
mutableprivate

Definition at line 154 of file OutputModule.h.

Referenced by doEvent(), getTriggerResults(), and OutputModule().

bool edm::OutputModule::wantAllEvents_
private

Definition at line 153 of file OutputModule.h.

Referenced by doEvent(), OutputModule(), and wantAllEvents().