ATLAS Offline Software
TrigEDMAuxChecker.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
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 
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 
54  ATH_MSG_DEBUG("REGTEST: DUMP DECORATORS");
55  ATH_MSG_DEBUG("Container size " << x->size() );
56  //Get list of auxids
57  const SG::auxid_set_t& auxIds=x->getAuxIDs();
58  const SG::auxid_set_t& dyn_auxids = x->getDynamicAuxIDs();
59  const std::type_info *type(0);
60  //Get registry to determine variable type
62  ATH_MSG_INFO("Number of auxIds " << auxIds.size() << " Number of dynaux " << dyn_auxids.size());
63  std::vector<std::string> auxvar = m_auxmap.at(key);
64  std::vector<std::string> dynauxvar = m_dynauxmap.at(key);
65  ATH_MSG_DEBUG("======== Aux store variables ==========");
66  for (auto ai: auxIds) {
67  const std::string &auxName=SG::AuxTypeRegistry::instance().getName(ai);
68  type = reg.getType( ai );
69  std::vector<std::string>::iterator it = find(auxvar.begin(), auxvar.end(), auxName);
70  if (it == auxvar.end()) {
71  auxvar.push_back(auxName);
72  if(m_count==0) ATH_MSG_INFO("Auxid=" << ai << ", Name=" << auxName << ", type= " << type->name());
73  else ATH_MSG_WARNING("REGTEST: Found new Auxid=" << ai << ", Name=" << auxName << ", type= " << type->name());
74  }
75 
76  }
77  ATH_MSG_DEBUG("======== Aux store dynamic variables ==========");
78 
79  for (auto ai: dyn_auxids) {
80  const std::string &auxName=SG::AuxTypeRegistry::instance().getName(ai);
81  type = reg.getType( ai );
82  std::vector<std::string>::iterator it = find(dynauxvar.begin(), dynauxvar.end(), auxName);
83  if (it == dynauxvar.end()) {
84  dynauxvar.push_back(auxName);
85  if(m_count==0) ATH_MSG_INFO("Auxid=" << ai << ", Name=" << auxName << ", type= " << type->name());
86  else ATH_MSG_WARNING("REGTEST: Found new Dynamic Auxid=" << ai << ", Name=" << auxName << ", type= " << type->name());
87  }
88 
89  }
90  m_auxmap[key]=auxvar;
91  m_dynauxmap[key]=dynauxvar;
92 }
93 
95  const xAOD::AuxContainerBase* aux=0;
96  StatusCode sc = StatusCode::SUCCESS;
97  for(const auto& key:m_auxList){
98  sc = evtStore()->retrieve(aux,key);
99  if (sc.isFailure()) {
100  ATH_MSG_WARNING("REGTEST Cannot retrieve " << key);
101  continue;
102  }
103  ATH_MSG_DEBUG("REGTEST: Dump Aux variables for " << key);
104  dumpDecorators(aux,key);
105  }
106  m_count++;
107  return sc;
108 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
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_auxList
std::vector< std::string > m_auxList
Definition: TrigEDMAuxChecker.h:33
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
TrigEDMAuxChecker::execute
StatusCode execute()
Definition: TrigEDMAuxChecker.cxx:94
SG::AuxTypeRegistry::instance
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Definition: AuxTypeRegistry.cxx:639
TrigEDMAuxChecker::m_auxmap
std::map< std::string, std::vector< std::string > > m_auxmap
Definition: TrigEDMAuxChecker.h:34
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
SG::AuxTypeRegistry::getName
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
Definition: AuxTypeRegistry.cxx:881
skel.it
it
Definition: skel.GENtoEVGEN.py:396
xAOD::AuxContainerBase
Common base class for the auxiliary containers.
Definition: AuxContainerBase.h:59
TrigEDMAuxChecker.h
TrigEDMAuxChecker::~TrigEDMAuxChecker
~TrigEDMAuxChecker()
Definition: TrigEDMAuxChecker.cxx:18
x
#define x
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
TrigEDMAuxChecker::dumpDecorators
void dumpDecorators(const xAOD::AuxContainerBase *, const std::string &)
Definition: TrigEDMAuxChecker.cxx:53
SG::AuxTypeRegistry
Handle mappings between names and auxid_t.
Definition: AuxTypeRegistry.h:61
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
SG::AuxTypeRegistry::getType
const std::type_info * getType(SG::auxid_t auxid) const
Return the type of an aux data item.
Definition: AuxTypeRegistry.cxx:908
CxxUtils::ConcurrentBitset::size
bit_t size() const
Count the number of 1 bits in the set.
TrigEDMAuxChecker::finalize
StatusCode finalize()
Definition: TrigEDMAuxChecker.cxx:32
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthAlgorithm
Definition: AthAlgorithm.h:47
TrigEDMAuxChecker::initialize
StatusCode initialize()
Definition: TrigEDMAuxChecker.cxx:20
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrigEDMAuxChecker::m_count
int m_count
Definition: TrigEDMAuxChecker.h:36
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SG::auxid_set_t
A set of aux data identifiers.
Definition: AuxTypes.h:47
TrigEDMAuxChecker::m_dynauxmap
std::map< std::string, std::vector< std::string > > m_dynauxmap
Definition: TrigEDMAuxChecker.h:35
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37