ATLAS Offline Software
Loading...
Searching...
No Matches
xAOD::AddDVProxy Class Reference

Set up collection proxy for a DataVector class. More...

#include <AddDVProxy.h>

Collaboration diagram for xAOD::AddDVProxy:

Classes

struct  Helper
 Helper structure implementing the resize(...) function. More...

Static Public Member Functions

template<typename T>
static void add (ROOT::TGenericClassInfo *clInfo)
 Set up collection proxy for a DataVector class.

Static Private Member Functions

static void loadDictionaries ()
 Helper function force-loading all the needed dictionaries.

Detailed Description

Set up collection proxy for a DataVector class.

If cl is a DataVector class, or derives from one, then we attach an appropriate Root collection proxy to it. This is required for Root to recognize the class as a collection in, eg, TTree::Draw.

Definition at line 87 of file AddDVProxy.h.

Member Function Documentation

◆ add()

template<typename T>
void xAOD::AddDVProxy::add ( ROOT::TGenericClassInfo * clInfo)
inlinestatic

Set up collection proxy for a DataVector class.

If cl is a DataVector class, or derives from one, then we attach an appropriate Root collection proxy to it. This is required for Root to recognize the class as a collection in, eg, TTree::Draw.

Definition at line 147 of file AddDVProxy.h.

147 {
148
149 // Load the minimal amount of required dictionaries:
151
152 // Create the collection proxy instance:
153 TDVCollectionProxy* proxy =
154 new TDVCollectionProxy( ClassName< T >::name().c_str() );
155 proxy->SetResize( Helper< T >::resize );
156
157 // Add it to the class info:
158 clInfo->AdoptCollectionProxy( proxy );
159
160 return;
161 }
static std::string name()
Return the name of class T as a string.
static void loadDictionaries()
Helper function force-loading all the needed dictionaries.
static void resize(void *obj, size_t size)
Function taking care of resizing DataVector<T> objects in memory.
Definition AddDVProxy.h:111

◆ loadDictionaries()

void xAOD::AddDVProxy::loadDictionaries ( )
staticprivate

Helper function force-loading all the needed dictionaries.

The constructor of TDVCollectionProxy needs the dictionary of DataVector<xAOD::TDVCollectionProxyDummy> to be loaded already.

This function makes sure that this is the case.

Definition at line 104 of file AddDVProxy.cxx.

104 {
105
106 // Enable library auto-loading. Only once per job.
107 static std::once_flag libLoadFlag;
108 std::call_once( libLoadFlag, []( TInterpreter& interpreter ) {
109
110 // Enable library auto-loading.
111 TClass::ReadRules();
112 interpreter.LoadLibraryMap();
113 interpreter.SetClassAutoloading( true );
114
115 // Make sure that the minimal set of dictionaries are loaded:
116 if( ! TClass::GetClass( "DataVector<xAOD::TDVCollectionProxyDummy>" ) ) {
117 ::Error( "xAOD::AddDVProxy::loadDictionaries",
118 "Couldn't load the dictionary for "
119 "DataVector<xAOD::TDVCollectionProxyDummy>" );
120 }
121
122 // Install the cling workaround (see above).
123 gROOT->AddClassGenerator (&generator);
124
125 }, *gInterpreter );
126
127 return;
128 }

The documentation for this class was generated from the following files: