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 DQMRootOutputModule edm::AsciiOutputModule edm::GetProductCheckerOutputModule edm::ProvenanceCheckerOutputModule edm::StreamerOutputModuleBase FRDEventOutputModule< Consumer > 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)
 
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
 
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, 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 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
 
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_
 
SelectedProductsForBranchType keptProducts_
 
int maxEvents_
 
ModuleDescription moduleDescription_
 
BranchIDLists const * origBranchIDLists_
 
std::string process_name_
 
ProductSelector productSelector_
 
ProductSelectorRules productSelectorRules_
 
int remainingEvents_
 
ParameterSetID selector_config_id_
 
detail::TriggerResultsBasedEventSelector selectors_
 
bool wantAllEvents_
 

Friends

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

Detailed Description

Definition at line 42 of file OutputModule.h.

Member Typedef Documentation

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

Definition at line 159 of file OutputModule.h.

Definition at line 47 of file OutputModule.h.

Constructor & Destructor Documentation

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

Definition at line 28 of file OutputModule.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_.

28  :
29  maxEvents_(-1),
31  keptProducts_(),
33  process_name_(),
34  productSelectorRules_(pset, "outputCommands", "OutputModule"),
37  wantAllEvents_(false),
38  selectors_(),
42  origBranchIDLists_(nullptr),
44  branchChildren_() {
45 
46  hasNewlyDroppedBranch_.fill(false);
47 
49  process_name_ = tns->getProcessName();
50 
51  ParameterSet selectevents =
52  pset.getUntrackedParameterSet("SelectEvents", ParameterSet());
53 
54  selectevents.registerIt(); // Just in case this PSet is not registered
55 
56  selector_config_id_ = selectevents.id();
60  selectors_);
61  }
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: OutputModule.h:140
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:155
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
ModuleDescription moduleDescription_
Definition: OutputModule.h:145
BranchIDLists const * origBranchIDLists_
Definition: OutputModule.h:157
std::string process_name_
Definition: OutputModule.h:142
std::unique_ptr< BranchIDLists > branchIDLists_
Definition: OutputModule.h:156
detail::TriggerResultsBasedEventSelector selectors_
Definition: OutputModule.h:148
SelectedProductsForBranchType keptProducts_
Definition: OutputModule.h:139
ProductSelector productSelector_
Definition: OutputModule.h:144
std::vector< std::string > const & getAllTriggerNames()
BranchChildren branchChildren_
Definition: OutputModule.h:162
ProductSelectorRules productSelectorRules_
Definition: OutputModule.h:143
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:160
ParameterSetID selector_config_id_
Definition: OutputModule.h:151
edm::OutputModule::~OutputModule ( )
virtual

Definition at line 155 of file OutputModule.cc.

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

Member Function Documentation

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

Definition at line 346 of file OutputModule.cc.

References edm::kBaseType().

346  {
347  return kBaseType;
348  }
static const std::string kBaseType("EDAnalyzer")
virtual void edm::OutputModule::beginJob ( void  )
inlineprivatevirtual

Reimplemented in edm::StreamerOutputModuleBase.

Definition at line 195 of file OutputModule.h.

Referenced by doBeginJob().

