ATLAS Offline Software
Loading...
Searching...
No Matches
egammaClusterHelpers Namespace Reference

Functions

std::pair< const double, const double > etaphi_range (const CaloDetDescrManager &mgr, double eta, double phi, CaloCell_ID::CaloSample sampling, const CaloDetDescrElement *elt)
 Duplicate code.
void fillPositionsInCalo (xAOD::CaloCluster *cluster, const CaloDetDescrManager &mgr)
 Function to decorate the calo cluster with position variables.
void makeCorrection1 (xAOD::CaloCluster *cluster, const CaloDetDescrManager &mgr, const CaloSampling::CaloSample sample)
 functions to make 1st sampling (strips) specific corrections
void refineEta1Position (xAOD::CaloCluster *cluster, const CaloDetDescrManager &mgr)
 function to refine position in eta1

Function Documentation

◆ etaphi_range()

std::pair< const double, const double > egammaClusterHelpers::etaphi_range ( const CaloDetDescrManager & mgr,
double eta,
double phi,
CaloCell_ID::CaloSample sampling,
const CaloDetDescrElement * elt )

Duplicate code.

Return eta/phi ranges encompassing +- 1 cell.

Parameters
etaCentral eta value.
phiCentral phi value.
samplingThe sampling to use.
[out]detaRange in eta.
[out]dphiRange in phi.

This can be a little tricky due to misalignments and the fact that cells have different sizes in different regions. Also, CaloLayerCalculator takes only a symmetric eta range. We try to find the neighboring cells by starting from the center cell and looking a little bit more than half its width in either direction, and finding the centers of those cells. Then we use the larger of these for the symmetric range.

Definition at line 13 of file egammaClusterHelpers.cxx.

18 {
19 // Should be smaller than the eta half-width of any cell.
20 constexpr double eps = 0.001;
21
22 // Now look in the negative eta direction, on the low (left) side.
23 const CaloDetDescrElement* elt_l = mgr.get_element_raw(sampling, eta - elt->deta() - eps, phi);
24 double deta_l = elt_l ? std::abs(eta - elt_l->eta_raw()) + eps : 0.;
25
26 // Now look in the positive eta direction, on the high (right) side.
27 const CaloDetDescrElement* elt_r = mgr.get_element_raw(sampling, eta + elt->deta() + eps, phi);
28 double deta_r = elt_r ? std::abs(eta - elt_r->eta_raw()) + eps : 0.;
29
30 // Now for the phi variation.
31 // The phi size can change as a function of eta, but not of phi.
32 // Thus we have to look again at the adjacent eta cells, and
33 // take the largest variation.
34
35 // Now look in the negative eta direction, on the low-eta () side.
36 elt_l = mgr.get_element_raw(sampling, eta - elt->deta() - eps, CaloPhiRange::fix(phi - elt->dphi() - eps));
37 double dphi_l = elt_l ? std::abs(CaloPhiRange::fix(phi - elt_l->phi_raw())) + eps : 0.;
38
39 // Now look in the positive eta direction, on the positive (down) side.
40 elt_r = mgr.get_element_raw(sampling, eta + elt->deta() + eps, CaloPhiRange::fix(phi - elt->dphi() - eps));
41 double dphi_r = elt_r ? std::abs(CaloPhiRange::fix(phi - elt_r->phi_raw())) + eps : 0.;
42
43 // Total is twice the maximum.
44 return {2 * std::max(deta_r, deta_l), 2 * std::max(dphi_l, dphi_r)};
45}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
This class groups all DetDescr information related to a CaloCell.
static double fix(double phi)

◆ fillPositionsInCalo()

void egammaClusterHelpers::fillPositionsInCalo ( xAOD::CaloCluster * cluster,
const CaloDetDescrManager & mgr )

Function to decorate the calo cluster with position variables.

Filling eta phi in calo-frame:

Definition at line 48 of file egammaClusterHelpers.cxx.

