21#include "Gaudi/Property.h"
22#include "GaudiKernel/IIncidentSvc.h"
23#include "GaudiKernel/Incident.h"
24#include "GaudiKernel/IAlgContextSvc.h"
39 base_class ( name, pSvcLocator ),
70 incSvc->addListener(
this, IncidentType::BeginRun );
71 incSvc->addListener(
this, IncidentType::BeginEvent );
72 incSvc->addListener(
this, IncidentType::EndEvent );
74 return StatusCode::SUCCESS;
83 ATH_MSG_WARNING(
"No data gathered. This might be because you did not run over at least 3 events.");
84 return StatusCode::SUCCESS;
90 f <<
"Algs: " <<
m_vAlg.size() << std::endl;
91 std::vector<std::string>::iterator i;
93 f << (*i) << std::endl;
96 f <<
"Obj: "<<
m_vObj.size()<<std::endl;
98 f << (*i) << std::endl;
102 for (
unsigned int w=0;w<
m_vAlg.size();w++){
103 for(
unsigned int q=0;q<
m_vObj.size();q++){
104 int oaHash=q*1000 + w;
121 if (
m_ofs.is_open()) {
129 return StatusCode::SUCCESS;
138 " from: " << inc.source());
140 if (inc.type() == IncidentType::BeginEvent) {
142 m_ofa <<
"---- BEGIN EVENT " <<
m_nEvents <<
" ----" << std::endl;
148 if ( inc.type() == IncidentType::EndEvent ) {
161 if ( inc.type() == IncidentType::BeginRun ) {
182 if (SGobject==
"") SGobject=
"noKey";
184 for (
unsigned int i = 0; i < SGobject.length(); i++)
185 if (!std::isdigit(SGobject[i])){
206 if (SGobject==
"") SGobject=
"noKey";
207 for (
unsigned int i = 0; i < SGobject.length(); i++)
208 if (!std::isdigit(SGobject[i])){
226 const int& typ,
const int& store_id) {
229 if (
m_pCID == 0) {
return; }
244 if( !
m_pCID->getTypeNameOfID(
id,idname).isSuccess()) {
245 std::ostringstream ost;
251 if (
m_ofa.is_open()) {
252 m_ofa << ( (typ == 1) ?
"RECORD" :
"RETRIEVE" ) <<
" clid: " <<
id
258 <<
" store: " << store_id
264 if (!
m_ofs.is_open())
return;
272 std::ostringstream ost;
273 ost <<
id <<
"/" << key;
276 kk = idname +
"/" + key;
279 DataMap::iterator itr;
282 if (itr !=
m_read.end()) {
283 itr->second.insert(std::move(kk));
290 itr->second.insert(std::move(kk));
308 std::string name = asdf->name();
314 std::vector<std::string>::iterator i;
336 std::vector<std::string>::iterator i;
361 std::pair<int,int> p(oaHash,1);
376 std::pair<int,int> p(oaHash,1);
397 DataMap::const_iterator itr;
398 std::set<std::string>::const_iterator it2;
399 std::vector<std::string>::const_iterator ia;
401 m_ofs <<
"{ \"algorithms\" : [" << std::endl;
403 m_ofs <<
" {" << std::endl;
404 m_ofs <<
" \"name\" : \"" << *ia <<
"\"," << std::endl;
405 m_ofs <<
" \"inputs\" : [";
408 if (itr !=
m_read.end()) {
409 for (it2 = itr->second.begin(); it2 != itr->second.end(); ++it2) {
410 if (it2 != itr->second.begin())
m_ofs <<
",";
411 m_ofs <<
"\"" << *it2 <<
"\"";
414 m_ofs <<
"]," << std::endl;
416 m_ofs <<
" \"outputs\" : [";
420 for (it2 = itr->second.begin(); it2 != itr->second.end(); ++it2) {
421 if (it2 != itr->second.begin())
m_ofs <<
",";
422 m_ofs <<
"\"" << *it2 <<
"\"";
425 m_ofs <<
"]," << std::endl;
426 m_ofs <<
" }," << std::endl;
428 m_ofs <<
" ]" << std::endl <<
"}" << std::endl;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
uint32_t CLID
The Class ID type.
Gaudi::Property< std::string > m_outFileName
std::string m_fakeCurrAlg
virtual void setFakeCurrentAlg(const std::string &) override
For implementing custom increased granularity auditing of for instance tools.
std::map< int, int > m_timesWritten
map counting Writes of each object by each algorithm.
void SGAudRECORD(std::string SGobject)
std::map< int, int > m_timesRead
map counting Reads of each object by each algorithm.
virtual void SGAudit(const std::string &key, const CLID &id, const int &fnc, const int &store_id) override
void monitor()
just counts events. called at EndEvent incident
bool SGGetCurrentAlg()
Gets name of curently running algorithm from AlgContextSvc.
void SGAudRETRIEVE(std::string SGobject)
Gaudi::Property< bool > m_useCLID
virtual StatusCode initialize() override
Gaudi Service Implementation.
SGAudSvc()
Default constructor:
virtual void clearFakeCurrentAlg() override
For implementing custom increased granularity auditing of for instance tools.
ServiceHandle< IClassIDSvc > m_pCID
std::vector< std::string > m_vAlg
Vector of names of algorithms accessing SG.
Gaudi::Property< std::string > m_sumFileName
virtual void handle(const Incident &incident) override
incident service handle for EndEvent.
Gaudi::Property< int > m_startEvent
void getNobj(const std::string &name)
virtual StatusCode finalize() override
Gaudi::Property< bool > m_ignoreFakeAlgs
std::vector< std::string > m_vObj
Vector of accessed SG objects names.
Gaudi::Property< std::string > m_allFileName
ServiceHandle< IAlgContextSvc > p_algCtxSvc
Pointer to the AlgContextScv.