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 dqmservices::JsonWritingTimeoutPoolOutputModule

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, ThinnedAssociationsHelper const &)
 
ThinnedAssociationsHelper const * thinnedAssociationsHelper () const
 
bool wantAllEvents () const
 
virtual ~OutputModuleBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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 doRegisterThinnedAssociations (ProductRegistry const &, ThinnedAssociationsHelper &)
 
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
 
void keepThisBranch (BranchDescription const &desc, std::map< BranchID, BranchDescription const * > &trueBranchIDToKeptBranchDesc, std::set< BranchID > &keptProductsInEvent)
 
bool limitReached () const
 
void maybeOpenFile ()
 
virtual void openFile (FileBlock const &)
 
virtual void postForkReacquireResources (unsigned int, unsigned int)
 
virtual void preForkReleaseResources ()
 
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_
 
std::map< BranchID, bool > keepAssociation_
 
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_
 
std::unique_ptr
< ThinnedAssociationsHelper
thinnedAssociationsHelper_
 
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 66 of file OutputModuleBase.h.

Member Typedef Documentation

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

Definition at line 186 of file OutputModuleBase.h.

Definition at line 71 of file OutputModuleBase.h.

Constructor & Destructor Documentation

OutputModuleBase::OutputModuleBase ( ParameterSet const &  pset)
explicit

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

42  :
43  maxEvents_(-1),
45  keptProducts_(),
47  process_name_(),
48  productSelectorRules_(pset, "outputCommands", "OutputModule"),
51  wantAllEvents_(false),
52  selectors_(),
56  origBranchIDLists_(nullptr),
57  thinnedAssociationsHelper_(new ThinnedAssociationsHelper),
59  branchChildren_() {
60 
61  hasNewlyDroppedBranch_.fill(false);
62 
64  process_name_ = tns->getProcessName();
65 
66  ParameterSet selectevents =
67  pset.getUntrackedParameterSet("SelectEvents", ParameterSet());
68 
69  selectevents.registerIt(); // Just in case this PSet is not registered
70 
71  selector_config_id_ = selectevents.id();
75  selectors_);
76  }
std::unique_ptr< BranchIDLists > branchIDLists_
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
SelectedProductsForBranchType keptProducts_
ModuleDescription moduleDescription_
ProductSelectorRules productSelectorRules_
std::atomic< int > remainingEvents_
std::unique_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper_
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 177 of file OutputModuleBase.cc.

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

Member Function Documentation

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

Definition at line 367 of file OutputModuleBase.cc.

References edm::one::kBaseType().

367  {
368  return kBaseType;
369  }
static const std::string kBaseType("EDAnalyzer")
virtual void edm::one::OutputModuleBase::beginJob ( void  )
inlineprivatevirtual

Reimplemented in DQMRootOutputModule, and edm::PoolOutputModule.

Definition at line 231 of file OutputModuleBase.h.

Referenced by doBeginJob().

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

Definition at line 99 of file OutputModuleBase.h.

References branchChildren_.

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

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

Definition at line 313 of file OutputModuleBase.cc.

References branchIDLists_, droppedBranchIDToKeptBranchID_, getDQMSummary::iter, and origBranchIDLists_.

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

313  {
314  if(!droppedBranchIDToKeptBranchID_.empty()) {
315  // Make a private copy of the BranchIDLists.
317  // Check for branches dropped while an EDAlias was kept.
318  for(BranchIDList& branchIDList : *branchIDLists_) {
319  for(BranchID::value_type& branchID : branchIDList) {
320  // 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.
321  std::map<BranchID::value_type, BranchID::value_type>::const_iterator iter = droppedBranchIDToKeptBranchID_.find(branchID);
322  if(iter != droppedBranchIDToKeptBranchID_.end()) {
323  branchID = iter->second;
324  }
325  }
326  }
327  return branchIDLists_.get();
328  }
329  return origBranchIDLists_;
330  }
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 179 of file OutputModuleBase.cc.

Referenced by doBeginJob().

179  {
180  return SharedResourcesAcquirer{};
181  }
ModuleDescription const & OutputModuleBase::description ( ) const
protected

Definition at line 338 of file OutputModuleBase.cc.

References moduleDescription_.

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

338  {
339  return moduleDescription_;
340  }
ModuleDescription moduleDescription_
void OutputModuleBase::doBeginJob ( )
protected

Definition at line 183 of file OutputModuleBase.cc.

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

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

Definition at line 247 of file OutputModuleBase.cc.

References doBeginLuminosityBlock_().

