CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
edm::EventPrincipal Class Reference

#include <EventPrincipal.h>

Inheritance diagram for edm::EventPrincipal:
edm::Principal edm::EDProductGetter

Public Types

typedef EventAuxiliary Auxiliary
 
typedef Principal Base
 
typedef Base::SharedConstGroupPtr SharedConstGroupPtr
 
- Public Types inherited from edm::Principal
typedef std::vector< BasicHandleBasicHandleVec
 
typedef boost::filter_iterator
< FilledGroupPtr,
GroupCollection::const_iterator > 
const_iterator
 
typedef std::vector
< boost::shared_ptr< Group > > 
GroupCollection
 
typedef std::string ProcessName
 
typedef
ProcessHistory::const_iterator 
ProcessNameConstIterator
 
typedef boost::shared_ptr
< Group const > 
SharedConstGroupPtr
 
typedef boost::shared_ptr< GroupSharedGroupPtr
 
typedef GroupCollection::size_type size_type
 

Public Member Functions

EventAuxiliary const & aux () const
 
ProductID branchIDToProductID (BranchID const &bid) const
 
BranchListIndexes const & branchListIndexes () const
 
int const bunchCrossing () const
 
void clearEventPrincipal ()
 
 EventPrincipal (boost::shared_ptr< ProductRegistry const > reg, ProcessConfiguration const &pc)
 
EventSelectionIDVector const & eventSelectionIDs () const
 
EventAuxiliary::ExperimentType ExperimentType () const
 
void fillEventPrincipal (std::auto_ptr< EventAuxiliary > aux, boost::shared_ptr< LuminosityBlockPrincipal > lbp, boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs=boost::shared_ptr< EventSelectionIDVector >(new EventSelectionIDVector), boost::shared_ptr< BranchListIndexes > branchListIndexes=boost::shared_ptr< BranchListIndexes >(new BranchListIndexes), boost::shared_ptr< BranchMapper > mapper=boost::shared_ptr< BranchMapper >(new BranchMapper), boost::shared_ptr< DelayedReader > rtrv=boost::shared_ptr< DelayedReader >(new NoDelayedReader))
 
BasicHandle getByProductID (ProductID const &oid) const
 
virtual EDProduct const * getIt (ProductID const &pid) const
 
Provenance getProvenance (ProductID const &pid) const
 
EventID const & id () const
 
bool const isReal () const
 
LuminosityBlockNumber_t luminosityBlock () const
 
LuminosityBlockPrincipal const & luminosityBlockPrincipal () const
 
LuminosityBlockPrincipalluminosityBlockPrincipal ()
 
void put (ConstBranchDescription const &bd, std::auto_ptr< EDProduct > edp, std::auto_ptr< ProductProvenance > productProvenance)
 
void putOnRead (ConstBranchDescription const &bd, std::auto_ptr< EDProduct > edp, std::auto_ptr< ProductProvenance > productProvenance)
 
RunNumber_t run () const
 
RunPrincipal const & runPrincipal () const
 
RunPrincipalrunPrincipal ()
 
void setUnscheduledHandler (boost::shared_ptr< UnscheduledHandler > iHandler)
 
int const storeNumber () const
 
Timestamp const & time () const
 
boost::shared_ptr
< UnscheduledHandler
unscheduledHandler () const
 
 ~EventPrincipal ()
 
- Public Member Functions inherited from edm::Principal
void addGroupInput (boost::shared_ptr< ConstBranchDescription > bd)
 
void addGroupScheduled (boost::shared_ptr< ConstBranchDescription > bd)
 
void addGroupSource (boost::shared_ptr< ConstBranchDescription > bd)
 
void addOnDemandGroup (boost::shared_ptr< ConstBranchDescription > bd)
 
void adjustIndexesAfterProductRegistryAddition ()
 
bool adjustToNewProductRegistry (ProductRegistry const &reg)
 
const_iterator begin () const
 
boost::shared_ptr< BranchMapperbranchMapperPtr () const
 
BranchType const & branchType () const
 
void clearPrincipal ()
 
const_iterator end () const
 
