ATLAS Offline Software
Loading...
Searching...
No Matches
TileTopCalibAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "TileTopCalibAlg.h"
6
7// ROOT includes
8#include "TFile.h"
9
15
16TileTopCalibAlg::TileTopCalibAlg(const std::string& name, ISvcLocator* pSvcLocator)
17 : AthAlgorithm(name, pSvcLocator)
18 , m_runNumber(0)
19 , m_runType(0)
20 , m_fileName("TileCalibNtuple.root")
21 , m_rootFile(nullptr)
22{
23 declareProperty("RunNumber", m_runNumber=0);
24 declareProperty("RunType", m_runType=0);
25 declareProperty("FileName",m_fileName="TileCalibNtuple.root");
26}
27
34
39{
40 ATH_MSG_DEBUG ( "in initialize()" );
41
42 ATH_MSG_DEBUG ( "Run number set to " << m_runNumber );
43 ATH_MSG_DEBUG ( "Run type set to " << m_runType );
44 ATH_MSG_DEBUG ( "Output file set to " << m_fileName );
45 ATH_MSG_DEBUG ( "starting to retrieve list " << m_tileCalibToolList );
46 ATH_CHECK( m_tileCalibToolList.retrieve() );
47 ATH_MSG_DEBUG ( m_tileCalibToolList << "retrieved");
48
49 // Create output root file, one file for all tools
50 m_rootFile = new TFile(m_fileName.c_str(), "recreate");
51
52 ToolHandleArray< ITileCalibTool >::iterator itTool = m_tileCalibToolList.begin();
53 ToolHandleArray< ITileCalibTool >::iterator itToolEnd = m_tileCalibToolList.end();
54
55 for ( ; itTool != itToolEnd; ++itTool ) {
56 ATH_CHECK( (*itTool)->initNtuple(m_runNumber,m_runType,m_rootFile) );
57 }
58
59 ATH_MSG_INFO ( "initialization completed successfully" );
60 return StatusCode::SUCCESS;
61}
62
67{
68 ATH_MSG_DEBUG ( "in execute()" );
69
70 ToolHandleArray< ITileCalibTool >::iterator itTool = m_tileCalibToolList.begin();
71 ToolHandleArray< ITileCalibTool >::iterator itToolEnd = m_tileCalibToolList.end();
72
73 for ( ; itTool != itToolEnd; ++itTool ) {
74 ATH_CHECK( (*itTool)->execute() );
75 }
76
77 ATH_MSG_INFO ( "execute completed successfully" );
78 return StatusCode::SUCCESS;
79}
80
84StatusCode
86{
87 ATH_MSG_INFO ( "in finalize()" );
88
89 ToolHandleArray< ITileCalibTool >::iterator itTool = m_tileCalibToolList.begin();
90 ToolHandleArray< ITileCalibTool >::iterator itToolEnd = m_tileCalibToolList.end();
91
92 for ( ; itTool != itToolEnd; ++itTool ) {
93 ATH_CHECK( (*itTool)->finalizeCalculations() );
94 m_rootFile->cd();
95 ATH_CHECK((*itTool)->writeNtuple(m_runNumber,m_runType,m_rootFile) );
96 }
97
98 m_rootFile->Close();
99
100 ATH_MSG_INFO ( "finalize completed successfully" );
101 return StatusCode::SUCCESS;
102}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
int m_runNumber
Run number.
virtual ~TileTopCalibAlg()
Destructor.
std::string m_fileName
Name of output file with ntuples.
int m_runType
Run type.
StatusCode execute()
Execute.
TileTopCalibAlg(const std::string &name, ISvcLocator *pSvcLocator)
Standard constructor.
StatusCode finalize()
Finalize.
StatusCode initialize()
Initialize algorithm.
TFile * m_rootFile
Pointer to the ROOT file.
ToolHandleArray< ITileCalibTool > m_tileCalibToolList
Vector of algtools to call.