ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TileCalorimeter
TileCalib
TileCalibAlgs
src
TileLaserCalibAlg.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
// Gaudi includes
6
#include "GaudiKernel/ISvcLocator.h"
7
8
// Athena includes
9
#include "
ByteStreamCnvSvcBase/ROBDataProviderSvc.h
"
10
#include "
AthenaKernel/errorcheck.h
"
11
12
13
// Tile includes
14
#include "
TileLaserCalibAlg.h
"
15
16
#include "TFile.h"
17
#include <iostream>
18
19
/****************************************************/
20
/* TileLaserCalibAlg.cxx March 5th 2008 */
21
/* */
22
/* M.Cascella michele.cascella@cern.ch */
23
/* I.Vivarelli iacopo.vivarelli@cern.ch */
24
/* A.Dotti andrea.dotti@cern.ch */
25
/* */
26
/* S. Viret (25/06/2008) : */
27
/* Code cleaning to fit with the new */
28
/* conditions stuff */
29
/****************************************************/
30
31
TileLaserCalibAlg::TileLaserCalibAlg
(
const
std::string& name, ISvcLocator* pSvcLocator)
32
:
AthAlgorithm
(name, pSvcLocator)
33
,
m_RobSvc
(
"ROBDataProviderSvc"
, name)
34
,
m_outfile
(nullptr)
35
,
m_fileName
(
"LaserCalib.root"
)
36
,
m_runNo
(0)
37
,
m_runType
(0)
38
{
39
40
declareProperty
(
"FileName"
,
m_fileName
);
41
}
42
43
TileLaserCalibAlg::~TileLaserCalibAlg
() {
44
}
45
47
49
50
StatusCode
TileLaserCalibAlg::initialize
() {
51
52
ATH_MSG_INFO
(
"Initializing TileLaserCalibAlg"
);
53
54
// Find necessary services
55
CHECK
(
m_RobSvc
.retrieve() );
56
57
m_runNo
= 0;
58
60
CHECK
(
m_lasTools
.retrieve() );
61
63
lastools_t::iterator fTool =
m_lasTools
.begin();
64
for
(; fTool !=
m_lasTools
.end(); ++fTool) {
65
CHECK
( (*fTool)->initialize() );
66
}
67
68
return
StatusCode::SUCCESS;
69
}
70
72
73
StatusCode
TileLaserCalibAlg::execute
(
const
EventContext& ctx) {
74
75
ATH_MSG_DEBUG
(
"Running on execute! TileLaserCalibAlg"
);
76
77
// Get the run number and type once for all
78
auto
event
=
m_RobSvc
->getEvent(ctx);
79
80
if
(
m_runNo
== 0) {
81
m_runNo
=
static_cast<
uint32_t
>
(
event
->run_no());
82
m_runType
=
static_cast<
uint32_t
>
(
event
->run_type());
83
}
84
85
// Then check that we are dealing with a LASER event
86
//
87
// If run_type is 0,1 or 2, the correct trigger type (52) should be there
88
// If run_type is 15 (Test) trigger type is not available
89
90
int
trig_type =
static_cast<
uint32_t
>
(
event
->lvl1_trigger_type());
91
92
if
(trig_type != 52 &&
m_runType
!= 15) {
93
ATH_MSG_DEBUG
(
"This is not a LASER event : skip it !!"
);
94
return
StatusCode::SUCCESS;
95
}
96
98
99
lastools_t::iterator fTool =
m_lasTools
.begin();
100
101
for
(; fTool !=
m_lasTools
.end(); ++fTool) {
102
CHECK
( (*fTool)->execute() );
103
}
104
105
return
StatusCode::SUCCESS;
106
}
107
109
110
StatusCode
TileLaserCalibAlg::finalize
() {
111
112
ATH_MSG_INFO
(
"Finalizing TileLaserCalibAlg"
);
113
114
// Writing the corresponding ROOTfile
115
m_outfile
=
new
TFile(
m_fileName
.c_str(),
"recreate"
);
116
118
119
lastools_t::iterator fTool =
m_lasTools
.begin();
120
121
for
(; fTool !=
m_lasTools
.end(); ++fTool) {
122
CHECK
( (*fTool)->finalizeCalculations() );
// Perform the calibration
123
CHECK
( (*fTool)->writeNtuple(
m_runNo
, 2,
m_outfile
) );
// Fill the nTuple
124
}
125
126
m_outfile
->Write();
127
m_outfile
->Close();
128
129
return
StatusCode::SUCCESS;
130
}
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
ROBDataProviderSvc.h
TileLaserCalibAlg.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
TileLaserCalibAlg::m_runNo
int m_runNo
Definition
TileLaserCalibAlg.h:57
TileLaserCalibAlg::m_runType
int m_runType
Definition
TileLaserCalibAlg.h:58
TileLaserCalibAlg::m_outfile
TFile * m_outfile
Definition
TileLaserCalibAlg.h:46
TileLaserCalibAlg::execute
StatusCode execute(const EventContext &ctx)
Execute method.
Definition
TileLaserCalibAlg.cxx:73
TileLaserCalibAlg::initialize
StatusCode initialize()
implementing the Gaudi Hooks
Definition
TileLaserCalibAlg.cxx:50
TileLaserCalibAlg::~TileLaserCalibAlg
virtual ~TileLaserCalibAlg()
Definition
TileLaserCalibAlg.cxx:43
TileLaserCalibAlg::m_lasTools
lastools_t m_lasTools
Definition
TileLaserCalibAlg.h:36
TileLaserCalibAlg::m_fileName
std::string m_fileName
Definition
TileLaserCalibAlg.h:47
TileLaserCalibAlg::m_RobSvc
ServiceHandle< IROBDataProviderSvc > m_RobSvc
Definition
TileLaserCalibAlg.h:39
TileLaserCalibAlg::finalize
StatusCode finalize()
Definition
TileLaserCalibAlg.cxx:110
TileLaserCalibAlg::TileLaserCalibAlg
TileLaserCalibAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
TileLaserCalibAlg.cxx:31
Generated on
for ATLAS Offline Software by
1.17.0