CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends

edm::OutputModule Class Reference

#include <OutputModule.h>

Inheritance diagram for edm::OutputModule:
edm::EDConsumerBase DQMRootOutputModule edm::AsciiOutputModule edm::GetProductCheckerOutputModule edm::PoolOutputModule edm::ProvenanceCheckerOutputModule edm::StreamerOutputModuleBase edm::SubProcess FRDEventOutputModule< Consumer >

List of all members.

Public Types

typedef OutputModule ModuleType
typedef OutputWorker WorkerType

Public Member Functions

BranchChildren const & branchChildren () const
BranchIDLists const * branchIDLists () const
std::array< bool,
NumBranchTypes > const & 
hasNewlyDroppedBranch () const
SelectionsArray const & keptProducts () const
int maxEvents () const
OutputModuleoperator= (OutputModule const &)
 OutputModule (ParameterSet const &pset)
 OutputModule (OutputModule const &)
std::string const & processName () const
int remainingEvents () const
bool selected (BranchDescription const &desc) const
void selectProducts (ProductRegistry const &preg)
bool wantAllEvents () const
virtual ~OutputModule ()

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)
CurrentProcessingContext const * currentContext () const
ModuleDescription const & description () const
void doBeginJob ()
bool doBeginLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, CurrentProcessingContext const *cpc)
bool doBeginRun (RunPrincipal const &rp, EventSetup const &c, CurrentProcessingContext const *cpc)
void doEndJob ()
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, CurrentProcessingContext const *cpc)
bool doEndRun (RunPrincipal const &rp, EventSetup const &c, CurrentProcessingContext const *cpc)
bool doEvent (EventPrincipal const &ep, EventSetup const &c, CurrentProcessingContext const *cpc)
std::map< BranchID::value_type,
BranchID::value_type > const & 
droppedBranchIDToKeptBranchID ()
Trig getTriggerResults (EventPrincipal const &ep) const
Trig getTriggerResults (Event const &ep) const
ParameterSetID selectorConfig () const
void setEventSelectionInfo (std::map< std::string, std::vector< std::pair< std::string, int > > > const &outputModulePathPositions, bool anyProductProduced)

Private Types

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

Private Member Functions

virtual void beginJob ()
virtual void beginLuminosityBlock (LuminosityBlockPrincipal const &)
virtual void beginRun (RunPrincipal const &)
void doCloseFile ()
 Tell the OutputModule that is must end the current file.
virtual void doOpenFile ()
void doOpenFile (FileBlock const &fb)
void doPostForkReacquireResources (unsigned int iChildIndex, unsigned int iNumberOfChildren)
void doPreForkReleaseResources ()
void doRespondToCloseInputFile (FileBlock const &fb)
void doRespondToCloseOutputFiles (FileBlock const &fb)
void doRespondToOpenInputFile (FileBlock const &fb)
void doRespondToOpenOutputFiles (FileBlock const &fb)
void doWriteLuminosityBlock (LuminosityBlockPrincipal const &lbp)
void doWriteRun (RunPrincipal const &rp)
virtual void endJob ()
virtual void endLuminosityBlock (LuminosityBlockPrincipal const &)
virtual void endRun (RunPrincipal const &)
void fillDependencyGraph ()
virtual void finishEndFile ()
virtual bool isFileOpen () const
bool limitReached () const
void maybeOpenFile ()
virtual void openFile (FileBlock const &)
virtual void postForkReacquireResources (unsigned int, unsigned int)
virtual void preForkReleaseResources ()
void reallyCloseFile ()
void registerProductsAndCallbacks (OutputModule const *, ProductRegistry const *)
virtual void respondToCloseInputFile (FileBlock const &)
virtual void respondToCloseOutputFiles (FileBlock const &)
virtual void respondToOpenInputFile (FileBlock const &)
virtual void respondToOpenOutputFiles (FileBlock const &)
void setModuleDescription (ModuleDescription const &md)
virtual bool shouldWeCloseFile () const
 Ask the OutputModule if we should end the current file.
virtual void startEndFile ()
void updateBranchParents (EventPrincipal const &ep)
std::string workerType () const
virtual void write (EventPrincipal const &e)=0
virtual void writeBranchIDListRegistry ()
virtual void writeBranchMapper ()
virtual void writeFileFormatVersion ()
virtual void writeFileIdentifier ()
virtual void writeIndexIntoFile ()
virtual void writeLuminosityBlock (LuminosityBlockPrincipal const &)=0
virtual void writeParameterSetRegistry ()
virtual void writeParentageRegistry ()
virtual void writeProcessConfigurationRegistry ()
virtual void writeProcessHistoryRegistry ()
virtual void writeProductDependencies ()
virtual void writeProductDescriptionRegistry ()
virtual void writeRun (RunPrincipal const &)=0

