From: cblume Date: Fri, 21 Dec 2007 08:53:06 +0000 (+0000) Subject: Updated tracking code by Alexandru und Markus X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=d9950a5a8613a39c8cbf1a49431e155827e5dfe4;p=u%2Fmrichter%2FAliRoot.git Updated tracking code by Alexandru und Markus --- diff --git a/TRD/AliTRDgeometry.cxx b/TRD/AliTRDgeometry.cxx index 35dd41eb5a6..c47c0b00bfe 100644 --- a/TRD/AliTRDgeometry.cxx +++ b/TRD/AliTRDgeometry.cxx @@ -2414,6 +2414,39 @@ Int_t AliTRDgeometry::GetChamber(Int_t d) const } +//_____________________________________________________________________________ +Int_t AliTRDgeometry::GetChamber(Double_t z, Int_t plane) +{ + // + // Reconstruct the chamber number from the z position and plane number + // + // The return function has to be protected for positiveness !! + // + + if ((plane < 0) || + (plane >= fgkNplan)) { + return -1; + } + + Int_t ichmb = fgkNcham; + Double_t zmin; + Double_t zmax; + + do { + ichmb--; + if (ichmb < 0) break; + AliTRDpadPlane *pp = GetPadPlane(plane,ichmb); + zmax = pp->GetRow0(); + Int_t nrows = pp->GetNrows(); + zmin = zmax - 2*pp->GetLengthOPad() + - (nrows-2)*pp->GetLengthIPad() + - (nrows-1)*pp->GetRowSpacing(); + } while((z < zmin) || (z > zmax)); + + return ichmb; + +} + //_____________________________________________________________________________ Int_t AliTRDgeometry::GetSector(Int_t d) const { diff --git a/TRD/AliTRDgeometry.h b/TRD/AliTRDgeometry.h index f5f53979031..0f46fc47f89 100644 --- a/TRD/AliTRDgeometry.h +++ b/TRD/AliTRDgeometry.h @@ -60,6 +60,7 @@ class AliTRDgeometry : public AliGeometry { static Int_t GetDetector(Int_t p, Int_t c, Int_t s); static Int_t GetPlane(Int_t d); virtual Int_t GetChamber(Int_t d) const; + virtual Int_t GetChamber(Double_t z, Int_t plane); virtual Int_t GetSector(Int_t d) const; void CreatePadPlaneArray(); diff --git a/TRD/AliTRDseed.cxx b/TRD/AliTRDseed.cxx index 7d1129f1814..46afd800fa1 100644 --- a/TRD/AliTRDseed.cxx +++ b/TRD/AliTRDseed.cxx @@ -32,10 +32,11 @@ #include "AliTRDtracker.h" ClassImp(AliTRDseed) - +Int_t AliTRDseed::fgTimeBins = 0; //_____________________________________________________________________________ AliTRDseed::AliTRDseed() :TObject() + ,fTimeBinsRange(0) ,fTilt(0) ,fPadLength(0) ,fX0(0) @@ -82,6 +83,7 @@ AliTRDseed::AliTRDseed() //_____________________________________________________________________________ AliTRDseed::AliTRDseed(const AliTRDseed &s) :TObject(s) + ,fTimeBinsRange(s.fTimeBinsRange) ,fTilt(s.fTilt) ,fPadLength(s.fPadLength) ,fX0(s.fX0) @@ -126,14 +128,14 @@ AliTRDseed::AliTRDseed(const AliTRDseed &s) } //_____________________________________________________________________________ -void AliTRDseed::Copy(TObject &o) const +void AliTRDseed::Copy(TObject &o) const { - // - // Copy function - // + //printf("AliTRDseed::Copy()\n"); - AliTRDseed &seed = (AliTRDseed &)o; - seed.fTilt = fTilt; + AliTRDseed &seed = (AliTRDseed &)o; + + seed.fTimeBinsRange = fTimeBinsRange; + seed.fTilt = fTilt; seed.fPadLength = fPadLength; seed.fX0 = fX0; seed.fSigmaY = fSigmaY; @@ -150,8 +152,7 @@ void AliTRDseed::Copy(TObject &o) const seed.fCC = fCC; seed.fChi2 = fChi2; seed.fChi2Z = fChi2Z; - - for (Int_t i = 0; i < knTimebins; i++) { + for (Int_t i = 0; i < knTimebins; i++) { seed.fX[i] = fX[i]; seed.fY[i] = fY[i]; seed.fZ[i] = fZ[i]; @@ -218,14 +219,11 @@ void AliTRDseed::CookLabels() // Cook 2 labels for seed // - AliTRDcalibDB *cal = AliTRDcalibDB::Instance(); - Int_t nTimeBins = cal->GetNumberOfTimeBins(); - Int_t labels[200]; Int_t out[200]; Int_t nlab = 0; - for (Int_t i = 0; i < nTimeBins+1; i++) { + for (Int_t i = 0; i < fgTimeBins+1; i++) { if (!fClusters[i]) continue; for (Int_t ilab = 0; ilab < 3; ilab++) { if (fClusters[i]->GetLabel(ilab) >= 0) { @@ -251,10 +249,7 @@ void AliTRDseed::UseClusters() // Use clusters // - AliTRDcalibDB *cal = AliTRDcalibDB::Instance(); - Int_t nTimeBins = cal->GetNumberOfTimeBins(); - - for (Int_t i = 0; i < nTimeBins+1; i++) { + for (Int_t i = 0; i < fgTimeBins+1; i++) { if (!fClusters[i]) continue; if (!(fClusters[i]->IsUsed())) fClusters[i]->Use(); } @@ -268,12 +263,15 @@ void AliTRDseed::Update() // Update the seed. // + + // linear fit on the y direction + // dy|x = (yc|x - dz|x*tg(tilt)) - (y0 + dy/dx|x * x ) + // dz|x = zc|x - (z0 + dz/dx|x) + const Float_t kRatio = 0.8; const Int_t kClmin = 5; const Float_t kmaxtan = 2; - AliTRDcalibDB *cal = AliTRDcalibDB::Instance(); - Int_t nTimeBins = cal->GetNumberOfTimeBins(); if (TMath::Abs(fYref[1]) > kmaxtan){ //printf("Exit: Abs(fYref[1]) = %3.3f, kmaxtan = %3.3f\n", TMath::Abs(fYref[1]), kmaxtan); @@ -303,7 +301,7 @@ void AliTRDseed::Update() fN = 0; fN2 = 0; - for (Int_t i = 0; i < nTimeBins; i++) { + for (Int_t i = 0; i < fTimeBinsRange; i++) { yres[i] = 10000.0; if (!fClusters[i]) continue; yres[i] = fY[i] - fYref[0] - (fYref[1] + anglecor) * fX[i]; // Residual y @@ -340,22 +338,22 @@ void AliTRDseed::Update() // with maximal numebr of accepted clusters // fNChange = 1; - for (Int_t i = 0; i < nTimeBins; i++) { + for (Int_t i = 0; i < fTimeBinsRange; i++) { cumul[i][0] = counts[0]; cumul[i][1] = counts[1]; if (TMath::Abs(fZ[i]-zouts[0]) < 2) counts[0]++; if (TMath::Abs(fZ[i]-zouts[2]) < 2) counts[1]++; } Int_t maxcount = 0; - for (Int_t i = 0; i < nTimeBins; i++) { - Int_t after = cumul[nTimeBins][0] - cumul[i][0]; + for (Int_t i = 0; i < fTimeBinsRange; i++) { + Int_t after = cumul[fTimeBinsRange][0] - cumul[i][0]; Int_t before = cumul[i][1]; if (after + before > maxcount) { maxcount = after + before; breaktime = i; mbefore = kFALSE; } - after = cumul[nTimeBins-1][1] - cumul[i][1]; + after = cumul[fTimeBinsRange-1][1] - cumul[i][1]; before = cumul[i][0]; if (after + before > maxcount) { maxcount = after + before; @@ -368,18 +366,18 @@ void AliTRDseed::Update() } - for (Int_t i = 0; i < nTimeBins+1; i++) { + for (Int_t i = 0; i < fTimeBinsRange+1; i++) { if (i > breaktime) allowedz[i] = mbefore ? zouts[2] : zouts[0]; if (i <= breaktime) allowedz[i] = (!mbefore) ? zouts[2] : zouts[0]; } - if (((allowedz[0] > allowedz[nTimeBins]) && (fZref[1] < 0)) || - ((allowedz[0] < allowedz[nTimeBins]) && (fZref[1] > 0))) { + if (((allowedz[0] > allowedz[fTimeBinsRange]) && (fZref[1] < 0)) || + ((allowedz[0] < allowedz[fTimeBinsRange]) && (fZref[1] > 0))) { // // Tracklet z-direction not in correspondance with track z direction // fNChange = 0; - for (Int_t i = 0; i < nTimeBins+1; i++) { + for (Int_t i = 0; i < fTimeBinsRange+1; i++) { allowedz[i] = zouts[0]; // Only longest taken } } @@ -388,7 +386,7 @@ void AliTRDseed::Update() // // Cross pad -row tracklet - take the step change into account // - for (Int_t i = 0; i < nTimeBins+1; i++) { + for (Int_t i = 0; i < fTimeBinsRange+1; i++) { if (!fClusters[i]) continue; if (TMath::Abs(fZ[i] - allowedz[i]) > 2) continue; yres[i] = fY[i] - fYref[0] - (fYref[1] + anglecor) * fX[i]; // Residual y @@ -402,7 +400,7 @@ void AliTRDseed::Update() Double_t yres2[knTimebins]; Double_t mean; Double_t sigma; - for (Int_t i = 0; i < nTimeBins+1; i++) { + for (Int_t i = 0; i < fTimeBinsRange+1; i++) { if (!fClusters[i]) continue; if (TMath::Abs(fZ[i] - allowedz[i]) > 2) continue; yres2[fN2] = yres[i]; @@ -432,12 +430,12 @@ void AliTRDseed::Update() fMeanz = 0; fMPads = 0; - for (Int_t i = 0; i < nTimeBins+1; i++) { + for (Int_t i = 0; i < fTimeBinsRange+1; i++) { fUsable[i] = kFALSE; if (!fClusters[i]) continue; - if (TMath::Abs(fZ[i] - allowedz[i]) > 2) continue; - if (TMath::Abs(yres[i] - mean) > 4.0 * sigma) continue; + if (TMath::Abs(fZ[i] - allowedz[i]) > 2){fClusters[i] = 0x0; continue;} + if (TMath::Abs(yres[i] - mean) > 4.0 * sigma){fClusters[i] = 0x0; continue;} fUsable[i] = kTRUE; fN2++; fMPads += fClusters[i]->GetNPads(); @@ -445,7 +443,10 @@ void AliTRDseed::Update() if (fClusters[i]->GetNPads() > 4) weight = 0.5; if (fClusters[i]->GetNPads() > 5) weight = 0.2; + Double_t x = fX[i]; + //printf("x = %7.3f dy = %7.3f fit %7.3f\n", x, yres[i], fY[i]-yres[i]); + sumw += weight; sumwx += x * weight; sumwx2 += x*x * weight; @@ -474,12 +475,14 @@ void AliTRDseed::Update() fYfitR[1] = (sumw * sumwxy - sumwx * sumwy) / det; fSigmaY2 = 0; - for (Int_t i = 0; i < nTimeBins+1; i++) { + for (Int_t i = 0; i < fTimeBinsRange+1; i++) { if (!fUsable[i]) continue; Float_t delta = yres[i] - fYfitR[0] - fYfitR[1] * fX[i]; fSigmaY2 += delta*delta; } fSigmaY2 = TMath::Sqrt(fSigmaY2 / Float_t(fN2-2)); + // TEMPORARY UNTIL covariance properly calculated + fSigmaY2 = TMath::Max(fSigmaY2, Float_t(.1)); fZfitR[0] = (sumwx2 * sumwz - sumwx * sumwxz) / det; fZfitR[1] = (sumw * sumwxz - sumwx * sumwz) / det; @@ -489,7 +492,9 @@ void AliTRDseed::Update() fYfitR[1] += fYref[1]; fYfit[0] = fYfitR[0]; fYfit[1] = fYfitR[1]; - + + //printf("y0 = %7.3f tgy = %7.3f z0 = %7.3f tgz = %7.3f \n", fYfitR[0], fYfitR[1], fZfitR[0], fZfitR[1]); + UpdateUsed(); } @@ -501,17 +506,11 @@ void AliTRDseed::UpdateUsed() // Update used seed // - AliTRDcalibDB *cal = AliTRDcalibDB::Instance(); - Int_t nTimeBins = cal->GetNumberOfTimeBins(); - fNUsed = 0; - for (Int_t i = 0; i < nTimeBins; i++) { - if (!fClusters[i]) { - continue; - } - if ((fClusters[i]->IsUsed())) { - fNUsed++; - } + for (Int_t i = 0; i < fgTimeBins; i++) { + if (!fClusters[i]) continue; + if(!fUsable[i]) continue; + if ((fClusters[i]->IsUsed())) fNUsed++; } } @@ -527,9 +526,6 @@ Float_t AliTRDseed::FitRiemanTilt(AliTRDseed * cseed, Bool_t terror) TLinearFitter fitterT2(4,"hyp4"); fitterT2.StoreData(kTRUE); - AliTRDcalibDB *cal = AliTRDcalibDB::Instance(); - Int_t nTimeBins = cal->GetNumberOfTimeBins(); - Float_t xref2 = (cseed[2].fX0 + cseed[3].fX0) * 0.5; // Reference x0 for z Int_t npointsT = 0; @@ -540,7 +536,7 @@ Float_t AliTRDseed::FitRiemanTilt(AliTRDseed * cseed, Bool_t terror) if (!cseed[iLayer].IsOK()) continue; Double_t tilt = cseed[iLayer].fTilt; - for (Int_t itime = 0; itime < nTimeBins+1; itime++) { + for (Int_t itime = 0; itime < fgTimeBins+1; itime++) { if (!cseed[iLayer].fUsable[itime]) continue; // x relative to the midle chamber diff --git a/TRD/AliTRDseed.h b/TRD/AliTRDseed.h index 11e6e69bb29..7814d4666e8 100644 --- a/TRD/AliTRDseed.h +++ b/TRD/AliTRDseed.h @@ -64,7 +64,10 @@ class AliTRDseed : public TObject { Float_t GetCC() const { return fCC; } Float_t GetChi2() const { return fChi2; } Float_t GetChi2Z() const { return fChi2Z; } + Int_t GetNTimeBins() const { return fgTimeBins; } + Int_t GetNTimeBinsRange() const { return fTimeBinsRange; } + void SetTilt(Float_t tilt) { fTilt = tilt; } void SetPadLength(Float_t len) { fPadLength = len; } void SetX0(Float_t x0) { fX0 = x0; } @@ -92,11 +95,15 @@ class AliTRDseed : public TObject { void SetCC(Float_t cc) { fCC = cc; } void SetChi2(Float_t chi2) { fChi2 = chi2; } void SetChi2Z(Float_t chi2z) { fChi2Z = chi2z; } + static void SetNTimeBins(Int_t nTB) { fgTimeBins = nTB; } + void SetNTimeBinsRange(Int_t nTB) { fTimeBinsRange = nTB; } protected: void Copy(TObject &o) const; + static Int_t fgTimeBins; // local copy of the total number of TB + Int_t fTimeBinsRange;// number of time bins in the geometrical range of the detector Float_t fTilt; // Tilting angle Float_t fPadLength; // Pad length Float_t fX0; // X0 position @@ -105,7 +112,7 @@ class AliTRDseed : public TObject { Float_t fZ[knTimebins]; //! Z position Int_t fIndexes[knTimebins];//! Indexes AliTRDcluster *fClusters[knTimebins]; // Clusters - Bool_t fUsable[knTimebins]; //! Indication - usable cluster + Bool_t fUsable[knTimebins]; // Indication - usable cluster Float_t fYref[2]; // Reference y Float_t fZref[2]; // Reference z Float_t fYfit[2]; // Y fit position +derivation diff --git a/TRD/AliTRDseedV1.cxx b/TRD/AliTRDseedV1.cxx index 2cbcca78369..f134bfc9eba 100644 --- a/TRD/AliTRDseedV1.cxx +++ b/TRD/AliTRDseedV1.cxx @@ -33,6 +33,7 @@ #include "AliTRDseedV1.h" #include "AliTRDcluster.h" +#include "AliTRDtrack.h" #include "AliTRDcalibDB.h" #include "AliTRDstackLayer.h" #include "AliTRDrecoParam.h" @@ -44,26 +45,19 @@ ClassImp(AliTRDseedV1) //____________________________________________________________________ AliTRDseedV1::AliTRDseedV1(Int_t layer, AliTRDrecoParam *p) :AliTRDseed() - ,fLayer(layer) - ,fTimeBins(0) + ,fPlane(layer) ,fOwner(kFALSE) ,fRecoParam(p) { // // Constructor // - - //AliInfo(""); - AliTRDcalibDB *cal = AliTRDcalibDB::Instance(); - fTimeBins = cal->GetNumberOfTimeBins(); - } //____________________________________________________________________ -AliTRDseedV1::AliTRDseedV1(const AliTRDseedV1 &ref, Bool_t owner) +AliTRDseedV1::AliTRDseedV1(const AliTRDseedV1 &ref) :AliTRDseed((AliTRDseed&)ref) - ,fLayer(ref.fLayer) - ,fTimeBins(ref.fTimeBins) + ,fPlane(ref.fPlane) ,fOwner(kFALSE) ,fRecoParam(ref.fRecoParam) { @@ -72,17 +66,10 @@ AliTRDseedV1::AliTRDseedV1(const AliTRDseedV1 &ref, Bool_t owner) // //AliInfo(""); - - if(owner){ - for(int ic=0; icGetProlongation(fX0, y, z); + fYref[0] = y; + fYref[1] = track->GetSnp() < 0. ? track->GetTgl() : -track->GetTgl(); + fZref[0] = z; + // TO DO + // tilting pad correction !! + fZref[1] = 0.; // TMath::Tan(track->Theta()); + + //printf("Tracklet ref x[%7.3f] y[%7.3f] z[%7.3f], snp[%f] tgl[%f]\n", fX0, fYref[0], fZref[0], track->GetSnp(), track->GetTgl()); +} + //____________________________________________________________________ Float_t AliTRDseedV1::GetQuality(Bool_t kZcorr) const { @@ -140,6 +156,47 @@ Float_t AliTRDseedV1::GetQuality(Bool_t kZcorr) const + 2. * TMath::Abs(fMeanz - fZref[0]) / fPadLength; } +//____________________________________________________________________ +void AliTRDseedV1::GetCovAt(Double_t /*x*/, Double_t *cov) const +{ +// Computes covariance in the y-z plane at radial point x + + const Float_t k0= .2; // to be checked in FindClusters + Double_t sy20 = k0*TMath::Tan(fYfit[1]); sy20 *= sy20; + + Double_t sy2 = fSigmaY2*fSigmaY2 + sy20; + Double_t sz2 = fPadLength/12.; + + //printf("Yfit[1] %f sy20 %f SigmaY2 %f\n", fYfit[1], sy20, fSigmaY2); + + cov[0] = sy2; + cov[1] = fTilt*(sy2-sz2); + cov[2] = sz2; +} + +//____________________________________________________________________ +void AliTRDseedV1::SetOwner(Bool_t own) +{ + // + // Handles the ownership of the clusters + // + if(own){ + for(int ic=0; icGetRoad1y(); Double_t kroadz = fPadLength * .5 + 1.; @@ -171,7 +230,7 @@ Bool_t AliTRDseedV1::AttachClustersIter(AliTRDstackLayer *layer for (Int_t iter = 0; iter < niter; iter++) { //AliInfo(Form("iter = %i", iter)); ncl = 0; - for (Int_t iTime = 0; iTime < fTimeBins; iTime++) { + for (Int_t iTime = 0; iTime < fgTimeBins; iTime++) { // define searching configuration Double_t dxlayer = layer[iTime].GetX() - fX0; if(c){ @@ -188,11 +247,14 @@ Bool_t AliTRDseedV1::AttachClustersIter(AliTRDstackLayer *layer // printf("xexp = %3.3f ,yexp = %3.3f, zexp = %3.3f\n",layer[iTime].GetX(),yexp,zexp); // printf("layer[%i].GetNClusters() = %i\n", iTime, layer[iTime].GetNClusters()); Int_t index = layer[iTime].SearchNearestCluster(yexp, zexp, kroady, kroadz); + +// printf("%d[%d] x[%7.3f | %7.3f] y[%7.3f] z[%7.3f]\n", iTime, layer[iTime].GetNClusters(), dxlayer, layer[iTime].GetX(), yexp, zexp); // for(Int_t iclk = 0; iclk < layer[iTime].GetNClusters(); iclk++){ // AliTRDcluster *testcl = layer[iTime].GetCluster(iclk); -// printf("Cluster %i: x = %3.3f, y = %3.3f, z = %3.3f\n",iclk,testcl->GetX(), testcl->GetY(), testcl->GetZ()); +// printf("Cluster %i: %d x = %7.3f, y = %7.3f, z = %7.3f\n", iclk, testcl->GetLocalTimeBin(), testcl->GetX(), testcl->GetY(), testcl->GetZ()); // } // printf("Index = %i\n",index); + if (index < 0) continue; // Register cluster @@ -214,10 +276,10 @@ Bool_t AliTRDseedV1::AttachClustersIter(AliTRDstackLayer *layer #ifdef SEED_DEBUG // Int_t nclusters = 0; // Float_t fD[iter] = 0.; -// for(int ic=0; icGetY()-cj->GetY())*(ci->GetY()-cj->GetY())+ @@ -245,10 +307,8 @@ Bool_t AliTRDseedV1::AttachClustersIter(AliTRDstackLayer *layer } //____________________________________________________________________ -Bool_t AliTRDseedV1::AttachClustersProj(AliTRDstackLayer *layer - , Float_t /*quality*/ - , Bool_t kZcorr - , AliTRDcluster *c) +Bool_t AliTRDseedV1::AttachClusters(AliTRDstackLayer *layer + ,Bool_t kZcorr) { // // Projective algorithm to attach clusters to seeding tracklets @@ -271,8 +331,7 @@ Bool_t AliTRDseedV1::AttachClustersProj(AliTRDstackLayer *layer return kFALSE; } - const Int_t knTimeBins = 35; - const Int_t kClusterCandidates = 2 * knTimeBins; + const Int_t kClusterCandidates = 2 * knTimebins; //define roads Double_t kroady = fRecoParam->GetRoad1y(); @@ -282,13 +341,13 @@ Bool_t AliTRDseedV1::AttachClustersProj(AliTRDstackLayer *layer // working variables AliTRDcluster *clusters[kClusterCandidates]; - Double_t cond[4], yexp[knTimeBins], zexp[knTimeBins], + Double_t cond[4], yexp[knTimebins], zexp[knTimebins], yres[kClusterCandidates], zres[kClusterCandidates]; - Int_t ncl, *index = 0x0, tboundary[knTimeBins]; + Int_t ncl, *index = 0x0, tboundary[knTimebins]; // Do cluster projection Int_t nYclusters = 0; Bool_t kEXIT = kFALSE; - for (Int_t iTime = 0; iTime < fTimeBins; iTime++) { + for (Int_t iTime = 0; iTime < fgTimeBins; iTime++) { fX[iTime] = layer[iTime].GetX() - fX0; zexp[iTime] = fZref[0] + fZref[1] * fX[iTime]; yexp[iTime] = fYref[0] + fYref[1] * fX[iTime] - zcorr; @@ -298,7 +357,7 @@ Bool_t AliTRDseedV1::AttachClustersProj(AliTRDstackLayer *layer cond[2] = zexp[iTime] - kroadz; cond[3] = zexp[iTime] + kroadz; layer[iTime].GetClusters(cond, index, ncl); for(Int_t ic = 0; icGetY() - yexp[iTime]; if(nYclusters >= kClusterCandidates) { @@ -338,9 +397,10 @@ Bool_t AliTRDseedV1::AttachClustersProj(AliTRDstackLayer *layer // Select only one cluster/TimeBin Int_t lastCluster = 0; fN2 = 0; - for (Int_t iTime = 0; iTime < fTimeBins; iTime++) { + for (Int_t iTime = 0; iTime < fgTimeBins; iTime++) { ncl = tboundary[iTime] - lastCluster; if(!ncl) continue; + AliTRDcluster *c = 0x0; if(ncl == 1){ c = clusters[lastCluster]; } else if(ncl > 1){ @@ -356,8 +416,8 @@ Bool_t AliTRDseedV1::AttachClustersProj(AliTRDstackLayer *layer } c = clusters[iptr]; } - //Int_t globalIndex = layer[iTime].GetGlobalIndex(index); - //fIndexes[iTime] = globalIndex; + //Int_t GlobalIndex = layer[iTime].GetGlobalIndex(index); + //fIndexes[iTime] = GlobalIndex; fClusters[iTime] = c; fY[iTime] = c->GetY(); fZ[iTime] = c->GetZ(); @@ -366,22 +426,31 @@ Bool_t AliTRDseedV1::AttachClustersProj(AliTRDstackLayer *layer } // number of minimum numbers of clusters expected for the tracklet - Int_t kClmin = Int_t(fRecoParam->GetFindableClusters()*fTimeBins); + Int_t kClmin = Int_t(fRecoParam->GetFindableClusters()*fgTimeBins); if (fN2 < kClmin){ AliWarning(Form("Not enough clusters to fit the tracklet %d [%d].", fN2, kClmin)); fN2 = 0; return kFALSE; } - AliTRDseed::Update(); + + // update used clusters + fNUsed = 0; + for (Int_t iTime = 0; iTime < fgTimeBins; iTime++) { + if(!fClusters[iTime]) continue; + if((fClusters[iTime]->IsUsed())) fNUsed++; + } + + if (fN2-fNUsed < kClmin){ + AliWarning(Form("Too many clusters already in use %d (from %d).", fNUsed, fN2)); + fN2 = 0; + return kFALSE; + } -// // fit tracklet and update clusters -// if(!FitTracklet()) return kFALSE; -// UpdateUsed(); return kTRUE; } //____________________________________________________________________ -Bool_t AliTRDseedV1::FitTracklet() +Bool_t AliTRDseedV1::Fit() { // // Linear fit of the tracklet @@ -402,20 +471,20 @@ Bool_t AliTRDseedV1::FitTracklet() Float_t anglecor = fTilt * fZref[1]; // Correction to the angle // calculate residuals - const Int_t knTimeBins = 35; - Float_t yres[knTimeBins]; // y (r-phi) residuals - Int_t zint[knTimeBins], // Histograming of the z coordinate - zout[2*knTimeBins];// + Float_t yres[knTimebins]; // y (r-phi) residuals + Int_t zint[knTimebins], // Histograming of the z coordinate + zout[2*knTimebins];// fN = 0; - for (Int_t iTime = 0; iTime < fTimeBins; iTime++) { + for (Int_t iTime = 0; iTime < fTimeBinsRange; iTime++) { if (!fClusters[iTime]) continue; yres[iTime] = fY[iTime] - fYref[0] - (fYref[1] + anglecor) * fX[iTime]; - zint[fN++] = Int_t(fZ[iTime]); + zint[fN] = Int_t(fZ[iTime]); + fN++; } // calculate pad row boundary crosses - Int_t kClmin = Int_t(fRecoParam->GetFindableClusters()*fTimeBins); + Int_t kClmin = Int_t(fRecoParam->GetFindableClusters()*fTimeBinsRange); Int_t nz = AliMathBase::Freq(fN, zint, zout, kFALSE); fZProb = zout[0]; if(nz <= 1) zout[3] = 0; @@ -437,7 +506,8 @@ Bool_t AliTRDseedV1::FitTracklet() Int_t npads; fMPads = 0; fMeanz = 0.; - for(int iTime=0; iTimeGetNPads(); @@ -476,7 +546,7 @@ Bool_t AliTRDseedV1::FitTracklet() fYfitR[1] = (sumw * sumwxy - sumwx * sumwy) / det; fSigmaY2 = 0; - for (Int_t i = 0; i < fTimeBins+1; i++) { + for (Int_t i = 0; i < fTimeBinsRange+1; i++) { if (!fUsable[i]) continue; Float_t delta = yres[i] - fYfitR[0] - fYfitR[1] * fX[i]; fSigmaY2 += delta*delta; @@ -647,13 +717,13 @@ void AliTRDseedV1::Print() printf(" fX0 = %f\n", fX0); for(int ic=0; icGetZat(fX0); fZref[1] = rieman->GetDZat(fX0); diff --git a/TRD/AliTRDtrack.h b/TRD/AliTRDtrack.h index c705f28bf9e..102706d1e06 100644 --- a/TRD/AliTRDtrack.h +++ b/TRD/AliTRDtrack.h @@ -16,10 +16,13 @@ #include "AliTRDtracklet.h" +#ifndef ALITRDSEEDV1_H +#include "AliTRDseedV1.h" +#endif + class AliESDtrack; class AliTrackReference; class AliTRDcluster; - class AliTRDtrack : public AliKalmanTrack { public: @@ -44,7 +47,7 @@ class AliTRDtrack : public AliKalmanTrack { , Double_t xr, Double_t alpha); AliTRDtrack(const AliTRDtrack &t/*, const Bool_t owner = kTRUE*/); AliTRDtrack(const AliESDtrack &t); - ~AliTRDtrack(); + virtual ~AliTRDtrack(); AliTRDtrack(const AliKalmanTrack &t, Double_t alpha); void ResetClusters() { SetChi2(0.0); @@ -87,6 +90,11 @@ class AliTRDtrack : public AliKalmanTrack { Float_t GetBudget(Int_t i) const { return fBudget[i]; } Float_t GetChi2Last() const { return fChi2Last; } AliTRDtrack *GetBackupTrack() { return fBackupTrack; } + // dummy to bridge the function in AliTRDtrackV1 + //Int_t GetNumberOfClusters() const {printf("AliTRDtrack::GetNumberOfClusters()\n"); return AliKalmanTrack::GetNumberOfClusters();} + inline virtual Int_t GetNumberOfTracklets() const ; + virtual Int_t GetTrackletIndex(Int_t plane) const {return plane>=0 && plane<6 ? fTrackletIndex[plane] : -1;} + void SetdEdx(Double_t dedx) { fdEdx = dedx; } void SetStop(Bool_t stop) { fStopped = stop; } @@ -188,9 +196,21 @@ class AliTRDtrack : public AliKalmanTrack { AliTRDtracklet fTracklets[6]; // Tracklets Float_t fBudget[3]; // Integrated material budget AliTRDtrack *fBackupTrack; //! Backup track + + Int_t fTrackletIndex[6]; // tracklets index in the tracker list + AliTRDseedV1 fTracklet[6]; // tracklets array defining the track ClassDef(AliTRDtrack,9) // TRD reconstructed tracks }; +//___________________________________________________________ +inline Int_t AliTRDtrack::GetNumberOfTracklets() const +{ + Int_t ntrklt = 0; + for(int ip=0; ip<6; ip++) if(fTrackletIndex[ip] >= 0) ntrklt++; + return ntrklt; +} + + #endif diff --git a/TRD/AliTRDtrackV1.cxx b/TRD/AliTRDtrackV1.cxx new file mode 100644 index 00000000000..93d0b04a0ff --- /dev/null +++ b/TRD/AliTRDtrackV1.cxx @@ -0,0 +1,249 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD track // +// // +// Authors: // +// Alex Bercuci // +// Markus Fasel // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliTRDtrackV1.h" +#include "AliTRDcluster.h" +#include "AliTRDcalibDB.h" +#include "AliTRDrecoParam.h" + +#include "AliESDtrack.h" + +ClassImp(AliTRDtrackV1) + + +//_______________________________________________________________ +AliTRDtrackV1::AliTRDtrackV1() : + AliTRDtrack() + ,fRecoParam(0x0) +{ + // + // Default constructor + // + + for(int ip=0; ip<6; ip++){ + fTrackletIndex[ip] = -1; + fTracklet[ip].Reset(); + } +} + +//_______________________________________________________________ +AliTRDtrackV1::AliTRDtrackV1(const AliESDtrack &t) : + AliTRDtrack(t) + ,fRecoParam(0x0) +{ + // + // Standard constructor + // + + //AliInfo(Form("alpha %f", GetAlpha())); + t.GetTRDtracklets(&fTrackletIndex[0]); + for(int ip=0; ip<6; ip++) fTracklet[ip].Reset(); +} + +//_______________________________________________________________ +AliTRDtrackV1::AliTRDtrackV1(const AliTRDtrackV1 &t) : + AliTRDtrack(t) + ,fRecoParam(0x0) +{ + // + // Copy constructor + // + +} + +//_______________________________________________________________ +// AliTRDtrackV1::~AliTRDtrackV1() +// { +// +// } + + +//_______________________________________________________________ +AliTRDtrackV1::AliTRDtrackV1(AliTRDseedV1 *trklts, const Double_t p[5], const Double_t cov[15], Double_t x, Double_t alpha) : + AliTRDtrack() + ,fRecoParam(0x0) +{ +// The stand alone tracking constructor +// TEMPORARY !!!!!!!!!!! +// to check : +// 1. covariance matrix +// 2. dQdl calculation + + + Double_t cnv = 1.0 / (GetBz() * kB2C); + + Double_t pp[5] = { p[0] + , p[1] + , x*p[4] - p[2] + , p[3] + , p[4]*cnv }; + + Double_t c22 = x*x*cov[14] - 2*x*cov[12] + cov[ 5]; + Double_t c32 = x*cov[13] - cov[ 8]; + Double_t c20 = x*cov[10] - cov[ 3]; + Double_t c21 = x*cov[11] - cov[ 4]; + Double_t c42 = x*cov[14] - cov[12]; + + Double_t cc[15] = { cov[ 0] + , cov[ 1], cov[ 2] + , c20, c21, c22 + , cov[ 6], cov[ 7], c32, cov[ 9] + , cov[10]*cnv, cov[11]*cnv, c42*cnv, cov[13]*cnv, cov[14]*cnv*cnv }; + + Set(x,alpha,pp,cc); + Double_t s = GetSnp(); + Double_t t = GetTgl(); + + Int_t ncl = 0, nclPlane; AliTRDcluster *c = 0x0; + for(int iplane=0; iplane<6; iplane++){ + fTrackletIndex[iplane] = -1; + fTracklet[iplane] = trklts[iplane]; + nclPlane = 0; + for(int ic = 0; icGetQ()); + fClusters[ncl] = c; + // temporary !!! + // This is not correctly. Has to be updated in the AliTRDtrackerV1::FollowBackProlonagation() + fdQdl[ncl] = q * (s*s < 1.) ? TMath::Sqrt((1-s*s)/(1+t*t)) : 1.; + ncl++; + nclPlane++; + } + //printf("%d N clusters plane %d [%d %d].\n", iplane, nclPlane, fTracklet[iplane].GetN2(), trklts[iplane].GetN()); + } + //printf("N clusters in AliTRDtrackV1 %d.\n", ncl); + SetNumberOfClusters(ncl); +} + +//_______________________________________________________________ +Bool_t AliTRDtrackV1::CookPID() +{ +// CookdEdx(); // truncated mean ... do we still need it ? + +// CookdEdxTimBin(seed->GetID()); + for(int itrklt=0; itrklt<6; itrklt++){ + for (Int_t iSlice = 0; iSlice < AliESDtrack::kNSlice; iSlice++) fdEdxPlane[itrklt][iSlice] = -1.; + + if(fTrackletIndex[itrklt]<0) continue; + fTracklet[itrklt].CookdEdx(fdEdxPlane[itrklt]); + } + + // retrive calibration db + AliTRDcalibDB *calibration = AliTRDcalibDB::Instance(); + if (!calibration) { + AliError("No access to calibration data"); + return kFALSE; + } + + // Retrieve the CDB container class with the parametric detector response + const AliTRDCalPID *pd = calibration->GetPIDObject(0/*fRecoParam->GetPIDMethod()*/); + if (!pd) { + AliError("No access to AliTRDCalPID object"); + return kFALSE; + } + +// CookPID(pidQ); + + +} + + +//_______________________________________________________________ +Double_t AliTRDtrackV1::GetPredictedChi2(const AliTRDseedV1 *trklt) const +{ + // + // Returns the predicted chi2 + // + + Double_t x = trklt->GetX0(); + Double_t p[2] = { trklt->GetYat(x) + , trklt->GetZat(x) }; + Double_t cov[3]; + trklt->GetCovAt(x, cov); + + return AliExternalTrackParam::GetPredictedChi2(p, cov); + +} + +//_______________________________________________________________ +void AliTRDtrackV1::SetTracklet(AliTRDseedV1 *trklt, Int_t plane, Int_t index) +{ + // + // Sets the tracklets + // + + if(plane < 0 || plane >=6) return; + fTracklet[plane] = (*trklt); + fTrackletIndex[plane] = index; +} + +//_______________________________________________________________ +Bool_t AliTRDtrackV1::Update(const AliTRDseedV1 *trklt, Double_t chisq) +{ + // + // Update the track + // + + Double_t x = trklt->GetX0(); + Double_t p[2] = { trklt->GetYat(x) + , trklt->GetZat(x) }; + Double_t cov[3]; + trklt->GetCovAt(x, cov); + +// Print(); +// AliInfo(Form("cov[%f %f %f]", cov[0], cov[1], cov[2])); + + if(!AliExternalTrackParam::Update(p, cov)) return kFALSE; + //Print(); + + // Register info to track +// Int_t n = GetNumberOfClusters(); +// fIndex[n] = index; +// fClusters[n] = c; + SetNumberOfClusters(GetNumberOfClusters()+trklt->GetN()); + SetChi2(GetChi2() + chisq); + + return kTRUE; +} + +//_______________________________________________________________ +void AliTRDtrackV1::UpdateESDdEdx(AliESDtrack *track) +{ + // + // Update the dedx info + // + + for (Int_t i = 0; i < AliESDtrack::kNPlane; i++) { + for (Int_t j = 0; j < AliESDtrack::kNSlice; j++) { + track->SetTRDsignals(fdEdxPlane[i][j], i, j); + } + track->SetTRDTimBin(fTimBinPlane[i], i); + } +} diff --git a/TRD/AliTRDtrackV1.h b/TRD/AliTRDtrackV1.h new file mode 100644 index 00000000000..52a003306b6 --- /dev/null +++ b/TRD/AliTRDtrackV1.h @@ -0,0 +1,74 @@ +#ifndef ALITRDTRACKV1_H +#define ALITRDTRACKV1_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//////////////////////////////////////////////////////////////////////////// +// // +// The TRD track // +// // +// Authors: // +// Alex Bercuci // +// Markus Fasel // +// // +//////////////////////////////////////////////////////////////////////////// + +#ifndef ALITRDTRACK_H +#include "AliTRDtrack.h" +#endif + +class AliTRDseedV1; +class AliESDtrack; +class AliCluster; + +class AliTRDtrackV1 : public AliTRDtrack +{ +public: + AliTRDtrackV1(); + AliTRDtrackV1(AliTRDseedV1 *trklts, const Double_t p[5], const Double_t cov[15], Double_t x, Double_t alpha); + AliTRDtrackV1(const AliESDtrack &ref); + AliTRDtrackV1(const AliTRDtrackV1 & /*ref*/); + AliTRDtrackV1& operator=(const AliTRDtrackV1 &/*ref*/){ return *this; } + + Bool_t CookPID(); + inline Int_t GetNumberOfClusters() const; + Double_t GetPredictedChi2(const AliTRDseedV1 *tracklet) const; + Double_t GetPredictedChi2(const AliCluster* /*c*/) const { return 0.0; } + const AliTRDseedV1* GetTracklet(Int_t plane) const {return plane >=0 && plane <6 ? &fTracklet[plane] : 0x0;} + Int_t* GetTrackletIndexes() {return &fTrackletIndex[0];} + void SetTracklet(AliTRDseedV1 *trklt, Int_t plane, Int_t index); + Bool_t Update(const AliTRDseedV1 *tracklet, Double_t chi2); +virtual Bool_t Update(const AliCluster*, Double_t, Int_t) { return kTRUE; } + void UpdateESDdEdx(AliESDtrack *t); + +protected: + AliTRDrecoParam *fRecoParam; // reconstruction parameters + ClassDef(AliTRDtrackV1, 1) // development TRD track +}; + +//___________________________________________________________ +inline Int_t AliTRDtrackV1::GetNumberOfClusters() const +{ +/* Int_t ntrklts = GetNumberOfTracklets(); + printf("AliTRDtrackV1::GetNumberOfClusters() %d\n", ntrklts); + return ntrklts;*/ + Int_t ncls = 0; + for(int ip=0; ip<6; ip++) + if(fTrackletIndex[ip] >= 0) ncls+=fTracklet[ip].GetN(); + + return ncls; +} + +// //___________________________________________________________ +// inline Int_t AliTRDtrackV1::GetNumberOfTracklets() const +// { +// Int_t ntrklt = 0; +// for(int ip=0; ip<6; ip++) if(fTrackletIndex[ip] >= 0) ntrklt++; +// return ntrklt; +// } + +#endif + + diff --git a/TRD/AliTRDtracker.h b/TRD/AliTRDtracker.h index 288f59c1203..77d3f7eb7dc 100644 --- a/TRD/AliTRDtracker.h +++ b/TRD/AliTRDtracker.h @@ -73,7 +73,7 @@ class AliTRDtracker : public AliTracker { Float_t GetMinClustersInTrack() const { return fgkMinClustersInTrack; } Int_t GetLastPlane(AliTRDtrack *track); Double_t GetTiltFactor(const AliTRDcluster *c); - Bool_t GetTrackPoint(Int_t index, AliTrackPoint& p) const; + virtual Bool_t GetTrackPoint(Int_t index, AliTrackPoint& p) const; Double_t GetX(Int_t sec, Int_t plane, Int_t localTB) const; Double_t GetX(Int_t sec, Int_t pl) const { return fTrSec[sec]->GetLayer(pl)->GetX(); } @@ -183,14 +183,13 @@ class AliTRDtracker : public AliTracker { TH1D *fHDeltaX; // QA histogram TH1D *fHXCl; // QA histogram - private: + protected: Int_t FollowProlongation(AliTRDtrack &t); Int_t PropagateToX(AliTRDtrack &t, Double_t xToGo, Double_t maxStep); Double_t ExpectedSigmaY2(Double_t r, Double_t tgl, Double_t pt) const; Double_t ExpectedSigmaZ2(Double_t r, Double_t tgl) const; - private: TTreeSRedirector *fDebugStreamer; //!Debug streamer diff --git a/TRD/AliTRDtrackerV1.cxx b/TRD/AliTRDtrackerV1.cxx index 37441a904ae..6b1139b0056 100644 --- a/TRD/AliTRDtrackerV1.cxx +++ b/TRD/AliTRDtrackerV1.cxx @@ -64,6 +64,8 @@ #include "AliTRDstackLayer.h" #include "AliTRDrecoParam.h" #include "AliTRDseedV1.h" +#include "AliTRDtrackV1.h" +#include "Cal/AliTRDCalDet.h" #define DEBUG @@ -78,9 +80,9 @@ Double_t AliTRDtrackerV1::fgTopologicQA[kNConfigs] = { AliTRDtrackerV1::AliTRDtrackerV1(AliTRDrecoParam *p) :AliTRDtracker() ,fSieveSeeding(0) - ,fRecoParam(p) + ,fTracklets(0x0) + ,fRecoParam(p) ,fFitter(0x0) - ,fDebugStreamerV1(0x0) { // // Default constructor. Nothing is initialized. @@ -92,9 +94,9 @@ AliTRDtrackerV1::AliTRDtrackerV1(AliTRDrecoParam *p) AliTRDtrackerV1::AliTRDtrackerV1(const TFile *in, AliTRDrecoParam *p) :AliTRDtracker(in) ,fSieveSeeding(0) + ,fTracklets(0x0) ,fRecoParam(p) ,fFitter(0x0) - ,fDebugStreamerV1(0x0) { // // Standard constructor. @@ -105,8 +107,7 @@ AliTRDtrackerV1::AliTRDtrackerV1(const TFile *in, AliTRDrecoParam *p) fFitter = new AliTRDtrackerFitter(); #ifdef DEBUG - fDebugStreamerV1 = new TTreeSRedirector("TRDdebug.root"); - fFitter->SetDebugStream(fDebugStreamerV1); + fFitter->SetDebugStream(fDebugStreamer); #endif } @@ -118,10 +119,9 @@ AliTRDtrackerV1::~AliTRDtrackerV1() // Destructor // - if(fDebugStreamerV1) delete fDebugStreamerV1; if(fFitter) delete fFitter; if(fRecoParam) delete fRecoParam; - + if(fTracklets) {fTracklets->Delete(); delete fTracklets;} } //____________________________________________________________________ @@ -157,6 +157,729 @@ Int_t AliTRDtrackerV1::Clusters2Tracks(AliESDEvent *esd) return ntracks; } + +//_____________________________________________________________________________ +Bool_t AliTRDtrackerV1::GetTrackPoint(Int_t index, AliTrackPoint &/*p*/) const +{ + //AliInfo(Form("Asking for tracklet %d", index)); + + if(index<0) return kFALSE; + // Why is this (CBL) ? + //AliTRDseedV1 *tracklet = (AliTRDseedV1*)fTracklets->UncheckedAt(index); + // etc + return kTRUE; +} + + +//_____________________________________________________________________________ +Int_t AliTRDtrackerV1::PropagateBack(AliESDEvent *event) +{ + // + // Gets seeds from ESD event. The seeds are AliTPCtrack's found and + // backpropagated by the TPC tracker. Each seed is first propagated + // to the TRD, and then its prolongation is searched in the TRD. + // If sufficiently long continuation of the track is found in the TRD + // the track is updated, otherwise it's stored as originaly defined + // by the TPC tracker. + // + + Int_t found = 0; // number of tracks found + Float_t foundMin = 20.0; + + AliTRDseed::SetNTimeBins(fTimeBinsPerPlane); + Int_t nSeed = event->GetNumberOfTracks(); + if(!nSeed){ + // run stand alone tracking + if (AliTRDReconstructor::SeedingOn()) Clusters2Tracks(event); + return 0; + } + + Float_t *quality = new Float_t[nSeed]; + Int_t *index = new Int_t[nSeed]; + for (Int_t iSeed = 0; iSeed < nSeed; iSeed++) { + AliESDtrack *seed = event->GetTrack(iSeed); + Double_t covariance[15]; + seed->GetExternalCovariance(covariance); + quality[iSeed] = covariance[0] + covariance[2]; + } + // Sort tracks according to covariance of local Y and Z + TMath::Sort(nSeed,quality,index,kFALSE); + + // Backpropagate all seeds + for (Int_t iSeed = 0; iSeed < nSeed; iSeed++) { + + // Get the seeds in sorted sequence + AliESDtrack *seed = event->GetTrack(index[iSeed]); + + // Check the seed status + ULong_t status = seed->GetStatus(); + if ((status & AliESDtrack::kTPCout) == 0) continue; + if ((status & AliESDtrack::kTRDout) != 0) continue; + + // Do the back prolongation + Int_t lbl = seed->GetLabel(); + AliTRDtrackV1 *track = new AliTRDtrackV1(*seed); + //track->Print(); + track->SetSeedLabel(lbl); + seed->UpdateTrackParams(track, AliESDtrack::kTRDbackup); // Make backup + fNseeds++; + Float_t p4 = track->GetC(); + Int_t expectedClr = FollowBackProlongation(*track); + //AliInfo(Form("\nTRACK %d Clusters %d [%d] in chi2 %f", index[iSeed], expectedClr, track->GetNumberOfClusters(), track->GetChi2())); + //track->Print(); + + //Double_t cov[15]; + //seed->GetExternalCovariance(cov); + //AliInfo(Form("track %d cov[%f %f] 0", index[iSeed], cov[0], cov[2])); + + if ((TMath::Abs(track->GetC() - p4) / TMath::Abs(p4) < 0.2) || + (track->Pt() > 0.8)) { + // + // Make backup for back propagation + // + Int_t foundClr = track->GetNumberOfClusters(); + if (foundClr >= foundMin) { + //AliInfo(Form("Making backup track ncls [%d]...", foundClr)); + track->CookdEdx(); + track->CookdEdxTimBin(seed->GetID()); // A.Bercuci 25.07.07 + CookLabel(track,1 - fgkLabelFraction); + if (track->GetBackupTrack()) UseClusters(track->GetBackupTrack()); + + + //seed->GetExternalCovariance(cov); + //AliInfo(Form("track %d cov[%f %f] 0 test", index[iSeed], cov[0], cov[2])); + + // Sign only gold tracks + if (track->GetChi2() / track->GetNumberOfClusters() < 4) { + if ((seed->GetKinkIndex(0) == 0) && + (track->Pt() < 1.5)) UseClusters(track); + } + Bool_t isGold = kFALSE; + + // Full gold track + if (track->GetChi2() / track->GetNumberOfClusters() < 5) { + if (track->GetBackupTrack()) seed->UpdateTrackParams(track->GetBackupTrack(),AliESDtrack::kTRDbackup); + + isGold = kTRUE; + } + //seed->GetExternalCovariance(cov); + //AliInfo(Form("track %d cov[%f %f] 00", index[iSeed], cov[0], cov[2])); + + // Almost gold track + if ((!isGold) && (track->GetNCross() == 0) && + (track->GetChi2() / track->GetNumberOfClusters() < 7)) { + //seed->UpdateTrackParams(track, AliESDtrack::kTRDbackup); + if (track->GetBackupTrack()) seed->UpdateTrackParams(track->GetBackupTrack(),AliESDtrack::kTRDbackup); + + isGold = kTRUE; + } + //seed->GetExternalCovariance(cov); + //AliInfo(Form("track %d cov[%f %f] 01", index[iSeed], cov[0], cov[2])); + + if ((!isGold) && (track->GetBackupTrack())) { + if ((track->GetBackupTrack()->GetNumberOfClusters() > foundMin) && ((track->GetBackupTrack()->GetChi2()/(track->GetBackupTrack()->GetNumberOfClusters()+1)) < 7)) { + seed->UpdateTrackParams(track->GetBackupTrack(),AliESDtrack::kTRDbackup); + isGold = kTRUE; + } + } + //seed->GetExternalCovariance(cov); + //AliInfo(Form("track %d cov[%f %f] 02", index[iSeed], cov[0], cov[2])); + + //if ((track->StatusForTOF() > 0) && (track->GetNCross() == 0) && (Float_t(track->GetNumberOfClusters()) / Float_t(track->GetNExpected()) > 0.4)) { + //seed->UpdateTrackParams(track->GetBackupTrack(), AliESDtrack::kTRDbackup); + //} + } + } + /**/ + + /**/ + // Debug part of tracking +/* TTreeSRedirector &cstream = *fDebugStreamer; + Int_t eventNrInFile = event->GetEventNumberInFile(); // This is most likely NOT the event number you'd like to use. It has nothing to do with the 'real' event number. + if (AliTRDReconstructor::StreamLevel() > 0) { + if (track->GetBackupTrack()) { + cstream << "Tracks" + << "EventNrInFile=" << eventNrInFile + << "ESD.=" << seed + << "trd.=" << track + << "trdback.=" << track->GetBackupTrack() + << "\n"; + } + else { + cstream << "Tracks" + << "EventNrInFile=" << eventNrInFile + << "ESD.=" << seed + << "trd.=" << track + << "trdback.=" << track + << "\n"; + } + }*/ + /**/ + + //seed->GetExternalCovariance(cov); + //AliInfo(Form("track %d cov[%f %f] 1", index[iSeed], cov[0], cov[2])); + + // Propagation to the TOF (I.Belikov) + if (track->GetStop() == kFALSE) { + //AliInfo("Track not stopped in TRD ..."); + Double_t xtof = 371.0; + Double_t xTOF0 = 370.0; + + Double_t c2 = track->GetSnp() + track->GetC() * (xtof - track->GetX()); + if (TMath::Abs(c2) >= 0.99) { + delete track; + continue; + } + + PropagateToX(*track,xTOF0,fgkMaxStep); + + // Energy losses taken to the account - check one more time + c2 = track->GetSnp() + track->GetC() * (xtof - track->GetX()); + if (TMath::Abs(c2) >= 0.99) { + delete track; + continue; + } + + //if (!PropagateToX(*track,xTOF0,fgkMaxStep)) { + // fHBackfit->Fill(7); + //delete track; + // continue; + //} + + Double_t ymax = xtof * TMath::Tan(0.5 * AliTRDgeometry::GetAlpha()); + Double_t y; + track->GetYAt(xtof,GetBz(),y); + if (y > ymax) { + if (!track->Rotate( AliTRDgeometry::GetAlpha())) { + delete track; + continue; + } + }else if (y < -ymax) { + if (!track->Rotate(-AliTRDgeometry::GetAlpha())) { + delete track; + continue; + } + } + + if (track->PropagateTo(xtof)) { + //AliInfo("set kTRDout"); + seed->UpdateTrackParams(track,AliESDtrack::kTRDout); + + for (Int_t i = 0; i < AliESDtrack::kNPlane; i++) { + for (Int_t j = 0; j < AliESDtrack::kNSlice; j++) { + seed->SetTRDsignals(track->GetPIDsignals(i,j),i,j); + } + seed->SetTRDTimBin(track->GetPIDTimBin(i),i); + } + //seed->SetTRDtrack(new AliTRDtrack(*track)); + if (track->GetNumberOfClusters() > foundMin) found++; + } + } else { + //AliInfo("Track stopped in TRD ..."); + + if ((track->GetNumberOfClusters() > 15) && + (track->GetNumberOfClusters() > 0.5*expectedClr)) { + seed->UpdateTrackParams(track,AliESDtrack::kTRDout); + + //seed->SetStatus(AliESDtrack::kTRDStop); + for (Int_t i = 0; i < AliESDtrack::kNPlane; i++) { + for (Int_t j = 0; j SetTRDsignals(track->GetPIDsignals(i,j),i,j); + } + seed->SetTRDTimBin(track->GetPIDTimBin(i),i); + } + //seed->SetTRDtrack(new AliTRDtrack(*track)); + found++; + } + } + + //if (((t->GetStatus()&AliESDtrack::kTRDout)!=0 ) + + seed->SetTRDQuality(track->StatusForTOF()); + seed->SetTRDBudget(track->GetBudget(0)); + +// if ((seed->GetStatus()&AliESDtrack::kTRDin)!=0 ) printf("TRDin "); +// if ((seed->GetStatus()&AliESDtrack::kTRDbackup)!=0 ) printf("TRDbackup "); +// if ((seed->GetStatus()&AliESDtrack::kTRDStop)!=0 ) printf("TRDstop "); +// if ((seed->GetStatus()&AliESDtrack::kTRDout)!=0 ) printf("TRDout "); +// printf("\n"); + delete track; + + //seed->GetExternalCovariance(cov); + //AliInfo(Form("track %d cov[%f %f] 2", index[iSeed], cov[0], cov[2])); + } + + + AliInfo(Form("Number of seeds: %d",fNseeds)); + AliInfo(Form("Number of back propagated TRD tracks: %d",found)); + + //fSeeds->Clear(); + fNseeds = 0; + + delete [] index; + delete [] quality; + + return 0; +} + + +//____________________________________________________________________ +Int_t AliTRDtrackerV1::RefitInward(AliESDEvent *event) +{ + // + // Refits tracks within the TRD. The ESD event is expected to contain seeds + // at the outer part of the TRD. + // The tracks are propagated to the innermost time bin + // of the TRD and the ESD event is updated + // Origin: Thomas KUHR (Thomas.Kuhr@cern.ch) + // + + Int_t nseed = 0; // contor for loaded seeds + Int_t found = 0; // contor for updated TRD tracks + AliTRDtrackV1 track; + for (Int_t itrack = 0; itrack < event->GetNumberOfTracks(); itrack++) { + AliESDtrack *seed = event->GetTrack(itrack); + new(&track) AliTRDtrackV1(*seed); + + if (track.GetX() < 270.0) { + seed->UpdateTrackParams(&track, AliESDtrack::kTRDbackup); + //AliInfo(Form("Remove for X = %7.3f [270.]\n", track.GetX())); + continue; + } + + ULong_t status = seed->GetStatus(); + if((status & AliESDtrack::kTRDout) == 0) continue; + if((status & AliESDtrack::kTRDin) != 0) continue; + nseed++; + + track.ResetCovariance(50.0); + + // do the propagation and processing + FollowProlongation(track); + track.CookPID(); + //track.Calibrate(); + + // Prolongate to TPC + Double_t xTPC = 250.0; + if (PropagateToX(track, xTPC, fgkMaxStep)) { // -with update + seed->UpdateTrackParams(&track, AliESDtrack::kTRDrefit); + track.UpdateESDdEdx(seed); + // Add TRD track to ESDfriendTrack + if (AliTRDReconstructor::StreamLevel() > 0) seed->AddCalibObject(new AliTRDtrackV1(track/*, kTRUE*/)); + found++; + } else { // - without update + AliTRDtrackV1 tt(*seed); + if (PropagateToX(tt, xTPC, fgkMaxStep)) seed->UpdateTrackParams(&tt, AliESDtrack::kTRDrefit); + } + } + AliInfo(Form("Number of loaded seeds: %d",nseed)); + AliInfo(Form("Number of found tracks from loaded seeds: %d",found)); + + return 0; +} + + +//____________________________________________________________________ +Int_t AliTRDtrackerV1::FollowProlongation(AliTRDtrackV1 &t) +{ +// Extrapolates the TRD track in the TPC direction. +// +// Parameters +// t : the TRD track which has to be extrapolated +// +// Output +// number of clusters attached to the track +// +// Detailed description +// +// Starting from current radial position of track this function +// extrapolates the track through the 6 TRD layers. The following steps +// are being performed for each plane: +// 1. prepare track: +// a. get plane limits in the local x direction +// b. check crossing sectors +// c. check track inclination +// 2. search tracklet in the tracker list (see GetTracklet() for details) +// 3. evaluate material budget using the geo manager +// 4. propagate and update track using the tracklet information. +// +// Debug level 2 +// + + //AliInfo(""); + Int_t nClustersExpected = 0; + Int_t lastplane = 5; //GetLastPlane(&t); + for (Int_t iplane = lastplane; iplane >= 0; iplane--) { + //AliInfo(Form("plane %d", iplane)); + Int_t row1 = GetGlobalTimeBin(0, iplane, 0); // to be modified to the true time bin in the geometrical acceptance + //AliInfo(Form("row1 %d", row1)); + + // Propagate track close to the plane if neccessary + AliTRDpropagationLayer *layer = fTrSec[0]->GetLayer(row1); + Double_t currentx = layer->GetX(); + if (currentx < (-fgkMaxStep + t.GetX())) + if (!PropagateToX(t, currentx+fgkMaxStep, fgkMaxStep)) break; + + if (!AdjustSector(&t)) break; + + Int_t row0 = GetGlobalTimeBin(0,iplane,GetTimeBinsPerPlane()-1); + //AliInfo(Form("row0 %d", row0)); + + // Start global position + Double_t xyz0[3]; + t.GetXYZ(xyz0); + + // End global position + Double_t x = fTrSec[0]->GetLayer(row0)->GetX(), y, z; + if (!t.GetProlongation(x,y,z)) break; + Double_t xyz1[3]; + xyz1[0] = x * TMath::Cos(t.GetAlpha()) - y * TMath::Sin(t.GetAlpha()); + xyz1[1] = +x * TMath::Sin(t.GetAlpha()) + y * TMath::Cos(t.GetAlpha()); + xyz1[2] = z; + + // Get material budget + Double_t param[7]; + AliTracker::MeanMaterialBudget(xyz0,xyz1,param); + Double_t xrho= param[0]*param[4]; + Double_t xx0 = param[1]; // Get mean propagation parameters + + // Propagate and update + //Int_t sector = t.GetSector(); + Int_t index = 0; + //AliInfo(Form("sector %d", sector)); + AliTRDseedV1 *tracklet = GetTracklet(&t, iplane, index); + //AliInfo(Form("tracklet 0x%x @ %d", tracklet, index)); + if(!tracklet) continue; + + t.PropagateTo(tracklet->GetX0(), xx0, xrho); // not correct + if (!AdjustSector(&t)) break; + + Double_t maxChi2 = t.GetPredictedChi2(tracklet); + if (maxChi2 < 1e+10) + if(t.Update(tracklet, maxChi2)) nClustersExpected += tracklet->GetN(); + } + +#ifdef DEBUG + if(AliTRDReconstructor::StreamLevel() > 1){ + Int_t index; + for(int iplane=0; iplane<6; iplane++){ + AliTRDseedV1 *tracklet = GetTracklet(&t, iplane, index); + if(!tracklet) continue; + t.SetTracklet(tracklet, iplane, index); + } + + TTreeSRedirector &cstreamer = *fDebugStreamer; + cstreamer << "FollowProlongation" + << "ncl=" << nClustersExpected + << "track.=" << &t + << "\n"; + } +#endif + + return nClustersExpected; + +} + +//_____________________________________________________________________________ +Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) +{ +// Extrapolates the TRD track in the TOF direction. +// +// Parameters +// t : the TRD track which has to be extrapolated +// +// Output +// number of clusters attached to the track +// +// Detailed description +// +// Starting from current radial position of track this function +// extrapolates the track through the 6 TRD layers. The following steps +// are being performed for each plane: +// 1. prepare track: +// a. get plane limits in the local x direction +// b. check crossing sectors +// c. check track inclination +// 2. build tracklet (see AliTRDseed::AttachClusters() for details) +// 3. evaluate material budget using the geo manager +// 4. propagate and update track using the tracklet information. +// +// Debug level 2 +// + + Int_t nClustersExpected = 0; + + // Loop through the TRD planes + for (Int_t iplane = 0; iplane < AliTRDgeometry::Nplan(); iplane++) { + //AliInfo(Form("Processing plane %d ...", iplane)); + // Get the global time bin for the first local time bin of the given plane + Int_t row0 = GetGlobalTimeBin(0, iplane, fTimeBinsPerPlane-1); + + // Retrive first propagation layer in the chamber + AliTRDpropagationLayer *layer = fTrSec[0]->GetLayer(row0); + + // Get the X coordinates of the propagation layer for the first time bin + Double_t currentx = layer->GetX(); // what if X is not defined ??? + if (currentx < t.GetX()) continue; + + // Get the global time bin for the last local time bin of the given plane + Int_t row1 = GetGlobalTimeBin(0, iplane, 0); + + // Propagate closer to the current chamber if neccessary + if (currentx > (fgkMaxStep + t.GetX()) && !PropagateToX(t, currentx-fgkMaxStep, fgkMaxStep)) break; + + // Rotate track to adjacent sector if neccessary + if (!AdjustSector(&t)) break; + Int_t sector = Int_t(TMath::Abs(t.GetAlpha()/AliTRDgeometry::GetAlpha())); + if(t.GetAlpha() < 0) sector = AliTRDgeometry::Nsect() - sector-1; + + //AliInfo(Form("sector %d [%f]", sector, t.GetAlpha())); + + // Check whether azimuthal angle is getting too large + if (TMath::Abs(t.GetSnp()) > fgkMaxSnp) break; + + //Calculate global entry and exit positions of the track in chamber (only track prolongation) + Double_t xyz0[3]; // entry point + t.GetXYZ(xyz0); + //printf("Entry global x[%7.3f] y[%7.3f] z[%7.3f]\n", xyz0[0], xyz0[1], xyz0[2]); + + // Get local Y and Z at the X-position of the end of the chamber + Double_t x0 = fTrSec[sector]->GetLayer(row1)->GetX(), y, z; + if (!t.GetProlongation(x0, y, z)) break; + //printf("Exit local x[%7.3f] y[%7.3f] z[%7.3f]\n", x0, y, z); + + Double_t xyz1[3]; // exit point + xyz1[0] = x0 * TMath::Cos(t.GetAlpha()) - y * TMath::Sin(t.GetAlpha()); + xyz1[1] = +x0 * TMath::Sin(t.GetAlpha()) + y * TMath::Cos(t.GetAlpha()); + xyz1[2] = z; + + //printf("Exit global x[%7.3f] y[%7.3f] z[%7.3f]\n", xyz1[0], xyz1[1], xyz1[2]); + // Find tracklet along the path inside the chamber + AliTRDseedV1 tracklet(*t.GetTracklet(iplane)); + // if the track is not already build (e.g. stand alone tracker) we build it now. + if(!tracklet.GetN()){ // a better check has to be implemented !!!!!!! + + //AliInfo(Form("Building tracklet for plane %d ...", iplane)); + // check if we are inside detection volume + Int_t ichmb = fGeom->GetChamber(xyz0[2], iplane); + if(ichmb<0) ichmb = fGeom->GetChamber(xyz1[2], iplane); + if(ichmb<0){ + // here we should decide what to do with the track. The space between the pads in 2 chambers is 4cm+. Is it making sense to continue building the tracklet here ???? + AliWarning(Form("Track prolongated in the interspace between TRD detectors in plane %d. Skip plane. To be fixed !", iplane)); + continue; + } + + // temporary until the functionalities of AliTRDpropagationLayer and AliTRDstackLayer are merged + AliTRDpadPlane *pp = fGeom->GetPadPlane(iplane, ichmb); + Int_t nrows = pp->GetNrows(); + Double_t stacklength = pp->GetRow0ROC() - pp->GetRowEndROC();/*(nrows - 2) * pp->GetLengthIPad() + 2 * pp->GetLengthOPad() + (nrows - 1) * pp->GetRowSpacing();*/ + Double_t z0 = fGeom->GetRow0(iplane, ichmb, 0); + + Int_t nClustersChmb = 0; + AliTRDstackLayer stackLayer[35]; + for(int itb=0; itbGetLayer(row1 - itb))); + stackLayer[itb] = ksmLayer; +#ifdef DEBUG + stackLayer[itb].SetDebugStream(fDebugStreamer); +#endif + stackLayer[itb].SetRange(z0 - stacklength, stacklength); + stackLayer[itb].SetSector(sector); + stackLayer[itb].SetStackNr(ichmb); + stackLayer[itb].SetNRows(nrows); + stackLayer[itb].SetRecoParam(fRecoParam); + stackLayer[itb].BuildIndices(); + nClustersChmb += stackLayer[itb].GetNClusters(); + } + //AliInfo(Form("Detector p[%d] c[%d]. Building tracklet from %d clusters ... ", iplane, ichmb, nClustersChmb)); + + tracklet.SetRecoParam(fRecoParam); + tracklet.SetTilt(TMath::Tan(-TMath::DegToRad()*pp->GetTiltingAngle())); + tracklet.SetPadLength(pp->GetLengthIPad()); + tracklet.SetPlane(iplane); + Int_t tbRange = fTimeBinsPerPlane; //Int_t(AliTRDgeometry::CamHght()+AliTRDgeometry::CdrHght() * AliTRDCommonParam::Instance()->GetSamplingFrequency()/AliTRDcalibDB::Instance()->GetVdriftDet()->GetValue(det)); + //printf("%d hl[%f] pl[%f] tb[%d]\n", il, hL[il], padlength[il], tbRange[il]); + tracklet.SetNTimeBinsRange(tbRange); + tracklet.SetX0(x0); + tracklet.Init(&t); + if(!tracklet.AttachClustersIter(stackLayer, 1000.)) continue; + + //if(!tracklet.AttachClusters(stackLayer, kTRUE)) continue; + //if(!tracklet.Fit()) continue; + } + Int_t ncl = tracklet.GetN(); + //AliInfo(Form("N clusters %d", ncl)); + + // Discard tracklet if bad quality. + //Check if this condition is not already checked during building of the tracklet + if(ncl < fTimeBinsPerPlane * fRecoParam->GetFindableClusters()){ + //AliInfo(Form("Discard tracklet for %d nclusters", ncl)); + continue; + } + + // load tracklet to the tracker and the track + Int_t index = SetTracklet(&tracklet); + t.SetTracklet(&tracklet, iplane, index); + + // Calculate the mean material budget along the path inside the chamber + Double_t param[7]; + AliTracker::MeanMaterialBudget(xyz0, xyz1, param); + // The mean propagation parameters + Double_t xrho = param[0]*param[4]; // density*length + Double_t xx0 = param[1]; // radiation length + + // Propagate and update track + t.PropagateTo(tracklet.GetX0(), xx0, xrho); + if (!AdjustSector(&t)) break; + Double_t maxChi2 = t.GetPredictedChi2(&tracklet); + if (maxChi2<1e+10){ + t.Update(&tracklet, maxChi2); + } + // Reset material budget if 2 consecutive gold + if(iplane>0 && ncl + t.GetTracklet(iplane-1)->GetN() > 20) t.SetBudget(2, 0.); + + // Make backup of the track until is gold + // TO DO update quality check of the track. + // consider comparison with fTimeBinsRange + Float_t ratio0 = ncl / Float_t(fTimeBinsPerPlane); + //Float_t ratio1 = Float_t(t.GetNumberOfClusters()+1) / Float_t(t.GetNExpected()+1); + //printf("tracklet.GetChi2() %f [< 18.0]\n", tracklet.GetChi2()); + //printf("ratio0 %f [> 0.8]\n", ratio0); + //printf("ratio1 %f [> 0.6]\n", ratio1); + //printf("ratio0+ratio1 %f [> 1.5]\n", ratio0+ratio1); + //printf("t.GetNCross() %d [== 0]\n", t.GetNCross()); + //printf("TMath::Abs(t.GetSnp()) %f [< 0.85]\n", TMath::Abs(t.GetSnp())); + //printf("t.GetNumberOfClusters() %d [> 20]\n", t.GetNumberOfClusters()); + + if (//(tracklet.GetChi2() < 18.0) && TO DO check with FindClusters and move it to AliTRDseed::Update + (ratio0 > 0.8) && + //(ratio1 > 0.6) && + //(ratio0+ratio1 > 1.5) && + (t.GetNCross() == 0) && + (TMath::Abs(t.GetSnp()) < 0.85) && + (t.GetNumberOfClusters() > 20)) t.MakeBackupTrack(); + + nClustersExpected += ncl; + } // end planes loop + +#ifdef DEBUG + if(AliTRDReconstructor::StreamLevel() > 1){ + TTreeSRedirector &cstreamer = *fDebugStreamer; + cstreamer << "FollowBackProlongation" + << "ncl=" << nClustersExpected + << "track.=" << &t + << "\n"; + } +#endif + + return nClustersExpected; +} + +//____________________________________________________________________ +void AliTRDtrackerV1::UnloadClusters() +{ + // + // Clears the arrays of clusters and tracks. Resets sectors and timebins + // + + Int_t i; + Int_t nentr; + + nentr = fClusters->GetEntriesFast(); + //AliInfo(Form("clearing %d clusters", nentr)); + for (i = 0; i < nentr; i++) { + delete fClusters->RemoveAt(i); + } + fNclusters = 0; + + nentr = fTracklets->GetEntriesFast(); + //AliInfo(Form("clearing %d tracklets", nentr)); + for (i = 0; i < nentr; i++) { + delete fTracklets->RemoveAt(i); + } + + nentr = fSeeds->GetEntriesFast(); + //AliInfo(Form("clearing %d seeds", nentr)); + for (i = 0; i < nentr; i++) { + delete fSeeds->RemoveAt(i); + } + + nentr = fTracks->GetEntriesFast(); + //AliInfo(Form("clearing %d tracks", nentr)); + for (i = 0; i < nentr; i++) { + delete fTracks->RemoveAt(i); + } + + Int_t nsec = AliTRDgeometry::kNsect; + for (i = 0; i < nsec; i++) { + for(Int_t pl = 0; pl < fTrSec[i]->GetNumberOfLayers(); pl++) { + fTrSec[i]->GetLayer(pl)->Clear(); + } + } + +} + +//____________________________________________________________________ +AliTRDseedV1* AliTRDtrackerV1::GetTracklet(AliTRDtrackV1 *track, Int_t p, Int_t &idx) +{ +// Find tracklet for TRD track +// Parameters +// - track +// - sector +// - plane +// - index +// Output +// tracklet +// index +// Detailed description +// + idx = track->GetTrackletIndex(p); + //AliInfo(Form("looking for tracklet in plane %d idx %d [%d]", p, idx, track->GetTrackletIndex(p))); + AliTRDseedV1 *tracklet = idx<0 ? 0x0 : (AliTRDseedV1*)fTracklets->UncheckedAt(idx); + //AliInfo(Form("found 0x%x @ %d", tracklet, idx)); + +// Int_t *index = track->GetTrackletIndexes(); +// for (UInt_t i = 0; i < 6; i++) AliInfo(Form("index[%d] = %d", i, index[i])); +// +// for (UInt_t i = 0; i < 6/*kMaxTimeBinIndex*/; i++) { +// if (index[i] < 0) continue; +// +// tracklet = (AliTRDseedV1*)fTracklets->UncheckedAt(index[i]); +// if(!tracklet) break; +// +// if(tracklet->GetPlane() != p) continue; +// +// idx = index[i]; +// } + + return tracklet; +} + +//____________________________________________________________________ +Int_t AliTRDtrackerV1::SetTracklet(AliTRDseedV1 */*tracklet*/) +{ +// Add this tracklet to the list of tracklets stored in the tracker +// +// Parameters +// - tracklet : pointer to the tracklet to be added to the list +// +// Output +// - the index of the new tracklet in the tracker tracklets list +// +// Detailed description +// Build the tracklets list if it is not yet created (late initialization) +// and adds the new tracklet to the list. +// + if(!fTracklets){ + fTracklets = new TClonesArray("AliTRDseedV1", AliTRDgeometry::Nsect()*kMaxTracksStack); + fTracklets->SetOwner(kTRUE); + } + Int_t nentries = fTracklets->GetEntriesFast(); + //AliTRDseedV1 *t = new ((*fTracklets)[nentries]) AliTRDseedV1(*tracklet); + //AliInfo(Form("0x%x @ %d", t, nentries)); + return nentries; +} + //____________________________________________________________________ Int_t AliTRDtrackerV1::Clusters2TracksSM(AliTRDtracker::AliTRDtrackingSector *sector , AliESDEvent *esd) @@ -203,10 +926,10 @@ Int_t AliTRDtrackerV1::Clusters2TracksSM(AliTRDtracker::AliTRDtrackingSector *se + 2 * pp->GetLengthOPad() + 2 * pp->GetLengthRim(); //Debug Double_t z0 = fGeom->GetRow0((Int_t)(ilayer/nTimeBins),istack,0); - const AliTRDpropagationLayer kSMlayer(*(sector->GetLayer(ilayer))); - stackLayer[ilayer] = kSMlayer; + const AliTRDpropagationLayer ksmLayer(*(sector->GetLayer(ilayer))); + stackLayer[ilayer] = ksmLayer; #ifdef DEBUG - stackLayer[ilayer].SetDebugStream(fDebugStreamerV1); + stackLayer[ilayer].SetDebugStream(fDebugStreamer); #endif stackLayer[ilayer].SetRange(z0 - stacklength, stacklength); stackLayer[ilayer].SetSector(sector->GetSector()); @@ -258,10 +981,8 @@ Int_t AliTRDtrackerV1::Clusters2TracksStack(AliTRDstackLayer *layer // 8. Build ESD track and register it to the output list // - AliTRDcalibDB *cal = AliTRDcalibDB::Instance(); - Int_t nTimeBins = cal->GetNumberOfTimeBins(); AliTRDseedV1 sseed[kMaxTracksStack*6]; // to be initialized - Int_t pars[3]; // MakeSeeds parameters + Int_t pars[4]; // MakeSeeds parameters //Double_t alpha = AliTRDgeometry::GetAlpha(); //Double_t shift = .5 * alpha; @@ -291,8 +1012,7 @@ Int_t AliTRDtrackerV1::Clusters2TracksStack(AliTRDstackLayer *layer if(ntracks == kMaxTracksStack) break; } #ifdef DEBUG - if(AliTRDReconstructor::StreamLevel() > 1) - AliInfo(Form("Candidate TRD tracks %d in stack %d.", ntracks, pars[1])); + if(AliTRDReconstructor::StreamLevel() > 1) AliInfo(Form("Candidate TRD tracks %d in stack %d iteration %d.", ntracks, pars[1], fSieveSeeding)); #endif if(!ntracks) break; @@ -344,7 +1064,7 @@ Int_t AliTRDtrackerV1::Clusters2TracksStack(AliTRDstackLayer *layer nlayers++; // Cooking label - for (Int_t itime = 0; itime < nTimeBins; itime++) { + for (Int_t itime = 0; itime < fTimeBinsPerPlane; itime++) { if(!sseed[jseed].IsUsable(itime)) continue; naccepted++; Int_t tindex = 0, ilab = 0; @@ -356,12 +1076,12 @@ Int_t AliTRDtrackerV1::Clusters2TracksStack(AliTRDstackLayer *layer } // Filter duplicated tracks if (nused > 30){ - //printf("Skip nused %d\n", nused); + printf("Skip %d nused %d\n", trackIndex, nused); fakeTrack[trackIndex] = kTRUE; continue; } if (Float_t(nused)/ncl >= .25){ - //printf("Skip nused/ncl >= .25\n"); + printf("Skip %d nused/ncl >= .25\n", trackIndex); fakeTrack[trackIndex] = kTRUE; continue; } @@ -390,12 +1110,12 @@ Int_t AliTRDtrackerV1::Clusters2TracksStack(AliTRDstackLayer *layer case 4: if (nlayers == 3){skip = kTRUE; break;} - if (TMath::Log(1.E-9+fTrackQuality[trackIndex]) - nused/(nlayers-3.0) < -15.0){skip = kTRUE; break;} + //if (TMath::Log(1.E-9+fTrackQuality[trackIndex]) - nused/(nlayers-3.0) < -15.0){skip = kTRUE; break;} break; } if(skip){ candidates++; - //printf("REJECTED : %d [%d] nlayers %d trackQuality = %e nused %d\n", itrack, trackIndex, nlayers, fTrackQuality[trackIndex], nused); + printf("REJECTED : %d [%d] nlayers %d trackQuality = %e nused %d\n", itrack, trackIndex, nlayers, fTrackQuality[trackIndex], nused); continue; } signedTrack[trackIndex] = kTRUE; @@ -463,13 +1183,14 @@ Int_t AliTRDtrackerV1::Clusters2TracksStack(AliTRDstackLayer *layer Int_t nclusters = 0; AliTRDseedV1 *dseed[6]; for(int is=0; is<6; is++){ - dseed[is] = new AliTRDseedV1(sseed[trackIndex*6+is], kTRUE); + dseed[is] = new AliTRDseedV1(sseed[trackIndex*6+is]); + dseed[is]->SetOwner(); nclusters += sseed[is].GetN2(); //for(int ic=0; ic<30; ic++) if(sseed[trackIndex*6+is].GetClusters(ic)) printf("l[%d] tb[%d] cptr[%p]\n", is, ic, sseed[trackIndex*6+is].GetClusters(ic)); } //Int_t eventNrInFile = esd->GetEventNumberInFile(); //AliInfo(Form("Number of clusters %d.", nclusters)); - TTreeSRedirector &cstreamer = *fDebugStreamerV1; + TTreeSRedirector &cstreamer = *fDebugStreamer; cstreamer << "Clusters2TracksStack" << "Iter=" << fSieveSeeding << "Like=" << fTrackQuality[trackIndex] @@ -502,11 +1223,12 @@ Int_t AliTRDtrackerV1::Clusters2TracksStack(AliTRDstackLayer *layer } #endif - AliTRDtrack *track = AliTRDtrackerV1::RegisterSeed(&sseed[trackIndex*kNPlanes], trackParams); + AliTRDtrackV1 *track = AliTRDtrackerV1::MakeTrack(&sseed[trackIndex*kNPlanes], trackParams); if(!track){ AliWarning("Fail to build a TRD Track."); continue; } + AliInfo("End of MakeTrack()"); AliESDtrack esdTrack; esdTrack.UpdateTrackParams(track, AliESDtrack::kTRDout); esdTrack.SetLabel(track->GetLabel()); @@ -526,7 +1248,7 @@ Int_t AliTRDtrackerV1::Clusters2TracksStack(AliTRDstackLayer *layer quality = BuildSeedingConfigs(layer, configs); //if(quality < fRecoParam->GetPlaneQualityThreshold()) break; - for(Int_t il = 0; il < kNPlanes * nTimeBins; il++) layer[il].BuildIndices(fSieveSeeding); + for(Int_t il = 0; il < kNPlanes * fTimeBinsPerPlane; il++) layer[il].BuildIndices(fSieveSeeding); #ifdef DEBUG if(AliTRDReconstructor::StreamLevel() > 1) AliInfo(Form("Sieve level %d Plane config %d %d %d Quality %f", fSieveSeeding, configs[0], configs[1], configs[2], quality)); @@ -568,12 +1290,9 @@ Double_t AliTRDtrackerV1::BuildSeedingConfigs(AliTRDstackLayer *layers // The overall chamber quality is given by the product of this 2 contributions. // - AliTRDcalibDB *cal = AliTRDcalibDB::Instance(); - Int_t nTimeBins = cal->GetNumberOfTimeBins(); - Double_t chamberQA[kNPlanes]; for(int iplane=0; iplaneGetNumberOfTimeBins(); AliTRDcluster *c[4] = {0x0, 0x0, 0x0, 0x0}; // initilize seeding clusters AliTRDseedV1 *cseed = &sseed[0]; // initialize tracklets for first track Int_t ncl, mcl; // working variable for looping over clusters @@ -668,19 +1385,23 @@ Int_t AliTRDtrackerV1::MakeSeeds(AliTRDstackLayer *layers #endif // Init chambers geometry + Int_t det, tbRange[6]; // time bins inside the detector geometry Double_t hL[kNPlanes]; // Tilting angle Float_t padlength[kNPlanes]; // pad lenghts AliTRDpadPlane *pp; for(int il=0; ilGetPadPlane(il, istack); // istack has to be imported hL[il] = TMath::Tan(-TMath::DegToRad()*pp->GetTiltingAngle()); - padlength[il] = 10.; //pp->GetLengthIPad(); + padlength[il] = pp->GetLengthIPad(); + det = il; // to be fixed !!!!! + tbRange[il] = fTimeBinsPerPlane; //Int_t(AliTRDgeometry::CamHght()+AliTRDgeometry::CdrHght() * AliTRDCommonParam::Instance()->GetSamplingFrequency()/AliTRDcalibDB::Instance()->GetVdriftDet()->GetValue(det)); + //printf("%d hl[%f] pl[%f] tb[%d]\n", il, hL[il], padlength[il], tbRange[il]); } Double_t cond0[4], cond1[4], cond2[4]; // make seeding layers (to be moved in Clusters2TracksStack) AliTRDstackLayer *layer[] = {0x0, 0x0, 0x0, 0x0}; - for(int isl=0; islSetRecoParam(fRecoParam); - tseed->SetLayer(planes[iLayer]); - tseed->SetTilt(hL[planes[iLayer]]); - tseed->SetPadLength(TMath::Sqrt(c[iLayer]->GetSigmaZ2()*12)); - tseed->SetX0(layer[iLayer]->GetX()); - - tseed->Update(fFitter->GetRiemanFitter()); + tseed->SetPlane(jLayer); + tseed->SetTilt(hL[jLayer]); + tseed->SetPadLength(padlength[jLayer]); + tseed->SetNTimeBinsRange(tbRange[jLayer]); + tseed->SetX0(layer[iLayer]->GetX());//layers[jLayer*fTimeBinsPerPlane].GetX()); + + tseed->Init(fFitter->GetRiemanFitter()); + // temporary until new AttachClusters() + tseed->SetX0(layers[(jLayer+1)*fTimeBinsPerPlane-1].GetX()); chi2[0] += tseed->GetChi2Z(c[iLayer]->GetZ()); chi2[1] += tseed->GetChi2Y(c[iLayer]->GetY()); } @@ -744,7 +1469,7 @@ Int_t AliTRDtrackerV1::MakeSeeds(AliTRDstackLayer *layers } Float_t threshold = .5;//1./(3. - sLayer); Int_t ll = c[3]->GetLabel(0); - TTreeSRedirector &cs0 = *fDebugStreamerV1; + TTreeSRedirector &cs0 = *fDebugStreamer; cs0 << "MakeSeeds0" <<"isFake=" << isFake <<"label=" << ll @@ -783,7 +1508,7 @@ Int_t AliTRDtrackerV1::MakeSeeds(AliTRDstackLayer *layers } Double_t xpos[4]; for(Int_t l = 0; l < kNSeedPlanes; l++) xpos[l] = layer[l]->GetX(); - TTreeSRedirector &cstreamer = *fDebugStreamerV1; + TTreeSRedirector &cstreamer = *fDebugStreamer; cstreamer << "MakeSeeds1" << "isFake=" << isFake << "config=" << config @@ -812,10 +1537,9 @@ Int_t AliTRDtrackerV1::MakeSeeds(AliTRDstackLayer *layers Int_t nUsedCl = 0; Int_t nlayers = 0; for(int iLayer=0; iLayer 25) break; nlayers++; } @@ -828,7 +1552,7 @@ Int_t AliTRDtrackerV1::MakeSeeds(AliTRDstackLayer *layers fFitter->FitRieman(&cseed[0], &planes[0]); AliRieman *rim = fFitter->GetRiemanFitter(); for(int iLayer=0; iLayer<4; iLayer++){ - cseed[planes[iLayer]].Update(rim); + cseed[planes[iLayer]].Init(rim); chi2[0] += (Float_t)cseed[planes[iLayer]].GetChi2Z(); chi2[1] += cseed[planes[iLayer]].GetChi2Y(); } @@ -855,24 +1579,21 @@ Int_t AliTRDtrackerV1::MakeSeeds(AliTRDstackLayer *layers // prepare extrapolated seed cseed[jLayer].Reset(); cseed[jLayer].SetRecoParam(fRecoParam); - cseed[jLayer].SetLayer(jLayer); + cseed[jLayer].SetPlane(jLayer); cseed[jLayer].SetTilt(hL[jLayer]); - cseed[jLayer].SetX0(layers[jLayer * nTimeBins + (nTimeBins/2)].GetX()); // ???????? - //cseed[jLayer].SetPadLength(??????????); - cseed[jLayer].Update(rim); - - AliTRDcluster *cd = FindSeedingCluster(&layers[jLayer*nTimeBins], &cseed[jLayer]); - if(cd == 0x0) continue; -// if(!cd) continue; - cseed[jLayer].SetPadLength(TMath::Sqrt(cd->GetSigmaZ2() * 12.)); - cseed[jLayer].SetX0(cd->GetX()); // reference defined by a seedingLayer which is defined by the x-coordinate of the layers inside + cseed[jLayer].SetX0(layers[(jLayer +1) * fTimeBinsPerPlane-1].GetX()); + cseed[jLayer].SetPadLength(padlength[jLayer]); + cseed[jLayer].SetNTimeBinsRange(tbRange[jLayer]); + cseed[jLayer].Init(rim); +// AliTRDcluster *cd = FindSeedingCluster(&layers[jLayer*fTimeBinsPerPlane], &cseed[jLayer]); +// if(cd == 0x0) continue; // fit extrapolated seed AliTRDseedV1::FitRiemanTilt(cseed, kTRUE); if ((jLayer == 0) && !(cseed[1].IsOK())) continue; if ((jLayer == 5) && !(cseed[4].IsOK())) continue; AliTRDseedV1 tseed = cseed[jLayer]; - if(!tseed.AttachClustersIter(&layers[jLayer*nTimeBins], 1000.)) continue; + if(!tseed.AttachClustersIter(&layers[jLayer*fTimeBinsPerPlane], 1000.)) continue; cseed[jLayer] = tseed; nusedf += cseed[jLayer].GetNUsed(); // debug value AliTRDseedV1::FitRiemanTilt(cseed, kTRUE); @@ -900,7 +1621,7 @@ Int_t AliTRDtrackerV1::MakeSeeds(AliTRDstackLayer *layers fFitter->FitRieman(&cseed[0]); Double_t chi2ZF = 0., chi2RF = 0.; for(int ilayer=0; ilayer<6; ilayer++){ - cseed[ilayer].Update(fFitter->GetRiemanFitter()); + cseed[ilayer].Init(fFitter->GetRiemanFitter()); if (!cseed[ilayer].IsOK()) continue; //tchi2 = cseed[ilayer].GetChi2Z(); //printf("layer %d chi2 %e\n", ilayer, tchi2); @@ -913,7 +1634,7 @@ Int_t AliTRDtrackerV1::MakeSeeds(AliTRDstackLayer *layers // do the final track fitting fFitter->SetLayers(nlayers); #ifdef DEBUG - fFitter->SetDebugStream(fDebugStreamerV1); + fFitter->SetDebugStream(fDebugStreamer); #endif fTrackQuality[ntracks] = fFitter->FitHyperplane(&cseed[0], chi2ZF, GetZ()); Double_t param[3]; @@ -953,7 +1674,7 @@ Int_t AliTRDtrackerV1::MakeSeeds(AliTRDstackLayer *layers #ifdef DEBUG if(AliTRDReconstructor::StreamLevel() >= 2){ Double_t curv = (fFitter->GetRiemanFitter())->GetC(); - TTreeSRedirector &cstreamer = *fDebugStreamerV1; + TTreeSRedirector &cstreamer = *fDebugStreamer; cstreamer << "MakeSeeds2" << "C=" << curv << "Chi2R=" << chi2r @@ -995,7 +1716,7 @@ Int_t AliTRDtrackerV1::MakeSeeds(AliTRDstackLayer *layers } //_____________________________________________________________________________ -AliTRDtrack *AliTRDtrackerV1::RegisterSeed(AliTRDseedV1 *seeds, Double_t *params) +AliTRDtrackV1* AliTRDtrackerV1::MakeTrack(AliTRDseedV1 *seeds, Double_t *params) { // // Build a TRD track out of tracklet candidates @@ -1012,9 +1733,6 @@ AliTRDtrack *AliTRDtrackerV1::RegisterSeed(AliTRDseedV1 *seeds, Double_t *params // To be discussed with Marian !! // - AliTRDcalibDB *cal = AliTRDcalibDB::Instance(); - Int_t nTimeBins = cal->GetNumberOfTimeBins(); - Double_t alpha = AliTRDgeometry::GetAlpha(); Double_t shift = AliTRDgeometry::GetAlpha()/2.0; Double_t c[15]; @@ -1025,47 +1743,29 @@ AliTRDtrack *AliTRDtrackerV1::RegisterSeed(AliTRDseedV1 *seeds, Double_t *params c[ 6] = 0.0; c[ 7] = 0.0; c[ 8] = 0.0; c[ 9] = 0.1; c[10] = 0.0; c[11] = 0.0; c[12] = 0.0; c[13] = 0.0; c[14] = params[5]*params[5]*0.01; - Int_t index = 0; - AliTRDcluster *cl = 0; - - for (Int_t ilayer = 0; ilayer < 6; ilayer++) { - if (seeds[ilayer].IsOK()) { - for (Int_t itime = nTimeBins - 1; itime > 0; itime--) { - if (seeds[ilayer].GetIndexes(itime) > 0) { - index = seeds[ilayer].GetIndexes(itime); - cl = seeds[ilayer].GetClusters(itime); - break; - } - } - } - if (index > 0) { - break; - } - } - if (cl == 0) return 0; - AliTRDtrack *track = new AliTRDtrack(cl - ,index - ,¶ms[1] - ,c - ,params[0] - ,params[6]*alpha+shift); - // SetCluster(cl, 0); // A. Bercuci + AliTRDtrackV1 *track = new AliTRDtrackV1(seeds, ¶ms[1], c, params[0], params[6]*alpha+shift); track->PropagateTo(params[0]-5.0); track->ResetCovariance(1); - Int_t rc = FollowBackProlongation(*track); - if (rc < 30) { + Int_t nc = FollowBackProlongation(*track); + AliInfo(Form("N clusters for track %d", nc)); + if (nc < 30) { delete track; - track = 0; - } - else { - track->CookdEdx(); - track->CookdEdxTimBin(-1); - CookLabel(track,0.9); + track = 0x0; + } else { +// track->CookdEdx(); +// track->CookdEdxTimBin(-1); +// CookLabel(track, 0.9); } return track; } +//____________________________________________________________________ +void AliTRDtrackerV1::CookLabel(AliKalmanTrack */*pt*/, Float_t /*wrong*/) const +{ + // to be implemented, preferably at the level of TRD tracklet. !!!!!!! +} + //____________________________________________________________________ void AliTRDtrackerV1::ImproveSeedQuality(AliTRDstackLayer *layers , AliTRDseedV1 *cseed) @@ -1127,7 +1827,7 @@ void AliTRDtrackerV1::ImproveSeedQuality(AliTRDstackLayer *layers } //____________________________________________________________________ -Double_t AliTRDtrackerV1::CookPlaneQA(AliTRDstackLayer *layers) +Double_t AliTRDtrackerV1::MakeSeedingPlanes(AliTRDstackLayer *layers) { // // Calculate plane quality for seeding. @@ -1181,7 +1881,7 @@ Double_t AliTRDtrackerV1::CookPlaneQA(AliTRDstackLayer *layers) // fitter.PrintResults(3); // Double_t a = fitter.GetParameter(1); // -// printf("nclDev(%f) a(%f)\n", nclDev, a); +// printf("ncl_dev(%f) a(%f)\n", ncl_dev, a); // return quality*TMath::Exp(-a); } @@ -1239,7 +1939,7 @@ Double_t AliTRDtrackerV1::CookLikelihood(AliTRDseedV1 *cseed #ifdef DEBUG //AliInfo(Form("sumda(%f) chi2[0](%f) chi2[1](%f) likea(%f) likechi2y(%f) likechi2z(%f) nclusters(%d) likeN(%f)", sumda, chi2[0], chi2[1], likea, likechi2y, likechi2z, nclusters, likeN)); if(AliTRDReconstructor::StreamLevel() >= 2){ - TTreeSRedirector &cstreamer = *fDebugStreamerV1; + TTreeSRedirector &cstreamer = *fDebugStreamer; cstreamer << "CookLikelihood" << "sumda=" << sumda << "chi0=" << chi2[0] @@ -1623,11 +2323,11 @@ AliTRDstackLayer *AliTRDtrackerV1::MakeSeedingLayer(AliTRDstackLayer *layers #ifdef DEBUG if(AliTRDReconstructor::StreamLevel() >= 3){ - TMatrixT hist(nRows, nCols); + TMatrixD hist(nRows, nCols); for(Int_t i = 0; i < nRows; i++) for(Int_t j = 0; j < nCols; j++) hist(i,j) = histogram[i][j]; - TTreeSRedirector &cstreamer = *fDebugStreamerV1; + TTreeSRedirector &cstreamer = *fDebugStreamer; cstreamer << "MakeSeedingLayer" << "Iteration=" << fSieveSeeding << "plane=" << plane @@ -1644,8 +2344,7 @@ AliTRDstackLayer *AliTRDtrackerV1::MakeSeedingLayer(AliTRDstackLayer *layers } //____________________________________________________________________ -void AliTRDtrackerV1::GetSeedingConfig(Int_t iconfig - , Int_t planes[4]) const +void AliTRDtrackerV1::GetSeedingConfig(Int_t iconfig, Int_t planes[4]) { // // Map seeding configurations to detector planes. @@ -1786,8 +2485,7 @@ void AliTRDtrackerV1::GetSeedingConfig(Int_t iconfig } //____________________________________________________________________ -void AliTRDtrackerV1::GetExtrapolationConfig(Int_t iconfig - , Int_t planes[2]) const +void AliTRDtrackerV1::GetExtrapolationConfig(Int_t iconfig, Int_t planes[2]) { // // Returns the extrapolation planes for a seeding configuration. diff --git a/TRD/AliTRDtrackerV1.h b/TRD/AliTRDtrackerV1.h index 9c69df97d8e..e28b9ea5311 100644 --- a/TRD/AliTRDtrackerV1.h +++ b/TRD/AliTRDtrackerV1.h @@ -36,7 +36,8 @@ class AliTRDseedV1; class AliTRDstackLayer; class AliTRDtrackerFitter; class AliTRDrecoParam; - +class AliTRDtrackV1; +class AliTrackPoint; class AliTRDtrackerV1 : public AliTRDtracker { @@ -50,42 +51,50 @@ class AliTRDtrackerV1 : public AliTRDtracker }; AliTRDtrackerV1(AliTRDrecoParam *p = 0x0); AliTRDtrackerV1(const TFile *in, AliTRDrecoParam *p); - ~AliTRDtrackerV1(); + virtual ~AliTRDtrackerV1(); Int_t Clusters2Tracks(AliESDEvent *esd); - void GetSeedingConfig(Int_t iconfig, Int_t planes[4]) const; - void GetExtrapolationConfig(Int_t iconfig, Int_t planes[2]) const; + static void GetExtrapolationConfig(Int_t iconfig, Int_t planes[2]); + static void GetSeedingConfig(Int_t iconfig, Int_t planes[4]); + Int_t FollowBackProlongation(AliTRDtrackV1 &t); + Int_t FollowProlongation(AliTRDtrackV1 &t); + Int_t PropagateBack(AliESDEvent *event); + Int_t RefitInward(AliESDEvent *event); void SetRecoParam(AliTRDrecoParam *p){fRecoParam = p;} - - protected: + void UnloadClusters(); + protected: Double_t BuildSeedingConfigs(AliTRDstackLayer *layer, Int_t *configs); - Int_t Clusters2TracksSM(AliTRDtracker::AliTRDtrackingSector *sector, AliESDEvent *esd); + Int_t Clusters2TracksSM( AliTRDtracker::AliTRDtrackingSector *sector, AliESDEvent *esd); Int_t Clusters2TracksStack(AliTRDstackLayer *layer, TClonesArray *esdTrackList); - Double_t CookPlaneQA(AliTRDstackLayer *layer); - Double_t CookLikelihood(AliTRDseedV1 *cseed, Int_t planes[4], Double_t *chi2); + void CookLabel(AliKalmanTrack *pt, Float_t wrong) const; Int_t GetSeedingLayers(AliTRDstackLayer *layers, Double_t *params); void GetMeanCLStack(AliTRDstackLayer *layers, Int_t *planes, Double_t *params); + AliTRDseedV1* GetTracklet(AliTRDtrackV1 *trk, Int_t plane, Int_t &idx); + virtual Bool_t GetTrackPoint(Int_t index, AliTrackPoint &p) const; AliTRDcluster *FindSeedingCluster(AliTRDstackLayer *layers, AliTRDseedV1/*AliRieman*/ *sfit); - void ImproveSeedQuality(AliTRDstackLayer *layer, AliTRDseedV1 *cseed); - Int_t MakeSeeds(AliTRDstackLayer *layers, AliTRDseedV1 *sseed, Int_t *ipar); + + Double_t MakeSeedingPlanes(AliTRDstackLayer *layer); AliTRDstackLayer *MakeSeedingLayer(AliTRDstackLayer *layers, Int_t Plane); - AliTRDtrack* RegisterSeed(AliTRDseedV1 *seeds, Double_t *params); - - private: + Int_t MakeSeeds(AliTRDstackLayer *layers, AliTRDseedV1 *sseed, Int_t *ipar); + AliTRDtrackV1* MakeTrack(AliTRDseedV1 *seeds, Double_t *params); + Int_t SetTracklet(AliTRDseedV1 *tracklet); +private: AliTRDtrackerV1(const AliTRDtrackerV1 &tracker); AliTRDtrackerV1 &operator=(const AliTRDtrackerV1 &tracker); + Double_t CookLikelihood(AliTRDseedV1 *cseed, Int_t planes[4], Double_t *chi2); + void ImproveSeedQuality(AliTRDstackLayer *layer, AliTRDseedV1 *cseed); - private: +private: - static Double_t fgTopologicQA[kNConfigs]; // Topologic quality + static Double_t fgTopologicQA[kNConfigs]; // Topologic quality Double_t fTrackQuality[kMaxTracksStack]; // Track quality Int_t fSeedLayer[kMaxTracksStack]; // Seed layer Int_t fSieveSeeding; //! Seeding iterator + TClonesArray *fTracklets; // List of tracklets for all sectors AliTRDrecoParam *fRecoParam; // Reconstruction parameters AliTRDtrackerFitter *fFitter; //! Fitter class of the tracker - TTreeSRedirector *fDebugStreamerV1; //! Debug stream of the tracker ClassDef(AliTRDtrackerV1, 1) // Stand alone tracker development class diff --git a/TRD/TRDrecLinkDef.h b/TRD/TRDrecLinkDef.h index 29dab8abab6..3684fbb426d 100644 --- a/TRD/TRDrecLinkDef.h +++ b/TRD/TRDrecLinkDef.h @@ -33,9 +33,9 @@ #pragma link C++ class AliTRDrecoParam+; #pragma link C++ class AliTRDseedV1+; #pragma link C++ class AliTRDtrackerV1+; +#pragma link C++ class AliTRDtrackV1+; #pragma link C++ class AliTRDstackLayer+; #pragma link C++ class AliTRDtrackerFitter+; -#pragma link C++ class AliTRDQADataMakerRec+; #endif diff --git a/TRD/libTRDrec.pkg b/TRD/libTRDrec.pkg index 5830ad77f9e..9a308c0dcce 100644 --- a/TRD/libTRDrec.pkg +++ b/TRD/libTRDrec.pkg @@ -14,10 +14,10 @@ SRCS= AliTRDcluster.cxx \ AliTRDrecoParam.cxx \ AliTRDseedV1.cxx \ AliTRDtrackerV1.cxx \ + AliTRDtrackV1.cxx \ AliTRDpropagationLayer.cxx \ AliTRDstackLayer.cxx \ - AliTRDtrackerFitter.cxx \ - AliTRDQADataMakerRec.cxx + AliTRDtrackerFitter.cxx HDRS= $(SRCS:.cxx=.h)