CMS 3D CMS Logo

edm::EventPrincipal Class Reference

#include <FWCore/Framework/interface/EventPrincipal.h>

Inheritance diagram for edm::EventPrincipal:

edm::Principal edm::EDProductGetter

List of all members.

Public Types

typedef EventAuxiliary Auxiliary
typedef Principal Base
typedef std::vector
< EventEntryInfo
EntryInfoVector
typedef Base::SharedConstGroupPtr SharedConstGroupPtr

Public Member Functions

void addGroup (ConstBranchDescription const &bd, boost::shared_ptr< EventEntryInfo > entryInfo)
void addGroup (std::auto_ptr< EDProduct > prod, ConstBranchDescription const &bd, boost::shared_ptr< EventEntryInfo > entryInfo)
void addGroup (ConstBranchDescription const &bd, std::auto_ptr< EventEntryInfo > entryInfo)
void addGroup (std::auto_ptr< EDProduct > prod, ConstBranchDescription const &bd, std::auto_ptr< EventEntryInfo > entryInfo)
void addGroup (ConstBranchDescription const &bd)
void addOnDemandGroup (ConstBranchDescription const &desc)
EventAuxiliary const & aux () const
int const bunchCrossing () const
 EventPrincipal (EventAuxiliary const &aux, boost::shared_ptr< ProductRegistry const > reg, ProcessConfiguration const &pc, ProcessHistoryID const &hist=ProcessHistoryID(), boost::shared_ptr< BranchMapper > mapper=boost::shared_ptr< BranchMapper >(new BranchMapper), boost::shared_ptr< DelayedReader > rtrv=boost::shared_ptr< DelayedReader >(new NoDelayedReader))
EventSelectionIDVector const & eventSelectionIDs () const
EventAuxiliary::ExperimentType ExperimentType () const
void getAllProvenance (std::vector< Provenance const * > &provenances) const
BasicHandle getByProductID (ProductID const &oid) const
virtual EDProduct const * getIt (ProductID const &oid) const
Provenance getProvenance (ProductID const &pid) const
Provenance getProvenance (BranchID const &bid) const
History const & history () const
EventID const & id () const
bool const isReal () const
LuminosityBlockNumber_t const & luminosityBlock () const
LuminosityBlockPrincipalluminosityBlockPrincipal ()
LuminosityBlockPrincipal const & luminosityBlockPrincipal () const
boost::shared_ptr
< LuminosityBlockPrincipal
luminosityBlockPrincipalSharedPtr ()
void put (std::auto_ptr< EDProduct > edp, ConstBranchDescription const &bd, std::auto_ptr< EventEntryInfo > entryInfo)
RunNumber_t run () const
RunPrincipalrunPrincipal ()
RunPrincipal const & runPrincipal () const
void setHistory (History const &h)
void setLuminosityBlockPrincipal (boost::shared_ptr< LuminosityBlockPrincipal > lbp)
void setUnscheduledHandler (boost::shared_ptr< UnscheduledHandler > iHandler)
int const storeNumber () const
Timestamp const & time () const
 ~EventPrincipal ()

Static Public Attributes

static int const invalidBunchXing = EventAuxiliary::invalidBunchXing
static int const invalidStoreNumber = EventAuxiliary::invalidStoreNumber

Private Member Functions

virtual void addOrReplaceGroup (std::auto_ptr< Group > g)
virtual void resolveProvenance (Group const &g) const
virtual bool unscheduledFill (std::string const &moduleLabel) const

Private Attributes

EventAuxiliary aux_
History eventHistory_
boost::shared_ptr
< LuminosityBlockPrincipal
luminosityBlockPrincipal_
std::vector< std::string > moduleLabelsRunning_
boost::shared_ptr
< UnscheduledHandler
unscheduledHandler_


Detailed Description

Definition at line 31 of file EventPrincipal.h.


Member Typedef Documentation

typedef EventAuxiliary edm::EventPrincipal::Auxiliary

Definition at line 33 of file EventPrincipal.h.

typedef Principal edm::EventPrincipal::Base

Definition at line 36 of file EventPrincipal.h.

typedef std::vector<EventEntryInfo> edm::EventPrincipal::EntryInfoVector