Private Attributes

BranchChildren branchChildren_
std::unique_ptr< BranchIDListsbranchIDLists_
BranchParents branchParents_
CurrentProcessingContext const * current_context_
std::map< BranchID::value_type,
BranchID::value_type
droppedBranchIDToKeptBranchID_
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
SelectionsArray keptProducts_
int maxEvents_
ModuleDescription moduleDescription_
BranchIDLists const * origBranchIDLists_
std::string process_name_
bool prodsValid_
ProductSelector productSelector_
ProductSelectorRules productSelectorRules_
int remainingEvents_
ParameterSetID selector_config_id_
detail::CachedProducts selectors_
bool wantAllEvents_

Friends

class OutputWorker
class WorkerT

Detailed Description

Definition at line 36 of file OutputModule.h.


Member Typedef Documentation

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

Definition at line 163 of file OutputModule.h.

Definition at line 40 of file OutputModule.h.

Definition at line 41 of file OutputModule.h.


Constructor & Destructor Documentation

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

Definition at line 105 of file OutputModule.cc.

References edm::ParameterSet::empty(), edm::getAllTriggerNames(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameterSet(), hasNewlyDroppedBranch_, i, edm::ParameterSet::id(), process_name_, edm::ParameterSet::registerIt(), selector_config_id_, selectors_, edm::detail::CachedProducts::setup(), edm::detail::CachedProducts::setupDefault(), and wantAllEvents_.

                                                     :
    maxEvents_(-1),
    remainingEvents_(maxEvents_),
    keptProducts_(),
    hasNewlyDroppedBranch_(),
    process_name_(),
    productSelectorRules_(pset, "outputCommands", "OutputModule"),
    productSelector_(),
    moduleDescription_(),
    current_context_(nullptr),
    prodsValid_(false),
    wantAllEvents_(false),
    selectors_(),
    selector_config_id_(),
    droppedBranchIDToKeptBranchID_(),
    branchIDLists_(new BranchIDLists),
    origBranchIDLists_(nullptr),
    branchParents_(),
    branchChildren_() {

    hasNewlyDroppedBranch_.fill(false);

    Service<service::TriggerNamesService> tns;
    process_name_ = tns->getProcessName();

    ParameterSet selectevents =
      pset.getUntrackedParameterSet("SelectEvents", ParameterSet());

    selectevents.registerIt(); // Just in case this PSet is not registered

    selector_config_id_ = selectevents.id();
    // If selectevents is an emtpy ParameterSet, then we are to write
    // all events, or one which contains a vstrig 'SelectEvents' that
    // is empty, we are to write all events. We have no need for any
    // EventSelectors.
    if(selectevents.empty()) {
        wantAllEvents_ = true;
        selectors_.setupDefault(getAllTriggerNames());
        return;
    }

    std::vector<std::string> path_specs =
      selectevents.getParameter<std::vector<std::string> >("SelectEvents");

    if(path_specs.empty()) {
        wantAllEvents_ = true;
        selectors_.setupDefault(getAllTriggerNames());
        return;
    }

    // If we get here, we have the possibility of having to deal with
    // path_specs that look at more than one process.
    std::vector<parsed_path_spec_t> parsed_paths(path_specs.size());
    for(size_t i = 0; i < path_specs.size(); ++i) {
      parse_path_spec(path_specs[i], parsed_paths[i]);
    }
    selectors_.setup(parsed_paths, getAllTriggerNames(), process_name_);
  }
edm::OutputModule::~OutputModule ( ) [virtual]

Definition at line 256 of file OutputModule.cc.

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

Member Function Documentation

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

Definition at line 502 of file OutputModule.cc.

References edm::kBaseType().

                         {
    return kBaseType;
  }
virtual void edm::OutputModule::beginJob ( void  ) [inline, private, virtual]

Reimplemented in edm::SubProcess, edm::PoolOutputModule, and edm::StreamerOutputModuleBase.

Definition at line 201 of file OutputModule.h.

Referenced by doBeginJob().

{}
virtual void edm::OutputModule::beginLuminosityBlock ( LuminosityBlockPrincipal const &  ) [inline, private, virtual]

Reimplemented in edm::SubProcess.

Definition at line 206 of file OutputModule.h.

Referenced by doBeginLuminosityBlock().

{}
virtual void edm::OutputModule::beginRun ( RunPrincipal const &  ) [inline, private, virtual]

Reimplemented in edm::SubProcess, FRDEventOutputModule< Consumer >, and edm::StreamerOutputModuleBase.

Definition at line 203 of file OutputModule.h.

Referenced by doBeginRun().

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

Definition at line 69 of file OutputModule.h.

References branchChildren_.

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

{return branchChildren_;}
BranchIDLists const * edm::OutputModule::branchIDLists ( ) const

Definition at line 448 of file OutputModule.cc.

References branchIDLists_, droppedBranchIDToKeptBranchID_, and origBranchIDLists_.

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

                                    {
    if(!droppedBranchIDToKeptBranchID_.empty()) {
      // Make a private copy of the BranchIDLists.
      *branchIDLists_ = *origBranchIDLists_;
      // Check for branches dropped while an EDAlias was kept.
      for(BranchIDList& branchIDList : *branchIDLists_) {
        for(BranchID::value_type& branchID : branchIDList) {
          // 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.
          std::map<BranchID::value_type, BranchID::value_type>::const_iterator iter = droppedBranchIDToKeptBranchID_.find(branchID);
          if(iter != droppedBranchIDToKeptBranchID_.end()) {
            branchID = iter->second;
          }
        }
      }
      return branchIDLists_.get();
    }
    return origBranchIDLists_;
  }
void edm::OutputModule::configure ( OutputModuleDescription const &  desc) [protected]
CurrentProcessingContext const * edm::OutputModule::currentContext ( ) const [protected]

Definition at line 468 of file OutputModule.cc.

References current_context_.

                                     {
    return current_context_;
  }
ModuleDescription const & edm::OutputModule::description ( ) const [protected]
void edm::OutputModule::doBeginJob ( ) [protected]

Definition at line 258 of file OutputModule.cc.

References beginJob().

                                {
    this->beginJob();
  }
bool edm::OutputModule::doBeginLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
CurrentProcessingContext const *  cpc 
) [protected]

