#include <TGeoMatrix.h>
#include "AliLog.h"
-#include "AliTracker.h"
-#include "AliCodeTimer.h"
#include "AliTRDtransform.h"
#include "AliTRDcluster.h"
ClassImp(AliTRDtransform)
//_____________________________________________________________________________
-//AliTRDtransform::AliTRDtransform()
-// :AliTransform()
AliTRDtransform::AliTRDtransform()
:TObject()
- ,fGeo(0x0)
,fDetector(0)
,fParam(0x0)
,fCalibration(0x0)
,fCalVdriftROC(0x0)
,fCalT0ROC(0x0)
- ,fCalVdriftDet(0x0)
- ,fCalT0Det(0x0)
+ ,fCalPRFROC(0x0)
+ ,fkCalVdriftDet(0x0)
+ ,fkCalT0Det(0x0)
+ ,fkCalExBDet(0x0)
,fCalVdriftDetValue(0)
,fCalT0DetValue(0)
+ ,fCalExBDetValue(0)
,fSamplingFrequency(0)
,fPadPlane(0x0)
,fZShiftIdeal(0)
// AliTRDtransform default constructor
//
+ fParam = AliTRDCommonParam::Instance();
+ if (!fParam) {
+ AliError("Could not get common parameters\n");
+ }
+ fSamplingFrequency = fParam->GetSamplingFrequency();
+
+ fCalibration = AliTRDcalibDB::Instance();
+ if (!fCalibration) {
+ AliError("Cannot find calibration object");
+ }
+
+ // Get the calibration objects for the global calibration
+ fkCalVdriftDet = fCalibration->GetVdriftDet();
+ fkCalT0Det = fCalibration->GetT0Det();
+ fkCalExBDet = fCalibration->GetExBDet();
+
}
//_____________________________________________________________________________
-//AliTRDtransform::AliTRDtransform(Int_t det)
-// :AliTransform()
AliTRDtransform::AliTRDtransform(Int_t det)
:TObject()
- ,fGeo(0x0)
,fDetector(0)
,fParam(0x0)
,fCalibration(0x0)
,fCalVdriftROC(0x0)
,fCalT0ROC(0x0)
- ,fCalVdriftDet(0x0)
- ,fCalT0Det(0x0)
+ ,fCalPRFROC(0x0)
+ ,fkCalVdriftDet(0x0)
+ ,fkCalT0Det(0x0)
+ ,fkCalExBDet(0x0)
,fCalVdriftDetValue(0)
,fCalT0DetValue(0)
+ ,fCalExBDetValue(0)
,fSamplingFrequency(0)
,fPadPlane(0x0)
,fZShiftIdeal(0)
// AliTRDtransform constructor for a given detector
//
- fGeo = new AliTRDgeometry();
- if (!fGeo->CreateClusterMatrixArray()) {
- AliError("Could not get transformation matrices\n");
- }
-
fParam = AliTRDCommonParam::Instance();
if (!fParam) {
AliError("Could not get common parameters\n");
}
// Get the calibration objects for the global calibration
- fCalVdriftDet = fCalibration->GetVdriftDet();
- fCalT0Det = fCalibration->GetT0Det();
+ fkCalVdriftDet = fCalibration->GetVdriftDet();
+ fkCalT0Det = fCalibration->GetT0Det();
+ fkCalExBDet = fCalibration->GetExBDet();
SetDetector(det);
}
//_____________________________________________________________________________
-//AliTRDtransform::AliTRDtransform(const AliTRDtransform &t)
-// :AliTransform(t)
AliTRDtransform::AliTRDtransform(const AliTRDtransform &t)
:TObject(t)
- ,fGeo(0x0)
,fDetector(t.fDetector)
,fParam(0x0)
,fCalibration(0x0)
,fCalVdriftROC(0x0)
,fCalT0ROC(0x0)
- ,fCalVdriftDet(0x0)
- ,fCalT0Det(0x0)
+ ,fCalPRFROC(0x0)
+ ,fkCalVdriftDet(0x0)
+ ,fkCalT0Det(0x0)
+ ,fkCalExBDet(0x0)
,fCalVdriftDetValue(0)
,fCalT0DetValue(0)
+ ,fCalExBDetValue(0)
,fSamplingFrequency(0)
,fPadPlane(0x0)
,fZShiftIdeal(0)
// AliTRDtransform copy constructor
//
- if (fGeo) {
- delete fGeo;
- }
- fGeo = new AliTRDgeometry();
- fGeo->CreateClusterMatrixArray();
-
fParam = AliTRDCommonParam::Instance();
if (!fParam) {
AliError("Could not get common parameters\n");
if (!fCalibration) {
AliError("Cannot find calibration object");
}
- fCalVdriftDet = fCalibration->GetVdriftDet();
- fCalT0Det = fCalibration->GetT0Det();
-
+ fkCalVdriftDet = fCalibration->GetVdriftDet();
+ fkCalT0Det = fCalibration->GetT0Det();
+ fkCalExBDet = fCalibration->GetExBDet();
}
//_____________________________________________________________________________
//
// AliTRDtransform destructor
//
+ delete fCalibration;
+}
+
+//_____________________________________________________________________________
+AliTRDtransform &AliTRDtransform::operator=(const AliTRDtransform &t)
+{
+ //
+ // Assignment operator
+ //
+
+ if (this != &t) {
+ ((AliTRDtransform &) t).Copy(*this);
+ }
+
+ return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDtransform::Copy(TObject &t) const
+{
+ //
+ // Copy function
+ //
- if (fGeo) {
- delete fGeo;
+ ((AliTRDtransform &) t).fDetector = fDetector;
+ ((AliTRDtransform &) t).fParam = AliTRDCommonParam::Instance();
+ ((AliTRDtransform &) t).fCalibration = AliTRDcalibDB::Instance();
+ if (fCalibration) {
+ ((AliTRDtransform &) t).fkCalVdriftDet = fCalibration->GetVdriftDet();
+ ((AliTRDtransform &) t).fkCalT0Det = fCalibration->GetT0Det();
+ ((AliTRDtransform &) t).fkCalExBDet = fCalibration->GetExBDet();
}
+ else {
+ ((AliTRDtransform &) t).fkCalVdriftDet = 0;
+ ((AliTRDtransform &) t).fkCalT0Det = 0;
+ ((AliTRDtransform &) t).fkCalExBDet = 0;
+ }
+ ((AliTRDtransform &) t).fCalVdriftROC = 0x0;
+ ((AliTRDtransform &) t).fCalT0ROC = 0x0;
+ ((AliTRDtransform &) t).fCalPRFROC = 0x0;
+ ((AliTRDtransform &) t).fCalVdriftDetValue = 0;
+ ((AliTRDtransform &) t).fCalT0DetValue = 0;
+ ((AliTRDtransform &) t).fCalExBDetValue = 0;
+ ((AliTRDtransform &) t).fSamplingFrequency = 0;
+ ((AliTRDtransform &) t).fPadPlane = 0x0;
+ ((AliTRDtransform &) t).fZShiftIdeal = 0;
+ ((AliTRDtransform &) t).fMatrix = 0x0;
+
+}
+//_____________________________________________________________________________
+AliTRDgeometry& AliTRDtransform::Geometry()
+{
+ static AliTRDgeometry g;
+ if (!g.CreateClusterMatrixArray()) {
+ AliErrorGeneral("AliTRDtransform::Geometry()", "Could not get transformation matrices\n");
+ }
+ return g;
}
//_____________________________________________________________________________
// Get the calibration objects for the pad-by-pad calibration
fCalVdriftROC = fCalibration->GetVdriftROC(det);
fCalT0ROC = fCalibration->GetT0ROC(det);
+ fCalPRFROC = fCalibration->GetPRFROC(det);
// Get the detector wise defined calibration values
- fCalVdriftDetValue = fCalVdriftDet->GetValue(det);
- fCalT0DetValue = fCalT0Det->GetValue(det);
+ fCalVdriftDetValue = fkCalVdriftDet->GetValue(det);
+ fCalT0DetValue = fkCalT0Det->GetValue(det);
+ fCalExBDetValue = fkCalExBDet->GetValue(det);
// Shift needed to define Z-position relative to middle of chamber
- Int_t pla = fGeo->GetPlane(det);
- Int_t cha = fGeo->GetChamber(det);
- fPadPlane = fGeo->GetPadPlane(pla,cha);
+ Int_t layer = Geometry().GetLayer(det);
+ Int_t stack = Geometry().GetStack(det);
+ fPadPlane = Geometry().GetPadPlane(layer,stack);
fZShiftIdeal = 0.5 * (fPadPlane->GetRow0() + fPadPlane->GetRowEnd());
// Get the current transformation matrix
- fMatrix = fGeo->GetClusterMatrix(det);
+ fMatrix = Geometry().GetClusterMatrix(det);
}
//_____________________________________________________________________________
-Bool_t AliTRDtransform::Transform(Double_t *x, Int_t *i, UInt_t time
- , Int_t /*coordinateType*/)
+Bool_t AliTRDtransform::Transform(AliTRDcluster *c)
{
//
// Transforms the local cluster coordinates into calibrated
//
// Here the calibration for T0, Vdrift and ExB is applied as well.
//
- // Input:
- // x[0] = COL-position relative to the center pad (pad units)
- // x[1] = cluster signal in left pad
- // x[2] = cluster signal in middle pad
- // x[3] = cluster signal in right pad
- // i[0] = ROW pad number
- // i[1] = COL pad number
- // time = time bin number (uncalibrated for t0)
- //
- // Output:
- // x[0] = X-positions in tracking CS
- // x[1] = Y-positions in tracking CS
- // x[2] = Z-positions in tracking CS
- // x[3] = total cluster charge
- // x[4] = error in Y-direction
- // x[5] = error in Z-direction
- // i[2] = time bin number (calibrated for t0)
- //
-
- Double_t posLocal[3];
- Double_t posTracking[3];
-
- Int_t row = i[0];
- Int_t col = i[1];
+ // Input: Cluster in the local chamber coordinates
+ // Output: Tracking cluster
- // Parameter to adjust the X position
- const Double_t kX0shift = 2.52;
+ if (!fMatrix) return kFALSE;
- if (!fMatrix) {
- x[0] = 0.0;
- x[1] = 0.0;
- x[2] = 0.0;
- x[3] = 0.0;
- x[4] = 0.0;
- x[5] = 0.0;
- i[2] = 0;
+ // Parameters to adjust the X position of clusters in the alignable volume
+ const Double_t kX0shift = AliTRDgeometry::AnodePos(); //[cm]
- return kFALSE;
-
- }
- else {
- // 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);
-
- 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 = fCalExBDetValue;//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;
}
// be used.
//
- if (setDet) {
- SetDetector(c->GetDetector());
- }
-
- // Transform the local cluster coordinates into recalibrated
- // space point positions defined in the local tracking system.
- // Here the calibration for T0, Vdrift and ExB is applied as well.
- Double_t clusterXYZ[6];
- clusterXYZ[0] = c->GetCenter();
- clusterXYZ[1] = 0.0;
- clusterXYZ[2] = 0.0;
- clusterXYZ[3] = 0.0;
- clusterXYZ[4] = 0.0;
- clusterXYZ[5] = 0.0;
- Int_t clusterRCT[3];
- clusterRCT[0] = c->GetPadRow();
- clusterRCT[1] = c->GetPadCol();
- clusterRCT[2] = 0;
- Int_t time = c->GetPadTime();
- Transform(clusterXYZ,clusterRCT,((UInt_t) time),0);
-
- // Set the recalibrated coordinates
- c->SetX(clusterXYZ[0]);
- c->SetY(clusterXYZ[1]);
- c->SetZ(clusterXYZ[2]);
- c->SetLocalTimeBin(((Char_t) clusterRCT[2]));
+ if (setDet) SetDetector(c->GetDetector());
+ Transform(c);
}