X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TRD%2FAliTRDtransform.cxx;h=4528a09a5bab5341631743a25e6901965f0f661d;hb=dcc2ade075ecd6298757d84b65bdd14ca92f42f6;hp=143136b57cbd7529bd178d4af84a196160f989da;hpb=af26ce805d7dc72b446f0fc90640ba512869aede;p=u%2Fmrichter%2FAliRoot.git diff --git a/TRD/AliTRDtransform.cxx b/TRD/AliTRDtransform.cxx index 143136b57cb..4528a09a5ba 100644 --- a/TRD/AliTRDtransform.cxx +++ b/TRD/AliTRDtransform.cxx @@ -25,8 +25,6 @@ #include #include "AliLog.h" -#include "AliTracker.h" -#include "AliCodeTimer.h" #include "AliTRDtransform.h" #include "AliTRDcluster.h" @@ -39,19 +37,19 @@ ClassImp(AliTRDtransform) +AliTRDgeometry* AliTRDtransform::fgGeo = NULL; + //_____________________________________________________________________________ -//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) ,fCalVdriftDetValue(0) ,fCalT0DetValue(0) ,fSamplingFrequency(0) @@ -63,21 +61,41 @@ AliTRDtransform::AliTRDtransform() // AliTRDtransform default constructor // + if(!fgGeo){ + fgGeo = new AliTRDgeometry(); + if (!fgGeo->CreateClusterMatrixArray()) { + AliError("Could not get transformation matrices\n"); + } + } + + 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(); + } //_____________________________________________________________________________ -//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) ,fCalVdriftDetValue(0) ,fCalT0DetValue(0) ,fSamplingFrequency(0) @@ -89,8 +107,12 @@ AliTRDtransform::AliTRDtransform(Int_t det) // AliTRDtransform constructor for a given detector // - fGeo = new AliTRDgeometry(); - fGeo->ReadGeoMatrices(); + if(!fgGeo){ + fgGeo = new AliTRDgeometry(); + if (!fgGeo->CreateClusterMatrixArray()) { + AliError("Could not get transformation matrices\n"); + } + } fParam = AliTRDCommonParam::Instance(); if (!fParam) { @@ -104,26 +126,24 @@ AliTRDtransform::AliTRDtransform(Int_t det) } // Get the calibration objects for the global calibration - fCalVdriftDet = fCalibration->GetVdriftDet(); - fCalT0Det = fCalibration->GetT0Det(); + fkCalVdriftDet = fCalibration->GetVdriftDet(); + fkCalT0Det = fCalibration->GetT0Det(); 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) ,fCalVdriftDetValue(0) ,fCalT0DetValue(0) ,fSamplingFrequency(0) @@ -135,12 +155,6 @@ AliTRDtransform::AliTRDtransform(const AliTRDtransform &t) // AliTRDtransform copy constructor // - if (fGeo) { - delete fGeo; - } - fGeo = new AliTRDgeometry(); - fGeo->ReadGeoMatrices(); - fParam = AliTRDCommonParam::Instance(); if (!fParam) { AliError("Could not get common parameters\n"); @@ -151,8 +165,8 @@ AliTRDtransform::AliTRDtransform(const AliTRDtransform &t) if (!fCalibration) { AliError("Cannot find calibration object"); } - fCalVdriftDet = fCalibration->GetVdriftDet(); - fCalT0Det = fCalibration->GetT0Det(); + fkCalVdriftDet = fCalibration->GetVdriftDet(); + fkCalT0Det = fCalibration->GetT0Det(); } @@ -163,9 +177,50 @@ AliTRDtransform::~AliTRDtransform() // AliTRDtransform destructor // - if (fGeo) { - delete fGeo; +} + +//_____________________________________________________________________________ +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 + // + + ((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(); + } + else { + ((AliTRDtransform &) t).fkCalVdriftDet = 0; + ((AliTRDtransform &) t).fkCalT0Det = 0; } + ((AliTRDtransform &) t).fCalVdriftROC = 0x0; + ((AliTRDtransform &) t).fCalT0ROC = 0x0; + ((AliTRDtransform &) t).fCalPRFROC = 0x0; + ((AliTRDtransform &) t).fCalVdriftDetValue = 0; + ((AliTRDtransform &) t).fCalT0DetValue = 0; + ((AliTRDtransform &) t).fSamplingFrequency = 0; + ((AliTRDtransform &) t).fPadPlane = 0x0; + ((AliTRDtransform &) t).fZShiftIdeal = 0; + ((AliTRDtransform &) t).fMatrix = 0x0; } @@ -182,28 +237,25 @@ void AliTRDtransform::SetDetector(Int_t det) // 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); // 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 = fgGeo->GetLayer(det); + Int_t stack = fgGeo->GetStack(det); + fPadPlane = fgGeo->GetPadPlane(layer,stack); fZShiftIdeal = 0.5 * (fPadPlane->GetRow0() + fPadPlane->GetRowEnd()); // Get the current transformation matrix - fMatrix = fGeo->GetCorrectionMatrix(det); - if (!fMatrix) { - AliError("No transformation matrix available\n"); - } + fMatrix = fgGeo->GetClusterMatrix(det); } //_____________________________________________________________________________ -void 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 @@ -211,84 +263,55 @@ void AliTRDtransform::Transform(Double_t *x, Int_t *i, UInt_t time // // 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) - // + // Input: Cluster in the local chamber coordinates + // Output: Tracking cluster - Double_t posLocal[3]; - Double_t posTracking[3]; + if (!fMatrix) return kFALSE; - Int_t row = i[0]; - Int_t col = i[1]; - // Parameter to adjust the X position - const Double_t kX0shift = 2.52; + // Parameters to adjust the X position of clusters in the alignable volume + const Double_t kX0shift = AliTRDgeometry::AnodePos(); //[cm] - // 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); + + // 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 exbCorr = fCalibration->GetOmegaTau(vdrift - ,-0.1*AliTracker::GetBz()); + Double_t exb = AliTRDCommonParam::Instance()->GetOmegaTau(vd); - // Pad dimensions - Double_t rowSize = fPadPlane->GetRowSize(row); - Double_t colSize = fPadPlane->GetColSize(col); + Float_t x = c->GetXloc(t0, vd); - // 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; + // 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 - 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); - } + Double_t trk[3]; + fMatrix->LocalToMaster(loc, trk); - // 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); + // 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; } @@ -302,31 +325,7 @@ void AliTRDtransform::Recalibrate(AliTRDcluster *c, Bool_t setDet) // 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); }