CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
edm::global::OutputModuleBase Class Referenceabstract

#include <OutputModuleBase.h>

Inheritance diagram for edm::global::OutputModuleBase:
edm::EDConsumerBase edm::global::OutputModule< T > edm::global::outputmodule::InputFileWatcher edm::global::OutputModule<> edm::AsciiOutputModule

Public Types

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

Public Member Functions

BranchIDLists const * branchIDLists ()
 
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
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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 doBeginStream (StreamID id)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)
 
bool doEndRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
 
void doEndStream (StreamID id)
 
bool doEvent (EventPrincipal const &ep, EventSetup const &c, ActivityRegistry *, ModuleCallingContext const *)
 
void doPreallocate (PreallocationConfiguration const &)
 
void doStreamBeginLuminosityBlock (StreamID id, LuminosityBlockPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
 
void doStreamBeginRun (StreamID id, RunPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
 
void doStreamEndLuminosityBlock (StreamID id, LuminosityBlockPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
 
void doStreamEndRun (StreamID id, RunPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
 
std::map< BranchID::value_type, BranchID::value_type > const & droppedBranchIDToKeptBranchID ()
 
void preActionBeforeRunEventAsync (WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) 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 Member Functions

virtual void beginJob ()
 
virtual void doBeginLuminosityBlock_ (LuminosityBlockForOutput const &)
 
virtual void doBeginLuminosityBlockSummary_ (LuminosityBlockForOutput const &, EventSetup const &)
 
virtual void doBeginRun_ (RunForOutput const &)
 
virtual void doBeginRunSummary_ (RunForOutput const &, EventSetup const &)
 
virtual void doBeginStream_ (StreamID)
 
void doCloseFile ()
 Tell the OutputModule that is must end the current file. More...
 
virtual void doEndLuminosityBlock_ (LuminosityBlockForOutput const &)
 
virtual void doEndLuminosityBlockSummary_ (LuminosityBlockForOutput const &, EventSetup const &)
 
virtual void doEndRun_ (RunForOutput const &)
 
virtual void doEndRunSummary_ (RunForOutput const &, EventSetup const &)
 
virtual void doEndStream_ (StreamID)
 
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 &)
 
virtual void doStreamBeginLuminosityBlock_ (StreamID, LuminosityBlockForOutput const &, EventSetup const &)
 
virtual void doStreamBeginRun_ (StreamID, RunForOutput const &, EventSetup const &)
 
virtual void doStreamEndLuminosityBlock_ (StreamID, LuminosityBlockForOutput const &, EventSetup const &)
 
virtual void doStreamEndLuminosityBlockSummary_ (StreamID, LuminosityBlockForOutput const &, EventSetup const &)
 
virtual void doStreamEndRun_ (StreamID, RunForOutput const &, EventSetup const &)
 
virtual void doStreamEndRunSummary_ (StreamID, RunForOutput const &, EventSetup const &)
 
void doWriteLuminosityBlock (LuminosityBlockPrincipal const &lbp, ModuleCallingContext const *)
 
void doWriteRun (RunPrincipal const &rp, ModuleCallingContext const *)
 
virtual void endJob ()
 
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 preallocStreams (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...
 
std::string workerType () const
 
virtual void write (EventForOutput const &)=0
 
virtual void writeLuminosityBlock (LuminosityBlockForOutput const &)=0
 
virtual void writeRun (RunForOutput const &)=0
 

Private Attributes

edm::propagate_const< std::unique_ptr< BranchIDLists > > branchIDLists_
 
std::map< BranchID::value_type, BranchID::value_typedroppedBranchIDToKeptBranchID_
 
std::array< bool, NumBranchTypeshasNewlyDroppedBranch_
 
std::map< BranchID, bool > keepAssociation_
 
SelectedProductsForBranchType keptProducts_
 
int maxEvents_
 
ModuleDescription moduleDescription_
 
BranchIDLists const * origBranchIDLists_
 
std::string process_name_
 
ProductSelector productSelector_
 
ProductSelectorRules productSelectorRules_
 
std::atomic< int > remainingEvents_
 
ParameterSet selectEvents_
 
ParameterSetID selector_config_id_
 
std::vector< detail::TriggerResultsBasedEventSelectorselectors_
 
edm::propagate_const< 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 61 of file OutputModuleBase.h.

Member Typedef Documentation

Definition at line 66 of file OutputModuleBase.h.

Constructor & Destructor Documentation

OutputModuleBase::OutputModuleBase ( ParameterSet const &  pset)
explicit

Definition at line 42 of file OutputModuleBase.cc.

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

42  :
43  maxEvents_(-1),
45  keptProducts_(),
47  process_name_(),
48  productSelectorRules_(pset, "outputCommands", "OutputModule"),
51  wantAllEvents_(false),
52  selectors_(),
56  origBranchIDLists_(nullptr),
57  thinnedAssociationsHelper_(new ThinnedAssociationsHelper) {
58 
59  hasNewlyDroppedBranch_.fill(false);
60 
62  process_name_ = tns->getProcessName();
63 
65  pset.getUntrackedParameterSet("SelectEvents", ParameterSet());
66 
67  selectEvents_.registerIt(); // Just in case this PSet is not registered
68 
70 
71  //need to set wantAllEvents_ in constructor
72  // we will make the remaining selectors once we know how many streams
73  selectors_.resize(1);
77  selectors_[0],
79 
80  }
BranchIDLists const * origBranchIDLists_
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
ParameterSetID id() const
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
SelectedProductsForBranchType keptProducts_
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
ModuleDescription moduleDescription_
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::propagate_const< std::unique_ptr< BranchIDLists > > branchIDLists_
bool configureEventSelector(edm::ParameterSet const &iPSet, std::string const &iProcessName, std::vector< std::string > const &iAllTriggerNames, edm::detail::TriggerResultsBasedEventSelector &oSelector, ConsumesCollector &&iC)
ProductSelectorRules productSelectorRules_
std::atomic< int > remainingEvents_
std::vector< std::string > const & getAllTriggerNames()
ParameterSet const & registerIt()
OutputModuleBase::~OutputModuleBase ( )
virtual

Definition at line 182 of file OutputModuleBase.cc.

182 { }
edm::global::OutputModuleBase::OutputModuleBase ( OutputModuleBase const &  )
delete

Member Function Documentation

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

Definition at line 397 of file OutputModuleBase.cc.

References edm::global::kBaseType().

397  {
398  return kBaseType;
399  }
static const std::string kBaseType("EDAnalyzer")
virtual void edm::global::OutputModuleBase::beginJob ( void  )
inlineprivatevirtual

Definition at line 237 of file OutputModuleBase.h.

Referenced by doBeginJob().

237 {}
BranchIDLists const * OutputModuleBase::branchIDLists ( )

Definition at line 343 of file OutputModuleBase.cc.

References branchIDLists_, droppedBranchIDToKeptBranchID_, and origBranchIDLists_.

343  {
344  if(!droppedBranchIDToKeptBranchID_.empty()) {
345  // Make a private copy of the BranchIDLists.
347  // Check for branches dropped while an EDAlias was kept.
348  for(BranchIDList& branchIDList : *branchIDLists_) {
349  for(BranchID::value_type& branchID : branchIDList) {
350  // 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.
351  std::map<BranchID::value_type, BranchID::value_type>::const_iterator iter = droppedBranchIDToKeptBranchID_.find(branchID);
352  if(iter != droppedBranchIDToKeptBranchID_.end()) {
353  branchID = iter->second;
354  }
355  }
356  }
357  return branchIDLists_.get();
358  }
359  return origBranchIDLists_;
360  }
BranchIDLists const * origBranchIDLists_
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
unsigned int value_type
Definition: BranchID.h:16
edm::propagate_const< std::unique_ptr< BranchIDLists > > branchIDLists_
std::vector< BranchID::value_type > BranchIDList
Definition: BranchIDList.h:18
void OutputModuleBase::configure ( OutputModuleDescription const &  desc)
protected
ModuleDescription const & OutputModuleBase::description ( ) const
protected

Definition at line 368 of file OutputModuleBase.cc.

References moduleDescription_.

Referenced by setEventSelectionInfo().

368  {
369  return moduleDescription_;
370  }
ModuleDescription moduleDescription_
void OutputModuleBase::doBeginJob ( )
protected

Definition at line 202 of file OutputModuleBase.cc.

References beginJob().

202  {
203  this->beginJob();
204  }
bool OutputModuleBase::doBeginLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 274 of file OutputModuleBase.cc.

References doBeginLuminosityBlock_(), moduleDescription_, and edm::OccurrenceForOutput::setConsumer().

276  {
278  lb.setConsumer(this);
280  return true;
281  }
ModuleDescription moduleDescription_
virtual void doBeginLuminosityBlock_(LuminosityBlockForOutput const &)
virtual void edm::global::OutputModuleBase::doBeginLuminosityBlock_ ( LuminosityBlockForOutput const &  )
inlineprivatevirtual

Definition at line 262 of file OutputModuleBase.h.

Referenced by doBeginLuminosityBlock().

262 {}
virtual void edm::global::OutputModuleBase::doBeginLuminosityBlockSummary_ ( LuminosityBlockForOutput const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 263 of file OutputModuleBase.h.

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

Definition at line 246 of file OutputModuleBase.cc.

References doBeginRun_(), moduleDescription_, alignCSCRings::r, and edm::OccurrenceForOutput::setConsumer().

248  {
250  r.setConsumer(this);
251  doBeginRun_(r);
252  return true;
253  }
ModuleDescription moduleDescription_
virtual void doBeginRun_(RunForOutput const &)
virtual void edm::global::OutputModuleBase::doBeginRun_ ( RunForOutput const &  )
inlineprivatevirtual

Definition at line 258 of file OutputModuleBase.h.

Referenced by doBeginRun().

258 {}
virtual void edm::global::OutputModuleBase::doBeginRunSummary_ ( RunForOutput const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 259 of file OutputModuleBase.h.

259 {}
void edm::global::OutputModuleBase::doBeginStream ( StreamID  id)
protected
virtual void edm::global::OutputModuleBase::doBeginStream_ ( StreamID  )
inlineprivatevirtual

Definition at line 249 of file OutputModuleBase.h.

249 {}
void OutputModuleBase::doCloseFile ( )
private

Tell the OutputModule that is must end the current file.

Definition at line 333 of file OutputModuleBase.cc.

References isFileOpen(), and reallyCloseFile().

333  {
334  if(isFileOpen()) {
335  reallyCloseFile();
336  }
337  }
virtual bool isFileOpen() const
void OutputModuleBase::doEndJob ( )
protected

Definition at line 206 of file OutputModuleBase.cc.

References endJob().

206  {
207  endJob();
208  }
bool OutputModuleBase::doEndLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 284 of file OutputModuleBase.cc.

References doEndLuminosityBlock_(), moduleDescription_, and edm::OccurrenceForOutput::setConsumer().

286  {
288  lb.setConsumer(this);
290  return true;
291  }
ModuleDescription moduleDescription_
virtual void doEndLuminosityBlock_(LuminosityBlockForOutput const &)
virtual void edm::global::OutputModuleBase::doEndLuminosityBlock_ ( LuminosityBlockForOutput const &  )
inlineprivatevirtual

Definition at line 264 of file OutputModuleBase.h.

Referenced by doEndLuminosityBlock().

264 {}
virtual void edm::global::OutputModuleBase::doEndLuminosityBlockSummary_ ( LuminosityBlockForOutput const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 265 of file OutputModuleBase.h.

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

Definition at line 256 of file OutputModuleBase.cc.

References doEndRun_(), moduleDescription_, alignCSCRings::r, and edm::OccurrenceForOutput::setConsumer().

258  {
260  r.setConsumer(this);
261  doEndRun_(r);
262  return true;
263  }
ModuleDescription moduleDescription_
virtual void doEndRun_(RunForOutput const &)
virtual void edm::global::OutputModuleBase::doEndRun_ ( RunForOutput const &  )
inlineprivatevirtual

Definition at line 260 of file OutputModuleBase.h.

Referenced by doEndRun().

260 {}
virtual void edm::global::OutputModuleBase::doEndRunSummary_ ( RunForOutput const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 261 of file OutputModuleBase.h.

261 {}
void edm::global::OutputModuleBase::doEndStream ( StreamID  id)
protected
virtual void edm::global::OutputModuleBase::doEndStream_ ( StreamID  )
inlineprivatevirtual

Definition at line 250 of file OutputModuleBase.h.

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

Definition at line 219 of file OutputModuleBase.cc.

References MillePedeFileConverter_cfg::e, moduleDescription_, remainingEvents(), remainingEvents_, edm::OccurrenceForOutput::setConsumer(), and write().

222  {
223 
224  {
226  e.setConsumer(this);
227  EventSignalsSentry sentry(act,mcc);
228  write(e);
229  }
230 
231  auto remainingEvents = remainingEvents_.load();
232  bool keepTrying = remainingEvents > 0;
233  while(keepTrying) {
234  auto newValue = remainingEvents - 1;
235  keepTrying = !remainingEvents_.compare_exchange_strong(remainingEvents, newValue);
236  if(keepTrying) {
237  // the exchange failed because the value was changed by another thread.
238  // remainingEvents was changed to be the new value of remainingEvents_;
239  keepTrying = remainingEvents > 0;
240  }
241  }
242  return true;
243  }
ModuleDescription moduleDescription_
std::atomic< int > remainingEvents_
virtual void write(EventForOutput const &)=0
void OutputModuleBase::doOpenFile ( FileBlock const &  fb)
private

Definition at line 300 of file OutputModuleBase.cc.

References openFile().

300  {
301  openFile(fb);
302  }
virtual void openFile(FileBlock const &)
void OutputModuleBase::doPostForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
)
private

Definition at line 318 of file OutputModuleBase.cc.

References postForkReacquireResources().

318  {
319  postForkReacquireResources(iChildIndex, iNumberOfChildren);
320  }
virtual void postForkReacquireResources(unsigned int, unsigned int)
void OutputModuleBase::doPreallocate ( PreallocationConfiguration const &  iPC)
protected

Definition at line 184 of file OutputModuleBase.cc.

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

184  {
185  auto nstreams = iPC.numberOfStreams();
186  selectors_.resize(nstreams);
187 
188  bool seenFirst = false;
189  for(auto& s : selectors_) {
190  if(seenFirst) {
194  s,
196  } else {
197  seenFirst = true;
198  }
199  }
200  }
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
bool configureEventSelector(edm::ParameterSet const &iPSet, std::string const &iProcessName, std::vector< std::string > const &iAllTriggerNames, edm::detail::TriggerResultsBasedEventSelector &oSelector, ConsumesCollector &&iC)
std::vector< std::string > const & getAllTriggerNames()
void OutputModuleBase::doPreForkReleaseResources ( )
private

Definition at line 313 of file OutputModuleBase.cc.

References preForkReleaseResources().

313  {
315  }
void edm::global::OutputModuleBase::doRegisterThinnedAssociations ( ProductRegistry const &  ,
ThinnedAssociationsHelper  
)
inlineprivate

Definition at line 212 of file OutputModuleBase.h.

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

Definition at line 308 of file OutputModuleBase.cc.

References doRespondToCloseInputFile_().

308  {
310  }
virtual void doRespondToCloseInputFile_(FileBlock const &)
virtual void edm::global::OutputModuleBase::doRespondToCloseInputFile_ ( FileBlock const &  )
inlineprivatevirtual

Reimplemented in edm::global::outputmodule::InputFileWatcher.

Definition at line 267 of file OutputModuleBase.h.

Referenced by doRespondToCloseInputFile().

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

Definition at line 304 of file OutputModuleBase.cc.

References doRespondToOpenInputFile_().

304  {
306  }
virtual void doRespondToOpenInputFile_(FileBlock const &)
virtual void edm::global::OutputModuleBase::doRespondToOpenInputFile_ ( FileBlock const &  )
inlineprivatevirtual

Reimplemented in edm::global::outputmodule::InputFileWatcher.

Definition at line 266 of file OutputModuleBase.h.

Referenced by doRespondToOpenInputFile().

266 {}
void edm::global::OutputModuleBase::doStreamBeginLuminosityBlock ( StreamID  id,
LuminosityBlockPrincipal ep,
EventSetup const &  c,
ModuleCallingContext const *   
)
protected
virtual void edm::global::OutputModuleBase::doStreamBeginLuminosityBlock_ ( StreamID  ,
LuminosityBlockForOutput const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 254 of file OutputModuleBase.h.

254 {}
void edm::global::OutputModuleBase::doStreamBeginRun ( StreamID  id,
RunPrincipal ep,
EventSetup const &  c,
ModuleCallingContext const *   
)
protected
virtual void edm::global::OutputModuleBase::doStreamBeginRun_ ( StreamID  ,
RunForOutput const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 251 of file OutputModuleBase.h.

251 {}
void edm::global::OutputModuleBase::doStreamEndLuminosityBlock ( StreamID  id,
LuminosityBlockPrincipal ep,
EventSetup const &  c,
ModuleCallingContext const *   
)
protected
virtual void edm::global::OutputModuleBase::doStreamEndLuminosityBlock_ ( StreamID  ,
LuminosityBlockForOutput const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 255 of file OutputModuleBase.h.

255 {}
virtual void edm::global::OutputModuleBase::doStreamEndLuminosityBlockSummary_ ( StreamID  ,
LuminosityBlockForOutput const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 256 of file OutputModuleBase.h.

256 {}
void edm::global::OutputModuleBase::doStreamEndRun ( StreamID  id,
RunPrincipal ep,
EventSetup const &  c,
ModuleCallingContext const *   
)
protected
virtual void edm::global::OutputModuleBase::doStreamEndRun_ ( StreamID  ,
RunForOutput const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 252 of file OutputModuleBase.h.

252 {}
virtual void edm::global::OutputModuleBase::doStreamEndRunSummary_ ( StreamID  ,
RunForOutput const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 253 of file OutputModuleBase.h.

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

Definition at line 293 of file OutputModuleBase.cc.

References moduleDescription_, edm::OccurrenceForOutput::setConsumer(), and writeLuminosityBlock().

294  {
296  lb.setConsumer(this);
298  }
ModuleDescription moduleDescription_
virtual void writeLuminosityBlock(LuminosityBlockForOutput const &)=0
void OutputModuleBase::doWriteRun ( RunPrincipal const &  rp,
ModuleCallingContext const *  mcc 
)
private

Definition at line 266 of file OutputModuleBase.cc.

References moduleDescription_, alignCSCRings::r, edm::OccurrenceForOutput::setConsumer(), and writeRun().

267  {
269  r.setConsumer(this);
270  writeRun(r);
271  }
ModuleDescription moduleDescription_
virtual void writeRun(RunForOutput const &)=0
std::map<BranchID::value_type, BranchID::value_type> const& edm::global::OutputModuleBase::droppedBranchIDToKeptBranchID ( )
inlineprotected

Definition at line 153 of file OutputModuleBase.h.

153  {
155  }
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
virtual void edm::global::OutputModuleBase::endJob ( void  )
inlineprivatevirtual

Definition at line 238 of file OutputModuleBase.h.

Referenced by doEndJob().

238 {}
void OutputModuleBase::fillDescription ( ParameterSetDescription desc)
static

Definition at line 385 of file OutputModuleBase.cc.

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

385  {
386  ProductSelectorRules::fillDescription(desc, "outputCommands");
388  }
static void fillDescription(ParameterSetDescription &desc, char const *parameterName, std::vector< std::string > const &defaultStrings=defaultSelectionStrings())
static void fillDescription(ParameterSetDescription &desc)
void OutputModuleBase::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 378 of file OutputModuleBase.cc.

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

378  {
380  desc.setUnknown();
381  descriptions.addDefault(desc);
382  }
std::array<bool, NumBranchTypes> const& edm::global::OutputModuleBase::hasNewlyDroppedBranch ( ) const
inline

Definition at line 87 of file OutputModuleBase.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 242 of file OutputModuleBase.h.

Referenced by doCloseFile(), and maybeOpenFile().

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

Definition at line 136 of file OutputModuleBase.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().

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

Definition at line 86 of file OutputModuleBase.h.

86 {return keptProducts_;}
SelectedProductsForBranchType keptProducts_
bool edm::global::OutputModuleBase::limitReached ( ) const
inlineprivate

Definition at line 277 of file OutputModuleBase.h.

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

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

Definition at line 76 of file OutputModuleBase.h.

void OutputModuleBase::maybeOpenFile ( )
private

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

Definition at line 329 of file OutputModuleBase.cc.

References isFileOpen(), and reallyOpenFile().

329  {
330  if(!isFileOpen()) reallyOpenFile();
331  }
virtual bool isFileOpen() const
const ModuleDescription& edm::global::OutputModuleBase::moduleDescription ( ) const
inline

Definition at line 100 of file OutputModuleBase.h.

References heppy_report::description.

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

Definition at line 326 of file OutputModuleBase.cc.

Referenced by doPostForkReacquireResources().

326 {}
void edm::global::OutputModuleBase::preActionBeforeRunEventAsync ( WaitingTask iTask,
ModuleCallingContext const &  iModuleCallingContext,
Principal const &  iPrincipal 
) const
inlineprotected

Definition at line 137 of file OutputModuleBase.h.

References genParticles_cff::map, and AlCaHLTBitMon_QueryRunRegistry::string.

137 {}
virtual void edm::global::OutputModuleBase::preallocStreams ( unsigned  int)
inlineprivatevirtual

Definition at line 248 of file OutputModuleBase.h.

248 {}
void OutputModuleBase::preForkReleaseResources ( )
privatevirtual

Definition at line 323 of file OutputModuleBase.cc.

Referenced by doPreForkReleaseResources().

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

Definition at line 210 of file OutputModuleBase.cc.

References MillePedeFileConverter_cfg::e, moduleDescription_, alignCSCRings::s, selectors_, edm::OccurrenceForOutput::setConsumer(), and wantAllEvents_.

210  {
211  if(wantAllEvents_) return true;
212  auto& s = selectors_[id.value()];
214  e.setConsumer(this);
215  return s.wantEvent(e);
216  }
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
ModuleDescription moduleDescription_
void OutputModuleBase::prevalidate ( ConfigurationDescriptions )
static

Definition at line 391 of file OutputModuleBase.cc.

References edm::global::kBaseType(), and AlCaHLTBitMon_QueryRunRegistry::string.

391  {
392  }
std::string const& edm::global::OutputModuleBase::processName ( ) const
inline

Definition at line 85 of file OutputModuleBase.h.

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

Definition at line 339 of file OutputModuleBase.cc.

Referenced by doCloseFile().

339  {
340  }
virtual void edm::global::OutputModuleBase::reallyOpenFile ( )
inlineprivatevirtual

Definition at line 243 of file OutputModuleBase.h.

Referenced by maybeOpenFile().

243 {}
void edm::global::OutputModuleBase::registerProductsAndCallbacks ( OutputModuleBase const *  ,
ProductRegistry const *   
)
inlineprivate

Definition at line 224 of file OutputModuleBase.h.

224 {}
int edm::global::OutputModuleBase::remainingEvents ( ) const
inline

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

Definition at line 80 of file OutputModuleBase.h.

Referenced by doEvent().

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

Definition at line 373 of file OutputModuleBase.cc.

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

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

373  {
374  return productSelector_.selected(desc);
375  }
bool selected(BranchDescription const &desc) const
ParameterSetID edm::global::OutputModuleBase::selectorConfig ( ) const
inlineprotected

Definition at line 107 of file OutputModuleBase.h.

References EnergyCorrector::c.

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

Definition at line 87 of file OutputModuleBase.cc.

References edm::ProductRegistry::allBranchDescriptions(), TrackValidation_cff::association, 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().

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

Definition at line 402 of file OutputModuleBase.cc.

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

403  {
405  description().moduleLabel(),
406  outputModulePathPositions,
407  anyProductProduced);
408  }
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)
void edm::global::OutputModuleBase::setModuleDescription ( ModuleDescription const &  md)
inlineprivate

Definition at line 273 of file OutputModuleBase.h.

273  {
274  moduleDescription_ = md;
275  }
ModuleDescription moduleDescription_
virtual bool edm::global::OutputModuleBase::shouldWeCloseFile ( ) const
inlineprivatevirtual

Ask the OutputModule if we should end the current file.

Definition at line 234 of file OutputModuleBase.h.

References TriggerAnalyzer::write().

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

Definition at line 363 of file OutputModuleBase.cc.

References thinnedAssociationsHelper_.

363  {
364  return thinnedAssociationsHelper_.get();
365  }
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
bool edm::global::OutputModuleBase::wantAllEvents ( ) const
inline

Definition at line 94 of file OutputModuleBase.h.

std::string edm::global::OutputModuleBase::workerType ( ) const
inlineprivate

Definition at line 215 of file OutputModuleBase.h.

215 {return "WorkerT<edm::global::OutputModuleBase>";}
virtual void edm::global::OutputModuleBase::write ( EventForOutput const &  )
privatepure virtual

Implemented in edm::AsciiOutputModule.

Referenced by doEvent(), and pkg.AbstractPkg::generate().

virtual void edm::global::OutputModuleBase::writeLuminosityBlock ( LuminosityBlockForOutput const &  )
privatepure virtual

Implemented in edm::AsciiOutputModule.

Referenced by doWriteLuminosityBlock().

virtual void edm::global::OutputModuleBase::writeRun ( RunForOutput const &  )
privatepure virtual

Implemented in edm::AsciiOutputModule.

Referenced by doWriteRun().

Friends And Related Function Documentation

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

Definition at line 65 of file OutputModuleBase.h.

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

Definition at line 64 of file OutputModuleBase.h.

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

Definition at line 63 of file OutputModuleBase.h.

Member Data Documentation

edm::propagate_const<std::unique_ptr<BranchIDLists> > edm::global::OutputModuleBase::branchIDLists_
private

Definition at line 195 of file OutputModuleBase.h.

Referenced by branchIDLists().

std::map<BranchID::value_type, BranchID::value_type> edm::global::OutputModuleBase::droppedBranchIDToKeptBranchID_
private

Definition at line 194 of file OutputModuleBase.h.

Referenced by branchIDLists(), and selectProducts().

std::array<bool, NumBranchTypes> edm::global::OutputModuleBase::hasNewlyDroppedBranch_
private

Definition at line 178 of file OutputModuleBase.h.

Referenced by OutputModuleBase(), and selectProducts().

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

Definition at line 199 of file OutputModuleBase.h.

Referenced by selectProducts().

SelectedProductsForBranchType edm::global::OutputModuleBase::keptProducts_
private

Definition at line 177 of file OutputModuleBase.h.

Referenced by keepThisBranch().

int edm::global::OutputModuleBase::maxEvents_
private

Definition at line 159 of file OutputModuleBase.h.

Referenced by configure().

ModuleDescription edm::global::OutputModuleBase::moduleDescription_
private
BranchIDLists const* edm::global::OutputModuleBase::origBranchIDLists_
private

Definition at line 196 of file OutputModuleBase.h.

Referenced by branchIDLists(), and configure().

std::string edm::global::OutputModuleBase::process_name_
private

Definition at line 180 of file OutputModuleBase.h.

Referenced by doPreallocate(), and OutputModuleBase().

ProductSelector edm::global::OutputModuleBase::productSelector_
private

Definition at line 182 of file OutputModuleBase.h.

Referenced by selected(), and selectProducts().

ProductSelectorRules edm::global::OutputModuleBase::productSelectorRules_
private

Definition at line 181 of file OutputModuleBase.h.

Referenced by selectProducts().

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

Definition at line 160 of file OutputModuleBase.h.

Referenced by configure(), and doEvent().

ParameterSet edm::global::OutputModuleBase::selectEvents_
private

Definition at line 187 of file OutputModuleBase.h.

Referenced by doPreallocate(), and OutputModuleBase().

ParameterSetID edm::global::OutputModuleBase::selector_config_id_
private

Definition at line 190 of file OutputModuleBase.h.

Referenced by OutputModuleBase(), and setEventSelectionInfo().

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

Definition at line 186 of file OutputModuleBase.h.

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

edm::propagate_const<std::unique_ptr<ThinnedAssociationsHelper> > edm::global::OutputModuleBase::thinnedAssociationsHelper_
private

Definition at line 198 of file OutputModuleBase.h.

Referenced by selectProducts(), and thinnedAssociationsHelper().

bool edm::global::OutputModuleBase::wantAllEvents_
private

Definition at line 185 of file OutputModuleBase.h.

Referenced by OutputModuleBase(), and prePrefetchSelection().