ATLAS Offline Software
TrkEDMTestAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //<<<<<< INCLUDES >>>>>>
7 
8 TrkEDMTestAlg::TrkEDMTestAlg(const std::string& name, ISvcLocator* pSvcLocator)
9 :
10  AthAlgorithm(name, pSvcLocator),
11  m_eventNum(0),
12  m_numDetailedWarnings(0)
13 {
14  declareProperty("DoDumpSummaryToFile", m_dumpSummaryToFile=true);
15  declareProperty("SummaryDumpFileName", m_summaryDumpFileName="TrkEDMTestAlg.summary.log");
16  declareProperty("DoDumpToFile", m_dumpToFile=true);
17  declareProperty("DoDumpToMsgStream", m_dumpToMsg=false);
18  declareProperty("DoDetailedChecks", m_doDetailedChecks=false);
19 }
20 
21 //--------------------------------------------------------------------------
23 = default;
24 
25 //-----------------------------------------------------------------------
28 {
29  // summary is special (normally want to write it)
30  if (m_dumpSummaryToFile) {
33  }
34 
35  return AthAlgorithm::initialize();
36 }
37 
38 //-------------------------------------------------------------------------
41 {
42  ++m_eventNum;
43  return runTest();
44 }
45 
46 //---------------------------------------------------------------------------
47 
50 {
51  ATH_MSG_INFO("Number of events processed = "<<m_eventNum);
52  if (m_numDetailedWarnings>0) ATH_MSG_ERROR(" Found "<<m_numDetailedWarnings<<" problems! Please check log for more details.");
53 
54  if (m_dumpSummaryToFile) m_summaryFileOutput <<"Summary"<<std::endl<<"-------"<<std::endl;
55 
56  for (const auto & [SGKey, objCount] : m_numContsFound ) {
57  const int numberOfObjects = m_numConstObjsFound[SGKey];
58  ATH_MSG_INFO("Found :"<<objCount<<" \t at "<<SGKey<<", with "<<numberOfObjects<<" total contained objects.");
60  m_summaryFileOutput <<"Found :"<<objCount<<" \t at "<<SGKey<<", with "<<numberOfObjects<<" total contained objects."<<std::endl;
61  }
62  }
64  if (m_doDetailedChecks) m_summaryFileOutput<<"Detailed tests found : "<<m_numDetailedWarnings<<" problems.";
65  m_summaryFileOutput.close();
66  }
67 
68  return StatusCode::SUCCESS;
69 }
TrkEDMTestAlg::~TrkEDMTestAlg
~TrkEDMTestAlg()
TrkEDMTestAlg::TrkEDMTestAlg
TrkEDMTestAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrkEDMTestAlg.cxx:8
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
initialize
void initialize()
Definition: run_EoverP.cxx:894
TrkEDMTestAlg::m_dumpToMsg
bool m_dumpToMsg
Definition: TrkEDMTestAlg.h:64
TrkEDMTestAlg::m_dumpSummaryToFile
bool m_dumpSummaryToFile
Definition: TrkEDMTestAlg.h:66
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
TrkEDMTestAlg::m_summaryFileOutput
std::ofstream m_summaryFileOutput
Definition: TrkEDMTestAlg.h:69
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TrkEDMTestAlg::m_numDetailedWarnings
unsigned int m_numDetailedWarnings
Count of detailed warning found.
Definition: TrkEDMTestAlg.h:72
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TrkEDMTestAlg::m_eventNum
unsigned int m_eventNum
numbers of event
Definition: TrkEDMTestAlg.h:62
TrkEDMTestAlg::m_dumpToFile
bool m_dumpToFile
Definition: TrkEDMTestAlg.h:65
AthAlgorithm
Definition: AthAlgorithm.h:47
TrkEDMTestAlg.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrkEDMTestAlg::m_numConstObjsFound
std::map< std::string, unsigned int > m_numConstObjsFound
Definition: TrkEDMTestAlg.h:78
TrkEDMTestAlg::m_summaryDumpFileName
std::string m_summaryDumpFileName
Definition: TrkEDMTestAlg.h:68
TrkEDMTestAlg::m_doDetailedChecks
bool m_doDetailedChecks
If true, try to examine the PRDs etc in detail and catch any errors.
Definition: TrkEDMTestAlg.h:71
TrkEDMTestAlg::finalize
StatusCode finalize()
Definition: TrkEDMTestAlg.cxx:49
TrkEDMTestAlg::initialize
StatusCode initialize()
Definition: TrkEDMTestAlg.cxx:27
TrkEDMTestAlg::m_numContsFound
std::map< std::string, unsigned int > m_numContsFound
Definition: TrkEDMTestAlg.h:75
TrkEDMTestAlg::runTest
virtual StatusCode runTest()=0
TrkEDMTestAlg::execute
StatusCode execute()
Definition: TrkEDMTestAlg.cxx:40