ATLAS Offline Software
Loading...
Searching...
No Matches
CandidateMatchHelpers.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
7#include <cmath>
8
11 const Amg::Vector3D& point,
12 const bool isEndCap)
13{
14
15 return approxXYZwrtATLAS(cluster, isEndCap) - point;
16}
17
20 const bool isEndCap)
21{
22 // These are at the face of the calorimeter
23 const double RfaceCalo = 1500;
24 const double ZfaceCalo = 3700;
25 // Get the Rclus , Zclus given the cluster eta
26 double Rclus = RfaceCalo;
27 double Zclus = ZfaceCalo;
28 const double clusterEta = cluster.eta();
29 if (clusterEta != 0) {
30 /*
31 * tahn(eta) == cos(theta)
32 * 1/cosh(clusterEta) == sin(theta)
33 * tan =sin/cos
34 */
35 const double tanthetaclus = (1.0 / std::cosh(clusterEta)) / std::tanh(clusterEta);
36 if (isEndCap) {
37 Rclus = std::abs(ZfaceCalo * (tanthetaclus));
38 // Negative Eta ---> negative Z
39 if (clusterEta < 0) {
40 Zclus = -Zclus;
41 }
42 } else {
43 if (tanthetaclus != 0) {
44 Zclus = RfaceCalo / (tanthetaclus);
45 }
46 }
47 } else { // when eta ==0
48 Zclus = 0;
49 }
50
51 const double clusterPhi = cluster.phi();
52 return { Rclus * std::cos(clusterPhi), Rclus * std::sin(clusterPhi), Zclus };
53}
54
55double
57 const double Eta,
58 const int charge,
59 const double r_first,
60 const bool isEndCap)
61{
62 // Used in order to derive the formula below
63 const double Rcalo = 1200;
64
65 // correct phi for extrapolation to calo
66 double phiRot = 0.0;
67 double ecCorr = 1.0;
68 if (isEndCap) {
69 const double ecFactor = 1.0 / (0.8 * std::atan(15.0 / 34.0));
70 const double sinTheta0 = 2.0 * std::atan(std::exp(-std::abs(Eta)));
71 ecCorr = sinTheta0 * std::sqrt(sinTheta0) * ecFactor;
72 }
74 const double Rscaled = (Rcalo - r_first) * (1. / Rcalo);
75 phiRot = Rscaled * ecCorr * charge * 430. / (Et);
76 return phiRot;
77}
78
double charge(const T &p)
Definition AtlasPID.h:997
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
Eigen::Matrix< double, 3, 1 > Vector3D
double PhiROT(const double pt, const double eta, const int charge, const double r_start, const bool isEndCap)
Function to calculate the approximate rotation in phi/bending of a track until it reaches the calo.
Amg::Vector3D approxXYZwrtPoint(const xAOD::CaloCluster &cluster, const Amg::Vector3D &point, const bool isEndCap)
Function to get the (x,y,z) of the cluster wrt to a point (x0,y0,z0)
Amg::Vector3D approxXYZwrtATLAS(const xAOD::CaloCluster &clusterEta, const bool isEndCap)
Function to get the (x,y,z) of the cluster in the ATLAS frame origin (0,0,0)
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.