ATLAS Offline Software
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
18 CaloFillCellPositionShift::CaloFillCellPositionShift(const std::string& name, ISvcLocator* pSvcLocator):
19 AthAlgorithm(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 
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;
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.;
84  dy = -1.*std::cos(phi)*std::cos(phi);
85  dx = 1.*std::cos(phi)*std::sin(phi);
86  dz = 0.;
87  }
88 
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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition: CaloCell_Base_ID.h:46
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CaloRec::CaloCellPositionShift::set_deltaZ
void set_deltaZ(const size_type &hashID, float dz)
Definition: CaloCellPositionShift.h:60
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
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
CaloFillCellPositionShift.h
CaloFillCellPositionShift::execute
virtual StatusCode execute() override
standard Athena-Algorithm method
Definition: CaloFillCellPositionShift.cxx:46
CaloCell_Base_ID::calo_sample
int calo_sample(const Identifier id) const
returns an int taken from Sampling enum and describing the subCalo to which the Id belongs.
Definition: CaloCell_Base_ID.cxx:141
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
CaloCell_ID.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
BchCleanup.mgr
mgr
Definition: BchCleanup.py:294
CaloRec::CaloCellPositionShift
Container for a cell-level rescaling-factors, typically obtained by Z->ee intercalibration.
Definition: CaloCellPositionShift.h:31
CaloFillCellPositionShift::m_key
std::string m_key
Definition: CaloFillCellPositionShift.h:56
CaloIdManager
This class initializes the Calo (LAr and Tile) offline identifiers.
Definition: CaloIdManager.h:45
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloCell_Base_ID::calo_cell_hash_range
void calo_cell_hash_range(const Identifier id, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' cell hashes of one sub-calorimeter alone
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
CaloFillCellPositionShift::m_calo_id
const CaloCell_ID * m_calo_id
Definition: CaloFillCellPositionShift.h:52
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloFillCellPositionShift::finalize
virtual StatusCode finalize() override
standard Athena-Algorithm method
Definition: CaloFillCellPositionShift.cxx:98
AthAlgorithm
Definition: AthAlgorithm.h:47
CaloFillCellPositionShift::m_cellPos
CaloRec::CaloCellPositionShift * m_cellPos
Definition: CaloFillCellPositionShift.h:54
ReadCellNoiseFromCool.ncell
ncell
Definition: ReadCellNoiseFromCool.py:197
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
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,...
makeTRTBarrelCans.dy
tuple dy
Definition: makeTRTBarrelCans.py:21
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
CaloFillCellPositionShift::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition: CaloFillCellPositionShift.h:59
makeTRTBarrelCans.dx
tuple dx
Definition: makeTRTBarrelCans.py:20
CaloFillCellPositionShift::~CaloFillCellPositionShift
~CaloFillCellPositionShift()
Default Destructor.
Definition: CaloFillCellPositionShift.cxx:26
CaloRec::CaloCellPositionShift::set_deltaY
void set_deltaY(const size_type &hashID, float dy)
Definition: CaloCellPositionShift.h:57
CaloIdManager.h
CaloFillCellPositionShift::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition: CaloFillCellPositionShift.cxx:31
CaloDetDescrElement::phi
float phi() const
cell phi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:346
CaloFillCellPositionShift::stop
virtual StatusCode stop() override
standard Athena-Algorithm method
Definition: CaloFillCellPositionShift.cxx:53
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
CaloCell_Base_ID::LAREM
@ LAREM
Definition: CaloCell_Base_ID.h:46
CaloFillCellPositionShift::CaloFillCellPositionShift
CaloFillCellPositionShift(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
Definition: CaloFillCellPositionShift.cxx:18
CaloRec::CaloCellPositionShift::set_deltaX
void set_deltaX(const size_type &hashID, float dx)
Definition: CaloCellPositionShift.h:54
CaloCellPositionShift.h
Container for a cell-level position corrections to account for distorsion of calo shape in reconstruc...
Identifier
Definition: IdentifierFieldParser.cxx:14