5 #include "Stl3Util/ftf/FtfDedx.h"
13 fCoordTransformer = trafo;
17 fDriftLoss = driftLoss;
20 for (
int sector=0; sector<24; sector++) {
22 fUnitVec[sector].x = fCoordTransformer->GetSectorSin(sector);
23 if (sector+1>12) fUnitVec[sector].x = -1 * fUnitVec[sector].x;
24 fUnitVec[sector].y = fCoordTransformer->GetSectorCos(sector);
50 double cosl = 1 / (::sqrt( 1 + (
double) track->tanl*track->tanl));
53 if ( cosl==0 )
return 0;
56 double tPhi0 = track->psi + track->q * pi/2;
57 if ( tPhi0 > 2*pi ) tPhi0 = tPhi0 - 2*pi;
58 else if ( tPhi0 < 0. ) tPhi0 = tPhi0 + 2*pi;
60 double x0 = track->r0 * cos(track->phi0);
61 double y0 = track->r0 * sin(track->phi0);
62 double rr = track->pt / ( bFactor *track->getPara()->bField );
63 double xc = x0 - rr * cos(tPhi0);
64 double yc = y0 - rr * sin(tPhi0);
73 ihit = (
FtfHit *)ihit->nextTrackHit) {
77 if (ihit->flags)
continue;
86 tangent.x = (ihit->y - yc)/rr;
87 tangent.y = -(ihit->x - xc)/rr;
92 double cosCrossing = fabs(tangent.x * fUnitVec[ihit->sector-1].x + tangent.y * fUnitVec[ihit->sector-1].y);
95 if (ihit->row<14) padLength = padLengthInnerSector;
96 else padLength = padLengthOuterSector;
99 if ( cosCrossing==0 )
continue;
100 double dx = padLength / (cosCrossing * cosl);
104 double scaleDrift = 1 - fabs(ihit->z) * fDriftLoss/100;
111 if (ihit->row<14) deScale = 5.0345021e-9;
112 else deScale = 1.4234702e-8;
114 fDedxArray[nPointsInArray] = ihit->q * deScale / ( dx * scaleDrift );
124 sort( fDedxArray, fDedxArray+nPointsInArray );
127 int cLow = (int) floor(nPointsInArray * fCutLow);
128 int cHigh = (int) floor(nPointsInArray * fCutHigh);
133 for (
int i=cLow; i<cHigh; i++) {
135 track->dedx += fDedxArray[i];
138 if (track->nDedx>0) track->dedx = track->dedx/track->nDedx;