void fillPrincipal (ProcessHistoryID const &hist, boost::shared_ptr< BranchMapper > mapper, boost::shared_ptr< DelayedReader > rtrv)
 
void getAllProvenance (std::vector< Provenance const * > &provenances) const
 
BasicHandle getByLabel (TypeID const &tid, std::string const &label, std::string const &productInstanceName, std::string const &processName, size_t &cachedOffset, int &fillCount) const
 
BasicHandle getBySelector (TypeID const &tid, SelectorBase const &s) const
 
BasicHandle getByType (TypeID const &tid) const
 
OutputHandle getForOutput (BranchID const &bid, bool getProd) const
 
SharedConstGroupPtr const getGroup (BranchID const &oid, bool resolveProd, bool fillOnDemand) const
 
void getMany (TypeID const &tid, SelectorBase const &, BasicHandleVec &results) const
 
void getManyByType (TypeID const &tid, BasicHandleVec &results) const
 
size_t getMatchingSequence (TypeID const &typeID, SelectorBase const &selector, BasicHandle &result) const
 
Provenance getProvenance (BranchID const &bid) const
 
void maybeFlushCache (TypeID const &tid, InputTag const &tag) const
 
 Principal (boost::shared_ptr< ProductRegistry const > reg, ProcessConfiguration const &pc, BranchType bt)
 
ProcessConfiguration const & processConfiguration () const
 
ProcessHistory const & processHistory () const
 
ProcessHistoryID const & processHistoryID () const
 
EDProductGetter const * prodGetter () const
 
ProductRegistry const & productRegistry () const
 
void recombine (Principal &other, std::vector< BranchID > const &bids)
 
size_t size () const
 
boost::shared_ptr< DelayedReaderstore () const
 
virtual ~Principal ()
 
- Public Member Functions inherited from edm::EDProductGetter
 EDProductGetter ()
 
ProductID oldToNewProductID (ProductID const &oldProductID) const
 
virtual ~EDProductGetter ()
 

Static Public Attributes

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

Private Member Functions

virtual ProductID oldToNewProductID_ (ProductID const &oldProductID) const
 
BranchID pidToBid (ProductID const &pid) const
 
virtual void resolveProduct_ (Group const &g, bool fillOnDemand) const
 
virtual bool unscheduledFill (std::string const &moduleLabel) const
 

Private Attributes

boost::scoped_ptr< EventAuxiliaryaux_
 
boost::shared_ptr
< BranchListIndexes
branchListIndexes_
 
std::map< BranchListIndex,
ProcessIndex
branchListIndexToProcessIndex_
 
boost::shared_ptr
< EventSelectionIDVector
eventSelectionIDs_
 
boost::shared_ptr
< LuminosityBlockPrincipal
luminosityBlockPrincipal_
 
std::vector< std::string > moduleLabelsRunning_
 
boost::shared_ptr
< UnscheduledHandler
unscheduledHandler_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProductGetter
static void assignEDProductGetter (EDProductGetter const *&)
 
static EDProductGetter const * switchProductGetter (EDProductGetter const *)
 These can only be used internally by the framework. More...
 
- Protected Member Functions inherited from edm::Principal
void addGroup_ (std::auto_ptr< Group > g)
 
void addGroupOrThrow (std::auto_ptr< Group > g)
 
void checkUniquenessAndType (std::auto_ptr< EDProduct > &prod, Group const *group) const
 
GroupgetExistingGroup (BranchID const &branchID)
 
GroupgetExistingGroup (Group const &g)
 
SharedConstGroupPtr const getGroupByIndex (ProductTransientIndex const &oid, bool resolveProd, bool fillOnDemand) const
 
ProcessHistoryprocessHistoryUpdate ()
 
void putOrMerge (std::auto_ptr< EDProduct > prod, Group const *group) const
 
void putOrMerge (std::auto_ptr< EDProduct > prod, std::auto_ptr< ProductProvenance > prov, Group *group)
 
void resolveProduct (Group const &g, bool fillOnDemand) const
 
void setProcessHistory (Principal const &principal)
 
void swapBase (Principal &)
 

Detailed Description