Definition at line 34 of file EventPrincipal.h.

typedef Base::SharedConstGroupPtr edm::EventPrincipal::SharedConstGroupPtr

Reimplemented from edm::Principal.

Definition at line 38 of file EventPrincipal.h.


Constructor & Destructor Documentation

edm::EventPrincipal::EventPrincipal ( EventAuxiliary const &  aux,
boost::shared_ptr< ProductRegistry const >  reg,
ProcessConfiguration const &  pc,
ProcessHistoryID const &  hist = ProcessHistoryID(),
boost::shared_ptr< BranchMapper mapper = boost::shared_ptr<BranchMapper>(new BranchMapper),
boost::shared_ptr< DelayedReader rtrv = boost::shared_ptr<DelayedReader>(new NoDelayedReader) 
)

Definition at line 12 of file EventPrincipal.cc.

00017                                              :
00018           Base(reg, pc, hist, mapper, rtrv),
00019           aux_(aux),
00020           luminosityBlockPrincipal_(),
00021           unscheduledHandler_(),
00022           moduleLabelsRunning_(),
00023           eventHistory_() {
00024           }

edm::EventPrincipal::~EventPrincipal (  )  [inline]

Definition at line 47 of file EventPrincipal.h.

00047 {}


Member Function Documentation

void edm::EventPrincipal::addGroup ( ConstBranchDescription const &  bd,
boost::shared_ptr< EventEntryInfo entryInfo 
)

Definition at line 93 of file EventPrincipal.cc.

References addOrReplaceGroup(), and g.

00094                                                     {
00095     std::auto_ptr<Group> g(new Group(bd, entryInfo));
00096     addOrReplaceGroup(g);
00097   }

void edm::EventPrincipal::addGroup ( std::auto_ptr< EDProduct prod,
ConstBranchDescription const &  bd,
boost::shared_ptr< EventEntryInfo entryInfo 
)

Definition at line 85 of file EventPrincipal.cc.

References addOrReplaceGroup(), and g.

00087                                                     {
00088     std::auto_ptr<Group> g(new Group(prod, bd, entryInfo));
00089     addOrReplaceGroup(g);
00090   }

void edm::EventPrincipal::addGroup ( ConstBranchDescription const &  bd,
std::auto_ptr< EventEntryInfo entryInfo 
)

Definition at line 78 of file EventPrincipal.cc.

References addOrReplaceGroup(), and g.

00079                                                 {
00080     std::auto_ptr<Group> g(new Group(bd, entryInfo));
00081     addOrReplaceGroup(g);
00082   }

void edm::EventPrincipal::addGroup ( std::auto_ptr< EDProduct prod,
ConstBranchDescription const &  bd,
std::auto_ptr< EventEntryInfo entryInfo 
)

Definition at line 70 of file EventPrincipal.cc.

References addOrReplaceGroup(), and g.

00072                                                 {
00073     std::auto_ptr<Group> g(new Group(prod, bd, entryInfo));
00074     addOrReplaceGroup(g);
00075   }

void edm::EventPrincipal::addGroup ( ConstBranchDescription const &  bd  ) 

Definition at line 64 of file EventPrincipal.cc.

References addOrReplaceGroup(), and g.

Referenced by put().

00064                                                            {
00065     std::auto_ptr<Group> g(new Group(bd));
00066     addOrReplaceGroup(g);
00067   }

void edm::EventPrincipal::addOnDemandGroup ( ConstBranchDescription const &  desc  ) 

Definition at line 37 of file EventPrincipal.cc.

References addOrReplaceGroup(), and g.

Referenced by edm::Schedule::setupOnDemandSystem().

00037                                                                      {
00038     std::auto_ptr<Group> g(new Group(desc, true));
00039     addOrReplaceGroup(g);
00040   }

void edm::EventPrincipal::addOrReplaceGroup ( std::auto_ptr< Group g  )  [private, virtual]

Implements edm::Principal.

Definition at line 43 of file EventPrincipal.cc.