Definition at line 366 of file OutputModule.cc.

References beginLuminosityBlock(), current_context_, and FDEBUG.

                                                                                 {
    detail::CPCSentry sentry(current_context_, cpc);
    FDEBUG(2) << "beginLuminosityBlock called\n";
    beginLuminosityBlock(lbp);
    return true;
  }
bool edm::OutputModule::doBeginRun ( RunPrincipal const &  rp,
EventSetup const &  c,
CurrentProcessingContext const *  cpc 
) [protected]

Definition at line 340 of file OutputModule.cc.

References beginRun(), current_context_, and FDEBUG.

                                                                     {
    detail::CPCSentry sentry(current_context_, cpc);
    FDEBUG(2) << "beginRun called\n";
    beginRun(rp);
    return true;
  }
void edm::OutputModule::doCloseFile ( ) [private]

Tell the OutputModule that is must end the current file.

Definition at line 424 of file OutputModule.cc.

References isFileOpen(), and reallyCloseFile().

Referenced by edm::OutputWorker::closeFile().

void edm::OutputModule::doEndJob ( ) [protected]

Definition at line 262 of file OutputModule.cc.

References endJob().

                              {
    endJob();
  }
bool edm::OutputModule::doEndLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
CurrentProcessingContext const *  cpc 
) [protected]

Definition at line 376 of file OutputModule.cc.

References current_context_, endLuminosityBlock(), and FDEBUG.

                                                                               {
    detail::CPCSentry sentry(current_context_, cpc);
    FDEBUG(2) << "endLuminosityBlock called\n";
    endLuminosityBlock(lbp);
    return true;
  }
bool edm::OutputModule::doEndRun ( RunPrincipal const &  rp,
EventSetup const &  c,
CurrentProcessingContext const *  cpc 
) [protected]

Definition at line 350 of file OutputModule.cc.

References current_context_, endRun(), and FDEBUG.

                                                                   {
    detail::CPCSentry sentry(current_context_, cpc);
    FDEBUG(2) << "endRun called\n";
    endRun(rp);
    return true;
  }
bool edm::OutputModule::doEvent ( EventPrincipal const &  ep,
EventSetup const &  c,
CurrentProcessingContext const *  cpc 
) [protected]

Definition at line 299 of file OutputModule.cc.