249  {
250  doBeginLuminosityBlock_(lbp, mcc);
251  return true;
252  }
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 244 of file OutputModuleBase.h.

Referenced by doBeginLuminosityBlock().

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

Definition at line 225 of file OutputModuleBase.cc.

References doBeginRun_().

227  {
228  doBeginRun_(rp, mcc);
229  return true;
230  }
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 242 of file OutputModuleBase.h.

Referenced by doBeginRun().

242 {}
void OutputModuleBase::doCloseFile ( )
private

Tell the OutputModule that is must end the current file.

Definition at line 300 of file OutputModuleBase.cc.

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

300  {
301  if(isFileOpen()) {
303  reallyCloseFile();
304  branchParents_.clear();
306  }
307  }
virtual bool isFileOpen() const
void OutputModuleBase::doEndJob ( )
protected

Definition at line 188 of file OutputModuleBase.cc.

References endJob().

188  {
189  endJob();
190  }
bool OutputModuleBase::doEndLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 255 of file OutputModuleBase.cc.

References doEndLuminosityBlock_().

257  {
258  doEndLuminosityBlock_(lbp, mcc);
259  return true;
260  }
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 245 of file OutputModuleBase.h.

Referenced by doEndLuminosityBlock().

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

Definition at line 233 of file OutputModuleBase.cc.

References doEndRun_().

235  {
236  doEndRun_(rp, mcc);
237  return true;
238  }
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 243 of file OutputModuleBase.h.

Referenced by doEndRun().

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

Definition at line 198 of file OutputModuleBase.cc.

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

201  {
202 
203  {
204  std::lock_guard<std::mutex> guard(mutex_);
205  detail::TRBESSentry products_sentry(selectors_);
206  if(!wantAllEvents_) {
207  if(!selectors_.wantEvent(ep, mcc)) {
208  return true;
209  }
210  }
211  {
212  std::lock_guard<SharedResourcesAcquirer> guard(resourcesAcquirer_);
213  EventSignalsSentry sentry(act,mcc);
214  write(ep, mcc);
215  }
217  }
218  if(remainingEvents_ > 0) {
220  }
221  return true;
222  }
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 267 of file OutputModuleBase.cc.

References openFile().

267  {
268  openFile(fb);
269  }
virtual void openFile(FileBlock const &)
void OutputModuleBase::doPostForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
)
private

Definition at line 285 of file OutputModuleBase.cc.

References postForkReacquireResources().

285  {
286  postForkReacquireResources(iChildIndex, iNumberOfChildren);
287  }
virtual void postForkReacquireResources(unsigned int, unsigned int)
void edm::one::OutputModuleBase::doPreallocate ( PreallocationConfiguration const &  )
inlineprotected

Definition at line 118 of file OutputModuleBase.h.

118 {}
void OutputModuleBase::doPreForkReleaseResources ( )
private

Definition at line 280 of file OutputModuleBase.cc.

References preForkReleaseResources().

280  {
282  }
virtual void preForkReleaseResources()
void edm::one::OutputModuleBase::doRegisterThinnedAssociations ( ProductRegistry const &  ,
ThinnedAssociationsHelper  
)
inlineprivate

Definition at line 207 of file OutputModuleBase.h.

208  { }
void OutputModuleBase::doRespondToCloseInputFile ( FileBlock const &  fb)
private

Definition at line 275 of file OutputModuleBase.cc.

References doRespondToCloseInputFile_().

275  {
277  }
virtual void doRespondToCloseInputFile_(FileBlock const &)
virtual void edm::one::OutputModuleBase::doRespondToCloseInputFile_ ( FileBlock const &  )
inlineprivatevirtual

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

Definition at line 247 of file OutputModuleBase.h.

Referenced by doRespondToCloseInputFile().

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

Definition at line 271 of file OutputModuleBase.cc.

References doRespondToOpenInputFile_().

271  {
273  }
virtual void doRespondToOpenInputFile_(FileBlock const &)
virtual void edm::one::OutputModuleBase::doRespondToOpenInputFile_ ( FileBlock const &  )
inlineprivatevirtual

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

Definition at line 246 of file OutputModuleBase.h.

Referenced by doRespondToOpenInputFile().

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

Definition at line 262 of file OutputModuleBase.cc.

References writeLuminosityBlock().

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

Definition at line 241 of file OutputModuleBase.cc.

References writeRun().

242  {
243  writeRun(rp, mcc);
244  }
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 139 of file OutputModuleBase.h.

