- // Calibration values
- Double_t vdrift = fCalVdriftDetValue * fCalVdriftROC->GetValue(col,row);
- Double_t t0 = fCalT0DetValue + fCalT0ROC->GetValue(col,row);
-
- // T0 correction
- Double_t timeT0Cal = time - t0;
- // Calculate the X-position,
- Double_t xLocal = (timeT0Cal + 0.5) / fSamplingFrequency * vdrift;
-
- // Length of the amplification region
- Double_t ampLength = (Double_t) AliTRDgeometry::CamHght();
- // The drift distance
- Double_t driftLength = TMath::Max(xLocal - 0.5*ampLength,0.0);
- // ExB correction
- Double_t exbCorr = fCalibration->GetOmegaTau(vdrift
- ,-0.1*AliTracker::GetBz());
-
- // Pad dimensions
- Double_t rowSize = fPadPlane->GetRowSize(row);
- Double_t colSize = fPadPlane->GetColSize(col);
-
- // Invert the X-position,
- // apply ExB correction to the Y-position
- // and move to the Z-position relative to the middle of the chamber
- posLocal[0] = -xLocal;
- posLocal[1] = (fPadPlane->GetColPos(col) - (x[0] + 0.5) * colSize) - driftLength * exbCorr;
- posLocal[2] = (fPadPlane->GetRowPos(row) - 0.5 * rowSize) - fZShiftIdeal;
-
- // Go to tracking coordinates
- fMatrix->LocalToMaster(posLocal,posTracking);
-
- // The total charge of the cluster
- Double_t q0 = x[1];
- Double_t q1 = x[2];
- Double_t q2 = x[3];
- Double_t clusterCharge = q0 + q1 + q2;
- Double_t clusterSigmaY2 = 0.0;
- if (clusterCharge > 0.0) {
- clusterSigmaY2 = (q1 * (q0 + q2) + 4.0 * q0 * q2)
- / (clusterCharge*clusterCharge);
- }
-
- // Output values
- x[0] = posTracking[0] + kX0shift;
- x[1] = posTracking[1];
- x[2] = posTracking[2];
- x[3] = clusterCharge;
- x[4] = colSize*colSize * (clusterSigmaY2 + 1.0/12.0);
- x[5] = rowSize*rowSize / 12.0;
- i[2] = TMath::Nint(timeT0Cal);
-
- // A.Bercuci for TRD tracking calibration awareness
- out = (i[2] < 0 || i[2] > Int_t(3.5*fSamplingFrequency/vdrift)) ? kTRUE : kFALSE;
-
- return kTRUE;
-
- }
+ // Retrieve calibration values
+ Int_t col = c->GetPadCol(), row = c->GetPadRow();
+ // drift velocity
+ Double_t vd = fCalVdriftDetValue * fCalVdriftROC->GetValue(col,row);
+ // t0
+ Double_t t0 = fCalT0DetValue + fCalT0ROC->GetValue(col,row);
+ t0 /= fSamplingFrequency;
+ // ExB correction
+ Double_t exb = AliTRDCommonParam::Instance()->GetOmegaTau(vd);
+
+ Float_t x = c->GetXloc(t0, vd);
+
+ // Pad dimensions
+ Double_t rs = fPadPlane->GetRowSize(row);
+ Double_t cs = fPadPlane->GetColSize(col);
+
+ // cluster error with diffusion corrections
+ Double_t s2 = cs*fCalPRFROC->GetValue(col, row);
+ s2 *= s2;
+ Float_t dl, dt;
+ AliTRDCommonParam::Instance()->GetDiffCoeff(dl, dt, vd);
+
+ Double_t y0 = fPadPlane->GetColPos(col) + .5*cs;
+ Double_t loc[] = {
+ kX0shift-x, // Invert the X-position,
+ c->GetYloc(y0, s2, cs) - x*exb,// apply ExB correction
+ fPadPlane->GetRowPos(row) - .5*rs - fZShiftIdeal // move the Z-position relative to the middle of the chamber
+ };
+
+ // Go to tracking coordinates
+ Double_t trk[3];
+ fMatrix->LocalToMaster(loc, trk);
+
+ // store tracking values
+ c->SetX(trk[0]);c->SetY(trk[1]);c->SetZ(trk[2]);
+ c->SetSigmaY2(s2, dt, exb, x);
+ c->SetSigmaZ2(fPadPlane->GetRowSize(row)*fPadPlane->GetRowSize(row)/12.);
+
+ return kTRUE;