ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Event
xAOD
xAODCore
Root
AddDVProxy.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// Local include(s):
6
#include "
xAODCore/AddDVProxy.h
"
7
#include "
CxxUtils/checker_macros.h
"
8
9
// ROOT include(s):
10
#include <TClass.h>
11
#include <TError.h>
12
#include <TInterpreter.h>
13
#include <TROOT.h>
14
#include <TClassGenerator.h>
15
#include <TClassEdit.h>
16
17
// System include(s):
18
#include <mutex>
19
20
21
namespace
{
22
23
35
class
xAODClassGenerator :
public
TClassGenerator
36
{
37
public
:
38
using
TClassGenerator::GetClass;
39
virtual
TClass *GetClass(
const
char
* classname, Bool_t load)
override
;
40
virtual
TClass *GetClass(
const
std::type_info& , Bool_t )
override
41
{
return
nullptr
; }
42
43
// Protect against recursive invocation.
44
static
thread_local
bool
m_active;
45
struct
BeActive
46
{
47
BeActive() { m_active =
true
; }
48
~BeActive() { m_active =
false
; }
49
};
50
51
};
52
53
54
55
thread_local
bool
xAODClassGenerator::m_active =
false
;
56
57
58
TClass* xAODClassGenerator::GetClass(
const
char
* classname, Bool_t load)
59
{
60
static
const
std::string prefs[] = {
61
"SG::AuxTypeVectorFactory<"
,
62
"DataLink<"
,
63
"ElementLink<"
,
64
"SG::BaseInfo<"
,
65
"DataVector<"
,
66
};
67
if
(m_active)
return
nullptr
;
68
for
(
const
std::string&
pref
: prefs) {
69
if
(strncmp (classname,
pref
.c_str(),
pref
.size()) == 0) {
70
std::string eltName;
71
{
72
// Protect against data race inside TClassEdit.
73
// https://github.com/root-project/root/issues/10353
74
// Should be fixed in root 6.26.02.
75
R__WRITE_LOCKGUARD(ROOT::gCoreMutex);
76
TClassEdit::TSplitType
s
(classname);
77
if
(
s
.fElements.size() >= 2) {
78
eltName =
s
.fElements[1];
79
}
80
}
81
if
(!eltName.empty()) {
82
TClass::GetClass (eltName.c_str(), load);
83
BeActive
active
;
84
return
TClass::GetClass (classname, load);
85
}
86
}
87
}
88
return
nullptr
;
89
}
90
91
92
xAODClassGenerator
generator
ATLAS_THREAD_SAFE
;
93
94
95
}
// anonymous namespace
96
97
98
namespace
xAOD
{
99
104
void
AddDVProxy::loadDictionaries
() {
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
}
129
130
}
// namespace xAOD
AddDVProxy.h
pref
static Double_t * pref
Definition
LArPhysWaveHECTool.cxx:39
checker_macros.h
Define macros for attributes used to control the static checker.
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition
checker_macros.h:211
xAOD::AddDVProxy::loadDictionaries
static void loadDictionaries()
Helper function force-loading all the needed dictionaries.
Definition
AddDVProxy.cxx:104
Trk::active
@ active
Definition
Layer.h:47
mc.generator
generator
Configure Herwig7 These are the commands corresponding to what would go into the regular Herwig infil...
Definition
mc.MGH7_FxFx_H71-DEFAULT_test.py:18
python.SystemOfUnits.s
float s
Definition
SystemOfUnits.py:147
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition
ICaloAffectedTool.h:24
Generated on
for ATLAS Offline Software by
1.17.0