CMS 3D CMS Logo

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::ConstProductResolverPtr ConstProductResolverPtr
 
- Public Types inherited from edm::Principal
typedef std::vector< BasicHandleBasicHandleVec
 
typedef unsigned long CacheIdentifier_t
 
typedef boost::filter_iterator< FilledProductPtr, ProductResolverCollection::const_iterator > const_iterator
 
typedef ProductResolverBase const * ConstProductResolverPtr
 
typedef boost::filter_iterator< FilledProductPtr, ProductResolverCollection::iterator > iterator
 
typedef std::string ProcessName
 
typedef ProcessHistory::const_iterator ProcessNameConstIterator
 
typedef std::vector< propagate_const< std::shared_ptr< ProductResolverBase > > > ProductResolverCollection
 
typedef std::shared_ptr< ProductResolverBaseSharedProductPtr
 
typedef ProductResolverCollection::size_type size_type
 

Public Member Functions

EventAuxiliary const & aux () const
 
ProductID branchIDToProductID (BranchID const &bid) const
 
BranchListIndexes const & branchListIndexes () const
 
int bunchCrossing () const
 
void clearEventPrincipal ()
 
 EventPrincipal (std::shared_ptr< ProductRegistry const > reg, std::shared_ptr< BranchIDListHelper const > branchIDListHelper, std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper, ProcessConfiguration const &pc, HistoryAppender *historyAppender, unsigned int streamIndex=0, bool isForPrimaryProcess=true)
 
EventSelectionIDVector const & eventSelectionIDs () const
 
EventAuxiliary::ExperimentType ExperimentType () const
 
