ATLAS Offline Software
Loading...
Searching...
No Matches
PFClusterWidthCalculator.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include "eflowUtil.h"
8
9#include <cmath>
10
12
13
14PFClusterWidth PFClusterWidthCalculator::getPFClusterCoordinateWidth(const std::vector<double>& eta, const std::vector<double>& phi, double clusterEta, double clusterPhi, unsigned int nCells) const {
15 PFClusterWidth pfClusterWidth;
16 if (nCells <= 1) {
17 pfClusterWidth.etaMean = clusterEta;
18 pfClusterWidth.phiMean = clusterPhi;
19 pfClusterWidth.etaVariance = m_etaPhiLowerLimit;
20 pfClusterWidth.phiVariance = m_etaPhiLowerLimit;
21 return pfClusterWidth;
22 }
23
24 double etaSum(0.0);
25 double etaSum2(0.0);
26 double phiSum(0.0);
27 double phiSum2(0.0);
28
29 for(unsigned int iCell=0; iCell<nCells; ++iCell){
30 etaSum += eta[iCell];
31 etaSum2 += eta[iCell]*eta[iCell];
32 double thisCellPhi = eflowAzimuth(phi[iCell]).cycle(clusterPhi);
33 phiSum += thisCellPhi;
34 phiSum2 += thisCellPhi*thisCellPhi;
35 }
36
37 pfClusterWidth.etaMean = etaSum/static_cast<double>(nCells);
38 pfClusterWidth.phiMean = phiSum/static_cast<double>(nCells);
39
40 double varianceCorrection = (double)nCells / (double)(nCells-1);
41 pfClusterWidth.etaVariance = std::max(m_etaPhiLowerLimit, varianceCorrection * (etaSum2/static_cast<double>(nCells) - pfClusterWidth.etaMean*pfClusterWidth.etaMean));
42 pfClusterWidth.phiVariance = std::max(m_etaPhiLowerLimit, varianceCorrection * (phiSum2/static_cast<double>(nCells) - pfClusterWidth.phiMean*pfClusterWidth.phiMean));
43
44 return pfClusterWidth;
45}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
PFClusterWidth getPFClusterCoordinateWidth(const std::vector< double > &eta, const std::vector< double > &phi, double clusterEta, double clusterPhi, unsigned int nCells) const
eflowAzimuth represents phi and has kinematic functions which correctly deal with phi wraparound etc.
Definition eflowUtil.h:21
double cycle(const eflowAzimuth &other)
Definition eflowUtil.h:51