|
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"
42 p_algCtxSvc(0), m_pCID(0), m_useCLID(true),
45 m_nEvents(0), m_startEvent(3), m_inExec(false)
51 "Name of the output file to hold SGAudSvc data" );
54 "Name of the output file to hold the full SG aud data");
57 "Name of the output file to hold the summary output in json format");
60 "Set to ignore any attempts to override current-alg" );
63 "Event number to start recording data" );
66 "Use CLID or DataObj name in Summary File" );
85 m_msg.setLevel( m_outputLevel.value() );
90 m_msg << MSG::ERROR <<
"Could not intialize base class !!" <<
endmsg;
91 return StatusCode::FAILURE;
94 static const bool CREATEIF(
true);
96 if ( service(
"AlgContextSvc",
p_algCtxSvc,CREATEIF).isFailure() ) {
97 m_msg << MSG::ERROR <<
"Unable to retrieve the AlgContextSvc" <<
endmsg;
98 return StatusCode::FAILURE;
103 if ( service(
"ClassIDSvc",
m_pCID,CREATEIF).isFailure() ) {
104 m_msg << MSG::ERROR <<
"Unable to retrieve the ClassIDSvc" <<
endmsg;
105 return StatusCode::FAILURE;
118 if ( !incSvc.retrieve().isSuccess() ) {
119 m_msg << MSG::ERROR <<
"Unable to get the IncidentSvc" <<
endmsg;
120 return StatusCode::FAILURE;
122 incSvc->addListener(
this, IncidentType::BeginRun );
123 incSvc->addListener(
this, IncidentType::BeginEvent );
124 incSvc->addListener(
this, IncidentType::EndEvent );
126 return StatusCode::SUCCESS;
137 m_msg << MSG::WARNING<<
"No data gathered. This might be because you did not run over at least 3 events."<<
endmsg;
138 return StatusCode::SUCCESS;
144 f <<
"Algs: " <<
m_vAlg.size() << std::endl;
147 f << (*i) << std::endl;
150 f <<
"Obj: "<<
m_vObj.size()<<std::endl;
152 f << (*i) << std::endl;
156 for (
unsigned int w=0;
w<
m_vAlg.size();
w++){
157 for(
unsigned int q=0;
q<
m_vObj.size();
q++){
158 int oaHash=
q*1000 +
w;
175 if (
m_ofs.is_open()) {
183 return StatusCode::SUCCESS;
193 *ppvInterface =
dynamic_cast<ISGAudSvc*
>(
this);
196 return AthService::queryInterface(riid, ppvInterface);
199 return StatusCode::SUCCESS;
217 <<
" Incidence type: " << inc.type() <<
endmsg
218 <<
" from: " << inc.source() <<
endmsg;
221 if (inc.type() == IncidentType::BeginEvent) {
223 m_ofa <<
"---- BEGIN EVENT " <<
m_nEvents <<
" ----" << std::endl;
229 if ( inc.type() == IncidentType::EndEvent ) {
242 if ( inc.type() == IncidentType::BeginRun ) {
274 if (SGobject==
"") SGobject=
"noKey";
276 for (
unsigned int i = 0;
i < SGobject.length();
i++)
277 if (!std::isdigit(SGobject[
i])){
298 if (SGobject==
"") SGobject=
"noKey";
299 for (
unsigned int i = 0;
i < SGobject.length();
i++)
300 if (!std::isdigit(SGobject[
i])){
318 const int& typ,
const int& store_id) {
321 if (
m_pCID == 0) {
return; }
336 if( !
m_pCID->getTypeNameOfID(
id,idname).isSuccess()) {
337 std::ostringstream
ost;
343 if (
m_ofa.is_open()) {
344 m_ofa << ( (typ == 1) ?
"RECORD" :
"RETRIEVE" ) <<
" clid: " <<
id
350 <<
" store: " << store_id
356 if (!
m_ofs.is_open())
return;
364 std::ostringstream
ost;
368 kk = idname +
"/" +
key;
374 if (itr !=
m_read.end()) {
375 itr->second.insert(
kk);
382 itr->second.insert(
kk);
400 std::string
name = asdf->name();
453 std::pair<int,int>
p(oaHash,1);
468 std::pair<int,int>
p(oaHash,1);
489 DataMap::const_iterator itr;
490 std::set<std::string>::const_iterator it2;
491 std::vector<std::string>::const_iterator ia;
493 m_ofs <<
"{ \"algorithms\" : [" << std::endl;
495 m_ofs <<
" {" << std::endl;
496 m_ofs <<
" \"name\" : \"" << *ia <<
"\"," << std::endl;
497 m_ofs <<
" \"inputs\" : [";
500 if (itr !=
m_read.end()) {
501 for (it2 = itr->second.begin(); it2 != itr->second.end(); ++it2) {
502 if (it2 != itr->second.begin())
m_ofs <<
",";
503 m_ofs <<
"\"" << *it2 <<
"\"";
506 m_ofs <<
"]," << std::endl;
508 m_ofs <<
" \"outputs\" : [";
512 for (it2 = itr->second.begin(); it2 != itr->second.end(); ++it2) {
513 if (it2 != itr->second.begin())
m_ofs <<
",";
514 m_ofs <<
"\"" << *it2 <<
"\"";
517 m_ofs <<
"]," << std::endl;
518 m_ofs <<
" }," << std::endl;
520 m_ofs <<
" ]" << std::endl <<
"}" << std::endl;
JetConstituentVector::iterator iterator
bool SGGetCurrentAlg()
Gets name of curently running algorithm from AlgContextSvc.
StatusCode initialize()
Gaudi Service Implementation.
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)
SGAudSvc()
Default constructor:
void getNobj(std::string name)
bool m_useCLID
Whether to use CLID or Data Obj Name in JSON output file.
bool m_ignoreFakeAlgs
Whether to ignore fake current algs.
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.
static const InterfaceID & interfaceID()
::StatusCode StatusCode
StatusCode definition for legacy code.
void clearFakeCurrentAlg()
For implementing custom increased granularity auditing of for instance tools.
void setFakeCurrentAlg(const std::string &)
For implementing custom increased granularity auditing of for instance tools.
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 StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
virtual ~SGAudSvc()
Destructor:
std::string m_allFileName
MsgStream m_msg
MsgStream for talking with the outside world.
virtual void SGAudit(const std::string &key, const CLID &id, const int &fnc, const int &store_id)
IAlgContextSvc * p_algCtxSvc
Pointer to the AlgContextScv.
std::vector< std::string > m_vObj
Vector of accessed SG objects names.
std::string m_fakeCurrAlg
void handle(const Incident &incident)
incident service handle for EndEvent.