ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TileCalorimeter
TileL2Algs
src
TileMuRODToNtuple.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
//*****************************************************************************
6
// Filename : TileMuRODToNtuple.cxx
7
// Author : Aranzazu Ruiz
8
// Created : March 2006
9
//
10
// DESCRIPTION:
11
// Implementation comments only. Class level comments go in .h file.
12
//
13
// HISTORY:
14
//
15
// BUGS:
16
//
17
//
18
//*****************************************************************************
19
20
// Tile includes
21
#include "
TileL2Algs/TileMuRODToNtuple.h
"
22
23
// Athena includes
24
#include "
AthenaKernel/errorcheck.h
"
25
#include "
StoreGate/ReadHandle.h
"
26
27
// Gaudi includes
28
#include "GaudiKernel/INTupleSvc.h"
29
#include "GaudiKernel/IDataProviderSvc.h"
30
#include "GaudiKernel/SmartDataPtr.h"
31
32
33
TileMuRODToNtuple::TileMuRODToNtuple
(
const
std::string& name, ISvcLocator* pSvcLocator)
34
:
AthAlgorithm
(name, pSvcLocator)
35
,
m_ntuplePtr
(0)
36
,
m_ntupleID
(100)
37
,
m_maxNMuons
(50)
38
,
m_close
(1)
39
,
m_ntupleLoc
(
"/FILE1/TileMuRODTag"
)
40
{
41
declareProperty
(
"NTupleLoc"
,
m_ntupleLoc
);
42
declareProperty
(
"NTupleID"
,
m_ntupleID
);
43
declareProperty
(
"MaxNMuons"
,
m_maxNMuons
);
44
declareProperty
(
"CloseNtuple"
,
m_close
);
45
}
46
47
TileMuRODToNtuple::~TileMuRODToNtuple
() {
48
}
49
50
StatusCode
TileMuRODToNtuple::initialize
() {
51
52
m_ntupleLoc
=
"/NTUPLES/FILE1/TileMuRODTag"
;
53
54
SmartDataPtr<NTuple::Directory> DirPtr(
ntupleSvc
(),
m_ntupleLoc
);
55
if
(!DirPtr) DirPtr =
ntupleSvc
()->createDirectory(
m_ntupleLoc
);
56
57
if
(!DirPtr) {
58
ATH_MSG_ERROR
(
"Invalid Ntuple Directory: "
<<
m_ntupleLoc
);
59
return
StatusCode::FAILURE;
60
}
61
62
m_ntuplePtr
=
ntupleSvc
()->book(DirPtr.ptr(),
m_ntupleID
, CLID_ColumnWiseTuple
63
,
"TileMuRODTag-Ntuple"
);
64
65
if
(!
m_ntuplePtr
) {
66
ATH_MSG_ERROR
(
"Failed to book ntuple: TileMuRODTagNtuple"
);
67
return
StatusCode::FAILURE;
68
}
69
70
CHECK
(
m_ntuplePtr
->addItem(
"TileMuROD/NMuons"
,
m_ntag
, 0,
m_maxNMuons
));
71
CHECK
(
m_ntuplePtr
->addItem(
"TileMuROD/EtaMuons"
,
m_ntag
,
m_eta
, -1.5, 1.5));
72
CHECK
(
m_ntuplePtr
->addItem(
"TileMuROD/PhiMuons"
,
m_ntag
,
m_phi
, 0., 6.3));
73
74
ATH_CHECK
(
m_l2ContainerKey
.initialize() );
75
76
ATH_MSG_INFO
(
"Initialization completed"
);
77
78
return
StatusCode::SUCCESS;
79
}
80
81
StatusCode
TileMuRODToNtuple::execute
(
const
EventContext& ctx) {
82
83
// step1: read from TDS
84
SG::ReadHandle<TileL2Container>
l2Container(
m_l2ContainerKey
, ctx);
85
ATH_CHECK
( l2Container.
isValid
() );
86
87
m_ntag
= 0;
88
for
(
const
TileL2
* l2 : *l2Container) {
89
for
(
unsigned
int
a
= 0;
a
< l2->NMuons(); ++
a
) {
90
m_eta
[
m_ntag
] = l2->eta(
a
);
91
m_phi
[
m_ntag
] = l2->phi(
a
);
92
m_ntag
++;
93
}
94
if
(
m_ntag
>=
m_maxNMuons
)
break
;
95
}
96
97
if
(
m_close
== 1) {
98
CHECK
(
ntupleSvc
()->writeRecord(
m_ntuplePtr
) );
99
}
100
101
ATH_MSG_DEBUG
(
"execute() completed successfully"
);
102
103
return
StatusCode::SUCCESS;
104
}
105
106
StatusCode
TileMuRODToNtuple::finalize
() {
107
108
ATH_MSG_INFO
(
"finalize() successfully"
);
109
110
return
StatusCode::SUCCESS;
111
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
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
a
static Double_t a
Definition
LArPhysWaveHECTool.cxx:38
ntupleSvc
INTupleSvc * ntupleSvc()
Definition
ServiceAccessor.h:14
ReadHandle.h
Handle class for reading from StoreGate.
TileMuRODToNtuple.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
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TileL2
Class to store TileMuId and Et quantities computed at the TileCal ROD DSPs.
Definition
TileL2.h:33
TileMuRODToNtuple::m_close
int m_close
Definition
TileMuRODToNtuple.h:61
TileMuRODToNtuple::execute
StatusCode execute(const EventContext &ctx)
Execute method.
Definition
TileMuRODToNtuple.cxx:81
TileMuRODToNtuple::m_ntupleID
int m_ntupleID
Definition
TileMuRODToNtuple.h:59
TileMuRODToNtuple::m_ntupleLoc
std::string m_ntupleLoc
Definition
TileMuRODToNtuple.h:62
TileMuRODToNtuple::m_ntuplePtr
NTuple::Tuple * m_ntuplePtr
Definition
TileMuRODToNtuple.h:58
TileMuRODToNtuple::initialize
StatusCode initialize()
Definition
TileMuRODToNtuple.cxx:50
TileMuRODToNtuple::finalize
StatusCode finalize()
Definition
TileMuRODToNtuple.cxx:106
TileMuRODToNtuple::m_phi
NTuple::Array< float > m_phi
Definition
TileMuRODToNtuple.h:69
TileMuRODToNtuple::TileMuRODToNtuple
TileMuRODToNtuple(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
TileMuRODToNtuple.cxx:33
TileMuRODToNtuple::m_eta
NTuple::Array< float > m_eta
Definition
TileMuRODToNtuple.h:68
TileMuRODToNtuple::m_maxNMuons
int m_maxNMuons
Definition
TileMuRODToNtuple.h:60
TileMuRODToNtuple::m_l2ContainerKey
SG::ReadHandleKey< TileL2Container > m_l2ContainerKey
TileL2Container in detector store.
Definition
TileMuRODToNtuple.h:75
TileMuRODToNtuple::m_ntag
NTuple::Item< int > m_ntag
Definition
TileMuRODToNtuple.h:64
TileMuRODToNtuple::~TileMuRODToNtuple
virtual ~TileMuRODToNtuple()
Destructor.
Definition
TileMuRODToNtuple.cxx:47
Generated on
for ATLAS Offline Software by
1.17.0