CMS 3D CMS Logo

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

#include <OutputModule.h>

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

Public Types

typedef OutputModule ModuleType
 

Public Member Functions

BranchChildren const & branchChildren () const
 
BranchIDLists const * branchIDLists () const
 
std::array< bool,
NumBranchTypes > const & 
hasNewlyDroppedBranch () const
 
SelectedProductsForBranchType
const & 
keptProducts () const
 
int maxEvents () const
 
OutputModuleoperator= (OutputModule const &)=delete
 
 OutputModule (ParameterSet const &pset)
 
 OutputModule (OutputModule const &)=delete
 
std::string const & processName () const
 
int remainingEvents () const
 
bool selected (BranchDescription const &desc) const
 
void selectProducts (ProductRegistry const &preg, ThinnedAssociationsHelper const &)
 
ThinnedAssociationsHelper const * thinnedAssociationsHelper () const
 
bool wantAllEvents () const
 
virtual ~OutputModule ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static const std::string & baseType ()
 
static void fillDescription (ParameterSetDescription &desc)
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Protected Member Functions

void configure (OutputModuleDescription const &desc)
 
ModuleDescription const & description () const
 
void doBeginJob ()
 
bool doBeginLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *mcc)
 
bool doBeginRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *mcc)
 
bool doEndRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
 
bool doEvent (EventPrincipal const &ep, EventSetup const &c, ActivityRegistry *act, ModuleCallingContext const *mcc)
 
void doPreallocate (PreallocationConfiguration const &)
 
std::map< BranchID::value_type,
BranchID::value_type > const & 
droppedBranchIDToKeptBranchID ()
 
Trig getTriggerResults (EventPrincipal const &ep, ModuleCallingContext const *) const
 
ModuleDescription const & moduleDescription () const
 
ParameterSetID selectorConfig () const
 
void setEventSelectionInfo (std::map< std::string, std::vector< std::pair< std::string, int > > > const &outputModulePathPositions, bool anyProductProduced)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Types

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

Private Member Functions

virtual void beginJob ()
 
virtual void beginLuminosityBlock (LuminosityBlockPrincipal const &, ModuleCallingContext const *)
 
virtual void beginRun (RunPrincipal const &, ModuleCallingContext const *)
 
void doCloseFile ()
 Tell the OutputModule that is must end the current file. More...
 
void doOpenFile (FileBlock const &fb)
 
void doPostForkReacquireResources (unsigned int iChildIndex, unsigned int iNumberOfChildren)
 
void doPreForkReleaseResources ()
 
void doRegisterThinnedAssociations (ProductRegistry const &, ThinnedAssociationsHelper &)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doWriteLuminosityBlock (LuminosityBlockPrincipal const &lbp, ModuleCallingContext const *mcc)
 
void doWriteRun (RunPrincipal const &rp, ModuleCallingContext const *mcc)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (LuminosityBlockPrincipal const &, ModuleCallingContext const *)
 
virtual void endRun (RunPrincipal const &, ModuleCallingContext const *)
 
void fillDependencyGraph ()
 
virtual bool isFileOpen () const
 
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 (OutputModule const *, ProductRegistry const *)
 
virtual void respondToCloseInputFile (FileBlock const &)
 
virtual void respondToOpenInputFile (FileBlock const &)
 
void setModuleDescription (ModuleDescription const &md)
 
virtual bool shouldWeCloseFile () const
 Ask the OutputModule if we should end the current file. More...
 
void updateBranchParents (EventPrincipal const &ep)
 
std::string workerType () const
 
virtual void write (EventPrincipal const &e, ModuleCallingContext const *)=0
 
virtual void writeLuminosityBlock (LuminosityBlockPrincipal const &, ModuleCallingContext const *)=0
 
virtual void writeRun (RunPrincipal const &, ModuleCallingContext const *)=0
 

Private Attributes

BranchChildren branchChildren_
 
std::unique_ptr< BranchIDListsbranchIDLists_
 
BranchParents branchParents_
 
std::map< BranchID::value_type,
BranchID::value_type
droppedBranchIDToKeptBranchID_
 
std::array< bool, NumBranchTypeshasNewlyDroppedBranch_
 
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 resourceAcquirer_
 
ParameterSetID selector_config_id_
 
