#include <TTreeStream.h>
#include "AliLog.h"
+#include "AliMathBase.h"
#include "AliESDEvent.h"
#include "AliGeomManager.h"
#include "AliRieman.h"
// Destructor
//
- if(fgRieman) delete fgRieman;
- if(fgTiltedRieman) delete fgTiltedRieman;
- if(fgTiltedRiemanConstrained) delete fgTiltedRiemanConstrained;
+ if(fgRieman) delete fgRieman; fgRieman = 0x0;
+ if(fgTiltedRieman) delete fgTiltedRieman; fgTiltedRieman = 0x0;
+ if(fgTiltedRiemanConstrained) delete fgTiltedRiemanConstrained; fgTiltedRiemanConstrained = 0x0;
for(Int_t isl =0; isl<kNSeedPlanes; isl++) if(fSeedTB[isl]) delete fSeedTB[isl];
if(fTracks) {fTracks->Delete(); delete fTracks;}
if(fTracklets) {fTracklets->Delete(); delete fTracklets;}
//____________________________________________________________________
AliRieman* AliTRDtrackerV1::GetRiemanFitter()
{
- if(!fgRieman) fgRieman = new AliRieman(AliTRDtrackingChamber::kNTimeBins * AliTRDgeometry::kNlayer);
+ if(!fgRieman) fgRieman = new AliRieman(AliTRDseedV1::kNtb * AliTRDgeometry::kNlayer);
return fgRieman;
}
quality[iSeed] = covariance[0] + covariance[2];
}
// Sort tracks according to covariance of local Y and Z
- TMath::Sort(nSeed,quality,index,kFALSE);
+ TMath::Sort(nSeed, quality, index,kFALSE);
}
// Backpropagate all seeds
// Do the back prolongation
new(&track) AliTRDtrackV1(*seed);
track.SetReconstructor(fReconstructor);
-
+ track.SetKink(Bool_t(seed->GetKinkIndex(0)));
//Int_t lbl = seed->GetLabel();
//track.SetSeedLabel(lbl);
// Make backup and mark entrance in the TRD
seed->UpdateTrackParams(&track, AliESDtrack::kTRDin);
seed->UpdateTrackParams(&track, AliESDtrack::kTRDbackup);
- Float_t p4 = track.GetC();
+ Float_t p4 = track.GetC(track.GetBz());
expectedClr = FollowBackProlongation(track);
if (expectedClr<0) continue; // Back prolongation failed
}
}
- if ((TMath::Abs(track.GetC() - p4) / TMath::Abs(p4) < 0.2) ||(track.Pt() > 0.8)) {
- //
+ if ((TMath::Abs(track.GetC(track.GetBz()) - 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());
track.CookLabel(1. - fgkLabelFraction);
- if(track.GetBackupTrack()) UseClusters(track.GetBackupTrack());
+ //if(track.GetBackupTrack()) UseClusters(track.GetBackupTrack());
// Sign only gold tracks
if (track.GetChi2() / track.GetNumberOfClusters() < 4) {
- if ((seed->GetKinkIndex(0) == 0) && (track.Pt() < 1.5)){
- //UseClusters(&track);
- }
+ //if ((seed->GetKinkIndex(0) == 0) && (track.Pt() < 1.5)) UseClusters(&track);
}
Bool_t isGold = kFALSE;
Double_t xtof = 371.0;
Double_t xTOF0 = 370.0;
- Double_t c2 = track.GetSnp() + track.GetC() * (xtof - track.GetX());
+ Double_t c2 = track.GetSnp() + track.GetC(track.GetBz()) * (xtof - track.GetX());
if (TMath::Abs(c2) >= 0.99) continue;
if (!PropagateToX(track, xTOF0, fgkMaxStep)) continue;
// Energy losses taken to the account - check one more time
- c2 = track.GetSnp() + track.GetC() * (xtof - track.GetX());
+ c2 = track.GetSnp() + track.GetC(track.GetBz()) * (xtof - track.GetX());
if (TMath::Abs(c2) >= 0.99) continue;
//if (!PropagateToX(*track,xTOF0,fgkMaxStep)) {
continue;
}
+ // reject tracks which failed propagation in the TRD or
+ // are produced by the TRD stand alone tracker
ULong_t status = seed->GetStatus();
- // reject tracks which failed propagation in the TRD
- if((status & AliESDtrack::kTRDout) == 0) continue;
-
- // reject tracks which are produced by the TRD stand alone track finder.
- if((status & AliESDtrack::kTRDin) == 0) continue;
+ if(!(status & AliESDtrack::kTRDout)) continue;
+ if(!(status & AliESDtrack::kTRDin)) continue;
nseed++;
track.ResetCovariance(50.0);
if(FollowProlongation(track)){
// Prolongate to TPC
if (PropagateToX(track, xTPC, fgkMaxStep)) { // -with update
- seed->UpdateTrackParams(&track, AliESDtrack::kTRDrefit);
- found++;
- kUPDATE = kTRUE;
+ seed->UpdateTrackParams(&track, AliESDtrack::kTRDrefit);
+ found++;
+ kUPDATE = kTRUE;
+ }
+
+ // Update the friend track
+ if (fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 0){
+ TObject *o = 0x0; Int_t ic = 0;
+ AliTRDtrackV1 *calibTrack = 0x0;
+ while((o = seed->GetCalibObject(ic++))){
+ if(!(calibTrack = dynamic_cast<AliTRDtrackV1*>(o))) continue;
+ calibTrack->SetTrackHigh(track.GetTrackHigh());
+ }
}
- }
+ }
// Prolongate to TPC without update
if(!kUPDATE) {
AliTRDtrackV1 tt(*seed);
- if (PropagateToX(tt, xTPC, fgkMaxStep)) seed->UpdateTrackParams(&tt, AliESDtrack::kTRDrefit);
+ if (PropagateToX(tt, xTPC, fgkMaxStep)) seed->UpdateTrackParams(&tt, AliESDtrack::kTRDbackup);
}
}
AliInfo(Form("Number of loaded seeds: %d",nseed));
// Debug level 2
//
+ Bool_t kStoreIn = kTRUE;
Int_t nClustersExpected = 0;
- Int_t lastplane = 5; //GetLastPlane(&t);
- for (Int_t iplane = lastplane; iplane >= 0; iplane--) {
+ for (Int_t iplane = kNPlanes; iplane--;) {
Int_t index = 0;
AliTRDseedV1 *tracklet = GetTracklet(&t, iplane, index);
if(!tracklet) continue;
if(!tracklet->IsOK()) AliWarning("tracklet not OK");
- Double_t x = tracklet->GetX0();
+ Double_t x = tracklet->GetX();//GetX0();
// reject tracklets which are not considered for inward refit
if(x > t.GetX()+fgkMaxStep) continue;
t.PropagateTo(x, xx0, xrho);
if (!AdjustSector(&t)) break;
}
-
+ if(kStoreIn){
+ t.SetTrackHigh();
+ kStoreIn = kFALSE;
+ }
+
Double_t maxChi2 = t.GetPredictedChi2(tracklet);
if (maxChi2 < 1e+10 && t.Update(tracklet, maxChi2)){
nClustersExpected += tracklet->GetN();
//
Int_t nClustersExpected = 0;
- Double_t clength = AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick();
+ Double_t clength = .5*AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick();
AliTRDtrackingChamber *chamber = 0x0;
AliTRDseedV1 tracklet, *ptrTracklet = 0x0;
tracklets[ip] = t.GetTracklet(ip);
t.UnsetTracklet(ip);
}
+ Bool_t kStoreIn = kTRUE;
+
// Loop through the TRD layers
- for (Int_t ilayer = 0; ilayer < AliTRDgeometry::Nlayer(); ilayer++) {
+ for (Int_t ilayer = 0; ilayer < kNPlanes; ilayer++) {
// BUILD TRACKLET IF NOT ALREADY BUILT
- Double_t x = 0., y, z, alpha;
+ Double_t x = 0., x0, y, z, alpha;
ptrTracklet = tracklets[ilayer];
if(!ptrTracklet){
ptrTracklet = new(&tracklet) AliTRDseedV1(ilayer);
ptrTracklet->SetReconstructor(fReconstructor);
+ ptrTracklet->SetKink(t.IsKink());
alpha = t.GetAlpha();
Int_t sector = Int_t(alpha/AliTRDgeometry::GetAlpha() + (alpha>0. ? 0 : AliTRDgeometry::kNsector));
if((x = fTrSec[sector].GetX(ilayer)) < 1.) continue;
+ // Propagate closer to the current layer
+ x0 = x - 1.5*clength;
+ if (x0 > (fgkMaxStep + t.GetX()) && !PropagateToX(t, x0-fgkMaxStep, fgkMaxStep)) return -1/*nClustersExpected*/;
+ if (!AdjustSector(&t)) return -1/*nClustersExpected*/;
+ if (TMath::Abs(t.GetSnp()) > fgkMaxSnp) return -1/*nClustersExpected*/;
+
if (!t.GetProlongation(x, y, z)) return -1/*nClustersExpected*/;
Int_t stack = fGeom->GetStack(z, ilayer);
Int_t nCandidates = stack >= 0 ? 1 : 2;
tracklet.SetPadLength(pp->GetLengthIPad());
tracklet.SetDetector(chamber->GetDetector());
tracklet.SetX0(x);
- if(!tracklet.Init(&t)){
- t.SetStopped(kTRUE);
- return nClustersExpected;
- }
- if(!tracklet.AttachClustersIter(chamber, 1000./*, kTRUE*/)) continue;
- tracklet.Init(&t);
+ tracklet.UpDate(&t);
+// if(!tracklet.Init(&t)){
+// t.SetStopped(kTRUE);
+// return nClustersExpected;
+// }
+ if(!tracklet.AttachClusters(chamber, kTRUE)) continue;
+ //if(!tracklet.AttachClustersIter(chamber, 1000.)) continue;
+ //tracklet.Init(&t);
if(tracklet.GetN() < fgNTimeBins*fReconstructor->GetRecoParam() ->GetFindableClusters()) continue;
break;
}
- //ptrTracklet->UseClusters();
- } else ptrTracklet->Init(&t);
+ ptrTracklet->UpdateUsed();
+ }
if(!ptrTracklet->IsOK()){
+ ptrTracklet->Reset();
if(x < 1.) continue; //temporary
if(!PropagateToX(t, x-fgkMaxStep, fgkMaxStep)) return -1/*nClustersExpected*/;
if(!AdjustSector(&t)) return -1/*nClustersExpected*/;
if (TMath::Abs(t.GetSnp()) > fgkMaxSnp) return -1/*nClustersExpected*/;
// load tracklet to the tracker and the track
+ ptrTracklet->UseClusters();
+ ptrTracklet->Fit(kFALSE); // no tilt correction
ptrTracklet = SetTracklet(ptrTracklet);
t.SetTracklet(ptrTracklet, fTracklets->GetEntriesFast()-1);
Double_t xyz0[3]; // entry point
t.GetXYZ(xyz0);
alpha = t.GetAlpha();
- x = ptrTracklet->GetX0();
+ x = ptrTracklet->GetX(); //GetX0();
if (!t.GetProlongation(x, y, z)) return -1/*nClustersExpected*/;
Double_t xyz1[3]; // exit point
xyz1[0] = x * TMath::Cos(alpha) - y * TMath::Sin(alpha);
// Propagate and update track
if (!t.PropagateTo(x, xx0, xrho)) return -1/*nClustersExpected*/;
if (!AdjustSector(&t)) return -1/*nClustersExpected*/;
+
+ if(kStoreIn){
+ t.SetTrackLow();
+ kStoreIn = kFALSE;
+ }
Double_t maxChi2 = t.GetPredictedChi2(ptrTracklet);
if (!t.Update(ptrTracklet, maxChi2)) return -1/*nClustersExpected*/;
+ ptrTracklet->UpDate(&t);
+
if (maxChi2<1e+10) {
nClustersExpected += ptrTracklet->GetN();
//t.SetTracklet(&tracklet, index);
//(ratio0+ratio1 > 1.5) &&
(t.GetNCross() == 0) &&
(TMath::Abs(t.GetSnp()) < 0.85) &&
- (t.GetNumberOfClusters() > 20)) t.MakeBackupTrack();
-
+ (t.GetNumberOfClusters() > 20)){
+ t.MakeBackupTrack();
+ }
} // end layers loop
if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 1){
}
for(Int_t il = 0; il < maxLayers; il++){
if(!tracklets[ppl[il]].IsOK()) continue;
- fitter->AddPoint(tracklets[ppl[il]].GetX0(), tracklets[ppl[il]].GetYfitR(0), tracklets[ppl[il]].GetZProb(),1,10);
+ fitter->AddPoint(tracklets[ppl[il]].GetX0(), tracklets[ppl[il]].GetYfit(0), tracklets[ppl[il]].GetZfit(0),1,10);
}
fitter->Update();
// Set the reference position of the fit and calculate the chi2 values
Int_t nPoints = 0;
for(Int_t ilr = 0; ilr < AliTRDgeometry::kNlayer; ilr++){
if(!tracklets[ilr].IsOK()) continue;
- for(Int_t itb = 0; itb < fgNTimeBins; itb++){
+ for(Int_t itb = 0; itb < AliTRDseedV1::kNTimeBins; itb++){
if(!tracklets[ilr].IsUsable(itb)) continue;
cl = tracklets[ilr].GetClusters(itb);
x = cl->GetX();
uvt[0] = 2. * x * t;
uvt[1] = 2. * x * t * tilt ;
w = 2. * (y + tilt * (z - zVertex)) * t;
- error = 2. * 0.2 * t;
+ error = 2. * TMath::Sqrt(cl->GetSigmaY2()) * t;
fitter->AddPoint(uvt, w, error);
nPoints++;
}
Float_t chi2track = fitter->GetChisquare()/Double_t(nPoints);
for(Int_t ip = 0; ip < AliTRDtrackerV1::kNPlanes; ip++)
- tracklets[ip].SetCC(curvature);
+ tracklets[ip].SetC(curvature);
/* if(fReconstructor->GetStreamLevel() >= 5){
//Linear Model on z-direction
// Containers for Least-square fitter
for(Int_t ipl = 0; ipl < kNPlanes; ipl++){
if(!tracklets[ipl].IsOK()) continue;
- for(Int_t itb = 0; itb < fgNTimeBins; itb++){
+ for(Int_t itb = 0; itb < AliTRDseedV1::kNTimeBins; itb++){
if(!(cl = tracklets[ipl].GetClusters(itb))) continue;
if (!tracklets[ipl].IsUsable(itb)) continue;
x = cl->GetX();
w = 2. * (y + tilt*z) * t;
// error definition changes for the different calls
we = 2. * t;
- we *= sigError ? tracklets[ipl].GetSigmaY() : 0.2;
+ we *= sigError ? TMath::Sqrt(cl->GetSigmaY2()) : 0.2;
fitter->AddPoint(uvt, w, we);
zfitter.AddPoint(&x, z, static_cast<Double_t>(TMath::Sqrt(cl->GetSigmaZ2())));
nPoints++;
for (Int_t iLayer = 0; iLayer < kNPlanes; iLayer++) {
if(!tracklets[iLayer].IsOK()) continue;
zref = offset + slope * (tracklets[iLayer].GetX0() - xref);
- if (TMath::Abs(tracklets[iLayer].GetZProb() - zref) > tracklets[iLayer].GetPadLength() * 0.5 + 1.0)
+ if (TMath::Abs(tracklets[iLayer].GetZfit(0) - zref) > tracklets[iLayer].GetPadLength() * 0.5 + 1.0)
acceptablez = kFALSE;
}
if (!acceptablez) {
// Containers for Least-square fitter
for(Int_t ipl = 0; ipl < kNPlanes; ipl++){
if(!tracklets[ipl].IsOK()) continue;
- for(Int_t itb = 0; itb < fgNTimeBins; itb++){
+ for(Int_t itb = 0; itb < AliTRDseedV1::kNTimeBins; itb++){
if(!(cl = tracklets[ipl].GetClusters(itb))) continue;
if (!tracklets[ipl].IsUsable(itb)) continue;
x = cl->GetX();
w = 2. * (y + tilt*z) * t;
// error definition changes for the different calls
we = 2. * t;
- we *= sigError ? tracklets[ipl].GetSigmaY() : 0.2;
+ we *= sigError ? TMath::Sqrt(cl->GetSigmaY2()) : 0.2;
fitter->AddPoint(uvt, w, we);
zfitter.AddPoint(&x, z, static_cast<Double_t>(TMath::Sqrt(cl->GetSigmaZ2())));
nPoints++;
for (Int_t iLayer = 0; iLayer < kNPlanes; iLayer++) {
if(!tracklets[iLayer].IsOK()) continue;
zref = z0 + dzdx * (tracklets[iLayer].GetX0() - xref);
- if (TMath::Abs(tracklets[iLayer].GetZProb() - zref) > tracklets[iLayer].GetPadLength() * 0.5 + 1.0)
+ if (TMath::Abs(tracklets[iLayer].GetZfit(0) - zref) > tracklets[iLayer].GetPadLength() * 0.5 + 1.0)
accept = kFALSE;
}
if (!accept) {
Float_t xyz[3];
for(int ip=0; ip<np; ip++){
points[ip].GetXYZ(xyz);
- xyz[1] = TMath::Abs(xyz[0] - x0) > R ? 100. : y0 - (y0>0.?1.:-1.)*TMath::Sqrt(R*R-(xyz[0]-x0)*(xyz[0]-x0));
+ xyz[1] = TMath::Abs(xyz[0] - x0) > R ? 100. : y0 - (y0>0.?1.:-1.)*TMath::Sqrt((R-(xyz[0]-x0))*(R+(xyz[0]-x0)));
xyz[2] = z0 + dzdx * (xyz[0] - xref);
points[ip].SetXYZ(xyz);
}
for (Int_t iLayer = 0; iLayer < AliTRDgeometry::kNlayer; iLayer++) {
if(!tracklets[iLayer].IsOK()) continue;
Double_t z = offset + slope * (tracklets[iLayer].GetX0() - xref);
- chi2Z += TMath::Abs(tracklets[iLayer].GetMeanz() - z);
+ chi2Z += TMath::Abs(tracklets[iLayer].GetZfit(0) - z);
nLayers++;
}
chi2Z /= TMath::Max((nLayers - 3.0),1.0);
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;
- }
+ if (!t.PropagateTo(x, param[1], param[0]*param[4])) return 0;
// Rotate the track if necessary
AdjustSector(&t);
AliTRDtrackerDebug::SetEventNumber(AliTRDtrackerDebug::GetEventNumber() + 1);
}
+// //____________________________________________________________________
+// void AliTRDtrackerV1::UseClusters(const AliKalmanTrack *t, Int_t) const
+// {
+// const AliTRDtrackV1 *track = dynamic_cast<const AliTRDtrackV1*>(t);
+// if(!track) return;
+//
+// AliTRDseedV1 *tracklet = 0x0;
+// for(Int_t ily=AliTRDgeometry::kNlayer; ily--;){
+// if(!(tracklet = track->GetTracklet(ily))) continue;
+// AliTRDcluster *c = 0x0;
+// for(Int_t ic=AliTRDseed::knTimebins; ic--;){
+// if(!(c=tracklet->GetClusters(ic))) continue;
+// c->Use();
+// }
+// }
+// }
+//
+
//_____________________________________________________________________________
Bool_t AliTRDtrackerV1::AdjustSector(AliTRDtrackV1 *track)
{
const AliTRDCalDet *cal = AliTRDcalibDB::Instance()->GetT0Det();
AliTRDtrackingChamber *chamber = 0x0;
+ AliTRDtrackingChamber **ci = 0x0;
AliTRDseedV1 sseed[kMaxTracksStack*6]; // to be initialized
Int_t pars[4]; // MakeSeeds parameters
//Double_t shift = .5 * alpha;
Int_t configs[kNConfigs];
+ // Purge used clusters from the containers
+ ci = &stack[0];
+ for(Int_t ic = kNPlanes; ic--; ci++){
+ if(!(*ci)) continue;
+ (*ci)->Update();
+ }
+
// Build initial seeding configurations
Double_t quality = BuildSeedingConfigs(stack, configs);
if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 1){
fSieveSeeding = 0;
// Get stack index
- Int_t ic = 0; AliTRDtrackingChamber **cIter = &stack[0];
- while(ic<kNPlanes && !(*cIter)){ic++; cIter++;}
- if(!(*cIter)) return ntracks2;
- Int_t istack = fGeom->GetStack((*cIter)->GetDetector());
+ Int_t ic = 0; ci = &stack[0];
+ while(ic<kNPlanes && !(*ci)){ic++; ci++;}
+ if(!(*ci)) return ntracks2;
+ Int_t istack = fGeom->GetStack((*ci)->GetDetector());
do{
// Loop over seeding configurations
for (Int_t jLayer = 0; jLayer < kNPlanes; jLayer++) {
Int_t jseed = kNPlanes*trackIndex+jLayer;
if(!sseed[jseed].IsOK()) continue;
- if (TMath::Abs(sseed[jseed].GetYref(0) / sseed[jseed].GetX0()) < 0.15) findable++;
+ if (TMath::Abs(sseed[jseed].GetYref(0) / sseed[jseed].GetX0()) < 0.158) findable++;
sseed[jseed].UpdateUsed();
ncl += sseed[jseed].GetN2();
nlayers++;
}
- // Filter duplicated tracks
- if (nused > 30){
- //printf("Skip %d nused %d\n", trackIndex, nused);
- fakeTrack[trackIndex] = kTRUE;
- continue;
- }
- if (Float_t(nused)/ncl >= .25){
- //printf("Skip %d nused/ncl >= .25\n", trackIndex);
- fakeTrack[trackIndex] = kTRUE;
- continue;
- }
-
- // Classify tracks
- Bool_t skip = kFALSE;
- switch(jSieve){
- case 0:
- if(nlayers < 6) {skip = kTRUE; break;}
- if(TMath::Log(1.E-9+fTrackQuality[trackIndex]) < -5.){skip = kTRUE; break;}
- break;
-
- case 1:
- if(nlayers < findable){skip = kTRUE; break;}
- if(TMath::Log(1.E-9+fTrackQuality[trackIndex]) < -4.){skip = kTRUE; break;}
- break;
-
- case 2:
- if ((nlayers == findable) || (nlayers == 6)) { skip = kTRUE; break;}
- if (TMath::Log(1.E-9+fTrackQuality[trackIndex]) < -6.0){skip = kTRUE; break;}
- break;
-
- case 3:
- if (TMath::Log(1.E-9+fTrackQuality[trackIndex]) < -5.){skip = kTRUE; break;}
- break;
-
- 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;}
- break;
- }
- if(skip){
- candidates++;
- //printf("REJECTED : %d [%d] nlayers %d trackQuality = %e nused %d\n", itrack, trackIndex, nlayers, fTrackQuality[trackIndex], nused);
- continue;
- }
- signedTrack[trackIndex] = kTRUE;
-
-
- // Sign clusters
- AliTRDcluster *cl = 0x0; Int_t clusterIndex = -1;
- for (Int_t jLayer = 0; jLayer < kNPlanes; jLayer++) {
- Int_t jseed = kNPlanes*trackIndex+jLayer;
- if(!sseed[jseed].IsOK()) continue;
- if(TMath::Abs(sseed[jseed].GetYfit(1) - sseed[jseed].GetYfit(1)) >= .2) continue; // check this condition with Marian
- sseed[jseed].UseClusters();
- if(!cl){
- ic = 0;
- while(!(cl = sseed[jseed].GetClusters(ic))) ic++;
- clusterIndex = sseed[jseed].GetIndexes(ic);
- }
- }
- if(!cl) continue;
-
-
- // Build track parameters
- AliTRDseedV1 *lseed =&sseed[trackIndex*6];
-/* Int_t idx = 0;
- while(idx<3 && !lseed->IsOK()) {
- idx++;
- lseed++;
- }*/
- Double_t x = lseed->GetX0();// - 3.5;
- trackParams[0] = x; //NEW AB
- trackParams[1] = lseed->GetYref(0); // lseed->GetYat(x);
- trackParams[2] = lseed->GetZref(0); // lseed->GetZat(x);
- trackParams[3] = TMath::Sin(TMath::ATan(lseed->GetYref(1)));
- trackParams[4] = lseed->GetZref(1) / TMath::Sqrt(1. + lseed->GetYref(1) * lseed->GetYref(1));
- trackParams[5] = lseed->GetC();
- Int_t ich = 0; while(!(chamber = stack[ich])) ich++;
- trackParams[6] = fGeom->GetSector(chamber->GetDetector());/* *alpha+shift; // Supermodule*/
+ // Filter duplicated tracks
+ if (nused > 30){
+ //printf("Skip %d nused %d\n", trackIndex, nused);
+ fakeTrack[trackIndex] = kTRUE;
+ continue;
+ }
+ if (Float_t(nused)/ncl >= .25){
+ //printf("Skip %d nused/ncl >= .25\n", trackIndex);
+ fakeTrack[trackIndex] = kTRUE;
+ continue;
+ }
- if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 1){
- AliInfo(Form("Track %d [%d] nlayers %d trackQuality = %e nused %d, yref = %3.3f", itrack, trackIndex, nlayers, fTrackQuality[trackIndex], nused, trackParams[1]));
-
- Int_t nclusters = 0;
- AliTRDseedV1 *dseed[6];
-
- // Build track label - what happens if measured data ???
- Int_t labels[1000];
- Int_t outlab[1000];
- Int_t nlab = 0;
-
- Int_t labelsall[1000];
- Int_t nlabelsall = 0;
- Int_t naccepted = 0;
-
- for (Int_t iLayer = 0; iLayer < kNPlanes; iLayer++) {
- Int_t jseed = kNPlanes*trackIndex+iLayer;
- dseed[iLayer] = new AliTRDseedV1(sseed[jseed]);
- dseed[iLayer]->SetOwner();
- nclusters += sseed[jseed].GetN2();
- if(!sseed[jseed].IsOK()) continue;
- for(int ilab=0; ilab<2; ilab++){
- if(sseed[jseed].GetLabels(ilab) < 0) continue;
- labels[nlab] = sseed[jseed].GetLabels(ilab);
- nlab++;
- }
+ // Classify tracks
+ Bool_t skip = kFALSE;
+ switch(jSieve){
+ case 0:
+ if(nlayers < 6) {skip = kTRUE; break;}
+ if(TMath::Log(1.E-9+fTrackQuality[trackIndex]) < -5.){skip = kTRUE; break;}
+ break;
+
+ case 1:
+ if(nlayers < findable){skip = kTRUE; break;}
+ if(TMath::Log(1.E-9+fTrackQuality[trackIndex]) < -4.){skip = kTRUE; break;}
+ break;
+
+ case 2:
+ if ((nlayers == findable) || (nlayers == 6)) { skip = kTRUE; break;}
+ if (TMath::Log(1.E-9+fTrackQuality[trackIndex]) < -6.0){skip = kTRUE; break;}
+ break;
+
+ case 3:
+ if (TMath::Log(1.E-9+fTrackQuality[trackIndex]) < -5.){skip = kTRUE; break;}
+ break;
+
+ 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;}
+ break;
+ }
+ if(skip){
+ candidates++;
+ //printf("REJECTED : %d [%d] nlayers %d trackQuality = %e nused %d\n", itrack, trackIndex, nlayers, fTrackQuality[trackIndex], nused);
+ continue;
+ }
+ signedTrack[trackIndex] = kTRUE;
+
+ // Build track parameters
+ AliTRDseedV1 *lseed =&sseed[trackIndex*6];
+ /* Int_t idx = 0;
+ while(idx<3 && !lseed->IsOK()) {
+ idx++;
+ lseed++;
+ }*/
+ Double_t x = lseed->GetX0();// - 3.5;
+ trackParams[0] = x; //NEW AB
+ trackParams[1] = lseed->GetYref(0); // lseed->GetYat(x);
+ trackParams[2] = lseed->GetZref(0); // lseed->GetZat(x);
+ trackParams[3] = TMath::Sin(TMath::ATan(lseed->GetYref(1)));
+ trackParams[4] = lseed->GetZref(1) / TMath::Sqrt(1. + lseed->GetYref(1) * lseed->GetYref(1));
+ trackParams[5] = lseed->GetC();
+ Int_t ich = 0; while(!(chamber = stack[ich])) ich++;
+ trackParams[6] = fGeom->GetSector(chamber->GetDetector());/* *alpha+shift; // Supermodule*/
+
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 1){
+ AliInfo(Form("Track %d [%d] nlayers %d trackQuality = %e nused %d, yref = %3.3f", itrack, trackIndex, nlayers, fTrackQuality[trackIndex], nused, trackParams[1]));
+
+ AliTRDseedV1 *dseed[6];
+ memcpy(dseed, lseed, 6*sizeof(AliTRDseedV1*));
+
+ //Int_t eventNrInFile = esd->GetEventNumberInFile();
+ //AliInfo(Form("Number of clusters %d.", nclusters));
+ Int_t eventNumber = AliTRDtrackerDebug::GetEventNumber();
+ Int_t trackNumber = AliTRDtrackerDebug::GetTrackNumber();
+ Int_t candidateNumber = AliTRDtrackerDebug::GetCandidateNumber();
+ TTreeSRedirector &cstreamer = *fReconstructor->GetDebugStream(AliTRDReconstructor::kTracker);
+ cstreamer << "Clusters2TracksStack"
+ << "EventNumber=" << eventNumber
+ << "TrackNumber=" << trackNumber
+ << "CandidateNumber=" << candidateNumber
+ << "Iter=" << fSieveSeeding
+ << "Like=" << fTrackQuality[trackIndex]
+ << "S0.=" << dseed[0]
+ << "S1.=" << dseed[1]
+ << "S2.=" << dseed[2]
+ << "S3.=" << dseed[3]
+ << "S4.=" << dseed[4]
+ << "S5.=" << dseed[5]
+ << "p0=" << trackParams[0]
+ << "p1=" << trackParams[1]
+ << "p2=" << trackParams[2]
+ << "p3=" << trackParams[3]
+ << "p4=" << trackParams[4]
+ << "p5=" << trackParams[5]
+ << "p6=" << trackParams[6]
+ << "Ncl=" << ncl
+ << "NLayers=" << nlayers
+ << "Findable=" << findable
+ << "NUsed=" << nused
+ << "\n";
+ }
- // Cooking label
- for (Int_t itime = 0; itime < fgNTimeBins; itime++) {
- if(!sseed[jseed].IsUsable(itime)) continue;
- naccepted++;
- Int_t tindex = 0, ilab = 0;
- while(ilab<3 && (tindex = sseed[jseed].GetClusters(itime)->GetLabel(ilab)) >= 0){
- labelsall[nlabelsall++] = tindex;
- ilab++;
+ AliTRDtrackV1 *track = MakeTrack(&sseed[trackIndex*kNPlanes], trackParams);
+ if(!track){
+ AliWarning("Fail to build a TRD Track.");
+ continue;
}
- }
- }
- Freq(nlab,labels,outlab,kFALSE);
- Int_t label = outlab[0];
- Int_t frequency = outlab[1];
- Freq(nlabelsall,labelsall,outlab,kFALSE);
- Int_t label1 = outlab[0];
- Int_t label2 = outlab[2];
- Float_t fakeratio = (naccepted - outlab[1]) / Float_t(naccepted);
-
- //Int_t eventNrInFile = esd->GetEventNumberInFile();
- //AliInfo(Form("Number of clusters %d.", nclusters));
- Int_t eventNumber = AliTRDtrackerDebug::GetEventNumber();
- Int_t trackNumber = AliTRDtrackerDebug::GetTrackNumber();
- Int_t candidateNumber = AliTRDtrackerDebug::GetCandidateNumber();
- TTreeSRedirector &cstreamer = *fReconstructor->GetDebugStream(AliTRDReconstructor::kTracker);
- cstreamer << "Clusters2TracksStack"
- << "EventNumber=" << eventNumber
- << "TrackNumber=" << trackNumber
- << "CandidateNumber=" << candidateNumber
- << "Iter=" << fSieveSeeding
- << "Like=" << fTrackQuality[trackIndex]
- << "S0.=" << dseed[0]
- << "S1.=" << dseed[1]
- << "S2.=" << dseed[2]
- << "S3.=" << dseed[3]
- << "S4.=" << dseed[4]
- << "S5.=" << dseed[5]
- << "p0=" << trackParams[0]
- << "p1=" << trackParams[1]
- << "p2=" << trackParams[2]
- << "p3=" << trackParams[3]
- << "p4=" << trackParams[4]
- << "p5=" << trackParams[5]
- << "p6=" << trackParams[6]
- << "Label=" << label
- << "Label1=" << label1
- << "Label2=" << label2
- << "FakeRatio=" << fakeratio
- << "Freq=" << frequency
- << "Ncl=" << ncl
- << "NLayers=" << nlayers
- << "Findable=" << findable
- << "NUsed=" << nused
- << "\n";
- }
- AliTRDtrackV1 *track = MakeTrack(&sseed[trackIndex*kNPlanes], trackParams);
- if(!track){
- AliWarning("Fail to build a TRD Track.");
- continue;
- }
-
- //AliInfo("End of MakeTrack()");
- AliESDtrack *esdTrack = new ((*esdTrackList)[ntracks0++]) AliESDtrack();
- esdTrack->UpdateTrackParams(track, AliESDtrack::kTRDout);
- esdTrack->SetLabel(track->GetLabel());
- track->UpdateESDtrack(esdTrack);
- // write ESD-friends if neccessary
- if (fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 0){
- AliTRDtrackV1 *calibTrack = new AliTRDtrackV1(*track);
- calibTrack->SetOwner();
- esdTrack->AddCalibObject(calibTrack);
- }
- ntracks1++;
- AliTRDtrackerDebug::SetTrackNumber(AliTRDtrackerDebug::GetTrackNumber() + 1);
+ //AliInfo("End of MakeTrack()");
+ AliESDtrack *esdTrack = new ((*esdTrackList)[ntracks0++]) AliESDtrack();
+ esdTrack->UpdateTrackParams(track, AliESDtrack::kTRDout);
+ esdTrack->SetLabel(track->GetLabel());
+ track->UpdateESDtrack(esdTrack);
+ // write ESD-friends if neccessary
+ if (fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 0){
+ AliTRDtrackV1 *calibTrack = new AliTRDtrackV1(*track);
+ calibTrack->SetOwner();
+ esdTrack->AddCalibObject(calibTrack);
+ }
+ ntracks1++;
+ AliTRDtrackerDebug::SetTrackNumber(AliTRDtrackerDebug::GetTrackNumber() + 1);
}
jSieve++;
tseed->SetReconstructor(fReconstructor);
tseed->SetX0((*cIter) ? (*cIter)->GetX() : x_def[iLayer]);
tseed->Init(GetRiemanFitter());
+ tseed->SetStandAlone(kTRUE);
}
Bool_t isFake = kFALSE;
//AliInfo("Passed chi2 filter.");
// try attaching clusters to tracklets
- Int_t nUsedCl = 0;
Int_t mlayers = 0;
for(int iLayer=0; iLayer<kNSeedPlanes; iLayer++){
Int_t jLayer = planes[iLayer];
- if(!cseed[jLayer].AttachClustersIter(stack[jLayer], 5., kFALSE, c[iLayer])) continue;
- nUsedCl += cseed[jLayer].GetNUsed();
- if(nUsedCl > 25) break;
+ if(!cseed[jLayer].AttachClusters(stack[jLayer], kTRUE)) continue;
+ cseed[jLayer].UpdateUsed();
+ if(!cseed[jLayer].IsOK()) continue;
mlayers++;
}
for(int iLayer=0; iLayer<kNPlanes-kNSeedPlanes; iLayer++){
Int_t jLayer = planesExt[iLayer];
if(!(chamber = stack[jLayer])) continue;
- cseed[jLayer].AttachClustersIter(chamber, 1000.);
+ cseed[jLayer].AttachClusters(chamber, kTRUE);
}
fTrackQuality[ntracks] = 1.; // dummy value
ntracks++;
}
+ // Update Seeds and calculate Likelihood
// fit tracklets and cook likelihood
- FitTiltedRieman(&cseed[0], kTRUE);// Update Seeds and calculate Likelihood
+ FitTiltedRieman(&cseed[0], kTRUE);
+ for(int iLayer=0; iLayer<kNSeedPlanes; iLayer++){
+ Int_t jLayer = planes[iLayer];
+ cseed[jLayer].Fit(kTRUE);
+ }
Double_t like = CookLikelihood(&cseed[0], planes); // to be checked
if (TMath::Log(1.E-9 + like) < fReconstructor->GetRecoParam() ->GetTrackLikelihood()){
fSeedLayer[ntracks] = config;/*sLayer;*/
// attach clusters to the extrapolation seeds
- Int_t nusedf = 0; // debug value
for(int iLayer=0; iLayer<kNPlanes-kNSeedPlanes; iLayer++){
Int_t jLayer = planesExt[iLayer];
if(!(chamber = stack[jLayer])) continue;
if ((jLayer == 0) && !(cseed[1].IsOK())) continue;
if ((jLayer == 5) && !(cseed[4].IsOK())) continue;
AliTRDseedV1 pseed = cseed[jLayer];
- if(!pseed.AttachClustersIter(chamber, 1000.)) continue;
+ if(!pseed.AttachClusters(chamber, kTRUE)) continue;
+ pseed.Fit(kTRUE);
cseed[jLayer] = pseed;
- nusedf += cseed[jLayer].GetNUsed(); // debug value
FitTiltedRieman(cseed, kTRUE);
+ cseed[jLayer].Fit(kTRUE);
}
// AliInfo("Extrapolation done.");
//chi2Vals[2] = GetChi2ZTest(&cseed[0]);
fTrackQuality[ntracks] = CalculateTrackLikelihood(&cseed[0], &chi2Vals[0]);
//AliInfo("Hyperplane fit done\n");
-
- // finalize tracklets
- Int_t labels[12];
- Int_t outlab[24];
- Int_t nlab = 0;
- for (Int_t iLayer = 0; iLayer < 6; iLayer++) {
- if (!cseed[iLayer].IsOK()) continue;
-
- if (cseed[iLayer].GetLabels(0) >= 0) {
- labels[nlab] = cseed[iLayer].GetLabels(0);
- nlab++;
- }
-
- if (cseed[iLayer].GetLabels(1) >= 0) {
- labels[nlab] = cseed[iLayer].GetLabels(1);
- nlab++;
- }
- }
- Freq(nlab,labels,outlab,kFALSE);
- Int_t label = outlab[0];
- Int_t frequency = outlab[1];
- for (Int_t iLayer = 0; iLayer < 6; iLayer++) {
- cseed[iLayer].SetFreq(frequency);
- cseed[iLayer].SetChi2Z(chi2[1]);
- }
-
+
if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) >= 2){
TTreeSRedirector &cstreamer = *fReconstructor->GetDebugStream(AliTRDReconstructor::kTracker);
Int_t eventNumber = AliTRDtrackerDebug::GetEventNumber();
<< "Chi2TC=" << chi2Vals[1]
<< "Nlayers=" << mlayers
<< "NClusters=" << ncls
- << "NUsedS=" << nUsedCl
- << "NUsed=" << nusedf
<< "Like=" << like
<< "S0.=" << &cseed[0]
<< "S1.=" << &cseed[1]
<< "S3.=" << &cseed[3]
<< "S4.=" << &cseed[4]
<< "S5.=" << &cseed[5]
- << "Label=" << label
- << "Freq=" << frequency
<< "FitterT.=" << fitterT
<< "FitterTC.=" << fitterTC
<< "\n";
AliTRDtrackV1 track(seeds, ¶ms[1], c, params[0], params[6]*alpha+shift);
track.PropagateTo(params[0]-5.0);
+ AliTRDseedV1 *ptrTracklet = 0x0;
+ // Sign clusters
+ for (Int_t jLayer = 0; jLayer < AliTRDgeometry::kNlayer; jLayer++) {
+ ptrTracklet = &seeds[jLayer];
+ if(!ptrTracklet->IsOK()) continue;
+ if(TMath::Abs(ptrTracklet->GetYref(1) - ptrTracklet->GetYfit(1)) >= .2) continue; // check this condition with Marian
+ }
+ //
if(fReconstructor->IsHLT()){
- AliTRDseedV1 *ptrTracklet = 0x0;
for(Int_t ip=0; ip<kNPlanes; ip++){
track.UnsetTracklet(ip);
ptrTracklet = SetTracklet(&seeds[ip]);
+ ptrTracklet->UseClusters();
track.SetTracklet(ptrTracklet, fTracklets->GetEntriesFast()-1);
}
AliTRDtrackV1 *ptrTrack = SetTrack(&track);
// layers : Array of propagation layers for a stack/supermodule
// cseed : Array of 6 seeding tracklets which has to be improved
//
- // Output :
+ // Output :
// cssed : Improved seeds
//
// Detailed description
for (Int_t jLayer = 5; jLayer > 1; jLayer--) {
Int_t bLayer = sortindexes[jLayer];
if(!(chamber = stack[bLayer])) continue;
- bseed[bLayer].AttachClustersIter(chamber, squality[bLayer], kTRUE);
+ bseed[bLayer].AttachClusters(chamber, kTRUE);
+ bseed[bLayer].Fit(kTRUE);
if(bseed[bLayer].IsOK()) nLayers++;
}
<< "\n";
}
} // Loop: iter
-
// we are sure that at least 2 tracklets are OK !
return nLayers+2;
}
// debug level 2
//
- Double_t sumdaf = 0, nLayers = 0;
+ Double_t chi2phi = 0, nLayers = 0;
for (Int_t iLayer = 0; iLayer < kNPlanes; iLayer++) {
if(!tracklets[iLayer].IsOK()) continue;
- sumdaf += TMath::Abs((tracklets[iLayer].GetYfit(1) - tracklets[iLayer].GetYref(1))/ tracklets[iLayer].GetSigmaY2());
+ chi2phi += tracklets[iLayer].GetChi2Phi();
nLayers++;
}
- sumdaf /= Float_t (nLayers - 2.0);
+ chi2phi /= Float_t (nLayers - 2.0);
Double_t likeChi2Z = TMath::Exp(-chi2[2] * 0.14); // Chi2Z
Double_t likeChi2TC = (fReconstructor->GetRecoParam() ->IsVertexConstrained()) ?
TMath::Exp(-chi2[1] * 0.677) : 1; // Constrained Tilted Riemann
Double_t likeChi2TR = TMath::Exp(-chi2[0] * 0.78); // Non-constrained Tilted Riemann
- Double_t likeAF = TMath::Exp(-sumdaf * 3.23);
- Double_t trackLikelihood = likeChi2Z * likeChi2TR * likeAF;
+ Double_t likeChi2Phi= TMath::Exp(-chi2phi * 3.23);
+ Double_t trackLikelihood = likeChi2Z * likeChi2TR * likeChi2Phi;
if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) >= 2){
Int_t eventNumber = AliTRDtrackerDebug::GetEventNumber();
<< "LikeChi2Z=" << likeChi2Z
<< "LikeChi2TR=" << likeChi2TR
<< "LikeChi2TC=" << likeChi2TC
- << "LikeAF=" << likeAF
+ << "LikeChi2Phi=" << likeChi2Phi
<< "TrackLikelihood=" << trackLikelihood
<< "\n";
}
for(UChar_t ilayer = 0; ilayer < 4; ilayer++){
Int_t jlayer = planes[ilayer];
nclusters += cseed[jlayer].GetN2();
- sumda += TMath::Abs(cseed[jlayer].GetYfitR(1) - cseed[jlayer].GetYref(1));
+ sumda += TMath::Abs(cseed[jlayer].GetYfit(1) - cseed[jlayer].GetYref(1));
}
nclusters *= .25;
return tracklets[startIndex].GetX0() + (2.5 - startIndex) * meanDistance - 0.5 * (AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick());
}
-//_____________________________________________________________________________
-Int_t AliTRDtrackerV1::Freq(Int_t n, const Int_t *inlist
- , Int_t *outlist, Bool_t down)
-{
- //
- // Sort eleements according occurancy
- // The size of output array has is 2*n
- //
-
- if (n <= 0) {
- return 0;
- }
-
- Int_t *sindexS = new Int_t[n]; // Temporary array for sorting
- Int_t *sindexF = new Int_t[2*n];
- for (Int_t i = 0; i < n; i++) {
- sindexF[i] = 0;
- }
-
- TMath::Sort(n,inlist,sindexS,down);
-
- Int_t last = inlist[sindexS[0]];
- Int_t val = last;
- sindexF[0] = 1;
- sindexF[0+n] = last;
- Int_t countPos = 0;
+// //_____________________________________________________________________________
+// Int_t AliTRDtrackerV1::Freq(Int_t n, const Int_t *inlist
+// , Int_t *outlist, Bool_t down)
+// {
+// //
+// // Sort eleements according occurancy
+// // The size of output array has is 2*n
+// //
+//
+// if (n <= 0) {
+// return 0;
+// }
+//
+// Int_t *sindexS = new Int_t[n]; // Temporary array for sorting
+// Int_t *sindexF = new Int_t[2*n];
+// for (Int_t i = 0; i < n; i++) {
+// sindexF[i] = 0;
+// }
+//
+// TMath::Sort(n,inlist,sindexS,down);
+//
+// Int_t last = inlist[sindexS[0]];
+// Int_t val = last;
+// sindexF[0] = 1;
+// sindexF[0+n] = last;
+// Int_t countPos = 0;
+//
+// // Find frequency
+// for (Int_t i = 1; i < n; i++) {
+// val = inlist[sindexS[i]];
+// if (last == val) {
+// sindexF[countPos]++;
+// }
+// else {
+// countPos++;
+// sindexF[countPos+n] = val;
+// sindexF[countPos]++;
+// last = val;
+// }
+// }
+// if (last == val) {
+// countPos++;
+// }
+//
+// // Sort according frequency
+// TMath::Sort(countPos,sindexF,sindexS,kTRUE);
+//
+// for (Int_t i = 0; i < countPos; i++) {
+// outlist[2*i ] = sindexF[sindexS[i]+n];
+// outlist[2*i+1] = sindexF[sindexS[i]];
+// }
+//
+// delete [] sindexS;
+// delete [] sindexF;
+//
+// return countPos;
+//
+// }
- // Find frequency
- for (Int_t i = 1; i < n; i++) {
- val = inlist[sindexS[i]];
- if (last == val) {
- sindexF[countPos]++;
- }
- else {
- countPos++;
- sindexF[countPos+n] = val;
- sindexF[countPos]++;
- last = val;
- }
- }
- if (last == val) {
- countPos++;
- }
- // Sort according frequency
- TMath::Sort(countPos,sindexF,sindexS,kTRUE);
+//____________________________________________________________________
+void AliTRDtrackerV1::ResetSeedTB()
+{
+// reset buffer for seeding time bin layers. If the time bin
+// layers are not allocated this function allocates them
- for (Int_t i = 0; i < countPos; i++) {
- outlist[2*i ] = sindexF[sindexS[i]+n];
- outlist[2*i+1] = sindexF[sindexS[i]];
+ for(Int_t isl=0; isl<kNSeedPlanes; isl++){
+ if(!fSeedTB[isl]) fSeedTB[isl] = new AliTRDchamberTimeBin();
+ else fSeedTB[isl]->Clear();
}
-
- delete [] sindexS;
- delete [] sindexF;
-
- return countPos;
-
}
-//____________________________________________________________________
-
//_____________________________________________________________________________
Float_t AliTRDtrackerV1::GetChi2Y(AliTRDseedV1 *tracklets) const
{
- // Chi2 definition on y-direction
+ // Calculates normalized chi2 in y-direction
+ // chi2 = Sum chi2 / n_tracklets
- Float_t chi2 = 0;
- for(Int_t ipl = 0; ipl < kNPlanes; ipl++){
+ Double_t chi2 = 0.; Int_t n = 0;
+ for(Int_t ipl = kNPlanes; ipl--;){
if(!tracklets[ipl].IsOK()) continue;
- Double_t distLayer = (tracklets[ipl].GetYfit(0) - tracklets[ipl].GetYref(0));// /tracklets[ipl].GetSigmaY();
- chi2 += distLayer * distLayer;
- }
- return chi2;
-}
-
-//____________________________________________________________________
-void AliTRDtrackerV1::ResetSeedTB()
-{
-// reset buffer for seeding time bin layers. If the time bin
-// layers are not allocated this function allocates them
-
- for(Int_t isl=0; isl<kNSeedPlanes; isl++){
- if(!fSeedTB[isl]) fSeedTB[isl] = new AliTRDchamberTimeBin();
- else fSeedTB[isl]->Clear();
+ chi2 += tracklets[ipl].GetChi2Y();
+ n++;
}
+ return n ? chi2/n : 0.;
}
//_____________________________________________________________________________
Float_t AliTRDtrackerV1::GetChi2Z(AliTRDseedV1 *tracklets) const
{
// Calculates normalized chi2 in z-direction
+ // chi2 = Sum chi2 / n_tracklets
- Float_t chi2 = 0;
- // chi2 = Sum ((z - zmu)/sigma)^2
- // Sigma for the z direction is defined as half of the padlength
- for(Int_t ipl = 0; ipl < kNPlanes; ipl++){
+ Double_t chi2 = 0; Int_t n = 0;
+ for(Int_t ipl = kNPlanes; ipl--;){
if(!tracklets[ipl].IsOK()) continue;
- Double_t distLayer = (tracklets[ipl].GetMeanz() - tracklets[ipl].GetZref(0)); // /(tracklets[ipl].GetPadLength()/2);
- chi2 += distLayer * distLayer;
+ chi2 += tracklets[ipl].GetChi2Z();
+ n++;
}
- return chi2;
+ return n ? chi2/n : 0.;
}
///////////////////////////////////////////////////////