References current_context_, alignCSCRings::e, FDEBUG, moduleDescription_, prodsValid_, remainingEvents_, selectors_, updateBranchParents(), wantAllEvents_, edm::detail::CachedProducts::wantEvent(), and write().

                                                             {
    detail::CPCSentry sentry(current_context_, cpc);
    PVSentry          products_sentry(selectors_, prodsValid_);

    FDEBUG(2) << "writeEvent called\n";

    if(!wantAllEvents_) {
      // use module description and const_cast unless interface to
      // event is changed to just take a const EventPrincipal
      Event e(const_cast<EventPrincipal&>(ep), moduleDescription_);
      if(!selectors_.wantEvent(e)) {
        return true;
      }
    }
    write(ep);
    updateBranchParents(ep);
    if(remainingEvents_ > 0) {
      --remainingEvents_;
    }
    return true;
  }
void edm::OutputModule::doOpenFile ( FileBlock const &  fb) [private]

Definition at line 390 of file OutputModule.cc.

References openFile().

Referenced by edm::OutputWorker::openFile().

                                                   {
    openFile(fb);
  }
virtual void edm::OutputModule::doOpenFile ( ) [inline, private, virtual]

Reimplemented in edm::PoolOutputModule.

Definition at line 219 of file OutputModule.h.

Referenced by maybeOpenFile().

{ }
void edm::OutputModule::doPostForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
) [private]

Definition at line 416 of file OutputModule.cc.

References postForkReacquireResources().

                                                                                                     {
    postForkReacquireResources(iChildIndex, iNumberOfChildren);
  }
void edm::OutputModule::doPreForkReleaseResources ( ) [private]

Definition at line 411 of file OutputModule.cc.

References preForkReleaseResources().

void edm::OutputModule::doRespondToCloseInputFile ( FileBlock const &  fb) [private]

Definition at line 398 of file OutputModule.cc.

References respondToCloseInputFile().

void edm::OutputModule::doRespondToCloseOutputFiles ( FileBlock const &  fb) [private]

Definition at line 406 of file OutputModule.cc.

References respondToCloseOutputFiles().

void edm::OutputModule::doRespondToOpenInputFile ( FileBlock const &  fb) [private]

Definition at line 394 of file OutputModule.cc.

References respondToOpenInputFile().

void edm::OutputModule::doRespondToOpenOutputFiles ( FileBlock const &  fb) [private]

Definition at line 402 of file OutputModule.cc.

References respondToOpenOutputFiles().

void edm::OutputModule::doWriteLuminosityBlock ( LuminosityBlockPrincipal const &  lbp) [private]

Definition at line 385 of file OutputModule.cc.

References FDEBUG, and writeLuminosityBlock().

Referenced by edm::OutputWorker::writeLumi().

                                                                               {
    FDEBUG(2) << "writeLuminosityBlock called\n";
    writeLuminosityBlock(lbp);
  }
void edm::OutputModule::doWriteRun ( RunPrincipal const &  rp) [private]

Definition at line 360 of file OutputModule.cc.

References FDEBUG, and writeRun().

Referenced by edm::OutputWorker::writeRun().

                                                 {
    FDEBUG(2) << "writeRun called\n";
    writeRun(rp);
  }
std::map<BranchID::value_type, BranchID::value_type> const& edm::OutputModule::droppedBranchIDToKeptBranchID ( ) [inline, protected]

Definition at line 112 of file OutputModule.h.

References droppedBranchIDToKeptBranchID_.

Referenced by edm::SubProcess::beginJob().

virtual void edm::OutputModule::endJob ( void  ) [inline, private, virtual]

Reimplemented in edm::SubProcess, and edm::StreamerOutputModuleBase.

Definition at line 202 of file OutputModule.h.

Referenced by doEndJob().

{}
virtual void edm::OutputModule::endLuminosityBlock ( LuminosityBlockPrincipal const &  ) [inline, private, virtual]

Reimplemented in edm::SubProcess.

Definition at line 207 of file OutputModule.h.

Referenced by doEndLuminosityBlock().

{}
virtual void edm::OutputModule::endRun ( RunPrincipal const &  ) [inline, private, virtual]

Reimplemented in edm::SubProcess, FRDEventOutputModule< Consumer >, and edm::StreamerOutputModuleBase.

Definition at line 204 of file OutputModule.h.

Referenced by doEndRun().

{}
void edm::OutputModule::fillDependencyGraph ( ) [private]

Definition at line 554 of file OutputModule.cc.

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