void fillEventPrincipal (EventAuxiliary const &aux, ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
 
void fillEventPrincipal (EventAuxiliary const &aux, ProcessHistoryRegistry const &processHistoryRegistry, EventSelectionIDVector &&eventSelectionIDs, BranchListIndexes &&branchListIndexes)
 
void fillEventPrincipal (EventAuxiliary const &aux, ProcessHistoryRegistry const &processHistoryRegistry, EventSelectionIDVector &&eventSelectionIDs, BranchListIndexes &&branchListIndexes, ProductProvenanceRetriever const &provRetriever, DelayedReader *reader=0, bool deepCopyRetriever=true)
 
BasicHandle getByProductID (ProductID const &oid) const
 
virtual WrapperBase const * getIt (ProductID const &pid) const override
 
Provenance getProvenance (ProductID const &pid, ModuleCallingContext const *mcc) const
 
virtual WrapperBase const * getThinnedProduct (ProductID const &pid, unsigned int &key) const override
 
virtual void getThinnedProducts (ProductID const &pid, std::vector< WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys) const override
 
EventID const & id () const
 
bool isReal () const
 
LuminosityBlockNumber_t luminosityBlock () const
 
LuminosityBlockPrincipal const & luminosityBlockPrincipal () const
 
LuminosityBlockPrincipalluminosityBlockPrincipal ()
 
bool luminosityBlockPrincipalPtrValid () const
 
void mergeProvenanceRetrievers (EventPrincipal &other)
 
ProductProvenanceRetriever const * productProvenanceRetrieverPtr () const
 
void put (BranchDescription const &bd, std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance) const
 
void putOnRead (BranchDescription const &bd, std::unique_ptr< WrapperBase > edp, ProductProvenance const *productProvenance) const
 
RunNumber_t run () const
 
RunPrincipal const & runPrincipal () const
 
void setLuminosityBlockPrincipal (std::shared_ptr< LuminosityBlockPrincipal > const &lbp)
 
void setRunAndLumiNumber (RunNumber_t run, LuminosityBlockNumber_t lumi)
 
int storeNumber () const
 
StreamID streamID () const
 
Timestamp const & time () const
 
 ~EventPrincipal ()
 
- Public Member Functions inherited from edm::Principal
void adjustIndexesAfterProductRegistryAddition ()
 
bool adjustToNewProductRegistry (ProductRegistry const &reg)
 
bool atEndTransition () const
 
const_iterator begin () const
 
iterator begin ()
 
BranchType const & branchType () const
 
CacheIdentifier_t cacheIdentifier () const
 
void clearPrincipal ()
 
void deleteProduct (BranchID const &id) const
 
const_iterator end () const
 
iterator end ()
 
void fillPrincipal (ProcessHistoryID const &hist, ProcessHistoryRegistry const &phr, DelayedReader *reader)
 
ProductData const * findProductByTag (TypeID const &typeID, InputTag const &tag, ModuleCallingContext const *mcc) const
 
void getAllProvenance (std::vector< Provenance const * > &provenances) const
 
void getAllStableProvenance (std::vector< StableProvenance const * > &provenances) const
 
BasicHandle getByLabel (KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumes, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
BasicHandle getByLabel (KindOfType kindOfType, TypeID const &typeID, std::string const &label, std::string const &instance, std::string const &process, EDConsumerBase const *consumes, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
BasicHandle getByToken (KindOfType kindOfType, TypeID const &typeID, ProductResolverIndex index, bool skipCurrentProcess, bool &ambiguous, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
void getManyByType (TypeID const &typeID, BasicHandleVec &results, EDConsumerBase const *consumes, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
ProductResolverBasegetModifiableProductResolver (BranchID const &oid)
 
ConstProductResolverPtr getProductResolver (BranchID const &oid) const
 
ConstProductResolverPtr getProductResolverByIndex (ProductResolverIndex const &oid) const
 
Provenance getProvenance (BranchID const &bid, ModuleCallingContext const *mcc) const
 
bool isComplete () const
 
std::vector< unsigned int > const & lookupProcessOrder () const
 
void prefetchAsync (WaitingTask *waitTask, ProductResolverIndex index, bool skipCurrentProcess, ModuleCallingContext const *mcc) const
 
 Principal (std::shared_ptr< ProductRegistry const > reg, std::shared_ptr< ProductResolverIndexHelper const > productLookup, ProcessConfiguration const &pc, BranchType bt, HistoryAppender *historyAppender, bool isForPrimaryProcess=true)
 
ProcessConfiguration const & processConfiguration () const
 
ProcessHistory const & processHistory () const
 
ProcessHistoryID const & processHistoryID () const
 
EDProductGetter const * prodGetter () const
 
ProductResolverIndexHelper const & productLookup () const
 
ProductRegistry const & productRegistry () const
 
void readAllFromSourceAndMergeImmediately ()
 
DelayedReaderreader () const
 
void recombine (Principal &other, std::vector< BranchID > const &bids)
 
void resetFailedFromThisProcess ()
 
void setAtEndTransition (bool iAtEnd)
 
void setupUnscheduled (UnscheduledConfigurator const &)
 
size_t size () const
 
virtual ~Principal ()
 
- Public Member Functions inherited from edm::EDProductGetter
 EDProductGetter ()
 
 EDProductGetter (EDProductGetter const &)=delete
 
EDProductGetter const & operator= (EDProductGetter const &)=delete
 
unsigned int transitionIndex () const
 
virtual ~EDProductGetter ()
 

Static Public Attributes

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

Private Member Functions

edm::ThinnedAssociation const * getThinnedAssociation (edm::BranchID const &branchID) const
 
BranchID pidToBid (ProductID const &pid) const
 
std::shared_ptr< ProductProvenanceRetriever const > provRetrieverPtr () const
 
std::shared_ptr< ProductProvenanceRetriever > & provRetrieverPtr ()
 
virtual unsigned int transitionIndex_ () const override
 

Private Attributes

EventAuxiliary aux_
 
std::shared_ptr< BranchIDListHelper const > branchIDListHelper_
 
BranchListIndexes branchListIndexes_
 
std::map< BranchListIndex, ProcessIndexbranchListIndexToProcessIndex_
 
EventSelectionIDVector eventSelectionIDs_
 
edm::propagate_const< std::shared_ptr< LuminosityBlockPrincipal > > luminosityBlockPrincipal_
 
edm::propagate_const< std::shared_ptr< ProductProvenanceRetriever > > provRetrieverPtr_
 
StreamID streamID_
 
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper_
 

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 addProduct_ (std::unique_ptr< ProductResolverBase > phb)
 
void addProductOrThrow (std::unique_ptr< ProductResolverBase > phb)
 
template<typename F >
void applyToResolvers (F iFunc)
 
ProductResolverBasegetExistingProduct (BranchID const &branchID)
 
ProductResolverBase const * getExistingProduct (BranchID const &branchID) const
 
ProductResolverBase const * getExistingProduct (ProductResolverBase const &phb) const
 
void putOrMerge (BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
 

Detailed Description

Definition at line 46 of file EventPrincipal.h.

Member Typedef Documentation

Definition at line 48 of file EventPrincipal.h.

Definition at line 49 of file EventPrincipal.h.

Definition at line 51 of file EventPrincipal.h.

Constructor & Destructor Documentation

edm::EventPrincipal::EventPrincipal ( std::shared_ptr< ProductRegistry const >  reg,
std::shared_ptr< BranchIDListHelper const >  branchIDListHelper,
std::shared_ptr< ThinnedAssociationsHelper const >  thinnedAssociationsHelper,
ProcessConfiguration const &  pc,
HistoryAppender historyAppender,
unsigned int  streamIndex = 0,
bool  isForPrimaryProcess = true 
)

Definition at line 30 of file EventPrincipal.cc.

References thinnedAssociationsHelper_.

37  :
38  Base(reg, reg->productLookup(InEvent), pc, InEvent, historyAppender,isForPrimaryProcess),
39  aux_(),
41  provRetrieverPtr_(new ProductProvenanceRetriever(streamIndex)),
43  branchIDListHelper_(branchIDListHelper),
44  thinnedAssociationsHelper_(thinnedAssociationsHelper),
47  streamID_(streamIndex) {
49  }
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper_
EventSelectionIDVector eventSelectionIDs_
BranchListIndexes branchListIndexes_
std::map< BranchListIndex, ProcessIndex > branchListIndexToProcessIndex_
std::shared_ptr< BranchIDListHelper const > branchIDListHelper_
EventAuxiliary aux_
edm::propagate_const< std::shared_ptr< ProductProvenanceRetriever > > provRetrieverPtr_
edm::propagate_const< std::shared_ptr< LuminosityBlockPrincipal > > luminosityBlockPrincipal_
edm::EventPrincipal::~EventPrincipal ( )
inline

Member Function Documentation

EventAuxiliary const& edm::EventPrincipal::aux ( ) const
inline
ProductID edm::EventPrincipal::branchIDToProductID ( BranchID const &  bid) const

Definition at line 201 of file EventPrincipal.cc.

References branchIDListHelper_, branchListIndexToProcessIndex_, Exception, mps_fire::i, edm::BranchID::isValid(), and edm::errors::NotFound.

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

201  {
202  if(!bid.isValid()) {
203  throw Exception(errors::NotFound, "InvalidID")
204  << "branchIDToProductID: invalid BranchID supplied\n";
205  }
206  typedef BranchIDListHelper::BranchIDToIndexMap BIDToIndexMap;
207  typedef BIDToIndexMap::const_iterator Iter;
208  typedef std::pair<Iter, Iter> IndexRange;
209 
210  IndexRange range = branchIDListHelper_->branchIDToIndexMap().equal_range(bid);
211  for(Iter it = range.first; it != range.second; ++it) {
212  BranchListIndex blix = it->second.first;
213  std::map<BranchListIndex, ProcessIndex>::const_iterator i = branchListIndexToProcessIndex_.find(blix);
214  if(i != branchListIndexToProcessIndex_.end()) {
215  ProductIndex productIndex = it->second.second;
216  ProcessIndex processIndex = i->second;
217  return ProductID(processIndex+1, productIndex+1);
218  }
219  }
220  // cannot throw, because some products may legitimately not have product ID's (e.g. pile-up).
221  return ProductID();
222  }
unsigned short BranchListIndex
std::map< BranchListIndex, ProcessIndex > branchListIndexToProcessIndex_
std::shared_ptr< BranchIDListHelper const > branchIDListHelper_
std::multimap< BranchID, IndexPair > BranchIDToIndexMap
unsigned short ProcessIndex
Definition: ProductID.h:25
unsigned short ProductIndex
Definition: ProductID.h:26
BranchListIndexes const & edm::EventPrincipal::branchListIndexes ( ) const
int edm::EventPrincipal::bunchCrossing ( ) const
inline

Definition at line 115 of file EventPrincipal.h.

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

115  {
116  return aux().bunchCrossing();
117  }
int bunchCrossing() const
EventAuxiliary const & aux() const
void edm::EventPrincipal::clearEventPrincipal ( )

Definition at line 52 of file EventPrincipal.cc.

References aux_, branchListIndexToProcessIndex_, edm::Principal::clearPrincipal(), luminosityBlockPrincipal_, and provRetrieverPtr_.

Referenced by edm::VectorInputSource::clearEventPrincipal(), edm::SubProcess::processAsync(), and ~EventPrincipal().

52  {
54  aux_ = EventAuxiliary();
55  luminosityBlockPrincipal_ = nullptr; // propagate_const<T> has no reset() function
56  provRetrieverPtr_->reset();
58  }
void clearPrincipal()
Definition: Principal.cc:313
std::map< BranchListIndex, ProcessIndex > branchListIndexToProcessIndex_
EventAuxiliary aux_
edm::propagate_const< std::shared_ptr< ProductProvenanceRetriever > > provRetrieverPtr_
edm::propagate_const< std::shared_ptr< LuminosityBlockPrincipal > > luminosityBlockPrincipal_
EventSelectionIDVector const & edm::EventPrincipal::eventSelectionIDs ( ) const
EventAuxiliary::ExperimentType edm::EventPrincipal::ExperimentType ( ) const
inline

Definition at line 111 of file EventPrincipal.h.

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

111  {
112  return aux().experimentType();
113  }
ExperimentType experimentType() const
EventAuxiliary const & aux() const
void edm::EventPrincipal::fillEventPrincipal ( EventAuxiliary const &  aux,
ProcessHistoryRegistry const &  processHistoryRegistry,
DelayedReader reader = 0 
)

Definition at line 97 of file EventPrincipal.cc.

References aux(), aux_, branchIDListHelper_, branchIDToProductID(), branchListIndexes_, branchListIndexToProcessIndex_, edm::EventAuxiliary::event(), Exception, edm::Principal::fillPrincipal(), edm::invalidEventNumber, edm::errors::LogicError, edm::Principal::processHistory(), edm::EventAuxiliary::processHistoryID(), edm::Principal::processHistoryID(), parseEventContent::prod, productProvenanceRetrieverPtr(), edm::Principal::reader(), and edm::EventAuxiliary::setProcessHistoryID().

Referenced by fillEventPrincipal(), edm::RawInputSource::makeEvent(), edm::SubProcess::processAsync(), edm::StreamerInputSource::read(), edm::RootFile::readCurrentEvent(), LHESource::readEvent_(), edm::ProducerSourceBase::readEvent_(), and ~EventPrincipal().

99  {
100  if(aux.event() == invalidEventNumber) {
102  << "EventPrincipal::fillEventPrincipal, Invalid event number provided in EventAuxiliary, It is illegal for the event number to be 0\n";
103  }
104 
105  fillPrincipal(aux.processHistoryID(), processHistoryRegistry, reader);
106  aux_ = aux;
108 
109  if(branchListIndexes_.empty() and branchIDListHelper_->hasProducedProducts()) {
110  // Add index into BranchIDListRegistry for products produced this process
111  // if it hasn't already been filled in by the other fillEventPrincipal or by an earlier call to this function
112  branchListIndexes_.push_back(branchIDListHelper_->producedBranchListIndex());
113  }
114 
115  // Fill in helper map for Branch to ProductID mapping
116  ProcessIndex pix = 0;
117  for(auto const& blindex : branchListIndexes_) {
118  branchListIndexToProcessIndex_.insert(std::make_pair(blindex, pix));
119  ++pix;
120  }
121 
122  // Fill in the product ID's in the product holders.
123  for(auto& prod : *this) {
124  if (prod->singleProduct()) {
125  // If an alias is in the same process as the original then isAlias will be true.
126  // Under that condition, we want the ProductID to be the same as the original.
127  // If not, then we've internally changed the original BranchID to the alias BranchID
128  // in the ProductID lookup so we need the alias BranchID.
129  auto const & bd =prod->branchDescription();
130  prod->setProvenance(productProvenanceRetrieverPtr(),
131  processHistory(),
132  branchIDToProductID(bd.isAlias()?bd.originalBranchID(): bd.branchID()));
133  }
134  }
135  }
BranchListIndexes branchListIndexes_
std::map< BranchListIndex, ProcessIndex > branchListIndexToProcessIndex_
std::shared_ptr< BranchIDListHelper const > branchIDListHelper_
EventAuxiliary aux_
ProcessHistory const & processHistory() const
Definition: Principal.h:141
ProductID branchIDToProductID(BranchID const &bid) const
EventNumber_t const invalidEventNumber
ProcessHistoryID const & processHistoryID() const
Definition: Principal.h:145
ProductProvenanceRetriever const * productProvenanceRetrieverPtr() const
unsigned short ProcessIndex
Definition: ProductID.h:25
DelayedReader * reader() const
Definition: Principal.h:184
void setProcessHistoryID(ProcessHistoryID const &phid)
ProcessHistoryID const & processHistoryID() const
void fillPrincipal(ProcessHistoryID const &hist, ProcessHistoryRegistry const &phr, DelayedReader *reader)
Definition: Principal.cc:344
EventAuxiliary const & aux() const
EventNumber_t event() const
void edm::EventPrincipal::fillEventPrincipal ( EventAuxiliary const &  aux,
ProcessHistoryRegistry const &  processHistoryRegistry,
EventSelectionIDVector &&  eventSelectionIDs,
BranchListIndexes &&  branchListIndexes 
)

Definition at line 83 of file EventPrincipal.cc.

References branchIDListHelper_, branchListIndexes(), branchListIndexes_, eventSelectionIDs(), eventSelectionIDs_, and fillEventPrincipal().

86  {
89  if(branchIDListHelper_->hasProducedProducts()) {
90  // Add index into BranchIDListRegistry for products produced this process
91  branchListIndexes_.push_back(branchIDListHelper_->producedBranchListIndex());
92  }
93  fillEventPrincipal(aux,processHistoryRegistry,nullptr);
94  }
EventSelectionIDVector const & eventSelectionIDs() const
EventSelectionIDVector eventSelectionIDs_
BranchListIndexes branchListIndexes_
std::shared_ptr< BranchIDListHelper const > branchIDListHelper_
BranchListIndexes const & branchListIndexes() const
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
EventAuxiliary const & aux() const
void edm::EventPrincipal::fillEventPrincipal ( EventAuxiliary const &  aux,
ProcessHistoryRegistry const &  processHistoryRegistry,
EventSelectionIDVector &&  eventSelectionIDs,
BranchListIndexes &&  branchListIndexes,
ProductProvenanceRetriever const &  provRetriever,
DelayedReader reader = 0,
bool  deepCopyRetriever = true 
)

Definition at line 61 of file EventPrincipal.cc.

References branchIDListHelper_, branchListIndexes(), branchListIndexes_, eventSelectionIDs(), eventSelectionIDs_, fillEventPrincipal(), and provRetrieverPtr_.

67  {
69  if (deepCopyRetriever) {
70  provRetrieverPtr_->deepCopy(provRetriever);
71  } else {
72  provRetrieverPtr_->mergeParentProcessRetriever(provRetriever);
73  }
75  if(branchIDListHelper_->hasProducedProducts()) {
76  // Add index into BranchIDListRegistry for products produced this process
77  branchListIndexes_.push_back(branchIDListHelper_->producedBranchListIndex());
78  }
79  fillEventPrincipal(aux,processHistoryRegistry,reader);
80  }
EventSelectionIDVector const & eventSelectionIDs() const
EventSelectionIDVector eventSelectionIDs_
BranchListIndexes branchListIndexes_
std::shared_ptr< BranchIDListHelper const > branchIDListHelper_
edm::propagate_const< std::shared_ptr< ProductProvenanceRetriever > > provRetrieverPtr_
BranchListIndexes const & branchListIndexes() const
DelayedReader * reader() const
Definition: Principal.h:184
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
EventAuxiliary const & aux() const
BasicHandle edm::EventPrincipal::getByProductID ( ProductID const &  oid) const

Definition at line 240 of file EventPrincipal.cc.

References data, edm::Principal::getProductResolver(), edm::makeHandleExceptionFactory(), pidToBid(), edm::errors::ProductNotFound, fftjetproducer_cfi::resolution, and edm::throwProductDeletedException().

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

240  {
241  BranchID bid = pidToBid(pid);
243  if(phb == nullptr) {
244  return BasicHandle(makeHandleExceptionFactory([pid]()->std::shared_ptr<cms::Exception> {
245  std::shared_ptr<cms::Exception> whyFailed(std::make_shared<Exception>(errors::ProductNotFound, "InvalidID"));
246  *whyFailed
247  << "get by product ID: no product with given id: " << pid << "\n";
248  return whyFailed;
249  }));
250  }
251 
252  // Was this already deleted?
253  if(phb->productWasDeleted()) {
255  }
256  // Check for case where we tried on demand production and
257  // it failed to produce the object
258  if(phb->unscheduledWasNotRun()) {
259  return BasicHandle(makeHandleExceptionFactory([pid]()->std::shared_ptr<cms::Exception> {
260  std::shared_ptr<cms::Exception> whyFailed(std::make_shared<Exception>(errors::ProductNotFound, "InvalidID"));
261  *whyFailed
262  << "get by ProductID: could not get product with id: " << pid << "\n"
263  << "Unscheduled execution not allowed to get via ProductID.\n";
264  return whyFailed;
265  }));
266  }
267  auto resolution = phb->resolveProduct(*this,false,nullptr,nullptr);
268 
269  auto data = resolution.data();
270  if(data) {
271  return BasicHandle(data->wrapper(), &(data->provenance()));
272  }
273  return BasicHandle(nullptr,nullptr);
274  }
BranchID pidToBid(ProductID const &pid) const
static void throwProductDeletedException(ProductID const &pid, edm::EventPrincipal::ConstProductResolverPtr const phb)
std::shared_ptr< HandleExceptionFactory > makeHandleExceptionFactory(T &&iFunctor)
Base::ConstProductResolverPtr ConstProductResolverPtr
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
ConstProductResolverPtr getProductResolver(BranchID const &oid) const
Definition: Principal.cc:481
WrapperBase const * edm::EventPrincipal::getIt ( ProductID const &  pid) const
overridevirtual

Reimplemented from edm::Principal.

Definition at line 277 of file EventPrincipal.cc.

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

Referenced by edm::StreamerInputSource::EventPrincipalHolder::getIt(), and productProvenanceRetrieverPtr().

277  {
278  return getByProductID(pid).wrapper();
279  }
BasicHandle getByProductID(ProductID const &oid) const
WrapperBase const * wrapper() const
Definition: BasicHandle.h:90
Provenance edm::EventPrincipal::getProvenance ( ProductID const &  pid,
ModuleCallingContext const *  mcc 
) const

Definition at line 388 of file EventPrincipal.cc.

References pidToBid().

Referenced by edm::Event::getProvenance(), and productProvenanceRetrieverPtr().

388  {
389  BranchID bid = pidToBid(pid);
390  return getProvenance(bid, mcc);
391  }
BranchID pidToBid(ProductID const &pid) const
Provenance getProvenance(ProductID const &pid, ModuleCallingContext const *mcc) const
edm::ThinnedAssociation const * edm::EventPrincipal::getThinnedAssociation ( edm::BranchID const &  branchID) const
private

Definition at line 404 of file EventPrincipal.cc.

References data, edm::WrapperBase::dynamicTypeInfo(), Exception, edm::Principal::getProductResolver(), edm::errors::LogicError, edm::Wrapper< T >::product(), edm::ProductData::wrapper(), and wrapper.

Referenced by getThinnedProduct(), getThinnedProducts(), and mergeProvenanceRetrievers().

404  {
405 
406  ConstProductResolverPtr const phb = getProductResolver(branchID);
407 
408  if(phb == nullptr) {
410  << "EventPrincipal::getThinnedAssociation, ThinnedAssociation ProductResolver cannot be found\n"
411  << "This should never happen. Contact a Framework developer";
412  }
413  ProductData const* productData = (phb->resolveProduct(*this,false,nullptr,nullptr)).data();
414  if (productData == nullptr) {
415  return nullptr;
416  }
417  WrapperBase const* product = productData->wrapper();
418  if(!(typeid(edm::ThinnedAssociation) == product->dynamicTypeInfo())) {
420  << "EventPrincipal::getThinnedProduct, product has wrong type, not a ThinnedAssociation.\n";
421  }
422  Wrapper<ThinnedAssociation> const* wrapper = static_cast<Wrapper<ThinnedAssociation> const*>(product);
423  return wrapper->product();
424  }
Base::ConstProductResolverPtr ConstProductResolverPtr
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
ConstProductResolverPtr getProductResolver(BranchID const &oid) const
Definition: Principal.cc:481
static HepMC::HEPEVT_Wrapper wrapper
WrapperBase const * edm::EventPrincipal::getThinnedProduct ( ProductID const &  pid,
unsigned int &  key 
) const
overridevirtual

Reimplemented from edm::Principal.

Definition at line 282 of file EventPrincipal.cc.

References getByProductID(), getThinnedAssociation(), edm::ThinnedAssociation::hasParentIndex(), edm::BasicHandle::isValid(), class-composition::parent, edm::ThinnedAssociation::parentCollectionID(), pidToBid(), thinnedAssociationsHelper_, edm::ThinnedAssociation::thinnedCollectionID(), and edm::BasicHandle::wrapper().

Referenced by edm::StreamerInputSource::EventPrincipalHolder::getThinnedProduct(), and productProvenanceRetrieverPtr().

282  {
283 
284  BranchID parent = pidToBid(pid);
285 
286  // Loop over thinned containers which were made by selecting elements from the parent container
287  for(auto associatedBranches = thinnedAssociationsHelper_->parentBegin(parent),
288  iEnd = thinnedAssociationsHelper_->parentEnd(parent);
289  associatedBranches != iEnd; ++associatedBranches) {
290 
291  ThinnedAssociation const* thinnedAssociation =
292  getThinnedAssociation(associatedBranches->association());
293  if(thinnedAssociation == nullptr) continue;
294 
295  if(associatedBranches->parent() != pidToBid(thinnedAssociation->parentCollectionID())) {
296  continue;
297  }
298 
299  unsigned int thinnedIndex = 0;
300  // Does this thinned container have the element referenced by key?
301  // If yes, thinnedIndex is set to point to it in the thinned container
302  if(!thinnedAssociation->hasParentIndex(key, thinnedIndex)) {
303  continue;
304  }
305  // Get the thinned container and return a pointer if we can find it
306  ProductID const& thinnedCollectionPID = thinnedAssociation->thinnedCollectionID();
307  BasicHandle bhThinned = getByProductID(thinnedCollectionPID);
308  if(!bhThinned.isValid()) {
309  // Thinned container is not found, try looking recursively in thinned containers
310  // which were made by selecting elements from this thinned container.
311  WrapperBase const* wrapperBase = getThinnedProduct(thinnedCollectionPID, thinnedIndex);
312  if(wrapperBase != nullptr) {
313  key = thinnedIndex;
314  return wrapperBase;
315  } else {
316  continue;
317  }
318  }
319  key = thinnedIndex;
320  return bhThinned.wrapper();
321  }
322  return nullptr;
323  }
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper_
virtual WrapperBase const * getThinnedProduct(ProductID const &pid, unsigned int &key) const override
BasicHandle getByProductID(ProductID const &oid) const
BranchID pidToBid(ProductID const &pid) const
edm::ThinnedAssociation const * getThinnedAssociation(edm::BranchID const &branchID) const
ProductID const & thinnedCollectionID() const
void edm::EventPrincipal::getThinnedProducts ( ProductID const &  pid,
std::vector< WrapperBase const * > &  foundContainers,
std::vector< unsigned int > &  keys 
) const
overridevirtual

Reimplemented from edm::Principal.

Definition at line 326 of file EventPrincipal.cc.

References getByProductID(), getThinnedAssociation(), edm::ThinnedAssociation::hasParentIndex(), edm::BasicHandle::isValid(), gen::k, hpstanc_transforms::max, class-composition::parent, edm::ThinnedAssociation::parentCollectionID(), pidToBid(), thinnedAssociationsHelper_, edm::ThinnedAssociation::thinnedCollectionID(), and edm::BasicHandle::wrapper().

Referenced by edm::StreamerInputSource::EventPrincipalHolder::getThinnedProducts(), and productProvenanceRetrieverPtr().

328  {
329 
330  BranchID parent = pidToBid(pid);
331 
332  // Loop over thinned containers which were made by selecting elements from the parent container
333  for(auto associatedBranches = thinnedAssociationsHelper_->parentBegin(parent),
334  iEnd = thinnedAssociationsHelper_->parentEnd(parent);
335  associatedBranches != iEnd; ++associatedBranches) {
336 
337  ThinnedAssociation const* thinnedAssociation =
338  getThinnedAssociation(associatedBranches->association());
339  if(thinnedAssociation == nullptr) continue;
340 
341  if(associatedBranches->parent() != pidToBid(thinnedAssociation->parentCollectionID())) {
342  continue;
343  }
344 
345  unsigned nKeys = keys.size();
346  unsigned int doNotLookForThisIndex = std::numeric_limits<unsigned int>::max();
347  std::vector<unsigned int> thinnedIndexes(nKeys, doNotLookForThisIndex);
348  bool hasAny = false;
349  for(unsigned k = 0; k < nKeys; ++k) {
350  // Already found this one
351  if(foundContainers[k] != nullptr) continue;
352  // Already know this one is not in this thinned container
353  if(keys[k] == doNotLookForThisIndex) continue;
354  // Does the thinned container hold the entry of interest?
355  // Modifies thinnedIndexes[k] only if it returns true and
356  // sets it to the index in the thinned collection.
357  if(thinnedAssociation->hasParentIndex(keys[k], thinnedIndexes[k])) {
358  hasAny = true;
359  }
360  }
361  if(!hasAny) {
362  continue;
363  }
364  // Get the thinned container and set the pointers and indexes into
365  // it (if we can find it)
366  ProductID thinnedCollectionPID = thinnedAssociation->thinnedCollectionID();
367  BasicHandle bhThinned = getByProductID(thinnedCollectionPID);
368  if(!bhThinned.isValid()) {
369  // Thinned container is not found, try looking recursively in thinned containers
370  // which were made by selecting elements from this thinned container.
371  getThinnedProducts(thinnedCollectionPID, foundContainers, thinnedIndexes);
372  for(unsigned k = 0; k < nKeys; ++k) {
373  if(foundContainers[k] == nullptr) continue;
374  if(thinnedIndexes[k] == doNotLookForThisIndex) continue;
375  keys[k] = thinnedIndexes[k];
376  }
377  } else {
378  for(unsigned k = 0; k < nKeys; ++k) {
379  if(thinnedIndexes[k] == doNotLookForThisIndex) continue;
380  keys[k] = thinnedIndexes[k];
381  foundContainers[k] = bhThinned.wrapper();
382  }
383  }
384  }
385  }
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper_
BasicHandle getByProductID(ProductID const &oid) const
BranchID pidToBid(ProductID const &pid) const
edm::ThinnedAssociation const * getThinnedAssociation(edm::BranchID const &branchID) const
virtual void getThinnedProducts(ProductID const &pid, std::vector< WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys) const override
int k[5][pyjets_maxn]
EventID const& edm::EventPrincipal::id ( void  ) const
inline

Definition at line 99 of file EventPrincipal.h.

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

Referenced by edm::DataMixingEcalDigiWorkerProd::addEcalPileups(), edm::DataMixingEMWorker::addEMPileups(), edm::DataMixingEMDigiWorker::addEMPileups(), edm::DataMixingGeneralTrackWorker::addGeneralTrackPileups(), edm::DataMixingHcalWorker::addHcalPileups(), edm::DataMixingHcalDigiWorker::addHcalPileups(), edm::DataMixingHcalDigiWorkerProd::addHcalPileups(), edm::DataMixingMuonWorker::addMuonPileups(), sistrip::SpyEventMatcher::addNextEventToMap(), edm::DataMixingPileupCopy::addPileupInfo(), edm::DataMixingSiPixelWorker::addSiPixelPileups(), edm::DataMixingSiPixelMCDigiWorker::addSiPixelPileups(), edm::DataMixingSiStripWorker::addSiStripPileups(), edm::DataMixingSiStripRawWorker::addSiStripPileups(), edm::DataMixingSiStripMCDigiWorker::addSiStripPileups(), edm::DataMixingTrackingParticleWorker::addTrackingParticlePileups(), edm::EDLooperBase::doDuringLoop(), edm::StreamSchedule::finishedPaths(), edm::SecSourceAnalyzer::getBranches(), luminosityBlock(), edm::RecordEventID< T >::operator()(), edm::MixingModule::pileAllWorkers(), edm::DataMixingModule::pileWorker(), edm::InputSource::readEvent(), edm::PoolSource::readEvent_(), edm::StreamSchedule::reportSkipped(), run(), edm::OccurrenceTraits< EventPrincipal, BranchActionStreamBegin >::setStreamContext(), and edm::Path::workerFinished().

99  {
100  return aux().id();
101  }
EventID const & id() const
EventAuxiliary const & aux() const
bool edm::EventPrincipal::isReal ( ) const
inline

Definition at line 107 of file EventPrincipal.h.

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

107  {
108  return aux().isRealData();
109  }
bool isRealData() const
EventAuxiliary const & aux() const
LuminosityBlockNumber_t edm::EventPrincipal::luminosityBlock ( ) const
inline

Definition at line 129 of file EventPrincipal.h.

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

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

129  {
130  return id().luminosityBlock();
131  }
EventID const & id() const
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
LuminosityBlockPrincipal const& edm::EventPrincipal::luminosityBlockPrincipal ( ) const
inline

Definition at line 83 of file EventPrincipal.h.

References luminosityBlockPrincipal_.

Referenced by edm::EDLooperBase::doDuringLoop(), and runPrincipal().

83  {
85  }
edm::propagate_const< std::shared_ptr< LuminosityBlockPrincipal > > luminosityBlockPrincipal_
LuminosityBlockPrincipal& edm::EventPrincipal::luminosityBlockPrincipal ( )
inline

Definition at line 87 of file EventPrincipal.h.

References luminosityBlockPrincipal_.

87  {
89  }
edm::propagate_const< std::shared_ptr< LuminosityBlockPrincipal > > luminosityBlockPrincipal_
bool edm::EventPrincipal::luminosityBlockPrincipalPtrValid ( ) const
inline

Definition at line 91 of file EventPrincipal.h.

References luminosityBlockPrincipal_, run(), setLuminosityBlockPrincipal(), and setRunAndLumiNumber().

91  {
92  return (luminosityBlockPrincipal_) ? true : false;
93  }
edm::propagate_const< std::shared_ptr< LuminosityBlockPrincipal > > luminosityBlockPrincipal_
void edm::EventPrincipal::mergeProvenanceRetrievers ( EventPrincipal other)
inline

Definition at line 169 of file EventPrincipal.h.

References edm::Principal::getProvenance(), getThinnedAssociation(), pidToBid(), provRetrieverPtr(), provRetrieverPtr_, and transitionIndex_().

Referenced by edm::PoolSource::readEvent_().

169  {
170  provRetrieverPtr_->mergeProvenanceRetrievers(other.provRetrieverPtr());
171  }
edm::propagate_const< std::shared_ptr< ProductProvenanceRetriever > > provRetrieverPtr_
BranchID edm::EventPrincipal::pidToBid ( ProductID const &  pid) const
private

Definition at line 192 of file EventPrincipal.cc.

References branchIDListHelper_, branchListIndexes_, Exception, edm::ProductID::isValid(), edm::productIDToBranchID(), and edm::errors::ProductNotFound.

Referenced by getByProductID(), getProvenance(), getThinnedProduct(), getThinnedProducts(), and mergeProvenanceRetrievers().

192  {
193  if(!pid.isValid()) {
194  throw Exception(errors::ProductNotFound, "InvalidID")
195  << "get by product ID: invalid ProductID supplied\n";
196  }
198  }
BranchListIndexes branchListIndexes_
std::shared_ptr< BranchIDListHelper const > branchIDListHelper_
BranchID productIDToBranchID(ProductID const &pid, BranchIDLists const &lists, BranchListIndexes const &indexes)
ProductProvenanceRetriever const* edm::EventPrincipal::productProvenanceRetrieverPtr ( ) const
inline
std::shared_ptr<ProductProvenanceRetriever const> edm::EventPrincipal::provRetrieverPtr ( ) const
inlineprivate

Definition at line 183 of file EventPrincipal.h.

References edm::get_underlying_safe(), and provRetrieverPtr_.

Referenced by mergeProvenanceRetrievers().

edm::propagate_const< std::shared_ptr< ProductProvenanceRetriever > > provRetrieverPtr_
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
std::shared_ptr<ProductProvenanceRetriever>& edm::EventPrincipal::provRetrieverPtr ( )
inlineprivate

Definition at line 184 of file EventPrincipal.h.

References edm::get_underlying_safe(), and provRetrieverPtr_.

edm::propagate_const< std::shared_ptr< ProductProvenanceRetriever > > provRetrieverPtr_
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
void edm::EventPrincipal::put ( BranchDescription const &  bd,
std::unique_ptr< WrapperBase edp,
ProductProvenance const &  productProvenance 
) const

Definition at line 156 of file EventPrincipal.cc.

References edm::BranchDescription::branchID(), Exception, edm::Principal::getExistingProduct(), edm::errors::InsertFailure, edm::ProductProvenanceRetriever::insertIntoSet(), eostools::move(), and productProvenanceRetrieverPtr().

Referenced by productProvenanceRetrieverPtr(), FedRawDataInputSource::read(), and LHESource::readEvent_().

159  {
160 
161  // assert commented out for DaqSource. When DaqSource no longer uses put(), the assert can be restored.
162  //assert(produced());
163  if(edp.get() == nullptr) {
164  throw Exception(errors::InsertFailure, "Null Pointer")
165  << "put: Cannot put because ptr to product is null."
166  << "\n";
167  }
168  productProvenanceRetrieverPtr()->insertIntoSet(productProvenance);
169  auto phb = getExistingProduct(bd.branchID());
170  assert(phb);
171  // ProductResolver assumes ownership
172  phb->putProduct(std::move(edp));
173  }
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:421
ProductProvenanceRetriever const * productProvenanceRetrieverPtr() const
def move(src, dest)
Definition: eostools.py:510
void insertIntoSet(ProductProvenance const &provenanceProduct) const
void edm::EventPrincipal::putOnRead ( BranchDescription const &  bd,
std::unique_ptr< WrapperBase edp,
ProductProvenance const *  productProvenance 
) const

Definition at line 176 of file EventPrincipal.cc.

References edm::BranchDescription::branchID(), edm::Principal::getExistingProduct(), edm::ProductProvenanceRetriever::insertIntoSet(), eostools::move(), edm::BranchDescription::produced(), and productProvenanceRetrieverPtr().

Referenced by productProvenanceRetrieverPtr(), and edm::StreamerInputSource::read().

179  {
180 
181  assert(!bd.produced());
182  if (productProvenance) {
183  productProvenanceRetrieverPtr()->insertIntoSet(*productProvenance);
184  }
185  auto phb = getExistingProduct(bd.branchID());
186  assert(phb);
187  // ProductResolver assumes ownership
188  phb->putProduct(std::move(edp));
189  }
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:421
ProductProvenanceRetriever const * productProvenanceRetrieverPtr() const
def move(src, dest)
Definition: eostools.py:510
void insertIntoSet(ProductProvenance const &provenanceProduct) const
RunNumber_t edm::EventPrincipal::run ( void  ) const
inline

Definition at line 133 of file EventPrincipal.h.

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

Referenced by Types.EventID::cppID(), Types.LuminosityBlockID::cppID(), luminosityBlockPrincipalPtrValid(), and edm::PoolSource::readEvent_().

133  {
134  return id().run();
135  }
RunNumber_t run() const
Definition: EventID.h:39
EventID const & id() const
RunPrincipal const & edm::EventPrincipal::runPrincipal ( ) const

Definition at line 151 of file EventPrincipal.cc.

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

Referenced by run().

151  {
153  }
RunPrincipal const & runPrincipal() const
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
void edm::EventPrincipal::setLuminosityBlockPrincipal ( std::shared_ptr< LuminosityBlockPrincipal > const &  lbp)

Definition at line 138 of file EventPrincipal.cc.

References luminosityBlockPrincipal_.

Referenced by luminosityBlockPrincipalPtrValid(), and edm::SubProcess::processAsync().

138  {
140  }
edm::propagate_const< std::shared_ptr< LuminosityBlockPrincipal > > luminosityBlockPrincipal_
void edm::EventPrincipal::setRunAndLumiNumber ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
)

Definition at line 143 of file EventPrincipal.cc.

References aux_, edm::EventID::event(), edm::EventAuxiliary::id(), and luminosityBlockPrincipal_.

Referenced by luminosityBlockPrincipalPtrValid().

143  {
144  assert(run == luminosityBlockPrincipal_->run());
145  assert(lumi == luminosityBlockPrincipal_->luminosityBlock());
146  EventNumber_t event = aux_.id().event();
147  aux_.id() = EventID(run, lumi, event);
148  }
EventNumber_t event() const
Definition: EventID.h:41
RunNumber_t run() const
unsigned long long EventNumber_t
EventAuxiliary aux_
edm::propagate_const< std::shared_ptr< LuminosityBlockPrincipal > > luminosityBlockPrincipal_
EventID const & id() const
Definition: event.py:1
int edm::EventPrincipal::storeNumber ( ) const
inline

Definition at line 119 of file EventPrincipal.h.

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

119  {
120  return aux().storeNumber();
121  }
int storeNumber() const
EventAuxiliary const & aux() const
StreamID edm::EventPrincipal::streamID ( ) const
inline
Timestamp const& edm::EventPrincipal::time ( ) const
inline

Definition at line 103 of file EventPrincipal.h.

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

Referenced by edm::EDLooperBase::doDuringLoop(), edm::InputSource::readEvent(), and edm::OccurrenceTraits< EventPrincipal, BranchActionStreamBegin >::setStreamContext().

103  {
104  return aux().time();
105  }
Timestamp const & time() const
EventAuxiliary const & aux() const
unsigned int edm::EventPrincipal::transitionIndex_ ( ) const
overrideprivatevirtual

Implements edm::EDProductGetter.

Definition at line 225 of file EventPrincipal.cc.

References streamID_, and edm::StreamID::value().

Referenced by mergeProvenanceRetrievers().

225  {
226  return streamID_.value();
227  }
unsigned int value() const
Definition: StreamID.h:46

Member Data Documentation

EventAuxiliary edm::EventPrincipal::aux_
private
std::shared_ptr<BranchIDListHelper const> edm::EventPrincipal::branchIDListHelper_
private

Definition at line 197 of file EventPrincipal.h.

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

BranchListIndexes edm::EventPrincipal::branchListIndexes_
private

Definition at line 200 of file EventPrincipal.h.

Referenced by branchListIndexes(), fillEventPrincipal(), and pidToBid().

std::map<BranchListIndex, ProcessIndex> edm::EventPrincipal::branchListIndexToProcessIndex_
private

Definition at line 202 of file EventPrincipal.h.

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

EventSelectionIDVector edm::EventPrincipal::eventSelectionIDs_
private

Definition at line 195 of file EventPrincipal.h.

Referenced by eventSelectionIDs(), and fillEventPrincipal().

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

Definition at line 52 of file EventPrincipal.h.

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

Definition at line 53 of file EventPrincipal.h.

edm::propagate_const<std::shared_ptr<LuminosityBlockPrincipal> > edm::EventPrincipal::luminosityBlockPrincipal_
private
edm::propagate_const<std::shared_ptr<ProductProvenanceRetriever> > edm::EventPrincipal::provRetrieverPtr_
private
StreamID edm::EventPrincipal::streamID_
private

Definition at line 204 of file EventPrincipal.h.

Referenced by streamID(), and transitionIndex_().

std::shared_ptr<ThinnedAssociationsHelper const> edm::EventPrincipal::thinnedAssociationsHelper_
private

Definition at line 198 of file EventPrincipal.h.

Referenced by EventPrincipal(), getThinnedProduct(), and getThinnedProducts().