References edm::Principal::addGroup_(), edm::ConstBranchDescription::friendlyClassName(), edm::Principal::getExistingGroup(), group, edm::errors::InsertFailure, edm::ConstBranchDescription::moduleLabel(), edm::Group::onDemand(), edm::ConstBranchDescription::processName(), edm::Group::productDescription(), edm::ConstBranchDescription::productInstanceName(), and edm::Principal::replaceGroup().

Referenced by addGroup(), and addOnDemandGroup().

00043                                                         {
00044     Group const* group = getExistingGroup(*g);
00045     if (group != 0) {
00046       if(!group->onDemand()) {
00047         ConstBranchDescription const& bd = group->productDescription();
00048         throw edm::Exception(edm::errors::InsertFailure,"AlreadyPresent")
00049           << "addGroup_: Problem found while adding product provenance, "
00050           << "product already exists for ("
00051           << bd.friendlyClassName() << ","
00052           << bd.moduleLabel() << ","
00053           << bd.productInstanceName() << ","
00054           << bd.processName()
00055           << ")\n";
00056       }
00057       replaceGroup(g);
00058     } else {
00059       addGroup_(g);
00060     }
00061   }

EventAuxiliary const& edm::EventPrincipal::aux (  )  const [inline]

Definition at line 90 of file EventPrincipal.h.

References aux_, edm::Principal::processHistoryID(), and edm::EventAuxiliary::processHistoryID_.

Referenced by bunchCrossing(), ExperimentType(), id(), isReal(), edm::isSameEvent(), luminosityBlock(), edm::StreamSerializer::serializeEvent(), storeNumber(), time(), and edm::RootOutputFile::writeOne().

00090                                       {
00091       aux_.processHistoryID_ = processHistoryID();
00092       return aux_;
00093     }

int const edm::EventPrincipal::bunchCrossing (  )  const [inline]

Definition at line 82 of file EventPrincipal.h.

References aux(), and edm::EventAuxiliary::bunchCrossing().

00082                                     {
00083       return aux().bunchCrossing();
00084     }

EventSelectionIDVector const & edm::EventPrincipal::eventSelectionIDs (  )  const

Definition at line 210 of file EventPrincipal.cc.

References eventHistory_, and edm::History::eventSelectionIDs().

00211   {
00212     return eventHistory_.eventSelectionIDs();
00213   }

EventAuxiliary::ExperimentType edm::EventPrincipal::ExperimentType (  )  const [inline]

Definition at line 78 of file EventPrincipal.h.

References aux(), and edm::EventAuxiliary::experimentType().

00078                                                         {
00079       return aux().experimentType();
00080     }

void edm::EventPrincipal::getAllProvenance ( std::vector< Provenance const * > &  provenances  )  const

Definition at line 183 of file EventPrincipal.cc.

References edm::Principal::begin(), edm::Principal::end(), i, and resolveProvenance().

Referenced by edm::AsciiOutputModule::write().

00183                                                                                    {
00184     provenances.clear();
00185     for (Base::const_iterator i = begin(), iEnd = end(); i != iEnd; ++i) {
00186       if (i->second->provenanceAvailable()) {
00187         resolveProvenance(*i->second);
00188         if (i->second->provenance()->branchEntryInfoSharedPtr() &&
00189             i->second->provenance()->isPresent() &&
00190             i->second->provenance()->product().present())
00191            provenances.push_back(i->second->provenance());
00192         }
00193     }
00194   }

BasicHandle edm::EventPrincipal::getByProductID ( ProductID const &  oid  )  const

Definition at line 121 of file EventPrincipal.cc.

References edm::Principal::branchMapperPtr(), g, edm::Principal::getGroup(), edm::ProductID::isValid(), and edm::errors::ProductNotFound.

Referenced by getIt().

