ATLAS Offline Software
PFClusterWidthDecorator.cxx
Go to the documentation of this file.
1 
3 
4 #include "CaloEvent/CaloCluster.h"
5 
6 PFClusterWidthDecorator::PFClusterWidthDecorator(const std::string& name, ISvcLocator* pSvcLocator) :
7  AthAlgorithm(name, pSvcLocator)
8 {}
9 
13  return StatusCode::SUCCESS;
14 }
15 
17 
19  if (!clusterContainerWidthEta.isValid()) {
20  ATH_MSG_WARNING("Invalid cluster container with name " << m_clusterContainerWidthEtaKey.key());
21  return StatusCode::SUCCESS;
22  }
23 
25  if (!clusterContainerWidthPhi.isValid()) {
26  ATH_MSG_WARNING("Invalid cluster container with name " << m_clusterContainerWidthPhiKey.key());
27  return StatusCode::SUCCESS;
28  }
29 
30  for (const auto *const thisCluster : *clusterContainerWidthEta) {
31  const CaloClusterCellLink* theCellLinks = thisCluster->getCellLinks();
32  if (!theCellLinks) {
33  ATH_MSG_WARNING("No cell links found for cluster");
34  continue;
35  }
36 
37  std::vector<double> eta,phi;
38  for (CaloClusterCellLink::const_iterator it=theCellLinks->begin(); it!=theCellLinks->end(); ++it){
39  const CaloCell* cell = *it;
40  eta.push_back(cell->eta());
41  phi.push_back(cell->phi());
42  }
43 
44  std::pair<double,double> width = m_clusterWidthCalculator.getPFClusterCoordinateWidth(eta, phi, thisCluster->eta(), thisCluster->phi(), theCellLinks->size());
45  clusterContainerWidthEta(*thisCluster) = width.first;
46  clusterContainerWidthPhi(*thisCluster) = width.second;
47 
48  }
49 
50  return StatusCode::SUCCESS;
51 }
PFClusterWidthDecorator::execute
StatusCode execute() override
Definition: PFClusterWidthDecorator.cxx:16
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
skel.it
it
Definition: skel.GENtoEVGEN.py:423
PFClusterWidthDecorator::initialize
StatusCode initialize() override
Definition: PFClusterWidthDecorator.cxx:10
PFClusterWidthDecorator::PFClusterWidthDecorator
PFClusterWidthDecorator(const std::string &name, ISvcLocator *pSvcLocator)
Definition: PFClusterWidthDecorator.cxx:6
PFClusterWidthDecorator::m_clusterWidthCalculator
PFClusterWidthCalculator m_clusterWidthCalculator
Definition: PFClusterWidthDecorator.h:20
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
PFClusterWidthDecorator::m_clusterContainerWidthEtaKey
SG::WriteDecorHandleKey< xAOD::CaloClusterContainer > m_clusterContainerWidthEtaKey
Definition: PFClusterWidthDecorator.h:18
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:99
PFClusterWidthDecorator::m_clusterContainerWidthPhiKey
SG::WriteDecorHandleKey< xAOD::CaloClusterContainer > m_clusterContainerWidthPhiKey
Definition: PFClusterWidthDecorator.h:19
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthAlgorithm
Definition: AthAlgorithm.h:47
PFClusterWidthDecorator.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
PFClusterWidthCalculator::getPFClusterCoordinateWidth
std::pair< double, double > getPFClusterCoordinateWidth(const std::vector< double > &eta, const std::vector< double > &phi, const double &clusterEta, const double &clusterPhi, unsigned int nCells)
Definition: PFClusterWidthCalculator.cxx:11