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::one::OutputModule<> edm::PoolOutputModule DQMRootOutputModule 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
 
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 *)
 
bool doBeginRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)
 
bool doEndRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
 
bool doEvent (EventPrincipal const &ep, EventSetup const &c, ActivityRegistry *, ModuleCallingContext const *)
 
void doPreallocate (PreallocationConfiguration const &)
 
std::map< BranchID::value_type,
BranchID::value_type > const & 
droppedBranchIDToKeptBranchID ()
 
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 SharedResourcesAcquirer createAcquirer ()
 
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_
 
std::mutex mutex_
 
BranchIDLists const * origBranchIDLists_
 
std::string process_name_
 
ProductSelector productSelector_
 
ProductSelectorRules productSelectorRules_
 
std::atomic< int > remainingEvents_
 
SharedResourcesAcquirer resourcesAcquirer_
 
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 62 of file OutputModuleBase.h.

Member Typedef Documentation

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

Definition at line 177 of file OutputModuleBase.h.

Definition at line 67 of file OutputModuleBase.h.

Constructor & Destructor Documentation

OutputModuleBase::OutputModuleBase ( ParameterSet const &  pset)
explicit

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

40  :
41  maxEvents_(-1),
43  keptProducts_(),
45  process_name_(),
46  productSelectorRules_(pset, "outputCommands", "OutputModule"),
49  wantAllEvents_(false),
50  selectors_(),
54  origBranchIDLists_(nullptr),
56  branchChildren_() {
57 
58  hasNewlyDroppedBranch_.fill(false);
59 
61  process_name_ = tns->getProcessName();
62 
63  ParameterSet selectevents =
64  pset.getUntrackedParameterSet("SelectEvents", ParameterSet());
65 
66  selectevents.registerIt(); // Just in case this PSet is not registered
67 
68  selector_config_id_ = selectevents.id();
72  selectors_);
73  }
std::unique_ptr< BranchIDLists > branchIDLists_
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
SelectedProductsForBranchType keptProducts_
ModuleDescription moduleDescription_
ProductSelectorRules productSelectorRules_
std::atomic< int > remainingEvents_
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 167 of file OutputModuleBase.cc.

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

Member Function Documentation

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

Definition at line 352 of file OutputModuleBase.cc.

References edm::one::kBaseType().

352  {
353  return kBaseType;
354  }
static const std::string kBaseType("EDAnalyzer")
virtual void edm::one::OutputModuleBase::beginJob ( void  )
inlineprivatevirtual

Reimplemented in edm::PoolOutputModule.

Definition at line 219 of file OutputModuleBase.h.

Referenced by doBeginJob().

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

Definition at line 95 of file OutputModuleBase.h.

References branchChildren_.

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

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

Definition at line 303 of file OutputModuleBase.cc.

References branchIDLists_, droppedBranchIDToKeptBranchID_, and origBranchIDLists_.

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

303  {
304  if(!droppedBranchIDToKeptBranchID_.empty()) {
305  // Make a private copy of the BranchIDLists.
307  // Check for branches dropped while an EDAlias was kept.
308  for(BranchIDList& branchIDList : *branchIDLists_) {
309  for(BranchID::value_type& branchID : branchIDList) {
310  // 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.
311  std::map<BranchID::value_type, BranchID::value_type>::const_iterator iter = droppedBranchIDToKeptBranchID_.find(branchID);
312  if(iter != droppedBranchIDToKeptBranchID_.end()) {
313  branchID = iter->second;
314  }
315  }
316  }
317  return branchIDLists_.get();
318  }
319  return origBranchIDLists_;
320  }
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
SharedResourcesAcquirer OutputModuleBase::createAcquirer ( )
privatevirtual

Definition at line 169 of file OutputModuleBase.cc.

Referenced by doBeginJob().

169  {
170  return SharedResourcesAcquirer{};
171  }
ModuleDescription const & OutputModuleBase::description ( ) const
protected