195 {}
virtual void edm::OutputModule::beginLuminosityBlock ( LuminosityBlockPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual
virtual void edm::OutputModule::beginRun ( RunPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual
BranchChildren const& edm::OutputModule::branchChildren ( ) const
inline

Definition at line 75 of file OutputModule.h.

References branchChildren_.

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

Definition at line 297 of file OutputModule.cc.

References branchIDLists_, droppedBranchIDToKeptBranchID_, and origBranchIDLists_.

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

297  {
298  if(!droppedBranchIDToKeptBranchID_.empty()) {
299  // Make a private copy of the BranchIDLists.
301  // Check for branches dropped while an EDAlias was kept.
302  for(BranchIDList& branchIDList : *branchIDLists_) {
303  for(BranchID::value_type& branchID : branchIDList) {
304  // 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.
305  std::map<BranchID::value_type, BranchID::value_type>::const_iterator iter = droppedBranchIDToKeptBranchID_.find(branchID);
306  if(iter != droppedBranchIDToKeptBranchID_.end()) {
307  branchID = iter->second;
308  }
309  }
310  }
311  return branchIDLists_.get();
312  }
313  return origBranchIDLists_;
314  }
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:155
BranchIDLists const * origBranchIDLists_
Definition: OutputModule.h:157
unsigned int value_type
Definition: BranchID.h:16
std::unique_ptr< BranchIDLists > branchIDLists_
Definition: OutputModule.h:156
std::vector< BranchID::value_type > BranchIDList
Definition: BranchIDList.h:18
void edm::OutputModule::configure ( OutputModuleDescription const &  desc)
protected

Definition at line 63 of file OutputModule.cc.

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

63  {
64  remainingEvents_ = maxEvents_ = desc.maxEvents_;
65  origBranchIDLists_ = desc.branchIDLists_;
66  }
BranchIDLists const * origBranchIDLists_
Definition: OutputModule.h:157
ModuleDescription const & edm::OutputModule::description ( ) const
protected

Definition at line 317 of file OutputModule.cc.

References moduleDescription_.

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

317  {
318  return moduleDescription_;
319  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:145
void edm::OutputModule::doBeginJob ( )
protected

Definition at line 157 of file OutputModule.cc.

References beginJob().

157  {
158  this->beginJob();
159  }
virtual void beginJob()
Definition: OutputModule.h:195
bool edm::OutputModule::doBeginLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 235 of file OutputModule.cc.

References beginLuminosityBlock(), and FDEBUG.

237  {
238  FDEBUG(2) << "beginLuminosityBlock called\n";
239  beginLuminosityBlock(lbp, mcc);
240  return true;
241  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void beginLuminosityBlock(LuminosityBlockPrincipal const &, ModuleCallingContext const *)
Definition: OutputModule.h:200
bool edm::OutputModule::doBeginRun ( RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 210 of file OutputModule.cc.

References beginRun(), and FDEBUG.

212  {
213  FDEBUG(2) << "beginRun called\n";
214  beginRun(rp, mcc);
215  return true;
216  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void beginRun(RunPrincipal const &, ModuleCallingContext const *)
Definition: OutputModule.h:197
void edm::OutputModule::doCloseFile ( )
private

Tell the OutputModule that is must end the current file.

Definition at line 284 of file OutputModule.cc.

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

284  {
285  if(isFileOpen()) {
287  reallyCloseFile();
288  branchParents_.clear();
290  }
291  }
virtual void reallyCloseFile()
virtual bool isFileOpen() const
Definition: OutputModule.h:209
void fillDependencyGraph()
BranchChildren branchChildren_
Definition: OutputModule.h:162
BranchParents branchParents_
Definition: OutputModule.h:160
void edm::OutputModule::doEndJob ( )
protected

Definition at line 161 of file OutputModule.cc.

References endJob().

161  {
162  endJob();
163  }
virtual void endJob()
Definition: OutputModule.h:196
bool edm::OutputModule::doEndLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 244 of file OutputModule.cc.

References endLuminosityBlock(), and FDEBUG.

246  {
247  FDEBUG(2) << "endLuminosityBlock called\n";
248  endLuminosityBlock(lbp, mcc);
249  return true;
250  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void endLuminosityBlock(LuminosityBlockPrincipal const &, ModuleCallingContext const *)
Definition: OutputModule.h:201
bool edm::OutputModule::doEndRun ( RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 219 of file OutputModule.cc.

References endRun(), and FDEBUG.

221  {
222  FDEBUG(2) << "endRun called\n";
223  endRun(rp, mcc);
224  return true;
225  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void endRun(RunPrincipal const &, ModuleCallingContext const *)
Definition: OutputModule.h:198
bool edm::OutputModule::doEvent ( EventPrincipal const &  ep,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 173 of file OutputModule.cc.

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

175  {
176  detail::TRBESSentry products_sentry(selectors_);
177 
178  FDEBUG(2) << "writeEvent called\n";
179 
180  if(!wantAllEvents_) {
181  if(!selectors_.wantEvent(ep, mcc)) {
182  return true;
183  }
184  }
185  write(ep, mcc);
187  if(remainingEvents_ > 0) {
189  }
190  return true;
191  }
virtual void write(EventPrincipal const &e, ModuleCallingContext const *)=0
void updateBranchParents(EventPrincipal const &ep)
#define FDEBUG(lev)
Definition: DebugMacros.h:18
detail::TriggerResultsBasedEventSelector selectors_
Definition: OutputModule.h:148
bool wantEvent(EventPrincipal const &e, ModuleCallingContext const *)
void edm::OutputModule::doOpenFile ( FileBlock const &  fb)
private

Definition at line 258 of file OutputModule.cc.

References openFile().

258  {
259  openFile(fb);
260  }
virtual void openFile(FileBlock const &)
Definition: OutputModule.h:203
void edm::OutputModule::doPostForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
)
private

Definition at line 276 of file OutputModule.cc.

References postForkReacquireResources().

276  {
277  postForkReacquireResources(iChildIndex, iNumberOfChildren);
278  }
virtual void postForkReacquireResources(unsigned int, unsigned int)
Definition: OutputModule.h:207
void edm::OutputModule::doPreallocate ( PreallocationConfiguration const &  )
inlineprotected

Definition at line 95 of file OutputModule.h.

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

Definition at line 271 of file OutputModule.cc.

References preForkReleaseResources().

271  {
273  }
virtual void preForkReleaseResources()
Definition: OutputModule.h:206
void edm::OutputModule::doRespondToCloseInputFile ( FileBlock const &  fb)
private

Definition at line 266 of file OutputModule.cc.

References respondToCloseInputFile().

266  {
268  }
virtual void respondToCloseInputFile(FileBlock const &)
Definition: OutputModule.h:205
void edm::OutputModule::doRespondToOpenInputFile ( FileBlock const &  fb)
private

Definition at line 262 of file OutputModule.cc.

References respondToOpenInputFile().

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

Definition at line 252 of file OutputModule.cc.

References FDEBUG, and writeLuminosityBlock().

253  {
254  FDEBUG(2) << "writeLuminosityBlock called\n";
255  writeLuminosityBlock(lbp, mcc);
256  }
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 228 of file OutputModule.cc.

References FDEBUG, and writeRun().

229  {
230  FDEBUG(2) << "writeRun called\n";
231  writeRun(rp, mcc);
232  }
#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 115 of file OutputModule.h.

References droppedBranchIDToKeptBranchID_.

115  {
117  }
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:155
virtual void edm::OutputModule::endJob ( void  )
inlineprivatevirtual

Reimplemented in edm::StreamerOutputModuleBase.

Definition at line 196 of file OutputModule.h.

Referenced by doEndJob().

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

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

Definition at line 201 of file OutputModule.h.

Referenced by doEndLuminosityBlock().

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

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

375  {
376  for(BranchParents::const_iterator i = branchParents_.begin(), iEnd = branchParents_.end();
377  i != iEnd; ++i) {
378  BranchID const& child = i->first;
379  std::set<ParentageID> const& eIds = i->second;
380  for(std::set<ParentageID>::const_iterator it = eIds.begin(), itEnd = eIds.end();
381  it != itEnd; ++it) {
382  Parentage entryDesc;
383  ParentageRegistry::instance()->getMapped(*it, entryDesc);
384  std::vector<BranchID> const& parents = entryDesc.parents();
385  for(std::vector<BranchID>::const_iterator j = parents.begin(), jEnd = parents.end();
386  j != jEnd; ++j) {
387  branchChildren_.insertChild(*j, child);
388  }
389  }
390  }
391  }
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:162
static ParentageRegistry * instance()
BranchParents branchParents_
Definition: OutputModule.h:160
void edm::OutputModule::fillDescription ( ParameterSetDescription desc)
static
void edm::OutputModule::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 327 of file OutputModule.cc.

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

327  {
329  desc.setUnknown();
330  descriptions.addDefault(desc);
331  }
Trig edm::OutputModule::getTriggerResults ( EventPrincipal const &  ep,
ModuleCallingContext const *  mcc 
) const
protected

Definition at line 166 of file OutputModule.cc.

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

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

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

Definition at line 68 of file OutputModule.h.

References hasNewlyDroppedBranch_.

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

Reimplemented in DQMRootOutputModule.

Definition at line 209 of file OutputModule.h.

Referenced by doCloseFile(), and maybeOpenFile().

209 { return true; }
SelectedProductsForBranchType const& edm::OutputModule::keptProducts ( ) const
inline

Definition at line 67 of file OutputModule.h.

References keptProducts_.

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

Definition at line 220 of file OutputModule.h.

References remainingEvents_.

220 {return remainingEvents_ == 0;}
int edm::OutputModule::maxEvents ( ) const
inline

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

Definition at line 57 of file OutputModule.h.

References maxEvents_.

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

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

Definition at line 280 of file OutputModule.cc.

References isFileOpen(), and reallyOpenFile().

280  {
281  if(!isFileOpen()) reallyOpenFile();
282  }
virtual void reallyOpenFile()
Definition: OutputModule.h:211
virtual bool isFileOpen() const
Definition: OutputModule.h:209
ModuleDescription const& edm::OutputModule::moduleDescription ( ) const
inlineprotected

Definition at line 90 of file OutputModule.h.

References moduleDescription_.

90  { return moduleDescription_;
91  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:145
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

Reimplemented in DQMRootOutputModule.

Definition at line 207 of file OutputModule.h.

Referenced by doPostForkReacquireResources().

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

Definition at line 206 of file OutputModule.h.

Referenced by doPreForkReleaseResources().

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

Definition at line 340 of file OutputModule.cc.

340  {
341  }
std::string const& edm::OutputModule::processName ( ) const
inline

Definition at line 66 of file OutputModule.h.

References process_name_.

Referenced by edm::StreamerOutputModuleBase::serializeRegistry(), and DQMRootOutputModule::startEndFile().

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

Reimplemented in DQMRootOutputModule.

Definition at line 293 of file OutputModule.cc.

Referenced by doCloseFile().

293  {
294  }
virtual void edm::OutputModule::reallyOpenFile ( )
inlineprivatevirtual

Definition at line 211 of file OutputModule.h.

Referenced by maybeOpenFile().

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

Definition at line 189 of file OutputModule.h.

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

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

Definition at line 61 of file OutputModule.h.

References remainingEvents_.

61 {return remainingEvents_;}
virtual void edm::OutputModule::respondToCloseInputFile ( FileBlock const &  )
inlineprivatevirtual

Definition at line 205 of file OutputModule.h.

Referenced by doRespondToCloseInputFile().

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

Definition at line 204 of file OutputModule.h.

Referenced by doRespondToOpenInputFile().

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

Definition at line 322 of file OutputModule.cc.

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

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

322  {
323  return productSelector_.selected(desc);
324  }
bool selected(BranchDescription const &desc) const
ProductSelector productSelector_
Definition: OutputModule.h:144
ParameterSetID edm::OutputModule::selectorConfig ( ) const
inlineprotected

Definition at line 93 of file OutputModule.h.

References selector_config_id_.

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

93 { return selector_config_id_; }
ParameterSetID selector_config_id_
Definition: OutputModule.h:151
void edm::OutputModule::selectProducts ( ProductRegistry const &  preg)

Definition at line 68 of file OutputModule.cc.

References edm::ProductRegistry::allBranchDescriptions(), edm::BranchDescription::branchID(), edm::BranchDescription::branchType(), edm::errors::Configuration, edm::EDConsumerBase::consumes(), droppedBranchIDToKeptBranchID_, edm::hlt::Exception, hasNewlyDroppedBranch_, edm::BranchID::id(), edm::InEvent, edm::ProductSelector::initialize(), edm::ProductSelector::initialized(), edm::InLumi, edm::InRun, edm::BranchDescription::isAlias(), keptProducts_, edm::BranchDescription::moduleLabel(), edm::BranchDescription::originalBranchID(), edm::BranchDescription::present(), edm::BranchDescription::processName(), edm::BranchDescription::produced(), edm::PRODUCT_TYPE, edm::BranchDescription::productInstanceName(), edm::ProductRegistry::productList(), productSelector_, productSelectorRules_, selected(), edm::BranchDescription::transient(), and edm::BranchDescription::unwrappedTypeID().

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

Definition at line 351 of file OutputModule.cc.

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

352  {
354  description().moduleLabel(),
355  outputModulePathPositions,
356  anyProductProduced);
357  }
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:151
void edm::OutputModule::setModuleDescription ( ModuleDescription const &  md)
inlineprivate

Definition at line 213 of file OutputModule.h.

References moduleDescription_.

213  {
214  moduleDescription_ = md;
215  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:145
virtual bool edm::OutputModule::shouldWeCloseFile ( ) const
inlineprivatevirtual

Ask the OutputModule if we should end the current file.

Definition at line 192 of file OutputModule.h.

192 {return false;}
void edm::OutputModule::updateBranchParents ( EventPrincipal const &  ep)
private

Definition at line 360 of file OutputModule.cc.

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

Referenced by doEvent().

360  {
361  for(EventPrincipal::const_iterator i = ep.begin(), iEnd = ep.end(); i != iEnd; ++i) {
362  if((*i) && (*i)->productProvenancePtr() != 0) {
363  BranchID const& bid = (*i)->branchDescription().branchID();
364  BranchParents::iterator it = branchParents_.find(bid);
365  if(it == branchParents_.end()) {
366  it = branchParents_.insert(std::make_pair(bid, std::set<ParentageID>())).first;
367  }
368  it->second.insert((*i)->productProvenancePtr()->parentageID());
370  }
371  }
372  }
int i
Definition: DBlmapReader.cc:9
void insertEmpty(BranchID parent)
BranchChildren branchChildren_
Definition: OutputModule.h:162
boost::filter_iterator< FilledProductPtr, ProductHolderCollection::const_iterator > const_iterator
Definition: Principal.h:58
BranchParents branchParents_
Definition: OutputModule.h:160
bool edm::OutputModule::wantAllEvents ( ) const
inline

Definition at line 77 of file OutputModule.h.

References wantAllEvents_.

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

Definition at line 175 of file OutputModule.h.

175 {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 44 of file OutputModule.h.

template<typename T >
friend class OutputModuleCommunicatorT
friend

Definition at line 46 of file OutputModule.h.

template<typename T >
friend class WorkerT
friend

Definition at line 45 of file OutputModule.h.

Member Data Documentation

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

Definition at line 156 of file OutputModule.h.

Referenced by branchIDLists().

BranchParents edm::OutputModule::branchParents_
private

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

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

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

Definition at line 140 of file OutputModule.h.

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

SelectedProductsForBranchType edm::OutputModule::keptProducts_
private

Definition at line 139 of file OutputModule.h.

Referenced by keptProducts(), and selectProducts().

int edm::OutputModule::maxEvents_
private

Definition at line 121 of file OutputModule.h.

Referenced by configure(), and maxEvents().

ModuleDescription edm::OutputModule::moduleDescription_
private

Definition at line 145 of file OutputModule.h.

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

BranchIDLists const* edm::OutputModule::origBranchIDLists_
private

Definition at line 157 of file OutputModule.h.

Referenced by branchIDLists(), and configure().

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

Definition at line 142 of file OutputModule.h.

Referenced by OutputModule(), and processName().

ProductSelector edm::OutputModule::productSelector_
private

Definition at line 144 of file OutputModule.h.

Referenced by selected(), and selectProducts().

ProductSelectorRules edm::OutputModule::productSelectorRules_
private

Definition at line 143 of file OutputModule.h.

Referenced by selectProducts().

int edm::OutputModule::remainingEvents_
private

Definition at line 122 of file OutputModule.h.

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

ParameterSetID edm::OutputModule::selector_config_id_
private

Definition at line 151 of file OutputModule.h.

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

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

Definition at line 148 of file OutputModule.h.

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

bool edm::OutputModule::wantAllEvents_
private

Definition at line 147 of file OutputModule.h.

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