ATLAS Offline Software
Loading...
Searching...
No Matches
PtFromRadius.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "PtFromRadius.h"
6
7#include "TMath.h"
8
10
11// --------------------------------------------------------------------------------
12// --------------------------------------------------------------------------------
13
15 const std::string& name,
16 const IInterface* parent):
17 AthAlgTool(type, name, parent)
18{
19}
20
21// --------------------------------------------------------------------------------
22// --------------------------------------------------------------------------------
23
25 const TrigL2MuonSA::PtBarrelLUTSvc* ptBarrelLUTSvc)
26{
27 m_use_mcLUT = use_mcLUT;
28 m_ptBarrelLUT = ptBarrelLUTSvc->ptBarrelLUT();
29}
30
31// --------------------------------------------------------------------------------
32// --------------------------------------------------------------------------------
33
35{
36 const double ZERO_LIMIT = 1e-5;
37 const PtBarrelLUT::LUT& lut = (*m_ptBarrelLUT)->lut();
38 const PtBarrelLUT::LUTsp& lutSP = (*m_ptBarrelLUT)->lutSP();
39
40 TrigL2MuonSA::SuperPoint* superPoints[3];
41 for (int i_station=0; i_station<3; i_station++) {
42 superPoints[i_station] = &(trackPattern.superPoints[i_station]);
43 }
44
45 int etabin,phibin,neweta,newphi,ch,add;
46 float phistep,etastep,pstep,dist,distp,disteta,distphi;
47 float A0[6]={0.,0.,0.,0.,0.,0.},A1[6]={0.,0.,0.,0.,0.,0.};
48
49 const float scale = 0.1;
50
51 if(trackPattern.barrelRadius > ZERO_LIMIT) {
52 add = trackPattern.s_address;
53 etabin = (int)((trackPattern.etaMap - lut.EtaMin[add])/lut.EtaStep[add]);
54 phibin = (int)((trackPattern.phiMap - lut.PhiMin[add])/lut.PhiStep[add]);
55
56 if(etabin<=-1) etabin = 0;
57 if(etabin>=lut.NbinEta[add]) etabin = lut.NbinEta[add]-1;
58 if(phibin<=-1) phibin = 0;
59 if(phibin>=lut.NbinPhi[add]) phibin = lut.NbinPhi[add]-1;
60
61 trackPattern.etaBin = etabin;
62 trackPattern.phiBin = phibin;
63
64 disteta = trackPattern.etaMap - (etabin*lut.EtaStep[add] +
65 lut.EtaStep[add]/2. + lut.EtaMin[add]);
66 distphi = trackPattern.phiMap - (phibin*lut.PhiStep[add] +
67 lut.PhiStep[add]/2. + lut.PhiMin[add]);
68 neweta = (disteta >= 0.) ? etabin+1 : etabin-1;
69 newphi = (distphi >= 0.) ? phibin+1 : phibin-1;
70 etastep = (disteta >= 0.) ? lut.EtaStep[add] : -lut.EtaStep[add];
71 phistep = (distphi >= 0.) ? lut.PhiStep[add] : -lut.PhiStep[add];
72
73 ch = (trackPattern.charge>=0.)? 1 : 0;
74
75 if( add==1 ) {
76 // Use special table for Large-SP data
77
78 int iR = ( superPoints[0]->R > 5800 )? 1: 0;
79 int qeta = ( trackPattern.charge*trackPattern.etaMap >= 0.)? 1 : 0;
80
81 A0[0] = lutSP.table_LargeSP[qeta][iR][etabin][phibin][0];
82 A1[0] = lutSP.table_LargeSP[qeta][iR][etabin][phibin][1];
83
84 trackPattern.pt = trackPattern.barrelRadius*A0[0] + A1[0];
85
86 } else {
87
88 A0[0] = lut.table[add][ch][etabin][phibin][0];
89 A1[0] = lut.table[add][ch][etabin][phibin][1];
90 if((neweta<0||neweta>=lut.NbinEta[add])&&
91 (newphi<0||newphi>=lut.NbinPhi[add])) {
92 trackPattern.pt = trackPattern.barrelRadius*scale*A0[0] + A1[0];
93 } else if (neweta<0||neweta>=lut.NbinEta[add]) {
94 A0[1] = lut.table[add][ch][etabin][newphi][0];
95 A1[1] = lut.table[add][ch][etabin][newphi][1];
96 A0[2] = A0[0] + ((A0[1] - A0[0])/phistep)*distphi;
97 A1[2] = A1[0] + ((A1[1] - A1[0])/phistep)*distphi;
98 trackPattern.pt = trackPattern.barrelRadius*scale*A0[2] + A1[2];
99 } else if (newphi<0||newphi>=lut.NbinPhi[add]) {
100 A0[1] = lut.table[add][ch][neweta][phibin][0];
101 A1[1] = lut.table[add][ch][neweta][phibin][1];
102 A0[2] = A0[0] + ((A0[1] - A0[0])/etastep)*disteta;
103 A1[2] = A1[0] + ((A1[1] - A1[0])/etastep)*disteta;
104 trackPattern.pt = trackPattern.barrelRadius*scale*A0[2] + A1[2];
105 } else {
106 if(disteta >= distphi*lut.EtaStep[add]/lut.PhiStep[add]) {
107 A0[1] = lut.table[add][ch][neweta][phibin][0];
108 A1[1] = lut.table[add][ch][neweta][phibin][1];
109 A0[2] = lut.table[add][ch][neweta][newphi][0];
110 A1[2] = lut.table[add][ch][neweta][newphi][1];
111 A0[3] = A0[0] + ((A0[1] - A0[0])/etastep)*disteta;
112 A1[3] = A1[0] + ((A1[1] - A1[0])/etastep)*disteta;
113 dist = std::sqrt(phistep*phistep + etastep*etastep);
114 distp = std::sqrt(disteta*disteta + distphi*distphi);
115 A0[4] = A0[0] + ((A0[2] - A0[0])/dist)*distp;
116 A1[4] = A1[0] + ((A1[2] - A1[0])/dist)*distp;
117 pstep = (phistep/dist)*distp;
118 A0[5] = A0[3] + ((A0[4] - A0[3])/pstep)*distphi;
119 A1[5] = A1[3] + ((A1[4] - A1[3])/pstep)*distphi;
120 trackPattern.pt = trackPattern.barrelRadius*scale*A0[5] + A1[5];
121 } else {
122 A0[1] = lut.table[add][ch][etabin][newphi][0];
123 A1[1] = lut.table[add][ch][etabin][newphi][1];
124 A0[2] = lut.table[add][ch][neweta][newphi][0];
125 A1[2] = lut.table[add][ch][neweta][newphi][1];
126 A0[3] = A0[0] + ((A0[1] - A0[0])/phistep)*distphi;
127 A1[3] = A1[0] + ((A1[1] - A1[0])/phistep)*distphi;
128 dist = std::sqrt(phistep*phistep + etastep*etastep);
129 distp = std::sqrt(disteta*disteta + distphi*distphi);
130 A0[4] = A0[0] + ((A0[2] - A0[0])/dist)*distp;
131 A1[4] = A1[0] + ((A1[2] - A1[0])/dist)*distp;
132 pstep = (etastep/dist)*distp;
133 A0[5] = A0[3] + ((A0[4] - A0[3])/pstep)*disteta;
134 A1[5] = A1[3] + ((A1[4] - A1[3])/pstep)*disteta;
135 trackPattern.pt = trackPattern.barrelRadius*scale*A0[5] + A1[5];
136 }
137 }
138 }
139 }
140
141 ATH_MSG_DEBUG("pT determined from radius: barrelRadius/barrelSagitta/pT/charge/s_address="
142 << trackPattern.barrelRadius << "/" << trackPattern.barrelSagitta << "/"
143 << trackPattern.pt << "/" << trackPattern.charge << "/" << trackPattern.s_address);
144
145
146 return StatusCode::SUCCESS;
147}
148
149// --------------------------------------------------------------------------------
150// --------------------------------------------------------------------------------
151
#define ATH_MSG_DEBUG(x)
const float ZERO_LIMIT
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
const ToolHandle< PtBarrelLUT > * ptBarrelLUT(void) const
void setMCFlag(bool m_use_mcLUT, const TrigL2MuonSA::PtBarrelLUTSvc *ptBarrelLUTSvc)
const ToolHandle< PtBarrelLUT > * m_ptBarrelLUT
StatusCode setPt(TrigL2MuonSA::TrackPattern &trackPattern) const
PtFromRadius(const std::string &type, const std::string &name, const IInterface *parent)
TrigL2MuonSA::SuperPoint superPoints[s_NCHAMBER]
Definition TrackData.h:60
bool add(const std::string &hname, TKey *tobj)
Definition fastadd.cxx:55
float table_LargeSP[2][2][30][30][2]
Definition PtBarrelLUT.h:33