CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

edm::RunPrincipal Class Reference

#include <RunPrincipal.h>

Inheritance diagram for edm::RunPrincipal:
edm::Principal edm::EDProductGetter

List of all members.

Public Types

typedef RunAuxiliary Auxiliary
typedef Principal Base

Public Member Functions

void addToProcessHistory ()
RunAuxiliary const & aux () const
Timestamp const & beginTime () const
void checkProcessHistory () const
Timestamp const & endTime () const
void fillRunPrincipal (boost::shared_ptr< BranchMapper > mapper=boost::shared_ptr< BranchMapper >(), DelayedReader *reader=0)
RunID const & id () const
void mergeAuxiliary (RunAuxiliary const &aux)
void put (ConstBranchDescription const &bd, WrapperOwningHolder const &edp, ProductProvenance &productProvenance)
void readImmediate () const
RunNumber_t run () const
 RunPrincipal (boost::shared_ptr< RunAuxiliary > aux, boost::shared_ptr< ProductRegistry const > reg, ProcessConfiguration const &pc)
void setEndTime (Timestamp const &time)
void setUnscheduledHandler (boost::shared_ptr< UnscheduledHandler >)
 ~RunPrincipal ()

Private Member Functions

void resolveProductImmediate (Group const &g) const
virtual bool unscheduledFill (std::string const &) const

Private Attributes

boost::shared_ptr< RunAuxiliaryaux_

Detailed Description

Definition at line 26 of file RunPrincipal.h.


Member Typedef Documentation

Definition at line 28 of file RunPrincipal.h.

Definition at line 29 of file RunPrincipal.h.


Constructor & Destructor Documentation

edm::RunPrincipal::RunPrincipal ( boost::shared_ptr< RunAuxiliary aux,
boost::shared_ptr< ProductRegistry const >  reg,
ProcessConfiguration const &  pc 
)

Definition at line 11 of file RunPrincipal.cc.

                                    :
      Base(reg, pc, InRun),
      aux_(aux) {
  }
edm::RunPrincipal::~RunPrincipal ( ) [inline]

Definition at line 35 of file RunPrincipal.h.

{}

Member Function Documentation

void edm::RunPrincipal::addToProcessHistory ( )

Definition at line 98 of file RunPrincipal.cc.

References edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), edm::Principal::processConfiguration(), edm::Principal::processHistoryUpdate(), edm::ProcessHistory::push_back(), and edm::Principal::setProcessHistory().

Referenced by fillRunPrincipal().

                                    {
    ProcessHistory& ph = processHistoryUpdate();
    ph.push_back(processConfiguration());
    //OPTIMIZATION NOTE:  As of 0_9_0_pre3
    // For very simple Sources (e.g. EmptySource) this routine takes up nearly 50% of the time per event.
    // 96% of the time for this routine is being spent in computing the
    // ProcessHistory id which happens because we are reconstructing the ProcessHistory for each event.
    // (The process ID is first computed in the call to 'insertMapped(..)' below.)
    // It would probably be better to move the ProcessHistory construction out to somewhere
    // which persists for longer than one Event

    ProcessHistoryRegistry::instance()->insertMapped(ph);
    setProcessHistory(*this);
  }
RunAuxiliary const& edm::RunPrincipal::aux ( ) const [inline]

Definition at line 41 of file RunPrincipal.h.

References aux_.

Referenced by edm::SubProcess::beginRun(), beginTime(), endTime(), id(), run(), and edm::RootOutputFile::writeRun().

                                    {
      return *aux_;
    }
Timestamp const& edm::RunPrincipal::beginTime ( ) const [inline]
void edm::RunPrincipal::checkProcessHistory ( ) const

Definition at line 84 of file RunPrincipal.cc.

References aux_, edm::ProcessHistory::begin(), edm::errors::Configuration, edm::ProcessHistory::end(), Exception, edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), edm::Principal::processConfiguration(), and edm::ProcessConfiguration::processName().

Referenced by fillRunPrincipal().

                                          {
    ProcessHistory ph;
    ProcessHistoryRegistry::instance()->getMapped(aux_->processHistoryID(), ph);
    std::string const& processName = processConfiguration().processName();
    for (ProcessHistory::const_iterator it = ph.begin(), itEnd = ph.end(); it != itEnd; ++it) {
      if(processName == it->processName()) {
        throw edm::Exception(errors::Configuration, "Duplicate Process")
          << "The process name " << processName << " was previously used on these products.\n"
          << "Please modify the configuration file to use a distinct process name.\n";
      }
    }
  }
