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::one::OutputModuleBase Class Referenceabstract

#include <OutputModuleBase.h>

Inheritance diagram for edm::one::OutputModuleBase:
edm::EDConsumerBase edm::one::OutputModule< T > edm::one::outputmodule::InputFileWatcher edm::one::outputmodule::LuminosityBlockWatcher edm::one::outputmodule::RunWatcher edm::one::OutputModule< WatchInputFiles > edm::PoolOutputModule edm::TimeoutPoolOutputModule

Public Types

typedef OutputModuleBase 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
 
const ModuleDescriptionmoduleDescription () const
 
OutputModuleBaseoperator= (OutputModuleBase const &)=delete
 
 OutputModuleBase (ParameterSet const &pset)
 
 OutputModuleBase (OutputModuleBase const &)=delete
 
std::string const & processName () const
 
int remainingEvents () const
 
bool selected (BranchDescription const &desc) const
 
void selectProducts (ProductRegistry const &preg)
 
bool wantAllEvents () const
 
virtual ~OutputModuleBase ()
 
- 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
 
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 *)
 
bool doBeginRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)
 
bool doEndRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
 
bool doEvent (EventPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
 
void doPreallocate (PreallocationConfiguration const &)
 
std::map< BranchID::value_type,
BranchID::value_type > const & 
droppedBranchIDToKeptBranchID ()
 
Trig getTriggerResults (EventPrincipal const &ep, ModuleCallingContext const *) 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 doBeginLuminosityBlock_ (LuminosityBlockPrincipal const &, ModuleCallingContext const *)
 
virtual void doBeginRun_ (RunPrincipal const &, ModuleCallingContext const *)
 
void doCloseFile ()
 Tell the OutputModule that is must end the current file. More...
 
virtual void doEndLuminosityBlock_ (LuminosityBlockPrincipal const &, ModuleCallingContext const *)
 
virtual void doEndRun_ (RunPrincipal const &, ModuleCallingContext const *)
 
void doOpenFile (FileBlock const &fb)
 
void doPostForkReacquireResources (unsigned int iChildIndex, unsigned int iNumberOfChildren)
 
void doPreForkReleaseResources ()
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
virtual void doRespondToCloseInputFile_ (FileBlock const &)
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
virtual void doRespondToOpenInputFile_ (FileBlock const &)
 
void doWriteLuminosityBlock (LuminosityBlockPrincipal const &lbp, ModuleCallingContext const *)
 
void doWriteRun (RunPrincipal const &rp, ModuleCallingContext const *)
 
virtual void endJob ()
 
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 (OutputModuleBase const *, ProductRegistry 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_
 
BranchIDLists const * origBranchIDLists_
 
std::string process_name_
 
ProductSelector productSelector_
 
ProductSelectorRules productSelectorRules_
 
int remainingEvents_
 
ParameterSetID selector_config_id_
 
detail::TriggerResultsBasedEventSelector selectors_
 
bool wantAllEvents_
 

Friends

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

Detailed Description

Definition at line 59 of file OutputModuleBase.h.

Member Typedef Documentation

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

Definition at line 173 of file OutputModuleBase.h.

Definition at line 64 of file OutputModuleBase.h.

Constructor & Destructor Documentation

OutputModuleBase::OutputModuleBase ( ParameterSet const &  pset)
explicit

Definition at line 39 of file OutputModuleBase.cc.

References edm::detail::configureEventSelector(), edm::getAllTriggerNames(), edm::ParameterSet::getUntrackedParameterSet(), hasNewlyDroppedBranch_, edm::ParameterSet::id(), process_name_, edm::ParameterSet::registerIt(), 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),
55  branchChildren_() {
56 
57  hasNewlyDroppedBranch_.fill(false);
58 
60  process_name_ = tns->getProcessName();
61 
62  ParameterSet selectevents =
63  pset.getUntrackedParameterSet("SelectEvents", ParameterSet());
64 
65  selectevents.registerIt(); // Just in case this PSet is not registered
66 
67  selector_config_id_ = selectevents.id();
71  selectors_);
72  }
std::unique_ptr< BranchIDLists > branchIDLists_
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
SelectedProductsForBranchType keptProducts_
ModuleDescription moduleDescription_
ProductSelectorRules productSelectorRules_
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
std::vector< std::string > const & getAllTriggerNames()
BranchIDLists const * origBranchIDLists_
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
ProductSelector productSelector_
bool configureEventSelector(edm::ParameterSet const &iPSet, std::string const &iProcessName, std::vector< std::string > const &iAllTriggerNames, edm::detail::TriggerResultsBasedEventSelector &oSelector)
detail::TriggerResultsBasedEventSelector selectors_
ParameterSetID selector_config_id_
OutputModuleBase::~OutputModuleBase ( )
virtual

