|
ATLAS Offline Software
|
Go to the documentation of this file.
10 #include <TClassEdit.h>
12 #include <TBaseClass.h>
13 #include <TCollectionProxyInfo.h>
42 return cls->GetBaseClassOffset(
base );
52 std::vector< std::string >
args;
58 R__WRITE_LOCKGUARD(ROOT::gCoreMutex);
59 TClassEdit::GetSplit( dvclass->GetName(),
args, tailloc );
61 assert(
args.size() > 1 );
64 std::string elname =
args[ 1 ];
65 assert( elname.size() > 0 );
68 TClass* elclass = TClass::GetClass( elname.c_str() );
70 ::Error(
"xAOD::TDVCollectionProxy",
"Cannot find class %s",
89 TIter
next( dvclass->GetListOfBases() );
90 while( TBaseClass* bcl =
dynamic_cast< TBaseClass*
>(
next() ) ) {
91 TClass*
cc = bcl->GetClassPointer();
92 if( strncmp(
cc->GetName(),
"DataVector", 10 ) == 0 ) {
95 if( strncmp(
cc->GetName(),
"DataVector<", 11 ) == 0 )
116 TClass::GetClass(
"DataVector<xAOD::TDVCollectionProxyDummy>" );
118 Error(
"xAOD::findDVElement",
119 "Couldn't load the dictionary for "
120 "DataVector<xAOD::TDVCollectionProxyDummy>" );
126 const char*
name =
cl->GetName();
127 if( strncmp(
name,
"DataVector<", 11 ) == 0 ) {
129 elt = std::string(
name + 11, strlen(
name ) - 11 - 1 );
133 const std::string::size_type comma = elt.find(
',' );
134 if( comma != std::string::npos ) {
142 TIter
next(
cl->GetListOfBases() );
143 while( TBaseClass* bcl =
dynamic_cast< TBaseClass*
>(
next() ) ) {
144 TClass*
cc = bcl->GetClassPointer();
146 if( ! elt.empty() ) {
193 using Env_t = ROOT::TCollectionProxyInfo::Environ<TEnvBuff>;
238 buff.fIndex +=
e.fIdx;
240 if(
buff.fIndex >=
e.fSize ) {
254 e->fSize = cont(
env )->size();
255 return &(
e->fSize );
263 cont(
env )->clear();
280 ::Fatal(
"xAOD::TDVCollectionProxy",
"resize function not specified!" );
285 ::Fatal(
"xAOD::TDVCollectionProxy",
"construct not implemented" );
291 ::Fatal(
"xAOD::TDVCollectionProxy",
"destruct not implemented" );
299 const std::type_info &elem_typeinfo =
dv->dvlinfo_v().elt_tinfo();
302 if(
mn) cout <<
"PROX: feed, typename=" << ru_type.getTypeName() <<
" typesize=" << ru_type.getSize() <<endl;
306 void *
obj = ru_type.create();
316 ::Fatal(
"xAOD::TDVCollectionProxy",
"collect not implemented" );
328 TDVCollectionProxy::TDVCollectionProxy(
const char* conttype )
331 fName( conttype ), fInitialized( kFALSE ),
332 fContoff( 0 ), fOffset( 0 ), fEltBase( nullptr ), fEltType( nullptr ) {
335 fValDiff =
sizeof(
void* );
353 delete fValue.exchange(
nullptr );
371 : TGenCollectionProxy( rhs ),
373 fInitialized( rhs.fInitialized ),
374 fContoff( rhs.fContoff ),
375 fOffset( rhs.fOffset ),
376 fEltBase( rhs.fEltBase ),
377 fEltType( rhs.fEltType ) {
383 delete fValue.exchange(
nullptr );
399 ::TGenCollectionProxy::PushProxy( objstart );
406 buff.fOffset = fOffset;
410 char* dvstart =
reinterpret_cast< char*
>( objstart ) + fContoff;
418 const std::vector< char* >&
vec =
dv->stdcont();
421 const_cast< std::vector< char* >*
>( &
vec );
451 TClass*
cl = TClass::GetClass(
fName );
453 ::Fatal(
"xAOD::TDVCollectionProxy::InitializeEx",
454 "Couldn't find dictionary for class %s",
461 if( eltname.empty() ) {
462 ::Fatal(
"xAOD::TDVCollectionProxy::InitializeEx",
463 "Class \"%s\" doesn't seem to be a DataVector",
472 fValDiff =
sizeof(
void* );
477 TGenCollectionProxy::InitializeEx(
silent );
480 fSTL_type = TClassEdit::kList;
484 delete fValue.exchange(
nullptr );
486 if( fVal )
delete fVal;
487 fValue =
new TGenCollectionProxy::Value( eltname.c_str(),
false );
488 fVal =
new TGenCollectionProxy::Value( *fValue );
523 const char* conttype ) {
530 TClass* dvclass = TClass::GetClass( conttype );
532 ::Fatal(
"xAOD::TDVCollectionProxy::FindOffsets",
533 "Cannot find class %s", conttype );
542 ::Fatal(
"xAOD::TDVCollectionProxy::FindOffsets",
543 "Couldn't find element type of %s",
544 dvclass->GetName() );
558 std::string elttype2 = elttype;
559 if( elttype2[ elttype2.size() - 1 ] ==
'*' ) {
560 elttype2.erase( elttype2.size() - 1 );
562 fEltType = TClass::GetClass( elttype2.c_str() );
566 ::Fatal(
"xAOD::TDVCollectionProxy::FindOffsets",
567 "Couldn't find dictionaries for DV element "
568 "type(s) for %s", conttype );
static void * feed(void *, void *to, size_t size)
static void destruct(void *, size_t)
Not implemented for xAOD.
static Cont_t * cont(void *env)
Fetch the container from a proxy environment.
static void * first(void *env)
Return the first element of the container.
virtual void PushProxy(void *objstart)
Start working with a new collection.
std::string normalizedTypeinfoName(const std::type_info &info)
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
TDVCollectionProxy(const char *conttype)
Constructor.
ROOT::TCollectionProxyInfo::Environ< TEnvBuff > Env_t
The Root proxy environment structure.
Proxy environment buffer.
void TDVCollectionProxy::PushProxy NO_SANITIZE_UNDEFINED(void *objstart)
Start working with a new collection.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
std::vector< size_t > vec
A Root collection proxy for DataVector containers.
Helper functions for accessing the container data via the proxy.
int fOffset
Offset between the pointer held by the DV and the start of the object.
std::vector< char * > Cont_t
The container type.
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Bool_t fInitialized
Flag for knowing whether the class was initialised already.
static void * create_env()
Return a new environment structure.
void FindOffsets(const char *elttype, const char *conttype)
Initialize the cached pointer offsets.
TString fName
Name of the container that this class proxies.
static void * next(void *env)
Return a following element of the container.
void SetResize(Sizing_t func)
Set the resize(...) function used by the proxy.
static void resize(void *, size_t)
Not implemented for xAOD.
std::string findDVElement(TClass *cl)
Find the element type of a DataVector class.
virtual TGenCollectionProxy * InitializeEx(Bool_t silent)
Function initialising the proxy just in time.
Cont_t * fCont
Pointer to the container.
static void * collect(void *, void *)
Not implemented for xAOD.
ptrdiff_t fContoff
The offset of the underlying DataVector in the declared type.
ptrdiff_t fOffset
Offset between the DV base pointer and the full DV pointer.
void * fEltPtr
The last element pointer to have been returned.
size_t fIndex
The index of the last element retrieved.
TClass * fEltBase
The element type to which the DV representation points.
An STL vector of pointers that by default owns its pointed-to elements.
TClass * fEltType
The declared element type of the DV.
std::string getenv(const std::string &variableName)
get an environment variable
def silent(func)
Redirect stdout/err to /dev/null Useful wrapper to get rid of ROOT verbosity...
static void * clear(void *env)
Erase the container.
Dummy class to use as the DataVector template argument for the class we give to the Root proxy.
Error
The different types of error that can be flagged in the L1TopoRDO.
Helper to disable undefined behavior sanitizer for a function.
int safeGetBaseOffset(TClass *cls, TClass *base)
Find base class offset using Reflex.
#define ATLAS_THREAD_SAFE
TClass * findDVBase(TClass *dvclass)
Find the unique base DataVector class.
static void * size(void *env)
Return the size of the container.
Define macros for attributes used to control the static checker.
static void * construct(void *, size_t)
Not implemented for xAOD.
TClass * classFromDVClass(TClass *dvclass)
Find the contained class in a DataVector.
TGenCollectionProxy::Sizing_t Sizing_t
Make the definition of Sizing_t public.
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
virtual TVirtualCollectionProxy * Generate() const
Clone this object.