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< one::WatchRuns, one::WatchLuminosityBlocks > edm::one::OutputModule< WatchInputFiles > edm::one::OutputModule<> edm::StreamerOutputModuleBase edm::PoolOutputModule DQMRootOutputModule edm::StreamerOutputModule< Consumer > evf::RecoEventOutputModuleForFU< Consumer > edm::TimeoutPoolOutputModule dqmservices::JsonWritingTimeoutPoolOutputModule

Public Types

typedef OutputModuleBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

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 ()
 
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 ()
 
bool prePrefetchSelection (StreamID id, EventPrincipal const &, ModuleCallingContext const *)
 
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_
 
ParameterSet selectEvents_
 
ParameterSetID selector_config_id_
 
std::vector
< 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 64 of file OutputModuleBase.h.

Member Typedef Documentation

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

Definition at line 183 of file OutputModuleBase.h.

Definition at line 69 of file OutputModuleBase.h.

Constructor & Destructor Documentation

OutputModuleBase::OutputModuleBase ( ParameterSet const &  pset)
explicit

Definition at line 43 of file OutputModuleBase.cc.

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

43  :
44  maxEvents_(-1),
46  keptProducts_(),
48  process_name_(),
49  productSelectorRules_(pset, "outputCommands", "OutputModule"),
52  wantAllEvents_(false),
53  selectors_(),
57  origBranchIDLists_(nullptr),
58  thinnedAssociationsHelper_(new ThinnedAssociationsHelper),
60  branchChildren_() {
61 
62  hasNewlyDroppedBranch_.fill(false);
63 
65  process_name_ = tns->getProcessName();
66 
68  pset.getUntrackedParameterSet("SelectEvents", ParameterSet());
69 
70  selectEvents_.registerIt(); // Just in case this PSet is not registered
71 
73 
74  //need to set wantAllEvents_ in constructor
75  // we will make the remaining selectors once we know how many streams
76  selectors_.resize(1);
80  selectors_[0]);
81 
82  }
std::unique_ptr< BranchIDLists > branchIDLists_
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
SelectedProductsForBranchType keptProducts_
ModuleDescription moduleDescription_
ParameterSetID id() const
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
ProductSelectorRules productSelectorRules_
std::atomic< int > remainingEvents_
std::unique_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper_
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
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)
ParameterSet const & registerIt()
ParameterSetID selector_config_id_
OutputModuleBase::~OutputModuleBase ( )
virtual

Definition at line 183 of file OutputModuleBase.cc.

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

Member Function Documentation

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

Definition at line 387 of file OutputModuleBase.cc.

References edm::one::kBaseType().

387  {
388  return kBaseType;
389  }
static const std::string kBaseType("EDAnalyzer")
virtual void edm::one::OutputModuleBase::beginJob ( void  )
inlineprivatevirtual
BranchChildren const& edm::one::OutputModuleBase::branchChildren ( ) const
inline

Definition at line 97 of file OutputModuleBase.h.

References branchChildren_.

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

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

Definition at line 333 of file OutputModuleBase.cc.

References branchIDLists_, droppedBranchIDToKeptBranchID_, and origBranchIDLists_.

Referenced by edm::StreamerOutputModuleBase::serializeRegistry(), and edm::RootOutputFile::writeBranchIDListRegistry().

333  {
334  if(!droppedBranchIDToKeptBranchID_.empty()) {
335  // Make a private copy of the BranchIDLists.
337  // Check for branches dropped while an EDAlias was kept.
338  for(BranchIDList& branchIDList : *branchIDLists_) {
339  for(BranchID::value_type& branchID : branchIDList) {
340  // 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.
341  std::map<BranchID::value_type, BranchID::value_type>::const_iterator iter = droppedBranchIDToKeptBranchID_.find(branchID);
342  if(iter != droppedBranchIDToKeptBranchID_.end()) {
343  branchID = iter->second;
344  }
345  }
346  }
347  return branchIDLists_.get();
348  }
349  return origBranchIDLists_;
350  }
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 185 of file OutputModuleBase.cc.