Definition at line 166 of file OutputModuleBase.cc.

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

Member Function Documentation

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

Definition at line 338 of file OutputModuleBase.cc.

References edm::one::kBaseType().

338  {
339  return kBaseType;
340  }
static const std::string kBaseType("EDAnalyzer")
virtual void edm::one::OutputModuleBase::beginJob ( void  )
inlineprivatevirtual

Reimplemented in edm::PoolOutputModule.

Definition at line 210 of file OutputModuleBase.h.

Referenced by doBeginJob().

210 {}
BranchChildren const& edm::one::OutputModuleBase::branchChildren ( ) const
inline

Definition at line 92 of file OutputModuleBase.h.

References branchChildren_.

Referenced by edm::RootOutputFile::writeProductDependencies().

92 {return branchChildren_;}
BranchIDLists const * OutputModuleBase::branchIDLists ( ) const

Definition at line 289 of file OutputModuleBase.cc.

References branchIDLists_, droppedBranchIDToKeptBranchID_, and origBranchIDLists_.

Referenced by edm::RootOutputFile::writeBranchIDListRegistry().

289  {
290  if(!droppedBranchIDToKeptBranchID_.empty()) {
291  // Make a private copy of the BranchIDLists.
293  // Check for branches dropped while an EDAlias was kept.
294  for(BranchIDList& branchIDList : *branchIDLists_) {
295  for(BranchID::value_type& branchID : branchIDList) {
296  // 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.
297  std::map<BranchID::value_type, BranchID::value_type>::const_iterator iter = droppedBranchIDToKeptBranchID_.find(branchID);
298  if(iter != droppedBranchIDToKeptBranchID_.end()) {
299  branchID = iter->second;
300  }
301  }
302  }
303  return branchIDLists_.get();
304  }
305  return origBranchIDLists_;
306  }
std::unique_ptr< BranchIDLists > branchIDLists_
unsigned int value_type
Definition: BranchID.h:16
std::vector< BranchID::value_type > BranchIDList
Definition: BranchIDList.h:18
BranchIDLists const * origBranchIDLists_
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
void OutputModuleBase::configure ( OutputModuleDescription const &  desc)
protected
ModuleDescription const & OutputModuleBase::description ( ) const
protected

Definition at line 309 of file OutputModuleBase.cc.

References moduleDescription_.

Referenced by setEventSelectionInfo().

309  {
310  return moduleDescription_;
311  }
ModuleDescription moduleDescription_
void OutputModuleBase::doBeginJob ( )
protected

Definition at line 168 of file OutputModuleBase.cc.

References beginJob().

168  {
169  this->beginJob();
170  }
bool OutputModuleBase::doBeginLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 223 of file OutputModuleBase.cc.

References doBeginLuminosityBlock_().

