ATLAS Offline Software
Event
xAOD
xAODCaloEvent
Root
CaloTowerContainer_v1.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
#include "
xAODCaloEvent/versions/CaloTowerContainer_v1.h
"
7
8
#include "
CaloGeoHelpers/CaloPhiRange.h
"
9
#include <cmath>
10
11
12
13
xAOD::CaloTowerContainer_v1::CaloTowerContainer_v1
(
int
nEtaBins
,
double
etaMin
,
double
etaMax
,
int
nPhiBins
,
SG::OwnershipPolicy
ownPolicy,
SG::IndexTrackingPolicy
trackIndices)
14
:
CaloTowerContainerBase_v1
(ownPolicy,trackIndices)
15
, m_nEtaBins(
nEtaBins
)
16
, m_etaMin(
etaMin
)
17
, m_etaMax(
etaMax
)
18
, m_nPhiBins(
nPhiBins
)
19
, m_deltaEta(0.)
20
, m_deltaPhi(0.)
21
{ this->
configureGrid
(); }
22
23
xAOD::CaloTowerContainer_v1::CaloTowerContainer_v1
(
SG::OwnershipPolicy
ownPolicy,
SG::IndexTrackingPolicy
trackIndices)
24
:
CaloTowerContainerBase_v1
(ownPolicy,trackIndices)
25
, m_nEtaBins(0)
26
, m_etaMin(0)
27
, m_etaMax(0)
28
, m_nPhiBins(0)
29
, m_deltaEta(0.)
30
, m_deltaPhi(0.)
31
, m_isConfigured(false)
32
{ }
33
34
35
36
xAOD::CaloTowerContainer_v1::~CaloTowerContainer_v1
()
37
{ }
38
39
bool
xAOD::CaloTowerContainer_v1::configureGrid
(
int
nEtaBins
,
double
etaMin
,
double
etaMax
,
int
nPhiBins
)
40
{
41
// reject configuration update!
42
if
( m_isConfigured ) {
return
false
; }
43
// store configuration
44
m_nEtaBins =
nEtaBins
;
45
m_etaMin =
etaMin
;
46
m_etaMax =
etaMax
;
47
m_nPhiBins =
nPhiBins
;
48
return
this->configureGrid();
49
}
50
51
bool
xAOD::CaloTowerContainer_v1::configureGrid
()
52
{
53
if
(m_nEtaBins > 0 && m_etaMin < m_etaMax && m_nPhiBins > 0) {
54
m_deltaEta=(m_etaMax-m_etaMin)/m_nEtaBins;
55
m_deltaPhi=(2*
M_PI
)/m_nPhiBins;
56
m_isConfigured=
true
;
57
}
58
else
59
m_isConfigured=
false
;
60
return
m_isConfigured;
61
62
}
63
64
65
int
xAOD::CaloTowerContainer_v1::index
(
double
eta,
double
phi
)
const
{
66
if
(eta<m_etaMin || eta>m_etaMax) {
67
return
CaloTower_v1::INVALIDINDEX
;
68
}
69
phi
=
CaloPhiRange::fix
(
phi
);
70
// int iphi=(phi-m_phiMin)/m_deltaPhi;
71
int
iphi=(
phi
+
M_PI
)/m_deltaPhi;
72
int
ieta=(eta-m_etaMin)/m_deltaEta;
73
return
ieta*m_nPhiBins+iphi;
74
}
75
76
77
double
xAOD::CaloTowerContainer_v1::eta
(
size_t
index
)
const
{
78
79
assert((
int
)
index
< m_nPhiBins * m_nEtaBins);
80
81
int
ieta=
index
/m_nPhiBins;
82
return
(0.5+ieta)*m_deltaEta+m_etaMin;
83
}
84
85
86
double
xAOD::CaloTowerContainer_v1::phi
(
size_t
index
)
const
{
87
88
assert((
int
)
index
< m_nPhiBins * m_nEtaBins);
89
90
int
iphi=
index
% m_nPhiBins;
91
return
(0.5 + iphi)*m_deltaPhi-
M_PI
;
92
}
TCS::KFMET::nEtaBins
constexpr unsigned nEtaBins
Definition:
KalmanMETCorrectionConstants.h:18
index
Definition:
index.py:1
M_PI
#define M_PI
Definition:
ActiveFraction.h:11
xAOD::etaMax
etaMax
Definition:
HIEventShape_v2.cxx:46
SG::OwnershipPolicy
OwnershipPolicy
describes the possible element ownership policies (see e.g. DataVector)
Definition:
OwnershipPolicy.h:16
xAOD::CaloTowerContainer_v1::configureGrid
bool configureGrid()
Definition:
CaloTowerContainer_v1.cxx:51
xAOD::phi
setEt phi
Definition:
TrigEMCluster_v1.cxx:29
xAOD::CaloTower_v1::INVALIDINDEX
@ INVALIDINDEX
Definition:
CaloTower_v1.h:22
CaloPhiRange.h
CaloPhiRange class declaration.
DataVector
Derived DataVector<T>.
Definition:
DataVector.h:794
CaloPhiRange::fix
static double fix(double phi)
Definition:
CaloPhiRange.cxx:14
CaloTowerContainer_v1.h
xAOD::CaloTowerContainer_v1::CaloTowerContainer_v1
CaloTowerContainer_v1(SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
Default constructor Constructs a tower container without structure (binning) or content.
Definition:
CaloTowerContainer_v1.cxx:23
xAOD::CaloTowerContainer_v1::phi
double phi(size_t index) const
Definition:
CaloTowerContainer_v1.cxx:86
xAOD::CaloTowerContainer_v1::~CaloTowerContainer_v1
~CaloTowerContainer_v1()
Destructor.
Definition:
CaloTowerContainer_v1.cxx:36
LArCellBinning.etaMin
etaMin
Definition:
LArCellBinning.py:84
xAOD::CaloTowerContainer_v1::index
int index(double eta, double phi) const
Definition:
CaloTowerContainer_v1.cxx:65
SG::IndexTrackingPolicy
IndexTrackingPolicy
Definition:
IndexTrackingPolicy.h:37
xAOD::CaloTowerContainer_v1::eta
double eta(size_t index) const
Definition:
CaloTowerContainer_v1.cxx:77
PUfitVar::nPhiBins
constexpr std::size_t nPhiBins
Definition:
GepMETPufitAlg.cxx:20
Generated on Sun Dec 22 2024 21:08:07 for ATLAS Offline Software by
1.8.18