Referenced by doBeginJob().

185  {
186  return SharedResourcesAcquirer{};
187  }
ModuleDescription const & OutputModuleBase::description ( ) const
protected
void OutputModuleBase::doBeginJob ( )
protected

Definition at line 206 of file OutputModuleBase.cc.

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

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

Definition at line 267 of file OutputModuleBase.cc.

References doBeginLuminosityBlock_().

269  {
270  doBeginLuminosityBlock_(lbp, mcc);
271  return true;
272  }
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 242 of file OutputModuleBase.h.

Referenced by doBeginLuminosityBlock().

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

Definition at line 245 of file OutputModuleBase.cc.

References doBeginRun_().

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

Referenced by doBeginRun().

240 {}
void OutputModuleBase::doCloseFile ( )
private

Tell the OutputModule that is must end the current file.

Definition at line 320 of file OutputModuleBase.cc.

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

320  {
321  if(isFileOpen()) {
323  reallyCloseFile();
324  branchParents_.clear();
326  }
327  }
virtual bool isFileOpen() const
void OutputModuleBase::doEndJob ( )
protected

Definition at line 211 of file OutputModuleBase.cc.

References endJob().

211  {
212  endJob();
213  }
bool OutputModuleBase::doEndLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 275 of file OutputModuleBase.cc.

References doEndLuminosityBlock_().

277  {
278  doEndLuminosityBlock_(lbp, mcc);
279  return true;
280  }
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 243 of file OutputModuleBase.h.

Referenced by doEndLuminosityBlock().

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

Definition at line 253 of file OutputModuleBase.cc.

References doEndRun_().

255  {
256  doEndRun_(rp, mcc);
257  return true;
258  }
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 241 of file OutputModuleBase.h.

Referenced by doEndRun().

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

Definition at line 224 of file OutputModuleBase.cc.

References mutex_, remainingEvents_, resourcesAcquirer_, updateBranchParents(), and write().

227  {
228 
229  {
230  std::lock_guard<std::mutex> guard(mutex_);
231  {
232  std::lock_guard<SharedResourcesAcquirer> guard(resourcesAcquirer_);
233  EventSignalsSentry sentry(act,mcc);
234  write(ep, mcc);
235  }
237  }
238  if(remainingEvents_ > 0) {
240  }
241  return true;
242  }
std::atomic< int > remainingEvents_
SharedResourcesAcquirer resourcesAcquirer_
virtual void write(EventPrincipal const &e, ModuleCallingContext const *)=0
void updateBranchParents(EventPrincipal const &ep)
void OutputModuleBase::doOpenFile ( FileBlock const &  fb)
private

Definition at line 287 of file OutputModuleBase.cc.

References openFile().

287  {
288  openFile(fb);
289  }
virtual void openFile(FileBlock const &)
void OutputModuleBase::doPostForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
)
private

Definition at line 305 of file OutputModuleBase.cc.

References postForkReacquireResources().

305  {
306  postForkReacquireResources(iChildIndex, iNumberOfChildren);
307  }
virtual void postForkReacquireResources(unsigned int, unsigned int)
void OutputModuleBase::doPreallocate ( PreallocationConfiguration const &  iPC)
protected

Definition at line 189 of file OutputModuleBase.cc.

References edm::detail::configureEventSelector(), edm::getAllTriggerNames(), edm::PreallocationConfiguration::numberOfStreams(), process_name_, alignCSCRings::s, selectEvents_, and selectors_.

189  {
190  auto nstreams = iPC.numberOfStreams();
191  selectors_.resize(nstreams);
192 
193  bool seenFirst = false;
194  for(auto& s : selectors_) {
195  if(seenFirst) {
199  s);
200  } else {
201  seenFirst = true;
202  }
203  }
204  }
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
std::vector< std::string > const & getAllTriggerNames()
bool configureEventSelector(edm::ParameterSet const &iPSet, std::string const &iProcessName, std::vector< std::string > const &iAllTriggerNames, edm::detail::TriggerResultsBasedEventSelector &oSelector)
void OutputModuleBase::doPreForkReleaseResources ( )
private