Definition at line 36 of file EventPrincipal.h.

Member Typedef Documentation

Definition at line 38 of file EventPrincipal.h.

Definition at line 39 of file EventPrincipal.h.

Definition at line 41 of file EventPrincipal.h.

Constructor & Destructor Documentation

edm::EventPrincipal::EventPrincipal ( boost::shared_ptr< ProductRegistry const >  reg,
ProcessConfiguration const &  pc 
)

Definition at line 19 of file EventPrincipal.cc.

21  :
22  Base(reg, pc, InEvent),
23  aux_(),
boost::shared_ptr< LuminosityBlockPrincipal > luminosityBlockPrincipal_
std::map< BranchListIndex, ProcessIndex > branchListIndexToProcessIndex_
boost::scoped_ptr< EventAuxiliary > aux_
boost::shared_ptr< UnscheduledHandler > unscheduledHandler_
boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs_
boost::shared_ptr< BranchListIndexes > branchListIndexes_
std::vector< std::string > moduleLabelsRunning_
edm::EventPrincipal::~EventPrincipal ( )
inline

Definition at line 47 of file EventPrincipal.h.

47 {}

Member Function Documentation

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

Definition at line 90 of file EventPrincipal.h.

References aux_.

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

90  {
91  return *aux_;
92  }
boost::scoped_ptr< EventAuxiliary > aux_
ProductID edm::EventPrincipal::branchIDToProductID ( BranchID const &  bid) const

Definition at line 161 of file EventPrincipal.cc.

References branchListIndexToProcessIndex_, edm::hlt::Exception, edm::detail::ThreadSafeIndexedRegistry< T, E >::extra(), i, edm::detail::ThreadSafeIndexedRegistry< T, E >::instance(), edm::BranchID::isValid(), and edm::errors::NotFound.

Referenced by fillEventPrincipal(), edm::Event::makeProductID(), and oldToNewProductID_().

161  {
162  if(!bid.isValid()) {
163  throw Exception(errors::NotFound, "InvalidID")
164  << "branchIDToProductID: invalid BranchID supplied\n";
165  }
166  typedef BranchIDListHelper::BranchIDToIndexMap BIDToIndexMap;
167  typedef BIDToIndexMap::const_iterator Iter;
168  typedef std::pair<Iter, Iter> IndexRange;
169 
170  BIDToIndexMap const& branchIDToIndexMap = BranchIDListRegistry::instance()->extra().branchIDToIndexMap();
171  IndexRange range = branchIDToIndexMap.equal_range(bid);
172  for(Iter it = range.first; it != range.second; ++it) {
173  BranchListIndex blix = it->second.first;
174  std::map<BranchListIndex, ProcessIndex>::const_iterator i = branchListIndexToProcessIndex_.find(blix);
175  if(i != branchListIndexToProcessIndex_.end()) {
176  ProductIndex productIndex = it->second.second;
177  ProcessIndex processIndex = i->second;
178  return ProductID(processIndex+1, productIndex+1);
179  }
180  }
181  // cannot throw, because some products may legitimately not have product ID's (e.g. pile-up).
182  return ProductID();
183  }
int i
Definition: DBlmapReader.cc:9
unsigned short BranchListIndex
std::map< BranchListIndex, ProcessIndex > branchListIndexToProcessIndex_
std::multimap< BranchID, IndexPair > BranchIDToIndexMap
unsigned short ProcessIndex
Definition: ProductID.h:25
static ThreadSafeIndexedRegistry * instance()
unsigned short ProductIndex
Definition: ProductID.h:26
BranchListIndexes const & edm::EventPrincipal::branchListIndexes ( ) const

Definition at line 235 of file EventPrincipal.cc.

References branchListIndexes_.

Referenced by fillEventPrincipal(), edm::StreamSerializer::serializeEvent(), and edm::RootOutputFile::writeOne().

235  {
236  return *branchListIndexes_;
237  }
boost::shared_ptr< BranchListIndexes > branchListIndexes_
int const edm::EventPrincipal::bunchCrossing ( ) const
inline

Definition at line 82 of file EventPrincipal.h.

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

