18 const std::string&
name,
30 m_use_mcLUT = use_mcLUT;
42 const int MAX_STATION = 6;
43 const double PHI_RANGE = 12./(
M_PI/8.);
47 float MiddleSlope = 0;
48 float MiddleIntercept = 0;
69 for (
int i_station=0; i_station<MAX_STATION; i_station++) {
80 if ( superPoint->
Npoint > 2 && superPoint->
R > 0.) {
82 InnerSlope = superPoint->
Alin;
83 InnerR = superPoint->
R;
84 InnerZ = superPoint->
Z;
86 MiddleSlope = superPoint->
Alin;
87 MiddleIntercept = superPoint->
R - MiddleSlope*superPoint->
Z;
88 MiddleR = superPoint->
R;
89 MiddleZ = superPoint->
Z;
91 OuterR = superPoint->
R;
92 OuterZ = superPoint->
Z;
101 CSCR = superPoint->
R;
102 CSCZ = superPoint->
Z;
104 phim = superPoint->
Phim;
111 double phi1 = tgcFitResult.
tgcMid1[1];
112 double phi2 = tgcFitResult.
tgcMid2[1];
113 if ( isZero(tgcFitResult.
tgcMid1[3]) || isZero(tgcFitResult.
tgcMid2[3]) ) {
114 if ( !isZero(tgcFitResult.
tgcMid1[3]) ) phi = phi1;
115 if ( !isZero(tgcFitResult.
tgcMid2[3]) ) phi = phi2;
116 }
else if( phi1*phi2 < 0 && std::abs(phi1)>(
M_PI/2.) ) {
117 double tmp1 = (phi1>0)? phi1 -
M_PI : phi1 +
M_PI;
122 phi = (phi2+phi1)/2.;
125 if ( isZero(MiddleZ) ) {
126 if ( !isZero(tgcFitResult.
tgcMid1[0]) && !isZero(tgcFitResult.
tgcMid2[0]) ) {
134 double etaInner = 0.;
135 double etaMiddle = 0.;
136 if ( !isZero(MiddleZ) ) {
137 double theta =
std::atan(MiddleR/std::abs(MiddleZ));
141 if ( !isZero(InnerZ) ) {
142 double theta =
std::atan(InnerR/std::abs(InnerZ));
146 if ( !isZero(MiddleZ) ) trackPattern.
etaMap = etaMiddle;
147 else if ( !isZero(InnerZ) ) trackPattern.
etaMap = etaInner;
148 if ( !isZero(tgcFitResult.
tgcInn[3]) ) phi = tgcFitResult.
tgcInn[1];
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);
152 else trackPattern.
phiMap = phi - phim;
155 double PhiInOctant = std::abs(tgcFitResult.
tgcMid1[1] - Octant * (
M_PI/4.));
156 if (PhiInOctant > (
M_PI/8.)) PhiInOctant = (
M_PI/4.) - PhiInOctant;
159 trackPattern.
phiMS = phi;
160 trackPattern.
pt = std::abs(tgcFitResult.
tgcPT);
161 trackPattern.
charge = (tgcFitResult.
tgcPT!=0.0)? tgcFitResult.
tgcPT/std::abs(tgcFitResult.
tgcPT) : +1;
163 trackPattern.
phiBin =
static_cast<int>(PhiInOctant * PHI_RANGE);
164 trackPattern.
etaBin =
static_cast<int>((std::abs(tgcFitResult.
tgcMid1[0])-1.)/0.05);
167 trackPattern.
phiBinEE =
static_cast<int> (phiEE*96/
M_PI);
173 phi = p_roids->
phi();
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);
177 else trackPattern.
phiMap = phi - phim;
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;
184 trackPattern.
phiMS = phi;
188 trackPattern.
phiBin =
static_cast<int>(PhiInOctant * PHI_RANGE);
189 trackPattern.
etaBin =
static_cast<int>((std::abs(p_roids->
eta())-1.)/0.05);
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);
196 if (!isZero(MiddleZ) && !isZero(OuterZ)) {
197 double slope = (OuterR-MiddleR)/(OuterZ-MiddleZ);
198 double inter = MiddleR - slope*MiddleZ;
200 trackPattern.
endcapAlpha = (*m_ptEndcapLUT)->alpha(MiddleZ,MiddleR,OuterZ,OuterR);
201 trackPattern.
slope = slope;
203 if (!isZero(InnerR)) {
205 trackPattern.
deltaR = slope * InnerZ + MiddleIntercept - InnerR;
207 trackPattern.
endcapRadius = computeRadius(InnerSlope, InnerR, InnerZ,
208 slope, MiddleR, MiddleZ,
216 double slope_modified=(OuterR_modified-MiddleR)/(OuterZ-MiddleZ);
218 ATH_MSG_DEBUG(
"OuterR_modified=" << OuterR_modified <<
" slope_modified=" << slope_modified);
222 if( trackPattern.
pt >= 8. || !tgcFitResult.
isSuccess) {
223 if(!isZero(MiddleZ)) {
224 double Ze = MiddleZ+(std::abs(MiddleZ)/MiddleZ)*1000.;
225 double Re = MiddleSlope*(Ze) + MiddleIntercept;
227 trackPattern.
endcapAlpha = (*m_ptEndcapLUT)->alpha(MiddleZ,MiddleR,Ze,Re);
228 trackPattern.
slope = MiddleSlope;
229 trackPattern.
intercept = MiddleIntercept;
233 if (!isZero(MiddleZ) && !isZero(InnerZ)) {
235 trackPattern.
deltaR = MiddleSlope*InnerZ + MiddleIntercept - InnerR;
237 trackPattern.
endcapRadius = computeRadius(InnerSlope, InnerR, InnerZ,
238 MiddleSlope, MiddleR, MiddleZ,
241 if(!isZero(MiddleZ) && !isZero(CSCZ)){
247 if (std::abs(EEZ)>10000 && std::abs(EEZ)<10600){
248 if ( (!isZero(EBIZ) && !isZero(EEZ)) && !isZero(MiddleZ) ){
249 trackPattern.
endcapRadius3P = computeRadius3Points(EBIZ, EBIR, EEZ, EER, MiddleZ, MiddleR);
250 distance = calcDistance(EBIZ, EBIR, EEZ, EER, MiddleZ, MiddleR);
253 if (std::abs(EEZ)>10600 && std::abs(EEZ)<12000){
254 if ( (!isZero(InnerZ) && !isZero(EEZ)) && !isZero(MiddleZ) ){
255 trackPattern.
endcapRadius3P = computeRadius3Points(InnerZ, InnerR, EEZ, EER, MiddleZ, MiddleR);
256 distance = calcDistance(InnerZ, InnerR, EEZ, EER, MiddleZ, MiddleR);
261 ATH_MSG_DEBUG(
"... alpha/beta/endcapRadius/cscGamma/charge/s_address="
265 return StatusCode::SUCCESS;
272 double MiddleSlope,
double MiddleR,
double MiddleZ,
275 double cr1 = 0.080/400;
278 if (std::abs(
x1)>=0.1) {
282 double A1 = InnerSlope;
283 double A2 = MiddleSlope;
284 if (!(std::abs(MiddleSlope+999)<0.1)) {
290 double xm = (
x1+
x2)/2.;
291 double ym = (
y1+
y2)/2.;
293 double c2_1 = -
x1-A1*
y1;
294 double c2_2 = -
x2-A2*
y2;
297 double xR1 = -A1*yR1-c2_1;
298 double xR2 = -A2*yR2-c2_2;
300 double xR = ((1./cr1)*xR1+(1./cr2)*xR2)/((1./cr1)+(1./cr2));
301 double yR = ((1./cr1)*yR1+(1./cr2)*yR2)/((1./cr1)+(1./cr2));
302 double radius = 0.5*(std::sqrt((xR-
x1)*(xR-
x1)+(yR-
y1)*(yR-
y1))+std::sqrt((xR-
x2)*(xR-
x2)+(yR-
y2)*(yR-
y2)));
310 double EEZ,
double EER,
311 double MiddleZ,
double MiddleR)
319 double x0 = 0., y0 = 0.,
x2 = 0.,
y2 = 0., x3 = 0., y3 = 0.;
322 a3 = ( MiddleZ - InnerZ ) / ( MiddleR - InnerR );
328 x3 = MiddleR - InnerR;
329 y3 = MiddleZ - InnerZ;
336 x3 = ( x3 + y3*
m)*
cost;
337 y3 = (-tm*
m + y3 )*
cost;
342 radius_EE = std::sqrt(x0*x0 + y0*y0);
347 double xm1=(
x1+
x2)/2;
348 double xm2=(
x2+x3)/2;
349 double ym1=(
y1+
y2)/2;
350 double ym2=(
y2+y3)/2;
352 double a2=(
x2-x3)/(y3-
y2);
353 double x0=(a2*xm2-a1*xm1-ym2+ym1)/(a2-a1);
354 double y0=a1*(x0-xm1)+ym1;
355 double a = (x0-
x1)/(
y1-y0);
357 double d=std::abs(
b)/std::sqrt(
a*
a+1);