Base class for data that users can add to pat objects. More...
#include <DataFormats/PatCandidates/interface/UserData.h>
Public Member Functions | |
const void * | bareData () const |
virtual UserData * | clone () const =0 |
Necessary for deep copy in OwnVector. | |
template<typename T > | |
const T * | get () const |
Extract data in a typesafe way. <T> must be the *concrete* type of the data. | |
virtual const std::type_info & | typeId () const =0 |
Concrete type of stored data. | |
virtual const std::string & | typeName () const =0 |
Human readable name of the concrete type of stored data. | |
UserData () | |
virtual | ~UserData () |
Static Public Member Functions | |
template<typename T > | |
static std::auto_ptr< UserData > | make (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) | |
Static Private Member Functions | |
static void | checkDictionaries (const std::type_info &type) |
Base class for data that users can add to pat objects.
Definition at line 25 of file UserData.h.
pat::UserData::UserData | ( | ) | [inline] |
Definition at line 27 of file UserData.h.
{}
virtual pat::UserData::~UserData | ( | ) | [inline, virtual] |
Definition at line 28 of file UserData.h.
{}
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().
{ return data_(); }
void pat::UserData::checkDictionaries | ( | const std::type_info & | type | ) | [static, private] |
Definition at line 6 of file UserData.cc.
References edm::errors::DictionaryNotFound, Exception, edm::TypeWithDict::hasDictionary(), ntuplemaker::status, AlCaHLTBitMon_QueryRunRegistry::string, and typeName().
Referenced by make().
{ edm::TypeWithDict edmType(type); if (!edmType.hasDictionary()) { int status = 0; char * demangled = abi::__cxa_demangle(type.name(), 0, 0, &status); std::string typeName(status == 0 ? demangled : type.name()); if ((demangled != 0) && (status == 0)) free(demangled); throw edm::Exception(edm::errors::DictionaryNotFound) << " No REFLEX data dictionary found for the following class:\n\t" << typeName << "\n Most likely the dictionary was never generated,\n" << " but it may be that it was generated in the wrong package.\n" << " Please add (or move) the specification\n" << "\t<class name=\"" << typeName << "\" />\n" << " to the appropriate classes_def.xml file.\n" << " If the class is a template instance, you may need\n" << " to define a dummy variable of this type in classes.h.\n" << " Also, if this class has any transient members,\n" << " you need to specify them in classes_def.xml.\n"; } // check for dictionary }
virtual UserData* pat::UserData::clone | ( | ) | const [pure virtual] |
Necessary for deep copy in OwnVector.
Implemented in pat::UserHolder< T >.
virtual const void* pat::UserData::data_ | ( | ) | const [protected, pure virtual] |
Get out the data (can't template non virtual functions)
Implemented in pat::UserHolder< T >.
Referenced by bareData(), and get().
const T* pat::UserData::get | ( | void | ) | const [inline] |
std::auto_ptr< pat::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
Definition at line 89 of file UserData.h.
References checkDictionaries(), and relativeConstraints::value.
Referenced by pat::MatcherUsingTracks::produce().
{ if (!transientOnly) { checkDictionaries(typeid(T)); checkDictionaries(typeid(pat::UserHolder<T>)); } return std::auto_ptr<UserData>(new pat::UserHolder<T>(value)); }
virtual const std::type_info& pat::UserData::typeId | ( | ) | const [pure virtual] |
virtual const std::string& pat::UserData::typeName | ( | ) | const [pure virtual] |
Human readable name of the concrete type of stored data.
Implemented in pat::UserHolder< T >.
Referenced by checkDictionaries(), and pat::PATObject< reco::Muon >::userDataObjectType().