ATLAS Offline Software
Loading...
Searching...
No Matches
CaloFillCellPositionShift.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include <cmath>
6
8
10#include "CaloDetDescr/CaloDetDescrElement.h"
13#include "CaloGeoHelpers/CaloSampling.h"
14
15//Constructor
16CaloFillCellPositionShift::CaloFillCellPositionShift(const std::string& name, ISvcLocator* pSvcLocator):
17 AthAlgorithm(name,pSvcLocator)
18{
19}
20
21//__________________________________________________________________________
22//Destructor
24
25//__________________________________________________________________________
27{
28 ATH_MSG_DEBUG ("CaloFillCellPositionShift initialize()" );
29
30 const CaloIdManager* mgr = nullptr;
31 ATH_CHECK( detStore()->retrieve( mgr ) );
32 m_calo_id = mgr->getCaloCell_ID();
33
34 ATH_CHECK( m_caloMgrKey.initialize() );
35
36 ATH_MSG_INFO ( " end of CaloFillCellPositionShift::initialize " );
37 return StatusCode::SUCCESS;
38
39}
40//__________________________________________________________________________
42{
43 ATH_MSG_DEBUG ("CaloFillCellPositionShift execute()" );
44 return StatusCode::SUCCESS;
45}
46
47//__________________________________________________________________________
49{
50 //int ncell=m_calo_id->calo_cell_hash_max();
51 IdentifierHash emmin,emmax,fcalmin,fcalmax;
52 m_calo_id->calo_cell_hash_range(CaloCell_ID::LAREM,emmin,emmax);
53 m_calo_id->calo_cell_hash_range(CaloCell_ID::LARFCAL,fcalmin,fcalmax);
54 int ncell=fcalmax-emmin;
55 ATH_MSG_INFO ( " Number of cells in LAr calo " << emmin << " " << fcalmax << " " << ncell );
56
58
59 ATH_CHECK( detStore()->record(m_cellPos,m_key) );
60
62 ATH_CHECK(caloMgrHandle.isValid());
63 const CaloDetDescrManager* calodetdescrmgr = *caloMgrHandle;
64
65 ATH_MSG_INFO ( " start loop over Calo cells " << ncell );
66 for (int i=0;i<ncell;i++) {
67 IdentifierHash idHash=i+emmin;
68 Identifier id=m_calo_id->cell_id(idHash);
69 const CaloDetDescrElement* calodde = calodetdescrmgr->get_element(id);
70
71 //float eta = calodde->eta();
72 float phi = calodde->phi();
73 int layer = m_calo_id->calo_sample(id);
74
75 float dx=0.;
76 float dy=0.;
77 float dz=0.;
78 if (layer==CaloSampling::EMB2) {
79 dy = -1.*std::cos(phi)*std::cos(phi);
80 dx = 1.*std::cos(phi)*std::sin(phi);
81 dz = 0.;
82 }
83
84 m_cellPos->set_deltaX(i,dx);
85 m_cellPos->set_deltaY(i,dy);
86 m_cellPos->set_deltaZ(i,dz);
87
88 } // loop over cells
89
90 return StatusCode::SUCCESS;
91 }
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
Container for a cell-level position corrections to account for distorsion of calo shape in reconstruc...
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
This class groups all DetDescr information related to a CaloCell.
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
This class provides the client interface for accessing the detector description information common to...
~CaloFillCellPositionShift()
Default Destructor.
CaloFillCellPositionShift(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
CaloRec::CaloCellPositionShift * m_cellPos
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
virtual StatusCode execute() override
standard Athena-Algorithm method
virtual StatusCode stop() override
standard Athena-Algorithm method
Gaudi::Property< std::string > m_key
virtual StatusCode initialize() override
standard Athena-Algorithm method
This class initializes the Calo (LAr and Tile) offline identifiers.
Container for a cell-level rescaling-factors, typically obtained by Z->ee intercalibration.
This is a "hash" representation of an Identifier.