Timestamp const& edm::RunPrincipal::endTime ( ) const [inline]
void edm::RunPrincipal::fillRunPrincipal ( boost::shared_ptr< BranchMapper mapper = boost::shared_ptr<BranchMapper>(),
DelayedReader reader = 0 
)
RunID const& edm::RunPrincipal::id ( void  ) const [inline]
void edm::RunPrincipal::mergeAuxiliary ( RunAuxiliary const &  aux) [inline]

Definition at line 65 of file RunPrincipal.h.

References aux_.

                                                 {
      return aux_->mergeAuxiliary(aux);
    }
void edm::RunPrincipal::put ( ConstBranchDescription const &  bd,
WrapperOwningHolder const &  edp,
ProductProvenance productProvenance 
)

Definition at line 37 of file RunPrincipal.cc.

References edm::ConstBranchDescription::branchID(), edm::Principal::branchMapperPtr(), Exception, g, edm::Principal::getExistingGroup(), edm::errors::InsertFailure, edm::WrapperHolder::isValid(), edm::ConstBranchDescription::produced(), and edm::Principal::putOrMerge().

Referenced by edm::Run::commit_().

                                              {

    assert(bd.produced());
    if(!edp.isValid()) {
      throw edm::Exception(edm::errors::InsertFailure,"Null Pointer")
        << "put: Cannot put because auto_ptr to product is null."
        << "\n";
    }
    branchMapperPtr()->insert(productProvenance);
    Group *g = getExistingGroup(bd.branchID());
    assert(g);
    // Group assumes ownership
    putOrMerge(edp, productProvenance, g);
  }
void edm::RunPrincipal::readImmediate ( ) const

Definition at line 56 of file RunPrincipal.cc.

References edm::Principal::begin(), edm::Group::branchDescription(), edm::Principal::branchMapperPtr(), edm::Principal::end(), g, i, edm::ConstBranchDescription::produced(), edm::Group::productUnavailable(), and resolveProductImmediate().

                                    {
    for (Principal::const_iterator i = begin(), iEnd = end(); i != iEnd; ++i) {
      Group const& g = **i;
      if(!g.branchDescription().produced()) {
        if(!g.productUnavailable()) {
          resolveProductImmediate(g);
        }
      }
    }
    branchMapperPtr()->setDelayedRead(false);
  }
void edm::RunPrincipal::resolveProductImmediate ( Group const &  g) const [private]

Definition at line 69 of file RunPrincipal.cc.

References edm::Group::branchDescription(), edm::ProductData::getInterface(), edm::getProduct(), edm::ConstBranchDescription::produced(), edm::Group::productData(), edm::Principal::putOrMerge(), and edm::Principal::reader().

Referenced by readImmediate().

                                                            {
    if(g.branchDescription().produced()) return; // nothing to do.
    if(!reader()) return; // nothing to do.

    // must attempt to load from persistent store
    BranchKey const bk = BranchKey(g.branchDescription());
    WrapperOwningHolder edp(reader()->getProduct(bk, g.productData().getInterface(), this));

    // Now fix up the Group
    if(edp.isValid()) {
      putOrMerge(edp, &g);
    }
  }
RunNumber_t edm::RunPrincipal::run ( void  ) const [inline]
void edm::RunPrincipal::setEndTime ( Timestamp const &  time) [inline]

Definition at line 61 of file RunPrincipal.h.

References aux_.

Referenced by edm::InputSource::doEndRun().

                                           {
      aux_->setEndTime(time);
    }
void edm::RunPrincipal::setUnscheduledHandler ( boost::shared_ptr< UnscheduledHandler ) [inline]

Definition at line 74 of file RunPrincipal.h.

{}
virtual bool edm::RunPrincipal::unscheduledFill ( std::string const &  ) const [inline, private, virtual]

Implements edm::Principal.

Definition at line 85 of file RunPrincipal.h.

{return false;}

Member Data Documentation

boost::shared_ptr<RunAuxiliary> edm::RunPrincipal::aux_ [private]

Definition at line 90 of file RunPrincipal.h.

Referenced by aux(), checkProcessHistory(), fillRunPrincipal(), mergeAuxiliary(), and setEndTime().