CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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< math::PtEtaPhiMLorentzVector > pat::UserHolder< math::XYZPoint > pat::UserHolder< math::XYZTLorentzVector > pat::UserHolder< math::XYZVector > pat::UserHolder< reco::Track > pat::UserHolder< reco::Vertex >

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::auto_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::auto_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 demangleName (const char *iMangledName)
 

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 25 of file UserData.h.

Constructor & Destructor Documentation

pat::UserData::UserData ( )
inline

Definition at line 27 of file UserData.h.

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

Definition at line 28 of file UserData.h.

28 {}

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 50 of file UserData.h.

References data_().

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

50 { 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 6 of file UserData.cc.

References edm::errors::DictionaryNotFound, edm::hlt::Exception, edm::TypeWithDict::hasDictionary(), ntuplemaker::status, AlCaHLTBitMon_QueryRunRegistry::string, and typeName().

Referenced by make().

6  {
7  edm::TypeWithDict edmType(type);
8  if (!edmType.hasDictionary()) {
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.
tuple status
Definition: ntuplemaker.py:245
virtual UserData* pat::UserData::clone ( ) const
pure virtual
virtual const void* pat::UserData::data_ ( ) const
protectedpure virtual
std::string pat::UserData::demangleName ( const char *  iMangledName)
staticprotected

Definition at line 28 of file UserData.cc.

References mergeVDriftHistosByStation::name, ntuplemaker::status, and AlCaHLTBitMon_QueryRunRegistry::string.

28  {
29  int status = 0;
30  char * demangled = abi::__cxa_demangle(iMangledName, 0, 0, &status);
31  const std::string name(status == 0 ? demangled : "[UNKNOWN]");
32  if((status ==0) and (nullptr != demangled)) { free(demangled);}
33  return name;
template<typename T >
const T* pat::UserData::get ( void  ) const
inline

Extract data in a typesafe way. <T> must be the concrete type of the data.

Definition at line 42 of file UserData.h.

References data_(), and typeId().

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), and betterConfigParser.BetterConfigParser::getResultingSection().

42  {
43  if (typeid(T) != typeId()) return 0;
44  return static_cast<const T *>(data_());
45  }
virtual const void * data_() const =0
Get out the data (can&#39;t template non virtual functions)
virtual const std::type_info & typeId() const =0
Concrete type of stored data.
long double T
template<typename T >
static std::auto_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 pat::MatcherUsingTracks::produce().

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

Definition at line 90 of file UserData.h.

References checkDictionaries(), and relativeConstraints::value.

90  {
91  if (!transientOnly) {
92  checkDictionaries(typeid(T));
94  }
95  return std::auto_ptr<UserData>(new pat::UserHolder<T>(value));
96 }
long double T
static void checkDictionaries(const std::type_info &type)
Definition: UserData.cc:6