Definition at line 300 of file OutputModuleBase.cc.

References preForkReleaseResources().

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

Definition at line 204 of file OutputModuleBase.h.

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

Definition at line 295 of file OutputModuleBase.cc.

References doRespondToCloseInputFile_().

295  {
297  }
virtual void doRespondToCloseInputFile_(FileBlock const &)
virtual void edm::one::OutputModuleBase::doRespondToCloseInputFile_ ( FileBlock const &  )
inlineprivatevirtual

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

Definition at line 245 of file OutputModuleBase.h.

Referenced by doRespondToCloseInputFile().

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

Definition at line 291 of file OutputModuleBase.cc.

References doRespondToOpenInputFile_().

291  {
293  }
virtual void doRespondToOpenInputFile_(FileBlock const &)
virtual void edm::one::OutputModuleBase::doRespondToOpenInputFile_ ( FileBlock const &  )
inlineprivatevirtual

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

Definition at line 244 of file OutputModuleBase.h.

Referenced by doRespondToOpenInputFile().

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

Definition at line 282 of file OutputModuleBase.cc.

References writeLuminosityBlock().

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

Definition at line 261 of file OutputModuleBase.cc.

References writeRun().

262  {
263  writeRun(rp, mcc);
264  }
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 135 of file OutputModuleBase.h.

References droppedBranchIDToKeptBranchID_.

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

Reimplemented in edm::StreamerOutputModuleBase.

Definition at line 230 of file OutputModuleBase.h.

Referenced by doEndJob().

230 {}
void OutputModuleBase::fillDependencyGraph ( )
private

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

416  {
417  for(BranchParents::const_iterator i = branchParents_.begin(), iEnd = branchParents_.end();
418  i != iEnd; ++i) {
419  BranchID const& child = i->first;
420  std::set<ParentageID> const& eIds = i->second;
421  for(std::set<ParentageID>::const_iterator it = eIds.begin(), itEnd = eIds.end();
422  it != itEnd; ++it) {
423  Parentage entryDesc;
424  ParentageRegistry::instance()->getMapped(*it, entryDesc);
425  std::vector<BranchID> const& parents = entryDesc.parents();
426  for(std::vector<BranchID>::const_iterator j = parents.begin(), jEnd = parents.end();
427  j != jEnd; ++j) {
428  branchChildren_.insertChild(*j, child);
429  }
430  }
431  }
432  }
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 375 of file OutputModuleBase.cc.

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

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

Definition at line 368 of file OutputModuleBase.cc.

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

368  {
370  desc.setUnknown();
371  descriptions.addDefault(desc);
372  }
std::array<bool, NumBranchTypes> const& edm::one::OutputModuleBase::hasNewlyDroppedBranch ( ) const
inline

Definition at line 90 of file OutputModuleBase.h.

References hasNewlyDroppedBranch_.

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

Reimplemented in DQMRootOutputModule, and edm::PoolOutputModule.

Definition at line 234 of file OutputModuleBase.h.

Referenced by doCloseFile(), and maybeOpenFile().

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

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

140  {
141 
143  trueBranchIDToKeptBranchDesc);
144 
145  switch (desc.branchType()) {
146  case InEvent:
147  {
148  if(desc.produced()) {
149  keptProductsInEvent.insert(desc.originalBranchID());
150  } else {
151  keptProductsInEvent.insert(desc.branchID());
152  }
153  consumes(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
154  InputTag{desc.moduleLabel(),
155  desc.productInstanceName(),
156  desc.processName()});
157  break;
158  }
159  case InLumi:
160  {
161  consumes<InLumi>(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
162  InputTag(desc.moduleLabel(),
163  desc.productInstanceName(),
164  desc.processName()));
165  break;
166  }
167  case InRun:
168  {
169  consumes<InRun>(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
170  InputTag(desc.moduleLabel(),
171  desc.productInstanceName(),
172  desc.processName()));
173  break;
174  }
175  default:
176  assert(false);
177  break;
178  }
179  // Now put it in the list of selected branches.
180  keptProducts_[desc.branchType()].push_back(&desc);
181  }
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 258 of file OutputModuleBase.h.