Referenced by reallyCloseFile().

                                    {
    for(BranchParents::const_iterator i = branchParents_.begin(), iEnd = branchParents_.end();
        i != iEnd; ++i) {
      BranchID const& child = i->first;
      std::set<ParentageID> const& eIds = i->second;
      for(std::set<ParentageID>::const_iterator it = eIds.begin(), itEnd = eIds.end();
          it != itEnd; ++it) {
        Parentage entryDesc;
        ParentageRegistry::instance()->getMapped(*it, entryDesc);
        std::vector<BranchID> const& parents = entryDesc.parents();
        for(std::vector<BranchID>::const_iterator j = parents.begin(), jEnd = parents.end();
          j != jEnd; ++j) {
          branchChildren_.insertChild(*j, child);
        }
      }
    }
  }
void edm::OutputModule::fillDescription ( ParameterSetDescription desc) [static]
void edm::OutputModule::fillDescriptions ( ConfigurationDescriptions descriptions) [static]
virtual void edm::OutputModule::finishEndFile ( ) [inline, private, virtual]

Reimplemented in DQMRootOutputModule, and edm::PoolOutputModule.

Definition at line 245 of file OutputModule.h.

Referenced by reallyCloseFile().

{}
Trig edm::OutputModule::getTriggerResults ( Event const &  ep) const [protected]

Definition at line 267 of file OutputModule.cc.

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

Referenced by getTriggerResults(), and edm::StreamerOutputModuleBase::setHltMask().

                                                            {
    return selectors_.getOneTriggerResults(ev);
  }
Trig edm::OutputModule::getTriggerResults ( EventPrincipal const &  ep) const [protected]

Definition at line 271 of file OutputModule.cc.

References current_context_, getTriggerResults(), and edm::CurrentProcessingContext::moduleDescription().

                                                                     {
    // This is bad, because we're returning handles into an Event that
    // is destructed before the return. It might not fail, because the
    // actual EventPrincipal is not destroyed, but it still needs to
    // be cleaned up.
    Event ev(const_cast<EventPrincipal&>(ep),
             *current_context_->moduleDescription());
    return getTriggerResults(ev);
  }
std::array<bool, NumBranchTypes> const& edm::OutputModule::hasNewlyDroppedBranch ( ) const [inline]

Definition at line 62 of file OutputModule.h.

References hasNewlyDroppedBranch_.

virtual bool edm::OutputModule::isFileOpen ( ) const [inline, private, virtual]

Reimplemented in DQMRootOutputModule, and edm::PoolOutputModule.

Definition at line 217 of file OutputModule.h.

Referenced by doCloseFile(), and maybeOpenFile().

{ return true; }
SelectionsArray const& edm::OutputModule::keptProducts ( ) const [inline]
bool edm::OutputModule::limitReached ( ) const [inline, private]

Definition at line 228 of file OutputModule.h.

References remainingEvents_.

Referenced by edm::OutputWorker::limitReached().

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

References maxEvents_.

Referenced by edm::SubProcess::SubProcess().

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

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

Definition at line 420 of file OutputModule.cc.

References doOpenFile(), and isFileOpen().

Referenced by edm::OutputWorker::openNewFileIfNeeded().

                                   {
    if(!isFileOpen()) doOpenFile();
  }
virtual void edm::OutputModule::openFile ( FileBlock const &  ) [inline, private, virtual]

Reimplemented in DQMRootOutputModule, and edm::PoolOutputModule.

Definition at line 209 of file OutputModule.h.

Referenced by doOpenFile().

{}
OutputModule& edm::OutputModule::operator= ( OutputModule const &  )
virtual void edm::OutputModule::postForkReacquireResources ( unsigned int  ,
unsigned int   
) [inline, private, virtual]

Reimplemented in edm::SubProcess, and edm::PoolOutputModule.

Definition at line 215 of file OutputModule.h.

Referenced by doPostForkReacquireResources().

{}
virtual void edm::OutputModule::preForkReleaseResources ( ) [inline, private, virtual]

Reimplemented in edm::SubProcess.

Definition at line 214 of file OutputModule.h.

Referenced by doPreForkReleaseResources().

{}
void edm::OutputModule::prevalidate ( ConfigurationDescriptions ) [static]

Definition at line 496 of file OutputModule.cc.

                                                       {
  }
std::string const& edm::OutputModule::processName ( ) const [inline]
void edm::OutputModule::reallyCloseFile ( ) [private]
void edm::OutputModule::registerProductsAndCallbacks ( OutputModule const *  ,
ProductRegistry const *   
) [inline, private]

Definition at line 195 of file OutputModule.h.

{}
int edm::OutputModule::remainingEvents ( ) const [inline]

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

Definition at line 55 of file OutputModule.h.