00121                                                            {
00122     BranchID bid = branchMapperPtr()->productToBranch(oid);
00123     SharedConstGroupPtr const& g = getGroup(bid, true, true, true);
00124     if (g.get() == 0) {
00125       if (!oid.isValid()) {
00126         throw edm::Exception(edm::errors::ProductNotFound,"InvalidID")
00127           << "get by product ID: invalid ProductID supplied\n";
00128       }
00129       boost::shared_ptr<cms::Exception> whyFailed( new edm::Exception(edm::errors::ProductNotFound,"InvalidID") );
00130       *whyFailed
00131         << "get by product ID: no product with given id: "<< oid << "\n";
00132       return BasicHandle(whyFailed);
00133     }
00134 
00135     // Check for case where we tried on demand production and
00136     // it failed to produce the object
00137     if (g->onDemand()) {
00138       boost::shared_ptr<cms::Exception> whyFailed( new edm::Exception(edm::errors::ProductNotFound,"InvalidID") );
00139       *whyFailed
00140         << "get by product ID: no product with given id: " << oid << "\n"
00141         << "onDemand production failed to produce it.\n";
00142       return BasicHandle(whyFailed);
00143     }
00144     return BasicHandle(g->product(), g->provenance());
00145   }

EDProduct const * edm::EventPrincipal::getIt ( ProductID const &  oid  )  const [virtual]

Reimplemented from edm::Principal.

Definition at line 148 of file EventPrincipal.cc.

References getByProductID(), and edm::BasicHandle::wrapper().

Referenced by edm::StreamerInputSource::ProductGetter::getIt().

00148                                                   {
00149     return getByProductID(oid).wrapper();
00150   }

Provenance edm::EventPrincipal::getProvenance ( ProductID const &  pid  )  const

Definition at line 174 of file EventPrincipal.cc.

References edm::Principal::branchMapperPtr(), and getProvenance().

00174                                                           {
00175     BranchID bid = branchMapperPtr()->productToBranch(pid);
00176     return getProvenance(bid);
00177   }

Provenance edm::EventPrincipal::getProvenance ( BranchID const &  bid  )  const

Definition at line 153 of file EventPrincipal.cc.

References g, edm::Principal::getGroup(), edm::errors::ProductNotFound, and unscheduledFill().

Referenced by getProvenance().

00153                                                          {
00154     SharedConstGroupPtr const& g = getGroup(bid, false, true, true);
00155     if (g.get() == 0) {
00156       throw edm::Exception(edm::errors::ProductNotFound,"InvalidID")
00157         << "getProvenance: no product with given branch id: "<< bid << "\n";
00158     }
00159 
00160     if (g->onDemand()) {
00161       unscheduledFill(g->productDescription().moduleLabel());
00162     }
00163     // We already tried to produce the unscheduled products above
00164     // If they still are not there, then throw
00165     if (g->onDemand()) {
00166       throw edm::Exception(edm::errors::ProductNotFound)
00167         << "getProvenance: no product with given BranchID: "<< bid <<"\n";
00168     }
00169 
00170     return *g->provenance();
00171   }

History const & edm::EventPrincipal::history (  )  const

Definition at line 216 of file EventPrincipal.cc.

References eventHistory_.

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

00217   {
00218     return eventHistory_;
00219   }

EventID const& edm::EventPrincipal::id ( void   )  const [inline]

Definition at line 66 of file EventPrincipal.h.

References aux(), and edm::EventAuxiliary::id().

Referenced by edm::checkConsistency(), edm::NoDelayedReader::getProduct_(), edm::OccurrenceTraits< EventPrincipal, BranchActionBegin >::preScheduleSignal(), edm::EventProcessor::procOneEvent(), edm::Schedule::reportSkipped(), run(), edm::StreamerOutputModuleBase::serializeEvent(), edm::StreamSerializer::serializeEvent(), edm::AsciiOutputModule::write(), and edm::RootOutputFile::writeOne().

00066                               {
00067       return aux().id();
00068     }

bool const edm::EventPrincipal::isReal (  )  const [inline]

Definition at line 74 of file EventPrincipal.h.

References aux(), and edm::EventAuxiliary::isRealData().

00074                               {
00075       return aux().isRealData();
00076     }

LuminosityBlockNumber_t const& edm::EventPrincipal::luminosityBlock (  )  const [inline]

Definition at line 95 of file EventPrincipal.h.

References aux(), and edm::EventAuxiliary::luminosityBlock().

Referenced by edm::EventProcessor::procOneEvent(), and edm::StreamerOutputModuleBase::serializeEvent().

00095                                                            {
00096       return aux().luminosityBlock();
00097     }

LuminosityBlockPrincipal& edm::EventPrincipal::luminosityBlockPrincipal (  )  [inline]