225  {
226  doBeginLuminosityBlock_(lbp, mcc);
227  return true;
228  }
virtual void doBeginLuminosityBlock_(LuminosityBlockPrincipal const &, ModuleCallingContext const *)
virtual void edm::one::OutputModuleBase::doBeginLuminosityBlock_ ( LuminosityBlockPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual

Reimplemented in edm::one::outputmodule::LuminosityBlockWatcher.

Definition at line 223 of file OutputModuleBase.h.

Referenced by doBeginLuminosityBlock().

223 {}
bool OutputModuleBase::doBeginRun ( RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 201 of file OutputModuleBase.cc.

References doBeginRun_().

203  {
204  doBeginRun_(rp, mcc);
205  return true;
206  }
virtual void doBeginRun_(RunPrincipal const &, ModuleCallingContext const *)
virtual void edm::one::OutputModuleBase::doBeginRun_ ( RunPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual

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

Definition at line 221 of file OutputModuleBase.h.

Referenced by doBeginRun().

221 {}
void OutputModuleBase::doCloseFile ( )
private

Tell the OutputModule that is must end the current file.

Definition at line 276 of file OutputModuleBase.cc.

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

276  {
277  if(isFileOpen()) {
279  reallyCloseFile();
280  branchParents_.clear();
282  }
283  }
virtual bool isFileOpen() const
void OutputModuleBase::doEndJob ( )
protected

Definition at line 172 of file OutputModuleBase.cc.

References endJob().

172  {
173  endJob();
174  }
bool OutputModuleBase::doEndLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 231 of file OutputModuleBase.cc.

References doEndLuminosityBlock_().

233  {
234  doEndLuminosityBlock_(lbp, mcc);
235  return true;
236  }
virtual void doEndLuminosityBlock_(LuminosityBlockPrincipal const &, ModuleCallingContext const *)
virtual void edm::one::OutputModuleBase::doEndLuminosityBlock_ ( LuminosityBlockPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual

Reimplemented in edm::one::outputmodule::LuminosityBlockWatcher.

Definition at line 224 of file OutputModuleBase.h.

Referenced by doEndLuminosityBlock().

224 {}
bool OutputModuleBase::doEndRun ( RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 209 of file OutputModuleBase.cc.

References doEndRun_().

211  {
212  doEndRun_(rp, mcc);
213  return true;
214  }
virtual void doEndRun_(RunPrincipal const &, ModuleCallingContext const *)
virtual void edm::one::OutputModuleBase::doEndRun_ ( RunPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual

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

Definition at line 222 of file OutputModuleBase.h.

Referenced by doEndRun().

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

Definition at line 182 of file OutputModuleBase.cc.

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

184  {
185  detail::TRBESSentry products_sentry(selectors_);
186 
187  if(!wantAllEvents_) {
188  if(!selectors_.wantEvent(ep, mcc)) {
189  return true;
190  }
191  }
192  write(ep, mcc);
194  if(remainingEvents_ > 0) {
196  }
197  return true;
198  }
bool wantEvent(EventPrincipal const &e, ModuleCallingContext const *)
virtual void write(EventPrincipal const &e, ModuleCallingContext const *)=0
void updateBranchParents(EventPrincipal const &ep)
detail::TriggerResultsBasedEventSelector selectors_
void OutputModuleBase::doOpenFile ( FileBlock const &  fb)
private

Definition at line 243 of file OutputModuleBase.cc.

References openFile().

243  {
244  openFile(fb);
245  }
virtual void openFile(FileBlock const &)
void OutputModuleBase::doPostForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
)
private

Definition at line 261 of file OutputModuleBase.cc.

References postForkReacquireResources().

261  {
262  postForkReacquireResources(iChildIndex, iNumberOfChildren);
263  }
virtual void postForkReacquireResources(unsigned int, unsigned int)
void edm::one::OutputModuleBase::doPreallocate ( PreallocationConfiguration const &  )
inlineprotected

Definition at line 109 of file OutputModuleBase.h.

109 {}
void OutputModuleBase::doPreForkReleaseResources ( )
private

Definition at line 256 of file OutputModuleBase.cc.

References preForkReleaseResources().

256  {
258  }
virtual void preForkReleaseResources()
void OutputModuleBase::doRespondToCloseInputFile ( FileBlock const &  fb)
private

Definition at line 251 of file OutputModuleBase.cc.

References doRespondToCloseInputFile_().

251  {
253  }
virtual void doRespondToCloseInputFile_(FileBlock const &)
virtual void edm::one::OutputModuleBase::doRespondToCloseInputFile_ ( FileBlock const &  )
inlineprivatevirtual

Reimplemented in edm::one::outputmodule::InputFileWatcher.

Definition at line 226 of file OutputModuleBase.h.

Referenced by doRespondToCloseInputFile().

226 {}
void OutputModuleBase::doRespondToOpenInputFile ( FileBlock const &  fb)
private

Definition at line 247 of file OutputModuleBase.cc.

References doRespondToOpenInputFile_().

247  {
249  }
virtual void doRespondToOpenInputFile_(FileBlock const &)
virtual void edm::one::OutputModuleBase::doRespondToOpenInputFile_ ( FileBlock const &  )
inlineprivatevirtual

Reimplemented in edm::one::outputmodule::InputFileWatcher.

Definition at line 225 of file OutputModuleBase.h.

Referenced by doRespondToOpenInputFile().

225 {}
void OutputModuleBase::doWriteLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
ModuleCallingContext const *  mcc 
)
private

Definition at line 238 of file OutputModuleBase.cc.

References writeLuminosityBlock().

239  {
240  writeLuminosityBlock(lbp, mcc);
241  }
virtual void writeLuminosityBlock(LuminosityBlockPrincipal const &, ModuleCallingContext const *)=0
void OutputModuleBase::doWriteRun ( RunPrincipal const &  rp,
ModuleCallingContext const *  mcc 
)
private

Definition at line 217 of file OutputModuleBase.cc.

References writeRun().

218  {
219  writeRun(rp, mcc);
220  }
virtual void writeRun(RunPrincipal const &, ModuleCallingContext const *)=0
std::map<BranchID::value_type, BranchID::value_type> const& edm::one::OutputModuleBase::droppedBranchIDToKeptBranchID ( )
inlineprotected

Definition at line 129 of file OutputModuleBase.h.

References droppedBranchIDToKeptBranchID_.

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

Definition at line 211 of file OutputModuleBase.h.

Referenced by doEndJob().

211 {}
void OutputModuleBase::fillDependencyGraph ( )
private

Definition at line 367 of file OutputModuleBase.cc.

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

Referenced by doCloseFile().

367  {
368  for(BranchParents::const_iterator i = branchParents_.begin(), iEnd = branchParents_.end();
369  i != iEnd; ++i) {
370  BranchID const& child = i->first;
371  std::set<ParentageID> const& eIds = i->second;
372  for(std::set<ParentageID>::const_iterator it = eIds.begin(), itEnd = eIds.end();
373  it != itEnd; ++it) {
374  Parentage entryDesc;
375  ParentageRegistry::instance()->getMapped(*it, entryDesc);
376  std::vector<BranchID> const& parents = entryDesc.parents();
377  for(std::vector<BranchID>::const_iterator j = parents.begin(), jEnd = parents.end();
378  j != jEnd; ++j) {
379  branchChildren_.insertChild(*j, child);
380  }
381  }
382  }
383  }
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
static ParentageRegistry * instance()
void OutputModuleBase::fillDescription ( ParameterSetDescription desc)
static

Definition at line 326 of file OutputModuleBase.cc.

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

326  {
327  ProductSelectorRules::fillDescription(desc, "outputCommands");
329  }
static void fillDescription(ParameterSetDescription &desc, char const *parameterName)
static void fillDescription(ParameterSetDescription &desc)
void OutputModuleBase::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 319 of file OutputModuleBase.cc.

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

319  {
321  desc.setUnknown();
322  descriptions.addDefault(desc);
323  }
Trig OutputModuleBase::getTriggerResults ( EventPrincipal const &  ep,
ModuleCallingContext const *  mcc 
) const
protected

Definition at line 177 of file OutputModuleBase.cc.

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

178  {
179  return selectors_.getOneTriggerResults(ep, mcc); }
handle_t getOneTriggerResults(EventPrincipal const &e, ModuleCallingContext const *)
detail::TriggerResultsBasedEventSelector selectors_
std::array<bool, NumBranchTypes> const& edm::one::OutputModuleBase::hasNewlyDroppedBranch ( ) const
inline

Definition at line 85 of file OutputModuleBase.h.

References hasNewlyDroppedBranch_.

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

Reimplemented in edm::PoolOutputModule.

Definition at line 215 of file OutputModuleBase.h.

Referenced by doCloseFile(), and maybeOpenFile().

215 { return true; }
SelectedProductsForBranchType const& edm::one::OutputModuleBase::keptProducts ( ) const
inline
bool edm::one::OutputModuleBase::limitReached ( ) const
inlineprivate

Definition at line 235 of file OutputModuleBase.h.

References remainingEvents_.

235 {return remainingEvents_ == 0;}
int edm::one::OutputModuleBase::maxEvents ( ) const
inline

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

Definition at line 74 of file OutputModuleBase.h.

References maxEvents_.

void OutputModuleBase::maybeOpenFile ( )
private

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

Definition at line 272 of file OutputModuleBase.cc.

References isFileOpen(), and reallyOpenFile().

272  {
273  if(!isFileOpen()) reallyOpenFile();
274  }
virtual bool isFileOpen() const
const ModuleDescription& edm::one::OutputModuleBase::moduleDescription ( ) const
inline

Definition at line 98 of file OutputModuleBase.h.

References moduleDescription_.

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

Reimplemented in edm::PoolOutputModule.

Definition at line 269 of file OutputModuleBase.cc.

Referenced by doPostForkReacquireResources().

269 {}
void OutputModuleBase::preForkReleaseResources ( )
privatevirtual

Definition at line 266 of file OutputModuleBase.cc.

Referenced by doPreForkReleaseResources().

266 {}
void OutputModuleBase::prevalidate ( ConfigurationDescriptions )
static

Definition at line 332 of file OutputModuleBase.cc.

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

Definition at line 83 of file OutputModuleBase.h.

References process_name_.

83 {return process_name_;}
void OutputModuleBase::reallyCloseFile ( )
privatevirtual

Reimplemented in edm::PoolOutputModule.

Definition at line 285 of file OutputModuleBase.cc.

Referenced by doCloseFile().

285  {
286  }
virtual void edm::one::OutputModuleBase::reallyOpenFile ( )
inlineprivatevirtual

Reimplemented in edm::PoolOutputModule.

Definition at line 216 of file OutputModuleBase.h.

Referenced by maybeOpenFile().

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

Definition at line 198 of file OutputModuleBase.h.

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

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

Definition at line 78 of file OutputModuleBase.h.

References remainingEvents_.

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

bool OutputModuleBase::selected ( BranchDescription const &  desc) const

Definition at line 314 of file OutputModuleBase.cc.

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

Referenced by selectProducts().

314  {
315  return productSelector_.selected(desc);
316  }
bool selected(BranchDescription const &desc) const
ProductSelector productSelector_
ParameterSetID edm::one::OutputModuleBase::selectorConfig ( ) const
inlineprotected

Definition at line 107 of file OutputModuleBase.h.

References selector_config_id_.

Referenced by edm::RootOutputFile::writeOne().

107 { return selector_config_id_; }
ParameterSetID selector_config_id_
void OutputModuleBase::selectProducts ( ProductRegistry const &  preg)

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

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

Definition at line 343 of file OutputModuleBase.cc.

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

344  {
346  description().moduleLabel(),
347  outputModulePathPositions,
348  anyProductProduced);
349  }
ModuleDescription const & description() const
ParameterSet const & getParameterSet(ParameterSetID const &id)
ParameterSetID registerProperSelectionInfo(edm::ParameterSet const &iInitial, std::string const &iLabel, std::map< std::string, std::vector< std::pair< std::string, int > > > const &outputModulePathPositions, bool anyProductProduced)
ParameterSetID selector_config_id_
void edm::one::OutputModuleBase::setModuleDescription ( ModuleDescription const &  md)
inlineprivate

Definition at line 228 of file OutputModuleBase.h.

References moduleDescription_.

228  {
229  moduleDescription_ = md;
230  }
ModuleDescription moduleDescription_
virtual bool edm::one::OutputModuleBase::shouldWeCloseFile ( ) const
inlineprivatevirtual

Ask the OutputModule if we should end the current file.

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

Definition at line 207 of file OutputModuleBase.h.

207 {return false;}
void OutputModuleBase::updateBranchParents ( EventPrincipal const &  ep)
private

Definition at line 352 of file OutputModuleBase.cc.

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

Referenced by doEvent().

352  {
353  for(EventPrincipal::const_iterator i = ep.begin(), iEnd = ep.end(); i != iEnd; ++i) {
354  if((*i) && (*i)->productProvenancePtr() != 0) {
355  BranchID const& bid = (*i)->branchDescription().branchID();
356  BranchParents::iterator it = branchParents_.find(bid);
357  if(it == branchParents_.end()) {
358  it = branchParents_.insert(std::make_pair(bid, std::set<ParentageID>())).first;
359  }
360  it->second.insert((*i)->productProvenancePtr()->parentageID());
362  }
363  }
364  }
int i
Definition: DBlmapReader.cc:9
void insertEmpty(BranchID parent)
boost::filter_iterator< FilledProductPtr, ProductHolderCollection::const_iterator > const_iterator
Definition: Principal.h:58
bool edm::one::OutputModuleBase::wantAllEvents ( ) const
inline
std::string edm::one::OutputModuleBase::workerType ( ) const
inlineprivate

Definition at line 189 of file OutputModuleBase.h.

189 {return "WorkerT<edm::one::OutputModuleBase>";}
virtual void edm::one::OutputModuleBase::write ( EventPrincipal const &  e,
ModuleCallingContext const *   
)
privatepure virtual
virtual void edm::one::OutputModuleBase::writeLuminosityBlock ( LuminosityBlockPrincipal const &  ,
ModuleCallingContext const *   
)
privatepure virtual

Implemented in edm::PoolOutputModule.

Referenced by doWriteLuminosityBlock().

virtual void edm::one::OutputModuleBase::writeRun ( RunPrincipal const &  ,
ModuleCallingContext const *   
)
privatepure virtual

Implemented in edm::PoolOutputModule.

Referenced by doWriteRun().

Friends And Related Function Documentation

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

Definition at line 63 of file OutputModuleBase.h.

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

Definition at line 62 of file OutputModuleBase.h.

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

Definition at line 61 of file OutputModuleBase.h.

Member Data Documentation

BranchChildren edm::one::OutputModuleBase::branchChildren_
private
std::unique_ptr<BranchIDLists> edm::one::OutputModuleBase::branchIDLists_
private

Definition at line 170 of file OutputModuleBase.h.

Referenced by branchIDLists().

BranchParents edm::one::OutputModuleBase::branchParents_
private

Definition at line 174 of file OutputModuleBase.h.

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

std::map<BranchID::value_type, BranchID::value_type> edm::one::OutputModuleBase::droppedBranchIDToKeptBranchID_
private
std::array<bool, NumBranchTypes> edm::one::OutputModuleBase::hasNewlyDroppedBranch_
private

Definition at line 154 of file OutputModuleBase.h.

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

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

Definition at line 153 of file OutputModuleBase.h.

Referenced by keptProducts(), and selectProducts().

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

Definition at line 135 of file OutputModuleBase.h.

Referenced by configure(), and maxEvents().

ModuleDescription edm::one::OutputModuleBase::moduleDescription_
private

Definition at line 159 of file OutputModuleBase.h.

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

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

Definition at line 171 of file OutputModuleBase.h.

Referenced by branchIDLists(), and configure().

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

Definition at line 156 of file OutputModuleBase.h.

Referenced by OutputModuleBase(), and processName().

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

Definition at line 158 of file OutputModuleBase.h.

Referenced by selected(), and selectProducts().

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

Definition at line 157 of file OutputModuleBase.h.

Referenced by selectProducts().

int edm::one::OutputModuleBase::remainingEvents_
private

Definition at line 136 of file OutputModuleBase.h.

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

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

Definition at line 165 of file OutputModuleBase.h.

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

detail::TriggerResultsBasedEventSelector edm::one::OutputModuleBase::selectors_
mutableprivate

Definition at line 162 of file OutputModuleBase.h.

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

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

Definition at line 161 of file OutputModuleBase.h.

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