detail::TriggerResultsBasedEventSelector selectors_
 
std::unique_ptr
< ThinnedAssociationsHelper
thinnedAssociationsHelper_
 
bool wantAllEvents_
 

Friends

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

Detailed Description

Definition at line 50 of file OutputModule.h.

Member Typedef Documentation

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

Definition at line 173 of file OutputModule.h.

Definition at line 55 of file OutputModule.h.

Constructor & Destructor Documentation

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

Definition at line 33 of file OutputModule.cc.

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

33  :
34  maxEvents_(-1),
36  keptProducts_(),
38  process_name_(),
39  productSelectorRules_(pset, "outputCommands", "OutputModule"),
42  wantAllEvents_(false),
43  selectors_(),
47  origBranchIDLists_(nullptr),
48  thinnedAssociationsHelper_(new ThinnedAssociationsHelper),
50  branchChildren_() {
51 
52  hasNewlyDroppedBranch_.fill(false);
53 
55  process_name_ = tns->getProcessName();
56 
57  ParameterSet selectevents =
58  pset.getUntrackedParameterSet("SelectEvents", ParameterSet());
59 
60  selectevents.registerIt(); // Just in case this PSet is not registered
61 
62  selector_config_id_ = selectevents.id();
66  selectors_);
69 
70  }
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: OutputModule.h:151
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:166
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
ModuleDescription moduleDescription_
Definition: OutputModule.h:156
BranchIDLists const * origBranchIDLists_
Definition: OutputModule.h:168
std::string process_name_
Definition: OutputModule.h:153
static SharedResourcesRegistry * instance()
std::unique_ptr< BranchIDLists > branchIDLists_
Definition: OutputModule.h:167
detail::TriggerResultsBasedEventSelector selectors_
Definition: OutputModule.h:159
std::unique_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper_
Definition: OutputModule.h:170
void registerSharedResource(const std::string &)
A resource name must be registered before it can be used in the createAcquirer call.
static const std::string kLegacyModuleResourceName
All legacy modules share this resource.
SelectedProductsForBranchType keptProducts_
Definition: OutputModule.h:150
ProductSelector productSelector_
Definition: OutputModule.h:155
std::vector< std::string > const & getAllTriggerNames()
BranchChildren branchChildren_
Definition: OutputModule.h:176
ProductSelectorRules productSelectorRules_
Definition: OutputModule.h:154
std::atomic< int > remainingEvents_
Definition: OutputModule.h:133
bool configureEventSelector(edm::ParameterSet const &iPSet, std::string const &iProcessName, std::vector< std::string > const &iAllTriggerNames, edm::detail::TriggerResultsBasedEventSelector &oSelector)
BranchParents branchParents_
Definition: OutputModule.h:174
ParameterSetID selector_config_id_
Definition: OutputModule.h:162
edm::OutputModule::~OutputModule ( )
virtual

Definition at line 171 of file OutputModule.cc.

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

Member Function Documentation

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

Definition at line 379 of file OutputModule.cc.

References edm::kBaseType().

379  {
380  return kBaseType;
381  }
static const std::string kBaseType("EDAnalyzer")
virtual void edm::OutputModule::beginJob ( void  )
inlineprivatevirtual

Reimplemented in evf::RecoEventOutputModuleForFU< Consumer >, and edm::StreamerOutputModuleBase.

Definition at line 214 of file OutputModule.h.

Referenced by doBeginJob().

