ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigValidation
TrigValAlgs
src
TrigEDMAuxChecker.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
#include "GaudiKernel/MsgStream.h"
8
#include "GaudiKernel/IToolSvc.h"
9
#include "
TrigEDMAuxChecker.h
"
10
#include <algorithm>
11
TrigEDMAuxChecker::TrigEDMAuxChecker
(
const
std::string& name, ISvcLocator* pSvcLocator)
12
:
AthAlgorithm
(name, pSvcLocator),
13
m_count
(0)
14
{
15
declareProperty
(
"AuxContainerList"
,
m_auxList
);
16
}
17
18
TrigEDMAuxChecker::~TrigEDMAuxChecker
() {}
19
20
StatusCode
TrigEDMAuxChecker::initialize
() {
21
ATH_MSG_INFO
(
"Initializing TrigEDMAuxChecker"
);
22
std::vector<std::string> auxvar;
23
for
(
const
auto
& key:
m_auxList
){
24
ATH_MSG_INFO
(
"REGTEST AuxStore "
<< key);
25
m_auxmap
.insert(std::make_pair(key,auxvar));
26
m_dynauxmap
.insert(std::make_pair(key,auxvar));
27
}
28
m_count
=0;
29
return
StatusCode::SUCCESS;
30
}
31
32
StatusCode
TrigEDMAuxChecker::finalize
() {
33
34
std::vector<std::string> auxvar;
35
for
(
const
auto
& key:
m_auxList
){
36
ATH_MSG_INFO
(
"REGTEST : Aux vars for "
<< key <<
" ============================"
);
37
auxvar=
m_auxmap
[key];
38
for
(
const
auto
& var:auxvar){
39
ATH_MSG_INFO
(
"REGTEST : "
<< key <<
" "
<< var);
40
}
41
ATH_MSG_INFO
(
" ========================================================"
);
42
ATH_MSG_INFO
(
"REGTEST : Dynamic Aux vars for "
<< key);
43
auxvar=
m_dynauxmap
[key];
44
for
(
const
auto
& var:auxvar){
45
ATH_MSG_INFO
(
"REGTEST : "
<< key <<
" "
<< var);
46
}
47
ATH_MSG_INFO
(
" ========================================================"
);
48
}
49
50
return
StatusCode::SUCCESS;
51
}
52
53
template
<
typename
T>
54
void
TrigEDMAuxChecker::dumpDecorators
(
const
T *
x
,
const
std::string& key){
55
ATH_MSG_DEBUG
(
"REGTEST: DUMP DECORATORS"
);
56
ATH_MSG_DEBUG
(
"Container size "
<<
x
->size() );
57
//Get list of auxids
58
const
SG::auxid_set_t
& auxIds=
x
->getAuxIDs();
59
const
SG::auxid_set_t
& dyn_auxids =
x
->getDynamicAuxIDs();
60
const
std::type_info *
type
(0);
61
//Get registry to determine variable type
62
SG::AuxTypeRegistry
& reg =
SG::AuxTypeRegistry::instance
();
63
ATH_MSG_INFO
(
"Number of auxIds "
<< auxIds.size() <<
" Number of dynaux "
<< dyn_auxids.size());
64
std::vector<std::string> auxvar =
m_auxmap
.at(key);
65
std::vector<std::string> dynauxvar =
m_dynauxmap
.at(key);
66
ATH_MSG_DEBUG
(
"======== Aux store variables =========="
);
67
for
(
auto
ai: auxIds) {
68
const
std::string &auxName=
SG::AuxTypeRegistry::instance
().
getName
(ai);
69
type
= reg.getType( ai );
70
std::vector<std::string>::iterator it =
find
(auxvar.begin(), auxvar.end(), auxName);
71
if
(it == auxvar.end()) {
72
auxvar.push_back(auxName);
73
if
(
m_count
==0)
ATH_MSG_INFO
(
"Auxid="
<< ai <<
", Name="
<< auxName <<
", type= "
<<
type
->name());
74
else
ATH_MSG_WARNING
(
"REGTEST: Found new Auxid="
<< ai <<
", Name="
<< auxName <<
", type= "
<<
type
->name());
75
}
76
77
}
78
ATH_MSG_DEBUG
(
"======== Aux store dynamic variables =========="
);
79
80
for
(
auto
ai: dyn_auxids) {
81
const
std::string &auxName=
SG::AuxTypeRegistry::instance
().
getName
(ai);
82
type
= reg.getType( ai );
83
std::vector<std::string>::iterator it =
find
(dynauxvar.begin(), dynauxvar.end(), auxName);
84
if
(it == dynauxvar.end()) {
85
dynauxvar.push_back(auxName);
86
if
(
m_count
==0)
ATH_MSG_INFO
(
"Auxid="
<< ai <<
", Name="
<< auxName <<
", type= "
<<
type
->name());
87
else
ATH_MSG_WARNING
(
"REGTEST: Found new Dynamic Auxid="
<< ai <<
", Name="
<< auxName <<
", type= "
<<
type
->name());
88
}
89
90
}
91
m_auxmap
[key]=std::move(auxvar);
92
m_dynauxmap
[key]=std::move(dynauxvar);
93
}
94
95
StatusCode
TrigEDMAuxChecker::execute
(
const
EventContext&
/*ctx*/
) {
96
const
xAOD::AuxContainerBase
* aux=0;
97
StatusCode
sc
= StatusCode::SUCCESS;
98
for
(
const
auto
& key:
m_auxList
){
99
// check if retrieveable first as AuxContainerBase then ShallowAux
100
aux =
evtStore
()->tryConstRetrieve<
xAOD::AuxContainerBase
>(key);
101
if
(!aux) {
102
const
xAOD::ShallowAuxContainer
* shallowaux=0;
103
shallowaux =
evtStore
()->tryConstRetrieve<
xAOD::ShallowAuxContainer
>(key);
104
if
(!shallowaux){
105
ATH_MSG_WARNING
(
"REGTEST Cannot retrieve "
<< key);
106
}
else
{
// ShallowAuxContainer
107
ATH_MSG_DEBUG
(
"REGTEST: retrieved ShallowAuxContainer type "
<< key);
108
ATH_MSG_DEBUG
(
"REGTEST: Dump Aux variables for "
<< key);
109
dumpDecorators
(shallowaux,key);
110
}
111
}
112
else
{
// AuxBaseContainer
113
ATH_MSG_DEBUG
(
"REGTEST: retrieved AuxBaseContainer type "
<< key);
114
ATH_MSG_DEBUG
(
"REGTEST: Dump Aux variables for "
<< key);
115
dumpDecorators
(aux,key);
116
}
117
}
118
m_count
++;
119
return
sc
;
120
}
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x,...)
Definition
AthMsgStreamMacros.h:46
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
TrigEDMAuxChecker.h
x
#define x
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
SG::AuxTypeRegistry
Handle mappings between names and auxid_t.
Definition
AuxTypeRegistry.h:61
SG::AuxTypeRegistry::getName
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
Definition
AuxTypeRegistry.cxx:882
SG::AuxTypeRegistry::instance
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Definition
AuxTypeRegistry.cxx:640
SG::auxid_set_t
A set of aux data identifiers.
Definition
AuxTypes.h:47
TrigEDMAuxChecker::dumpDecorators
void dumpDecorators(const T *, const std::string &)
Definition
TrigEDMAuxChecker.cxx:54
TrigEDMAuxChecker::execute
StatusCode execute(const EventContext &ctx)
Execute method.
Definition
TrigEDMAuxChecker.cxx:95
TrigEDMAuxChecker::m_auxmap
std::map< std::string, std::vector< std::string > > m_auxmap
Definition
TrigEDMAuxChecker.h:35
TrigEDMAuxChecker::m_auxList
std::vector< std::string > m_auxList
Definition
TrigEDMAuxChecker.h:34
TrigEDMAuxChecker::~TrigEDMAuxChecker
~TrigEDMAuxChecker()
Definition
TrigEDMAuxChecker.cxx:18
TrigEDMAuxChecker::finalize
StatusCode finalize()
Definition
TrigEDMAuxChecker.cxx:32
TrigEDMAuxChecker::TrigEDMAuxChecker
TrigEDMAuxChecker(const std::string &name, ISvcLocator *pSvcLocator)
Adapted from code by A.Hamilton to check trigger EDM; R.Goncalo 21/11/07.
Definition
TrigEDMAuxChecker.cxx:11
TrigEDMAuxChecker::m_dynauxmap
std::map< std::string, std::vector< std::string > > m_dynauxmap
Definition
TrigEDMAuxChecker.h:36
TrigEDMAuxChecker::m_count
int m_count
Definition
TrigEDMAuxChecker.h:37
TrigEDMAuxChecker::initialize
StatusCode initialize()
Definition
TrigEDMAuxChecker.cxx:20
xAOD::AuxContainerBase
Common base class for the auxiliary containers.
Definition
AuxContainerBase.h:55
xAOD::ShallowAuxContainer
Class creating a shallow copy of an existing auxiliary container.
Definition
ShallowAuxContainer.h:50
find
std::string find(const std::string &s)
return a remapped string
Definition
hcg.cxx:140
type
Generated on
for ATLAS Offline Software by
1.17.0