|
ATLAS Offline Software
|
Go to the documentation of this file.
21 #include "Gaudi/Property.h"
22 #include "GaudiKernel/IIncidentSvc.h"
23 #include "GaudiKernel/Incident.h"
24 #include "GaudiKernel/IAlgContextSvc.h"
40 base_class (
name, pSvcLocator ),
42 p_algCtxSvc(
"AlgContextSvc",
name),
43 m_pCID(
"ClassIDSvc",
name),
47 m_nEvents(0), m_startEvent(3), m_inExec(false)
52 declareProperty(
"OutFileName",
m_outFileName =
"SGAudSvc.out",
53 "Name of the output file to hold SGAudSvc data" );
56 "Name of the output file to hold the full SG aud data");
59 "Name of the output file to hold the summary output in json format");
62 "Set to ignore any attempts to override current-alg" );
65 "Event number to start recording data" );
67 declareProperty(
"UseCLID",
m_useCLID =
true,
68 "Use CLID or DataObj name in Summary File" );
87 m_msg.setLevel( m_outputLevel.value() );
92 m_msg << MSG::ERROR <<
"Could not intialize base class !!" <<
endmsg;
93 return StatusCode::FAILURE;
111 incSvc->addListener(
this, IncidentType::BeginRun );
112 incSvc->addListener(
this, IncidentType::BeginEvent );
113 incSvc->addListener(
this, IncidentType::EndEvent );
115 return StatusCode::SUCCESS;
126 m_msg << MSG::WARNING<<
"No data gathered. This might be because you did not run over at least 3 events."<<
endmsg;
127 return StatusCode::SUCCESS;
133 f <<
"Algs: " <<
m_vAlg.size() << std::endl;
136 f << (*i) << std::endl;
139 f <<
"Obj: "<<
m_vObj.size()<<std::endl;
141 f << (*i) << std::endl;
145 for (
unsigned int w=0;
w<
m_vAlg.size();
w++){
146 for(
unsigned int q=0;
q<
m_vObj.size();
q++){
147 int oaHash=
q*1000 +
w;
164 if (
m_ofs.is_open()) {
172 return StatusCode::SUCCESS;
182 <<
" Incidence type: " << inc.type() <<
endmsg
183 <<
" from: " << inc.source() <<
endmsg;
186 if (inc.type() == IncidentType::BeginEvent) {
188 m_ofa <<
"---- BEGIN EVENT " <<
m_nEvents <<
" ----" << std::endl;
194 if ( inc.type() == IncidentType::EndEvent ) {
207 if ( inc.type() == IncidentType::BeginRun ) {
239 if (SGobject==
"") SGobject=
"noKey";
241 for (
unsigned int i = 0;
i < SGobject.length();
i++)
242 if (!std::isdigit(SGobject[
i])){
263 if (SGobject==
"") SGobject=
"noKey";
264 for (
unsigned int i = 0;
i < SGobject.length();
i++)
265 if (!std::isdigit(SGobject[
i])){
283 const int& typ,
const int& store_id) {
286 if (
m_pCID == 0) {
return; }
301 if( !
m_pCID->getTypeNameOfID(
id,idname).isSuccess()) {
302 std::ostringstream
ost;
308 if (
m_ofa.is_open()) {
309 m_ofa << ( (typ == 1) ?
"RECORD" :
"RETRIEVE" ) <<
" clid: " <<
id
315 <<
" store: " << store_id
321 if (!
m_ofs.is_open())
return;
329 std::ostringstream
ost;
333 kk = idname +
"/" +
key;
339 if (itr !=
m_read.end()) {
340 itr->second.insert(
kk);
347 itr->second.insert(
kk);
365 std::string
name = asdf->name();
418 std::pair<int,int>
p(oaHash,1);
433 std::pair<int,int>
p(oaHash,1);
454 DataMap::const_iterator itr;
455 std::set<std::string>::const_iterator it2;
456 std::vector<std::string>::const_iterator ia;
458 m_ofs <<
"{ \"algorithms\" : [" << std::endl;
460 m_ofs <<
" {" << std::endl;
461 m_ofs <<
" \"name\" : \"" << *ia <<
"\"," << std::endl;
462 m_ofs <<
" \"inputs\" : [";
465 if (itr !=
m_read.end()) {
466 for (it2 = itr->second.begin(); it2 != itr->second.end(); ++it2) {
467 if (it2 != itr->second.begin())
m_ofs <<
",";
468 m_ofs <<
"\"" << *it2 <<
"\"";
471 m_ofs <<
"]," << std::endl;
473 m_ofs <<
" \"outputs\" : [";
477 for (it2 = itr->second.begin(); it2 != itr->second.end(); ++it2) {
478 if (it2 != itr->second.begin())
m_ofs <<
",";
479 m_ofs <<
"\"" << *it2 <<
"\"";
482 m_ofs <<
"]," << std::endl;
483 m_ofs <<
" }," << std::endl;
485 m_ofs <<
" ]" << std::endl <<
"}" << std::endl;
JetConstituentVector::iterator iterator
bool SGGetCurrentAlg()
Gets name of curently running algorithm from AlgContextSvc.
ServiceHandle< IClassIDSvc > m_pCID
std::map< int, int > m_timesWritten
map counting Writes of each object by each algorithm.
std::string m_sumFileName
void monitor()
just counts events. called at EndEvent incident
void SGAudRECORD(std::string SGobject)
virtual void clearFakeCurrentAlg() override
For implementing custom increased granularity auditing of for instance tools.
SGAudSvc()
Default constructor:
virtual StatusCode initialize() override
Gaudi Service Implementation.
void getNobj(std::string name)
bool m_useCLID
Whether to use CLID or Data Obj Name in JSON output file.
virtual StatusCode finalize() override
virtual void handle(const Incident &incident) override
incident service handle for EndEvent.
bool m_ignoreFakeAlgs
Whether to ignore fake current algs.
virtual void setFakeCurrentAlg(const std::string &) override
For implementing custom increased granularity auditing of for instance tools.
std::map< int, int > m_timesRead
map counting Reads of each object by each algorithm.
msgSvc
Provide convenience handles for various services.
std::string m_outFileName
Name of the output file.
::StatusCode StatusCode
StatusCode definition for legacy code.
virtual void SGAudit(const std::string &key, const CLID &id, const int &fnc, const int &store_id) override
void SGAudRETRIEVE(std::string SGobject)
std::vector< std::string > m_vAlg
Vector of names of algorithms accessing SG.
uint32_t CLID
The Class ID type.
virtual ~SGAudSvc()
Destructor:
std::string m_allFileName
MsgStream m_msg
MsgStream for talking with the outside world.
ServiceHandle< IAlgContextSvc > p_algCtxSvc
Pointer to the AlgContextScv.
std::vector< std::string > m_vObj
Vector of accessed SG objects names.
std::string m_fakeCurrAlg