214 {}
virtual void edm::OutputModule::beginLuminosityBlock ( LuminosityBlockPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual
virtual void edm::OutputModule::beginRun ( RunPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual

Reimplemented in RawEventOutputModuleForBU< Consumer >, and edm::StreamerOutputModuleBase.

Definition at line 216 of file OutputModule.h.

Referenced by doBeginRun().

216 {}
BranchChildren const& edm::OutputModule::branchChildren ( ) const
inline

Definition at line 83 of file OutputModule.h.

References branchChildren_.

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

Definition at line 325 of file OutputModule.cc.

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

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

325  {
326  if(!droppedBranchIDToKeptBranchID_.empty()) {
327  // Make a private copy of the BranchIDLists.
329  // Check for branches dropped while an EDAlias was kept.
330  for(BranchIDList& branchIDList : *branchIDLists_) {
331  for(BranchID::value_type& branchID : branchIDList) {
332  // 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.
333  std::map<BranchID::value_type, BranchID::value_type>::const_iterator iter = droppedBranchIDToKeptBranchID_.find(branchID);
334  if(iter != droppedBranchIDToKeptBranchID_.end()) {
335  branchID = iter->second;
336  }
337  }
338  }
339  return branchIDLists_.get();
340  }
341  return origBranchIDLists_;
342  }
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:166
BranchIDLists const * origBranchIDLists_
Definition: OutputModule.h:168
unsigned int value_type
Definition: BranchID.h:16
std::unique_ptr< BranchIDLists > branchIDLists_
Definition: OutputModule.h:167
std::vector< BranchID::value_type > BranchIDList
Definition: BranchIDList.h:18
void edm::OutputModule::configure ( OutputModuleDescription const &  desc)
protected

Definition at line 72 of file OutputModule.cc.

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

72  {
73  remainingEvents_ = maxEvents_ = desc.maxEvents_;
74  origBranchIDLists_ = desc.branchIDLists_;
75  }
BranchIDLists const * origBranchIDLists_
Definition: OutputModule.h:168
std::atomic< int > remainingEvents_
Definition: OutputModule.h:133
ModuleDescription const & edm::OutputModule::description ( ) const
protected

Definition at line 350 of file OutputModule.cc.

References moduleDescription_.

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

350  {
351  return moduleDescription_;
352  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:156
void edm::OutputModule::doBeginJob ( )
protected

Definition at line 173 of file OutputModule.cc.

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

173  {
174  std::vector<std::string> res = {SharedResourcesRegistry::kLegacyModuleResourceName};
176 
177  this->beginJob();
178  }
SharedResourcesAcquirer resourceAcquirer_
Definition: OutputModule.h:178
SharedResourcesAcquirer createAcquirer(std::vector< std::string > const &) const
static SharedResourcesRegistry * instance()
static const std::string kLegacyModuleResourceName
All legacy modules share this resource.
virtual void beginJob()
Definition: OutputModule.h:214
bool edm::OutputModule::doBeginLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 263 of file OutputModule.cc.

References beginLuminosityBlock(), and FDEBUG.

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

Definition at line 238 of file OutputModule.cc.

References beginRun(), and FDEBUG.

240  {
241  FDEBUG(2) << "beginRun called\n";
242  beginRun(rp, mcc);
243  return true;
244  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void beginRun(RunPrincipal const &, ModuleCallingContext const *)
Definition: OutputModule.h:216
void edm::OutputModule::doCloseFile ( )
private

Tell the OutputModule that is must end the current file.

Definition at line 312 of file OutputModule.cc.

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

312  {
313  if(isFileOpen()) {
315  reallyCloseFile();
316  branchParents_.clear();
318  }
319  }
virtual void reallyCloseFile()
virtual bool isFileOpen() const
Definition: OutputModule.h:228
void fillDependencyGraph()
BranchChildren branchChildren_
Definition: OutputModule.h:176
BranchParents branchParents_
Definition: OutputModule.h:174
void edm::OutputModule::doEndJob ( )
protected

Definition at line 180 of file OutputModule.cc.

References endJob().

180  {
181  endJob();
182  }
virtual void endJob()
Definition: OutputModule.h:215
bool edm::OutputModule::doEndLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 272 of file OutputModule.cc.

References endLuminosityBlock(), and FDEBUG.

274  {
275  FDEBUG(2) << "endLuminosityBlock called\n";
276  endLuminosityBlock(lbp, mcc);
277  return true;
278  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void endLuminosityBlock(LuminosityBlockPrincipal const &, ModuleCallingContext const *)
Definition: OutputModule.h:220
bool edm::OutputModule::doEndRun ( RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 247 of file OutputModule.cc.

References endRun(), and FDEBUG.

249  {
250  FDEBUG(2) << "endRun called\n";
251  endRun(rp, mcc);
252  return true;
253  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void endRun(RunPrincipal const &, ModuleCallingContext const *)
Definition: OutputModule.h:217
bool edm::OutputModule::doEvent ( EventPrincipal const &  ep,
EventSetup const &  c,
ActivityRegistry act,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 192 of file OutputModule.cc.

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

195  {
196 
197  FDEBUG(2) << "writeEvent called\n";
198 
199  {
200  std::lock_guard<std::mutex> guard(mutex_);
201  detail::TRBESSentry products_sentry(selectors_);
202  if(!wantAllEvents_) {
203  if(!selectors_.wantEvent(ep, mcc)) {
204  return true;
205  }
206  }
207 
208  {
209  std::lock_guard<SharedResourcesAcquirer> guardAcq(resourceAcquirer_);
210  EventSignalsSentry signals(act,mcc);
211  write(ep, mcc);
212  }
214  }
215  if(remainingEvents_ > 0) {
217  }
218  return true;
219  }
virtual void write(EventPrincipal const &e, ModuleCallingContext const *)=0
SharedResourcesAcquirer resourceAcquirer_
Definition: OutputModule.h:178
void updateBranchParents(EventPrincipal const &ep)
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::mutex mutex_
Definition: OutputModule.h:179
detail::TriggerResultsBasedEventSelector selectors_
Definition: OutputModule.h:159
bool wantEvent(EventPrincipal const &e, ModuleCallingContext const *)
std::atomic< int > remainingEvents_
Definition: OutputModule.h:133
void edm::OutputModule::doOpenFile ( FileBlock const &  fb)
private

Definition at line 286 of file OutputModule.cc.

References openFile().

286  {
287  openFile(fb);
288  }
virtual void openFile(FileBlock const &)
Definition: OutputModule.h:222
void edm::OutputModule::doPostForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
)
private

Definition at line 304 of file OutputModule.cc.

References postForkReacquireResources().

304  {
305  postForkReacquireResources(iChildIndex, iNumberOfChildren);
306  }
virtual void postForkReacquireResources(unsigned int, unsigned int)
Definition: OutputModule.h:226
void edm::OutputModule::doPreallocate ( PreallocationConfiguration const &  )
inlineprotected

Definition at line 105 of file OutputModule.h.

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

Definition at line 299 of file OutputModule.cc.

References preForkReleaseResources().

299  {
301  }
virtual void preForkReleaseResources()
Definition: OutputModule.h:225
void edm::OutputModule::doRegisterThinnedAssociations ( ProductRegistry const &  ,
ThinnedAssociationsHelper  
)
inlineprivate

Definition at line 191 of file OutputModule.h.

192  { }
void edm::OutputModule::doRespondToCloseInputFile ( FileBlock const &  fb)
private

Definition at line 294 of file OutputModule.cc.

References respondToCloseInputFile().

294  {
296  }
virtual void respondToCloseInputFile(FileBlock const &)
Definition: OutputModule.h:224
void edm::OutputModule::doRespondToOpenInputFile ( FileBlock const &  fb)
private

Definition at line 290 of file OutputModule.cc.

References respondToOpenInputFile().

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

Definition at line 280 of file OutputModule.cc.

References FDEBUG, and writeLuminosityBlock().

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

Definition at line 256 of file OutputModule.cc.

References FDEBUG, and writeRun().

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

Definition at line 126 of file OutputModule.h.

References droppedBranchIDToKeptBranchID_.

126  {
128  }
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:166
virtual void edm::OutputModule::endJob ( void  )
inlineprivatevirtual

Reimplemented in edm::StreamerOutputModuleBase.

Definition at line 215 of file OutputModule.h.

Referenced by doEndJob().

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

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

Definition at line 220 of file OutputModule.h.

Referenced by doEndLuminosityBlock().

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

Reimplemented in RawEventOutputModuleForBU< Consumer >, and edm::StreamerOutputModuleBase.

Definition at line 217 of file OutputModule.h.

Referenced by doEndRun().

217 {}
void edm::OutputModule::fillDependencyGraph ( )
private

Definition at line 408 of file OutputModule.cc.

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

Referenced by doCloseFile().

408  {
409  for(BranchParents::const_iterator i = branchParents_.begin(), iEnd = branchParents_.end();
410  i != iEnd; ++i) {
411  BranchID const& child = i->first;
412  std::set<ParentageID> const& eIds = i->second;
413  for(std::set<ParentageID>::const_iterator it = eIds.begin(), itEnd = eIds.end();
414  it != itEnd; ++it) {
415  Parentage entryDesc;
416  ParentageRegistry::instance()->getMapped(*it, entryDesc);
417  std::vector<BranchID> const& parents = entryDesc.parents();
418  for(std::vector<BranchID>::const_iterator j = parents.begin(), jEnd = parents.end();
419  j != jEnd; ++j) {
420  branchChildren_.insertChild(*j, child);
421  }
422  }
423  }
424  }
int i
Definition: DBlmapReader.cc:9
TPRegexp parents
Definition: eve_filter.cc:24
void insertChild(BranchID parent, BranchID child)
bool getMapped(key_type const &k, value_type &result) const
int j
Definition: DBlmapReader.cc:9
BranchChildren branchChildren_
Definition: OutputModule.h:176
static ParentageRegistry * instance()
BranchParents branchParents_
Definition: OutputModule.h:174
void edm::OutputModule::fillDescription ( ParameterSetDescription desc)
static
void edm::OutputModule::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 360 of file OutputModule.cc.

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

360  {
362  desc.setUnknown();
363  descriptions.addDefault(desc);
364  }
Trig edm::OutputModule::getTriggerResults ( EventPrincipal const &  ep,
ModuleCallingContext const *  mcc 
) const
protected

Definition at line 185 of file OutputModule.cc.

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

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

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

Definition at line 76 of file OutputModule.h.

References hasNewlyDroppedBranch_.

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

Definition at line 228 of file OutputModule.h.

Referenced by doCloseFile(), and maybeOpenFile().

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

Definition at line 126 of file OutputModule.cc.

References edm::BranchDescription::branchID(), edm::BranchDescription::branchType(), edm::ProductSelector::checkForDuplicateKeptBranch(), edm::EDConsumerBase::consumes(), edm::InEvent, edm::InLumi, 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().

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

Definition at line 75 of file OutputModule.h.

References keptProducts_.

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

Definition at line 243 of file OutputModule.h.

References remainingEvents_.

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

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

Definition at line 65 of file OutputModule.h.

References maxEvents_.

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

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

Definition at line 308 of file OutputModule.cc.

References isFileOpen(), and reallyOpenFile().

308  {
309  if(!isFileOpen()) reallyOpenFile();
310  }
virtual void reallyOpenFile()
Definition: OutputModule.h:230
virtual bool isFileOpen() const
Definition: OutputModule.h:228
ModuleDescription const& edm::OutputModule::moduleDescription ( ) const
inlineprotected

Definition at line 100 of file OutputModule.h.

References moduleDescription_.

100  { return moduleDescription_;
101  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:156
virtual void edm::OutputModule::openFile ( FileBlock const &  )
inlineprivatevirtual
OutputModule& edm::OutputModule::operator= ( OutputModule const &  )
delete
virtual void edm::OutputModule::postForkReacquireResources ( unsigned  int,
unsigned  int 
)
inlineprivatevirtual

Definition at line 226 of file OutputModule.h.

Referenced by doPostForkReacquireResources().

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

Definition at line 225 of file OutputModule.h.

Referenced by doPreForkReleaseResources().

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

Definition at line 373 of file OutputModule.cc.

373  {
374  }
std::string const& edm::OutputModule::processName ( ) const
inline

Definition at line 74 of file OutputModule.h.

References process_name_.

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

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

Definition at line 321 of file OutputModule.cc.

Referenced by doCloseFile().

321  {
322  }
virtual void edm::OutputModule::reallyOpenFile ( )
inlineprivatevirtual

Definition at line 230 of file OutputModule.h.

Referenced by maybeOpenFile().

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

Definition at line 208 of file OutputModule.h.

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

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

Definition at line 69 of file OutputModule.h.

References remainingEvents_.

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

Definition at line 224 of file OutputModule.h.

Referenced by doRespondToCloseInputFile().

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

Definition at line 223 of file OutputModule.h.

Referenced by doRespondToOpenInputFile().

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

Definition at line 355 of file OutputModule.cc.

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

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

355  {
356  return productSelector_.selected(desc);
357  }
bool selected(BranchDescription const &desc) const
ProductSelector productSelector_
Definition: OutputModule.h:155
ParameterSetID edm::OutputModule::selectorConfig ( ) const
inlineprotected

Definition at line 103 of file OutputModule.h.

References selector_config_id_.

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

103 { return selector_config_id_; }
ParameterSetID selector_config_id_
Definition: OutputModule.h:162
void edm::OutputModule::selectProducts ( ProductRegistry const &  preg,
ThinnedAssociationsHelper const &  thinnedAssociationsHelper 
)

Definition at line 77 of file OutputModule.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(), edm::TypeWithDict::typeInfo(), and edm::BranchDescription::unwrappedType().

78  {
79  if(productSelector_.initialized()) return;
80  productSelector_.initialize(productSelectorRules_, preg.allBranchDescriptions());
81 
82  // TODO: See if we can collapse keptProducts_ and productSelector_ into a
83  // single object. See the notes in the header for ProductSelector
84  // for more information.
85 
86  std::map<BranchID, BranchDescription const*> trueBranchIDToKeptBranchDesc;
87  std::vector<BranchDescription const*> associationDescriptions;
88  std::set<BranchID> keptProductsInEvent;
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(desc.unwrappedType().typeInfo() == typeid(ThinnedAssociation)) {
98  associationDescriptions.push_back(&desc);
99  } else if(selected(desc)) {
100  keepThisBranch(desc, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
101  } else {
102  // otherwise, output nothing,
103  // and mark the fact that there is a newly dropped branch of this type.
104  hasNewlyDroppedBranch_[desc.branchType()] = true;
105  }
106  }
107 
109  keptProductsInEvent,
111 
112  for(auto association : associationDescriptions) {
113  if(keepAssociation_[association->branchID()]) {
114  keepThisBranch(*association, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
115  } else {
116  hasNewlyDroppedBranch_[association->branchType()] = true;
117  }
118  }
119 
120  // Now fill in a mapping needed in the case that a branch was dropped while its EDAlias was kept.
122 
124  }
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: OutputModule.h:151
void keepThisBranch(BranchDescription const &desc, std::map< BranchID, BranchDescription const * > &trueBranchIDToKeptBranchDesc, std::set< BranchID > &keptProductsInEvent)
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:166
static void fillDroppedToKept(ProductRegistry const &preg, std::map< BranchID, BranchDescription const * > const &trueBranchIDToKeptBranchDesc, std::map< BranchID::value_type, BranchID::value_type > &droppedBranchIDToKeptBranchID_)
std::map< BranchID, bool > keepAssociation_
Definition: OutputModule.h:171
bool selected(BranchDescription const &desc) const
void selectAssociationProducts(std::vector< BranchDescription const * > const &associationDescriptions, std::set< BranchID > const &keptProductsInEvent, std::map< BranchID, bool > &keepAssociation) const
std::unique_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper_
Definition: OutputModule.h:170
ThinnedAssociationsHelper const * thinnedAssociationsHelper() const
ProductSelector productSelector_
Definition: OutputModule.h:155
bool initialized() const
void initialize(ProductSelectorRules const &rules, std::vector< BranchDescription const * > const &branchDescriptions)
ProductSelectorRules productSelectorRules_
Definition: OutputModule.h:154
preg
Definition: Schedule.cc:370
void edm::OutputModule::setEventSelectionInfo ( std::map< std::string, std::vector< std::pair< std::string, int > > > const &  outputModulePathPositions,
bool  anyProductProduced 
)
protected

Definition at line 384 of file OutputModule.cc.

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

385  {
387  description().moduleLabel(),
388  outputModulePathPositions,
389  anyProductProduced);
390  }
ParameterSet const & getParameterSet(ParameterSetID const &id)
ParameterSetID registerProperSelectionInfo(edm::ParameterSet const &iInitial, std::string const &iLabel, std::map< std::string, std::vector< std::pair< std::string, int > > > const &outputModulePathPositions, bool anyProductProduced)
ModuleDescription const & description() const
ParameterSetID selector_config_id_
Definition: OutputModule.h:162
void edm::OutputModule::setModuleDescription ( ModuleDescription const &  md)
inlineprivate

Definition at line 236 of file OutputModule.h.

References popcon2dropbox_job_conf::md, and moduleDescription_.

236  {
238  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:156
virtual bool edm::OutputModule::shouldWeCloseFile ( ) const
inlineprivatevirtual

Ask the OutputModule if we should end the current file.

Definition at line 211 of file OutputModule.h.

211 {return false;}
ThinnedAssociationsHelper const * edm::OutputModule::thinnedAssociationsHelper ( ) const

Definition at line 345 of file OutputModule.cc.

References thinnedAssociationsHelper_.

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

345  {
346  return thinnedAssociationsHelper_.get();
347  }
std::unique_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper_
Definition: OutputModule.h:170
void edm::OutputModule::updateBranchParents ( EventPrincipal const &  ep)
private

Definition at line 393 of file OutputModule.cc.

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

Referenced by doEvent().

393  {
394  for(EventPrincipal::const_iterator i = ep.begin(), iEnd = ep.end(); i != iEnd; ++i) {
395  if((*i) && (*i)->productProvenancePtr() != 0) {
396  BranchID const& bid = (*i)->branchDescription().branchID();
397  BranchParents::iterator it = branchParents_.find(bid);
398  if(it == branchParents_.end()) {
399  it = branchParents_.insert(std::make_pair(bid, std::set<ParentageID>())).first;
400  }
401  it->second.insert((*i)->productProvenancePtr()->parentageID());
403  }
404  }
405  }
int i
Definition: DBlmapReader.cc:9
void insertEmpty(BranchID parent)
BranchChildren branchChildren_
Definition: OutputModule.h:176
boost::filter_iterator< FilledProductPtr, ProductHolderCollection::const_iterator > const_iterator
Definition: Principal.h:56
BranchParents branchParents_
Definition: OutputModule.h:174
bool edm::OutputModule::wantAllEvents ( ) const
inline

Definition at line 85 of file OutputModule.h.

References wantAllEvents_.

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

Definition at line 194 of file OutputModule.h.

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

Friends And Related Function Documentation

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

Definition at line 52 of file OutputModule.h.

template<typename T >
friend class OutputModuleCommunicatorT
friend

Definition at line 54 of file OutputModule.h.

template<typename T >
friend class WorkerT
friend

Definition at line 53 of file OutputModule.h.

Member Data Documentation

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

Definition at line 167 of file OutputModule.h.

Referenced by branchIDLists().

BranchParents edm::OutputModule::branchParents_
private

Definition at line 174 of file OutputModule.h.

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

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

Definition at line 166 of file OutputModule.h.

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

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

Definition at line 151 of file OutputModule.h.

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

std::map<BranchID, bool> edm::OutputModule::keepAssociation_
private

Definition at line 171 of file OutputModule.h.

Referenced by selectProducts().

SelectedProductsForBranchType edm::OutputModule::keptProducts_
private

Definition at line 150 of file OutputModule.h.

Referenced by keepThisBranch(), and keptProducts().

int edm::OutputModule::maxEvents_
private

Definition at line 132 of file OutputModule.h.

Referenced by configure(), and maxEvents().

ModuleDescription edm::OutputModule::moduleDescription_
private

Definition at line 156 of file OutputModule.h.

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

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

Definition at line 179 of file OutputModule.h.

Referenced by doEvent().

BranchIDLists const* edm::OutputModule::origBranchIDLists_
private

Definition at line 168 of file OutputModule.h.

Referenced by branchIDLists(), and configure().

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

Definition at line 153 of file OutputModule.h.

Referenced by OutputModule(), and processName().

ProductSelector edm::OutputModule::productSelector_
private

Definition at line 155 of file OutputModule.h.

Referenced by selected(), and selectProducts().

ProductSelectorRules edm::OutputModule::productSelectorRules_
private

Definition at line 154 of file OutputModule.h.

Referenced by selectProducts().

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

Definition at line 133 of file OutputModule.h.

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

SharedResourcesAcquirer edm::OutputModule::resourceAcquirer_
private

Definition at line 178 of file OutputModule.h.

Referenced by doBeginJob(), and doEvent().

ParameterSetID edm::OutputModule::selector_config_id_
private

Definition at line 162 of file OutputModule.h.

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

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

Definition at line 159 of file OutputModule.h.

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

std::unique_ptr<ThinnedAssociationsHelper> edm::OutputModule::thinnedAssociationsHelper_
private

Definition at line 170 of file OutputModule.h.

Referenced by selectProducts(), and thinnedAssociationsHelper().

bool edm::OutputModule::wantAllEvents_
private

Definition at line 158 of file OutputModule.h.

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