82  {
83  return aux().bunchCrossing();
84  }
int bunchCrossing() const
EventAuxiliary const & aux() const
void edm::EventPrincipal::clearEventPrincipal ( )

Definition at line 32 of file EventPrincipal.cc.

References aux_, branchListIndexes_, branchListIndexToProcessIndex_, edm::Principal::clearPrincipal(), eventSelectionIDs_, luminosityBlockPrincipal_, moduleLabelsRunning_, and unscheduledHandler_.

Referenced by edm::EventProcessor::readAndProcessEvent().

32  {
34  aux_.reset();
36  unscheduledHandler_.reset();
37  moduleLabelsRunning_.clear();
38  eventSelectionIDs_.reset();
39  branchListIndexes_.reset();
41  }
void clearPrincipal()
Definition: Principal.cc:125
boost::shared_ptr< LuminosityBlockPrincipal > luminosityBlockPrincipal_
std::map< BranchListIndex, ProcessIndex > branchListIndexToProcessIndex_
boost::scoped_ptr< EventAuxiliary > aux_
boost::shared_ptr< UnscheduledHandler > unscheduledHandler_
boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs_
boost::shared_ptr< BranchListIndexes > branchListIndexes_
std::vector< std::string > moduleLabelsRunning_
EventSelectionIDVector const & edm::EventPrincipal::eventSelectionIDs ( ) const

Definition at line 230 of file EventPrincipal.cc.

References eventSelectionIDs_.

Referenced by edm::Event::eventSelectionIDs(), fillEventPrincipal(), edm::StreamSerializer::serializeEvent(), and edm::RootOutputFile::writeOne().

230  {
231  return *eventSelectionIDs_;
232  }
boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs_
EventAuxiliary::ExperimentType edm::EventPrincipal::ExperimentType ( ) const
inline

Definition at line 78 of file EventPrincipal.h.

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

78  {
79  return aux().experimentType();
80  }
ExperimentType experimentType() const
EventAuxiliary const & aux() const
void edm::EventPrincipal::fillEventPrincipal ( std::auto_ptr< EventAuxiliary aux,
boost::shared_ptr< LuminosityBlockPrincipal lbp,
boost::shared_ptr< EventSelectionIDVector eventSelectionIDs = boost::shared_ptr<EventSelectionIDVector>(new EventSelectionIDVector),
boost::shared_ptr< BranchListIndexes branchListIndexes = boost::shared_ptr<BranchListIndexes>(new BranchListIndexes),
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 44 of file EventPrincipal.cc.

References aux_, edm::Principal::begin(), branchIDToProductID(), branchListIndexes(), branchListIndexes_, branchListIndexToProcessIndex_, edm::Principal::end(), eventSelectionIDs(), eventSelectionIDs_, edm::Principal::fillPrincipal(), edm::BranchIDListHelper::fixBranchListIndexes(), edm::InEvent, luminosityBlockPrincipal_, edm::Principal::processHistoryID(), edm::Principal::productRegistry(), and edm::Principal::setProcessHistory().

Referenced by edm::StreamerInputSource::deserializeEvent(), edm::DaqSource::getNextItemType(), edm::RawInputSource::makeEvent(), edm::RootFile::readCurrentEvent(), edm::ConfigurableInputSource::reallyReadEvent(), and edm::SubProcess::write().

49  {
50  fillPrincipal(aux->processHistoryID(), mapper, rtrv);
51  aux_.reset(aux.release());
55 
58  aux_->setProcessHistoryID(processHistoryID());
59  }
60 
61  mapper->processHistoryID() = processHistoryID();
63 
64  if(productRegistry().productProduced(InEvent)) {
65  // Add index into BranchIDListRegistry for products produced this process
66  branchListIndexes_->push_back(productRegistry().producedBranchListIndex());
67  }
68 
69  // Fill in helper map for Branch to ProductID mapping
70  for(BranchListIndexes::const_iterator
71  it = branchListIndexes_->begin(),
72  itEnd = branchListIndexes_->end();
73  it != itEnd; ++it) {
74  ProcessIndex pix = it - branchListIndexes_->begin();
75  branchListIndexToProcessIndex_.insert(std::make_pair(*it, pix));
76  }
77  // Fill in the product ID's in the groups.
78  for(const_iterator it = this->begin(), itEnd = this->end(); it != itEnd; ++it) {
79  (*it)->setProvenance(mapper, branchIDToProductID((*it)->branchDescription().branchID()));
80  }
81  }
ProductRegistry const & productRegistry() const
Definition: Principal.h:122
EventSelectionIDVector const & eventSelectionIDs() const
boost::shared_ptr< LuminosityBlockPrincipal > luminosityBlockPrincipal_
const_iterator end() const
Definition: Principal.h:131
std::map< BranchListIndex, ProcessIndex > branchListIndexToProcessIndex_
BranchListIndexes const & branchListIndexes() const
ProductID branchIDToProductID(BranchID const &bid) const
static void fixBranchListIndexes(BranchListIndexes &indexes)
boost::scoped_ptr< EventAuxiliary > aux_
ProcessHistoryID const & processHistoryID() const
Definition: Principal.h:116
void setProcessHistory(Principal const &principal)
Definition: Principal.cc:201
void fillPrincipal(ProcessHistoryID const &hist, boost::shared_ptr< BranchMapper > mapper, boost::shared_ptr< DelayedReader > rtrv)
Definition: Principal.cc:138
boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs_
unsigned short ProcessIndex
Definition: ProductID.h:25
boost::shared_ptr< BranchListIndexes > branchListIndexes_
const_iterator begin() const
Definition: Principal.h:130
ProcessHistoryID const & processHistoryID() const
boost::filter_iterator< FilledGroupPtr, GroupCollection::const_iterator > const_iterator
Definition: Principal.h:48
EventAuxiliary const & aux() const
BasicHandle edm::EventPrincipal::getByProductID ( ProductID const &  oid) const