Definition at line 323 of file OutputModuleBase.cc.

References moduleDescription_.

Referenced by DQMRootOutputModule::openFile(), and setEventSelectionInfo().

323  {
324  return moduleDescription_;
325  }
ModuleDescription moduleDescription_
void OutputModuleBase::doBeginJob ( )
protected

Definition at line 173 of file OutputModuleBase.cc.

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

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

Definition at line 237 of file OutputModuleBase.cc.

References doBeginLuminosityBlock_().

239  {
240  doBeginLuminosityBlock_(lbp, mcc);
241  return true;
242  }
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 232 of file OutputModuleBase.h.

Referenced by doBeginLuminosityBlock().

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

Definition at line 215 of file OutputModuleBase.cc.

References doBeginRun_().

217  {
218  doBeginRun_(rp, mcc);
219  return true;
220  }
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 230 of file OutputModuleBase.h.

Referenced by doBeginRun().

230 {}
void OutputModuleBase::doCloseFile ( )
private

Tell the OutputModule that is must end the current file.

Definition at line 290 of file OutputModuleBase.cc.

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

290  {
291  if(isFileOpen()) {
293  reallyCloseFile();
294  branchParents_.clear();
296  }
297  }
virtual bool isFileOpen() const
void OutputModuleBase::doEndJob ( )
protected

Definition at line 178 of file OutputModuleBase.cc.

References endJob().

178  {
179  endJob();
180  }
bool OutputModuleBase::doEndLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 245 of file OutputModuleBase.cc.

References doEndLuminosityBlock_().

247  {
248  doEndLuminosityBlock_(lbp, mcc);
249  return true;
250  }
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 233 of file OutputModuleBase.h.

Referenced by doEndLuminosityBlock().

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

Definition at line 223 of file OutputModuleBase.cc.

References doEndRun_().

225  {
226  doEndRun_(rp, mcc);
227  return true;
228  }
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 231 of file OutputModuleBase.h.

Referenced by doEndRun().

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

Definition at line 188 of file OutputModuleBase.cc.

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

191  {
192 
193  {
194  std::lock_guard<std::mutex> guard(mutex_);
195  detail::TRBESSentry products_sentry(selectors_);
196  if(!wantAllEvents_) {
197  if(!selectors_.wantEvent(ep, mcc)) {
198  return true;
199  }
200  }
201  {
202  std::lock_guard<SharedResourcesAcquirer> guard(resourcesAcquirer_);
203  EventSignalsSentry sentry(act,mcc);
204  write(ep, mcc);
205  }
207  }
208  if(remainingEvents_ > 0) {
210  }
211  return true;
212  }
std::atomic< int > remainingEvents_
SharedResourcesAcquirer resourcesAcquirer_
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 257 of file OutputModuleBase.cc.

References openFile().

257  {
258  openFile(fb);
259  }
virtual void openFile(FileBlock const &)
void OutputModuleBase::doPostForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
)
private

Definition at line 275 of file OutputModuleBase.cc.

References postForkReacquireResources().

275  {
276  postForkReacquireResources(iChildIndex, iNumberOfChildren);
277  }
virtual void postForkReacquireResources(unsigned int, unsigned int)
void edm::one::OutputModuleBase::doPreallocate ( PreallocationConfiguration const &  )
inlineprotected

Definition at line 112 of file OutputModuleBase.h.

112 {}
void OutputModuleBase::doPreForkReleaseResources ( )
private

Definition at line 270 of file OutputModuleBase.cc.

References preForkReleaseResources().

270  {
272  }
virtual void preForkReleaseResources()
void OutputModuleBase::doRespondToCloseInputFile ( FileBlock const &  fb)
private

Definition at line 265 of file OutputModuleBase.cc.

References doRespondToCloseInputFile_().

265  {
267  }
virtual void doRespondToCloseInputFile_(FileBlock const &)
virtual void edm::one::OutputModuleBase::doRespondToCloseInputFile_ ( FileBlock const &  )
inlineprivatevirtual

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

