ATLAS Offline Software
PFMatchPositions.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*
6  * PFMatchPositions.cxx
7  *
8  * Created on: 25.03.2014
9  * Author: tlodd
10  */
11 
12 #include <cassert>
13 #include <iostream>
14 
17 
18 namespace PFMatch {
19 
20 /* Track position providers */
21 
23  eflowEtaPhiPosition etaphi = track->etaPhiInLayer(m_barrelLayer);
24  if (etaphi.getEta() == -999.){
25  etaphi = track->etaPhiInLayer(m_endcapLayer);
26  }
27  if (etaphi.getEta() == -999.){
28  etaphi = track->etaPhiInLayer(m_fcalLayer);
29  }
30  return etaphi;
31 }
32 
33 
34 /* Cluster position providers */
35 
37  eflowEtaPhiPosition etaphi(cluster->eta(), cluster->phi());
38  return etaphi;
39 }
40 
42 
44 
45  /* Check the status to make sure this function only execute once since it is expensive. */
46  if(cluster->calVarianceStatus()) {
47  return {eflowEtaPhiPosition(cluster->etaMean(), cluster->phiMean()), cluster->etaVariance(), cluster->phiVariance()};
48  }
49  cluster->setCalVarianceStatus();
50 
51 
52  unsigned int nCells = cluster->nCells();
53 
54  PFClusterWidthCalculator widthCalc;
55  std::pair<double,double> width = widthCalc.getPFClusterCoordinateWidth(cluster->cellEta(),cluster->cellPhi(),cluster->eta(),cluster->phi(),nCells);
56 
57  if (nCells > 1){
58  cluster->etaMean(widthCalc.getEtaMean());
59  cluster->phiMean(widthCalc.getPhiMean());
60  }
61  cluster->etaVariance(width.first);
62  cluster->phiVariance(width.second);
63 
64  return {eflowEtaPhiPosition(widthCalc.getEtaMean(),widthCalc.getPhiMean()), width.first, width.second};
65 
66 
67 
68 }
69 
70 }
PFMatch::ClusterPlainEtaPhiProvider::getPosition
EtaPhi getPosition(ICluster *cluster) const
Definition: PFMatchPositions.cxx:36
PFMatch::TrackEtaPhiInFixedLayersProvider::m_fcalLayer
LayerType m_fcalLayer
Definition: PFMatchPositions.h:87
PFMatch::ICluster::etaMean
virtual double etaMean() const =0
PFMatch::ICluster::cellEta
virtual const std::vector< double > & cellEta() const =0
eflowEtaPhiPosition::getEta
double getEta() const
Definition: eflowUtil.h:90
PFMatch::EtaPhi
Definition: PFMatchPositions.h:23
eflowEtaPhiPosition
Definition: eflowUtil.h:85
PFMatch::ICluster::etaVariance
virtual double etaVariance() const =0
PFMatch::ClusterGeometricalCenterProvider::m_etaPhiLowerLimit
static const double m_etaPhiLowerLimit
Definition: PFMatchPositions.h:71
PFMatch::ICluster
Definition: PFMatchInterfaces.h:37
PFMatch::EtaPhiWithVariance
Definition: PFMatchPositions.h:41
PFMatch::TrackEtaPhiInFixedLayersProvider::getPosition
EtaPhi getPosition(ITrack *track) const
Definition: PFMatchPositions.cxx:22
PFClusterWidthCalculator
Definition: PFClusterWidthCalculator.h:6
PFMatch::ICluster::phiMean
virtual double phiMean() const =0
PFMatch::ITrack
Definition: PFMatchInterfaces.h:28
xAOD::nCells
setRawEt setRawPhi nCells
Definition: TrigCaloCluster_v1.cxx:33
PFClusterWidthCalculator::getEtaMean
double getEtaMean() const
Definition: PFClusterWidthCalculator.h:14
PFMatch::TrackEtaPhiInFixedLayersProvider::m_barrelLayer
LayerType m_barrelLayer
Definition: PFMatchPositions.h:85
PFMatch::ClusterGeometricalCenterProvider::getPosition
EtaPhiWithVariance getPosition(ICluster *cluster) const
Definition: PFMatchPositions.cxx:43
PFMatch
Definition: PFMatchDistance.h:17
PFClusterWidthCalculator::getPhiMean
double getPhiMean() const
Definition: PFClusterWidthCalculator.h:15
PFMatch::TrackEtaPhiInFixedLayersProvider::m_endcapLayer
LayerType m_endcapLayer
Definition: PFMatchPositions.h:86
PFMatch::ICluster::phi
virtual double phi() const =0
PFMatch::ICluster::calVarianceStatus
virtual bool calVarianceStatus() const =0
PFMatch::ICluster::nCells
virtual unsigned int nCells() const =0
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
PFMatch::ICluster::setCalVarianceStatus
virtual void setCalVarianceStatus()=0
PFMatchPositions.h
PFClusterWidthCalculator.h
PFMatch::ICluster::cellPhi
virtual const std::vector< double > & cellPhi() const =0
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
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
PFMatch::ICluster::phiVariance
virtual double phiVariance() const =0
PFMatch::ICluster::eta
virtual double eta() const =0