Definition at line 186 of file EventPrincipal.cc.

References edm::hlt::Exception, g, edm::Principal::getGroup(), pidToBid(), and edm::errors::ProductNotFound.

Referenced by edm::Event::getByProductID_(), and getIt().

186  {
187  BranchID bid = pidToBid(pid);
188  SharedConstGroupPtr const& g = getGroup(bid, true, true);
189  if(g.get() == 0) {
190  boost::shared_ptr<cms::Exception> whyFailed(new Exception(errors::ProductNotFound, "InvalidID"));
191  *whyFailed
192  << "get by product ID: no product with given id: " << pid << "\n";
193  return BasicHandle(whyFailed);
194  }
195 
196  // Check for case where we tried on demand production and
197  // it failed to produce the object
198  if(g->onDemand()) {
199  boost::shared_ptr<cms::Exception> whyFailed(new Exception(errors::ProductNotFound, "InvalidID"));
200  *whyFailed
201  << "get by product ID: no product with given id: " << pid << "\n"
202  << "onDemand production failed to produce it.\n";
203  return BasicHandle(whyFailed);
204  }
205  return BasicHandle(g->product(), g->provenance());
206  }
BranchID pidToBid(ProductID const &pid) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
Base::SharedConstGroupPtr SharedConstGroupPtr
SharedConstGroupPtr const getGroup(BranchID const &oid, bool resolveProd, bool fillOnDemand) const
Definition: Principal.cc:207
EDProduct const * edm::EventPrincipal::getIt ( ProductID const &  pid) const
virtual

Reimplemented from edm::Principal.

Definition at line 209 of file EventPrincipal.cc.

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

209  {
210  return getByProductID(pid).wrapper();
211  }
BasicHandle getByProductID(ProductID const &oid) const
EDProduct const * wrapper() const
Definition: BasicHandle.h:87
Provenance edm::EventPrincipal::getProvenance ( ProductID const &  pid) const

Definition at line 214 of file EventPrincipal.cc.

References pidToBid().

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

214  {
215  BranchID bid = pidToBid(pid);
216  return getProvenance(bid);
217  }
BranchID pidToBid(ProductID const &pid) const
Provenance getProvenance(ProductID const &pid) const
EventID const& edm::EventPrincipal::id ( void  ) const
inline
bool const edm::EventPrincipal::isReal ( ) const
inline

