X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TRD%2FAliTRDtrackerV1.cxx;h=45b812697aa4187e50da80487e79cc9bee65f4fb;hb=adad4ea9e03e783c55b94ac290f699d1d2923ba2;hp=87fbcaa34cff3e39003b21383ccf6b9447cf220c;hpb=c08b1cc792d7047b14f084c4e2d4c7abf0783227;p=u%2Fmrichter%2FAliRoot.git diff --git a/TRD/AliTRDtrackerV1.cxx b/TRD/AliTRDtrackerV1.cxx index 87fbcaa34cf..45b812697aa 100644 --- a/TRD/AliTRDtrackerV1.cxx +++ b/TRD/AliTRDtrackerV1.cxx @@ -61,11 +61,7 @@ ClassImp(AliTRDtrackerV1) ClassImp(AliTRDtrackerV1::AliTRDLeastSquare) ClassImp(AliTRDtrackerV1::AliTRDtrackFitterRieman) -const Float_t AliTRDtrackerV1::fgkMinClustersInTrack = 0.5; // -const Float_t AliTRDtrackerV1::fgkLabelFraction = 0.8; // -const Double_t AliTRDtrackerV1::fgkMaxChi2 = 12.0; // -const Double_t AliTRDtrackerV1::fgkMaxSnp = 0.95; // Maximum local sine of the azimuthal angle -const Double_t AliTRDtrackerV1::fgkMaxStep = 2.0; // Maximal step size in propagation +AliTRDtrackerV1::ETRDtrackerV1BetheBloch AliTRDtrackerV1::fgBB = AliTRDtrackerV1::kGeant; Double_t AliTRDtrackerV1::fgTopologicQA[kNConfigs] = { 0.5112, 0.5112, 0.5112, 0.0786, 0.0786, 0.0786, 0.0786, 0.0579, 0.0579, 0.0474, @@ -73,6 +69,8 @@ Double_t AliTRDtrackerV1::fgTopologicQA[kNConfigs] = { }; const Double_t AliTRDtrackerV1::fgkX0[kNPlanes] = { 300.2, 312.8, 325.4, 338.0, 350.6, 363.2}; +// Number of Time Bins/chamber should be also stored independently by the traker +// (also in AliTRDReconstructor) in oder to be able to run HLT. Fix TODO Int_t AliTRDtrackerV1::fgNTimeBins = 0; AliRieman* AliTRDtrackerV1::fgRieman = NULL; TLinearFitter* AliTRDtrackerV1::fgTiltedRieman = NULL; @@ -89,6 +87,7 @@ AliTRDtrackerV1::AliTRDtrackerV1(AliTRDReconstructor *rec) ,fTracks(NULL) ,fTracksESD(NULL) ,fSieveSeeding(0) + ,fEventInFile(-1) { // // Default constructor. @@ -288,12 +287,13 @@ Int_t AliTRDtrackerV1::PropagateBack(AliESDEvent *event) Float_t *quality = NULL; Int_t *index = NULL; + fEventInFile = event->GetEventNumberInFile(); nSeeds = event->GetNumberOfTracks(); // Sort tracks according to quality // (covariance in the yz plane) if(nSeeds){ quality = new Float_t[nSeeds]; - index = new Int_t[nSeeds]; + index = new Int_t[4*nSeeds]; for (Int_t iSeed = nSeeds; iSeed--;) { AliESDtrack *seed = event->GetTrack(iSeed); Double_t covariance[15]; @@ -318,8 +318,9 @@ Int_t AliTRDtrackerV1::PropagateBack(AliESDEvent *event) if ((status & AliESDtrack::kTRDout) != 0) continue; // Propagate to the entrance in the TRD mother volume + track.~AliTRDtrackV1(); new(&track) AliTRDtrackV1(*seed); - if(AliTRDgeometry::GetXtrdBeg() > (fgkMaxStep + track.GetX()) && !PropagateToX(track, AliTRDgeometry::GetXtrdBeg(), fgkMaxStep)){ + if(AliTRDgeometry::GetXtrdBeg() > (AliTRDReconstructor::GetMaxStep() + track.GetX()) && !PropagateToX(track, AliTRDgeometry::GetXtrdBeg(), AliTRDReconstructor::GetMaxStep())){ seed->UpdateTrackParams(&track, AliESDtrack::kTRDStop); continue; } @@ -327,13 +328,12 @@ Int_t AliTRDtrackerV1::PropagateBack(AliESDEvent *event) seed->UpdateTrackParams(&track, AliESDtrack::kTRDStop); continue; } - if(TMath::Abs(track.GetSnp()) > fgkMaxSnp) { + if(TMath::Abs(track.GetSnp()) > AliTRDReconstructor::GetMaxSnp()) { seed->UpdateTrackParams(&track, AliESDtrack::kTRDStop); continue; } - nTPCseeds++; - + AliDebug(2, Form("TRD propagate TPC seed[%d] = %d.", iSeed, index[iSeed])); // store track status at TRD entrance seed->UpdateTrackParams(&track, AliESDtrack::kTRDbackup); @@ -375,7 +375,7 @@ Int_t AliTRDtrackerV1::PropagateBack(AliESDEvent *event) // Make backup for back propagation Int_t foundClr = track.GetNumberOfClusters(); if (foundClr >= foundMin) { - track.CookLabel(1. - fgkLabelFraction); + track.CookLabel(1. - AliTRDReconstructor::GetLabelFraction()); //if(track.GetBackupTrack()) UseClusters(track.GetBackupTrack()); // Sign only gold tracks @@ -430,7 +430,7 @@ Int_t AliTRDtrackerV1::PropagateBack(AliESDEvent *event) xtof = TMath::Sqrt(glob[0]*glob[0]+glob[1]*glob[1]); } } - if(xtof > (fgkMaxStep + track.GetX()) && !PropagateToX(track, xtof, fgkMaxStep)){ + if(xtof > (AliTRDReconstructor::GetMaxStep() + track.GetX()) && !PropagateToX(track, xtof, AliTRDReconstructor::GetMaxStep())){ seed->UpdateTrackParams(&track, AliESDtrack::kTRDStop); continue; } @@ -438,7 +438,7 @@ Int_t AliTRDtrackerV1::PropagateBack(AliESDEvent *event) seed->UpdateTrackParams(&track, AliESDtrack::kTRDStop); continue; } - if(TMath::Abs(track.GetSnp()) > fgkMaxSnp){ + if(TMath::Abs(track.GetSnp()) > AliTRDReconstructor::GetMaxSnp()){ seed->UpdateTrackParams(&track, AliESDtrack::kTRDStop); continue; } @@ -514,7 +514,7 @@ Int_t AliTRDtrackerV1::RefitInward(AliESDEvent *event) } // Prolongate to TPC - if (PropagateToX(track, xTPC, fgkMaxStep)) { // -with update + if (PropagateToX(track, xTPC, AliTRDReconstructor::GetMaxStep())) { // -with update seed->UpdateTrackParams(&track, AliESDtrack::kTRDrefit); found++; kUPDATE = kTRUE; @@ -524,7 +524,7 @@ Int_t AliTRDtrackerV1::RefitInward(AliESDEvent *event) // Prolongate to TPC without update if(!kUPDATE) { AliTRDtrackV1 tt(*seed); - if (PropagateToX(tt, xTPC, fgkMaxStep)) seed->UpdateTrackParams(&tt, AliESDtrack::kTRDbackup); + if (PropagateToX(tt, xTPC, AliTRDReconstructor::GetMaxStep())) seed->UpdateTrackParams(&tt, AliESDtrack::kTRDbackup); } } AliInfo(Form("Number of seeds: TRDout[%d]", nseed)); @@ -572,12 +572,12 @@ Int_t AliTRDtrackerV1::FollowProlongation(AliTRDtrackV1 &t) } Double_t x = tracklet->GetX();//GetX0(); // reject tracklets which are not considered for inward refit - if(x > t.GetX()+fgkMaxStep) continue; + if(x > t.GetX()+AliTRDReconstructor::GetMaxStep()) continue; // append tracklet to track t.SetTracklet(tracklet, index); - if (x < (t.GetX()-fgkMaxStep) && !PropagateToX(t, x+fgkMaxStep, fgkMaxStep)) break; + if (x < (t.GetX()-AliTRDReconstructor::GetMaxStep()) && !PropagateToX(t, x+AliTRDReconstructor::GetMaxStep(), AliTRDReconstructor::GetMaxStep())) break; if (!AdjustSector(&t)) break; // Start global position @@ -693,8 +693,7 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) Int_t debugLevel = fkReconstructor->IsDebugStreaming() ? fkRecoParam->GetStreamLevel(AliTRDrecoParam::kTracker) : 0; TTreeSRedirector *cstreamer = fkReconstructor->IsDebugStreaming() ? fkReconstructor->GetDebugStream(AliTRDrecoParam::kTracker) : 0x0; - Bool_t kStoreIn(kTRUE), // - kPropagateIn(kTRUE), // + Bool_t kStoreIn(kTRUE), // toggel store track params. at TRD entry kStandAlone(kFALSE), // toggle tracker awarness of stand alone seeding kUseTRD(fkRecoParam->IsOverPtThreshold(t.Pt()));// use TRD measurment to update Kalman @@ -729,7 +728,7 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) // Loop through the TRD layers TGeoHMatrix *matrix = NULL; - Double_t x, y, z; + Double_t x(0.), y(0.), z(0.); for (Int_t ily=startLayer, sm=-1, stk=-1, det=-1; ily < AliTRDgeometry::kNlayer; ily++) { AliDebug(2, Form("Propagate to x[%d] = %7.2f", ily, fR[ily])); @@ -747,7 +746,6 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) stk = fGeom->GetStack(z, ily); det = stk>=0 ? AliTRDgeometry::GetDetector(ily, stk, sm) : -1; matrix = det>=0 ? fGeom->GetClusterMatrix(det) : NULL; - AliDebug(3, Form("Propagate to det[%3d]", det)); // check if supermodule/chamber is installed if( !fGeom->GetSMstatus(sm) || @@ -756,7 +754,7 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) !matrix ){ AliDebug(4, Form("Missing Geometry ly[%d]. Guess radial position", ily)); // propagate to the default radial position - if(fR[ily] > (fgkMaxStep + t.GetX()) && !PropagateToX(t, fR[ily], fgkMaxStep)){ + if(fR[ily] > (AliTRDReconstructor::GetMaxStep() + t.GetX()) && !PropagateToX(t, fR[ily], AliTRDReconstructor::GetMaxStep())){ n=-1; t.SetStatus(AliTRDtrackV1::kPropagation); AliDebug(4, "Failed Propagation [Missing Geometry]"); @@ -768,7 +766,7 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) AliDebug(4, "Failed Adjust Sector [Missing Geometry]"); break; } - if(TMath::Abs(t.GetSnp()) > fgkMaxSnp){ + if(TMath::Abs(t.GetSnp()) > AliTRDReconstructor::GetMaxSnp()){ n=-1; t.SetStatus(AliTRDtrackV1::kSnp); AliDebug(4, "Failed Max Snp [Missing Geometry]"); @@ -782,10 +780,11 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) Double_t loc[] = {AliTRDgeometry::AnodePos()- driftLength, 0., 0.}; Double_t glb[] = {0., 0., 0.}; matrix->LocalToMaster(loc, glb); + AliDebug(3, Form("Propagate to det[%3d] x_anode[%7.2f] (%f %f)", det, glb[0]+driftLength, glb[1], glb[2])); // Propagate to the radial distance of the current layer - x = glb[0] - fgkMaxStep; - if(x > (fgkMaxStep + t.GetX()) && !PropagateToX(t, x, fgkMaxStep)){ + x = glb[0] - AliTRDReconstructor::GetMaxStep(); + if(x > (AliTRDReconstructor::GetMaxStep() + t.GetX()) && !PropagateToX(t, x, AliTRDReconstructor::GetMaxStep())){ n=-1; t.SetStatus(AliTRDtrackV1::kPropagation); AliDebug(4, Form("Failed Initial Propagation to x[%7.2f]", x)); @@ -797,10 +796,10 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) AliDebug(4, "Failed Adjust Sector Start"); break; } - if(TMath::Abs(t.GetSnp()) > fgkMaxSnp) { + if(TMath::Abs(t.GetSnp()) > AliTRDReconstructor::GetMaxSnp()) { n=-1; t.SetStatus(AliTRDtrackV1::kSnp); - AliDebug(4, Form("Failed Max Snp[%f] MaxSnp[%f]", t.GetSnp(), fgkMaxSnp)); + AliDebug(4, Form("Failed Max Snp[%f] MaxSnp[%f]", t.GetSnp(), AliTRDReconstructor::GetMaxSnp())); break; } Bool_t doRecalculate = kFALSE; @@ -820,14 +819,14 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) continue; } matrix->LocalToMaster(loc, glb); - x = glb[0] - fgkMaxStep; + x = glb[0] - AliTRDReconstructor::GetMaxStep(); } // check if track is well inside fiducial volume - if (!t.GetProlongation(x+fgkMaxStep, y, z)) { + if (!t.GetProlongation(x+AliTRDReconstructor::GetMaxStep(), y, z)) { n=-1; t.SetStatus(AliTRDtrackV1::kProlongation); - AliDebug(4, Form("Failed Prolongation to x[%7.2f] y[%7.2f] z[%7.2f]", x+fgkMaxStep, y, z)); + AliDebug(4, Form("Failed Prolongation to x[%7.2f] y[%7.2f] z[%7.2f]", x+AliTRDReconstructor::GetMaxStep(), y, z)); break; } if(fGeom->IsOnBoundary(det, y, z, .5)){ @@ -835,11 +834,6 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) AliDebug(4, "Failed Track on Boundary"); continue; } - // mark track as entering the FIDUCIAL volume of TRD - if(kStoreIn){ - t.SetTrackIn(); - kStoreIn = kFALSE; - } ptrTracklet = tracklets[ily]; if(!ptrTracklet){ // BUILD TRACKLET @@ -868,24 +862,29 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) continue; } // build tracklet + tracklet.~AliTRDseedV1(); ptrTracklet = new(&tracklet) AliTRDseedV1(det); ptrTracklet->SetReconstructor(fkReconstructor); ptrTracklet->SetKink(t.IsKink()); ptrTracklet->SetPrimary(t.IsPrimary()); ptrTracklet->SetPadPlane(fGeom->GetPadPlane(ily, stk)); ptrTracklet->SetX0(glb[0]+driftLength); - if(!tracklet.Init(&t)){ + if(!ptrTracklet->Init(&t)){ n=-1; t.SetStatus(AliTRDtrackV1::kTrackletInit); AliDebug(4, "Failed Tracklet Init"); break; } - if(!tracklet.AttachClusters(chamber, kTRUE)){ + // Select attachment base on track to B field sign not only track charge which is buggy + // mark kFALSE same sign tracks and kTRUE opposite sign tracks + // A.Bercuci 3.11.2011 + Float_t prod(t.GetBz()*t.Charge()); + if(!ptrTracklet->AttachClusters(chamber, kTRUE, prod<0.?kTRUE:kFALSE, fEventInFile)){ t.SetStatus(AliTRDtrackV1::kNoAttach, ily); if(debugLevel>3){ AliTRDseedV1 trackletCp(*ptrTracklet); UChar_t status(t.GetStatusTRD(ily)); - (*cstreamer) << "FollowBackProlongation2" + (*cstreamer) << "FollowBackProlongation4" <<"status=" << status <<"tracklet.=" << &trackletCp << "\n"; @@ -893,13 +892,13 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) AliDebug(4, "Failed Attach Clusters"); continue; } - AliDebug(3, Form("Number of Clusters in Tracklet: %d", tracklet.GetN())); - if(tracklet.GetN() < fgNTimeBins*fkRecoParam ->GetFindableClusters()){ + AliDebug(3, Form("Number of Clusters in Tracklet: %d", ptrTracklet->GetN())); + if(ptrTracklet->GetN() < fgNTimeBins*fkRecoParam->GetFindableClusters()){ t.SetStatus(AliTRDtrackV1::kNoClustersTracklet, ily); if(debugLevel>3){ AliTRDseedV1 trackletCp(*ptrTracklet); UChar_t status(t.GetStatusTRD(ily)); - (*cstreamer) << "FollowBackProlongation2" + (*cstreamer) << "FollowBackProlongation4" <<"status=" << status <<"tracklet.=" << &trackletCp << "\n"; @@ -915,13 +914,13 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) // tilt correction options // 0 : no correction // 2 : pseudo tilt correction - if(!ptrTracklet->Fit(2)){ + if(!ptrTracklet->FitRobust(t.Charge()>0?kTRUE:kFALSE)){ t.SetStatus(AliTRDtrackV1::kNoFit, ily); AliDebug(4, "Failed Tracklet Fit"); continue; } x = ptrTracklet->GetX(); //GetX0(); - if(x > (fgkMaxStep + t.GetX()) && !PropagateToX(t, x, fgkMaxStep)) { + if(x > (AliTRDReconstructor::GetMaxStep() + t.GetX()) && !PropagateToX(t, x, AliTRDReconstructor::GetMaxStep())) { n=-1; t.SetStatus(AliTRDtrackV1::kPropagation); AliDebug(4, Form("Failed Propagation to Tracklet x[%7.2f]", x)); @@ -933,16 +932,12 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) AliDebug(4, "Failed Adjust Sector"); break; } - if(TMath::Abs(t.GetSnp()) > fgkMaxSnp) { + if(TMath::Abs(t.GetSnp()) > AliTRDReconstructor::GetMaxSnp()) { n=-1; t.SetStatus(AliTRDtrackV1::kSnp); - AliDebug(4, Form("Failed Max Snp[%f] MaxSnp[%f]", t.GetSnp(), fgkMaxSnp)); + AliDebug(4, Form("Failed Max Snp[%f] MaxSnp[%f]", t.GetSnp(), AliTRDReconstructor::GetMaxSnp())); break; } - if(kPropagateIn){ - t.SetTrackIn(); - kPropagateIn = kFALSE; - } Double_t cov[3]; ptrTracklet->GetCovAt(x, cov); Double_t p[2] = { ptrTracklet->GetY(), ptrTracklet->GetZ()}; Double_t chi2 = ((AliExternalTrackParam)t).GetPredictedChi2(p, cov); @@ -954,7 +949,7 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) AliTRDseedV1 trackletCp(*ptrTracklet); AliTRDtrackV1 trackCp(t); trackCp.SetOwner(); - (*cstreamer) << "FollowBackProlongation1" + (*cstreamer) << "FollowBackProlongation3" << "status=" << status << "tracklet.=" << &trackletCp << "track.=" << &trackCp @@ -963,6 +958,11 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) AliDebug(4, Form("Failed Chi2[%f]", chi2)); continue; } + // mark track as entering the FIDUCIAL volume of TRD + if(kStoreIn){ + t.SetTrackIn(); + kStoreIn = kFALSE; + } if(kUseTRD){ if(!((AliExternalTrackParam&)t).Update(p, cov)) { n=-1; @@ -972,7 +972,7 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) AliTRDseedV1 trackletCp(*ptrTracklet); AliTRDtrackV1 trackCp(t); trackCp.SetOwner(); - (*cstreamer) << "FollowBackProlongation1" + (*cstreamer) << "FollowBackProlongation3" << "status=" << status << "tracklet.=" << &trackletCp << "track.=" << &trackCp @@ -987,8 +987,11 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) AliTracker::FillResiduals(&t, p, cov, ptrTracklet->GetVolumeId()); - // load tracklet to the tracker - ptrTracklet->Update(&t); + // register tracklet with the tracker and track + // Save inside the tracklet the track parameters BEFORE track update. + // Commented out their overwriting AFTER track update + // A.Bercuci 3.11.2011 + //ptrTracklet->Update(&t); ptrTracklet = SetTracklet(ptrTracklet); Int_t index(fTracklets->GetEntriesFast()-1); t.SetTracklet(ptrTracklet, index); @@ -1010,13 +1013,12 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t) //printf("clusters[%d] chi2[%f] x[%f] status[%d ", n, t.GetChi2(), t.GetX(), t.GetStatusTRD()); //for(int i=0; i<6; i++) printf("%d ", t.GetStatusTRD(i)); printf("]\n"); - if(debugLevel > 1){ - Int_t eventNumber = AliTRDtrackerDebug::GetEventNumber(); + if(n && debugLevel > 1){ + //Int_t eventNumber = AliTRDtrackerDebug::GetEventNumber(); AliTRDtrackV1 track(t); track.SetOwner(); - (*cstreamer) << "FollowBackProlongation0" - << "EventNumber=" << eventNumber - << "ncl=" << n + (*cstreamer) << "FollowBackProlongation2" + << "EventNumber=" << fEventInFile << "track.=" << &track << "\n"; } @@ -1138,7 +1140,7 @@ Float_t AliTRDtrackerV1::FitTiltedRiemanConstraint(AliTRDseedV1 *tracklets, Doub if(!tracklets[ilr].IsOK()) continue; for(Int_t itb = 0; itb < AliTRDseedV1::kNclusters; itb++){ if(!tracklets[ilr].IsUsable(itb)) continue; - cl = tracklets[ilr].GetClusters(itb); + if(!(cl = tracklets[ilr].GetClusters(itb))) continue; if(!cl->IsInChamber()) continue; x = cl->GetX(); y = cl->GetY(); @@ -1675,7 +1677,8 @@ Double_t AliTRDtrackerV1::FitKalman(AliTRDtrackV1 *track, AliTRDseedV1 * const t //if(points) printf("First marker point @ x[%d] = %f\n", ip, points[ip].GetX()); - AliTRDseedV1 tracklet, *ptrTracklet = NULL; + AliTRDseedV1 tracklet; + AliTRDseedV1 *ptrTracklet = NULL; //Loop through the TRD planes for (Int_t jplane = 0; jplane < kNPlanes; jplane++) { @@ -1698,8 +1701,8 @@ Double_t AliTRDtrackerV1::FitKalman(AliTRDtrackV1 *track, AliTRDseedV1 * const t while(ip < np){ //don't do anything if next marker is after next update point. - if((up?-1:1) * (points[ip].GetX() - x) - fgkMaxStep < 0) break; - if(((up?-1:1) * (points[ip].GetX() - track->GetX()) < 0) && !PropagateToX(*track, points[ip].GetX(), fgkMaxStep)) return -1.; + if((up?-1:1) * (points[ip].GetX() - x) - AliTRDReconstructor::GetMaxStep() < 0) break; + if(((up?-1:1) * (points[ip].GetX() - track->GetX()) < 0) && !PropagateToX(*track, points[ip].GetX(), AliTRDReconstructor::GetMaxStep())) return -1.; Double_t xyz[3]; // should also get the covariance track->GetXYZ(xyz); @@ -1710,10 +1713,10 @@ Double_t AliTRDtrackerV1::FitKalman(AliTRDtrackV1 *track, AliTRDseedV1 * const t // printf("plane[%d] tracklet[%p] x[%f]\n", iplane, ptrTracklet, x); // Propagate closer to the next update point - if(((up?-1:1) * (x - track->GetX()) + fgkMaxStep < 0) && !PropagateToX(*track, x + (up?-1:1)*fgkMaxStep, fgkMaxStep)) return -1.; + if(((up?-1:1) * (x - track->GetX()) + AliTRDReconstructor::GetMaxStep() < 0) && !PropagateToX(*track, x + (up?-1:1)*AliTRDReconstructor::GetMaxStep(), AliTRDReconstructor::GetMaxStep())) return -1.; if(!AdjustSector(track)) return -1; - if(TMath::Abs(track->GetSnp()) > fgkMaxSnp) return -1; + if(TMath::Abs(track->GetSnp()) > AliTRDReconstructor::GetMaxSnp()) return -1; //load tracklet to the tracker and the track /* Int_t index; @@ -1762,7 +1765,7 @@ Double_t AliTRDtrackerV1::FitKalman(AliTRDtrackV1 *track, AliTRDseedV1 * const t // extrapolation while(ip < np){ - if(((up?-1:1) * (points[ip].GetX() - track->GetX()) < 0) && !PropagateToX(*track, points[ip].GetX(), fgkMaxStep)) return -1.; + if(((up?-1:1) * (points[ip].GetX() - track->GetX()) < 0) && !PropagateToX(*track, points[ip].GetX(), AliTRDReconstructor::GetMaxStep())) return -1.; Double_t xyz[3]; // should also get the covariance track->GetXYZ(xyz); @@ -1775,7 +1778,7 @@ Double_t AliTRDtrackerV1::FitKalman(AliTRDtrackV1 *track, AliTRDseedV1 * const t } //_________________________________________________________________________ -Float_t AliTRDtrackerV1::CalculateChi2Z(AliTRDseedV1 *tracklets, Double_t offset, Double_t slope, Double_t xref) +Float_t AliTRDtrackerV1::CalculateChi2Z(const AliTRDseedV1 *tracklets, Double_t offset, Double_t slope, Double_t xref) { // // Calculates the chi2-value of the track in z-Direction including tilting pad correction. @@ -1807,16 +1810,15 @@ Int_t AliTRDtrackerV1::PropagateToX(AliTRDtrackV1 &t, Double_t xToGo, Double_t m // Returns 1 if track reaches the plane, and 0 otherwise // - const Double_t kEpsilon = 0.00001; - // Current track X-position - Double_t xpos = t.GetX(); + Double_t xpos = t.GetX()/*, + mass = t.GetMass()*/; // Direction: inward or outward Double_t dir = (xpos < xToGo) ? 1.0 : -1.0; - while (((xToGo - xpos) * dir) > kEpsilon) { - + while (((xToGo - xpos) * dir) > AliTRDReconstructor::GetEpsilon()) { +// printf("to go %f\n", (xToGo - xpos) * dir); Double_t xyz0[3]; Double_t xyz1[3]; Double_t param[7]; @@ -1844,12 +1846,47 @@ Int_t AliTRDtrackerV1::PropagateToX(AliTRDtrackV1 &t, Double_t xToGo, Double_t m // Calculate the mean material budget between start and // end point of this prolongation step if(AliTracker::MeanMaterialBudget(xyz0, xyz1, param)<=0.) return 0; - + // Propagate the track to the X-position after the next step if (!t.PropagateTo(x, param[1], param[0]*param[4])) return 0; +/* // Correct for mean material budget + Double_t dEdx(0.), + bg(t.GetP()/mass); + if(AliLog::GetDebugLevel("TRD", "AliTRDtrackerV1")>=3){ + const char *pn[] = {"rho", "x/X0", "", "", "L", "", "Nb"}; + printf("D-AliTRDtrackerV1::PropagateTo(): x[%6.2f] bg[%6.2f]\n", xpos, bg); + printf(" param :: %s[%e] %s[%e] %s[%e] %s[%e] %s[%e] %s[%e] %s[%e]\n" + , pn[0], param[0] + , pn[1], param[1] + , pn[2], param[2] + , pn[3], param[3] + , pn[4], param[4] + , pn[5], param[5] + , pn[6], param[6]); + } + switch(fgBB){ + case kSolid: + dEdx = AliExternalTrackParam::BetheBlochSolid(bg); + break; + case kGas: + dEdx = AliExternalTrackParam::BetheBlochGas(bg); + break; + case kGeant: + { // mean exitation energy (GeV) + Double_t mee = ((param[3] < 13.) ? (12. * param[3] + 7.) : (9.76 * param[3] + 58.8 * TMath::Power(param[3],-0.19))) * 1.e-9; + Double_t mZA = param[5]>1.e-5?param[5]:(param[3]/param[2]); + if(AliLog::GetDebugLevel("TRD", "AliTRDtrackerV1")>=3) printf("D-AliTRDtrackerV1::PropagateTo(): Mee[%e] [%e]\n", mee, mZA); + // protect against failed calculation of rho in MeanMaterialBudget() + dEdx = AliExternalTrackParam::BetheBlochGeant(bg, param[0]>1.e-6?param[0]:2.33, 0.2, 3., mee, mZA); + } + break; + } + if(AliLog::GetDebugLevel("TRD", "AliTRDtrackerV1")>=2) printf("D-AliTRDtrackerV1::PropagateTo(): dEdx(bg=%e, m=%e)= %e[GeV/cm]\n", bg, mass, dEdx); + if (!t.CorrectForMeanMaterialdEdx(param[1], dir*param[0]*param[4], mass, dEdx)) return 0; +*/ // Rotate the track if necessary - AdjustSector(&t); + if(!AdjustSector(&t)) return 0; // New track X-position xpos = t.GetX(); @@ -1860,9 +1897,8 @@ Int_t AliTRDtrackerV1::PropagateToX(AliTRDtrackV1 &t, Double_t xToGo, Double_t m } - //_____________________________________________________________________________ -Int_t AliTRDtrackerV1::ReadClusters(TClonesArray* &array, TTree *clusterTree) const +Bool_t AliTRDtrackerV1::ReadClusters(TTree *clusterTree) { // // Reads AliTRDclusters from the file. @@ -1876,15 +1912,15 @@ Int_t AliTRDtrackerV1::ReadClusters(TClonesArray* &array, TTree *clusterTree) co TBranch *branch = clusterTree->GetBranch("TRDcluster"); if (!branch) { AliError("Can't get the branch !"); - return 1; + return kFALSE; } branch->SetAddress(&clusterArray); if(!fClusters){ Float_t nclusters = fkRecoParam->GetNClusters(); if(fkReconstructor->IsHLT()) nclusters /= AliTRDgeometry::kNsector; - array = new TClonesArray("AliTRDcluster", Int_t(nclusters)); - array->SetOwner(kTRUE); + fClusters = new TClonesArray("AliTRDcluster", Int_t(nclusters)); + fClusters->SetOwner(kTRUE); } // Loop through all entries in the tree @@ -1903,11 +1939,10 @@ Int_t AliTRDtrackerV1::ReadClusters(TClonesArray* &array, TTree *clusterTree) co new((*fClusters)[ncl++]) AliTRDcluster(*c); delete (clusterArray->RemoveAt(iCluster)); } - } delete clusterArray; - return 0; + return kTRUE; } //_____________________________________________________________________________ @@ -1922,7 +1957,7 @@ Int_t AliTRDtrackerV1::LoadClusters(TTree *cTree) if(!fkReconstructor->IsWritingClusters()){ fClusters = AliTRDReconstructor::GetClusters(); } else { - if (ReadClusters(fClusters, cTree)) { + if(!ReadClusters(cTree)) { AliError("Problem with reading the clusters !"); return 1; } @@ -2287,7 +2322,7 @@ Int_t AliTRDtrackerV1::Clusters2TracksStack(AliTRDtrackingChamber **stack, TClon if(!ntracks) break; // Sort the seeds according to their quality - Int_t sort[kMaxTracksStack]; + Int_t sort[kMaxTracksStack+1]; TMath::Sort(ntracks, fTrackQuality, sort, kTRUE); if(AliLog::GetDebugLevel("TRD", "AliTRDtrackerV1") > 2){ AliDebug(3, "Track candidates classification:"); @@ -2355,7 +2390,7 @@ Int_t AliTRDtrackerV1::Clusters2TracksStack(AliTRDtrackingChamber **stack, TClon break; case 1: // select shorter primary tracks, good quality - if(findable<4){skip = kTRUE; break;} + //if(findable<4){skip = kTRUE; break;} if(nlayers < findable){skip = kTRUE; break;} if(TMath::Log(1.E-9+fTrackQuality[trackIndex]) < -4.){skip = kTRUE; break;} break; @@ -2627,8 +2662,8 @@ Int_t AliTRDtrackerV1::MakeSeeds(AliTRDtrackingChamber **stack, AliTRDseedV1 * c for(int iLayer=0; iLayerGetClusterMatrix((*cIter)->GetDetector()))){ - continue; x0[iLayer] = fgkX0[iLayer]; + continue; } matrix->LocalToMaster(loc, glb); x0[iLayer] = glb[0]; @@ -3078,9 +3113,10 @@ AliTRDtrackV1* AliTRDtrackerV1::MakeTrack(AliTRDseedV1 * const tracklet) ptrTrack->CookPID(); // update calibration references using this track AliTRDCalibraFillHisto *calibra = AliTRDCalibraFillHisto::Instance(); - if (!calibra){ - AliInfo("Could not get Calibra instance\n"); - if(calibra->GetHisto2d()) calibra->UpdateHistogramsV1(ptrTrack); + if(!calibra){ + AliInfo("Could not get Calibra instance."); + } else if(calibra->GetHisto2d()){ + calibra->UpdateHistogramsV1(ptrTrack); } return ptrTrack; } @@ -3113,7 +3149,7 @@ Bool_t AliTRDtrackerV1::ImproveSeedQuality(AliTRDtrackingChamber **stack, AliTRD AliTRDseedV1 bseed[AliTRDgeometry::kNlayer]; Float_t quality(1.e3), - lQuality[] = {1.e3, 1.e3, 1.e3, 1.e3, 1.e3, 1.e3}; + lQuality[AliTRDgeometry::kNlayer] = {1.e3, 1.e3, 1.e3, 1.e3, 1.e3, 1.e3}; Int_t rLayers(0); for(Int_t jLayer=AliTRDgeometry::kNlayer; jLayer--;){ bseed[jLayer] = cseed[jLayer]; @@ -3128,7 +3164,7 @@ Bool_t AliTRDtrackerV1::ImproveSeedQuality(AliTRDtrackingChamber **stack, AliTRD for (Int_t iter = 0; iter < 4; iter++) { // Try better cluster set Int_t nLayers(0); Float_t qualitynew(0.); - Int_t indexes[6]; + Int_t indexes[4*AliTRDgeometry::kNlayer]; TMath::Sort(Int_t(AliTRDgeometry::kNlayer), lQuality, indexes, kFALSE); for(Int_t jLayer=AliTRDgeometry::kNlayer; jLayer--;) { Int_t bLayer = indexes[jLayer]; @@ -3791,6 +3827,7 @@ Double_t AliTRDtrackerV1::FitTiltedRiemanV1(AliTRDseedV1 *const tracklets){ //____________________________________________________________________ void AliTRDtrackerV1::UnsetTrackletsTrack(const AliTRDtrackV1 * const track) { +// Remove tracklets from tracker list attached to "track" Int_t idx(-1); for(Int_t il(0); ilGetTrackletIndex(il)) < 0) continue; @@ -3877,7 +3914,7 @@ Bool_t AliTRDtrackerV1::AliTRDLeastSquare::Eval(){ // Double_t det = fSums[0] * fSums[4] - fSums[1] *fSums[1]; - if(det==0) return kFALSE; + if(TMath::Abs(det)<1.e-30) return kFALSE; // for(Int_t isum = 0; isum < 5; isum++) // printf("fSums[%d] = %f\n", isum, fSums[isum]);