References remainingEvents_.

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

{return remainingEvents_;}
virtual void edm::OutputModule::respondToCloseInputFile ( FileBlock const &  ) [inline, private, virtual]

Reimplemented in edm::SubProcess, and edm::PoolOutputModule.

Definition at line 211 of file OutputModule.h.

Referenced by doRespondToCloseInputFile().

{}
virtual void edm::OutputModule::respondToCloseOutputFiles ( FileBlock const &  ) [inline, private, virtual]

Reimplemented in edm::SubProcess.

Definition at line 213 of file OutputModule.h.

Referenced by doRespondToCloseOutputFiles().

{}
virtual void edm::OutputModule::respondToOpenInputFile ( FileBlock const &  ) [inline, private, virtual]

Reimplemented in edm::SubProcess, and edm::PoolOutputModule.

Definition at line 210 of file OutputModule.h.

Referenced by doRespondToOpenInputFile().

{}
virtual void edm::OutputModule::respondToOpenOutputFiles ( FileBlock const &  ) [inline, private, virtual]

Reimplemented in edm::SubProcess.

Definition at line 212 of file OutputModule.h.

Referenced by doRespondToOpenOutputFiles().

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

Definition at line 478 of file OutputModule.cc.

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

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

                                                            {
    return productSelector_.selected(desc);
  }
ParameterSetID edm::OutputModule::selectorConfig ( ) const [inline, protected]
void edm::OutputModule::selectProducts ( ProductRegistry const &  preg)

Definition at line 169 of file OutputModule.cc.

References edm::ProductRegistry::allBranchDescriptions(), edm::BranchDescription::branchID(), edm::BranchDescription::branchType(), edm::errors::Configuration, edm::EDConsumerBase::consumes(), droppedBranchIDToKeptBranchID_, 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().

Referenced by edm::OutputWorker::selectProducts(), and edm::SubProcess::SubProcess().

                                                               {
    if(productSelector_.initialized()) return;
    productSelector_.initialize(productSelectorRules_, preg.allBranchDescriptions());

    // TODO: See if we can collapse keptProducts_ and productSelector_ into a
    // single object. See the notes in the header for ProductSelector
    // for more information.

    std::map<BranchID, BranchDescription const*> trueBranchIDToKeptBranchDesc;

    for(auto const& it : preg.productList()) {
      BranchDescription const& desc = it.second;
      if(desc.transient()) {
        // if the class of the branch is marked transient, output nothing
      } else if(!desc.present() && !desc.produced()) {
        // else if the branch containing the product has been previously dropped,
        // output nothing
      } else if(selected(desc)) {
        // else if the branch has been selected, put it in the list of selected branches.
        if(desc.produced()) {
          // First we check if an equivalent branch has already been selected due to an EDAlias.
          // We only need the check for products produced in this process.
          BranchID const& trueBranchID = desc.originalBranchID();
          std::map<BranchID, BranchDescription const*>::const_iterator iter = trueBranchIDToKeptBranchDesc.find(trueBranchID);
          if(iter != trueBranchIDToKeptBranchDesc.end()) {
             throw edm::Exception(errors::Configuration, "Duplicate Output Selection")
               << "Two (or more) equivalent branches have been selected for output.\n"
               << "#1: " << BranchKey(desc) << "\n" 
               << "#2: " << BranchKey(*iter->second) << "\n" 
               << "Please drop at least one of them.\n";
          }
          trueBranchIDToKeptBranchDesc.insert(std::make_pair(trueBranchID, &desc));
        }
        switch (desc.branchType()) {
          case InEvent:
          {
            consumes(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
                     InputTag{desc.moduleLabel(),
                              desc.productInstanceName(),
                       desc.processName()});
            break;
          }
          case InLumi:
          {
            consumes<InLumi>(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
                             InputTag(desc.moduleLabel(),
                                      desc.productInstanceName(),
                                      desc.processName()));
            break;
          }
          case InRun:
          {
            consumes<InRun>(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
                            InputTag(desc.moduleLabel(),
                                     desc.productInstanceName(),
                                     desc.processName()));
            break;
          }
          default:
            assert(false);
            break;
        }
        // Now put it in the list of selected branches.
        keptProducts_[desc.branchType()].push_back(&desc);
      } else {
        // otherwise, output nothing,
        // and mark the fact that there is a newly dropped branch of this type.
        hasNewlyDroppedBranch_[desc.branchType()] = true;
      }
    }
    // Now fill in a mapping needed in the case that a branch was dropped while its EDAlias was kept.
    for(auto const& it : preg.productList()) {
      BranchDescription const& desc = it.second;
      if(!desc.produced() || desc.isAlias()) continue;
      BranchID const& branchID = desc.branchID();
      std::map<BranchID, BranchDescription const*>::const_iterator iter = trueBranchIDToKeptBranchDesc.find(branchID);
      if(iter != trueBranchIDToKeptBranchDesc.end()) {
        // This branch, produced in this process, or an alias of it, was persisted.
        BranchID const& keptBranchID = iter->second->branchID();
        if(keptBranchID != branchID) {
          // An EDAlias branch was persisted.
          droppedBranchIDToKeptBranchID_.insert(std::make_pair(branchID.id(), keptBranchID.id()));
        }
      }
    }
  }