49 {
50 bool isBarrel = cluster->inBarrel();
51 const bool isEndcap = cluster->inEndcap();
52 if (isBarrel && isEndcap) {
53 isBarrel = cluster->eSample(CaloSampling::EMB2)
54 >= cluster->eSample(CaloSampling::EME2);
55 }
57 isBarrel ? CaloCell_ID::EMB2 : CaloCell_ID::EME2;
58 // eta and phi of the cluster in the calorimeter frame
59 double eta;
60 double phi;
62 mgr, sample, cluster->eta(), cluster->phi(), eta, phi);
65 // eta in the second sampling
67 mgr, sample, cluster->etaBE(2), cluster->phiBE(2), eta, phi);
70 // eta in the first sampling
71 sample = isBarrel ? CaloCell_ID::EMB1 : CaloCell_ID::EME1;
73 mgr, sample, cluster->etaBE(1), cluster->phiBE(1), eta, phi);
76 }
static bool getDetPosition(const CaloDetDescrManager &mgr, CaloCell_ID::CaloSample sam, double etaAtlas, double phiAtlas, double &etaDet, double &phiDet)
get Detector level eta-phi position from Atlas level (aligned) position
CaloSampling::CaloSample CaloSample
Definition CaloCell_ID.h:53
float phiBE(const unsigned layer) const
Get the phi in one layer of the EM Calo.
virtual double eta() const
The pseudorapidity ( ) of the particle.
void insertMoment(MomentType type, double value)
bool inBarrel() const
Returns true if at least one clustered cell in the barrel.
float eSample(const CaloSample sampling) const
bool inEndcap() const
Returns true if at least one clustered cell in the endcap.
virtual double phi() const
The azimuthal angle ( ) of the particle.
@ ETA2CALOFRAME
Eta of sampling 2 in the calo frame (for egamma)
@ ETACALOFRAME
Eta in the calo frame (for egamma)
@ PHI2CALOFRAME
Phi of sampling 2 in the calo frame (for egamma)
@ PHI1CALOFRAME
Phi of sampling 1 in the calo frame (for egamma)
@ PHICALOFRAME
Phi in the calo frame (for egamma)
@ ETA1CALOFRAME
Eta of sampling 1 in the calo frame (for egamma)
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.

◆ makeCorrection1()

void egammaClusterHelpers::makeCorrection1 ( xAOD::CaloCluster * cluster,
const CaloDetDescrManager & mgr,
const CaloSampling::CaloSample sample )

functions to make 1st sampling (strips) specific corrections

Definition at line 79 of file egammaClusterHelpers.cxx.

82 {
83 const double clusterEtaMax = cluster->etamax(sample);
84 const double clusterPhiMax = cluster->phimax(sample);
85
86 // Protections.
87 if (clusterEtaMax == -999. || clusterPhiMax == -999.) {
88 return;
89 }
90 if (std::abs(clusterEtaMax) < 1E-6 && std::abs(clusterPhiMax) < 1E-6) {
91 return;
92 }
93
94 // Get the hottest in raw co-ordinates
95 // We have two kinds of enums ...
96 const CaloCell_ID::CaloSample xsample =
97 (sample == CaloSampling::EMB1) ? CaloCell_ID::EMB1 : CaloCell_ID::EME1;
98
99 const CaloDetDescrElement* dde = mgr.get_element(xsample,
100 clusterEtaMax,
101 clusterPhiMax);
102
103 if (!dde) {
104 return;
105 }
106
107 double etamax = dde->eta_raw();
108 double phimax = dde->phi_raw();
109
110 const CaloDetDescrElement* elt = mgr.get_element_raw(xsample, etamax, phimax);
111 if (!elt) {
112 return;
113 }
114
115 // Now Locate the +-1 range, use raw co-ordinates here.
116 auto [detastr, dphistr] = etaphi_range(mgr, etamax, phimax, xsample, elt);
117
118 // Given the range refine the position employing the smaller window
119 if (detastr > 0 && dphistr > 0) {
120 CaloLayerCalculator helper;
121 const auto* const cellLink = cluster->getCellLinks();
122 helper.fill(cellLink->begin(),
123 cellLink->end(),
124 etamax,
125 phimax,
126 detastr,
127 dphistr,
128 sample);
129
130 // Here is where we (re-)fill the eta in the 1st sampling
131 if (helper.etam() != -999.) {
132 // This is "real" atlas co-ordinates
133 cluster->setEta(sample, helper.etam());
134 }
135 }
136 }
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
bool setEta(const CaloSample sampling, const float eta)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
float etamax(const CaloSample sampling) const
Retrieve of cell with maximum energy in given sampling.
float phimax(const CaloSample sampling) const
Retrieve of cell with maximum energy in given sampling.
std::pair< const double, const double > etaphi_range(const CaloDetDescrManager &mgr, double eta, double phi, CaloCell_ID::CaloSample sampling, const CaloDetDescrElement *elt)
Duplicate code.

◆ refineEta1Position()

void egammaClusterHelpers::refineEta1Position ( xAOD::CaloCluster * cluster,
const CaloDetDescrManager & mgr )

function to refine position in eta1

Definition at line 139 of file egammaClusterHelpers.cxx.

140 {
141 // This only makes sense if we have cells there
142 if (!cluster->hasSampling(CaloSampling::EMB1) &&
143 !cluster->hasSampling(CaloSampling::EME1)) {
144 return;
145 }
146 // Now calculare the position using cells in barrel or endcap or both
147 const double aeta = std::abs(cluster->etaBE(2));
148 if (aeta < 1.6 && cluster->hasSampling(CaloSampling::EMB1)) {
149 makeCorrection1(cluster, mgr, CaloSampling::EMB1);
150 }
151 if (aeta > 1.3 && cluster->hasSampling(CaloSampling::EME1)) {
152 makeCorrection1(cluster, mgr, CaloSampling::EME1);
153 }
154 }
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.
void makeCorrection1(xAOD::CaloCluster *cluster, const CaloDetDescrManager &mgr, const CaloSampling::CaloSample sample)
functions to make 1st sampling (strips) specific corrections