ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1CaloFEX
TrigT1CaloFexPerf
src
GTowerMappingDataCondAlg.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 "
GTowerMappingDataCondAlg.h
"
6
#include "TMath.h"
7
#include "TVector2.h"
8
#include "CaloDetDescr/CaloDetDescrElement.h"
9
#include "
GTowerHelpers.h
"
10
11
namespace
LVL1
12
{
13
GTowerMappingDataCondAlg::GTowerMappingDataCondAlg
(
const
std::string &
name
, ISvcLocator *pSvcLocator)
14
:
JGTowerMappingDataCondAlgBase
(
name
, pSvcLocator)
15
{
16
}
17
18
GTowerMappingDataCondAlg::~GTowerMappingDataCondAlg
() {}
19
20
StatusCode
GTowerMappingDataCondAlg::initialize
()
21
{
22
ATH_CHECK
(
JGTowerMappingDataCondAlgBase::initialize
());
23
ATH_CHECK
(
detStore
()->retrieve(
m_gtowerID
));
24
return
StatusCode::SUCCESS;
25
}
26
27
StatusCode
GTowerMappingDataCondAlg::buildForwardMapping
(
28
JGTowerMappingData
&data,
29
const
CaloSuperCellDetDescrManager
*scDetMgr)
const
30
{
31
// Define GTower geometry
32
std::array<float, 5> etaBounds{3.1, 3.5, 4.0, 4.45, 4.9};
33
constexpr
std::size_t nEtaTowers = etaBounds.size() - 1;
34
constexpr
std::size_t nPhiTowers = 16;
35
float
dPhi = 2 * TMath::Pi() / nPhiTowers;
36
for
(std::size_t iEta = 0; iEta < etaBounds.size() - 1; ++iEta)
37
{
38
float
eta
= (etaBounds[iEta] + etaBounds[iEta + 1]) / 2;
39
float
dEta = etaBounds[iEta + 1] - etaBounds[iEta];
40
41
for
(
int
sign
: {1, -1})
42
{
43
for
(std::size_t iPhi = 0; iPhi < nPhiTowers; ++iPhi)
44
{
45
std::size_t
index
= data.size();
46
float
phi
= dPhi * (iPhi + 0.5);
47
if
(
phi
> TMath::Pi())
48
phi
-= 2 * TMath::Pi();
49
JGTowerHelper
helper(
eta
*
sign
, dEta,
phi
, dPhi);
50
helper.SetSampling(2);
51
for
(std::size_t scIdx = 0; scIdx <
m_scid
->calo_cell_hash_max(); ++scIdx)
52
{
53
Identifier
scid =
m_scid
->cell_id(scIdx);
54
if
(
m_scid
->is_tile(scid) &&
m_scid
->sampling(scid) != 2)
55
continue
;
56
const
CaloDetDescrElement
*dde = scDetMgr->
get_element
(scid);
57
if
(!dde)
58
{
59
ATH_MSG_ERROR
(
"Failed to load CaloDetDescrElement"
);
60
return
StatusCode::FAILURE;
61
}
62
if
(std::abs(dde->
eta_raw
()) < 3.2)
63
continue
;
64
if
(helper.inBox(dde->
eta_raw
(), dde->
phi_raw
()) &&
sign
*
m_scid
->pos_neg(scid) > 0)
65
helper.SetSCIndices(scIdx);
66
}
67
data.push_back(std::move(helper));
68
if
(iEta > 0)
69
{
70
if
(
sign
> 0)
71
helper.setPreviousEtaIndex(
index
- 2 * nPhiTowers);
72
else
73
helper.setNextEtaIndex(
index
- 2 * nPhiTowers);
74
}
75
if
(iEta < nEtaTowers - 1)
76
{
77
if
(
sign
> 0)
78
helper.setNextEtaIndex(
index
- 2 * nPhiTowers);
79
else
80
helper.setPreviousEtaIndex(
index
- 2 * nPhiTowers);
81
}
82
helper.setPreviousPhiIndex(iPhi == 0 ?
index
+ nPhiTowers - 1 :
index
- 1);
83
helper.setNextPhiIndex(iPhi == nPhiTowers - 1 ?
index
- (nPhiTowers - 1) :
index
+ 1);
84
}
85
}
86
}
87
return
StatusCode::SUCCESS;
88
}
89
90
StatusCode
GTowerMappingDataCondAlg::loadTowerAreas
(
JGTowerMappingData
&data)
const
91
{
92
for
(
JGTowerHelper
&helper : data)
93
helper.setArea(
gFEX::towerArea
(helper.Eta()));
94
return
StatusCode::SUCCESS;
95
}
96
}
// namespace LVL1
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
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
GTowerHelpers.h
GTowerMappingDataCondAlg.h
sign
int sign(int a)
Definition
TRT_StrawNeighbourSvc.h:108
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell.
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloDetDescrElement::eta_raw
float eta_raw() const
cell eta_raw
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:350
CaloDetDescrElement::phi_raw
float phi_raw() const
cell phi_raw
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:352
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition
CaloDetDescrManager.cxx:159
CaloSuperCellDetDescrManager
Definition
CaloDetDescrManager.h:486
LVL1::GTowerMappingDataCondAlg::buildForwardMapping
virtual StatusCode buildForwardMapping(JGTowerMappingData &data, const CaloSuperCellDetDescrManager *mgr) const override
Definition
GTowerMappingDataCondAlg.cxx:27
LVL1::GTowerMappingDataCondAlg::~GTowerMappingDataCondAlg
virtual ~GTowerMappingDataCondAlg() override
Definition
GTowerMappingDataCondAlg.cxx:18
LVL1::GTowerMappingDataCondAlg::m_gtowerID
const GTower_ID * m_gtowerID
Definition
GTowerMappingDataCondAlg.h:22
LVL1::GTowerMappingDataCondAlg::GTowerMappingDataCondAlg
GTowerMappingDataCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
GTowerMappingDataCondAlg.cxx:13
LVL1::GTowerMappingDataCondAlg::loadTowerAreas
virtual StatusCode loadTowerAreas(JGTowerMappingData &data) const override
Definition
GTowerMappingDataCondAlg.cxx:90
LVL1::GTowerMappingDataCondAlg::initialize
virtual StatusCode initialize() override
Definition
GTowerMappingDataCondAlg.cxx:20
LVL1::JGTowerHelper
Definition
JGTowerHelper.h:26
LVL1::JGTowerMappingDataCondAlgBase::m_scid
const CaloCell_SuperCell_ID * m_scid
Definition
JGTowerMappingDataCondAlgBase.h:41
LVL1::JGTowerMappingDataCondAlgBase::JGTowerMappingDataCondAlgBase
JGTowerMappingDataCondAlgBase(const std::string &name, ISvcLocator *pSvcLocator)
Definition
JGTowerMappingDataCondAlgBase.cxx:18
LVL1::JGTowerMappingDataCondAlgBase::initialize
virtual StatusCode initialize() override
Definition
JGTowerMappingDataCondAlgBase.cxx:25
Identifier
Definition
IdentifierFieldParser.cxx:14
LVL1::gFEX::towerArea
float towerArea(float eta)
Get the GCaloTower areas from their eta bins.
Definition
GTowerHelpers.cxx:59
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition
IZdcDataAccess.h:13
LVL1::JGTowerMappingData
std::vector< JGTowerHelper > JGTowerMappingData
Definition
JGTowerMappingData.h:13
index
Definition
index.py:1
TrigConf::name
Definition
HLTChainList.h:35
Generated on
for ATLAS Offline Software by
1.17.0