void edm::OutputModule::setEventSelectionInfo ( std::map< std::string, std::vector< std::pair< std::string, int > > > const &  outputModulePathPositions,
bool  anyProductProduced 
) [protected]

Definition at line 507 of file OutputModule.cc.

References edm::ParameterSet::addParameter(), edm::ParameterSet::copyForModify(), description(), alignCSCRings::e, edm::ParameterSet::exists(), edm::getParameterSet(), i, edm::ParameterSet::id(), diffTwoXMLs::label, edm::ModuleDescription::moduleLabel(), edm::ParameterSet::registerIt(), selector_config_id_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edm::SubProcess::SubProcess().

                                                               {

    ParameterSet selectEventsInfo;
    selectEventsInfo.copyForModify(getParameterSet(selector_config_id_));
    selectEventsInfo.addParameter<bool>("InProcessHistory", anyProductProduced);
    std::string const& label = description().moduleLabel();
    std::vector<std::string> endPaths;
    std::vector<int> endPathPositions;

    // The label will be empty if and only if this is a SubProcess
    // SubProcess's do not appear on any end path
    if (!label.empty()) {
      std::map<std::string, std::vector<std::pair<std::string, int> > >::const_iterator iter = outputModulePathPositions.find(label);
      assert(iter != outputModulePathPositions.end());
      for (std::vector<std::pair<std::string, int> >::const_iterator i = iter->second.begin(), e = iter->second.end();
           i != e; ++i) {
        endPaths.push_back(i->first);
        endPathPositions.push_back(i->second);
      }
    }
    selectEventsInfo.addParameter<std::vector<std::string> >("EndPaths", endPaths);
    selectEventsInfo.addParameter<std::vector<int> >("EndPathPositions", endPathPositions);
    if (!selectEventsInfo.exists("SelectEvents")) {
      selectEventsInfo.addParameter<std::vector<std::string> >("SelectEvents", std::vector<std::string>());
    }
    selectEventsInfo.registerIt();

    selector_config_id_ = selectEventsInfo.id();
  }
void edm::OutputModule::setModuleDescription ( ModuleDescription const &  md) [inline, private]

Definition at line 221 of file OutputModule.h.

References moduleDescription_.

                                                           {
      moduleDescription_ = md;
    }
virtual bool edm::OutputModule::shouldWeCloseFile ( ) const [inline, private, virtual]

Ask the OutputModule if we should end the current file.

Reimplemented in edm::PoolOutputModule, and edm::TimeoutPoolOutputModule.

Definition at line 198 of file OutputModule.h.

Referenced by edm::OutputWorker::shouldWeCloseFile().

{return false;}
virtual void edm::OutputModule::startEndFile ( ) [inline, private, virtual]

Reimplemented in DQMRootOutputModule, and edm::PoolOutputModule.

Definition at line 233 of file OutputModule.h.

Referenced by reallyCloseFile().

{}
void edm::OutputModule::updateBranchParents ( EventPrincipal const &  ep) [private]

Definition at line 539 of file OutputModule.cc.

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

Referenced by doEvent().

                                                            {
    for(EventPrincipal::const_iterator i = ep.begin(), iEnd = ep.end(); i != iEnd; ++i) {
      if((*i) && (*i)->productProvenancePtr() != 0) {
        BranchID const& bid = (*i)->branchDescription().branchID();
        BranchParents::iterator it = branchParents_.find(bid);
        if(it == branchParents_.end()) {
          it = branchParents_.insert(std::make_pair(bid, std::set<ParentageID>())).first;
        }
        it->second.insert((*i)->productProvenancePtr()->parentageID());
        branchChildren_.insertEmpty(bid);
      }
    }
  }
bool edm::OutputModule::wantAllEvents ( ) const [inline]
std::string edm::OutputModule::workerType ( ) const [inline, private]

