X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TPC%2FAliTPCtrackerMI.cxx;h=886c129fb77361903e4288da8ef78e31ec39f396;hb=1598ba75da57f9073125da7745b7349d6d7ed19e;hp=774149b8bbcb139ec88bac39bd76ff88940e7cbc;hpb=bc4bc05389b3761e25eb077ab3fe0237ffbf98b5;p=u%2Fmrichter%2FAliRoot.git diff --git a/TPC/AliTPCtrackerMI.cxx b/TPC/AliTPCtrackerMI.cxx index 774149b8bbc..886c129fb77 100644 --- a/TPC/AliTPCtrackerMI.cxx +++ b/TPC/AliTPCtrackerMI.cxx @@ -113,6 +113,7 @@ #include #include #include +#include #include "AliLog.h" #include "AliComplexCluster.h" #include "AliESDEvent.h" @@ -137,8 +138,10 @@ #include "AliTrackPointArray.h" #include "TRandom.h" #include "AliTPCcalibDB.h" +#include "AliTPCcalibDButil.h" #include "AliTPCTransform.h" #include "AliTPCClusterParam.h" +#include "AliTPCdEdxInfo.h" // @@ -197,11 +200,18 @@ AliTPCtrackerMI::AliTPCtrackerMI() fSeeds(0), fIteration(0), fkParam(0), - fDebugStreamer(0) + fDebugStreamer(0), + fUseHLTClusters(4) { // // default constructor // + for (Int_t irow=0; irow<200; irow++){ + fXRow[irow]=0; + fYMax[irow]=0; + fPadLength[irow]=0; + } + } //_____________________________________________________________________ @@ -213,8 +223,10 @@ Int_t AliTPCtrackerMI::UpdateTrack(AliTPCseed * track, Int_t accept){ AliTPCclusterMI* c =track->GetCurrentCluster(); - if (accept>0) track->SetCurrentClusterIndex1(track->GetCurrentClusterIndex1() | 0x8000); //sign not accepted clusters - + if (accept > 0) //sign not accepted clusters + track->SetCurrentClusterIndex1(track->GetCurrentClusterIndex1() | 0x8000); + else // unsign accpeted clusters + track->SetCurrentClusterIndex1(track->GetCurrentClusterIndex1() & 0xffff7fff); UInt_t i = track->GetCurrentClusterIndex1(); Int_t sec=(i&0xff000000)>>24; @@ -297,7 +309,7 @@ Int_t AliTPCtrackerMI::AcceptCluster(AliTPCseed * seed, AliTPCclusterMI * cluste Double_t sdistancey2 = sy2+seed->GetSigmaY2(); Double_t sdistancez2 = sz2+seed->GetSigmaZ2(); Double_t dy=seed->GetCurrentCluster()->GetY()-yt; - Double_t dz=seed->GetCurrentCluster()->GetY()-zt; + Double_t dz=seed->GetCurrentCluster()->GetZ()-zt; Double_t rdistancey2 = (seed->GetCurrentCluster()->GetY()-yt)* (seed->GetCurrentCluster()->GetY()-yt)/sdistancey2; Double_t rdistancez2 = (seed->GetCurrentCluster()->GetZ()-zt)* @@ -339,6 +351,10 @@ Int_t AliTPCtrackerMI::AcceptCluster(AliTPCseed * seed, AliTPCclusterMI * cluste "rmsz2p30="<SetNFoundable(seed->GetNFoundable()-1); return 2; } + + if (fUseHLTClusters == 3 || fUseHLTClusters == 4) { + if(!AliTPCReconstructor::GetRecoParam()->GetUseHLTOnePadCluster()) { + if (TMath::Abs(cluster->GetSigmaY2()) < kAlmost0) + return 2; + } + } + return 0; } @@ -385,7 +409,9 @@ AliTracker(), fSeeds(0), fIteration(0), fkParam(0), - fDebugStreamer(0) + fDebugStreamer(0), + fUseHLTClusters(4) + { //--------------------------------------------------------------------- // The main TPC tracker constructor @@ -439,12 +465,19 @@ AliTPCtrackerMI::AliTPCtrackerMI(const AliTPCtrackerMI &t): fSeeds(0), fIteration(0), fkParam(0), - fDebugStreamer(0) + fDebugStreamer(0), + fUseHLTClusters(4) { //------------------------------------ // dummy copy constructor //------------------------------------------------------------------ fOutput=t.fOutput; + for (Int_t irow=0; irow<200; irow++){ + fXRow[irow]=0; + fYMax[irow]=0; + fPadLength[irow]=0; + } + } AliTPCtrackerMI & AliTPCtrackerMI::operator=(const AliTPCtrackerMI& /*r*/) { @@ -473,7 +506,8 @@ void AliTPCtrackerMI::FillESD(const TObjArray* arr) // // //fill esds using updated tracks - if (fEvent){ + if (!fEvent) return; + // write tracks to the event // store index of the track Int_t nseed=arr->GetEntriesFast(); @@ -604,9 +638,9 @@ void AliTPCtrackerMI::FillESD(const TObjArray* arr) kink->SetIndex(it, knkId<0 ? 0:1); // update track index of the kink: mother at 0, daughter at 1 } } - // << account for suppressed tracks in the kink indices (RS) - } - printf("Number of filled ESDs-\t%d\n",fEvent->GetNumberOfTracks()); + // << account for suppressed tracks in the kink indices (RS) + AliInfo(Form("Number of filled ESDs-\t%d\n",fEvent->GetNumberOfTracks())); + } @@ -980,7 +1014,7 @@ Double_t AliTPCtrackerMI::F1(Double_t x1,Double_t y1, y2 -=y1; // Double_t det = x3*y2-x2*y3; - if (TMath::Abs(det)<1e-16){ + if (TMath::Abs(det)<1e-10){ return 100; } // @@ -1006,7 +1040,7 @@ Double_t AliTPCtrackerMI::F2(Double_t x1,Double_t y1, y2 -=y1; // Double_t det = x3*y2-x2*y3; - if (TMath::Abs(det)<1e-16) { + if (TMath::Abs(det)<1e-10) { return 100; } // @@ -1112,7 +1146,7 @@ Bool_t AliTPCtrackerMI::GetProlongation(Double_t x1, Double_t x2, Double_t x[5 Int_t AliTPCtrackerMI::LoadClusters (TTree *const tree) { - // + // load clusters // fInput = tree; return LoadClusters(); @@ -1123,7 +1157,7 @@ Int_t AliTPCtrackerMI::LoadClusters(const TObjArray *arr) { // // load clusters to the memory - AliTPCClustersRow *clrow = 0x0; + AliTPCClustersRow *clrow = new AliTPCClustersRow("AliTPCclusterMI"); Int_t lower = arr->LowerBound(); Int_t entries = arr->GetEntriesFast(); @@ -1163,6 +1197,7 @@ Int_t AliTPCtrackerMI::LoadClusters(const TObjArray *arr) for (Int_t j=0;jGetN2();++j) tpcrow->SetCluster2(j,*(AliTPCclusterMI*)(clrow->GetArray()->At(j))); } + clrow->GetArray()->Clear("C"); } // delete clrow; @@ -1233,17 +1268,17 @@ Int_t AliTPCtrackerMI::LoadClusters() { // // load clusters to the memory - AliTPCClustersRow *clrow= new AliTPCClustersRow; - clrow->SetClass("AliTPCclusterMI"); - clrow->SetArray(0); - clrow->GetArray()->ExpandCreateFast(10000); + AliTPCClustersRow *clrow= new AliTPCClustersRow("AliTPCclusterMI"); // // TTree * tree = fClustersArray.GetTree(); TTree * tree = fInput; TBranch * br = tree->GetBranch("Segment"); br->SetAddress(&clrow); - // + + // Conversion of pad, row coordinates in local tracking coords. + // Could be skipped here; is already done in clusterfinder + Int_t j=Int_t(tree->GetEntries()); for (Int_t i=0; iGetEntry(i); @@ -1343,11 +1378,13 @@ void AliTPCtrackerMI::FillClusterArray(TObjArray* array) const{ void AliTPCtrackerMI::Transform(AliTPCclusterMI * cluster){ // + // transformation // - // - AliTPCTransform *transform = AliTPCcalibDB::Instance()->GetTransform() ; + AliTPCcalibDB * calibDB = AliTPCcalibDB::Instance(); + AliTPCTransform *transform = calibDB->GetTransform() ; if (!transform) { AliFatal("Tranformations not in calibDB"); + return; } transform->SetCurrentRecoParam((AliTPCRecoParam*)AliTPCReconstructor::GetRecoParam()); Double_t x[3]={cluster->GetRow(),cluster->GetPad(),cluster->GetTimeBin()}; @@ -1380,22 +1417,23 @@ void AliTPCtrackerMI::Transform(AliTPCclusterMI * cluster){ cluster->SetY(x[1]); cluster->SetZ(x[2]); // The old stuff: - // // // //if (!fkParam->IsGeoRead()) fkParam->ReadGeoMatrices(); - TGeoHMatrix *mat = fkParam->GetClusterMatrix(cluster->GetDetector()); - //TGeoHMatrix mat; - Double_t pos[3]= {cluster->GetX(),cluster->GetY(),cluster->GetZ()}; - Double_t posC[3]={cluster->GetX(),cluster->GetY(),cluster->GetZ()}; - if (mat) mat->LocalToMaster(pos,posC); - else{ - // chack Loading of Geo matrices from GeoManager - TEMPORARY FIX - } - cluster->SetX(posC[0]); - cluster->SetY(posC[1]); - cluster->SetZ(posC[2]); + if (AliTPCReconstructor::GetRecoParam()->GetUseSectorAlignment() && (!calibDB->HasAlignmentOCDB())){ + TGeoHMatrix *mat = fkParam->GetClusterMatrix(cluster->GetDetector()); + //TGeoHMatrix mat; + Double_t pos[3]= {cluster->GetX(),cluster->GetY(),cluster->GetZ()}; + Double_t posC[3]={cluster->GetX(),cluster->GetY(),cluster->GetZ()}; + if (mat) mat->LocalToMaster(pos,posC); + else{ + // chack Loading of Geo matrices from GeoManager - TEMPORARY FIX + } + cluster->SetX(posC[0]); + cluster->SetY(posC[1]); + cluster->SetZ(posC[2]); + } } //_____________________________________________________________________________ @@ -1571,7 +1609,7 @@ Int_t AliTPCtrackerMI::FollowToNext(AliTPCseed& t, Int_t nr) { if (fIteration>0 && tpcindex>=-1){ //if we have already clusters // if (tpcindex==-1) return 0; //track in dead zone - if (tpcindex>0){ // + if (tpcindex >= 0){ // cl = t.GetClusterPointer(nr); if ( (cl==0) ) cl = GetClusterMI(tpcindex); t.SetCurrentClusterIndex1(tpcindex); @@ -1605,7 +1643,11 @@ Int_t AliTPCtrackerMI::FollowToNext(AliTPCseed& t, Int_t nr) { t.SetNFoundable(t.GetNFoundable()+1); UpdateTrack(&t,accept); return 1; - } + } + else { // Remove old cluster from track + t.SetClusterIndex(nr, -3); + t.SetClusterPointer(nr, 0); + } } } if (TMath::Abs(t.GetSnp())>AliTPCReconstructor::GetMaxSnpTracker()) return 0; // cut on angle @@ -1617,7 +1659,11 @@ Int_t AliTPCtrackerMI::FollowToNext(AliTPCseed& t, Int_t nr) { // UInt_t index=0; // if (TMath::Abs(t.GetSnp())>0.95 || TMath::Abs(x*t.GetC()-t.GetEta())>0.95) return 0;// patch 28 fev 06 - Double_t y=t.GetYat(x); + if (!t.PropagateTo(x)) { + if (fIteration==0) t.SetRemoval(10); + return 0; + } + Double_t y = t.GetY(); if (TMath::Abs(y)>ymax){ if (y > ymax) { t.SetRelativeSector((t.GetRelativeSector()+1) % fN); @@ -1628,14 +1674,13 @@ Int_t AliTPCtrackerMI::FollowToNext(AliTPCseed& t, Int_t nr) { if (!t.Rotate(-fSectors->GetAlpha())) return 0; } - //return 1; + if (!t.PropagateTo(x)) { + if (fIteration==0) t.SetRemoval(10); + return 0; + } + y = t.GetY(); } // - if (!t.PropagateTo(x)) { - if (fIteration==0) t.SetRemoval(10); - return 0; - } - y=t.GetY(); Double_t z=t.GetZ(); // @@ -1760,7 +1805,7 @@ Int_t AliTPCtrackerMI::UpdateClusters(AliTPCseed& t, Int_t nr) { // This function tries to find a track prolongation to next pad row //----------------------------------------------------------------- t.SetCurrentCluster(0); - t.SetCurrentClusterIndex1(0); + t.SetCurrentClusterIndex1(-3); Double_t xt=t.GetX(); Int_t row = GetRowNumber(xt)-1; @@ -1845,9 +1890,9 @@ Int_t AliTPCtrackerMI::UpdateClusters(AliTPCseed& t, Int_t nr) { if (!cl){ index = t.GetClusterIndex2(nr); - if ( (index>0) && (index&0x8000)==0){ + if ( (index >= 0) && (index&0x8000)==0){ cl = t.GetClusterPointer(nr); - if ( (cl==0) && (index>0)) cl = GetClusterMI(index); + if ( (cl==0) && (index >= 0)) cl = GetClusterMI(index); t.SetCurrentClusterIndex1(index); if (cl) { t.SetCurrentCluster(cl); @@ -1898,8 +1943,8 @@ Int_t AliTPCtrackerMI::FollowToNextCluster(AliTPCseed & t, Int_t nr) { } else { if (fIteration==0){ - if ( ( (t.GetSigmaY2()+t.GetSigmaZ2())>0.16)&& t.GetNumberOfClusters()>18) t.SetRemoval(10); - if ( t.GetChi2()/t.GetNumberOfClusters()>6 &&t.GetNumberOfClusters()>18) t.SetRemoval(10); + if ( t.GetNumberOfClusters()>18 && ( (t.GetSigmaY2()+t.GetSigmaZ2())>0.16)) t.SetRemoval(10); + if ( t.GetNumberOfClusters()>18 && t.GetChi2()/t.GetNumberOfClusters()>6 ) t.SetRemoval(10); if (( (t.GetNFoundable()*0.5 > t.GetNumberOfClusters()) || t.GetNoCluster()>15)) t.SetRemoval(10); } @@ -1910,19 +1955,23 @@ Int_t AliTPCtrackerMI::FollowToNextCluster(AliTPCseed & t, Int_t nr) { //_____________________________________________________________________________ -Int_t AliTPCtrackerMI::FollowProlongation(AliTPCseed& t, Int_t rf, Int_t step) { +Int_t AliTPCtrackerMI::FollowProlongation(AliTPCseed& t, Int_t rf, Int_t step, Bool_t fromSeeds) { //----------------------------------------------------------------- // This function tries to find a track prolongation. //----------------------------------------------------------------- Double_t xt=t.GetX(); // - Double_t alpha=t.GetAlpha() - fSectors->GetAlphaShift(); + Double_t alpha=t.GetAlpha(); if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi(); if (alpha < 0. ) alpha += 2.*TMath::Pi(); // t.SetRelativeSector(Int_t(alpha/fSectors->GetAlpha()+0.0001)%fN); - Int_t first = GetRowNumber(xt)-1; + Int_t first = GetRowNumber(xt); + if (!fromSeeds) + first -= step; + if (first < 0) + first = 0; for (Int_t nr= first; nr>=rf; nr-=step) { // update kink info if (t.GetKinkIndexes()[0]>0){ @@ -1965,19 +2014,23 @@ Int_t AliTPCtrackerMI::FollowProlongation(AliTPCseed& t, Int_t rf, Int_t step) { -Int_t AliTPCtrackerMI::FollowBackProlongation(AliTPCseed& t, Int_t rf) { +Int_t AliTPCtrackerMI::FollowBackProlongation(AliTPCseed& t, Int_t rf, Bool_t fromSeeds) { //----------------------------------------------------------------- // This function tries to find a track prolongation. //----------------------------------------------------------------- // Double_t xt=t.GetX(); - Double_t alpha=t.GetAlpha() - fSectors->GetAlphaShift(); + Double_t alpha=t.GetAlpha(); if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi(); if (alpha < 0. ) alpha += 2.*TMath::Pi(); t.SetRelativeSector(Int_t(alpha/fSectors->GetAlpha()+0.0001)%fN); Int_t first = t.GetFirstPoint(); - if (firstGetSigmaTglZ()+ s2->GetSigmaTglZ()); if (TMath::Abs(s1->GetTgl()-s2->GetTgl())>thetaCut) return; @@ -2084,11 +2137,7 @@ void AliTPCtrackerMI::SignShared(AliTPCseed * s1, AliTPCseed * s2) // if ( (s1->GetClusterIndex2(i)&0xFFFF8FFF)==(s2->GetClusterIndex2(i)&0xFFFF8FFF) && s1->GetClusterIndex2(i)>0) { if ( (s1->GetClusterIndex2(i))==(s2->GetClusterIndex2(i)) && s1->GetClusterIndex2(i)>0) { sumshared++; - s1->SetSharedMapBit(i, kTRUE); - s2->SetSharedMapBit(i, kTRUE); } - if (s1->GetClusterIndex2(i)>0) - s1->SetClusterMapBit(i, kTRUE); } if (sumshared>cutN0){ // sign clusters @@ -2146,7 +2195,7 @@ void AliTPCtrackerMI::SignShared(TObjArray * arr) for (Int_t i=0; iUncheckedAt(i); if (!pt) continue; - for (Int_t j=0;j<=12;j++){ + for (Int_t j=0;j<12;j++){ pt->SetOverlapLabel(j,0); } } @@ -2237,13 +2286,8 @@ void AliTPCtrackerMI::RemoveUsed2(TObjArray * arr, Float_t factor1, Float_t fac if (!pt) continue; // if (quality[trackindex]<0){ - if (pt) { delete arr->RemoveAt(trackindex); - } - else{ - arr->RemoveAt(trackindex); - } - continue; + continue; } // // @@ -2310,6 +2354,88 @@ void AliTPCtrackerMI::RemoveUsed2(TObjArray * arr, Float_t factor1, Float_t fac delete []indexes; } +void AliTPCtrackerMI::DumpClusters(Int_t iter, TObjArray *trackArray) +{ + // + // Dump clusters after reco + // signed and unsigned cluster can be visualized + // 1. Unsign all cluster + // 2. Sign all used clusters + // 3. Dump clusters + UnsignClusters(); + Int_t nseed = trackArray->GetEntries(); + for (Int_t i=0; iUncheckedAt(i); + if (!pt) { + continue; + } + Bool_t isKink=pt->GetKinkIndex(0)!=0; + for (Int_t j=0; j<160; ++j) { + Int_t index=pt->GetClusterIndex2(j); + if (index<0) continue; + AliTPCclusterMI *c= pt->GetClusterPointer(j); + if (!c) continue; + if (isKink) c->Use(100); // kink + c->Use(10); // by default usage 10 + } + } + // + + for (Int_t sec=0;secGetNRows();row++){ + AliTPCclusterMI *cl = fInnerSec[sec][row].GetClusters1(); + for (Int_t icl =0;icl< fInnerSec[sec][row].GetN1();icl++){ + Float_t gx[3]; cl[icl].GetGlobalXYZ(gx); + (*fDebugStreamer)<<"clDump"<< + "iter="<GetNRows();row++){ + AliTPCclusterMI *cl = fOuterSec[sec][row].GetClusters1(); + for (Int_t icl =0;icl< fOuterSec[sec][row].GetN1();icl++){ + Float_t gx[3]; cl[icl].GetGlobalXYZ(gx); + (*fDebugStreamer)<<"clDump"<< + "iter="<GetTimeGainSplinesRun(event->GetRunNumber()); + + AliTPCTransform *transform = AliTPCcalibDB::Instance()->GetTransform() ; + if (!transform) { + AliFatal("Tranformations not in RefitInward"); + return 0; + } + transform->SetCurrentRecoParam((AliTPCRecoParam*)AliTPCReconstructor::GetRecoParam()); + const AliTPCRecoParam * recoParam = AliTPCcalibDB::Instance()->GetTransform()->GetCurrentRecoParam(); + Int_t nContribut = event->GetNumberOfTracks(); + TGraphErrors * graphMultDependenceDeDx = 0x0; + if (recoParam && recoParam->GetUseMultiplicityCorrectionDedx() && gainCalibArray) { + if (recoParam->GetUseTotCharge()) { + graphMultDependenceDeDx = (TGraphErrors *) gainCalibArray->FindObject("TGRAPHERRORS_MEANQTOT_MULTIPLICITYDEPENDENCE_BEAM_ALL"); + } else { + graphMultDependenceDeDx = (TGraphErrors *) gainCalibArray->FindObject("TGRAPHERRORS_MEANQMAX_MULTIPLICITYDEPENDENCE_BEAM_ALL"); + } + } + // ReadSeeds(event,2); fIteration=2; //PrepareForProlongation(fSeeds,1); @@ -2619,13 +2766,11 @@ Int_t AliTPCtrackerMI::RefitInward(AliESDEvent *event) seed->PropagateTo(fkParam->GetInnerRadiusLow()); seed->UpdatePoints(); AddCovariance(seed); - MakeBitmaps(seed); + MakeESDBitmaps(seed, esd); seed->CookdEdx(0.02,0.6); CookLabel(seed,0.1); //For comparison only - esd->SetTPCClusterMap(seed->GetClusterMap()); - esd->SetTPCSharedMap(seed->GetSharedMap()); // - if (AliTPCReconstructor::StreamLevel()>1 && seed!=0&&esd!=0) { + if (AliTPCReconstructor::StreamLevel()>1 && seed!=0) { TTreeSRedirector &cstream = *fDebugStreamer; cstream<<"Crefit"<< "Esd.="<GetNCDEDX(0); Float_t sdedx = seed->GetSDEDX(0); Float_t dedx = seed->GetdEdx(); + // apply mutliplicity dependent dEdx correction if available + if (graphMultDependenceDeDx) { + Double_t corrGain = AliTPCcalibDButil::EvalGraphConst(graphMultDependenceDeDx, nContribut); + dedx += (1 - corrGain)*50.; // MIP is normalized to 50 + } esd->SetTPCsignal(dedx, sdedx, ndedx); // + // fill new dEdx information + // + Double32_t signal[4]; + Char_t ncl[3]; + Char_t nrows[3]; + // + for(Int_t iarr=0;iarr<3;iarr++) { + signal[iarr] = seed->GetDEDXregion(iarr+1); + ncl[iarr] = seed->GetNCDEDX(iarr+1); + nrows[iarr] = seed->GetNCDEDXInclThres(iarr+1); + } + signal[3] = seed->GetDEDXregion(4); + // + AliTPCdEdxInfo * infoTpcPid = new AliTPCdEdxInfo(); + infoTpcPid->SetTPCSignalRegionInfo(signal, ncl, nrows); + esd->SetTPCdEdxInfo(infoTpcPid); + // // add seed to the esd track in Calib level // Bool_t storeFriend = gRandom->Rndm()<(kMaxFriendTracks)/Float_t(nseed); @@ -2656,6 +2823,7 @@ Int_t AliTPCtrackerMI::RefitInward(AliESDEvent *event) } } //FindKinks(fSeeds,event); + if (AliTPCReconstructor::StreamLevel()>3) DumpClusters(2,fSeeds); Info("RefitInward","Number of refitted tracks %d",ntracks); return 0; } @@ -2666,7 +2834,7 @@ Int_t AliTPCtrackerMI::PropagateBack(AliESDEvent *event) // // back propagation of ESD tracks // - + if (!event) return 0; fEvent = event; fIteration = 1; ReadSeeds(event,1); @@ -2686,6 +2854,7 @@ Int_t AliTPCtrackerMI::PropagateBack(AliESDEvent *event) seed->UpdatePoints(); AddCovariance(seed); AliESDtrack *esd=event->GetTrack(i); + if (!esd) continue; //never happen if (seed->GetNumberOfClusters()<60 && seed->GetNumberOfClusters()<(esd->GetTPCclusters(0) -5)*0.8){ AliExternalTrackParam paramIn; AliExternalTrackParam paramOut; @@ -2726,6 +2895,7 @@ Int_t AliTPCtrackerMI::PropagateBack(AliESDEvent *event) } } } + if (AliTPCReconstructor::StreamLevel()>3) DumpClusters(1,fSeeds); //FindKinks(fSeeds,event); Info("PropagateBack","Number of back propagated tracks %d",ntracks); fEvent =0; @@ -2749,7 +2919,7 @@ void AliTPCtrackerMI::DeleteSeeds() fSeeds =0; } -void AliTPCtrackerMI::ReadSeeds(AliESDEvent *const event, Int_t direction) +void AliTPCtrackerMI::ReadSeeds(const AliESDEvent *const event, Int_t direction) { // //read seeds from the event @@ -2816,24 +2986,27 @@ void AliTPCtrackerMI::ReadSeeds(AliESDEvent *const event, Int_t direction) // rotate to the local coordinate system // fSectors=fInnerSec; fN=fkNIS; - Double_t alpha=seed->GetAlpha() - fSectors->GetAlphaShift(); + Double_t alpha=seed->GetAlpha(); if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi(); if (alpha < 0. ) alpha += 2.*TMath::Pi(); - Int_t ns=Int_t(alpha/fSectors->GetAlpha())%fN; + Int_t ns=Int_t(alpha/fSectors->GetAlpha()+0.0001)%fN; alpha =ns*fSectors->GetAlpha() + fSectors->GetAlphaShift(); + alpha-=seed->GetAlpha(); if (alpha<-TMath::Pi()) alpha += 2*TMath::Pi(); if (alpha>=TMath::Pi()) alpha -= 2*TMath::Pi(); - alpha-=seed->GetAlpha(); - if (!seed->Rotate(alpha)) { - delete seed; - continue; + if (TMath::Abs(alpha) > 0.001) { // This should not happen normally + AliWarning(Form("Rotating track over %f",alpha)); + if (!seed->Rotate(alpha)) { + delete seed; + continue; + } } seed->SetESD(esd); // sign clusters if (esd->GetKinkIndex(0)<=0){ for (Int_t irow=0;irow<160;irow++){ Int_t index = seed->GetClusterIndex2(irow); - if (index>0){ + if (index >= 0){ // AliTPCclusterMI * cl = GetClusterMI(index); seed->SetClusterPointer(irow,cl); @@ -3423,7 +3596,7 @@ void AliTPCtrackerMI::MakeSeeds5(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, } if (fDebug>3){ - Info("MakeSeeds5","\nSeeding statiistic:\t%d\t%d\t%d\t%d\t%d\t%d",nin0,nin1,nin2,nin,nout1,nout2,nout3); + Info("MakeSeeds5","\nSeeding statiistic:\t%d\t%d\t%d\t%d\t%d\t%d\t%d",nin0,nin1,nin2,nin,nout1,nout2,nout3); } delete seed; } @@ -3714,7 +3887,7 @@ AliTPCseed *AliTPCtrackerMI::MakeSeed(AliTPCseed *const track, Float_t r0, Float if ( (indexGetX()>1){ clindex = track->GetClusterIndex2(i); - if (clindex>0){ + if (clindex >= 0){ x0[0] = trpoint->GetX(); x0[1] = trpoint->GetY(); x0[2] = trpoint->GetZ(); @@ -3725,7 +3898,7 @@ AliTPCseed *AliTPCtrackerMI::MakeSeed(AliTPCseed *const track, Float_t r0, Float if ( (indexGetX()>1)){ clindex = track->GetClusterIndex2(i); - if (clindex>0){ + if (clindex >= 0){ x1[0] = trpoint->GetX(); x1[1] = trpoint->GetY(); x1[2] = trpoint->GetZ(); @@ -3734,7 +3907,7 @@ AliTPCseed *AliTPCtrackerMI::MakeSeed(AliTPCseed *const track, Float_t r0, Float } if ( (indexGetX()>1)){ clindex = track->GetClusterIndex2(i); - if (clindex>0){ + if (clindex >= 0){ x2[0] = trpoint->GetX(); x2[1] = trpoint->GetY(); x2[2] = trpoint->GetZ(); @@ -3837,8 +4010,8 @@ AliTPCseed *AliTPCtrackerMI::ReSeed(const AliTPCseed *track, Float_t r0, Float_t ipos[2] = TMath::Min(int(r2*nclusters),nclusters-1); // last point // // - Double_t xyz[3][3]; - Int_t row[3],sec[3]={0,0,0}; + Double_t xyz[3][3]={{0}}; + Int_t row[3]={0},sec[3]={0,0,0}; // // find track row position at given ratio of the length Int_t index=-1; @@ -4257,6 +4430,8 @@ void AliTPCtrackerMI::FindMultiMC(const TObjArray * array, AliESDEvent */*esd*/ } delete [] helixes; delete [] xm; + delete [] dz0; + delete [] dz1; if (AliTPCReconstructor::StreamLevel()>1) { AliInfo("Time for curling tracks removal DEBUGGING MC"); timer.Print(); @@ -4295,6 +4470,7 @@ void AliTPCtrackerMI::FindSplitted(TObjArray * array, AliESDEvent */*esd*/, Int //0. Sort tracks according quality //1. Propagate the ext. param to reference radius Int_t nseed = array->GetEntriesFast(); + if (nseed<=0) return; Float_t * quality = new Float_t[nseed]; Int_t * indexes = new Int_t[nseed]; for (Int_t i=0; iAt(indexes[ikink0]); if (!kink0) continue; // - for (Int_t ikink1=0;ikink1At(indexes[ikink0]); if (!kink0) continue; AliKink * kink1 = (AliKink*) kinks->At(indexes[ikink1]); if (!kink1) continue; @@ -5167,6 +5348,7 @@ void AliTPCtrackerMI::FindKinks(TObjArray * array, AliESDEvent *esd) shared[kink0->GetIndex(0)]= kTRUE; shared[kink0->GetIndex(1)]= kTRUE; delete kinks->RemoveAt(indexes[ikink0]); + break; } else{ shared[kink1->GetIndex(0)]= kTRUE; @@ -5327,367 +5509,10 @@ void AliTPCtrackerMI::FindKinks(TObjArray * array, AliESDEvent *esd) kinks->Delete(); delete kinks; - printf("Ncandidates=\t%d\t%d\t%d\t%d\n",esd->GetNumberOfKinks(),ncandidates,ntracks,nall); + AliInfo(Form("Ncandidates=\t%d\t%d\t%d\t%d\n",esd->GetNumberOfKinks(),ncandidates,ntracks,nall)); timer.Print(); } -void AliTPCtrackerMI::FindV0s(const TObjArray * array, AliESDEvent *const esd) -{ - // - // find V0s - // - // - TObjArray *tpcv0s = new TObjArray(100000); - Int_t nentries = array->GetEntriesFast(); - AliHelix *helixes = new AliHelix[nentries]; - Int_t *sign = new Int_t[nentries]; - Float_t *alpha = new Float_t[nentries]; - Float_t *z0 = new Float_t[nentries]; - Float_t *dca = new Float_t[nentries]; - Float_t *sdcar = new Float_t[nentries]; - Float_t *cdcar = new Float_t[nentries]; - Float_t *pulldcar = new Float_t[nentries]; - Float_t *pulldcaz = new Float_t[nentries]; - Float_t *pulldca = new Float_t[nentries]; - Bool_t *isPrim = new Bool_t[nentries]; - const AliESDVertex * primvertex = esd->GetVertex(); - Double_t zvertex = primvertex->GetZv(); - // - // nentries = array->GetEntriesFast(); - // - for (Int_t i=0;iAt(i); - if (!track) continue; - track->GetV0Indexes()[0] = 0; //rest v0 indexes - track->GetV0Indexes()[1] = 0; //rest v0 indexes - track->GetV0Indexes()[2] = 0; //rest v0 indexes - // - alpha[i] = track->GetAlpha(); - new (&helixes[i]) AliHelix(*track); - Double_t xyz[3]; - helixes[i].Evaluate(0,xyz); - sign[i] = (track->GetC()>0) ? -1:1; - Double_t x,y,z; - x=160; - z0[i]=1000; - if (track->GetProlongation(0,y,z)) z0[i] = z; - dca[i] = track->GetD(0,0); - // - // dca error parrameterezation + pulls - // - sdcar[i] = TMath::Sqrt(0.150*0.150+(100*track->GetC())*(100*track->GetC())); - if (TMath::Abs(track->GetTgl())>1) sdcar[i]*=2.5; - cdcar[i] = TMath::Exp((TMath::Abs(track->GetC())-0.0106)*525.3); - pulldcar[i] = (dca[i]-cdcar[i])/sdcar[i]; - pulldcaz[i] = (z0[i]-zvertex)/sdcar[i]; - pulldca[i] = TMath::Sqrt(pulldcar[i]*pulldcar[i]+pulldcaz[i]*pulldcaz[i]); - if (track->TPCrPID(1)+track->TPCrPID(2)+track->TPCrPID(3)>0.5) { - if (pulldca[i]<3.) isPrim[i]=kTRUE; //pion, muon and Kaon 3 sigma cut - } - if (track->TPCrPID(4)>0.5) { - if (pulldca[i]<0.5) isPrim[i]=kTRUE; //proton 0.5 sigma cut - } - if (track->TPCrPID(0)>0.4) { - isPrim[i]=kFALSE; //electron no sigma cut - } - } - // - // - TStopwatch timer; - timer.Start(); - Int_t ncandidates =0; - Int_t nall =0; - Int_t ntracks=0; - Double_t phase[2][2],radius[2]; - // - // Finf V0s loop - // - // - // // - Float_t fprimvertex[3]={GetX(),GetY(),GetZ()}; - AliV0 vertex; - Double_t cradius0 = 10*10; - Double_t cradius1 = 200*200; - Double_t cdist1=3.; - Double_t cdist2=4.; - Double_t cpointAngle = 0.95; - // - Double_t delta[2]={10000,10000}; - for (Int_t i =0;iAt(i); - if (!track0) continue; - if (AliTPCReconstructor::StreamLevel()>1){ - TTreeSRedirector &cstream = *fDebugStreamer; - cstream<<"Tracks"<< - "Tr0.="<GetSigned1Pt()<0) continue; - if (track0->GetKinkIndex(0)>0||isPrim[i]) continue; //daughter kink - // - if (TMath::Abs(helixes[i].GetHelix(4))<0.000000001) continue; - ntracks++; - // debug output - - - for (Int_t j =0;jAt(j); - if (!track1) continue; - if (track1->GetKinkIndex(0)>0 || isPrim[j]) continue; //daughter kink - if (sign[j]*sign[i]>0) continue; - if (TMath::Abs(helixes[j].GetHelix(4))<0.000001) continue; - if (track0->GetCircular()+track1->GetCircular()>1) continue; //circling -returning track - nall++; - // - // DCA to prim vertex cut - // - // - delta[0]=10000; - delta[1]=10000; - - Int_t npoints = helixes[i].GetRPHIintersections(helixes[j], phase, radius,cdist2); - if (npoints<1) continue; - Int_t iclosest=0; - // cuts on radius - if (npoints==1){ - if (radius[0]cradius1) continue; - helixes[i].LinearDCA(helixes[j],phase[0][0],phase[0][1],radius[0],delta[0]); - if (delta[0]>cdist1) continue; - } - else{ - if (TMath::Max(radius[0],radius[1])cradius1) continue; - helixes[i].LinearDCA(helixes[j],phase[0][0],phase[0][1],radius[0],delta[0]); - helixes[i].LinearDCA(helixes[j],phase[1][0],phase[1][1],radius[1],delta[1]); - if (delta[1]cdist1) continue; - } - helixes[i].ParabolicDCA(helixes[j],phase[iclosest][0],phase[iclosest][1],radius[iclosest],delta[iclosest]); - if (radius[iclosest]cradius1 || delta[iclosest]>cdist1) continue; - // - Double_t pointAngle = helixes[i].GetPointAngle(helixes[j],phase[iclosest],fprimvertex); - if (pointAngleTPCrPID(0)>0.3&&track1->TPCrPID(0)>0.3&&vertex.GetAnglep()[2]<0.15) isGamma=kTRUE; // gamma conversion candidate - Double_t pointAngle2 = vertex.GetV0CosineOfPointingAngle(); - //continue; - if (vertex.GetV0CosineOfPointingAngle()2&&(!isGamma)) continue; // point angle cut - if (vertex.GetDcaV0Daughters()>2&&(!isGamma)) continue;//Bo: // point angle cut - Float_t sigmae = 0.15*0.15; - if (vertex.GetRr()<80) - sigmae += (sdcar[i]*sdcar[i]+sdcar[j]*sdcar[j])*(1.-vertex.GetRr()/80.)*(1.-vertex.GetRr()/80.); - sigmae+= TMath::Sqrt(sigmae); - //Bo: if (vertex.GetDist2()/sigmae>3.&&(!isGamma)) continue; - if (vertex.GetDcaV0Daughters()/sigmae>3.&&(!isGamma)) continue; - Float_t densb0=0,densb1=0,densa0=0,densa1=0; - Int_t row0 = GetRowNumber(vertex.GetRr()); - if (row0>15){ - //Bo: if (vertex.GetDist2()>0.2) continue; - if (vertex.GetDcaV0Daughters()>0.2) continue; - densb0 = track0->Density2(0,row0-5); - densb1 = track1->Density2(0,row0-5); - if (densb0>0.3|| densb1>0.3) continue; //clusters before vertex - densa0 = track0->Density2(row0+5,row0+40); - densa1 = track1->Density2(row0+5,row0+40); - if ((densa0<0.4|| densa1<0.4)&&(!isGamma)) continue; //missing clusters after vertex - } - else{ - densa0 = track0->Density2(0,40); //cluster density - densa1 = track1->Density2(0,40); //cluster density - if ((vertex.GetRr()<80&&densa0+densa1<1.)&&(!isGamma)) continue; - } -//Bo: vertex.SetLab(0,track0->GetLabel()); -//Bo: vertex.SetLab(1,track1->GetLabel()); - vertex.SetChi2After((densa0+densa1)*0.5); - vertex.SetChi2Before((densb0+densb1)*0.5); - vertex.SetIndex(0,i); - vertex.SetIndex(1,j); -//Bo: vertex.SetStatus(1); // TPC v0 candidate - vertex.SetOnFlyStatus(2);//Bo: // TPC v0 candidate -//Bo: vertex.SetRp(track0->TPCrPIDs()); -//Bo: vertex.SetRm(track1->TPCrPIDs()); - tpcv0s->AddLast(new AliESDv0(vertex)); - ncandidates++; - { - Int_t eventNr = esd->GetEventNumberInFile(); // This is most likely NOT the event number you'd like to use. It has nothing to do with the 'real' event number - Double_t radiusm= (delta[0]1) { - Int_t lab0=track0->GetLabel(); - Int_t lab1=track1->GetLabel(); - Char_t c0=track0->GetCircular(); - Char_t c1=track1->GetCircular(); - TTreeSRedirector &cstream = *fDebugStreamer; - cstream<<"V0"<< - "Event="<At(i); - quality[i] = 1./(1.00001-v0->GetV0CosineOfPointingAngle()); //base point angle - // quality[i] /= (0.5+v0->GetDist2()); - // quality[i] *= v0->GetChi2After(); //density factor - - Int_t index0 = v0->GetIndex(0); - Int_t index1 = v0->GetIndex(1); - //Bo: Double_t minpulldca = TMath::Min(2.+pulldca[v0->GetIndex(0)],(2.+pulldca[v0->GetIndex(1)]) ); //pull - Double_t minpulldca = TMath::Min(2.+pulldca[index0],(2.+pulldca[index1]) );//Bo: - - - - AliTPCseed * track0 = (AliTPCseed*)array->At(index0); - AliTPCseed * track1 = (AliTPCseed*)array->At(index1); - if (track0->TPCrPID(0)>0.3&&track1->TPCrPID(0)>0.3&&v0->GetAnglep()[2]<0.15) quality[i]+=1000000; // gamma conversion candidate - if (track0->TPCrPID(4)>0.9||(track1->TPCrPID(4)>0.9&&minpulldca>4)) quality[i]*=10; // lambda candidate candidate - } - - TMath::Sort(ncandidates,quality,indexes,kTRUE); - // - // - for (Int_t i=0;iAt(indexes[i]); - if (!v0) continue; - Int_t index0 = v0->GetIndex(0); - Int_t index1 = v0->GetIndex(1); - AliTPCseed * track0 = (AliTPCseed*)array->At(index0); - AliTPCseed * track1 = (AliTPCseed*)array->At(index1); - if (!track0||!track1) { - printf("Bug\n"); - continue; - } - Bool_t accept =kTRUE; //default accept - Int_t *v0indexes0 = track0->GetV0Indexes(); - Int_t *v0indexes1 = track1->GetV0Indexes(); - // - Int_t order0 = (v0indexes0[0]!=0) ? 1:0; - Int_t order1 = (v0indexes1[0]!=0) ? 1:0; - if (v0indexes0[1]!=0) order0 =2; - if (v0indexes1[1]!=0) order1 =2; - // - if (v0indexes0[2]!=0) {order0=3; accept=kFALSE;} - if (v0indexes0[2]!=0) {order1=3; accept=kFALSE;} - // - AliESDv0 * v02 = v0; - if (accept){ - //Bo: v0->SetOrder(0,order0); - //Bo: v0->SetOrder(1,order1); - //Bo: v0->SetOrder(1,order0+order1); - v0->SetOnFlyStatus(kTRUE); - Int_t index = esd->AddV0(v0); - v02 = esd->GetV0(index); - v0indexes0[order0]=index; - v0indexes1[order1]=index; - naccepted++; - } - { - Int_t eventNr = esd->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 (AliTPCReconstructor::StreamLevel()>1) { - Int_t lab0=track0->GetLabel(); - Int_t lab1=track1->GetLabel(); - TTreeSRedirector &cstream = *fDebugStreamer; - cstream<<"V02"<< - "Event="<GetTransform() ; + transform->SetCurrentTimeStamp( esd->GetTimeStamp()); + transform->SetCurrentRun(esd->GetRunNumber()); + Clusters2Tracks(); if (!fSeeds) return 1; FillESD(fSeeds); + if (AliTPCReconstructor::StreamLevel()>3) DumpClusters(0,fSeeds); return 0; // } @@ -6121,7 +5954,7 @@ Int_t AliTPCtrackerMI::Clusters2Tracks() { CookLabel(pt,0.1); if (pt->GetRemoval()==10) { if (pt->GetDensityFirst(20)>0.8 || pt->GetDensityFirst(30)>0.8 || pt->GetDensityFirst(40)>0.7) - pt->Desactivate(10); // make track again active + pt->Desactivate(10); // make track again active // MvL: should be 0 ? else{ pt->Desactivate(20); delete fSeeds->RemoveAt(i); @@ -6213,7 +6046,7 @@ Int_t AliTPCtrackerMI::Clusters2Tracks() { fIteration = 2; PrepareForProlongation(fSeeds,5.); - PropagateForward2(fSeeds); + PropagateForard2(fSeeds); printf("Time for FORWARD propagation: \t");timer.Print();timer.Start(); // RemoveUsed(fSeeds,0.7,0.7,6); @@ -6296,7 +6129,7 @@ TObjArray * AliTPCtrackerMI::Tracking(Int_t seedtype, Int_t i1, Int_t i2, Float_ TObjArray * AliTPCtrackerMI::Tracking() { - // + // tracking // if (AliTPCReconstructor::GetRecoParam()->GetSpecialSeeding()) return TrackingSpecial(); TStopwatch timer; @@ -6305,6 +6138,9 @@ TObjArray * AliTPCtrackerMI::Tracking() TObjArray * seeds = new TObjArray; TObjArray * arr=0; + Int_t fLastSeedRowSec=AliTPCReconstructor::GetRecoParam()->GetLastSeedRowSec(); + Int_t gapPrim = AliTPCReconstructor::GetRecoParam()->GetSeedGapPrim(); + Int_t gapSec = AliTPCReconstructor::GetRecoParam()->GetSeedGapSec(); Int_t gap =20; Float_t cuts[4]; @@ -6318,7 +6154,7 @@ TObjArray * AliTPCtrackerMI::Tracking() // //find primaries cuts[0]=0.0066; - for (Int_t delta = 0; delta<18; delta+=6){ + for (Int_t delta = 0; delta<18; delta+=gapPrim){ // cuts[0]=0.0070; cuts[1] = 1.5; @@ -6343,7 +6179,7 @@ TObjArray * AliTPCtrackerMI::Tracking() //find primaries cuts[0]=0.0077; - for (Int_t delta = 20; delta<120; delta+=10){ + for (Int_t delta = 20; delta<120; delta+=gapPrim){ // // seed high pt tracks cuts[0]=0.0060; @@ -6396,9 +6232,22 @@ TObjArray * AliTPCtrackerMI::Tracking() SumTracks(seeds,arr); SignClusters(seeds,fnumber,fdensity); // + arr = Tracking(4,nup-5,nup-5-gap,cuts,-1); + SumTracks(seeds,arr); + SignClusters(seeds,fnumber,fdensity); + // + arr = Tracking(4,nup-7,nup-7-gap,cuts,-1); + SumTracks(seeds,arr); + SignClusters(seeds,fnumber,fdensity); + // + // + arr = Tracking(4,nup-9,nup-9-gap,cuts,-1); + SumTracks(seeds,arr); + SignClusters(seeds,fnumber,fdensity); + // - for (Int_t delta = 3; delta<30; delta+=5){ + for (Int_t delta = 9; delta<30; delta+=gapSec){ // cuts[0] = 0.3; cuts[1] = 1.5; @@ -6421,10 +6270,9 @@ TObjArray * AliTPCtrackerMI::Tracking() fdensity = 2.; cuts[0]=0.0080; - Int_t fLastSeedRowSec=AliTPCReconstructor::GetRecoParam()->GetLastSeedRowSec(); // find secondaries - for (Int_t delta = 30; deltaGetAlpha(); if (TMath::Abs(angle1-angle2)>0.001){ - pt->Rotate(angle1-angle2); + if (!pt->Rotate(angle1-angle2)) return; //angle2 = pt->GetAlpha(); //pt->fRelativeSector = pt->GetAlpha()/fInnerSec->GetAlpha(); //if (pt->GetAlpha()<0) @@ -6645,7 +6493,7 @@ void AliTPCtrackerMI::PrepareForProlongation(TObjArray *const arr, Float_t fac) } -Int_t AliTPCtrackerMI::PropagateBack(TObjArray *const arr) +Int_t AliTPCtrackerMI::PropagateBack(const TObjArray *const arr) { // // make back propagation @@ -6658,7 +6506,7 @@ Int_t AliTPCtrackerMI::PropagateBack(TObjArray *const arr) fSectors = fInnerSec; //FollowBackProlongation(*pt,fInnerSec->GetNRows()-1); //fSectors = fOuterSec; - FollowBackProlongation(*pt,fInnerSec->GetNRows()+fOuterSec->GetNRows()-1); + FollowBackProlongation(*pt,fInnerSec->GetNRows()+fOuterSec->GetNRows()-1,1); //if (pt->GetNumberOfClusters()<(pt->fEsd->GetTPCclusters(0)) ){ // Error("PropagateBack","Not prolonged track %d",pt->GetLabel()); // FollowBackProlongation(*pt2,fInnerSec->GetNRows()+fOuterSec->GetNRows()-1); @@ -6668,7 +6516,7 @@ Int_t AliTPCtrackerMI::PropagateBack(TObjArray *const arr) AliESDkink * kink = fEvent->GetKink(pt->GetKinkIndex(0)-1); pt->SetFirstPoint(kink->GetTPCRow0()); fSectors = fInnerSec; - FollowBackProlongation(*pt,fInnerSec->GetNRows()+fOuterSec->GetNRows()-1); + FollowBackProlongation(*pt,fInnerSec->GetNRows()+fOuterSec->GetNRows()-1,1); } CookLabel(pt,0.3); } @@ -6676,7 +6524,7 @@ Int_t AliTPCtrackerMI::PropagateBack(TObjArray *const arr) } -Int_t AliTPCtrackerMI::PropagateForward2(TObjArray *const arr) +Int_t AliTPCtrackerMI::PropagateForward2(const TObjArray *const arr) { // // make forward propagation @@ -6686,12 +6534,12 @@ Int_t AliTPCtrackerMI::PropagateForward2(TObjArray *const arr) for (Int_t i=0;iUncheckedAt(i); if (pt) { - FollowProlongation(*pt,0); + FollowProlongation(*pt,0,1,1); CookLabel(pt,0.3); } } - return 0; + return 0; } @@ -6758,12 +6606,17 @@ Int_t AliTPCtrackerMI::PropagateBack(AliTPCseed *const pt, Int_t row0, Int_t row void AliTPCtrackerMI::GetShape(AliTPCseed * seed, Int_t row) { - // + // gets cluster shape // AliTPCClusterParam * clparam = AliTPCcalibDB::Instance()->GetClusterParam(); Float_t zdrift = TMath::Abs((fkParam->GetZLength(0)-TMath::Abs(seed->GetZ()))); Int_t type = (seed->GetSector() < fkParam->GetNSector()/2) ? 0: (row>126) ? 1:2; Double_t angulary = seed->GetSnp(); + + if (TMath::Abs(angulary)>AliTPCReconstructor::GetMaxSnpTracker()) { + angulary = TMath::Sign(AliTPCReconstructor::GetMaxSnpTracker(),angulary); + } + angulary = angulary*angulary/((1.-angulary)*(1.+angulary)); Double_t angularz = seed->GetTgl()*seed->GetTgl()*(1.+angulary); @@ -6855,14 +6708,14 @@ void AliTPCtrackerMI::CookLabel(AliKalmanTrack *tk, Float_t wrong) const { if (TMath::Abs(c->GetLabel(1)) == lab || TMath::Abs(c->GetLabel(2)) == lab ) max++; } - - if ((1.- Float_t(max)/noc) > wrong) lab=-lab; + if (noc<=0) { lab=-1; return;} + if ((1.- Float_t(max)/(noc)) > wrong) lab=-lab; else { Int_t tail=Int_t(0.10*noc); max=0; Int_t ind=0; - for (i=1; i<=160&&indGetLabel(1)) == lab || TMath::Abs(c->GetLabel(2)) == lab ) max++; } - - if ((1.- Float_t(max)/noc) > wrong) lab=-lab; + if (noc<=0) { lab=-1; return -1;} + if ((1.- Float_t(max)/(noc)) > wrong) lab=-lab; else { Int_t tail=Int_t(0.10*noc); max=0; Int_t ind=0; - for (i=1; i<=160&&indGetClusterPointer(iter); if (cluster) { - t->SetClusterMapBit(iter, kTRUE); + clusterMap.SetBitNumber(iter, kTRUE); point = t->GetTrackPoint(iter); if (point->IsShared()) - t->SetSharedMapBit(iter,kTRUE); - else - t->SetSharedMapBit(iter, kFALSE); + sharedMap.SetBitNumber(iter,kTRUE); } - else { - t->SetClusterMapBit(iter, kFALSE); - t->SetSharedMapBit(iter, kFALSE); + if (t->GetClusterIndex(iter) >= 0 && (t->GetClusterIndex(iter) & 0x8000) == 0) { + fitMap.SetBitNumber(iter, kTRUE); + nclsf++; } } + esd->SetTPCClusterMap(clusterMap); + esd->SetTPCSharedMap(sharedMap); + esd->SetTPCFitMap(fitMap); + if (nclsf != t->GetNumberOfClusters()) + AliWarning(Form("Inconsistency between ncls %d and indices %d (found %d)",t->GetNumberOfClusters(),nclsf,esd->GetTPCClusterMap().CountBits())); } Bool_t AliTPCtrackerMI::IsFindable(AliTPCseed & track){ @@ -7026,10 +6887,42 @@ Bool_t AliTPCtrackerMI::IsFindable(AliTPCseed & track){ void AliTPCtrackerMI::AddCovariance(AliTPCseed * seed){ // - // Adding systematic error + // Adding systematic error estimate to the covariance matrix // !!!! the systematic error for element 4 is in 1/cm not in pt + // + const Double_t *param = AliTPCReconstructor::GetRecoParam()->GetSystematicError(); + // + // use only the diagonal part if not specified otherwise + if (!AliTPCReconstructor::GetRecoParam()->GetUseSystematicCorrelation()) return AddCovarianceAdd(seed); + // + Double_t *covarS= (Double_t*)seed->GetCovariance(); + Double_t factor[5]={1,1,1,1,1}; + Double_t facC = AliTracker::GetBz()*kB2C; + factor[0]= TMath::Sqrt(TMath::Abs((covarS[0] + param[0]*param[0])/covarS[0])); + factor[1]= TMath::Sqrt(TMath::Abs((covarS[2] + param[1]*param[1])/covarS[2])); + factor[2]= TMath::Sqrt(TMath::Abs((covarS[5] + param[2]*param[2])/covarS[5])); + factor[3]= TMath::Sqrt(TMath::Abs((covarS[9] + param[3]*param[3])/covarS[9])); + factor[4]= TMath::Sqrt(TMath::Abs((covarS[14] + facC*facC*param[4]*param[4])/covarS[14])); + // 0 + // 1 2 + // 3 4 5 + // 6 7 8 9 + // 10 11 12 13 14 + for (Int_t i=0; i<5; i++){ + for (Int_t j=i; j<5; j++){ + Int_t index=seed->GetIndex(i,j); + covarS[index]*=factor[i]*factor[j]; + } + } +} + +void AliTPCtrackerMI::AddCovarianceAdd(AliTPCseed * seed){ + // + // Adding systematic error - as additive factor without correlation + // const Double_t *param = AliTPCReconstructor::GetRecoParam()->GetSystematicError(); + Double_t *covarIn= (Double_t*)seed->GetCovariance(); Double_t covar[15]; for (Int_t i=0;i<15;i++) covar[i]=0; // 0 @@ -7043,5 +6936,20 @@ void AliTPCtrackerMI::AddCovariance(AliTPCseed * seed){ covar[9] = param[3]*param[3]; Double_t facC = AliTracker::GetBz()*kB2C; covar[14]= param[4]*param[4]*facC*facC; + // + covar[1]=TMath::Sqrt((covar[0]*covar[2]))*covarIn[1]/TMath::Sqrt((covarIn[0]*covarIn[2])); + // + covar[3]=TMath::Sqrt((covar[0]*covar[5]))*covarIn[3]/TMath::Sqrt((covarIn[0]*covarIn[5])); + covar[4]=TMath::Sqrt((covar[2]*covar[5]))*covarIn[4]/TMath::Sqrt((covarIn[2]*covarIn[5])); + // + covar[6]=TMath::Sqrt((covar[0]*covar[9]))*covarIn[6]/TMath::Sqrt((covarIn[0]*covarIn[9])); + covar[7]=TMath::Sqrt((covar[2]*covar[9]))*covarIn[7]/TMath::Sqrt((covarIn[2]*covarIn[9])); + covar[8]=TMath::Sqrt((covar[5]*covar[9]))*covarIn[8]/TMath::Sqrt((covarIn[5]*covarIn[9])); + // + covar[10]=TMath::Sqrt((covar[0]*covar[14]))*covarIn[10]/TMath::Sqrt((covarIn[0]*covarIn[14])); + covar[11]=TMath::Sqrt((covar[2]*covar[14]))*covarIn[11]/TMath::Sqrt((covarIn[2]*covarIn[14])); + covar[12]=TMath::Sqrt((covar[5]*covar[14]))*covarIn[12]/TMath::Sqrt((covarIn[5]*covarIn[14])); + covar[13]=TMath::Sqrt((covar[9]*covar[14]))*covarIn[13]/TMath::Sqrt((covarIn[9]*covarIn[14])); + // seed->AddCovariance(covar); }