Definition at line 53 of file EventPrincipal.h.

References luminosityBlockPrincipal_.

00053                                                           {
00054       return *luminosityBlockPrincipal_;
00055     }

LuminosityBlockPrincipal const& edm::EventPrincipal::luminosityBlockPrincipal (  )  const [inline]

Definition at line 49 of file EventPrincipal.h.

References luminosityBlockPrincipal_.

Referenced by edm::newLumi(), and runPrincipal().

00049                                                                      {
00050       return *luminosityBlockPrincipal_;
00051     }

boost::shared_ptr<LuminosityBlockPrincipal> edm::EventPrincipal::luminosityBlockPrincipalSharedPtr (  )  [inline]

Definition at line 58 of file EventPrincipal.h.

References luminosityBlockPrincipal_.

Referenced by edm::newLumi().

00058                                         {
00059       return luminosityBlockPrincipal_;
00060     }

void edm::EventPrincipal::put ( std::auto_ptr< EDProduct edp,
ConstBranchDescription const &  bd,
std::auto_ptr< EventEntryInfo entryInfo 
)

Definition at line 100 of file EventPrincipal.cc.

References addGroup(), edm::Principal::addToProcessHistory(), edm::Principal::branchMapperPtr(), and edm::errors::InsertFailure.

Referenced by edm::Event::commit_aux().

00102                                                        {
00103 
00104     if (edp.get() == 0) {
00105       throw edm::Exception(edm::errors::InsertFailure,"Null Pointer")
00106         << "put: Cannot put because auto_ptr to product is null."
00107         << "\n";
00108     }
00109     this->addToProcessHistory();
00110     // Group assumes ownership
00111     if (!entryInfo->productID().isValid()) {
00112       throw edm::Exception(edm::errors::InsertFailure,"Null Product ID")
00113         << "put: Cannot put product with null Product ID."
00114         << "\n";
00115     }
00116     branchMapperPtr()->insert(*entryInfo);
00117     this->addGroup(edp, bd, entryInfo);
00118   }

void edm::EventPrincipal::resolveProvenance ( Group const &  g  )  const [private, virtual]

Implements edm::Principal.

Definition at line 197 of file EventPrincipal.cc.

References edm::ConstBranchDescription::branchID(), edm::Principal::branchMapperPtr(), edm::Group::entryInfoPtr(), edm::Group::productDescription(), and edm::Group::setProvenance().

Referenced by getAllProvenance().

00197                                                         {
00198     if (!g.entryInfoPtr()) {
00199       // Now fix up the Group
00200       g.setProvenance(branchMapperPtr()->branchToEntryInfo(g.productDescription().branchID()));
00201     }
00202   }

RunNumber_t edm::EventPrincipal::run ( void   )  const [inline]

Definition at line 99 of file EventPrincipal.h.

References id(), and edm::EventID::run().

00099                             {
00100       return id().run();
00101     }

RunPrincipal & edm::EventPrincipal::runPrincipal (  ) 

Definition at line 32 of file EventPrincipal.cc.

References luminosityBlockPrincipal(), and edm::LuminosityBlockPrincipal::runPrincipal().

00032                                {
00033     return luminosityBlockPrincipal().runPrincipal();
00034   }

RunPrincipal const & edm::EventPrincipal::runPrincipal (  )  const

Definition at line 27 of file EventPrincipal.cc.

References luminosityBlockPrincipal(), and edm::LuminosityBlockPrincipal::runPrincipal().

00027                                      {
00028     return luminosityBlockPrincipal().runPrincipal();
00029   }

void edm::EventPrincipal::setHistory ( History const &  h  ) 

Definition at line 252 of file EventPrincipal.cc.

References eventHistory_.

00252                                              {
00253     eventHistory_ = h;
00254   }

void edm::EventPrincipal::setLuminosityBlockPrincipal ( boost::shared_ptr< LuminosityBlockPrincipal lbp  )  [inline]

Definition at line 62 of file EventPrincipal.h.

References luminosityBlockPrincipal_.

00062                                                                                     {
00063       luminosityBlockPrincipal_ = lbp;
00064     }