Definition at line 181 of file OutputModule.h.

{return "OutputWorker";}
virtual void edm::OutputModule::write ( EventPrincipal const &  e) [private, pure virtual]
virtual void edm::OutputModule::writeBranchIDListRegistry ( ) [inline, private, virtual]

Reimplemented in edm::PoolOutputModule.

Definition at line 240 of file OutputModule.h.

Referenced by reallyCloseFile().

{}
virtual void edm::OutputModule::writeBranchMapper ( ) [inline, private, virtual]

Definition at line 244 of file OutputModule.h.

Referenced by reallyCloseFile().

{}
virtual void edm::OutputModule::writeFileFormatVersion ( ) [inline, private, virtual]

Reimplemented in edm::PoolOutputModule.

Definition at line 234 of file OutputModule.h.

Referenced by reallyCloseFile().

{}
virtual void edm::OutputModule::writeFileIdentifier ( ) [inline, private, virtual]

Reimplemented in edm::PoolOutputModule.

Definition at line 235 of file OutputModule.h.

Referenced by reallyCloseFile().

{}
virtual void edm::OutputModule::writeIndexIntoFile ( ) [inline, private, virtual]

Reimplemented in edm::PoolOutputModule.

Definition at line 236 of file OutputModule.h.

Referenced by reallyCloseFile().

{}
virtual void edm::OutputModule::writeLuminosityBlock ( LuminosityBlockPrincipal const &  ) [private, pure virtual]
virtual void edm::OutputModule::writeParameterSetRegistry ( ) [inline, private, virtual]

Reimplemented in edm::PoolOutputModule.

Definition at line 239 of file OutputModule.h.

Referenced by reallyCloseFile().

{}
virtual void edm::OutputModule::writeParentageRegistry ( ) [inline, private, virtual]

Reimplemented in edm::PoolOutputModule.

Definition at line 241 of file OutputModule.h.

Referenced by reallyCloseFile().

{}
virtual void edm::OutputModule::writeProcessConfigurationRegistry ( ) [inline, private, virtual]

Reimplemented in edm::PoolOutputModule.

Definition at line 237 of file OutputModule.h.

Referenced by reallyCloseFile().

{}
virtual void edm::OutputModule::writeProcessHistoryRegistry ( ) [inline, private, virtual]

Reimplemented in edm::PoolOutputModule.

Definition at line 238 of file OutputModule.h.

Referenced by reallyCloseFile().

{}
virtual void edm::OutputModule::writeProductDependencies ( ) [inline, private, virtual]

Reimplemented in edm::PoolOutputModule.

Definition at line 243 of file OutputModule.h.

Referenced by reallyCloseFile().

{}
virtual void edm::OutputModule::writeProductDescriptionRegistry ( ) [inline, private, virtual]

Reimplemented in edm::PoolOutputModule.

Definition at line 242 of file OutputModule.h.

Referenced by reallyCloseFile().

{}
virtual void edm::OutputModule::writeRun ( RunPrincipal const &  ) [private, pure virtual]

Friends And Related Function Documentation

friend class OutputWorker [friend]

Definition at line 39 of file OutputModule.h.

friend class WorkerT [friend]

Definition at line 38 of file OutputModule.h.


Member Data Documentation

Definition at line 160 of file OutputModule.h.

Referenced by branchIDLists().

Definition at line 164 of file OutputModule.h.

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

Definition at line 159 of file OutputModule.h.

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

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

Definition at line 137 of file OutputModule.h.

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

Definition at line 136 of file OutputModule.h.

Referenced by keptProducts(), and selectProducts().

Definition at line 118 of file OutputModule.h.

Referenced by configure(), and maxEvents().

Definition at line 142 of file OutputModule.h.

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

Definition at line 161 of file OutputModule.h.

Referenced by branchIDLists(), and configure().

std::string edm::OutputModule::process_name_ [private]

Definition at line 139 of file OutputModule.h.

Referenced by OutputModule(), and processName().

bool edm::OutputModule::prodsValid_ [mutable, private]

Definition at line 149 of file OutputModule.h.

Referenced by doEvent().

Definition at line 141 of file OutputModule.h.

Referenced by selected(), and selectProducts().

Definition at line 140 of file OutputModule.h.

Referenced by selectProducts().

Definition at line 119 of file OutputModule.h.

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

Definition at line 155 of file OutputModule.h.

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

Definition at line 152 of file OutputModule.h.

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

Definition at line 151 of file OutputModule.h.

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