ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1CaloFEX
TrigT1CaloFexPerf
src
JTowerMappingDataCondAlg.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 "
JTowerMappingDataCondAlg.h
"
6
#include "TH1F.h"
7
#include "TFile.h"
8
#include <memory>
9
#include "
PathResolver/PathResolver.h
"
10
#include "CaloDetDescr/CaloDetDescrElement.h"
11
12
namespace
LVL1
13
{
14
JTowerMappingDataCondAlg::JTowerMappingDataCondAlg
(
const
std::string &
name
, ISvcLocator *pSvcLocator)
15
:
JGTowerMappingDataCondAlgBase
(
name
, pSvcLocator)
16
{
17
}
18
19
JTowerMappingDataCondAlg::~JTowerMappingDataCondAlg
() {}
20
21
StatusCode
JTowerMappingDataCondAlg::initialize
()
22
{
23
ATH_CHECK
(
JGTowerMappingDataCondAlgBase::initialize
());
24
ATH_CHECK
(
detStore
()->retrieve(
m_jtowerID
));
25
26
std::unique_ptr<TFile> fIn(TFile::Open(
27
PathResolver::find_calib_file
(
m_towerAreasFile
.value()).c_str()));
28
if
(!fIn || fIn->IsZombie())
29
{
30
ATH_MSG_ERROR
(
"Failed to open tower areas file "
<<
m_towerAreasFile
);
31
return
StatusCode::FAILURE;
32
}
33
TH1F *areaHist = (TH1F *)fIn->Get(
"jTowerArea_final_hist"
);
34
if
(!areaHist)
35
{
36
ATH_MSG_ERROR
(
"Failed to read area histogram!"
);
37
return
StatusCode::FAILURE;
38
}
39
m_towerAreas
.clear();
40
m_towerAreas
.reserve(areaHist->GetNbinsX());
41
// Normalise the areas so that the first tower has an area of 1
42
float
scale = 1.0 / areaHist->GetBinContent(1);
43
for
(
int
towerIdx = 0; towerIdx < areaHist->GetNbinsX(); ++towerIdx)
44
m_towerAreas
.push_back(areaHist->GetBinContent(towerIdx + 1) * scale);
45
46
return
StatusCode::SUCCESS;
47
}
48
49
StatusCode
JTowerMappingDataCondAlg::buildForwardMapping
(
50
JGTowerMappingData
&data,
51
const
CaloSuperCellDetDescrManager
*scDetMgr)
const
52
{
53
ATH_MSG_INFO
(
"# central JTowers "
<< data.size());
54
// Create a single JTower per forward supercell
55
for
(std::size_t scHashIdx = 0; scHashIdx <
m_scid
->calo_cell_hash_max(); ++scHashIdx)
56
{
57
Identifier
scID =
m_scid
->cell_id(scHashIdx);
58
if
(
m_scid
->is_tile(scID) &&
m_scid
->sampling(scID) != 2)
59
continue
;
// skipping tile SCs for now
60
const
CaloDetDescrElement
*dde = scDetMgr->
get_element
(scID);
61
if
(!dde)
62
{
63
ATH_MSG_ERROR
(
"Error loading CaloDetDescrElement"
);
64
return
StatusCode::FAILURE;
65
}
66
float
superCellEta = dde->
eta_raw
();
67
float
superCellPhi = dde->
phi_raw
();
68
if
(std::abs(superCellEta) < 3.1)
69
continue
;
70
float
superCellDEta = dde->
deta
();
71
float
superCellDPhi = dde->
dphi
();
72
JGTowerHelper
helper(superCellEta, superCellDEta, superCellPhi, superCellDPhi);
73
helper.SetSCIndices(scHashIdx);
74
75
std::string detName =
CaloSampling::getSamplingName
(
m_ccid
->calo_sample(scID));
76
if
(detName.find(
"FCAL0"
) != std::string::npos)
77
helper.SetSampling(2);
78
else
if
(detName.find(
"FCAL1"
) != std::string::npos)
79
helper.SetSampling(3);
80
else
if
(detName.find(
"FCAL2"
) != std::string::npos)
81
helper.SetSampling(4);
82
else
83
helper.SetSampling(0);
84
data.push_back(std::move(helper));
85
}
86
ATH_MSG_INFO
(
"# towers (including forward)"
);
87
return
StatusCode::SUCCESS;
88
}
89
90
StatusCode
JTowerMappingDataCondAlg::loadTowerAreas
(
JGTowerMappingData
&data)
const
91
{
92
if
(data.size() !=
m_towerAreas
.size())
93
{
94
ATH_MSG_ERROR
(
"Number of towers ("
<< data.size() <<
") and number of tower areas ("
<<
m_towerAreas
.size() <<
") do not match!"
);
95
return
StatusCode::FAILURE;
96
}
97
98
for
(std::size_t idx = 0; idx <
m_towerAreas
.size(); ++idx)
99
data.at(idx).setArea(
m_towerAreas
.at(idx));
100
return
StatusCode::SUCCESS;
101
}
102
}
// namespace LVL1
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
JTowerMappingDataCondAlg.h
PathResolver.h
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::dphi
float dphi() const
cell dphi
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:358
CaloDetDescrElement::phi_raw
float phi_raw() const
cell phi_raw
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:352
CaloDetDescrElement::deta
float deta() const
cell deta
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:356
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition
CaloDetDescrManager.cxx:159
CaloSampling::getSamplingName
static std::string getSamplingName(CaloSample theSample)
Returns a string (name) for each CaloSampling.
Definition
Calorimeter/CaloGeoHelpers/Root/CaloSampling.cxx:18
CaloSuperCellDetDescrManager
Definition
CaloDetDescrManager.h:486
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::m_ccid
const CaloCell_ID * m_ccid
Definition
JGTowerMappingDataCondAlgBase.h:42
LVL1::JGTowerMappingDataCondAlgBase::initialize
virtual StatusCode initialize() override
Definition
JGTowerMappingDataCondAlgBase.cxx:25
LVL1::JTowerMappingDataCondAlg::loadTowerAreas
virtual StatusCode loadTowerAreas(JGTowerMappingData &data) const override
Definition
JTowerMappingDataCondAlg.cxx:90
LVL1::JTowerMappingDataCondAlg::buildForwardMapping
virtual StatusCode buildForwardMapping(JGTowerMappingData &data, const CaloSuperCellDetDescrManager *mgr) const override
Definition
JTowerMappingDataCondAlg.cxx:49
LVL1::JTowerMappingDataCondAlg::JTowerMappingDataCondAlg
JTowerMappingDataCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
JTowerMappingDataCondAlg.cxx:14
LVL1::JTowerMappingDataCondAlg::m_towerAreasFile
Gaudi::Property< std::string > m_towerAreasFile
Definition
JTowerMappingDataCondAlg.h:22
LVL1::JTowerMappingDataCondAlg::~JTowerMappingDataCondAlg
virtual ~JTowerMappingDataCondAlg() override
Definition
JTowerMappingDataCondAlg.cxx:19
LVL1::JTowerMappingDataCondAlg::m_towerAreas
std::vector< float > m_towerAreas
Definition
JTowerMappingDataCondAlg.h:30
LVL1::JTowerMappingDataCondAlg::initialize
virtual StatusCode initialize() override
Definition
JTowerMappingDataCondAlg.cxx:21
LVL1::JTowerMappingDataCondAlg::m_jtowerID
const JTower_ID * m_jtowerID
Definition
JTowerMappingDataCondAlg.h:24
PathResolver::find_calib_file
static std::string find_calib_file(const std::string &logical_file_name)
Definition
PathResolver.cxx:272
Identifier
Definition
IdentifierFieldParser.cxx:14
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
TrigConf::name
Definition
HLTChainList.h:35
Generated on
for ATLAS Offline Software by
1.17.0