ATLAS Offline Software
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 
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 
19 
21  {
24  return StatusCode::SUCCESS;
25  }
26 
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 
91  {
92  for (JGTowerHelper &helper : data)
93  helper.setArea(gFEX::towerArea(helper.Eta()));
94  return StatusCode::SUCCESS;
95  }
96 } // namespace LVL1
LVL1::gFEX::towerArea
float towerArea(float eta)
Get the GCaloTower areas from their eta bins.
Definition: GTowerHelpers.cxx:59
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
GTowerMappingDataCondAlg.h
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
LVL1::GTowerMappingDataCondAlg::GTowerMappingDataCondAlg
GTowerMappingDataCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: GTowerMappingDataCondAlg.cxx:13
index
Definition: index.py:1
CaloCell_Base_ID::pos_neg
int pos_neg(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition: CaloDetDescrManager.cxx:159
LVL1::GTowerMappingDataCondAlg::buildForwardMapping
virtual StatusCode buildForwardMapping(JGTowerMappingData &data, const CaloSuperCellDetDescrManager *mgr) const override
Definition: GTowerMappingDataCondAlg.cxx:27
LVL1::JGTowerHelper
Definition: JGTowerHelper.h:26
GTowerHelpers.h
CaloCell_Base_ID::is_tile
bool is_tile(const Identifier id) const
test if the id belongs to the Tiles
LVL1::GTowerMappingDataCondAlg::m_gtowerID
const GTower_ID * m_gtowerID
Definition: GTowerMappingDataCondAlg.h:22
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
CaloDetDescrElement::eta_raw
float eta_raw() const
cell eta_raw
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:350
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
CaloSuperCellDetDescrManager
Definition: CaloDetDescrManager.h:490
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:112
LVL1::JGTowerMappingDataCondAlgBase
Definition: JGTowerMappingDataCondAlgBase.h:20
LVL1::GTowerMappingDataCondAlg::~GTowerMappingDataCondAlg
virtual ~GTowerMappingDataCondAlg() override
Definition: GTowerMappingDataCondAlg.cxx:18
LVL1::GTowerMappingDataCondAlg::loadTowerAreas
virtual StatusCode loadTowerAreas(JGTowerMappingData &data) const override
Definition: GTowerMappingDataCondAlg.cxx:90
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CaloCell_Base_ID::sampling
int sampling(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
LVL1::GTowerMappingDataCondAlg::initialize
virtual StatusCode initialize() override
Definition: GTowerMappingDataCondAlg.cxx:20
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TauGNNUtils::Variables::Track::dPhi
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:538
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TrigConf::name
Definition: HLTChainList.h:35
LVL1::JGTowerMappingData
std::vector< JGTowerHelper > JGTowerMappingData
Definition: JGTowerMappingData.h:13
CaloCell_Base_ID::cell_id
Identifier cell_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy, const int eta, const int phi) const
Make a cell (== channel) ID from constituting fields and subCalo index; for (Mini)FCAL,...
LVL1::JGTowerMappingDataCondAlgBase::initialize
virtual StatusCode initialize() override
Definition: JGTowerMappingDataCondAlgBase.cxx:25
Trk::iPhi
@ iPhi
Definition: ParamDefs.h:47
TauGNNUtils::Variables::Track::dEta
bool dEta(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:527
xAOD::iEta
setScale setgFexType iEta
Definition: gFexJetRoI_v1.cxx:77
LVL1::JGTowerMappingDataCondAlgBase::m_scid
const CaloCell_SuperCell_ID * m_scid
Definition: JGTowerMappingDataCondAlgBase.h:41
CaloDetDescrElement::phi_raw
float phi_raw() const
cell phi_raw
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:352
CaloCell_Base_ID::calo_cell_hash_max
size_type calo_cell_hash_max(void) const
cell 'global' hash table max size
Identifier
Definition: IdentifierFieldParser.cxx:14