void edm::EventPrincipal::setUnscheduledHandler ( boost::shared_ptr< UnscheduledHandler iHandler  ) 

Definition at line 205 of file EventPrincipal.cc.

References unscheduledHandler_.

Referenced by edm::Schedule::setupOnDemandSystem().

00205                                                                                     {
00206     unscheduledHandler_ = iHandler;
00207   }

int const edm::EventPrincipal::storeNumber (  )  const [inline]

Definition at line 86 of file EventPrincipal.h.

References aux(), and edm::EventAuxiliary::storeNumber().

00086                                   {
00087       return aux().storeNumber();
00088     }

Timestamp const& edm::EventPrincipal::time (  )  const [inline]

Definition at line 70 of file EventPrincipal.h.

References aux(), and edm::EventAuxiliary::time().

Referenced by edm::OccurrenceTraits< EventPrincipal, BranchActionBegin >::preScheduleSignal(), edm::EventProcessor::procOneEvent(), and edm::AsciiOutputModule::write().

00070                                   {
00071       return aux().time();
00072     }

bool edm::EventPrincipal::unscheduledFill ( std::string const &  moduleLabel  )  const [private, virtual]

Implements edm::Principal.

Definition at line 222 of file EventPrincipal.cc.

References edm::find_in_all(), i, edm::errors::LogicError, moduleLabelsRunning_, and unscheduledHandler_.

Referenced by getProvenance().

00222                                                                     {
00223 
00224     // If it is a module already currently running in unscheduled
00225     // mode, then there is a circular dependency related to which
00226     // EDProducts modules require and produce.  There is no safe way
00227     // to recover from this.  Here we check for this problem and throw
00228     // an exception.
00229     std::vector<std::string>::const_iterator i =
00230       find_in_all(moduleLabelsRunning_, moduleLabel);
00231 
00232     if (i != moduleLabelsRunning_.end()) {
00233       throw edm::Exception(errors::LogicError)
00234         << "Hit circular dependency while trying to run an unscheduled module.\n"
00235         << "Current implementation of unscheduled execution cannot always determine\n"
00236         << "the proper order for module execution.  It is also possible the modules\n"
00237         << "have a built in circular dependence that will not work with any order.\n"
00238         << "In the first case, scheduling some or all required modules in paths will help.\n"
00239         << "In the second case, the modules themselves will have to be fixed.\n";
00240     }
00241 
00242     moduleLabelsRunning_.push_back(moduleLabel);
00243 
00244     if (unscheduledHandler_) {
00245       unscheduledHandler_->tryToFill(moduleLabel, *const_cast<EventPrincipal *>(this));
00246     }
00247     moduleLabelsRunning_.pop_back();
00248     return true;
00249   }


Member Data Documentation

EventAuxiliary edm::EventPrincipal::aux_ [private]

Definition at line 151 of file EventPrincipal.h.

Referenced by aux().

History edm::EventPrincipal::eventHistory_ [private]

Definition at line 159 of file EventPrincipal.h.

Referenced by eventSelectionIDs(), history(), and setHistory().

int const edm::EventPrincipal::invalidBunchXing = EventAuxiliary::invalidBunchXing [static]

Definition at line 39 of file EventPrincipal.h.

int const edm::EventPrincipal::invalidStoreNumber = EventAuxiliary::invalidStoreNumber [static]

Definition at line 40 of file EventPrincipal.h.

boost::shared_ptr<LuminosityBlockPrincipal> edm::EventPrincipal::luminosityBlockPrincipal_ [private]

Definition at line 152 of file EventPrincipal.h.

Referenced by luminosityBlockPrincipal(), luminosityBlockPrincipalSharedPtr(), and setLuminosityBlockPrincipal().

std::vector<std::string> edm::EventPrincipal::moduleLabelsRunning_ [mutable, private]

Definition at line 157 of file EventPrincipal.h.

Referenced by unscheduledFill().

boost::shared_ptr<UnscheduledHandler> edm::EventPrincipal::unscheduledHandler_ [private]

Definition at line 155 of file EventPrincipal.h.

Referenced by setUnscheduledHandler(), and unscheduledFill().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:40:54 2009 for CMSSW by  doxygen 1.5.4