References droppedBranchIDToKeptBranchID_.

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

Definition at line 232 of file OutputModuleBase.h.

Referenced by doEndJob().

232 {}
void OutputModuleBase::fillDependencyGraph ( )
private

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

396  {
397  for(BranchParents::const_iterator i = branchParents_.begin(), iEnd = branchParents_.end();
398  i != iEnd; ++i) {
399  BranchID const& child = i->first;
400  std::set<ParentageID> const& eIds = i->second;
401  for(std::set<ParentageID>::const_iterator it = eIds.begin(), itEnd = eIds.end();
402  it != itEnd; ++it) {
403  Parentage entryDesc;
404  ParentageRegistry::instance()->getMapped(*it, entryDesc);
405  std::vector<BranchID> const& parents = entryDesc.parents();
406  for(std::vector<BranchID>::const_iterator j = parents.begin(), jEnd = parents.end();
407  j != jEnd; ++j) {
408  branchChildren_.insertChild(*j, child);
409  }
410  }
411  }
412  }
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 355 of file OutputModuleBase.cc.

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

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

Definition at line 348 of file OutputModuleBase.cc.

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

348  {
350  desc.setUnknown();
351  descriptions.addDefault(desc);
352  }
Trig OutputModuleBase::getTriggerResults ( EventPrincipal const &  ep,
ModuleCallingContext const *  mcc 
) const
protected

Definition at line 193 of file OutputModuleBase.cc.

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

194  {
195  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 92 of file OutputModuleBase.h.

References hasNewlyDroppedBranch_.

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

Reimplemented in DQMRootOutputModule, and edm::PoolOutputModule.

Definition at line 236 of file OutputModuleBase.h.

Referenced by doCloseFile(), and maybeOpenFile().

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

Definition at line 132 of file OutputModuleBase.cc.

References assert(), edm::BranchDescription::branchID(), edm::BranchDescription::branchType(), edm::ProductSelector::checkForDuplicateKeptBranch(), edm::EDConsumerBase::consumes(), edm::InEvent, edm::InLumi, HLT_25ns14e33_v1_cff::InputTag, edm::InRun, keptProducts_, edm::BranchDescription::moduleLabel(), edm::BranchDescription::originalBranchID(), edm::BranchDescription::processName(), edm::BranchDescription::produced(), edm::PRODUCT_TYPE, edm::BranchDescription::productInstanceName(), and edm::BranchDescription::unwrappedTypeID().

Referenced by selectProducts().

134  {
135 
137  trueBranchIDToKeptBranchDesc);
138 
139  switch (desc.branchType()) {
140  case InEvent:
141  {
142  if(desc.produced()) {
143  keptProductsInEvent.insert(desc.originalBranchID());
144  } else {
145  keptProductsInEvent.insert(desc.branchID());
146  }
147  consumes(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
148  InputTag{desc.moduleLabel(),
149  desc.productInstanceName(),
150  desc.processName()});
151  break;
152  }
153  case InLumi:
154  {
155  consumes<InLumi>(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
156  InputTag(desc.moduleLabel(),
157  desc.productInstanceName(),
158  desc.processName()));
159  break;
160  }
161  case InRun:
162  {
163  consumes<InRun>(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
164  InputTag(desc.moduleLabel(),
165  desc.productInstanceName(),
166  desc.processName()));
167  break;
168  }
169  default:
170  assert(false);
171  break;
172  }
173  // Now put it in the list of selected branches.
174  keptProducts_[desc.branchType()].push_back(&desc);
175  }
SelectedProductsForBranchType keptProducts_
assert(m_qm.get())
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
static void checkForDuplicateKeptBranch(BranchDescription const &desc, std::map< BranchID, BranchDescription const * > &trueBranchIDToKeptBranchDesc)
SelectedProductsForBranchType const& edm::one::OutputModuleBase::keptProducts ( ) const
inline
bool edm::one::OutputModuleBase::limitReached ( ) const
inlineprivate

Definition at line 260 of file OutputModuleBase.h.

References remainingEvents_.