References remainingEvents_.

258 {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 79 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 316 of file OutputModuleBase.cc.

References isFileOpen(), and reallyOpenFile().

316  {
317  if(!isFileOpen()) reallyOpenFile();
318  }
virtual bool isFileOpen() const
const ModuleDescription& edm::one::OutputModuleBase::moduleDescription ( ) const
inline

Definition at line 105 of file OutputModuleBase.h.

References moduleDescription_.

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

105  {
106  return moduleDescription_;
107  }
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 313 of file OutputModuleBase.cc.

Referenced by doPostForkReacquireResources().

313 {}
void OutputModuleBase::preForkReleaseResources ( )
privatevirtual

Definition at line 310 of file OutputModuleBase.cc.

Referenced by doPreForkReleaseResources().

310 {}
bool OutputModuleBase::prePrefetchSelection ( StreamID  id,
EventPrincipal const &  ep,
ModuleCallingContext const *  mcc 
)
private

Definition at line 215 of file OutputModuleBase.cc.

References or, alignCSCRings::s, selectors_, and wantAllEvents_.

215  {
216 
217  auto& s = selectors_[id.value()];
218  detail::TRBESSentry products_sentry(s);
219 
220  return wantAllEvents_ or s.wantEvent(ep,mcc);
221  }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
void OutputModuleBase::prevalidate ( ConfigurationDescriptions )
static

Definition at line 381 of file OutputModuleBase.cc.

381  {
382  }
std::string const& edm::one::OutputModuleBase::processName ( ) const
inline
void OutputModuleBase::reallyCloseFile ( )
privatevirtual

Reimplemented in DQMRootOutputModule, and edm::PoolOutputModule.

Definition at line 329 of file OutputModuleBase.cc.

Referenced by doCloseFile().

329  {
330  }
virtual void edm::one::OutputModuleBase::reallyOpenFile ( )
inlineprivatevirtual

Reimplemented in edm::PoolOutputModule.

Definition at line 235 of file OutputModuleBase.h.

Referenced by maybeOpenFile().

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

Definition at line 216 of file OutputModuleBase.h.

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

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

Definition at line 83 of file OutputModuleBase.h.

References remainingEvents_.

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

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

Definition at line 363 of file OutputModuleBase.cc.

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

Referenced by selectProducts().

363  {
364  return productSelector_.selected(desc);
365  }
bool selected(BranchDescription const &desc) const
ProductSelector productSelector_
ParameterSetID edm::one::OutputModuleBase::selectorConfig ( ) const
inlineprotected
void OutputModuleBase::selectProducts ( ProductRegistry const &  preg,
ThinnedAssociationsHelper const &  thinnedAssociationsHelper 
)

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

90  {
91  if(productSelector_.initialized()) return;
92  productSelector_.initialize(productSelectorRules_, preg.allBranchDescriptions());
93 
94  // TODO: See if we can collapse keptProducts_ and productSelector_ into a
95  // single object. See the notes in the header for ProductSelector
96  // for more information.
97 
98  std::map<BranchID, BranchDescription const*> trueBranchIDToKeptBranchDesc;
99  std::vector<BranchDescription const*> associationDescriptions;
100  std::set<BranchID> keptProductsInEvent;
101 
102  for(auto const& it : preg.productList()) {
103  BranchDescription const& desc = it.second;
104  if(desc.transient()) {
105  // if the class of the branch is marked transient, output nothing
106  } else if(!desc.present() && !desc.produced()) {
107  // else if the branch containing the product has been previously dropped,
108  // output nothing
109  } else if(desc.unwrappedType() == typeid(ThinnedAssociation)) {
110  associationDescriptions.push_back(&desc);
111  } else if(selected(desc)) {
112  keepThisBranch(desc, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
113  } else {
114  // otherwise, output nothing,
115  // and mark the fact that there is a newly dropped branch of this type.
116  hasNewlyDroppedBranch_[desc.branchType()] = true;
117  }
118  }
119 
121  keptProductsInEvent,
123 
124  for(auto association : associationDescriptions) {
125  if(keepAssociation_[association->branchID()]) {
126  keepThisBranch(*association, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
127  } else {
128  hasNewlyDroppedBranch_[association->branchType()] = true;
129  }
130  }
131 
132  // Now fill in a mapping needed in the case that a branch was dropped while its EDAlias was kept.
134 
136  }
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 392 of file OutputModuleBase.cc.

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

393  {
395  description().moduleLabel(),
396  outputModulePathPositions,
397  anyProductProduced);
398  }
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 251 of file OutputModuleBase.h.

References popcon2dropbox_job_conf::md, and moduleDescription_.

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

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

Definition at line 353 of file OutputModuleBase.cc.

References thinnedAssociationsHelper_.

Referenced by edm::StreamerOutputModuleBase::serializeRegistry(), and edm::RootOutputFile::writeThinnedAssociationsHelper().

353  {
354  return thinnedAssociationsHelper_.get();
355  }
std::unique_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper_
void OutputModuleBase::updateBranchParents ( EventPrincipal const &  ep)
private

Definition at line 401 of file OutputModuleBase.cc.

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

Referenced by doEvent().

401  {
402  for(EventPrincipal::const_iterator i = ep.begin(), iEnd = ep.end(); i != iEnd; ++i) {
403  if((*i) && (*i)->productProvenancePtr() != 0) {
404  BranchID const& bid = (*i)->branchDescription().branchID();
405  BranchParents::iterator it = branchParents_.find(bid);
406  if(it == branchParents_.end()) {
407  it = branchParents_.insert(std::make_pair(bid, std::set<ParentageID>())).first;
408  }
409  it->second.insert((*i)->productProvenancePtr()->parentageID());
411  }
412  }
413  }
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 207 of file OutputModuleBase.h.

207 {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

Friends And Related Function Documentation

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

Definition at line 68 of file OutputModuleBase.h.

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

Definition at line 67 of file OutputModuleBase.h.

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

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

Referenced by branchIDLists().

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

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

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

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

Definition at line 181 of file OutputModuleBase.h.

Referenced by selectProducts().

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

Definition at line 159 of file OutputModuleBase.h.

Referenced by keepThisBranch(), and keptProducts().

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

Definition at line 141 of file OutputModuleBase.h.

Referenced by configure(), and maxEvents().

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

Definition at line 165 of file OutputModuleBase.h.

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

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

Definition at line 189 of file OutputModuleBase.h.

Referenced by doEvent().

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

Definition at line 178 of file OutputModuleBase.h.

Referenced by branchIDLists(), and configure().

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

Definition at line 162 of file OutputModuleBase.h.

Referenced by doPreallocate(), OutputModuleBase(), and processName().

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

Definition at line 164 of file OutputModuleBase.h.

Referenced by selected(), and selectProducts().

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

Definition at line 163 of file OutputModuleBase.h.

Referenced by selectProducts().

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

Definition at line 142 of file OutputModuleBase.h.

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

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

Definition at line 188 of file OutputModuleBase.h.

Referenced by doBeginJob(), and doEvent().

ParameterSet edm::one::OutputModuleBase::selectEvents_
private

Definition at line 169 of file OutputModuleBase.h.

Referenced by doPreallocate(), and OutputModuleBase().

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

Definition at line 172 of file OutputModuleBase.h.

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

std::vector<detail::TriggerResultsBasedEventSelector> edm::one::OutputModuleBase::selectors_
private

Definition at line 168 of file OutputModuleBase.h.

Referenced by doPreallocate(), OutputModuleBase(), and prePrefetchSelection().

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

Definition at line 180 of file OutputModuleBase.h.

Referenced by selectProducts(), and thinnedAssociationsHelper().

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

Definition at line 167 of file OutputModuleBase.h.

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