Definition at line 235 of file OutputModuleBase.h.

Referenced by doRespondToCloseInputFile().

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

Definition at line 261 of file OutputModuleBase.cc.

References doRespondToOpenInputFile_().

261  {
263  }
virtual void doRespondToOpenInputFile_(FileBlock const &)
virtual void edm::one::OutputModuleBase::doRespondToOpenInputFile_ ( FileBlock const &  )
inlineprivatevirtual

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

Definition at line 234 of file OutputModuleBase.h.

Referenced by doRespondToOpenInputFile().

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

Definition at line 252 of file OutputModuleBase.cc.

References writeLuminosityBlock().

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

Definition at line 231 of file OutputModuleBase.cc.

References writeRun().

232  {
233  writeRun(rp, mcc);
234  }
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 133 of file OutputModuleBase.h.

References droppedBranchIDToKeptBranchID_.

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

Definition at line 220 of file OutputModuleBase.h.

Referenced by doEndJob().

220 {}
void OutputModuleBase::fillDependencyGraph ( )
private

Definition at line 381 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().

381  {
382  for(BranchParents::const_iterator i = branchParents_.begin(), iEnd = branchParents_.end();
383  i != iEnd; ++i) {
384  BranchID const& child = i->first;
385  std::set<ParentageID> const& eIds = i->second;
386  for(std::set<ParentageID>::const_iterator it = eIds.begin(), itEnd = eIds.end();
387  it != itEnd; ++it) {
388  Parentage entryDesc;
389  ParentageRegistry::instance()->getMapped(*it, entryDesc);
390  std::vector<BranchID> const& parents = entryDesc.parents();
391  for(std::vector<BranchID>::const_iterator j = parents.begin(), jEnd = parents.end();
392  j != jEnd; ++j) {
393  branchChildren_.insertChild(*j, child);
394  }
395  }
396  }
397  }
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 340 of file OutputModuleBase.cc.

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

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

Definition at line 333 of file OutputModuleBase.cc.

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

333  {
335  desc.setUnknown();
336  descriptions.addDefault(desc);
337  }
Trig OutputModuleBase::getTriggerResults ( EventPrincipal const &  ep,
ModuleCallingContext const *  mcc 
) const
protected

Definition at line 183 of file OutputModuleBase.cc.

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

184  {
185  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 88 of file OutputModuleBase.h.

References hasNewlyDroppedBranch_.

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

Reimplemented in DQMRootOutputModule, and edm::PoolOutputModule.

Definition at line 224 of file OutputModuleBase.h.

Referenced by doCloseFile(), and maybeOpenFile().

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

Definition at line 244 of file OutputModuleBase.h.

References remainingEvents_.

244 {return remainingEvents_ == 0;}
std::atomic< int > remainingEvents_
int edm::one::OutputModuleBase::maxEvents ( ) const
inline

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

Definition at line 77 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 286 of file OutputModuleBase.cc.

References isFileOpen(), and reallyOpenFile().

286  {
287  if(!isFileOpen()) reallyOpenFile();
288  }
virtual bool isFileOpen() const
const ModuleDescription& edm::one::OutputModuleBase::moduleDescription ( ) const
inline

Definition at line 101 of file OutputModuleBase.h.

References moduleDescription_.

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

Reimplemented in DQMRootOutputModule, and edm::PoolOutputModule.

Definition at line 283 of file OutputModuleBase.cc.

Referenced by doPostForkReacquireResources().

283 {}
void OutputModuleBase::preForkReleaseResources ( )
privatevirtual

Definition at line 280 of file OutputModuleBase.cc.

Referenced by doPreForkReleaseResources().

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

Definition at line 346 of file OutputModuleBase.cc.

346  {
347  }
std::string const& edm::one::OutputModuleBase::processName ( ) const
inline

Definition at line 86 of file OutputModuleBase.h.

References process_name_.

Referenced by DQMRootOutputModule::startEndFile().

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

Reimplemented in DQMRootOutputModule, and edm::PoolOutputModule.

Definition at line 299 of file OutputModuleBase.cc.

Referenced by doCloseFile().

299  {
300  }
virtual void edm::one::OutputModuleBase::reallyOpenFile ( )
inlineprivatevirtual

Reimplemented in edm::PoolOutputModule.

Definition at line 225 of file OutputModuleBase.h.

Referenced by maybeOpenFile().

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

Definition at line 207 of file OutputModuleBase.h.

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

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

Definition at line 81 of file OutputModuleBase.h.

References remainingEvents_.

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

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

Definition at line 328 of file OutputModuleBase.cc.

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

Referenced by selectProducts().

328  {
329  return productSelector_.selected(desc);
330  }
bool selected(BranchDescription const &desc) const
ProductSelector productSelector_
ParameterSetID edm::one::OutputModuleBase::selectorConfig ( ) const
inlineprotected

Definition at line 110 of file OutputModuleBase.h.

References selector_config_id_.

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

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

Definition at line 80 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().

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

Definition at line 357 of file OutputModuleBase.cc.

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

358  {
360  description().moduleLabel(),
361  outputModulePathPositions,
362  anyProductProduced);
363  }
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 237 of file OutputModuleBase.h.

