ATLAS Offline Software
TileTopCalibAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "TileTopCalibAlg.h"
6 
7 // ROOT includes
8 #include "TFile.h"
9 
16 TileTopCalibAlg::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 
32 {
33 }
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 retrive 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 
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 
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 
86 {
87  ATH_MSG_INFO ( "in finalize()" );
88 
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 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TileTopCalibAlg::initialize
StatusCode initialize()
Initialize algorithm.
Definition: TileTopCalibAlg.cxx:38
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
TileTopCalibAlg::m_runType
int m_runType
Run type.
Definition: TileTopCalibAlg.h:46
TileTopCalibAlg::m_rootFile
TFile * m_rootFile
Pointer to the ROOT file.
Definition: TileTopCalibAlg.h:62
TileTopCalibAlg::TileTopCalibAlg
TileTopCalibAlg(const std::string &name, ISvcLocator *pSvcLocator)
Standard constructor.
Definition: TileTopCalibAlg.cxx:16
TileTopCalibAlg.h
TileTopCalibAlg::m_runNumber
int m_runNumber
Run number.
Definition: TileTopCalibAlg.h:41
TileTopCalibAlg::execute
StatusCode execute()
Execute.
Definition: TileTopCalibAlg.cxx:66
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthAlgorithm
Definition: AthAlgorithm.h:47
TileTopCalibAlg::m_fileName
std::string m_fileName
Name of output file with ntuples.
Definition: TileTopCalibAlg.h:51
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TileTopCalibAlg::~TileTopCalibAlg
virtual ~TileTopCalibAlg()
Destructor.
Definition: TileTopCalibAlg.cxx:31
TileTopCalibAlg::m_tileCalibToolList
ToolHandleArray< ITileCalibTool > m_tileCalibToolList
Vector of algtools to call.
Definition: TileTopCalibAlg.h:56
TileTopCalibAlg::finalize
StatusCode finalize()
Finalize.
Definition: TileTopCalibAlg.cxx:85