260 {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 81 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 296 of file OutputModuleBase.cc.

References isFileOpen(), and reallyOpenFile().

296  {
297  if(!isFileOpen()) reallyOpenFile();
298  }
virtual bool isFileOpen() const
const ModuleDescription& edm::one::OutputModuleBase::moduleDescription ( ) const
inline

Definition at line 107 of file OutputModuleBase.h.

References moduleDescription_.

107  {
108  return moduleDescription_;
109  }
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 293 of file OutputModuleBase.cc.

Referenced by doPostForkReacquireResources().

293 {}
void OutputModuleBase::preForkReleaseResources ( )
privatevirtual

Definition at line 290 of file OutputModuleBase.cc.

Referenced by doPreForkReleaseResources().

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

Definition at line 361 of file OutputModuleBase.cc.

361  {
362  }
std::string const& edm::one::OutputModuleBase::processName ( ) const
inline

Definition at line 90 of file OutputModuleBase.h.

References process_name_.

Referenced by DQMRootOutputModule::startEndFile().

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

Reimplemented in DQMRootOutputModule, and edm::PoolOutputModule.

Definition at line 309 of file OutputModuleBase.cc.

Referenced by doCloseFile().

309  {
310  }
virtual void edm::one::OutputModuleBase::reallyOpenFile ( )
inlineprivatevirtual

Reimplemented in edm::PoolOutputModule.

Definition at line 237 of file OutputModuleBase.h.

Referenced by maybeOpenFile().

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

Definition at line 219 of file OutputModuleBase.h.

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

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

Definition at line 85 of file OutputModuleBase.h.

References remainingEvents_.

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

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

Definition at line 343 of file OutputModuleBase.cc.

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

Referenced by selectProducts().

343  {
344  return productSelector_.selected(desc);
345  }
bool selected(BranchDescription const &desc) const
ProductSelector productSelector_
ParameterSetID edm::one::OutputModuleBase::selectorConfig ( ) const
inlineprotected

Definition at line 116 of file OutputModuleBase.h.

References selector_config_id_.

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

116 { return selector_config_id_; }
ParameterSetID selector_config_id_
void OutputModuleBase::selectProducts ( ProductRegistry const &  preg,
ThinnedAssociationsHelper const &  thinnedAssociationsHelper 
)

Definition at line 83 of file OutputModuleBase.cc.

References edm::ProductRegistry::allBranchDescriptions(), edm::BranchDescription::branchType(), droppedBranchIDToKeptBranchID_, edm::ProductSelector::fillDroppedToKept(), hasNewlyDroppedBranch_, edm::ProductSelector::initialize(), edm::ProductSelector::initialized(), keepAssociation_, keepThisBranch(), edm::BranchDescription::present(), edm::BranchDescription::produced(), edm::ProductRegistry::productList(), productSelector_, productSelectorRules_, edm::ThinnedAssociationsHelper::selectAssociationProducts(), selected(), thinnedAssociationsHelper_, edm::BranchDescription::transient(), and edm::BranchDescription::unwrappedType().

84  {
85  if(productSelector_.initialized()) return;
86  productSelector_.initialize(productSelectorRules_, preg.allBranchDescriptions());
87 
88  // TODO: See if we can collapse keptProducts_ and productSelector_ into a
89  // single object. See the notes in the header for ProductSelector
90  // for more information.
91 
92  std::map<BranchID, BranchDescription const*> trueBranchIDToKeptBranchDesc;
93  std::vector<BranchDescription const*> associationDescriptions;
94  std::set<BranchID> keptProductsInEvent;
95 
96  for(auto const& it : preg.productList()) {
97  BranchDescription const& desc = it.second;
98  if(desc.transient()) {
99  // if the class of the branch is marked transient, output nothing
100  } else if(!desc.present() && !desc.produced()) {
101  // else if the branch containing the product has been previously dropped,
102  // output nothing
103  } else if(desc.unwrappedType() == typeid(ThinnedAssociation)) {
104  associationDescriptions.push_back(&desc);
105  } else if(selected(desc)) {
106  keepThisBranch(desc, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
107  } else {
108  // otherwise, output nothing,
109  // and mark the fact that there is a newly dropped branch of this type.
110  hasNewlyDroppedBranch_[desc.branchType()] = true;
111  }
112  }
113 
115  keptProductsInEvent,
117 
118  for(auto association : associationDescriptions) {
119  if(keepAssociation_[association->branchID()]) {
120  keepThisBranch(*association, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
121  } else {
122  hasNewlyDroppedBranch_[association->branchType()] = true;
123  }
124  }
125 
126  // Now fill in a mapping needed in the case that a branch was dropped while its EDAlias was kept.
128 
130  }
ThinnedAssociationsHelper const * thinnedAssociationsHelper() const
static void fillDroppedToKept(ProductRegistry const &preg, std::map< BranchID, BranchDescription const * > const &trueBranchIDToKeptBranchDesc, std::map< BranchID::value_type, BranchID::value_type > &droppedBranchIDToKeptBranchID_)
void keepThisBranch(BranchDescription const &desc, std::map< BranchID, BranchDescription const * > &trueBranchIDToKeptBranchDesc, std::set< BranchID > &keptProductsInEvent)
ProductSelectorRules productSelectorRules_
void selectAssociationProducts(std::vector< BranchDescription const * > const &associationDescriptions, std::set< BranchID > const &keptProductsInEvent, std::map< BranchID, bool > &keepAssociation) const
bool selected(BranchDescription const &desc) const
std::unique_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper_
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:370
ProductSelector productSelector_
std::map< BranchID, bool > keepAssociation_
void OutputModuleBase::setEventSelectionInfo ( std::map< std::string, std::vector< std::pair< std::string, int > > > const &  outputModulePathPositions,
bool  anyProductProduced 
)
protected

Definition at line 372 of file OutputModuleBase.cc.

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

373  {
375  description().moduleLabel(),
376  outputModulePathPositions,
377  anyProductProduced);
378  }
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 253 of file OutputModuleBase.h.

References popcon2dropbox_job_conf::md, and moduleDescription_.

253  {
255  }
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 228 of file OutputModuleBase.h.

228 {return false;}
ThinnedAssociationsHelper const * OutputModuleBase::thinnedAssociationsHelper ( ) const

Definition at line 333 of file OutputModuleBase.cc.

References thinnedAssociationsHelper_.

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

333  {
334  return thinnedAssociationsHelper_.get();
335  }
std::unique_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper_
void OutputModuleBase::updateBranchParents ( EventPrincipal const &  ep)
private

Definition at line 381 of file OutputModuleBase.cc.

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

Referenced by doEvent().

381  {
382  for(EventPrincipal::const_iterator i = ep.begin(), iEnd = ep.end(); i != iEnd; ++i) {
383  if((*i) && (*i)->productProvenancePtr() != 0) {
384  BranchID const& bid = (*i)->branchDescription().branchID();
385  BranchParents::iterator it = branchParents_.find(bid);
386  if(it == branchParents_.end()) {
387  it = branchParents_.insert(std::make_pair(bid, std::set<ParentageID>())).first;
388  }
389  it->second.insert((*i)->productProvenancePtr()->parentageID());
391  }
392  }
393  }
int i
Definition: DBlmapReader.cc:9
void insertEmpty(BranchID parent)
boost::filter_iterator< FilledProductPtr, ProductHolderCollection::const_iterator > const_iterator
Definition: Principal.h:56
bool edm::one::OutputModuleBase::wantAllEvents ( ) const
inline
std::string edm::one::OutputModuleBase::workerType ( ) const
inlineprivate

Definition at line 210 of file OutputModuleBase.h.

210 {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 70 of file OutputModuleBase.h.

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

Definition at line 69 of file OutputModuleBase.h.

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

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

Referenced by branchIDLists().

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

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

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

std::map<BranchID, bool> edm::one::OutputModuleBase::keepAssociation_
private

Definition at line 184 of file OutputModuleBase.h.

Referenced by selectProducts().

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

Definition at line 163 of file OutputModuleBase.h.

Referenced by keepThisBranch(), and keptProducts().

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

Definition at line 145 of file OutputModuleBase.h.

Referenced by configure(), and maxEvents().

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

Definition at line 169 of file OutputModuleBase.h.

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

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

Definition at line 192 of file OutputModuleBase.h.

Referenced by doEvent().

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

Definition at line 181 of file OutputModuleBase.h.

Referenced by branchIDLists(), and configure().

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

Definition at line 166 of file OutputModuleBase.h.

Referenced by OutputModuleBase(), and processName().

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

Definition at line 168 of file OutputModuleBase.h.

Referenced by selected(), and selectProducts().

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

Definition at line 167 of file OutputModuleBase.h.

Referenced by selectProducts().

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

Definition at line 146 of file OutputModuleBase.h.

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

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

Definition at line 191 of file OutputModuleBase.h.

Referenced by doBeginJob(), and doEvent().

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

Definition at line 175 of file OutputModuleBase.h.

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

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

Definition at line 172 of file OutputModuleBase.h.

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

std::unique_ptr<ThinnedAssociationsHelper> edm::one::OutputModuleBase::thinnedAssociationsHelper_
private

Definition at line 183 of file OutputModuleBase.h.

Referenced by selectProducts(), and thinnedAssociationsHelper().

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

Definition at line 171 of file OutputModuleBase.h.

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