Definition at line 74 of file EventPrincipal.h.

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

74  {
75  return aux().isRealData();
76  }
bool isRealData() const
EventAuxiliary const & aux() const
LuminosityBlockNumber_t edm::EventPrincipal::luminosityBlock ( ) const
inline

Definition at line 94 of file EventPrincipal.h.

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

Referenced by Types.EventID::cppID(), Types.LuminosityBlockID::cppID(), edm::InputSource::readEvent(), edm::PoolSource::readEvent_(), and edm::StreamerOutputModuleBase::serializeEvent().

94  {
95  return id().luminosityBlock();
96  }
EventID const & id() const
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:43
LuminosityBlockPrincipal const& edm::EventPrincipal::luminosityBlockPrincipal ( ) const
inline

Definition at line 58 of file EventPrincipal.h.

References luminosityBlockPrincipal_.

Referenced by runPrincipal().

58  {
60  }
boost::shared_ptr< LuminosityBlockPrincipal > luminosityBlockPrincipal_
LuminosityBlockPrincipal& edm::EventPrincipal::luminosityBlockPrincipal ( )
inline

Definition at line 62 of file EventPrincipal.h.

References luminosityBlockPrincipal_.

62  {
64  }
boost::shared_ptr< LuminosityBlockPrincipal > luminosityBlockPrincipal_
ProductID edm::EventPrincipal::oldToNewProductID_ ( ProductID const &  oldProductID) const
privatevirtual

Reimplemented from edm::EDProductGetter.

Definition at line 270 of file EventPrincipal.cc.

References branchIDToProductID(), edm::Principal::branchMapperPtr(), and edm::BranchID::isValid().

270  {
271  BranchID bid = branchMapperPtr()->oldProductIDToBranchID(oldProductID);
272  if(!bid.isValid()) return oldProductID;
273  return branchIDToProductID(bid);
274  }
ProductID branchIDToProductID(BranchID const &bid) const
boost::shared_ptr< BranchMapper > branchMapperPtr() const
Definition: Principal.h:139
BranchID edm::EventPrincipal::pidToBid ( ProductID const &  pid) const
private

Definition at line 152 of file EventPrincipal.cc.

References branchListIndexes_, runTheMatrix::data, edm::hlt::Exception, edm::detail::ThreadSafeIndexedRegistry< T, E >::instance(), edm::ProductID::isValid(), edm::productIDToBranchID(), and edm::errors::ProductNotFound.

Referenced by getByProductID(), and getProvenance().

152  {
153  if(!pid.isValid()) {
154  throw Exception(errors::ProductNotFound, "InvalidID")
155  << "get by product ID: invalid ProductID supplied\n";
156  }
158  }
BranchID productIDToBranchID(ProductID const &pid, BranchIDLists const &lists, BranchListIndexes const &indexes)
boost::shared_ptr< BranchListIndexes > branchListIndexes_
static ThreadSafeIndexedRegistry * instance()
void edm::EventPrincipal::put ( ConstBranchDescription const &  bd,
std::auto_ptr< EDProduct edp,
std::auto_ptr< ProductProvenance productProvenance 
)

Definition at line 94 of file EventPrincipal.cc.

References edm::ConstBranchDescription::branchID(), edm::Principal::branchMapperPtr(), edm::Principal::checkUniquenessAndType(), edm::hlt::Exception, g, edm::Principal::getExistingGroup(), edm::errors::InsertFailure, edm::ConstBranchDescription::produced(), and edm::Group::putProduct().

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

