CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Static Private Member Functions
pat::UserData Class Referenceabstract

Base class for data that users can add to pat objects. More...

#include "DataFormats/PatCandidates/interface/UserData.h"

Inheritance diagram for pat::UserData:
pat::UserHolder< T > pat::UserHolder< AlgebraicSymMatrix22 > pat::UserHolder< AlgebraicSymMatrix33 > pat::UserHolder< AlgebraicSymMatrix44 > pat::UserHolder< AlgebraicSymMatrix55 > pat::UserHolder< AlgebraicVector2 > pat::UserHolder< AlgebraicVector3 > pat::UserHolder< AlgebraicVector4 > pat::UserHolder< AlgebraicVector5 > pat::UserHolder< bool > pat::UserHolder< edm::Ref< std::vector< pat::CompositeCandidate, std::allocator< pat::CompositeCandidate > >, pat::CompositeCandidate, edm::refhelper::FindUsingAdvance< std::vector< pat::CompositeCandidate, std::allocator< pat::CompositeCandidate > >, pat::CompositeCandidate > > > pat::UserHolder< edm::Ref< std::vector< reco::Vertex, std::allocator< reco::Vertex > >, reco::Vertex, edm::refhelper::FindUsingAdvance< std::vector< reco::Vertex, std::allocator< reco::Vertex > >, reco::Vertex > > > pat::UserHolder< math::PtEtaPhiMLorentzVector > pat::UserHolder< math::XYZPoint > pat::UserHolder< math::XYZTLorentzVector > pat::UserHolder< math::XYZVector > pat::UserHolder< reco::Track > pat::UserHolder< reco::Vertex > pat::UserHolder< std::vector< unsigned int > > pat::UserHolder< Vector3DBase< float, GlobalTag > > pat::UserHolder< vid::CutFlowResult >

Public Member Functions

const void * bareData () const
 
virtual UserDataclone () const =0
 Necessary for deep copy in OwnVector. More...
 
template<typename T >
const Tget () const
 Extract data in a typesafe way. <T> must be the concrete type of the data. More...
 
template<typename T >
std::unique_ptr< pat::UserDatamake (const T &value, bool transientOnly)
 
virtual const std::type_info & typeId () const =0
 Concrete type of stored data. More...
 
virtual const std::string & typeName () const =0
 Human readable name of the concrete type of stored data. More...
 
 UserData ()
 
virtual ~UserData ()
 

Static Public Member Functions

template<typename T >
static std::unique_ptr< UserDatamake (const T &value, bool transientOnly=false)
 

Protected Member Functions

virtual const void * data_ () const =0
 Get out the data (can't template non virtual functions) More...
 

Static Protected Member Functions

static std::string typeNameFor (std::type_info const &iInfo)
 

Static Private Member Functions

static void checkDictionaries (const std::type_info &type)
 

Detailed Description

Base class for data that users can add to pat objects.

Author
Sal Rappoccio
Version
$Id: UserData.h,v 1.01

Definition at line 24 of file UserData.h.

Constructor & Destructor Documentation

pat::UserData::UserData ( )
inline

Definition at line 26 of file UserData.h.

26 {}
virtual pat::UserData::~UserData ( )
inlinevirtual

Definition at line 27 of file UserData.h.

References clone(), AlCaHLTBitMon_QueryRunRegistry::string, typeId(), and typeName().

27 {}

Member Function Documentation

const void* pat::UserData::bareData ( ) const
inline

Get the data as a void *, for CINT usage. COMPLETELY UNSUPPORTED, USE ONLY FOR DEBUGGING

Definition at line 49 of file UserData.h.

References checkDictionaries(), data_(), make(), AlCaHLTBitMon_QueryRunRegistry::string, and typeNameFor().

Referenced by pat::PATObject< reco::Muon >::userDataBare().

49 { return data_(); }
virtual const void * data_() const =0
Get out the data (can&#39;t template non virtual functions)
void pat::UserData::checkDictionaries ( const std::type_info &  type)
staticprivate

Definition at line 7 of file UserData.cc.

References symbols::demangled, edm::errors::DictionaryNotFound, Exception, edm::hasDictionary(), mps_update::status, AlCaHLTBitMon_QueryRunRegistry::string, and typeName().

Referenced by bareData(), and make().

7  {
8  if (!edm::hasDictionary(type)) {
9  int status = 0;
10  char * demangled = abi::__cxa_demangle(type.name(), 0, 0, &status);
11  std::string typeName(status == 0 ? demangled : type.name());
12  if ((demangled != 0) && (status == 0)) free(demangled);
14  << " No REFLEX data dictionary found for the following class:\n\t"
15  << typeName
16  << "\n Most likely the dictionary was never generated,\n"
17  << " but it may be that it was generated in the wrong package.\n"
18  << " Please add (or move) the specification\n"
19  << "\t<class name=\"" << typeName << "\" />\n"
20  << " to the appropriate classes_def.xml file.\n"
21  << " If the class is a template instance, you may need\n"
22  << " to define a dummy variable of this type in classes.h.\n"
23  << " Also, if this class has any transient members,\n"
24  << " you need to specify them in classes_def.xml.\n";
25  } // check for dictionary
26 }
type
Definition: HCALResponse.h:21
virtual const std::string & typeName() const =0
Human readable name of the concrete type of stored data.
demangled
Definition: symbols.py:61
bool hasDictionary(std::type_info const &)
virtual UserData* pat::UserData::clone ( ) const
pure virtual
virtual const void* pat::UserData::data_ ( ) const
protectedpure virtual
template<typename T >
const T* pat::UserData::get ( ) const
inline
template<typename T >
static std::unique_ptr<UserData> pat::UserData::make ( const T value,
bool  transientOnly = false 
)
static

Make a UserData pointer from some value, wrapping it appropriately. It will check for dictionaries, unless 'transientOnly' is true

Referenced by bareData(), pat::MatcherUsingTracks::produce(), and VersionedIdProducer< PhysicsObjectPtr, SelectorType >::produce().

template<typename T >
std::unique_ptr<pat::UserData> pat::UserData::make ( const T value,
bool  transientOnly 
)

Definition at line 89 of file UserData.h.

References checkDictionaries(), and relativeConstraints::value.

89  {
90  if (!transientOnly) {
91  checkDictionaries(typeid(T));
93  }
94  return std::unique_ptr<UserData>(new pat::UserHolder<T>(value));
95 }
long double T
static void checkDictionaries(const std::type_info &type)
Definition: UserData.cc:7
virtual const std::type_info& pat::UserData::typeId ( ) const
pure virtual
virtual const std::string& pat::UserData::typeName ( ) const
pure virtual
std::string pat::UserData::typeNameFor ( std::type_info const &  iInfo)
staticprotected

Definition at line 28 of file UserData.cc.

References symbols::demangled, mps_update::status, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by bareData(), and pat::UserHolder< T >::typeName_().

28  {
29  int status = 0;
30  const char * demangled = abi::__cxa_demangle(iType.name(), 0, 0, &status);
31  return std::string(status == 0 ? demangled : "[UNKNOWN]");
32 }
demangled
Definition: symbols.py:61