#include <DataFormats/Common/interface/Ptr.h>
Public Types | |
typedef unsigned long | key_type |
typedef T | value_type |
Public Member Functions | |
T const * | get () const |
Returns C++ pointer to the item. | |
bool | hasProductCache () const |
ProductID | id () const |
Accessor for product ID. | |
bool | isAvailable () const |
bool | isNonnull () const |
Checks for non-null. | |
bool | isNull () const |
Checks for null. | |
bool | isTransient () const |
Checks if this Ptr is transient (i.e. not persistable). | |
key_type | key () const |
bool | operator! () const |
Checks for null. | |
T const & | operator* () const |
Dereference operator. | |
T const * | operator-> () const |
Member dereference operator. | |
void const * | product () const |
EDProductGetter const * | productGetter () const |
Accessor for product getter. | |
template<typename C > | |
Ptr (C const *iProduct, key_type iItemKey, bool=true) | |
Ptr (ProductID const &iId) | |
Ptr (ProductID const &productID, T const *item, key_type item_key) | |
template<typename C > | |
Ptr (OrphanHandle< C > const &handle, key_type itemKey, bool=true) | |
Ptr () | |
template<typename U > | |
Ptr (Ptr< U > const &iOther, typename boost::enable_if_c< boost::is_base_of< T, U >::value >::type *=0) | |
template<typename C > | |
Ptr (TestHandle< C > const &handle, key_type itemKey, bool=true) | |
template<typename C > | |
Ptr (Handle< C > const &handle, key_type itemKey, bool=true) | |
template<typename U > | |
Ptr (Ptr< U > const &iOther, typename boost::enable_if_c< boost::is_base_of< U, T >::value >::type *=0) | |
Ptr (ProductID const &productID, key_type itemKey, EDProductGetter const *prodGetter) | |
RefCore const & | refCore () const |
~Ptr () | |
Destructor. | |
Private Member Functions | |
void | getData_ () const |
template<typename C > | |
T const * | getItem_ (C const *product, key_type iKey) |
Ptr (T const *item, key_type item_key) | |
Private Attributes | |
RefCore | core_ |
key_type | key_ |
Friends | |
class | PtrVectorBase |
Description: Persistent 'pointer' to an item in a collection where the collection is in the edm::Event
Usage: <usage>
edm::Ptr< T >::Ptr | ( | OrphanHandle< C > const & | handle, |
key_type | itemKey, | ||
bool | = true |
||
) | [inline] |
edm::Ptr< T >::Ptr | ( | TestHandle< C > const & | handle, |
key_type | itemKey, | ||
bool | = true |
||
) | [inline] |
edm::Ptr< T >::Ptr | ( | ProductID const & | productID, |
key_type | itemKey, | ||
EDProductGetter const * | prodGetter | ||
) | [inline] |
Constructor for those users who do not have a product handle, but have a pointer to a product getter (such as the EventPrincipal). prodGetter will ususally be a pointer to the event principal.
Definition at line 82 of file Ptr.h.
: core_(productID, 0, mustBeNonZero(prodGetter, "Ptr", productID), false), key_(itemKey) { }
edm::Ptr< T >::Ptr | ( | ProductID const & | productID, |
T const * | item, | ||
key_type | item_key | ||
) | [inline] |
Constructor for use in the various X::fillView(...) functions or for extracting a persistent Ptr from a PtrVector. It is an error (not diagnosable at compile- or run-time) to call this constructor with a pointer to a T unless the pointed-to T object is already in a collection of type C stored in the Event. The given ProductID must be the id of the collection in the Event.
Definition at line 107 of file Ptr.h.
: core_(), key_(key_traits<key_type>::value) {}
Returns C++ pointer to the item.
Definition at line 143 of file Ptr.h.
Referenced by pat::Jet::cacheCaloTowers(), pat::Jet::cachePFCandidates(), edm::FwdPtr< T >::get(), pat::EventHypothesis::getAs(), pat::Jet::getCaloConstituent(), reco::CaloJet::getCaloConstituent(), MultipleAlgoIterator::getEt(), ParametrizedSubtractor::getEt(), ReflectedIterator::getEt(), ReflectedIterator::getEta(), ParametrizedSubtractor::getEta(), MultipleAlgoIterator::getEta(), reco::PFJet::getPFConstituent(), pat::Jet::getPFConstituent(), PileUpSubtractor::ieta(), VirtualJetProducer::inputTowers(), cms::SubEventGenJetProducer::inputTowers(), PileUpSubtractor::iphi(), pat::MET::MET(), reco::PFClusterJet::pfCluster(), EcalDigiSelector::produce(), pat::Tau::Tau(), and reco::TrackJet::track().
{ return isNull() ? 0 : this->operator->(); }
Definition at line 194 of file Ptr.h.
{ if(!hasProductCache() && 0 != productGetter()) { void const* ad = 0; WrapperHolder prod = productGetter()->getIt(core_.id()); if(!prod.isValid()) { core_.productNotFoundException(typeid(T)); } prod.setPtr(typeid(T), key_, ad); core_.setProductPtr(ad); } }
T const * edm::Ptr< T >::getItem_ | ( | C const * | product, |
key_type | iKey | ||
) | [private] |
Definition at line 212 of file Ptr.h.
References edm::detail::GetProduct< COLLECTION >::address().
{ assert (iProduct != 0); typename C::const_iterator it = iProduct->begin(); std::advance(it,iKey); T const* address = detail::GetProduct<C>::address(it); return address; }
Definition at line 171 of file Ptr.h.
Referenced by edm::Ptr< pat::MET >::getData_(), edm::FwdPtr< T >::hasProductCache(), and edm::PtrVector< Candidate >::push_back().
{ return 0 != core_.productPtr(); }
Accessor for product ID.
Definition at line 164 of file Ptr.h.
Referenced by pat::PATUserDataMerger< ObjectType, Operation >::add(), pat::Jet::cacheCaloTowers(), pat::Jet::cachePFCandidates(), ConvertedPhotonProducer::cleanCollections(), pat::PATElectronProducer::fillElectron2(), pat::Jet::getCaloConstituent(), reco::CaloJet::getCaloConstituent(), reco::PFJet::getPFConstituent(), pat::Jet::getPFConstituent(), edm::FwdPtr< T >::id(), pat::helper::RefHelper< T >::parentOrNull(), reco::Jet::print(), TopProjector< Top, Bottom >::ptrToAncestor(), pat::helper::RefHelper< T >::recursiveLookup(), ConvertedPhotonProducer::solveAmbiguity(), and metsig::SignPFSpecificAlgo::useOriginalPtrs().
{return core_.id();}
Checks if collection is in memory or available in the event. No type checking is done.
Definition at line 158 of file Ptr.h.
Referenced by reco::CaloJet::getCaloConstituent(), reco::PFJet::getPFConstituent(), edm::FwdPtr< T >::isAvailable(), reco::PFClusterJet::pfCluster(), and reco::TrackJet::track().
{return core_.isAvailable();}
Checks for non-null.
Definition at line 152 of file Ptr.h.
Referenced by reco::FlavorHistoryEvent::cache(), ConversionProducer::checkTrackPair(), reco::tau::RecoTauConstructor::convertToRef(), EGEnergyCorrector::CorrectedEnergyWithError(), edm::FwdPtr< T >::get(), reco::CaloJet::getCaloConstituent(), reco::PFJet::getPFConstituent(), reco::FlavorHistory::hasMatchedJet(), reco::FlavorHistory::hasParton(), reco::FlavorHistory::hasProgenitor(), reco::FlavorHistory::hasSister(), reco::FlavorHistory::hasSisterJet(), edm::FwdPtr< T >::id(), pat::helper::RefHelper< T >::isAncestorOf(), edm::FwdPtr< T >::isNonnull(), edm::Ptr< pat::MET >::isNull(), edm::FwdPtr< T >::key(), edm::FwdPtr< T >::operator*(), edm::FwdPtr< T >::operator->(), reco::PFCandidate::overlap(), pat::helper::RefHelper< T >::parentOrSelf(), reco::PFClusterJet::pfCluster(), reco::Jet::print(), pat::PATElectronProducer::produce(), pat::PATJetProducer::produce(), pat::helper::RefHelper< T >::recursiveLookup(), edm::FwdPtr< T >::refCore(), and reco::TrackJet::track().
{return key_traits<key_type>::value != key_;}
Checks for null.
Definition at line 148 of file Ptr.h.
Referenced by pat::helper::RefHelper< T >::ancestorOrSelf(), pat::helper::OverlapBySuperClusterSeed::fillOverlapsForItem(), edm::PtrVector< T >::fillView(), edm::Ptr< pat::MET >::get(), edm::Ptr< pat::MET >::operator!(), reco::PFCandidate::overlap(), WMuNuProducer::produce(), and metsig::SignPFSpecificAlgo::useOriginalPtrs().
{return !isNonnull(); }
Checks if this Ptr is transient (i.e. not persistable).
Definition at line 161 of file Ptr.h.
Referenced by edm::FwdPtr< T >::isTransient().
{return core_.isTransient();}
Definition at line 169 of file Ptr.h.
Referenced by pat::Jet::cacheCaloTowers(), pat::Jet::cachePFCandidates(), ConvertedPhotonProducer::cleanCollections(), reco::tau::RecoTauConstructor::convertToRef(), reco::CaloJet::getCaloConstituent(), pat::Jet::getCaloConstituent(), reco::PFJet::getPFConstituent(), pat::Jet::getPFConstituent(), reco::tau::isTauSignalPFCandidate(), edm::FwdPtr< T >::key(), reco::tau::RecoTauPhotonFilter::operator()(), reco::FlavorHistory::operator<(), operator<<(), reco::FlavorHistory::operator==(), edm::operator==(), reco::FlavorHistory::operator>(), reco::RecoTauPiZero::print(), reco::Jet::print(), TriggerMatcherToHLTDebug::produce(), TopProjector< Top, Bottom >::ptrToAncestor(), edm::PtrVector< Candidate >::push_back(), and ConvertedPhotonProducer::solveAmbiguity().
{return key_;}
Member dereference operator.
Definition at line 233 of file Ptr.h.
References compareJSON::const.
Referenced by edm::Ptr< pat::MET >::get().
EDProductGetter const* edm::Ptr< T >::productGetter | ( | ) | const [inline] |
Accessor for product getter.
Definition at line 167 of file Ptr.h.
Referenced by edm::Ptr< pat::MET >::getData_(), and edm::FwdPtr< T >::productGetter().
{return core_.productGetter();}
Definition at line 173 of file Ptr.h.
Referenced by edm::operator==(), edm::PtrVector< Candidate >::push_back(), and edm::FwdPtr< T >::refCore().
{return core_;}
friend class PtrVectorBase [friend] |
Definition at line 206 of file Ptr.h.
Referenced by edm::Ptr< pat::MET >::getData_(), edm::Ptr< pat::MET >::hasProductCache(), edm::Ptr< pat::MET >::id(), edm::Ptr< pat::MET >::isAvailable(), edm::Ptr< pat::MET >::isTransient(), edm::Ptr< pat::MET >::productGetter(), and edm::Ptr< pat::MET >::refCore().
Definition at line 207 of file Ptr.h.
Referenced by edm::Ptr< pat::MET >::getData_(), edm::Ptr< pat::MET >::isNonnull(), and edm::Ptr< pat::MET >::key().