97  {
98 
99  assert(bd.produced());
100  if(edp.get() == 0) {
101  throw Exception(errors::InsertFailure, "Null Pointer")
102  << "put: Cannot put because auto_ptr to product is null."
103  << "\n";
104  }
105  branchMapperPtr()->insert(*productProvenance);
106  Group *g = getExistingGroup(bd.branchID());
107  assert(g);
108  checkUniquenessAndType(edp, g);
109  // Group assumes ownership
110  g->putProduct(edp, productProvenance);
111  }
Group * getExistingGroup(BranchID const &branchID)
Definition: Principal.cc:155
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
void checkUniquenessAndType(std::auto_ptr< EDProduct > &prod, Group const *group) const
Definition: Principal.cc:608
boost::shared_ptr< BranchMapper > branchMapperPtr() const
Definition: Principal.h:139
void edm::EventPrincipal::putOnRead ( ConstBranchDescription const &  bd,
std::auto_ptr< EDProduct edp,
std::auto_ptr< ProductProvenance productProvenance 
)

Definition at line 114 of file EventPrincipal.cc.

References edm::ConstBranchDescription::branchID(), edm::Principal::branchMapperPtr(), edm::Principal::checkUniquenessAndType(), g, edm::Principal::getExistingGroup(), edm::ConstBranchDescription::produced(), and edm::Group::putProduct().

Referenced by edm::StreamerInputSource::deserializeEvent().

117  {
118 
119  assert(!bd.produced());
120  branchMapperPtr()->insert(*productProvenance);
121  Group *g = getExistingGroup(bd.branchID());
122  assert(g);
123  checkUniquenessAndType(edp, g);
124  // Group assumes ownership
125  g->putProduct(edp, productProvenance);
126  }
Group * getExistingGroup(BranchID const &branchID)
Definition: Principal.cc:155
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
void checkUniquenessAndType(std::auto_ptr< EDProduct > &prod, Group const *group) const
Definition: Principal.cc:608
boost::shared_ptr< BranchMapper > branchMapperPtr() const
Definition: Principal.h:139
void edm::EventPrincipal::resolveProduct_ ( Group const &  g,
bool  fillOnDemand 
) const
privatevirtual

Reimplemented from edm::Principal.

Definition at line 129 of file EventPrincipal.cc.

References edm::Group::branchDescription(), edm::Principal::checkUniquenessAndType(), edm::getProduct(), edm::ConstBranchDescription::moduleLabel(), edm::Group::onDemand(), edm::ConstBranchDescription::produced(), edm::Group::product(), edm::Group::productUnavailable(), edm::Group::putProduct(), edm::Principal::store(), and unscheduledFill().

129  {
130  // Try unscheduled production.
131  if(g.onDemand()) {
132  if(fillOnDemand) {
133  unscheduledFill(g.branchDescription().moduleLabel());
134  }
135  return;
136  }
137 
138  if(g.branchDescription().produced()) return; // nothing to do.
139  if(g.product()) return; // nothing to do.
140  if(g.productUnavailable()) return; // nothing to do.
141 
142  // must attempt to load from persistent store
143  BranchKey const bk = BranchKey(g.branchDescription());
144  std::auto_ptr<EDProduct> edp(store()->getProduct(bk, this));
145 
146  // Now fix up the Group
147  checkUniquenessAndType(edp, &g);
148  g.putProduct(edp);
149  }
boost::shared_ptr< DelayedReader > store() const
Definition: Principal.h:141
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
void checkUniquenessAndType(std::auto_ptr< EDProduct > &prod, Group const *group) const
Definition: Principal.cc:608
T const * getProduct(RefCore const &ref)
Definition: RefCoreGet.h:37
virtual bool unscheduledFill(std::string const &moduleLabel) const
RunNumber_t edm::EventPrincipal::run ( void  ) const
inline

Definition at line 98 of file EventPrincipal.h.

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

Referenced by Types.LuminosityBlockID::cppID(), edm::InputSource::readEvent(), and edm::PoolSource::readEvent_().

98  {
99  return id().run();
100  }
RunNumber_t run() const
Definition: EventID.h:42
EventID const & id() const
RunPrincipal const & edm::EventPrincipal::runPrincipal ( ) const

Definition at line 84 of file EventPrincipal.cc.

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

84  {
86  }
RunPrincipal const & runPrincipal() const
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
RunPrincipal & edm::EventPrincipal::runPrincipal ( )

Definition at line 89 of file EventPrincipal.cc.

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

