41{
42 const int MAX_STATION = 6;
43 const double PHI_RANGE = 12./(
M_PI/8.);
44
45
46 float InnerSlope = 0;
47 float MiddleSlope = 0;
48 float MiddleIntercept = 0;
49 float InnerR = 0;
50 float InnerZ = 0;
51 float EER = 0;
52 float EEZ = 0;
53 float MiddleR = 0;
54 float MiddleZ = 0;
55 float OuterR = 0;
56 float OuterZ = 0;
57 float EBIR = 0;
58 float EBIZ = 0;
59
60 float CSCR = 0;
61 float CSCZ = 0;
62
63
65 double phim = 0.;
66
67 TrigL2MuonSA::SuperPoint* superPoint;
68
69 for (int i_station=0; i_station<MAX_STATION; i_station++) {
70
79
80 if ( superPoint->
Npoint > 2 && superPoint->
R > 0.) {
81 if (chamber==3) {
82 InnerSlope = superPoint->
Alin;
83 InnerR = superPoint->
R;
84 InnerZ = superPoint->
Z;
85 } if ( chamber==4 ) {
86 MiddleSlope = superPoint->
Alin;
87 MiddleIntercept = superPoint->
R - MiddleSlope*superPoint->
Z;
88 MiddleR = superPoint->
R;
89 MiddleZ = superPoint->
Z;
90 } if ( chamber==5 ) {
91 OuterR = superPoint->
R;
92 OuterZ = superPoint->
Z;
93 } if ( chamber==6 ) {
96 } if ( chamber==0 ) {
99 } if ( chamber==7 ) {
100
101 CSCR = superPoint->
R;
102 CSCZ = superPoint->
Z;
103 }
104 phim = superPoint->
Phim;
105 }
106 }
107
109
110
111 double phi1 = tgcFitResult.
tgcMid1[1];
112 double phi2 = tgcFitResult.
tgcMid2[1];
116 }
else if( phi1*phi2 < 0 && std::abs(phi1)>(
M_PI/2.) ) {
117 double tmp1 = (phi1>0)? phi1 -
M_PI : phi1 +
M_PI;
121 } else {
122 phi = (phi2+phi1)/2.;
123 }
124
128 } else {
130 tgcFitResult.
tgcMid1[0] : tgcFitResult.tgcMid2[0];
131 }
132 }
133
134 double etaInner = 0.;
135 double etaMiddle = 0.;
137 double theta = std::atan(MiddleR/std::abs(MiddleZ));
138 etaMiddle = -std::log(std::tan(
theta/2.))*MiddleZ/std::abs(MiddleZ);
139 }
140
142 double theta = std::atan(InnerR/std::abs(InnerZ));
143 etaInner = -std::log(std::tan(
theta/2.))*InnerZ/std::abs(InnerZ);
144 }
145
146 if ( !
isZero(MiddleZ) ) trackPattern.
etaMap = etaMiddle;
147 else if ( !
isZero(InnerZ) ) trackPattern.
etaMap = etaInner;
149
150 if ( phim >
M_PI+0.1 ) phim = phim - 2*
M_PI;
151 if ( phim >= 0 ) trackPattern.
phiMap = (
phi>=0.)?
phi - phim : phim - std::abs(
phi);
153
155 double PhiInOctant = std::abs(tgcFitResult.
tgcMid1[1] - Octant * (
M_PI/4.));
156 if (PhiInOctant > (
M_PI/8.)) PhiInOctant = (
M_PI/4.) - PhiInOctant;
157
160 trackPattern.
pt = std::abs(tgcFitResult.
tgcPT);
161 trackPattern.
charge = (tgcFitResult.
tgcPT!=0.0)? tgcFitResult.
tgcPT/std::abs(tgcFitResult.
tgcPT) : +1;
162
163 trackPattern.
phiBin =
static_cast<int>(PhiInOctant * PHI_RANGE);
164 trackPattern.
etaBin =
static_cast<int>((std::abs(tgcFitResult.
tgcMid1[0])-1.)/0.05);
165
166 double phiEE = (tgcFitResult.
tgcMid1[1]>0) ? tgcFitResult.
tgcMid1[1] : tgcFitResult.tgcMid1[1] + 2*
M_PI;
167 trackPattern.
phiBinEE =
static_cast<int> (phiEE*96/
M_PI);
168
169 } else {
170
171
174
175 if ( phim >
M_PI+0.1 ) phim = phim - 2*
M_PI;
176 if ( phim >= 0 ) trackPattern.
phiMap = (
phi>=0.)?
phi - phim : phim - std::abs(
phi);
178
179 int Octant = (
int)(p_roids->
phi() / (
M_PI/4.));
180 double PhiInOctant = std::abs(p_roids->
phi() - Octant * (
M_PI/4.));
181 if (PhiInOctant > (
M_PI/8.)) PhiInOctant = (
M_PI/4.) - PhiInOctant;
182
187
188 trackPattern.
phiBin =
static_cast<int>(PhiInOctant * PHI_RANGE);
189 trackPattern.
etaBin =
static_cast<int>((std::abs(p_roids->
eta())-1.)/0.05);
190
191 double phiEE = (p_roids->
phi()>0) ? p_roids->
phi() : p_roids->
phi() + 2*
M_PI;
192 trackPattern.
phiBinEE =
static_cast<int> (phiEE*96/
M_PI);
193
194 }
195
197 double slope = (OuterR-MiddleR)/(OuterZ-MiddleZ);
198 double inter = MiddleR - slope*MiddleZ;
199
200 trackPattern.
endcapAlpha = (*m_ptEndcapLUT)->alpha(MiddleZ,MiddleR,OuterZ,OuterR);
201 trackPattern.
slope = slope;
204 trackPattern.
endcapBeta = std::abs( std::atan(InnerSlope) - std::atan(slope) );
205 trackPattern.
deltaR = slope * InnerZ + MiddleIntercept - InnerR;
208 slope, MiddleR, MiddleZ,
210 }
213 trackPattern.
cscGamma = std::abs( std::atan( (MiddleR-CSCR)/(MiddleZ-CSCZ) ) - std::atan(MiddleSlope) );
214 }else{
216 double slope_modified=(OuterR_modified-MiddleR)/(OuterZ-MiddleZ);
217 trackPattern.
cscGamma = std::abs( std::atan( (MiddleR-CSCR)/(MiddleZ-CSCZ) ) - std::atan(slope_modified) );
218 ATH_MSG_DEBUG(
"OuterR_modified=" << OuterR_modified <<
" slope_modified=" << slope_modified);
219 }
220 }
221 } else {
222 if( trackPattern.
pt >= 8. || !tgcFitResult.
isSuccess) {
224 double Ze = MiddleZ+(std::abs(MiddleZ)/MiddleZ)*1000.;
225 double Re = MiddleSlope*(Ze) + MiddleIntercept;
226
227 trackPattern.
endcapAlpha = (*m_ptEndcapLUT)->alpha(MiddleZ,MiddleR,Ze,Re);
228 trackPattern.
slope = MiddleSlope;
229 trackPattern.
intercept = MiddleIntercept;
230 }
231 }
232
234 trackPattern.
endcapBeta = std::abs( std::atan(InnerSlope) - std::atan(MiddleSlope) );
235 trackPattern.
deltaR = MiddleSlope*InnerZ + MiddleIntercept - InnerR;
238 MiddleSlope, MiddleR, MiddleZ,
240 }
242 trackPattern.
cscGamma = std::abs( std::atan( (MiddleR-CSCR)/(MiddleZ-CSCZ) ) - std::atan(MiddleSlope) );
243 }
244 }
245
247 if (std::abs(EEZ)>10000 && std::abs(EEZ)<10600){
251 }
252 }
253 if (std::abs(EEZ)>10600 && std::abs(EEZ)<12000){
257 }
258 }
260
261 ATH_MSG_DEBUG(
"... alpha/beta/endcapRadius/cscGamma/charge/s_address="
264
265 return StatusCode::SUCCESS;
266}
Scalar phi() const
phi method
Scalar theta() const
theta method
virtual double phi() const override final
Methods to retrieve data members.
virtual double eta() const override final
double computeRadius3Points(double InnerZ, double InnerR, double EEZ, double EER, double MiddleZ, double MiddleR) const
double computeRadius(double InnerSlope, double InnerR, double InnerZ, double MiddleSlope, double MiddleR, double MiddleZ, double sign) const
bool isZero(float value, float tolerance=1e-5) const
double calcDistance(double x1, double y1, double x2, double y2, double x3, double y3) const
TrigL2MuonSA::SuperPoint superPoints[s_NCHAMBER]
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
@ BarrelInner
Inner station in the barrel spectrometer.
@ EndcapOuter
Outer station in the endcap spectrometer.
@ CSC
CSC measurement point.
@ EndcapMiddle
Middle station in the endcap spectrometer.
@ EndcapExtra
Extra station in the endcap spectrometer.
@ EndcapInner
Inner station in the endcap spectrometer.