References moduleDescription_.

237  {
238  moduleDescription_ = md;
239  }
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 216 of file OutputModuleBase.h.

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

Definition at line 366 of file OutputModuleBase.cc.

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

Referenced by doEvent().

366  {
367  for(EventPrincipal::const_iterator i = ep.begin(), iEnd = ep.end(); i != iEnd; ++i) {
368  if((*i) && (*i)->productProvenancePtr() != 0) {
369  BranchID const& bid = (*i)->branchDescription().branchID();
370  BranchParents::iterator it = branchParents_.find(bid);
371  if(it == branchParents_.end()) {
372  it = branchParents_.insert(std::make_pair(bid, std::set<ParentageID>())).first;
373  }
374  it->second.insert((*i)->productProvenancePtr()->parentageID());
376  }
377  }
378  }
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 198 of file OutputModuleBase.h.

198 {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
virtual void edm::one::OutputModuleBase::writeRun ( RunPrincipal const &  ,
ModuleCallingContext const *   
)
privatepure virtual

Implemented in DQMRootOutputModule, and edm::PoolOutputModule.

Referenced by doWriteRun().

Friends And Related Function Documentation

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

Definition at line 66 of file OutputModuleBase.h.

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

Definition at line 65 of file OutputModuleBase.h.

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

Definition at line 64 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 174 of file OutputModuleBase.h.

Referenced by branchIDLists().

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

Definition at line 178 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 158 of file OutputModuleBase.h.

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

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

Definition at line 157 of file OutputModuleBase.h.

Referenced by keptProducts(), and selectProducts().

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

Definition at line 139 of file OutputModuleBase.h.

Referenced by configure(), and maxEvents().

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

Definition at line 163 of file OutputModuleBase.h.

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

std::mutex edm::one::OutputModuleBase::mutex_
private

Definition at line 183 of file OutputModuleBase.h.

Referenced by doEvent().

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

Definition at line 175 of file OutputModuleBase.h.

Referenced by branchIDLists(), and configure().

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

Definition at line 160 of file OutputModuleBase.h.

Referenced by OutputModuleBase(), and processName().

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

Definition at line 162 of file OutputModuleBase.h.

Referenced by selected(), and selectProducts().

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

Definition at line 161 of file OutputModuleBase.h.

Referenced by selectProducts().

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

Definition at line 140 of file OutputModuleBase.h.

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

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

Definition at line 182 of file OutputModuleBase.h.

Referenced by doBeginJob(), and doEvent().

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

Definition at line 169 of file OutputModuleBase.h.

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

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

Definition at line 166 of file OutputModuleBase.h.

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

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

Definition at line 165 of file OutputModuleBase.h.

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