89  {
91  }
RunPrincipal const & runPrincipal() const
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
void edm::EventPrincipal::setUnscheduledHandler ( boost::shared_ptr< UnscheduledHandler iHandler)

Definition at line 220 of file EventPrincipal.cc.

References unscheduledHandler_.

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

220  {
221  unscheduledHandler_ = iHandler;
222  }
boost::shared_ptr< UnscheduledHandler > unscheduledHandler_
int const edm::EventPrincipal::storeNumber ( ) const
inline

Definition at line 86 of file EventPrincipal.h.

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

86  {
87  return aux().storeNumber();
88  }
int storeNumber() const
EventAuxiliary const & aux() const
Timestamp const& edm::EventPrincipal::time ( ) const
inline
bool edm::EventPrincipal::unscheduledFill ( std::string const &  moduleLabel) const
privatevirtual

Implements edm::Principal.

Definition at line 240 of file EventPrincipal.cc.

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

Referenced by resolveProduct_().

240  {
241 
242  // If it is a module already currently running in unscheduled
243  // mode, then there is a circular dependency related to which
244  // EDProducts modules require and produce. There is no safe way
245  // to recover from this. Here we check for this problem and throw
246  // an exception.
247  std::vector<std::string>::const_iterator i =
249 
250  if(i != moduleLabelsRunning_.end()) {
252  << "Hit circular dependency while trying to run an unscheduled module.\n"
253  << "Current implementation of unscheduled execution cannot always determine\n"
254  << "the proper order for module execution. It is also possible the modules\n"
255  << "have a built in circular dependence that will not work with any order.\n"
256  << "In the first case, scheduling some or all required modules in paths will help.\n"
257  << "In the second case, the modules themselves will have to be fixed.\n";
258  }
259 
261 
262  if(unscheduledHandler_) {
263  unscheduledHandler_->tryToFill(moduleLabel, *const_cast<EventPrincipal *>(this));
264  }
265  moduleLabelsRunning_.pop_back();
266  return true;
267  }
int i
Definition: DBlmapReader.cc:9
boost::shared_ptr< UnscheduledHandler > unscheduledHandler_
ForwardSequence::const_iterator find_in_all(ForwardSequence const &s, Datum const &d)
wrappers for std::find
Definition: Algorithms.h:32
std::vector< std::string > moduleLabelsRunning_
const std::string * moduleLabel() const
Definition: HLTadd.h:40
boost::shared_ptr< UnscheduledHandler > edm::EventPrincipal::unscheduledHandler ( ) const

Definition at line 225 of file EventPrincipal.cc.

References unscheduledHandler_.

Referenced by edm::WorkerT< T >::implDoBegin().

225  {
226  return unscheduledHandler_;
227  }
boost::shared_ptr< UnscheduledHandler > unscheduledHandler_

Member Data Documentation

boost::scoped_ptr<EventAuxiliary> edm::EventPrincipal::aux_
private

Definition at line 147 of file EventPrincipal.h.

Referenced by aux(), clearEventPrincipal(), and fillEventPrincipal().

boost::shared_ptr<BranchListIndexes> edm::EventPrincipal::branchListIndexes_
private
std::map<BranchListIndex, ProcessIndex> edm::EventPrincipal::branchListIndexToProcessIndex_
private

Definition at line 160 of file EventPrincipal.h.

Referenced by branchIDToProductID(), clearEventPrincipal(), and fillEventPrincipal().

boost::shared_ptr<EventSelectionIDVector> edm::EventPrincipal::eventSelectionIDs_
private

Definition at line 156 of file EventPrincipal.h.

Referenced by clearEventPrincipal(), eventSelectionIDs(), and fillEventPrincipal().

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

Definition at line 42 of file EventPrincipal.h.

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

Definition at line 43 of file EventPrincipal.h.

boost::shared_ptr<LuminosityBlockPrincipal> edm::EventPrincipal::luminosityBlockPrincipal_
private
std::vector<std::string> edm::EventPrincipal::moduleLabelsRunning_
mutableprivate

Definition at line 154 of file EventPrincipal.h.

Referenced by clearEventPrincipal(), and unscheduledFill().

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