ATLAS Offline Software
Loading...
Searching...
No Matches
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>
11TrigEDMAuxChecker::TrigEDMAuxChecker(const std::string& name, ISvcLocator* pSvcLocator)
12 : AthAlgorithm(name, pSvcLocator),
13 m_count(0)
14{
15 declareProperty("AuxContainerList",m_auxList);
16}
17
19
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
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
53template <typename T>
54void 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
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
95StatusCode 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}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_INFO(x,...)
static Double_t sc
#define x
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
Handle mappings between names and auxid_t.
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
A set of aux data identifiers.
Definition AuxTypes.h:47
void dumpDecorators(const T *, const std::string &)
StatusCode execute(const EventContext &ctx)
Execute method.
std::map< std::string, std::vector< std::string > > m_auxmap
std::vector< std::string > m_auxList
TrigEDMAuxChecker(const std::string &name, ISvcLocator *pSvcLocator)
Adapted from code by A.Hamilton to check trigger EDM; R.Goncalo 21/11/07.
std::map< std::string, std::vector< std::string > > m_dynauxmap
Common base class for the auxiliary containers.
Class creating a shallow copy of an existing auxiliary container.
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:140