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 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 > pat::UserHolder< std::vector< unsigned int > > 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::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 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::hasDictionary(), ntuplemaker::status, AlCaHLTBitMon_QueryRunRegistry::string, and typeName().

Referenced by make().

6  {
7  if (!edm::hasDictionary(type)) {
8  int status = 0;
9  char * demangled = abi::__cxa_demangle(type.name(), 0, 0, &status);
10  std::string typeName(status == 0 ? demangled : type.name());
11  if ((demangled != 0) && (status == 0)) free(demangled);
13  << " No REFLEX data dictionary found for the following class:\n\t"
14  << typeName
15  << "\n Most likely the dictionary was never generated,\n"
16  << " but it may be that it was generated in the wrong package.\n"
17  << " Please add (or move) the specification\n"
18  << "\t<class name=\"" << typeName << "\" />\n"
19  << " to the appropriate classes_def.xml file.\n"
20  << " If the class is a template instance, you may need\n"
21  << " to define a dummy variable of this type in classes.h.\n"
22  << " Also, if this class has any transient members,\n"
23  << " you need to specify them in classes_def.xml.\n";
24  } // check for dictionary
25 }
type
Definition: HCALResponse.h:21
virtual const std::string & typeName() const =0
Human readable name of the concrete type of stored data.
bool hasDictionary(std::type_info const &)
tuple status
Definition: ntuplemaker.py:245
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 ( 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(), rrapi.RRApi::columns(), rrapi.RRApi::count(), rrapi.RRApi::data(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), rrapi.RRApi::report(), rrapi.RRApi::reports(), rrapi.RRApi::tables(), rrapi.RRApi::tags(), rrapi.RRApi::templates(), and rrapi.RRApi::workspaces().

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 VersionedIdProducer< PhysicsObjectPtr, SelectorType >::produce(), and pat::MatcherUsingTracks::produce().

template<typename T >
std::auto_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::auto_ptr<UserData>(new pat::UserHolder<T>(value));
95 }
long double T
static void checkDictionaries(const std::type_info &type)
Definition: UserData.cc:6
virtual const std::type_info& pat::UserData::typeId ( ) const
pure virtual
virtual const std::string& pat::UserData::typeName ( ) const
pure virtual