ATLAS Offline Software
Loading...
Searching...
No Matches
CaloFillCellPositionShift.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include <cmath>
6
7
8
10
12#include "CaloDetDescr/CaloDetDescrElement.h"
15#include "CaloGeoHelpers/CaloSampling.h"
16
17//Constructor
18CaloFillCellPositionShift::CaloFillCellPositionShift(const std::string& name, ISvcLocator* pSvcLocator):
19AthAlgorithm(name,pSvcLocator),m_calo_id(nullptr),m_cellPos(nullptr),m_key("LArCellPositionShift")
20{
21 declareProperty("outputKey",m_key,"Key for output CaloCellPositionShift");
22}
23
24//__________________________________________________________________________
25//Destructor
27{
28 ATH_MSG_DEBUG( "CaloFillCellPositionShift destructor called" );
29}
30//__________________________________________________________________________
32{
33 ATH_MSG_DEBUG ("CaloFillCellPositionShift initialize()" );
34
35 const CaloIdManager* mgr = nullptr;
36 ATH_CHECK( detStore()->retrieve( mgr ) );
37 m_calo_id = mgr->getCaloCell_ID();
38
39 ATH_CHECK( m_caloMgrKey.initialize() );
40
41 ATH_MSG_INFO ( " end of CaloFillCellPositionShift::initialize " );
42 return StatusCode::SUCCESS;
43
44}
45//__________________________________________________________________________
47{
48 ATH_MSG_DEBUG ("CaloFillCellPositionShift execute()" );
49 return StatusCode::SUCCESS;
50}
51
52//__________________________________________________________________________
54{
55 //int ncell=m_calo_id->calo_cell_hash_max();
56 IdentifierHash emmin,emmax,fcalmin,fcalmax;
57 m_calo_id->calo_cell_hash_range(CaloCell_ID::LAREM,emmin,emmax);
58 m_calo_id->calo_cell_hash_range(CaloCell_ID::LARFCAL,fcalmin,fcalmax);
59 int ncell=fcalmax-emmin;
60 ATH_MSG_INFO ( " Number of cells in LAr calo " << emmin << " " << fcalmax << " " << ncell );
61
63
64 ATH_CHECK( detStore()->record(m_cellPos,m_key) );
65
67 ATH_CHECK(caloMgrHandle.isValid());
68 const CaloDetDescrManager* calodetdescrmgr = *caloMgrHandle;
69
70 ATH_MSG_INFO ( " start loop over Calo cells " << ncell );
71 for (int i=0;i<ncell;i++) {
72 IdentifierHash idHash=i+emmin;
73 Identifier id=m_calo_id->cell_id(idHash);
74 const CaloDetDescrElement* calodde = calodetdescrmgr->get_element(id);
75
76 //float eta = calodde->eta();
77 float phi = calodde->phi();
78 int layer = m_calo_id->calo_sample(id);
79
80 float dx=0.;
81 float dy=0.;
82 float dz=0.;
83 if (layer==CaloSampling::EMB2) {
84 dy = -1.*std::cos(phi)*std::cos(phi);
85 dx = 1.*std::cos(phi)*std::sin(phi);
86 dz = 0.;
87 }
88
89 m_cellPos->set_deltaX(i,dx);
90 m_cellPos->set_deltaY(i,dy);
91 m_cellPos->set_deltaZ(i,dz);
92
93 } // loop over cells
94
95 return StatusCode::SUCCESS;
96 }
97
99{
100 return StatusCode::SUCCESS;
101}
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:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
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...
virtual StatusCode finalize() override
standard Athena-Algorithm method
~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
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.