Double_t GetCovariance( Int_t i ) const { return fCov[i]; }
Double_t GetCovariance( Int_t i, Int_t j ) const { return fCov[( j<=i ) ? i*(i+1)/2+j :j*(j+1)/2+i]; }
+ //*
+ //* Accessors
+ //*
+
+ const Double_t *Param() const { return fParam; }
+ const Double_t *Cov() const { return fCov; }
+ Double_t X() const { return fParam[0]; }
+ Double_t Y() const { return fParam[1]; }
+ Double_t Z() const { return fParam[2]; }
+ Double_t Px() const { return fParam[3]; }
+ Double_t Py() const { return fParam[4]; }
+ Double_t Pz() const { return fParam[5]; }
+ Double_t Chi2() const { return fChi2; }
+ Int_t NDF() const { return fNDF; }
+ Int_t Charge() const { return fSignQ; }
+
//* Accessors with calculations( &value, &estimated sigma )
//* error flag returned (0 means no error during calculations)
//* MODIFIERS
//*
- Double_t *Param() { return fParam; }
- Double_t *Cov() { return fCov; }
- Double_t &X() { return fParam[0]; }
- Double_t &Y() { return fParam[1]; }
- Double_t &Z() { return fParam[2]; }
- Double_t &Px() { return fParam[3]; }
- Double_t &Py() { return fParam[4]; }
- Double_t &Pz() { return fParam[5]; }
- Double_t &Chi2() { return fChi2; }
- Int_t &NDF() { return fNDF; }
- Int_t &Charge() { return fSignQ; }
-
+ void SetParam( Int_t i, Double_t v ) { fParam[i] = v; }
+ void SetCov( Int_t i, Double_t v ){ fCov[i] = v; }
+ void SetX( Double_t v ) { fParam[0] = v; }
+ void SetY( Double_t v ) { fParam[1] = v; }
+ void SetZ( Double_t v ) { fParam[2] = v; }
+ void SetPx( Double_t v ) { fParam[3] = v; }
+ void SetPy( Double_t v ) { fParam[4] = v; }
+ void SetPz( Double_t v ) { fParam[5] = v; }
+ void SetChi2( Double_t v ) { fChi2 = v; }
+ void SetNDF( Int_t v ) { fNDF = v; }
+ void SetCharge( Int_t v ) { fSignQ = v; }
+
//*
//* UTILITIES
#include "AliHLTTPCCATrack.h"
#include "AliHLTTPCCAGBTrack.h"
#include "AliHLTTPCCAGBHit.h"
+#include "AliHLTTPCCAPerformance.h"
+#include "AliHLTTPCCAMCTrack.h"
+#include "AliHLTTPCCAOutTrack.h"
#include "TString.h"
#include "Riostream.h"
return gAliHLTTPCCADisplay;
}
-AliHLTTPCCADisplay::AliHLTTPCCADisplay() : fYX(0), fZX(0), fAsk(1), fSliceView(1), fSlice(0),
+AliHLTTPCCADisplay::AliHLTTPCCADisplay() : fYX(0), fZX(0), fAsk(1), fSliceView(1), fSlice(0),fGB(0), fPerf(0),
fCos(1), fSin(0), fZMin(-250), fZMax(250),fYMin(-250), fYMax(250),fSliceCos(1), fSliceSin(0),
fRInnerMin(83.65), fRInnerMax(133.3), fROuterMin(133.5), fROuterMax(247.7),
- fTPCZMin(-250.), fTPCZMax(250), fArc(), fLine(), fPLine(), fMarker(), fBox(), fCrown(), fLatex()
+ fTPCZMin(-250.), fTPCZMax(250), fArc(), fLine(), fPLine(), fMarker(), fBox(), fCrown(), fLatex(), fDrawOnlyRef(0)
{
+ fPerf = &(AliHLTTPCCAPerformance::Instance());
// constructor
}
AliHLTTPCCADisplay::AliHLTTPCCADisplay( const AliHLTTPCCADisplay& )
- : fYX(0), fZX(0), fAsk(1), fSliceView(1), fSlice(0),
+ : fYX(0), fZX(0), fAsk(1), fSliceView(1), fSlice(0), fGB(0), fPerf(0),
fCos(1), fSin(0), fZMin(-250), fZMax(250), fYMin(-250), fYMax(250), fSliceCos(1), fSliceSin(0),
fRInnerMin(83.65), fRInnerMax(133.3), fROuterMin(133.5), fROuterMax(247.7),
- fTPCZMin(-250.), fTPCZMax(250), fArc(), fLine(), fPLine(), fMarker(), fBox(), fCrown(), fLatex()
+ fTPCZMin(-250.), fTPCZMax(250), fArc(), fLine(), fPLine(), fMarker(), fBox(), fCrown(), fLatex(), fDrawOnlyRef(0)
{
// dummy
}
fYX = new TCanvas ("YX", "YX window", -1, 0, 600, 600);
fZX = new TCanvas ("ZX", "ZX window", -610, 0, 590, 600);
fMarker = TMarker(0.0, 0.0, 20);//6);
+ fDrawOnlyRef = 1;
}
void AliHLTTPCCADisplay::Update()
if( !fAsk ) return;
fYX->Update();
fZX->Update();
+ fYX->Print("YX.pdf");
+ fZX->Print("ZX.pdf");
+
}
void AliHLTTPCCADisplay::ClearView()
fYMax = fROuterMax;
}
+
+void AliHLTTPCCADisplay::SetGB( AliHLTTPCCAGBTracker *GBTracker )
+{
+ fGB = GBTracker;
+}
+
void AliHLTTPCCADisplay::SetCurrentSlice( AliHLTTPCCATracker *slice )
{
// set reference to the current CA tracker, and read the current slice geometry
Double_t dz = .5*(slice->Param().ZMax()-slice->Param().ZMin())*1.2;
fYX->Range(cx-dr, cy-dr*1.05, cx+dr, cy+dr);
fZX->Range(cz-dz, cy-dr*1.05, cz+dz, cy+dr);
-
- fYX->Range(cx, cy-dr*0.8, cx+dr/2, cy+dr*0.1);
- fZX->Range(cz, cy-dr*.8, cz+dz, cy+dr*0.1);
- //fYX->Range(cx-dr/6, cy-dr, cx+dr/8, cy-dr + dr/8);
- //fZX->Range(cz+dz/2+dz/6, cy-dr , cz+dz-dz/8, cy-dr + dr/8);
-
- //fYX->Range(cx-dr/3, cy-dr/3, cx+dr, cy+dr);
- //fZX->Range(cz-dz/3, cy-dr/3, cz+dz, cy+dr);//+dr);
- //fYX->Range(cx-dr/3, cy-dr/2*1.3, cx+dr/3, cy-dr/2*1.1);//+dr);
- //fZX->Range(cz-dz*0.65, cy-dr/2*1.3, cz+dz*0-dz*0.55, cy-dr/2*1.1);//+dr);
+
+ //fYX->Range(cx-dr*0., cy-dr*1., cx+dr*.2, cy-dr*0.2);
+ //fZX->Range(cz-dz , cy-dr*1., cz+dz, cy-dr*0.2);
+
+ //Double_t x0 = cx-dr*.1, x1 = cx-dr*.05;
+ //Double_t y0 = cy-dr*1.05, y1 = cy-dr*0.7;
+ //Double_t z0 = cz-dz*.3, z1 = cz;
+ //Double_t xc = (x0+x1)/2, yc= (y0+y1)/2, zc=(z0+z1)/2;
+ //Double_t d = TMath::Max((x1-x0)/2,TMath::Max((y1-y0)/2,(z1-z0)/2));
+ //fYX->Range(xc-d, yc-d, xc+d, yc+d);
+ //fZX->Range(zc-d, yc-d, zc+d, yc+d);
+
}
}
{
// schematically draw TPC detector
fYX->Range(-fROuterMax, -fROuterMax, fROuterMax, fROuterMax);
+ //fYX->Range( -fROuterMax*.7, -fROuterMax, fROuterMax*0., -fROuterMax*.5);
fYX->Clear();
{
fArc.SetLineColor(kBlack);
}
}
fZX->cd();
- fZX->Range( fTPCZMin, -fROuterMax, fTPCZMax, fROuterMax );
+ fZX->Range( fTPCZMin, -fROuterMax, fTPCZMax*1.1, fROuterMax );
+ //fZX->Range( fTPCZMax*.1, -fROuterMax, fTPCZMax*.3, -fROuterMax*0.5 );
fZX->Clear();
}
-void AliHLTTPCCADisplay::DrawSlice( AliHLTTPCCATracker *slice )
+void AliHLTTPCCADisplay::DrawSlice( AliHLTTPCCATracker *slice, Bool_t DrawRows )
{
// draw current the TPC slice
fYX->cd();
fArc.SetFillStyle(0);
fCrown.SetLineColor(kBlack);
fCrown.SetFillStyle(0);
-
- fCrown.DrawCrown(0,0, slice->Param().RMin(),slice->Param().RMax(), a0-da, a0+da );
-
+ fCrown.DrawCrown(0,0, fRInnerMin, fRInnerMax, a0-da, a0+da );
+ fCrown.DrawCrown(0,0, fROuterMin, fROuterMax, a0-da, a0+da );
+ //fCrown.DrawCrown(0,0, slice->Param().RMin(),slice->Param().RMax(), a0-da, a0+da );
+
fLine.SetLineColor(kBlack);
fZX->cd();
Double_t dz = .5*(slice->Param().ZMax()-slice->Param().ZMin())*1.2;
//fLine.DrawLine(cz+dz, cy-dr, cz+dz, cy+dr );
if( fSliceView ) fLatex.DrawLatex(cz-dz+dz*.05,cy-dr+dr*.05, Form("ZX, Slice %2i",slice->Param().ISlice()));
+
+ if( DrawRows ){
+ fLine.SetLineWidth(1);
+ fLine.SetLineColor(kBlack);
+ SetSliceTransform(fSlice);
+ for( Int_t iRow=0; iRow<fSlice->Param().NRows(); iRow++ ){
+ Double_t x = fSlice->Row(iRow).X();
+ Double_t y = fSlice->Row(iRow).MaxY();
+ Double_t vx0, vy0, vx1, vy1;
+ Slice2View( x, y, &vx0, &vy0 );
+ Slice2View( x, -y, &vx1, &vy1 );
+ fYX->cd();
+ fLine.DrawLine(vx0, vy0,vx1,vy1);
+ fZX->cd();
+ fLine.DrawLine(fTPCZMin, vy0,fTPCZMax,vy1);
+ }
+ }
+
}
fLatex.DrawLatex(cz-dz+dz*.05,cy-dr+dr*.05, Form("ZX, Slices %2i/%2i",islice,jslice));
}
+Int_t AliHLTTPCCADisplay::GetColor( Int_t i ) const
+{
+ // Get color with respect to Z coordinate
+ const Color_t kMyColor[9] = { kGreen, kBlue, kYellow, kCyan, kOrange,
+ kSpring, kTeal, kAzure, kViolet };
+ if( i<0 ) i= 0;
+ if( i==0 ) return kBlack;
+ return kMyColor[(i-1)%9];
+}
-Int_t AliHLTTPCCADisplay::GetColor( Double_t z ) const
+Int_t AliHLTTPCCADisplay::GetColorZ( Double_t z ) const
{
// Get color with respect to Z coordinate
const Color_t kMyColor[11] = { kGreen, kBlue, kYellow, kMagenta, kCyan,
}
-void AliHLTTPCCADisplay::DrawGBHit( AliHLTTPCCAGBTracker &tracker, Int_t iHit, Int_t color )
+void AliHLTTPCCADisplay::DrawGBHit( AliHLTTPCCAGBTracker &tracker, Int_t iHit, Int_t color, Double_t width )
{
// draw hit
AliHLTTPCCAGBHit &h = tracker.Hits()[iHit];
AliHLTTPCCATracker &slice = tracker.Slices()[h.ISlice()];
SetSliceTransform(&slice);
-
- if( color<0 ) color = GetColor( h.Z() );
- fMarker.SetMarkerSize(.3);
+ if( color<0 ){
+ if( fPerf ){
+ Int_t lab = fPerf->HitLabels()[h.ID()].fLab[0];
+ color = GetColor(lab+1);
+ if( lab>=0 ){
+ AliHLTTPCCAMCTrack &mc = fPerf->MCTracks()[lab];
+ if( mc.P()>=1. ) color = kRed;
+ else if(fDrawOnlyRef) return;
+ }
+ }else color=GetColorZ( h.Z() );
+ }
+ if( width>0 )fMarker.SetMarkerSize(width);
+ else fMarker.SetMarkerSize(.3);
fMarker.SetMarkerColor(color);
Double_t vx, vy;
Slice2View( h.X(), h.Y(), &vx, &vy );
fMarker.DrawMarker(h.Z(), vy);
}
-void AliHLTTPCCADisplay::DrawGBTrack( AliHLTTPCCAGBTracker &tracker, Int_t itr, Int_t color )
+void AliHLTTPCCADisplay::DrawGBHits( AliHLTTPCCAGBTracker &tracker, Int_t color, Double_t width )
{
- // draw global track
-
- AliHLTTPCCAGBTrack &track = tracker.Tracks()[itr];
- if( track.NHits()<2 ) return;
- Int_t width = 1;
+ // draw hits
- AliHLTTPCCADisplayTmpHit vHits[track.NHits()];
- AliHLTTPCCATrackParam t = track.Param();
+ if( !fPerf ) return;
+ if( width<0 ) width = .3;
+
+ for( Int_t iHit = 0; iHit<tracker.NHits(); iHit++ ){
+ AliHLTTPCCAGBHit &h = tracker.Hits()[iHit];
+ Int_t imc = fPerf->HitLabels()[h.ID()].fLab[0];
+ AliHLTTPCCAMCTrack *mc = (imc>=0) ?&(fPerf->MCTracks()[imc]) :0;
+ if(fDrawOnlyRef && (!mc || (mc->P()<1))) continue;
+ Int_t col = color;
+ if( color<0 ){
+ col = GetColor(imc+1) ;
+ if( mc && (mc->P()>=1.) ) col = kRed;
+ }
+
+ AliHLTTPCCATracker &slice = tracker.Slices()[h.ISlice()];
+ SetSliceTransform(&slice);
+
+ fMarker.SetMarkerSize(width);
+ fMarker.SetMarkerColor(col);
+ Double_t vx, vy;
+ Slice2View( h.X(), h.Y(), &vx, &vy );
+
+ fYX->cd();
+ fMarker.DrawMarker(vx, vy);
+ fZX->cd();
+ fMarker.DrawMarker(h.Z(), vy);
+ }
+}
+
+void AliHLTTPCCADisplay::DrawSliceHit( Int_t iRow, Int_t iHit, Int_t color, Double_t width )
+{
+ // draw hit
+ if( !fSlice ) return;
+ AliHLTTPCCAGBTracker &tracker = *fGB;
+ const AliHLTTPCCARow &row = fSlice->Row(iRow);
+ Int_t id = tracker.FirstSliceHit()[fSlice->Param().ISlice()]+fSlice->HitInputIDs()[row.FirstHit()+iHit];
+ DrawGBHit( tracker, id, color, width );
+}
+
+void AliHLTTPCCADisplay::DrawSliceHits( Int_t color, Double_t width )
+{
+ // draw hits
+
+ if( !fPerf || !fGB) return;
+ AliHLTTPCCAGBTracker &tracker = *fGB;
+ if( width<0 ) width = .3;
+
+ for( Int_t imc=-3; imc<fPerf->NMCTracks(); imc++ ){
+ Int_t nh=0;
+ AliHLTTPCCAMCTrack *mc = (imc>=0) ?&(fPerf->MCTracks()[imc]) :0;
+
+ if(fDrawOnlyRef && (!mc || (mc->P()<1))) continue;
- for( Int_t ih=0; ih<track.NHits(); ih++ ){
- Int_t i = tracker.TrackHits()[ track.FirstHitRef() + ih];
- AliHLTTPCCAGBHit *h = &(tracker.Hits()[i]);
- vHits[ih].ID() = i;
- vHits[ih].S() = 0;
- vHits[ih].Z() = h->Z();
- }
+ Int_t col = color;
+ if( color<0 ){
+ col = GetColor(imc+1);
+ if( imc>=0 ){
+ if( mc&&(mc->P()>=1.) ) col = kRed;
+ }
+ }
+
+ for( Int_t ih=0; ih<fSlice->NHitsTotal(); ih++ ){
+ Int_t id = fSlice->HitInputIDs()[ih];
+ AliHLTTPCCAGBHit &h = tracker.Hits()[tracker.FirstSliceHit()[fSlice->Param().ISlice()]+id];
+ if( fPerf->HitLabels()[h.ID()].fLab[0] != imc ) continue;
+ nh++;
+ //AliHLTTPCCATracker &slice = tracker.Slices()[h.ISlice()];
+ //SetSliceTransform(&slice);
+
+ fMarker.SetMarkerSize(width);
+ fMarker.SetMarkerColor(col);
+ Double_t vx, vy;
+ Slice2View( h.X(), h.Y(), &vx, &vy );
+
+ fYX->cd();
+ fMarker.DrawMarker(vx, vy);
+ fZX->cd();
+ fMarker.DrawMarker(h.Z(), vy);
+ }
+ //if( nh<=0 ) continue;
+ //float p = mc ? mc->P() :0;
+ //std::cout<<"lab,nhits,color= "<<imc<<" "<<nh<<" "<<col<<std::endl;
+ //Ask();
+ }
+}
+
+Int_t AliHLTTPCCADisplay::GetTrackMC( AliHLTTPCCADisplayTmpHit *vHits, Int_t NHits )
+{
+ // get MC label for the track
- //sort(vHits, vHits + track.NHits(), AliHLTTPCCADisplayTmpHit::CompareHitZ );
- Int_t colorY = color;
+ AliHLTTPCCAGBTracker &tracker = *fGB;
+
+ Int_t label = -1;
+ Double_t purity = 0;
+ Int_t *lb = new Int_t[NHits*3];
+ Int_t nla=0;
+ //std::cout<<"\n\nTrack hits mc: "<<std::endl;
+ for( Int_t ihit=0; ihit<NHits; ihit++){
+ AliHLTTPCCAGBHit &h = tracker.Hits()[vHits[ihit].ID()];
+ AliHLTTPCCAPerformance::AliHLTTPCCAHitLabel &l = fPerf->HitLabels()[h.ID()];
+ if(l.fLab[0]>=0 ) lb[nla++]= l.fLab[0];
+ if(l.fLab[1]>=0 ) lb[nla++]= l.fLab[1];
+ if(l.fLab[2]>=0 ) lb[nla++]= l.fLab[2];
+ //std::cout<<ihit<<": "<<l.fLab[0]<<" "<<l.fLab[1]<<" "<<l.fLab[2]<<std::endl;
+ }
+ sort( lb, lb+nla );
+ Int_t labmax = -1, labcur=-1, lmax = 0, lcurr=0, nh=0;
+ //std::cout<<"MC track IDs :"<<std::endl;
+ for( Int_t i=0; i<nla; i++ ){
+ if( lb[i]!=labcur ){
+ if( 0 && i>0 && lb[i-1]>=0 ){
+ AliHLTTPCCAMCTrack &mc = fPerf->MCTracks()[lb[i-1]];
+ std::cout<<lb[i-1]<<": nhits="<<nh<<", pdg="<< mc.PDG()<<", Pt="<<mc.Pt()<<", P="<<mc.P()
+ <<", par="<<mc.Par()[0]<<" "<<mc.Par()[1]<<" "<<mc.Par()[2]
+ <<" "<<mc.Par()[3]<<" "<<mc.Par()[4]<<" "<<mc.Par()[5]<<" "<<mc.Par()[6]<<std::endl;
+
+ }
+ nh=0;
+ if( labcur>=0 && lmax<lcurr ){
+ lmax = lcurr;
+ labmax = labcur;
+ }
+ labcur = lb[i];
+ lcurr = 0;
+ }
+ lcurr++;
+ nh++;
+ }
+ if( 0 && nla-1>0 && lb[nla-1]>=0 ){
+ AliHLTTPCCAMCTrack &mc = fPerf->MCTracks()[lb[nla-1]];
+ std::cout<<lb[nla-1]<<": nhits="<<nh<<", pdg="<< mc.PDG()<<", Pt="<<mc.Pt()<<", P="<<mc.P()
+ <<", par="<<mc.Par()[0]<<" "<<mc.Par()[1]<<" "<<mc.Par()[2]
+ <<" "<<mc.Par()[3]<<" "<<mc.Par()[4]<<" "<<mc.Par()[5]<<" "<<mc.Par()[6]<<std::endl;
+
+ }
+ if( labcur>=0 && lmax<lcurr ){
+ lmax = lcurr;
+ labmax = labcur;
+ }
+ lmax = 0;
+ for( Int_t ihit=0; ihit<NHits; ihit++){
+ AliHLTTPCCAGBHit &h = tracker.Hits()[vHits[ihit].ID()];
+ AliHLTTPCCAPerformance::AliHLTTPCCAHitLabel &l = fPerf->HitLabels()[h.ID()];
+ if( l.fLab[0] == labmax || l.fLab[1] == labmax || l.fLab[2] == labmax
+ ) lmax++;
+ }
+ label = labmax;
+ purity = ( (NHits>0) ?double(lmax)/double(NHits) :0 );
+ if( lb ) delete[] lb;
+ if( purity<.9 ) label = -1;
+ return label;
+}
- {
- AliHLTTPCCAGBHit &h1 = tracker.Hits()[ vHits[0].ID()];
- AliHLTTPCCAGBHit &h2 = tracker.Hits()[ vHits[track.NHits()-1].ID()];
- if( color<0 ) color = GetColor( (h1.Z()+h2.Z())/2. );
- Double_t gx1, gy1, gx2, gy2;
- Slice2View(h1.X(), h1.Y(), &gx1, &gy1 );
- Slice2View(h2.X(), h2.Y(), &gx2, &gy2 );
- if( colorY<0 ) colorY = GetColorY( (gy1+gy2)/2. );
- color = colorY = GetColorK(t.GetKappa());
+Bool_t AliHLTTPCCADisplay::DrawTrack( AliHLTTPCCATrackParam t, Double_t Alpha, AliHLTTPCCADisplayTmpHit *vHits,
+ Int_t NHits, Int_t color, Double_t width, Bool_t pPoint )
+{
+ // draw track
+
+ if(NHits<2 ) return 0;
+
+ AliHLTTPCCAGBTracker &tracker = *fGB;
+ if( width<0 ) width = 2;
+
+ if(fDrawOnlyRef ){
+ Int_t lab = GetTrackMC(vHits, NHits);
+ if( lab<0 ) return 0;
+ AliHLTTPCCAMCTrack &mc = fPerf->MCTracks()[lab];
+ if(mc.P()<1) return 0;
+ }
+
+ if( color < 0 ){
+ //color = GetColorZ( (vz[0]+vz[mHits-1])/2. );
+ //color = GetColorK(t.GetKappa());
+ Int_t lab = GetTrackMC(vHits, NHits);
+ color = GetColor( lab +1 );
+ if( lab>=0 ){
+ AliHLTTPCCAMCTrack &mc = fPerf->MCTracks()[lab];
+ if( mc.P()>=1. ) color = kRed;
+ }
+ }
+
+ if( t.SinPhi()>.999 ) t.SetSinPhi( .999 );
+ else if( t.SinPhi()<-.999 ) t.SetSinPhi( -.999 );
+ if( t.CosPhi()>=0 ) t.SetCosPhi( TMath::Sqrt(1-t.SinPhi()*t.SinPhi() ));
+ else t.SetCosPhi( -TMath::Sqrt(1-t.SinPhi()*t.SinPhi() ));
+
+ // Int_t iSlice = fSlice->Param().ISlice();
+
+ //sort(vHits, vHits + NHits, AliHLTTPCCADisplayTmpHit::CompareHitZ );
+
+ Double_t vx[2000], vy[2000], vz[2000];
+ Int_t mHits = 0;
+
+ //Int_t oldSlice = -1;
+ Double_t alpha = (Alpha==-1) ?fSlice->Param().Alpha() :Alpha;
+ AliHLTTPCCATrackParam tt = t;
+
+ for( Int_t iHit=0; iHit<NHits; iHit++ ){
+
+ AliHLTTPCCAGBHit &h = tracker.Hits()[vHits[iHit].ID()];
+
+ Double_t hCos = TMath::Cos( alpha - tracker.Slices()[h.ISlice()].Param().Alpha());
+ Double_t hSin = TMath::Sin( alpha - tracker.Slices()[h.ISlice()].Param().Alpha());
+ Double_t x0=h.X(), y0=h.Y(), z1=h.Z();
+ Double_t x1 = x0*hCos + y0*hSin;
+ Double_t y1 = y0*hCos - x0*hSin;
+
+ {
+ Double_t dx = x1-tt.X();
+ Double_t dy = y1-tt.Y();
+ if( dx*dx+dy*dy>1. ){
+ Double_t dalpha = TMath::ATan2( dy, dx );
+ if( tt.Rotate(dalpha ) ){
+ alpha+=dalpha;
+ hCos = TMath::Cos( alpha - tracker.Slices()[h.ISlice()].Param().Alpha());
+ hSin = TMath::Sin( alpha - tracker.Slices()[h.ISlice()].Param().Alpha());
+ x1 = x0*hCos + y0*hSin;
+ y1 = y0*hCos - x0*hSin;
+ }
+ }
+ }
+ SetSliceTransform( alpha );
+
+ //t.GetDCAPoint( x1, y1, z1, x1, y1, z1 );
+ Bool_t ok = tt.TransportToX(x1,.999);
+ if( 0&&ok ){
+ x1 = tt.X();
+ y1 = tt.Y();
+ z1 = tt.Z();
+ }
+
+ Slice2View(x1, y1, &x1, &y1 );
+ vx[mHits] = x1;
+ vy[mHits] = y1;
+ vz[mHits] = z1;
+ mHits++;
+ for( int j=0; j<0; j++ ){
+ x0=h.X()+j; y0=h.Y(); z1=h.Z();
+ x1 = x0*hCos + y0*hSin;
+ y1 = y0*hCos - x0*hSin;
+
+ ok = tt.TransportToX(x1,.999);
+ if( 1||ok ){
+ x1 = tt.X();
+ y1 = tt.Y();
+ z1 = tt.Z();
+ }
+
+ Slice2View(x1, y1, &x1, &y1 );
+ vx[mHits] = x1;
+ vy[mHits] = y1;
+ vz[mHits] = z1;
+ mHits++;
+ }
+ }
+ if( pPoint ){
+ Double_t x1=t.X(), y1=t.Y(), z1=t.Z();
+ Double_t a = (Alpha==-1) ?fSlice->Param().Alpha() :Alpha;
+ SetSliceTransform( a );
+
+ Slice2View(x1, y1, &x1, &y1 );
+ Double_t dx = x1 - vx[0];
+ Double_t dy = y1 - vy[0];
+ //std::cout<<x1<<" "<<y1<<" "<<vx[0]<<" "<<vy[0]<<" "<<dx<<" "<<dy<<std::endl;
+ Double_t d0 = dx*dx + dy*dy;
+ dx = x1 - vx[mHits-1];
+ dy = y1 - vy[mHits-1];
+ //std::cout<<x1<<" "<<y1<<" "<<vx[mHits-1]<<" "<<vy[mHits-1]<<" "<<dx<<" "<<dy<<std::endl;
+ Double_t d1 = dx*dx + dy*dy;
+ //std::cout<<"d0, d1="<<d0<<" "<<d1<<std::endl;
+ if( d1<d0 ){
+ vx[mHits] = x1;
+ vy[mHits] = y1;
+ vz[mHits] = z1;
+ mHits++;
+ } else {
+ for( Int_t i = mHits; i>0; i-- ){
+ vx[i] = vx[i-1];
+ vy[i] = vy[i-1];
+ vz[i] = vz[i-1];
+ }
+ vx[0] = x1;
+ vy[0] = y1;
+ vz[0] = z1;
+ mHits++;
+ }
}
+
- //fMarker.SetMarkerColor(color);//kBlue);
- //fMarker.SetMarkerSize(1.);
fLine.SetLineColor(color);
fLine.SetLineWidth(width);
fArc.SetFillStyle(0);
pl.SetLineColor(color);
pl.SetLineWidth(width);
TPolyLine plZ;
- plZ.SetLineColor(colorY);
+ plZ.SetLineColor(color);
plZ.SetLineWidth(width);
+
+ fMarker.SetMarkerSize(width/2.);
+ fMarker.SetMarkerColor(color);
- Int_t oldSlice = -1;
- //Double_t alpha = track.Alpha();
- Double_t px[track.NHits()], py[track.NHits()], pz[track.NHits()];
+ fYX->cd();
+ pl.DrawPolyLine(mHits,vx,vy);
+ {
+ fMarker.DrawMarker(vx[0],vy[0]);
+ fMarker.DrawMarker(vx[mHits-1],vy[mHits-1]);
+ }
+ fZX->cd();
+ plZ.DrawPolyLine(mHits,vz,vy);
+ fMarker.DrawMarker(vz[0],vy[0]);
+ fMarker.DrawMarker(vz[mHits-1],vy[mHits-1]);
+
+ fLine.SetLineWidth(1);
+ return 1;
+}
- // YX
- for( Int_t iHit=0; iHit<track.NHits()-1; iHit++ ){
- AliHLTTPCCAGBHit &h1 = tracker.Hits()[vHits[iHit].ID()];
- AliHLTTPCCAGBHit &h2 = tracker.Hits()[vHits[iHit+1].ID()];
- Double_t vx1, vy1, vx2, vy2;
-
- if( h1.ISlice() != oldSlice ){
- //t.Rotate( tracker.Slices()[h1.ISlice()].Param().Alpha() - alpha);
- oldSlice = h1.ISlice();
- //alpha = tracker.Slices()[h1.ISlice()].Param().Alpha();
- SetSliceTransform( &(tracker.Slices()[oldSlice]) );
- }
- Float_t x1=h1.X(), y1=h1.Y(), z1=h1.Z();
- //t.GetDCAPoint( x1, y1, z1, x1, y1, z1 );
- Slice2View(x1, y1, &vx1, &vy1 );
- px[iHit] = vx1;
- py[iHit] = vy1;
- pz[iHit] = z1;
+Bool_t AliHLTTPCCADisplay::DrawTracklet( AliHLTTPCCATrackParam &track, Int_t *hitstore, Int_t color,Double_t width, Bool_t pPoint )
+{
+ // draw tracklet
+ AliHLTTPCCAGBTracker &tracker = *fGB;
+ AliHLTTPCCADisplayTmpHit vHits[200];
+ Int_t nHits = 0;
+ for( Int_t iRow=0; iRow<fSlice->Param().NRows(); iRow++ ){
+ Int_t iHit = hitstore[iRow];
+ if( iHit<0 ) continue;
+ const AliHLTTPCCARow &row = fSlice->Row(iRow);
+ Int_t id = fSlice->HitInputIDs()[row.FirstHit()+iHit];
+ Int_t iGBHit = tracker.FirstSliceHit()[fSlice->Param().ISlice()]+id;
+ AliHLTTPCCAGBHit &h = tracker.Hits()[iGBHit];
+ vHits[nHits].SetID( iGBHit );
+ vHits[nHits].SetS( 0 );
+ vHits[nHits].SetZ( h.Z() );
+ nHits++;
+ }
+ return DrawTrack( track, -1, vHits, nHits, color,width,pPoint );
+}
- if( h2.ISlice() != oldSlice ){
- //t.Rotate( tracker.Slices()[h2.ISlice()].Param().Alpha() - alpha);
- oldSlice = h2.ISlice();
- //alpha = tracker.Slices()[h2.ISlice()].Param().Alpha();
- SetSliceTransform( &(tracker.Slices()[oldSlice]) );
- }
- Float_t x2=h2.X(), y2=h2.Y(), z2=h2.Z();
- //t.GetDCAPoint( h2.X(), h2.Y(), h2.Z(), x2, y2, z2 );
- Slice2View(x2, y2, &vx2, &vy2 );
- px[iHit+1] = vx2;
- py[iHit+1] = vy2;
- pz[iHit+1] = z2;
- continue;
+void AliHLTTPCCADisplay::DrawSliceOutTrack( AliHLTTPCCATrackParam &t, Double_t alpha, Int_t itr, Int_t color, Double_t width )
+{
+ // draw slice track
+
+ AliHLTTPCCAOutTrack &track = fSlice->OutTracks()[itr];
+ if( track.NHits()<2 ) return;
- Double_t x0 = t.GetX();
- Double_t y0 = t.GetY();
- Double_t sinPhi = t.GetSinPhi();
- Double_t k = t.GetKappa();
- Double_t ex = t.GetCosPhi();
- Double_t ey = sinPhi;
-
- if( TMath::Abs(k)>1.e-4 ){
-
- fYX->cd();
+ AliHLTTPCCAGBTracker &tracker = *fGB;
+ AliHLTTPCCADisplayTmpHit vHits[200];
- Double_t r = 1/TMath::Abs(k);
- Double_t xc = x0 -ey*(1/k);
- Double_t yc = y0 +ex*(1/k);
-
- Double_t vx, vy;
- Slice2View( xc, yc, &vx, &vy );
-
- Double_t a1 = TMath::ATan2(vy1-vy, vx1-vx)/TMath::Pi()*180.;
- Double_t a2 = TMath::ATan2(vy2-vy, vx2-vx)/TMath::Pi()*180.;
- if( a1<0 ) a1+=360;
- if( a2<0 ) a2+=360;
- if( a2<a1 ) a2+=360;
- Double_t da = TMath::Abs(a2-a1);
- if( da>360 ) da-= 360;
- if( da>180 ){
- da = a1;
- a1 = a2;
- a2 = da;
- if( a2<a1 ) a2+=360;
- }
- fArc.DrawArc(vx,vy,r, a1,a2,"only");
- //fArc.DrawArc(vx,vy,r, 0,360,"only");
- } else {
- fYX->cd();
- fLine.DrawLine(vx1,vy1, vx2, vy2 );
- }
+ for( Int_t ih=0; ih<track.NHits(); ih++ ){
+ Int_t id = tracker.FirstSliceHit()[fSlice->Param().ISlice()] + fSlice->OutTrackHits()[track.FirstHitRef()+ih];
+ AliHLTTPCCAGBHit &h = tracker.Hits()[id];
+ vHits[ih].SetID( id );
+ vHits[ih].SetS( 0 );
+ vHits[ih].SetZ( h.Z() );
}
+
+ DrawTrack( t, alpha, vHits, track.NHits(), color, width, 1 );
+}
+
+void AliHLTTPCCADisplay::DrawSliceOutTrack( Int_t itr, Int_t color, Double_t width )
+{
+ // draw slice track
- fYX->cd();
- pl.DrawPolyLine(track.NHits(),px,py);
- fZX->cd();
- plZ.DrawPolyLine(track.NHits(),pz,py);
+ AliHLTTPCCAOutTrack &track = fSlice->OutTracks()[itr];
+ if( track.NHits()<2 ) return;
+
+ AliHLTTPCCAGBTracker &tracker = *fGB;
+ AliHLTTPCCADisplayTmpHit vHits[200];
+
+ for( Int_t ih=0; ih<track.NHits(); ih++ ){
+ Int_t id = tracker.FirstSliceHit()[fSlice->Param().ISlice()] + fSlice->OutTrackHits()[track.FirstHitRef()+ih];
+ AliHLTTPCCAGBHit &h = tracker.Hits()[id];
+ vHits[ih].SetID( id );
+ vHits[ih].SetS( 0 );
+ vHits[ih].SetZ( h.Z() );
+ }
+
+ DrawTrack( track.StartPoint(), -1, vHits, track.NHits(), color, width );
+}
+
+
+void AliHLTTPCCADisplay::DrawSliceTrack( Int_t itr, Int_t color )
+{
+ // draw slice track
- fLine.SetLineWidth(1);
+ AliHLTTPCCATrack &track = fSlice->Tracks()[itr];
+ if( track.NHits()<2 ) return;
+
+ AliHLTTPCCAGBTracker &tracker = *fGB;
+ AliHLTTPCCADisplayTmpHit vHits[200];
+ for( Int_t ith=0; ith<track.NHits(); ith++ ){
+ Int_t ic = (fSlice->TrackHits()[track.FirstHitID()+ith]);
+ const AliHLTTPCCARow &row = fSlice->ID2Row(ic);
+ Int_t ih = fSlice->ID2IHit(ic);
+ int id = fSlice->HitInputIDs()[row.FirstHit()+ih];
+ Int_t gbID = tracker.FirstSliceHit()[fSlice->Param().ISlice()] + id;
+ AliHLTTPCCAGBHit &h = tracker.Hits()[gbID];
+ vHits[ith].SetID( gbID );
+ vHits[ith].SetS( 0 );
+ vHits[ith].SetZ( h.Z() );
+ }
+
+ DrawTrack( track.Param(), -1, vHits, track.NHits(), color,-1 );
+ //track.Param().Print();
+}
+
+
+void AliHLTTPCCADisplay::DrawGBTrack( Int_t itr, Int_t color, Double_t width )
+{
+ // draw global track
+
+ AliHLTTPCCAGBTracker &tracker = *fGB;
+ AliHLTTPCCADisplayTmpHit vHits[1000];
+
+ AliHLTTPCCAGBTrack &track = tracker.Tracks()[itr];
+ if( track.NHits()<2 ) return;
+
+ for( Int_t ih=0; ih<track.NHits(); ih++ ){
+ Int_t i = tracker.TrackHits()[ track.FirstHitRef() + ih];
+ AliHLTTPCCAGBHit &h = tracker.Hits()[i];
+ vHits[ih].SetID( i );
+ vHits[ih].SetS( 0 );
+ vHits[ih].SetZ( h.Z() );
+ }
+
+ DrawTrack( track.Param(), track.Alpha(), vHits, track.NHits(), color, width );
}
+
void AliHLTTPCCADisplay::DrawGBTrackFast( AliHLTTPCCAGBTracker &tracker, Int_t itr, Int_t color )
{
// draw global track
Int_t width = 1;
AliHLTTPCCADisplayTmpHit *vHits = new AliHLTTPCCADisplayTmpHit[track.NHits()];
- AliHLTTPCCATrackParam &t = track.Param();
+ AliHLTTPCCATrackParam t = track.Param();
for( Int_t ih=0; ih<track.NHits(); ih++ ){
Int_t i = tracker.TrackHits()[ track.FirstHitRef() + ih];
AliHLTTPCCAGBHit *h = &(tracker.Hits()[i]);
- vHits[ih].ID() = i;
- vHits[ih].S() = 0;
- vHits[ih].Z() = h->Z();
+ vHits[ih].SetID( i );
+ vHits[ih].SetS( 0 );
+ vHits[ih].SetZ( h->Z() );
}
sort(vHits, vHits + track.NHits(), AliHLTTPCCADisplayTmpHit::CompareHitZ );
{
AliHLTTPCCAGBHit &h1 = tracker.Hits()[ vHits[0].ID()];
AliHLTTPCCAGBHit &h2 = tracker.Hits()[ vHits[track.NHits()-1].ID()];
- if( color<0 ) color = GetColor( (h1.Z()+h2.Z())/2. );
+ if( color<0 ) color = GetColorZ( (h1.Z()+h2.Z())/2. );
Double_t gx1, gy1, gx2, gy2;
Slice2View(h1.X(), h1.Y(), &gx1, &gy1 );
Slice2View(h2.X(), h2.Y(), &gx2, &gy2 );
-#ifdef XXXX
-
-
-void AliHLTTPCCADisplay::DrawHit( Int_t iRow, Int_t iHit, Int_t color )
-{
- // draw hit
- if( !fSlice ) return;
- AliHLTTPCCARow &row = fSlice->Rows()[iRow];
- AliHLTTPCCAHit *h = &(fSlice->Hits()[row.FirstHit()+iHit]);
- if( color<0 ) color = GetColor( h->Z() );
-
- //Double_t dgy = 3.5*TMath::Abs(h->ErrY()*fSlice->Param().CosAlpha() - fSlice->Param().ErrX()*fSlice->Param().SinAlpha() );
- Double_t dx = 0.1;//fSlice->Param().ErrX()*TMath::Sqrt(12.)/2.;
- Double_t dy = 0.35;//h->ErrY()*3.5;
- //Double_t dz = h->ErrZ()*3.5;
- fMarker.SetMarkerSize(.5);
- //fMarker.SetMarkerSize(.3);
- fMarker.SetMarkerColor(color);
- fArc.SetLineColor(color);
- fArc.SetFillStyle(0);
- Double_t vx, vy, dvx, dvy;
- Slice2View( row.X(), h->Y(), &vx, &vy );
- Slice2View( dx, dy, &dvx, &dvy );
-
- fYX->cd();
- //if( fSliceView ) fArc.DrawEllipse( vx, vy, dvx, dvy, 0,360, 0);
- //else fArc.DrawEllipse( vx, vy, dx, dy, 0,360, fSlice->Param().Alpha()*180./3.1415);
- fMarker.DrawMarker(vy, vx);
- fZX->cd();
- //if( fSliceView ) fArc.DrawEllipse( h->Z(), vy, dz, dvy, 0,360, 0 );
- //else fArc.DrawEllipse( h->Z(), vy, dz, dgy, 0,360, fSlice->Param().Alpha()*180./3.1415);
- fMarker.DrawMarker(h->Z(), vx);
-}
-
-
-
+#ifdef XXXX
#ifdef XXX
// connect two cells on display, kind of row is drawing
- AliHLTTPCCARow &row = fSlice->Rows()[iRow];
+ const AliHLTTPCCARow &row = fSlice->Row(iRow);
AliHLTTPCCAHit &h = row.Hits()[iHit];
AliHLTTPCCAHit &hyz = row.HitsYZ()[iHit];
y2 = h2.Y();
z2 = h2.Z();
}
- if( color<0 ) color = GetColor( (z+z1+z2)/3. );
+ if( color<0 ) color = GetColorZ( (z+z1+z2)/3. );
Slice2View(x,y, &x, &y );
}
}
sort(vHits, vHits + track.NHits(), AliHLTTPCCADisplayTmpHit::CompareHitZ );
- cout<<"Draw track, nhits = "<<nhits<<endl;
+ //cout<<"Draw track, nhits = "<<nhits<<endl;
{
AliHLTTPCCAHit &c1 = fSlice->ID2Hit(vHits[0].ID());
AliHLTTPCCAHit &c2 = fSlice->ID2Hit(vHits[track.NHits()-1].ID());
- if( color<0 ) color = GetColor( (c1.Z()+c2.Z())/2. );
+ if( color<0 ) color = GetColorZ( (c1.Z()+c2.Z())/2. );
}
fMarker.SetMarkerColor(color);//kBlue);
t.GetDCAPoint( row1.X(), c1.Y(), c1.Z(), x1, y1, z1 );
t.GetDCAPoint( row2.X(), c2.Y(), c2.Z(), x2, y2, z2 );
- //if( color<0 ) color = GetColor( (z1+z2)/2. );
+ //if( color<0 ) color = GetColorZ( (z1+z2)/2. );
Double_t vx1, vy1, vx2, vy2;
Slice2View(x1, y1, &vx1, &vy1 );
Slice2View(x2, y2, &vx2, &vy2 );
AliHLTTPCCAHit &c2 = fSlice->ID2Hit(vHits[iHit+1].ID());
AliHLTTPCCARow &row1 = fSlice->ID2Row(vHits[iHit].ID());
AliHLTTPCCARow &row2 = fSlice->ID2Row(vHits[iHit+1].ID());
-
+
//if( DrawHits ) ConnectHits( fSlice->ID2IRow(vHits[iHit].ID()),c1,
//fSlice->ID2IRow(vHits[iHit+1].ID()),c2, color );
Float_t x1, y1, z1, x2, y2, z2;
Int_t width = 1;
- if( color<0 ) color = GetColor( t.GetZ() );
+ if( color<0 ) color = GetColorZ( t.GetZ() );
fMarker.SetMarkerColor(color);
fMarker.SetMarkerSize(.5);
class AliHLTTPCCAGBTracker;
class AliHLTTPCCATrack;
class AliHLTTPCCATrackParam;
+class AliHLTTPCCAPerformance;
class TCanvas;
#include "TArc.h"
#include "TLine.h"
*/
class AliHLTTPCCADisplay
{
+
public:
+
+ class AliHLTTPCCADisplayTmpHit{
+
+ public:
+ Int_t ID() const { return fHitID; }
+ Double_t S() const { return fS; }
+ Double_t Z() const { return fZ; }
+
+ void SetID( Int_t v ){ fHitID = v; }
+ void SetS( Double_t v){ fS = v; }
+ void SetZ( Double_t v){ fZ = v; }
+
+ static Bool_t CompareHitDS( const AliHLTTPCCADisplayTmpHit &a,
+ const AliHLTTPCCADisplayTmpHit &b )
+ {
+ return (a.fS < b.fS);
+ }
+ static Bool_t CompareHitZ( const AliHLTTPCCADisplayTmpHit &a,
+ const AliHLTTPCCADisplayTmpHit &b )
+ {
+ return (a.fZ < b.fZ);
+ }
+ protected:
+ Int_t fHitID; // hit ID
+ Double_t fS; // hit position on the XY track curve
+ Double_t fZ; // hit Z position
+ };
+
static AliHLTTPCCADisplay &Instance();
AliHLTTPCCADisplay();
void SetSliceView();
void SetTPCView();
void SetCurrentSlice( AliHLTTPCCATracker *slice );
+ void SetGB( AliHLTTPCCAGBTracker *GBTracker );
void Set2Slices( AliHLTTPCCATracker *slice );
- Int_t GetColor( Double_t z ) const ;
+ Int_t GetColor( Int_t i ) const;
+ Int_t GetColorZ( Double_t z ) const ;
Int_t GetColorY( Double_t y ) const ;
Int_t GetColorK( Double_t k ) const ;
void Global2View( Double_t x, Double_t y, Double_t *xv, Double_t *yv ) const ;
void Slice2View( Double_t x, Double_t y, Double_t *xv, Double_t *yv ) const ;
+ Int_t GetTrackMC( AliHLTTPCCADisplayTmpHit *vHits, Int_t NHits );
void DrawTPC();
- void DrawSlice( AliHLTTPCCATracker *slice );
- void DrawGBTrack( AliHLTTPCCAGBTracker &tracker, Int_t itr, Int_t color=-1 );
+ void DrawSlice( AliHLTTPCCATracker *slice, Bool_t DrawRows=0 );
+ void DrawSliceOutTrack( Int_t itr, Int_t color=-1, Double_t width = -1 );
+ void DrawSliceOutTrack( AliHLTTPCCATrackParam &t, Double_t Alpha, Int_t itr, Int_t color=-1, Double_t width = -1 );
+ void DrawSliceTrack( Int_t itr, Int_t color=-1);
+ Bool_t DrawTrack( AliHLTTPCCATrackParam t, Double_t Alpha, AliHLTTPCCADisplayTmpHit *vHits,
+ Int_t NHits, Int_t color=-1, Double_t width=-1, Bool_t pPoint=0 );
+
+ void DrawGBTrack( Int_t itr, Int_t color=-1, Double_t width=-1 );
void DrawGBTrackFast( AliHLTTPCCAGBTracker &tracker, Int_t itr, Int_t color=-1 );
+ Bool_t DrawTracklet( AliHLTTPCCATrackParam &track, Int_t *hitstore, Int_t color=-1, Double_t width=-1, Bool_t pPoint=0 );
+
+ void DrawGBHit( AliHLTTPCCAGBTracker &tracker, Int_t iHit, Int_t color=-1, Double_t width =-1 );
+ void DrawGBHits( AliHLTTPCCAGBTracker &tracker, Int_t color=-1, Double_t width =-1 );
- void DrawGBHit( AliHLTTPCCAGBTracker &tracker, Int_t iHit, Int_t color=-1 );
+ void DrawSliceHit( Int_t iRow,Int_t iHit, Int_t color=-1, Double_t width=-1 );
+ void DrawSliceHits(Int_t color=-1, Double_t width=-1 );
#ifdef XXXX
- void DrawHit( Int_t iRow,Int_t iHit, Int_t color=-1 );
void DrawMergedHit( Int_t iRow, Int_t iHit, Int_t color=-1 );
void DrawTrack( AliHLTTPCCATrack &track, Int_t color=-1, Bool_t DrawCells=1 );
Bool_t fAsk; // flag to ask for the pressing key
Bool_t fSliceView; // switch between slice/TPC zoom
AliHLTTPCCATracker *fSlice; // current CA tracker, includes slice geometry
+ AliHLTTPCCAGBTracker *fGB; // the global tracker
+ AliHLTTPCCAPerformance *fPerf; // Performance class (mc labels etc)
Double_t fCos, fSin, fZMin, fZMax, fYMin, fYMax;// view parameters
Double_t fSliceCos, fSliceSin; // current slice angle
Double_t fRInnerMin, fRInnerMax, fROuterMin, fROuterMax,fTPCZMin, fTPCZMax; // view parameters
TCrown fCrown; //!
TLatex fLatex; //!
- class AliHLTTPCCADisplayTmpHit{
-
- public:
- Int_t &ID(){ return fHitID; }
- Double_t &S(){ return fS; }
- Double_t &Z(){ return fZ; }
-
- static Bool_t CompareHitDS( const AliHLTTPCCADisplayTmpHit &a,
- const AliHLTTPCCADisplayTmpHit &b )
- {
- return (a.fS < b.fS);
- }
- static Bool_t CompareHitZ( const AliHLTTPCCADisplayTmpHit &a,
- const AliHLTTPCCADisplayTmpHit &b )
- {
- return (a.fZ < b.fZ);
- }
- protected:
- Int_t fHitID; // cell ID
- Double_t fS; // cell position on the XY track curve
- Double_t fZ; // cell Z position
- };
-
+ Bool_t fDrawOnlyRef; // draw only clusters from ref. mc tracks
};
virtual ~AliHLTTPCCAGBHit(){}
- Float_t &X(){ return fX; }
- Float_t &Y(){ return fY; }
- Float_t &Z(){ return fZ; }
-
- Float_t &ErrX(){ return fErrX; }
- Float_t &ErrY(){ return fErrY; }
- Float_t &ErrZ(){ return fErrZ; }
- Float_t &Amp() { return fAmp; }
-
- Int_t &ISlice(){ return fISlice; }
- Int_t &IRow(){ return fIRow; }
- Int_t &ID(){ return fID; }
- Bool_t &IsUsed(){ return fIsUsed; };
-
+ Float_t X() const { return fX; }
+ Float_t Y() const { return fY; }
+ Float_t Z() const { return fZ; }
+
+ Float_t ErrX() const { return fErrX; }
+ Float_t ErrY() const { return fErrY; }
+ Float_t ErrZ() const { return fErrZ; }
+ Float_t Amp() const { return fAmp; }
+
+ Int_t ISlice() const { return fISlice; }
+ Int_t IRow() const { return fIRow; }
+ Int_t ID() const { return fID; }
+ Bool_t IsUsed() const { return fIsUsed; };
+
+ void SetX( Float_t v ){ fX = v; }
+ void SetY( Float_t v ){ fY = v; }
+ void SetZ( Float_t v ){ fZ = v; }
+ void SetErrX( Float_t v ){ fErrX = v; }
+ void SetErrY( Float_t v ){ fErrY = v; }
+ void SetErrZ( Float_t v ){ fErrZ = v; }
+ void SetAmp( Float_t v ) { fAmp = v; }
+ void SetISlice( Int_t v ){ fISlice = v; }
+ void SetIRow( Int_t v ){ fIRow = v; }
+ void SetID( Int_t v ){ fID = v; }
+ void SetIsUsed( Bool_t v ){ fIsUsed = v; };
static Bool_t Compare(const AliHLTTPCCAGBHit &a, const AliHLTTPCCAGBHit &b);
AliHLTTPCCAGBTrack():fFirstHitRef(0),fNHits(0),fParam(),fAlpha(0),fDeDx(0){ ; }
virtual ~AliHLTTPCCAGBTrack(){ ; }
- Int_t &NHits() { return fNHits; }
- Int_t &FirstHitRef() { return fFirstHitRef; }
- AliHLTTPCCATrackParam &Param() { return fParam; }
- Float_t &Alpha() { return fAlpha; }
- Float_t &DeDx() { return fDeDx; }
+ Int_t NHits() const { return fNHits; }
+ Int_t FirstHitRef() const { return fFirstHitRef; }
+ const AliHLTTPCCATrackParam &Param() const { return fParam; }
+ Float_t Alpha() const { return fAlpha; }
+ Float_t DeDx() const { return fDeDx; }
+
+
+ void SetNHits( Int_t v ) { fNHits = v; }
+ void SetFirstHitRef( Int_t v ) { fFirstHitRef = v; }
+ void SetParam( const AliHLTTPCCATrackParam &v ) { fParam = v; }
+ void SetAlpha( Float_t v ) { fAlpha = v; }
+ void SetDeDx( Float_t v ) { fDeDx = v; }
+
+
static Bool_t ComparePNClusters( const AliHLTTPCCAGBTrack *a, const AliHLTTPCCAGBTrack *b){
return (a->fNHits > b->fNHits);
}
{
//* destructor
StartEvent();
- if( fSliceTrackInfos ) delete[] fSliceTrackInfos;
+ if( fSliceTrackInfos ){
+ for( Int_t iSlice=0; iSlice<fNSlices; iSlice++ ){
+ if( fSliceTrackInfos[iSlice] ) delete[] fSliceTrackInfos[iSlice];
+ fSliceTrackInfos[iSlice] = 0;
+ }
+ delete[] fSliceTrackInfos;
+ }
fSliceTrackInfos = 0;
if( fSlices ) delete[] fSlices;
fSlices=0;
{
//* set N of slices
StartEvent();
- fNSlices = N;
- if( fSliceTrackInfos ) delete[] fSliceTrackInfos;
+ if( fSliceTrackInfos ){
+ for( Int_t iSlice=0; iSlice<fNSlices; iSlice++ ){
+ if( fSliceTrackInfos[iSlice] ) delete[] fSliceTrackInfos[iSlice];
+ fSliceTrackInfos[iSlice] = 0;
+ }
+ delete[] fSliceTrackInfos;
+ }
fSliceTrackInfos = 0;
+ fNSlices = N;
if( fSlices ) delete[] fSlices;
fSlices=0;
fSlices = new AliHLTTPCCATracker[N];
void AliHLTTPCCAGBTracker::StartEvent()
{
//* clean up track and hit arrays
-
if( fSliceTrackInfos ){
- for( Int_t iSlice=0; iSlice<fNSlices; iSlice++ ){
+ for( Int_t iSlice=0; iSlice<fNSlices; iSlice++ ){
if( fSliceTrackInfos[iSlice] ) delete[] fSliceTrackInfos[iSlice];
fSliceTrackInfos[iSlice] = 0;
}
{
//* read the hit to local array
AliHLTTPCCAGBHit &hit = fHits[fNHits];
- hit.X() = x;
- hit.Y() = y;
- hit.Z() = z;
- hit.ErrX() = 1.e-4;//fSlices[iSlice].Param().ErrX();
- hit.ErrY() = errY;
- hit.ErrZ() = errZ;
- hit.Amp() = amp;
- hit.ID() = ID;
- hit.ISlice()=iSlice;
- hit.IRow() = iRow;
- hit.IsUsed() = 0;
+ hit.SetX( x );
+ hit.SetY( y );
+ hit.SetZ( z );
+ hit.SetErrX( 1.e-4 );//fSlices[iSlice].Param().ErrX();
+ hit.SetErrY( errY );
+ hit.SetErrZ( errZ );
+ hit.SetAmp( amp );
+ hit.SetID( ID );
+ hit.SetISlice( iSlice );
+ hit.SetIRow( iRow );
+ hit.SetIsUsed( 0 );
fNHits++;
}
//* main tracking routine
fTime = 0;
fStatNEvents++;
+
#ifdef DRAW
if( fStatNEvents<=1 ){
if( !gApplication ){
}
AliHLTTPCCADisplay::Instance().Init();
}
+ AliHLTTPCCADisplay::Instance().SetGB(this);
AliHLTTPCCADisplay::Instance().SetTPCView();
AliHLTTPCCADisplay::Instance().DrawTPC();
+ AliHLTTPCCADisplay::Instance().Ask();
#endif //DRAW
if( fNHits<=0 ) return;
}
- delete[] hitY;
- delete[] hitZ;
+ if( hitY ) delete[] hitY;
+ hitY=0;
+ if( hitZ ) delete[] hitZ;
+ hitZ=0;
TStopwatch timer1;
TStopwatch timer2;
//std::cout<<"Start CA reconstruction"<<std::endl;
for( Int_t iSlice=0; iSlice<fNSlices; iSlice++ ){
+ //std::cout<<"Reconstruct slice "<<iSlice<<std::endl;
TStopwatch timer;
AliHLTTPCCATracker &slice = fSlices[iSlice];
slice.Reconstruct();
//fTime+= timer.CpuTime();
//blaTime+= timer.CpuTime();
fStatTime[0] += timer.CpuTime();
- fStatTime[1]+=slice.Timers()[0];
- fStatTime[2]+=slice.Timers()[1];
- fStatTime[3]+=slice.Timers()[2];
- fStatTime[4]+=slice.Timers()[3];
- fStatTime[5]+=slice.Timers()[4];
- fStatTime[6]+=slice.Timers()[5];
- fStatTime[7]+=slice.Timers()[6];
- fStatTime[8]+=slice.Timers()[7];
+ fStatTime[1]+=slice.Timer(0);
+ fStatTime[2]+=slice.Timer(1);
+ fStatTime[3]+=slice.Timer(2);
+ fStatTime[4]+=slice.Timer(3);
+ fStatTime[5]+=slice.Timer(4);
+ fStatTime[6]+=slice.Timer(5);
+ fStatTime[7]+=slice.Timer(6);
+ fStatTime[8]+=slice.Timer(7);
}
timer2.Stop();
//std::cout<<"blaTime = "<<timer2.CpuTime()*1.e3<<std::endl;
fSliceTrackerTime = timer2.CpuTime();
-
+
for( Int_t iSlice=0; iSlice<fNSlices; iSlice++ ){
AliHLTTPCCATracker &iS = fSlices[iSlice];
if( fSliceTrackInfos[iSlice] ) delete[] fSliceTrackInfos[iSlice];
fSliceTrackInfos[iSlice]=0;
Int_t iNTracks = *iS.NOutTracks();
fSliceTrackInfos[iSlice] = new AliHLTTPCCAGBSliceTrackInfo[iNTracks];
+
for( Int_t itr=0; itr<iNTracks; itr++ ){
fSliceTrackInfos[iSlice][itr].fPrevNeighbour = -1;
fSliceTrackInfos[iSlice][itr].fNextNeighbour = -1;
}
//std::cout<<"Start CA merging"<<std::endl;
+ TStopwatch timerM;
+ Refit();
+ timerM.Stop();
+ fStatTime[9]+=timerM.CpuTime();
+ //fTime+=timerMerge.CpuTime();
+ //std::cout<<"Refit time = "<<timerM.CpuTime()*1.e3<<"ms"<<std::endl;
+
TStopwatch timerMerge;
Merging();
timerMerge.Stop();
fStatTime[9]+=timerMerge.CpuTime();
//fTime+=timerMerge.CpuTime();
+ //std::cout<<"Merge time = "<<timerMerge.CpuTime()*1.e3<<"ms"<<std::endl;
//std::cout<<"End CA merging"<<std::endl;
timer1.Stop();
fTime+= timer1.CpuTime();
firstSliceHit+=sliceNHits[is];
}
- delete[] hitY;
- delete[] hitZ;
+ if( hitY ) delete[] hitY;
+ if( hitZ ) delete[] hitZ;
}
//fTime+= timer.CpuTime();
//blaTime+= timer.CpuTime();
fStatTime[0] += timer.CpuTime();
- fStatTime[1]+=slice.Timers()[0];
- fStatTime[2]+=slice.Timers()[1];
- fStatTime[3]+=slice.Timers()[2];
- fStatTime[4]+=slice.Timers()[3];
- fStatTime[5]+=slice.Timers()[4];
- fStatTime[6]+=slice.Timers()[5];
- fStatTime[7]+=slice.Timers()[6];
- fStatTime[8]+=slice.Timers()[7];
+ fStatTime[1]+=slice.Timer(0);
+ fStatTime[2]+=slice.Timer(1);
+ fStatTime[3]+=slice.Timer(2);
+ fStatTime[4]+=slice.Timer(3);
+ fStatTime[5]+=slice.Timer(4);
+ fStatTime[6]+=slice.Timer(5);
+ fStatTime[7]+=slice.Timer(6);
+ fStatTime[8]+=slice.Timer(7);
}
timer2.Stop();
#endif //DRAW
}
-void AliHLTTPCCAGBTracker::Merging()
-{
- //* track merging between slices
- Float_t dalpha = fSlices[1].Param().Alpha() - fSlices[0].Param().Alpha();
- Int_t nextSlice[100], prevSlice[100];
- for( Int_t iSlice=0; iSlice<fNSlices; iSlice++ ){
- nextSlice[iSlice] = iSlice + 1;
- prevSlice[iSlice] = iSlice - 1;
- }
- nextSlice[ fNSlices/2 - 1 ] = 0;
- prevSlice[ 0 ] = fNSlices/2 - 1;
- nextSlice[ fNSlices - 1 ] = fNSlices/2;
- prevSlice[ fNSlices/2 ] = fNSlices - 1;
-
- TStopwatch timerMerge1;
-
- Int_t maxNSliceTracks = 0;
- for( Int_t iSlice=0; iSlice<fNSlices; iSlice++ ){
- AliHLTTPCCATracker &iS = fSlices[iSlice];
- if( maxNSliceTracks < *iS.NOutTracks() ) maxNSliceTracks = *iS.NOutTracks();
- }
-
- //* arrays for rotated track parameters
-
- AliHLTTPCCATrackParam *iTrParams[2], *jTrParams[2];
- Bool_t *iOK[2], *jOK[2];
- for( Int_t i=0; i<2; i++ ){
- iTrParams[i] = new AliHLTTPCCATrackParam[maxNSliceTracks];
- jTrParams[i] = new AliHLTTPCCATrackParam[maxNSliceTracks];
- iOK[i] = new Bool_t [maxNSliceTracks];
- jOK[i] = new Bool_t [maxNSliceTracks];
- }
-
- for( Int_t iSlice=0; iSlice<fNSlices; iSlice++ ){
- //std::cout<<"\nMerge slice "<<iSlice<<std::endl<<std::endl;
- AliHLTTPCCATracker &iS = fSlices[iSlice];
- Int_t jSlice = nextSlice[iSlice];
- AliHLTTPCCATracker &jS = fSlices[jSlice];
- Int_t iNTracks = *iS.NOutTracks();
- Int_t jNTracks = *jS.NOutTracks();
- if( iNTracks<=0 || jNTracks<=0 ) continue;
-
- //* prepare slice tracks for merging
-
- for (Int_t itr=0; itr<iNTracks; itr++) {
- iOK[0][itr] = 0;
- iOK[1][itr] = 0;
- if( iS.OutTracks()[itr].NHits()<10 ) continue;
- AliHLTTPCCATrackParam &iT1 = iTrParams[0][itr];
- AliHLTTPCCATrackParam &iT2 = iTrParams[1][itr];
- iT1 = iS.OutTracks()[itr].StartPoint();
- iT2 = iS.OutTracks()[itr].EndPoint();
- iOK[0][itr] = iT1.Rotate( dalpha/2 - CAMath::Pi()/2 );
- iOK[1][itr] = iT2.Rotate( dalpha/2 - CAMath::Pi()/2 );
-
- if( iOK[0][itr] ){
- iOK[0][itr] = iT1.TransportToX( 0, .99 );
- if( iS.Param().RMin() > iT1.Y() || iS.Param().RMax() < iT1.Y() ) iOK[0][itr]=0;
- }
- if( iOK[1][itr] ){
- iOK[1][itr] = iT2.TransportToX( 0, .99 );
- if( iS.Param().RMin() > iT2.Y() || iS.Param().RMax() < iT2.Y() ) iOK[1][itr]=0;
- }
- }
-
- for (Int_t jtr=0; jtr<jNTracks; jtr++) {
- jOK[0][jtr] = 0;
- jOK[1][jtr] = 0;
- if( jS.OutTracks()[jtr].NHits()<10 ) continue;
- AliHLTTPCCATrackParam &jT1 = jTrParams[0][jtr];
- AliHLTTPCCATrackParam &jT2 = jTrParams[1][jtr];
- jT1 = jS.OutTracks()[jtr].StartPoint();
- jT2 = jS.OutTracks()[jtr].EndPoint();
- jOK[0][jtr] = jT1.Rotate( -dalpha/2 - CAMath::Pi()/2 );
- jOK[1][jtr] = jT2.Rotate( -dalpha/2 - CAMath::Pi()/2 );
- if( jOK[0][jtr] ){
- jOK[0][jtr] = jT1.TransportToX( 0, .99 );
- if( jS.Param().RMin() > jT1.Y() || jS.Param().RMax() < jT1.Y() ) jOK[0][jtr]=0;
- }
- if( jOK[1][jtr] ){
- jOK[1][jtr] = jT2.TransportToX( 0, .99 );
- if( jS.Param().RMin() > jT2.Y() || jS.Param().RMax() < jT2.Y() ) jOK[1][jtr]=0;
- }
- }
-
- //* start merging
- //std::cout<<"Start slice merging.."<<std::endl;
- for (Int_t itr=0; itr<iNTracks; itr++) {
- if( !iOK[0][itr] && !iOK[1][itr] ) continue;
- Int_t jBest = -1;
- Int_t lBest = 0;
- for (Int_t jtr=0; jtr<jNTracks; jtr++) {
- if( jS.OutTracks()[jtr].NHits() < lBest ) continue;
- if( !jOK[0][jtr] && !jOK[1][jtr] ) continue;
- for( Int_t ip=0; ip<2 && (jBest!=jtr) ; ip++ ){
- if( !iOK[ip][itr] ) continue;
- for( Int_t jp=0; jp<2 && (jBest!=jtr) ; jp++ ){
- if( !jOK[jp][jtr] ) continue;
- AliHLTTPCCATrackParam &iT = iTrParams[ip][itr];
- AliHLTTPCCATrackParam &jT = jTrParams[jp][jtr];
- // check for neighbouring
- {
- Float_t factor2 = 3.5*3.5;
- Float_t d = jT.GetY() - iT.GetY();
- Float_t s2 = jT.GetErr2Y() + iT.GetErr2Y();
- if( d*d>factor2*s2 ){
- continue;
- }
- d = jT.GetZ() - iT.GetZ();
- s2 = jT.GetErr2Z() + iT.GetErr2Z();
- if( d*d>factor2*s2 ){
- continue;
- }
- Bool_t ok = 1;
- { // phi, kappa, DsDz signs are the same
- d = jT.GetSinPhi() - iT.GetSinPhi();
- s2 = jT.GetErr2SinPhi() + iT.GetErr2SinPhi();
- if( d*d>factor2*s2 ) ok = 0;
- d = jT.GetKappa() - iT.GetKappa();
- s2 = jT.GetErr2Kappa() + iT.GetErr2Kappa();
- if( d*d>factor2*s2 ) ok = 0;
- d = jT.GetDzDs() - iT.GetDzDs();
- s2 = jT.GetErr2DzDs() + iT.GetErr2DzDs();
- if( d*d>factor2*s2 ) ok = 0;
- }
- if( !ok ){ // phi, kappa, DsDz signs are the different
- d = jT.GetSinPhi() + iT.GetSinPhi();
- s2 = jT.GetErr2SinPhi() + iT.GetErr2SinPhi();
- if( d*d>factor2*s2 ) continue;
- d = jT.GetKappa() + iT.GetKappa();
- s2 = jT.GetErr2Kappa() + iT.GetErr2Kappa();
- if( d*d>factor2*s2 ) continue;
- d = jT.GetDzDs() + iT.GetDzDs();
- s2 = jT.GetErr2DzDs() + iT.GetErr2DzDs();
- if( d*d>factor2*s2 ) continue;
- }
- // tracks can be matched
-
- lBest = jS.OutTracks()[jtr].NHits();
- jBest = jtr;
- }
- }
- }
- }
- if( jBest>=0 ){
- Int_t oldi = fSliceTrackInfos[jSlice][jBest].fPrevNeighbour;
- if( oldi >= 0 ){
- if( iS.OutTracks()[ oldi ].NHits() < iS.OutTracks()[ itr ].NHits() ){
- fSliceTrackInfos[jSlice][jBest].fPrevNeighbour = -1;
- fSliceTrackInfos[iSlice][oldi].fNextNeighbour = -1;
- } else continue;
- }
- //SG!!!
- fSliceTrackInfos[iSlice][itr].fNextNeighbour = jBest;
- fSliceTrackInfos[jSlice][jBest].fPrevNeighbour = itr;
- }
- }
- }
-
- for( Int_t i=0; i<2; i++){
- if( iTrParams[i] ) delete[] iTrParams[i];
- if( jTrParams[i] ) delete[] jTrParams[i];
- if( iOK[i] ) delete[] iOK[i];
- if( jOK[i] ) delete[] jOK[i];
- }
-
- timerMerge1.Stop();
- fStatTime[10]+=timerMerge1.CpuTime();
-
- TStopwatch timerMerge2;
-
- Int_t nTracksTot = 0;
- for( Int_t iSlice = 0; iSlice<fNSlices; iSlice++ ){
- AliHLTTPCCATracker &slice = fSlices[iSlice];
- nTracksTot+= *slice.NOutTracks();
- }
-
- if( fTrackHits ) delete[] fTrackHits;
- fTrackHits = 0;
- if(fTracks ) delete[] fTracks;
- fTracks = 0;
- fTrackHits = new Int_t [fNHits*10];
- fTracks = new AliHLTTPCCAGBTrack[nTracksTot];
- fNTracks = 0;
-
- Int_t nTrackHits = 0;
-
- //std::cout<<"\nStart global track creation...\n"<<std::endl;
-
- static Int_t nRejected = 0;
+void AliHLTTPCCAGBTracker::Refit()
+{
+ //* Refit the slice tracks
Int_t maxNRows = fSlices[0].Param().NRows();
for( Int_t iSlice = 0; iSlice<fNSlices; iSlice++ ){
AliHLTTPCCATracker &slice = fSlices[iSlice];
+
for( Int_t itr=0; itr<*slice.NOutTracks(); itr++ ){
- if( fSliceTrackInfos[iSlice][itr].fUsed ) continue;
- //std::cout<<"\n slice "<<iSlice<<", track "<<itr<<"\n"<<std::endl;
- //AliHLTTPCCAOutTrack &tCA = slice.OutTracks()[itr];
- AliHLTTPCCAGBTrack &t = fTracks[fNTracks];
- //t.Param() = tCA.StartPoint();
- //t.Alpha() = slice.Param().Alpha();
- t.NHits() = 0;
- t.FirstHitRef() = nTrackHits;
+ AliHLTTPCCAOutTrack &iTr = slice.OutTracks()[itr];
+
struct FitPoint{
Int_t fISlice;
Int_t fHitID;
Float_t fX, fY, fZ, fErr2Y, fErr2Z, fAmp;
} fitPoints[300];
for( Int_t i=0; i<maxNRows; i++ ) fitPoints[i].fISlice = -1;
-
+
Int_t nHits = 0;
- Int_t jSlice = iSlice;
- Int_t jtr = itr;
- do{
- if( fSliceTrackInfos[jSlice][jtr].fUsed ) break;
- fSliceTrackInfos[jSlice][jtr].fUsed = 1;
- AliHLTTPCCATracker &jslice = fSlices[jSlice];
- AliHLTTPCCAOutTrack &jTr = jslice.OutTracks()[jtr];
- for( Int_t jhit=0; jhit<jTr.NHits(); jhit++){
- Int_t id = fFirstSliceHit[jSlice] + jslice.OutTrackHits()[jTr.FirstHitRef()+jhit];
- AliHLTTPCCAGBHit &h = fHits[id];
- FitPoint &p = fitPoints[h.IRow()];
- if( p.fISlice >=0 ) continue;
- p.fISlice = h.ISlice();
- p.fHitID = id;
- p.fX = jslice.Rows()[h.IRow()].X();
- p.fY = h.Y();
- p.fZ = h.Z();
- //p.fErr2Y = h.ErrY()*h.ErrY();
- //p.fErr2Z = h.ErrZ()*h.ErrZ();
- p.fAmp = h.Amp();
- nHits++;
- }
- jtr = fSliceTrackInfos[jSlice][jtr].fNextNeighbour;
- jSlice = nextSlice[jSlice];
- } while( jtr >=0 );
-
- if( nHits < 10 ) continue; //SG!!!
+
+ for( Int_t ihit=0; ihit<iTr.NHits(); ihit++){
+ Int_t id = fFirstSliceHit[iSlice] + slice.OutTrackHits()[iTr.FirstHitRef()+ihit];
+ AliHLTTPCCAGBHit &h = fHits[id];
+ FitPoint &p = fitPoints[h.IRow()];
+ if( p.fISlice >=0 ) continue;
+ p.fISlice = h.ISlice();
+ p.fHitID = id;
+ p.fX = slice.Row(h.IRow()).X();
+ p.fY = h.Y();
+ p.fZ = h.Z();
+ p.fAmp = h.Amp();
+ nHits++;
+ }
+
+ //if( nHits < 10 ) continue; SG!!!
Int_t firstRow = 0, lastRow = maxNRows-1;
for( firstRow=0; firstRow<maxNRows; firstRow++ ){
midRow = i;
}
if( midRow==firstRow || midRow==lastRow ) continue;
-
+
Int_t searchRows[300];
Int_t nSearchRows = 0;
for( Int_t i=firstRow; i<=lastRow; i++ ) searchRows[nSearchRows++] = i;
- for( Int_t i=lastRow+1; i<maxNRows; i++ ) searchRows[nSearchRows++] = i;
- for( Int_t i=firstRow-1; i>=0; i-- ) searchRows[nSearchRows++] = i;
-
- // refit
- AliHLTTPCCATrackParam t0;
-
- {
-
- {
+ //std::cout<<"\nRefit slice "<<iSlice<<" track "<<itr<<": "<<std::endl;
+ // refit down
+ {
+ AliHLTTPCCATrackParam t0 = iTr.StartPoint();
+ /*
+ {
+
+ {
FitPoint &p0 = fitPoints[firstRow];
FitPoint &p1 = fitPoints[midRow];
FitPoint &p2 = fitPoints[lastRow];
Float_t x0=p0.fX, y0=p0.fY, z0=p0.fZ;
Float_t x1=p1.fX, y1=p1.fY, z1=p1.fZ;
Float_t x2=p2.fX, y2=p2.fY, z2=p2.fZ;
- if( p1.fISlice!=p0.fISlice ){
- Float_t dAlpha = fSlices[p0.fISlice].Param().Alpha() - fSlices[p1.fISlice].Param().Alpha();
- Float_t c = CAMath::Cos(dAlpha);
- Float_t s = CAMath::Sin(dAlpha);
- x1 = p1.fX*c + p1.fY*s;
- y1 = p1.fY*c - p1.fX*s;
- }
- if( p2.fISlice!=p0.fISlice ){
- Float_t dAlpha = fSlices[p0.fISlice].Param().Alpha() - fSlices[p2.fISlice].Param().Alpha();
- Float_t c = CAMath::Cos(dAlpha);
- Float_t s = CAMath::Sin(dAlpha);
- x2 = p2.fX*c + p2.fY*s;
- y2 = p2.fY*c - p2.fX*s;
- }
-
Float_t sp0[5] = {x0, y0, z0, .5, .5 };
Float_t sp1[5] = {x1, y1, z1, .5, .5 };
Float_t sp2[5] = {x2, y2, z2, .5, .5 };
t0.ConstructXYZ3(sp0,sp1,sp2,1., 0);
}
-
- Int_t currslice = fitPoints[firstRow].fISlice;
-
+
for( Int_t rowID=0; rowID<nSearchRows; rowID++ ){
Int_t iRow = searchRows[rowID];
- FitPoint &p = fitPoints[iRow];
-
- if( p.fISlice>=0 ){
-
- //* Existing hit
-
- //* Rotate to the new slice
-
- if( p.fISlice!=currslice ){
- if( !t0.Rotate( fSlices[p.fISlice].Param().Alpha() - fSlices[currslice].Param().Alpha() ) ) continue;
- currslice = p.fISlice;
- }
- //* Transport to the new row
-
- if( !t0.TransportToX( p.fX, .99 ) ) continue;
-
- //* Calculate hit errors
-
- GetErrors2( p.fISlice, iRow, t0, p.fErr2Y, p.fErr2Z );
-
- } else {
- //continue; //SG!!
- //* Search for the missed hit
-
- Float_t factor2 = 3.5*3.5;
-
- AliHLTTPCCATracker *cslice = &(fSlices[currslice]);
- AliHLTTPCCARow *row = &(cslice->Rows()[iRow]);
- if( !t0.TransportToX( row->X(), .99 ) ) continue;
-
- if( t0.GetY() > row->MaxY() ){ //next slice
-
- Int_t j = nextSlice[currslice];
-
- //* Rotate to the new slice
-
- if( !t0.Rotate( -fSlices[currslice].Param().Alpha() +fSlices[j].Param().Alpha() ) ) continue;
- currslice = j;
- cslice = &(fSlices[currslice]);
- row = &(cslice->Rows()[iRow]);
- if( !t0.TransportToX( row->X(), .99 ) ) continue;
- if( CAMath::Abs(t0.GetY()) > row->MaxY() ) continue;
-
- }else if( t0.GetY() < -row->MaxY() ){ //prev slice
- Int_t j = prevSlice[currslice];
- //* Rotate to the new slice
- if( !t0.Rotate( -fSlices[currslice].Param().Alpha() +fSlices[j].Param().Alpha() ) ) break;
- currslice = j;
- cslice = &(fSlices[currslice]);
- row = &(cslice->Rows()[iRow]);
- if( !t0.TransportToX( row->X(), .99 ) ) continue;
- if( CAMath::Abs(t0.GetY()) > row->MaxY() ) continue;
- }
-
- Int_t bestsh = -1;
- Float_t ds = 1.e10;
- Float_t y0 = row->Grid().YMin();
- Float_t z0 = row->Grid().ZMin();
- Float_t stepY = row->HstepY();
- Float_t stepZ = row->HstepZ();
- uint4* tmpint4 = cslice->RowData() + row->FullOffset();
- ushort2 *hits = reinterpret_cast<ushort2*>(tmpint4);
-
- for( Int_t ish=0; ish<row->NHits(); ish++ ){
- AliHLTTPCCAHit sh;// = cslice->Hits()[row->FirstHit()+ish];
- {
- ushort2 hh = hits[ish];
- sh.Y() = y0 + hh.x*stepY;
- sh.Z() = z0 + hh.y*stepZ;
- }
-
- Float_t dy = sh.Y() - t0.GetY();
- Float_t dz = sh.Z() - t0.GetZ();
- Float_t dds = dy*dy+dz*dz;
- if( dds<ds ){
- ds = dds;
- bestsh = ish;
- }
- }
- if( bestsh<0 ) continue;
-
- //* Calculate hit errors
-
- GetErrors2( currslice, iRow, t0, p.fErr2Y, p.fErr2Z );
-
- AliHLTTPCCAHit sh;// = cslice->Hits()[row->FirstHit()+bestsh];
- {
- ushort2 hh = hits[bestsh];
- sh.Y() = y0 + hh.x*stepY;
- sh.Z() = z0 + hh.y*stepZ;
- }
-
- Float_t dy = sh.Y() - t0.GetY();
- Float_t dz = sh.Z() - t0.GetZ();
- Float_t s2z = /*t0.GetErr2Z() + */ p.fErr2Z;
- if( dz*dz>factor2*s2z ) continue;
- Float_t s2y = /*t0.GetErr2Y() + */ p.fErr2Y;
- if( dy*dy>factor2*s2y ) continue;
-
- p.fISlice = currslice;
- p.fHitID = fFirstSliceHit[p.fISlice] + cslice->HitInputIDs()[row->FirstHit() + bestsh];
- p.fX = row->X();
- p.fY = sh.Y();
- p.fZ = sh.Z();
- p.fAmp = fHits[p.fHitID].Amp();
- }
-
- //* Update the track
-
+ FitPoint &p = fitPoints[iRow];
+ if( p.fISlice<0 ) continue;
+ if( !t0.TransportToX( p.fX, .99 ) ) continue;
+ GetErrors2( p.fISlice, iRow, t0, p.fErr2Y, p.fErr2Z );
t0.Filter2( p.fY, p.fZ, p.fErr2Y, p.fErr2Z, .99 );
}
-
+ */
//* final refit, dE/dx calculation
//std::cout<<"\n\nstart refit..\n"<<std::endl;
+ AliHLTTPCCATrackParam t00 = t0;
AliHLTTPCCATrackParam::AliHLTTPCCATrackFitParam fitPar;
- {
+ if(1){
Double_t sumDeDx = 0;
Int_t nDeDx = 0;
- t.NHits() = 0;
-
+
t0.CalculateFitParameters( fitPar, fSlices[0].Param().Bz() );
-
- t0.Cov()[ 0] = .1;
- t0.Cov()[ 1] = 0;
- t0.Cov()[ 2] = .1;
- t0.Cov()[ 3] = 0;
- t0.Cov()[ 4] = 0;
- t0.Cov()[ 5] = .1;
- t0.Cov()[ 6] = 0;
- t0.Cov()[ 7] = 0;
- t0.Cov()[ 8] = 0;
- t0.Cov()[ 9] = .1;
- t0.Cov()[10] = 0;
- t0.Cov()[11] = 0;
- t0.Cov()[12] = 0;
- t0.Cov()[13] = 0;
- t0.Cov()[14] = .1;
- t0.Chi2() = 0;
- t0.NDF() = -5;
+ /*
+ t0.Cov()[ 0] = .1;
+ t0.Cov()[ 1] = 0;
+ t0.Cov()[ 2] = .1;
+ t0.Cov()[ 3] = 0;
+ t0.Cov()[ 4] = 0;
+ t0.Cov()[ 5] = .1;
+ t0.Cov()[ 6] = 0;
+ t0.Cov()[ 7] = 0;
+ t0.Cov()[ 8] = 0;
+ t0.Cov()[ 9] = .1;
+ t0.Cov()[10] = 0;
+ t0.Cov()[11] = 0;
+ t0.Cov()[12] = 0;
+ t0.Cov()[13] = 0;
+ t0.Cov()[14] = .1;
+ */
+ t0.SetChi2( 0 );
+ t0.SetNDF( -5 );
Bool_t first = 1;
for( Int_t iRow = maxNRows-1; iRow>=0; iRow-- ){
FitPoint &p = fitPoints[iRow];
if( p.fISlice<0 ) continue;
- fTrackHits[nTrackHits+t.NHits()] = p.fHitID;
- t.NHits()++;
-
- //* Rotate to the new slice
-
- if( p.fISlice!=currslice ){
- //std::cout<<"rotate..."<<std::endl;
- //std::cout<<" before rotation:"<<std::endl;
- //t0.Print();
- if( !t0.Rotate( fSlices[p.fISlice].Param().Alpha() - fSlices[currslice].Param().Alpha() ) ) continue;
- //std::cout<<" after rotation:"<<std::endl;
+ //std::cout<<" row "<<iRow<<std::endl;
+ //t00.Print();
+ //t0.Print();
+ //if( !t0.TransportToX( p.fX, t00, .99 ) ){
+ if( !t0.TransportToXWithMaterial( p.fX, t00, fitPar ) ){
+ //std::cout<<"row "<<iRow<<": can not transport!!!"<<std::endl;
+ //t00.Print();
//t0.Print();
- currslice = p.fISlice;
+ continue;
}
- //* Transport to the new row
-
- //std::cout<<" before transport:"<<std::endl;
- //t0.Print();
- //if( !t0.TransportToX( p.fX, .99 ) ) continue;
- if( !t0.TransportToXWithMaterial( p.fX, fitPar ) ) continue;
- //if( !t0.TransportToX( p.fX, .99 ) ) continue;
- //std::cout<<" after transport:"<<std::endl;
- //t0.Print();
-
//* Update the track
if( first ){
- t0.Cov()[ 0] = .5*.5;
- t0.Cov()[ 1] = 0;
- t0.Cov()[ 2] = .5*.5;
- t0.Cov()[ 3] = 0;
- t0.Cov()[ 4] = 0;
- t0.Cov()[ 5] = .2*.2;
- t0.Cov()[ 6] = 0;
- t0.Cov()[ 7] = 0;
- t0.Cov()[ 8] = 0;
- t0.Cov()[ 9] = .2*.2;
- t0.Cov()[10] = 0;
- t0.Cov()[11] = 0;
- t0.Cov()[12] = 0;
- t0.Cov()[13] = 0;
- t0.Cov()[14] = .5*.5;
- t0.Chi2() = 0;
- t0.NDF() = -5;
+ t0.SetCov( 0, 10 );
+ t0.SetCov( 1, 0 );
+ t0.SetCov( 2, 10 );
+ t0.SetCov( 3, 0 );
+ t0.SetCov( 4, 0 );
+ t0.SetCov( 5, 1 );
+ t0.SetCov( 6, 0 );
+ t0.SetCov( 7, 0 );
+ t0.SetCov( 8, 0 );
+ t0.SetCov( 9, 1 );
+ t0.SetCov(10, 0 );
+ t0.SetCov(11, 0 );
+ t0.SetCov(12, 0 );
+ t0.SetCov(13, 0 );
+ t0.SetCov(14, 1 );
+ t0.SetChi2( 0 );
+ t0.SetNDF( -5 );
}
+
+ slice.GetErrors2( iRow, t00, p.fErr2Y, p.fErr2Z );
- //std::cout<<" before filtration:"<<std::endl;
- //t0.Print();
-
- if( !t0.Filter2( p.fY, p.fZ, p.fErr2Y, p.fErr2Z, .99 ) ) continue;
- //std::cout<<" after filtration:"<<std::endl;
- //t0.Print();
- first = 0;
+ if( !t0.Filter2NoCos( p.fY, p.fZ, p.fErr2Y, p.fErr2Z ) ){
+ //std::cout<<"row "<<iRow<<": can not filter!!!"<<std::endl;
+ //t00.Print();
+ //t0.Print();
+ continue;
+ }
+ first = 0;
- if( CAMath::Abs( t0.CosPhi() )>1.e-4 ){
- Float_t dLdX = CAMath::Sqrt(1.+t0.DzDs()*t0.DzDs())/CAMath::Abs(t0.CosPhi());
+ if( CAMath::Abs( t00.CosPhi() )>1.e-4 ){
+ Float_t dLdX = CAMath::Sqrt(1.+t00.DzDs()*t00.DzDs())/CAMath::Abs(t00.CosPhi());
sumDeDx+=p.fAmp/dLdX;
nDeDx++;
- }
+ }
+
}
- t.DeDx() = 0;
- if( nDeDx >0 ) t.DeDx() = sumDeDx/nDeDx;
+ //t.DeDx() = 0;
+ //if( nDeDx >0 ) t.DeDx() = sumDeDx/nDeDx;
if( t0.GetErr2Y()<=0 ){
//std::cout<<"nhits = "<<t.NHits()<<", t0.GetErr2Y() = "<<t0.GetErr2Y()<<std::endl;
//t0.Print();
//exit(1);
}
}
-
- if( t.NHits()<30 ) continue;//SG!!
- Double_t dAlpha = 0;
+
{
- Double_t xTPC=83.65;
- Double_t ddAlpha = 0.00609235;
+ Bool_t ok=1;
- if( t0.TransportToXWithMaterial( xTPC, fitPar ) ){
- Double_t y=t0.GetY();
- Double_t ymax=xTPC*CAMath::Tan(dAlpha/2.);
- if (y > ymax) {
- if( t0.Rotate( ddAlpha ) ){ dAlpha=ddAlpha; t0.TransportToXWithMaterial( xTPC, fitPar ); }
- } else if (y <-ymax) {
- if( t0.Rotate( -ddAlpha ) ){ dAlpha=-ddAlpha; t0.TransportToXWithMaterial( xTPC, fitPar );}
- }
+ const Float_t *c = t0.Cov();
+ for( Int_t i=0; i<15; i++ ) ok = ok && finite(c[i]);
+ for( Int_t i=0; i<5; i++ ) ok = ok && finite(t0.Par()[i]);
+ ok = ok && (t0.GetX()>50);
+
+ if( c[0]<=0 || c[2]<=0 || c[5]<=0 || c[9]<=0 || c[14]<=0 ) ok = 0;
+ //if( c[0]>5. || c[2]>5. || c[5]>2. || c[9]>2 || c[14]>2 ) ok = 0;
+
+ if( CAMath::Abs(t0.SinPhi())>.99 ) ok = 0;
+ else t0.SetCosPhi( CAMath::Sqrt(1.-t0.SinPhi()*t0.SinPhi()) );
+
+ if(!ok){
+ //std::cout<<" nan check: track rejected"<<std::endl;
+ //nRejected++;
+ //std::cout<<"\n\nRejected: "<<nRejected<<"\n"<<std::endl;
+ continue;
}
}
+
+ if( CAMath::Abs(t0.Kappa())<1.e-8 ) t0.SetKappa( 1.e-8 );
+ t0.TransportToX( slice.Row(firstRow).X(), .99 );
+ iTr.SetStartPoint( t0 );
+ }
+
+ // refit up
+ {
+ AliHLTTPCCATrackParam t0 = iTr.StartPoint();
+
+ AliHLTTPCCATrackParam t00 = t0;
+ AliHLTTPCCATrackParam::AliHLTTPCCATrackFitParam fitPar;
+ if(1){
+
+ t0.CalculateFitParameters( fitPar, fSlices[0].Param().Bz() );
+ t0.SetChi2( 0 );
+ t0.SetNDF( -5 );
+ Bool_t first = 1;
+ for( Int_t iRow = 0; iRow<maxNRows; iRow++ ){
+ FitPoint &p = fitPoints[iRow];
+ if( p.fISlice<0 ) continue;
+ if( !t0.TransportToXWithMaterial( p.fX, t00, fitPar ) ){
+ //std::cout<<"row "<<iRow<<": can not transport!!!"<<std::endl;
+ //t00.Print();
+ //t0.Print();
+ continue;
+ }
+
+ //* Update the track
+
+ if( first ){
+ t0.SetCov( 0, 10 );
+ t0.SetCov( 1, 0 );
+ t0.SetCov( 2, 10 );
+ t0.SetCov( 3, 0 );
+ t0.SetCov( 4, 0 );
+ t0.SetCov( 5, 1 );
+ t0.SetCov( 6, 0 );
+ t0.SetCov( 7, 0 );
+ t0.SetCov( 8, 0 );
+ t0.SetCov( 9, 1 );
+ t0.SetCov(10, 0 );
+ t0.SetCov(11, 0 );
+ t0.SetCov(12, 0 );
+ t0.SetCov(13, 0 );
+ t0.SetCov(14, 1 );
+ t0.SetChi2( 0 );
+ t0.SetNDF( -5 );
+ }
+
+ slice.GetErrors2( iRow, t00, p.fErr2Y, p.fErr2Z );
+ if( !t0.Filter2NoCos( p.fY, p.fZ, p.fErr2Y, p.fErr2Z ) ){
+ //std::cout<<"row "<<iRow<<": can not filter!!!"<<std::endl;
+ //t00.Print();
+ //t0.Print();
+ continue;
+ }
+ first = 0;
+ }
+ }
+
{
Bool_t ok=1;
- Float_t *c = t0.Cov();
+ const Float_t *c = t0.Cov();
for( Int_t i=0; i<15; i++ ) ok = ok && finite(c[i]);
for( Int_t i=0; i<5; i++ ) ok = ok && finite(t0.Par()[i]);
ok = ok && (t0.GetX()>50);
if( c[0]<=0 || c[2]<=0 || c[5]<=0 || c[9]<=0 || c[14]<=0 ) ok = 0;
//if( c[0]>5. || c[2]>5. || c[5]>2. || c[9]>2 || c[14]>2 ) ok = 0;
+
+ if( CAMath::Abs(t0.SinPhi())>.99 ) ok = 0;
+ else t0.SetCosPhi( CAMath::Sqrt(1.-t0.SinPhi()*t0.SinPhi()) );
+
if(!ok){
- nRejected++;
+ //std::cout<<" refit: nan check: track rejected"<<std::endl;
+ //nRejected++;
//std::cout<<"\n\nRejected: "<<nRejected<<"\n"<<std::endl;
continue;
}
}
+
+ if( CAMath::Abs(t0.Kappa())<1.e-8 ) t0.SetKappa( 1.e-8 );
+ t0.TransportToX( slice.Row(lastRow).X(), .99 );
+ iTr.SetEndPoint( t0 );
+ }
+ }
+ }
+}
- if( CAMath::Abs(t0.Kappa())<1.e-8 ) t0.Kappa() = 1.e-8;
- t.Param() = t0;
- t.Alpha() = fSlices[currslice].Param().Alpha() + dAlpha;
- nTrackHits+= t.NHits();
- fNTracks++;
+
+Bool_t AliHLTTPCCAGBTracker::FitTrack( AliHLTTPCCATrackParam &T, AliHLTTPCCATrackParam t0,
+ Float_t &Alpha, Int_t hits[], Int_t &NTrackHits, Float_t &DeDx,
+ Bool_t dir )
+{
+ // Fit the track
+
+ AliHLTTPCCATrackParam::AliHLTTPCCATrackFitParam fitPar;
+ Double_t sumDeDx = 0;
+ Int_t nDeDx = 0;
+ AliHLTTPCCATrackParam t = t0;
+ Bool_t first = 1;
+
+ t0.CalculateFitParameters( fitPar, fSlices[0].Param().Bz() );
+
+ Int_t hitsNew[1000];
+ Int_t nHitsNew = 0;
+
+ for( Int_t ihit=0; ihit<NTrackHits; ihit++){
+ Int_t jhit = dir ?(NTrackHits-1-ihit) :ihit;
+ AliHLTTPCCAGBHit &h = fHits[hits[jhit]];
+ Int_t iSlice = h.ISlice();
+ AliHLTTPCCATracker &slice = fSlices[iSlice];
+
+ if( slice.Param().Alpha()!=Alpha ){
+ if( ! t.RotateNoCos( slice.Param().Alpha() - Alpha, t0, .999 ) ) continue;
+ Alpha = slice.Param().Alpha();
+ }
+
+ Float_t x = slice.Row(h.IRow()).X();
+
+ if( !t.TransportToXWithMaterial( x, t0, fitPar ) ) continue;
+
+ if( first ){
+ t.SetCov( 0, 10 );
+ t.SetCov( 1, 0 );
+ t.SetCov( 2, 10 );
+ t.SetCov( 3, 0 );
+ t.SetCov( 4, 0 );
+ t.SetCov( 5, 1 );
+ t.SetCov( 6, 0 );
+ t.SetCov( 7, 0 );
+ t.SetCov( 8, 0 );
+ t.SetCov( 9, 1 );
+ t.SetCov(10, 0 );
+ t.SetCov(11, 0 );
+ t.SetCov(12, 0 );
+ t.SetCov(13, 0 );
+ t.SetCov(14, 1 );
+ t.SetChi2( 0 );
+ t.SetNDF( -5 );
+ t0.CalculateFitParameters( fitPar, fSlices[0].Param().Bz() );
+ }
+
+ Float_t err2Y, err2Z;
+ slice.GetErrors2( h.IRow(), t0, err2Y, err2Z );
+ if( !t.Filter2NoCos( h.Y(), h.Z(), err2Y, err2Z ) ) continue;
+ first = 0;
+
+ if( CAMath::Abs( t0.CosPhi() )>1.e-4 ){
+ Float_t dLdX = CAMath::Sqrt(1.+t0.DzDs()*t0.DzDs())/CAMath::Abs(t0.CosPhi());
+ sumDeDx+=h.Amp()/dLdX;
+ nDeDx++;
+ }
+ hitsNew[nHitsNew++] = hits[jhit];
+ }
+
+
+ DeDx = 0;
+ if( nDeDx >0 ) DeDx = sumDeDx/nDeDx;
+
+ if( CAMath::Abs(t.Kappa())<1.e-8 ) t.SetKappa( 1.e-8 );
+
+ Bool_t ok=1;
+
+ const Float_t *c = t.Cov();
+ for( Int_t i=0; i<15; i++ ) ok = ok && finite(c[i]);
+ for( Int_t i=0; i<5; i++ ) ok = ok && finite(t.Par()[i]);
+ ok = ok && (t.GetX()>50);
+
+ if( c[0]<=0 || c[2]<=0 || c[5]<=0 || c[9]<=0 || c[14]<=0 ) ok = 0;
+ //if( c[0]>5. || c[2]>5. || c[5]>2. || c[9]>2 || c[14]>2 ) ok = 0;
+
+ if( CAMath::Abs(t.SinPhi())>.99 ) ok = 0;
+ else if( t0.CosPhi()>=0 ) t.SetCosPhi( CAMath::Sqrt(1.-t.SinPhi()*t.SinPhi()) );
+ else t.SetCosPhi( -CAMath::Sqrt(1.-t.SinPhi()*t.SinPhi()) );
+
+ if( ok ){
+ T = t;
+ NTrackHits = nHitsNew;
+ for( Int_t i=0; i<NTrackHits; i++ ){
+ hits[dir ?(NTrackHits-1-i) :i] = hitsNew[i];
+ }
+ }
+ return ok;
+}
+
+
+Float_t AliHLTTPCCAGBTracker::GetChi2( Float_t x1, Float_t y1, Float_t a00, Float_t a10, Float_t a11,
+ Float_t x2, Float_t y2, Float_t b00, Float_t b10, Float_t b11 )
+{
+ //* Calculate Chi2/ndf deviation
+
+ Float_t d[2]={ x1-x2, y1-y2 };
+
+ Float_t mSi[3] = { a00 + b00, a10 + b10, a11 + b11 };
+
+ Float_t s = ( mSi[0]*mSi[2] - mSi[1]*mSi[1] );
+
+ if( s < 1.E-10 ) return 10000.;
+
+ Float_t mS[3] = { mSi[2], -mSi[1], mSi[0] };
+
+ return TMath::Abs( ( ( mS[0]*d[0] + mS[1]*d[1] )*d[0]
+ +(mS[1]*d[0] + mS[2]*d[1] )*d[1] )/s/2);
+
+}
+
+
+void AliHLTTPCCAGBTracker::MakeBorderTracks( Int_t iSlice, Int_t iBorder, AliHLTTPCCABorderTrack B[], Int_t &nB )
+{
+ //* prepare slice tracks for merging
+ static int statAll=0, statOK=0;
+ nB = 0;
+ AliHLTTPCCATracker &slice = fSlices[iSlice];
+ Float_t dAlpha = ( fSlices[1].Param().Alpha() - fSlices[0].Param().Alpha() )/2;
+ Float_t x0 = 0;
+
+ if( iBorder==0 ){
+ dAlpha = dAlpha - CAMath::Pi()/2 ;
+ } else if( iBorder==1 ){
+ dAlpha = -dAlpha - CAMath::Pi()/2 ;
+ } else if( iBorder==2 ){
+ dAlpha = dAlpha;
+ x0 = slice.Row(63).X();
+ }else if( iBorder==3 ){
+ dAlpha = -dAlpha;
+ x0 = slice.Row(63).X();
+ } else if( iBorder==4 ){
+ dAlpha = 0;
+ x0 = slice.Row(63).X();
+ }
+
+ for (Int_t itr=0; itr<*slice.NOutTracks(); itr++) {
+ AliHLTTPCCAOutTrack &t = slice.OutTracks()[itr];
+
+ AliHLTTPCCATrackParam t0 = t.StartPoint();
+ AliHLTTPCCATrackParam t1 = t.EndPoint();
+ Bool_t ok0 = t0.Rotate( dAlpha,.9 );
+ Bool_t ok1 = t1.Rotate( dAlpha,.9 );
+
+ Bool_t do0 = ok0;
+ Bool_t do1 = ok1 && ( !ok0 || t1.CosPhi()*t0.CosPhi()<0 );
+
+ if( ok0 && !do1 && ok1 && (t1.X() < t0.X()) ){
+ do0 = 0;
+ do1 = 1;
+ }
+
+ if( do0 ){
+ AliHLTTPCCABorderTrack &b = B[nB];
+ b.fOK = 1;
+ b.fITrack = itr;
+ b.fNHits = t.NHits();
+ b.fIRow = fHits[ fFirstSliceHit[iSlice] + slice.OutTrackHits()[t.FirstHitRef()+0]].IRow();
+ b.fParam = t0;
+ b.fX = t0.GetX();
+ if( b.fParam.TransportToX( x0, .9 ) ) nB++;
+ //else std::cout<<"0: can not transport to x="<<x0<<std::endl;
+
+ }
+ if( do1 ){
+ AliHLTTPCCABorderTrack &b = B[nB];
+ b.fOK = 1;
+ b.fITrack = itr;
+ b.fNHits = t.NHits();
+ b.fIRow = fHits[ fFirstSliceHit[iSlice] + slice.OutTrackHits()[t.FirstHitRef()+t.NHits()-1]].IRow();
+ b.fParam = t1;
+ b.fX = t0.GetX();
+ if( b.fParam.TransportToX( x0, .9 ) ) nB++;
+ //else std::cout<<"1: can not transport to x="<<x0<<std::endl;
+ }
+ if( do0 || do1 ) statOK++;
+ statAll++;
+ }
+ //std::cout<<"\n\n Stat all, stat ok = "<<statAll<<" "<<statOK<<std::endl;
+}
+
+
+void AliHLTTPCCAGBTracker::SplitBorderTracks( Int_t iSlice1, AliHLTTPCCABorderTrack B1[], Int_t N1,
+ Int_t iSlice2, AliHLTTPCCABorderTrack B2[], Int_t N2,
+ Float_t Alpha
+ )
+{
+ //* split two sets of tracks
+
+ Float_t factor2y = 2.6;
+ Float_t factor2z = 4.0;
+ Float_t factor2s = 2.6;
+ Float_t factor2t = 2.0;
+ Float_t factor2k = 2.2;
+ Float_t factor2ys = 1.5;
+ Float_t factor2zt = 1.5;
+
+ AliHLTTPCCATracker &slice1 = fSlices[iSlice1];
+ AliHLTTPCCATracker &slice2 = fSlices[iSlice2];
+
+ factor2y = 3.5*3.5*factor2y*factor2y;
+ factor2z = 3.5*3.5*factor2z*factor2z;
+ factor2s = 3.5*3.5*factor2s*factor2s;
+ factor2t = 3.5*3.5*factor2t*factor2t;
+ factor2k = 3.5*3.5*factor2k*factor2k;
+ factor2ys = 3.5*3.5*factor2ys*factor2ys;
+ factor2zt = 3.5*3.5*factor2zt*factor2zt;
+
+ Int_t minNPartHits = 10;//SG!!!
+ Int_t minNTotalHits = 20;
+ //Float_t maxDX = slice1.Row(40).X() - slice1.Row(0).X();
+
+ for (Int_t i1=0; i1<N1; i1++) {
+ AliHLTTPCCABorderTrack &b1 = B1[i1];
+ if( !b1.fOK ) continue;
+ if( b1.fNHits < minNPartHits ) continue;
+ AliHLTTPCCATrackParam &t1 = b1.fParam;
+ Int_t iBest2 = -1;
+ Int_t lBest2 = 0;
+ Int_t start2 = (iSlice1!=iSlice2) ?0 :i1+1;
+ for (Int_t i2=start2; i2<N2; i2++) {
+ AliHLTTPCCABorderTrack &b2 = B2[i2];
+ if( !b2.fOK ) continue;
+ if( b2.fNHits < minNPartHits ) continue;
+ if( b2.fNHits < lBest2 ) continue;
+ if( b1.fNHits + b2.fNHits < minNTotalHits ) continue;
+ //if( TMath::Abs(b1.fX - b2.fX)>maxDX ) continue;
+ AliHLTTPCCATrackParam &t2 = b2.fParam;
+
+ if( Alpha!=-1 ){
+#ifdef DRAW
+ std::cout<<"Try to merge tracks "<<i1<<" and "<<i2<<":"<<std::endl;
+ t1.Print();
+ t2.Print();
+
+ Float_t c= t2.CosPhi()*t1.CosPhi()>0 ?1 :-1;
+ Float_t dy = t2.GetY() - t1.GetY();
+ Float_t dz = t2.GetZ() - t1.GetZ();
+ Float_t ds = t2.GetSinPhi() - c*t1.GetSinPhi();
+ Float_t dt = t2.GetDzDs() - c*t1.GetDzDs();
+ Float_t dk = t2.GetKappa() - c*t1.GetKappa();
+
+ Float_t chi2ys = GetChi2( t1.GetY(),t1.GetSinPhi(),t1.GetCov()[0],t1.GetCov()[3],t1.GetCov()[5],
+ t2.GetY(),t2.GetSinPhi(),t2.GetCov()[0],t2.GetCov()[3],t2.GetCov()[5] );
+ Float_t chi2zt = GetChi2( t1.GetZ(),t1.GetDzDs(),t1.GetCov()[2],t1.GetCov()[7],t1.GetCov()[9],
+ t2.GetZ(),t2.GetDzDs(),t2.GetCov()[2],t2.GetCov()[7],t2.GetCov()[9] );
+
+
+
+ Float_t sy2 = t2.GetErr2Y() + t1.GetErr2Y();
+ Float_t sz2 = t2.GetErr2Z() + t1.GetErr2Z();
+ Float_t ss2 = t2.GetErr2SinPhi() + t1.GetErr2SinPhi();
+ Float_t st2 = t2.GetErr2DzDs() + t1.GetErr2DzDs();
+ Float_t sk2 = t2.GetErr2Kappa() + t1.GetErr2Kappa();
+
+ std::cout<<"dy, sy= "<<dy<<" "<<CAMath::Sqrt(factor2y*sy2)<<std::endl;
+ std::cout<<"dz, sz= "<<dz<<" "<<CAMath::Sqrt(factor2z*sz2)<<std::endl;
+ std::cout<<"ds, ss= "<<ds<<" "<<CAMath::Sqrt(factor2s*ss2)<<std::endl;
+ std::cout<<"dt, st= "<<dt<<" "<<CAMath::Sqrt(factor2t*st2)<<std::endl;
+ std::cout<<"dk, sk= "<<dk<<" "<<CAMath::Sqrt(factor2k*sk2)<<std::endl;
+
+ std::cout<<"dys, sy= "<<CAMath::Sqrt(chi2ys)<<" "<<CAMath::Sqrt(factor2y)<<std::endl;
+ std::cout<<"dzt, st= "<<CAMath::Sqrt(chi2zt)<<" "<<CAMath::Sqrt(factor2z)<<std::endl;
+
+ if( dy*dy<factor2y*sy2
+ && dz*dz<factor2z*sz2
+ && ds*ds<factor2s*ss2
+ && dt*dt<factor2t*st2
+ && dk*dk<factor2k*sk2
+ ){
+ std::cout<<"tracks are merged"<<std::endl;
+ } else std::cout<<"tracks are not merged"<<std::endl;
+
+ AliHLTTPCCADisplay::Instance().ClearView();
+ AliHLTTPCCADisplay::Instance().SetTPCView();
+ AliHLTTPCCADisplay::Instance().DrawTPC();
+ AliHLTTPCCADisplay::Instance().DrawGBHits( *this, kGreen, 1. );
+ AliHLTTPCCADisplay::Instance().SetCurrentSlice(&slice1);
+ AliHLTTPCCADisplay::Instance().DrawSliceOutTrack( t1, Alpha, b1.fITrack, kRed, 2. );
+ AliHLTTPCCADisplay::Instance().SetCurrentSlice(&slice2);
+ AliHLTTPCCADisplay::Instance().DrawSliceOutTrack( t2, Alpha, b2.fITrack, kBlue, 2. );
+ AliHLTTPCCADisplay::Instance().Ask();
+#endif
}
+
+ Float_t chi2ys = GetChi2( t1.GetY(),t1.GetSinPhi(),t1.GetCov()[0],t1.GetCov()[3],t1.GetCov()[5],
+ t2.GetY(),t2.GetSinPhi(),t2.GetCov()[0],t2.GetCov()[3],t2.GetCov()[5] );
+ Float_t chi2zt = GetChi2( t1.GetZ(),t1.GetDzDs(),t1.GetCov()[2],t1.GetCov()[7],t1.GetCov()[9],
+ t2.GetZ(),t2.GetDzDs(),t2.GetCov()[2],t2.GetCov()[7],t2.GetCov()[9] );
+ if( chi2ys>factor2ys ) continue;
+ if( chi2zt>factor2zt ) continue;
+
+ Float_t dy = t2.GetY() - t1.GetY();
+ Float_t sy2 = t2.GetErr2Y() + t1.GetErr2Y();
+ if( dy*dy>factor2y*sy2 ) continue;
+
+ Float_t dz = t2.GetZ() - t1.GetZ();
+ Float_t sz2 = t2.GetErr2Z() + t1.GetErr2Z();
+ if( dz*dz>factor2z*sz2 ) continue;
+
+ Float_t d, s2;
+ Float_t c= t2.CosPhi()*t1.CosPhi()>0 ?1 :-1;
+
+ d = t2.GetSinPhi() - c*t1.GetSinPhi();
+ s2 = t2.GetErr2SinPhi() + t1.GetErr2SinPhi();
+ if( d*d>factor2s*s2 ) continue;
+ d = t2.GetDzDs() - c*t1.GetDzDs();
+ s2 = t2.GetErr2DzDs() + t1.GetErr2DzDs();
+ if( d*d>factor2t*s2 ) continue;
+ d = t2.GetKappa() - c*t1.GetKappa();
+ s2 = t2.GetErr2Kappa() + t1.GetErr2Kappa();
+ if( d*d>factor2k*s2 ) continue;
+
+ lBest2 = b2.fNHits;
+ iBest2 = b2.fITrack;
}
+
+ if( iBest2>=0 ){
+ Int_t old1 = fSliceTrackInfos[iSlice2][iBest2].fPrevNeighbour;
+ if( old1 >= 0 ){
+ if( slice1.OutTracks()[ old1 ].NHits() < slice1.OutTracks()[ b1.fITrack ].NHits() ){
+ fSliceTrackInfos[iSlice2][iBest2].fPrevNeighbour = -1;
+ fSliceTrackInfos[iSlice1][old1].fNextNeighbour = -1;
+ } else continue;
+ }
+ Int_t old2 = fSliceTrackInfos[iSlice1][b1.fITrack].fNextNeighbour;
+ if( old2 >= 0 ){
+ if( slice2.OutTracks()[ old2 ].NHits() < slice2.OutTracks()[ iBest2 ].NHits() ){
+ fSliceTrackInfos[iSlice2][old2].fPrevNeighbour = -1;
+ } else continue;
+ }
+ fSliceTrackInfos[iSlice1][b1.fITrack].fNextNeighbour = iBest2;
+ fSliceTrackInfos[iSlice2][iBest2].fPrevNeighbour = b1.fITrack;
+ }
+ }
+}
+
+
+void AliHLTTPCCAGBTracker::Merging()
+{
+ //* track merging between slices
+
+#ifdef DRAW
+ AliHLTTPCCADisplay &disp = AliHLTTPCCADisplay::Instance();
+ if(0){
+ disp.SetSliceView();
+ for( Int_t iSlice=0; iSlice<fNSlices; iSlice++ ){
+ AliHLTTPCCATracker &slice = fSlices[iSlice];
+ Int_t nh=fFirstSliceHit[iSlice+1]-fFirstSliceHit[iSlice];
+ if( nh<=0 ) continue;
+ disp.SetCurrentSlice(&slice);
+ disp.DrawSlice( &slice );
+ //disp.DrawGBHits( *this, -1, .5 );
+ disp.DrawSliceHits(-1,.5);
+ disp.Ask();
+ std::cout<<"N out tracks = "<<*slice.NOutTracks()<<std::endl;
+ for( Int_t itr=0; itr<*slice.NOutTracks(); itr++ ){
+ std::cout<<"track N "<<itr<<", nhits="<<slice.OutTracks()[itr].NHits()<<std::endl;
+ disp.DrawSliceOutTrack( itr, kRed );
+ disp.Ask();
+ int id = slice.OutTracks()[itr].OrigTrackID();
+ disp.DrawSliceTrack( id, kBlue );
+ disp.Ask();
+ }
+ disp.Ask();
+ }
+ }
+ AliHLTTPCCADisplay::Instance().SetTPCView();
+ AliHLTTPCCADisplay::Instance().DrawTPC();
+ AliHLTTPCCADisplay::Instance().DrawGBHits( *this );
+ disp.Ask();
+ std::cout<<"Slice tracks:"<<std::endl;
+ for( Int_t iSlice=0; iSlice<fNSlices; iSlice++ ){
+ AliHLTTPCCATracker &slice = fSlices[iSlice];
+ disp.SetCurrentSlice(&slice);
+ for( Int_t itr=0; itr<*slice.NOutTracks(); itr++ ){
+ disp.DrawSliceOutTrack( itr, kBlue, 2. );
+ }
+ }
+ //AliHLTTPCCADisplay::Instance().DrawGBHits( *this );
+ disp.Ask();
+
+#endif //DRAW
+
+ Int_t nextSlice[100], prevSlice[100];
+
+ for( Int_t iSlice=0; iSlice<fNSlices; iSlice++ ){
+ nextSlice[iSlice] = iSlice + 1;
+ prevSlice[iSlice] = iSlice - 1;
+ }
+ Int_t mid = NSlices()/2 - 1 ;
+ Int_t last = NSlices() - 1 ;
+ if( mid<0 ) mid = 0; // to avoid compiler warning
+ if( last<0 ) last = 0; //
+ nextSlice[ mid ] = 0;
+ prevSlice[ 0 ] = mid;
+ nextSlice[ last ] = fNSlices/2;
+ prevSlice[ fNSlices/2 ] = last;
+
+ Int_t maxNSliceTracks = 0;
+ for( Int_t iSlice=0; iSlice<fNSlices; iSlice++ ){
+ AliHLTTPCCATracker &iS = fSlices[iSlice];
+ if( maxNSliceTracks < *iS.NOutTracks() ) maxNSliceTracks = *iS.NOutTracks();
}
+
+ if(1){// merging segments withing one slice //SG!!!
+
+ AliHLTTPCCABorderTrack bord[maxNSliceTracks*10];
+
+ for( Int_t iSlice=0; iSlice<fNSlices; iSlice++ ){
+ //std::cout<<" merging tracks withing slice "<<iSlice<<":"<<std::endl;
+
+#ifdef DRAW
+ if(0){
+ AliHLTTPCCADisplay &disp = AliHLTTPCCADisplay::Instance();
+ std::cout<<" merging tracks withing slice "<<iSlice<<":"<<std::endl;
+ disp.SetSliceView();
+ AliHLTTPCCATracker &slice = fSlices[iSlice];
+ Int_t nh=fFirstSliceHit[iSlice+1]-fFirstSliceHit[iSlice];
+ if( nh>0 ){
+ disp.SetCurrentSlice(&slice);
+ disp.DrawSlice( &slice );
+ disp.DrawSliceHits(-1,.5);
+ std::cout<<"N out tracks = "<<*slice.NOutTracks()<<std::endl;
+ for( Int_t itr=0; itr<*slice.NOutTracks(); itr++ ){
+ std::cout<<"track N "<<itr<<", nhits="<<slice.OutTracks()[itr].NHits()<<std::endl;
+ disp.DrawSliceOutTrack( itr, kRed );
+ //disp.Ask();
+ //int id = slice.OutTracks()[itr].OrigTrackID();
+ //disp.DrawSliceTrack( id, kBlue );
+ //disp.Ask();
+ }
+ disp.Ask();
+ }
+ }
+#endif //DRAW
+
+
+ AliHLTTPCCATracker &iS = fSlices[iSlice];
+ Int_t nBord=0;
+ MakeBorderTracks( iSlice, 4, bord, nBord );
+#ifdef DRAW
+ std::cout<<"\nMerge tracks withing slice "<<iSlice<<":\n"<<std::endl;
+#endif
+ Float_t alph = -1;//iS.Param().Alpha();
+ SplitBorderTracks( iSlice, bord, nBord, iSlice, bord, nBord, alph );
+
+ AliHLTTPCCAOutTrack tmpT[*iS.NOutTracks()];
+ Int_t tmpH[*iS.NOutTrackHits()];
+ Int_t nTr=0, nH=0;
+ for( Int_t itr=0; itr<*iS.NOutTracks(); itr++ ){
+ fSliceTrackInfos[iSlice][itr].fPrevNeighbour = -1;
+ if( fSliceTrackInfos[iSlice][itr].fNextNeighbour == -2 ){
+ fSliceTrackInfos[iSlice][itr].fNextNeighbour = -1;
+ continue;
+ }
+ AliHLTTPCCAOutTrack &it = iS.OutTracks()[itr];
+ AliHLTTPCCAOutTrack &t = tmpT[nTr];
+ t = it;
+ t.SetFirstHitRef( nH );
+ for( Int_t ih=0; ih<it.NHits(); ih++ ) tmpH[nH+ih] = iS.OutTrackHits()[it.FirstHitRef()+ih];
+ nTr++;
+ nH+=it.NHits();
+
+ int jtr = fSliceTrackInfos[iSlice][itr].fNextNeighbour;
+
+ if( jtr<0 ) continue;
+ fSliceTrackInfos[iSlice][itr].fNextNeighbour = -1;
+ fSliceTrackInfos[iSlice][jtr].fNextNeighbour = -2;
+
+ AliHLTTPCCAOutTrack &jt = iS.OutTracks()[jtr];
+ for( Int_t ih=0; ih<jt.NHits(); ih++ ) tmpH[nH+ih] = iS.OutTrackHits()[jt.FirstHitRef()+ih];
+ t.SetNHits( t.NHits() + jt.NHits() );
+ nH+=jt.NHits();
+ if( jt.StartPoint().X() < it.StartPoint().X() ) t.SetStartPoint( jt.StartPoint() );
+ if( jt.EndPoint().X() > it.EndPoint().X() ) t.SetEndPoint( jt.EndPoint() );
+ }
+
+ *iS.NOutTracks() = nTr;
+ *iS.NOutTrackHits() = nH;
+ for( Int_t itr=0; itr<nTr; itr++ ) iS.OutTracks()[itr] = tmpT[itr];
+ for( Int_t ih=0; ih<nH; ih++ ) iS.OutTrackHits()[ih] = tmpH[ih];
+
+#ifdef DRAW
+ if(0){
+ AliHLTTPCCADisplay &disp = AliHLTTPCCADisplay::Instance();
+ std::cout<<" merginged tracks withing slice "<<iSlice<<":"<<std::endl;
+ disp.SetSliceView();
+ AliHLTTPCCATracker &slice = fSlices[iSlice];
+ Int_t nh=fFirstSliceHit[iSlice+1]-fFirstSliceHit[iSlice];
+ if( nh>0 ){
+ disp.SetCurrentSlice(&slice);
+ disp.DrawSlice( &slice );
+ disp.DrawSliceHits(-1,.5);
+ std::cout<<"N out tracks = "<<*slice.NOutTracks()<<std::endl;
+ for( Int_t itr=0; itr<*slice.NOutTracks(); itr++ ){
+ std::cout<<"track N "<<itr<<", nhits="<<slice.OutTracks()[itr].NHits()<<std::endl;
+ disp.DrawSliceOutTrack( itr, kRed );
+ }
+ disp.Ask();
+ }
+ }
+#endif //DRAW
+
+ }
+ }
+
+#ifdef DRAW
+ if(0){
+ AliHLTTPCCADisplay &disp = AliHLTTPCCADisplay::Instance();
+ AliHLTTPCCADisplay::Instance().SetTPCView();
+ AliHLTTPCCADisplay::Instance().DrawTPC();
+ AliHLTTPCCADisplay::Instance().DrawGBHits( *this );
+ std::cout<<"Slice tracks:"<<std::endl;
+ for( Int_t iSlice=0; iSlice<fNSlices; iSlice++ ){
+ AliHLTTPCCATracker &slice = fSlices[iSlice];
+ disp.SetCurrentSlice(&slice);
+ for( Int_t itr=0; itr<*slice.NOutTracks(); itr++ ){
+ disp.DrawSliceOutTrack( itr, -1, 2. );
+ }
+ }
+ //AliHLTTPCCADisplay::Instance().DrawGBHits( *this );
+ disp.Ask();
+ }
+#endif //DRAW
+
+
+ //* arrays for the rotated track parameters
+
+ AliHLTTPCCABorderTrack bCurr0[maxNSliceTracks*10], bNext0[maxNSliceTracks*10];
+ AliHLTTPCCABorderTrack bCurr[maxNSliceTracks*10], bNext[maxNSliceTracks*10];
+
+ for( Int_t iSlice=0; iSlice<fNSlices; iSlice++ ){
+
+ Int_t jSlice = nextSlice[iSlice];
+
+#ifdef DRAW
+ std::cout<<" Merging slices "<<iSlice<<" and "<<jSlice<<std::endl;
+#endif
+ //AliHLTTPCCATracker &iS = fSlices[iSlice];
+ //AliHLTTPCCATracker &jS = fSlices[jSlice];
+
+ Int_t nCurr0 = 0, nNext0 = 0;
+ Int_t nCurr = 0, nNext = 0;
+
+ MakeBorderTracks( iSlice, 0, bCurr, nCurr );
+ MakeBorderTracks( jSlice, 1, bNext, nNext );
+ MakeBorderTracks( iSlice, 2, bCurr0, nCurr0 );
+ MakeBorderTracks( jSlice, 3, bNext0, nNext0 );
+
+#ifdef DRAW
+ std::cout<<"\nMerge0 tracks :\n"<<std::endl;
+#endif
+ Float_t alph = -1;//iS.Param().Alpha() + ( fSlices[1].Param().Alpha() - fSlices[0].Param().Alpha() )/2;
+ Float_t alph1 = -1;//alph - CAMath::Pi()/2;
+ SplitBorderTracks( iSlice, bCurr0, nCurr0, jSlice, bNext0, nNext0, alph );
+#ifdef DRAW
+ std::cout<<"\nMerge1 tracks :\n"<<std::endl;
+#endif
+ SplitBorderTracks( iSlice, bCurr, nCurr, jSlice, bNext, nNext, alph1 );
+ }
+
+ TStopwatch timerMerge2;
+
+ Int_t nTracksTot = 0;
+ for( Int_t iSlice = 0; iSlice<fNSlices; iSlice++ ){
+ AliHLTTPCCATracker &slice = fSlices[iSlice];
+ nTracksTot+= *slice.NOutTracks();
+ }
+
+ if( fTrackHits ) delete[] fTrackHits;
+ fTrackHits = 0;
+ if(fTracks ) delete[] fTracks;
+ fTracks = 0;
+ fTrackHits = new Int_t [fNHits*10];
+ fTracks = new AliHLTTPCCAGBTrack[nTracksTot];
+ fNTracks = 0;
+
+ Int_t nTrackHits = 0;
+
+ //std::cout<<"\nStart global track creation...\n"<<std::endl;
+
+ //static Int_t nRejected = 0;
+
+ //Int_t maxNRows = fSlices[0].Param().NRows();
+
+ for( Int_t iSlice = 0; iSlice<fNSlices; iSlice++ ){
+
+ AliHLTTPCCATracker &slice = fSlices[iSlice];
+ for( Int_t itr=0; itr<*slice.NOutTracks(); itr++ ){
+ if( fSliceTrackInfos[iSlice][itr].fUsed ) continue;
+ if( fSliceTrackInfos[iSlice][itr].fPrevNeighbour>=0 ) continue;
+ //std::cout<<"\n slice "<<iSlice<<", track "<<itr<<"\n"<<std::endl;
+ AliHLTTPCCAOutTrack &tCA = slice.OutTracks()[itr];
+ AliHLTTPCCAGBTrack &t = fTracks[fNTracks];
+
+ AliHLTTPCCATrackParam startPoint = tCA.StartPoint(), endPoint = tCA.EndPoint();
+ Float_t startAlpha = slice.Param().Alpha(), endAlpha = slice.Param().Alpha();
+ t.SetNHits( 0 );
+
+ t.SetFirstHitRef( nTrackHits );
+
+ Int_t hits[2000];
+ Int_t firstHit = 1000;
+ Int_t nHits = 0;
+ Int_t jSlice = iSlice;
+ Int_t jtr = itr;
+ {
+ fSliceTrackInfos[jSlice][jtr].fUsed = 1;
+ for( Int_t jhit=0; jhit<tCA.NHits(); jhit++){
+ Int_t id = fFirstSliceHit[iSlice] + slice.OutTrackHits()[tCA.FirstHitRef()+jhit];
+ hits[firstHit+jhit] = id;
+ }
+ nHits=tCA.NHits();
+ jtr = fSliceTrackInfos[iSlice][itr].fNextNeighbour;
+ jSlice = nextSlice[iSlice];
+ }
+ while( jtr >=0 ){
+ if( fSliceTrackInfos[jSlice][jtr].fUsed ) break;
+ fSliceTrackInfos[jSlice][jtr].fUsed = 1;
+ AliHLTTPCCATracker &jslice = fSlices[jSlice];
+ AliHLTTPCCAOutTrack &jTr = jslice.OutTracks()[jtr];
+ Bool_t dir = 0;
+ Int_t startHit = firstHit+ nHits;
+ Float_t d00 = startPoint.GetDistXZ2(jTr.StartPoint() );
+ Float_t d01 = startPoint.GetDistXZ2(jTr.EndPoint() );
+ Float_t d10 = endPoint.GetDistXZ2(jTr.StartPoint() );
+ Float_t d11 = endPoint.GetDistXZ2(jTr.EndPoint() );
+ if( d00<=d01 && d00<=d10 && d00<=d11 ){
+ startPoint = jTr.EndPoint();
+ startAlpha = jslice.Param().Alpha();
+ dir = 1;
+ firstHit -= jTr.NHits();
+ startHit = firstHit;
+ }else if( d01<=d10 && d01<=d11 ){
+ startPoint = jTr.StartPoint();
+ startAlpha = jslice.Param().Alpha();
+ dir = 0;
+ firstHit -= jTr.NHits();
+ startHit = firstHit;
+ }else if( d10<=d11 ){
+ endPoint = jTr.EndPoint();
+ endAlpha = jslice.Param().Alpha();
+ dir = 0;
+ }else{
+ endPoint = jTr.StartPoint();
+ endAlpha = jslice.Param().Alpha();
+ dir = 1;
+ }
+
+ for( Int_t jhit=0; jhit<jTr.NHits(); jhit++){
+ Int_t id = fFirstSliceHit[jSlice] + jslice.OutTrackHits()[jTr.FirstHitRef()+jhit];
+ hits[startHit+(dir ?(jTr.NHits()-1-jhit) :jhit)] = id;
+ }
+ nHits+=jTr.NHits();
+ jtr = fSliceTrackInfos[jSlice][jtr].fNextNeighbour;
+ jSlice = nextSlice[jSlice];
+ }
+
+ if( endPoint.X() < startPoint.X() ){ // swap
+ for( Int_t i=0; i<nHits; i++ ) hits[i] = hits[firstHit+nHits-1-i];
+ firstHit = 0;
+ }
+
+ if( nHits < 30 ) continue; //SG!!!
+
+ // refit
+ Float_t dEdX;
+ if( !FitTrack( endPoint, startPoint, startAlpha, hits+firstHit, nHits, dEdX, 0 ) ) continue;
+ endAlpha = startAlpha;
+ if( !FitTrack( startPoint, endPoint, startAlpha, hits+firstHit, nHits, dEdX, 1 ) ) continue;
+
+ if( nHits < 30 ) continue; //SG!!!
+
+
+ t.SetNHits( nHits );
+ t.SetParam( startPoint );
+ t.SetAlpha( startAlpha );
+ t.SetDeDx( dEdX );
+
+ for( Int_t i = 0; i<nHits; i++ ){
+ fTrackHits[nTrackHits+i] = hits[firstHit+i];
+ }
+
+ AliHLTTPCCATrackParam p = t.Param();
+ AliHLTTPCCATrackParam::AliHLTTPCCATrackFitParam fitPar;
+ p.CalculateFitParameters( fitPar, fSlices[0].Param().Bz() );
+
+ Double_t dAlpha = 0;
+ {
+ Double_t xTPC=83.65;
+ Double_t ddAlpha = 0.00609235;
+
+ if( p.TransportToXWithMaterial( xTPC, fitPar ) ){
+ Double_t y=p.GetY();
+ Double_t ymax=xTPC*CAMath::Tan(dAlpha/2.);
+ if (y > ymax) {
+ if( p.Rotate( ddAlpha ) ){ dAlpha=ddAlpha; p.TransportToXWithMaterial( xTPC, fitPar ); }
+ } else if (y <-ymax) {
+ if( p.Rotate( -ddAlpha ) ){ dAlpha=-ddAlpha; p.TransportToXWithMaterial( xTPC, fitPar );}
+ }
+ }
+ }
+
+ {
+ Bool_t ok=1;
+
+ const Float_t *c = p.Cov();
+ for( Int_t i=0; i<15; i++ ) ok = ok && finite(c[i]);
+ for( Int_t i=0; i<5; i++ ) ok = ok && finite(p.Par()[i]);
+ ok = ok && (p.GetX()>50);
+
+ if( c[0]<=0 || c[2]<=0 || c[5]<=0 || c[9]<=0 || c[14]<=0 ) ok = 0;
+ //if( c[0]>5. || c[2]>5. || c[5]>2. || c[9]>2 || c[14]>2 ) ok = 0;
+ if(!ok) continue;
+ }
+ t.SetParam( p );
+ t.SetAlpha( t.Alpha() + dAlpha );
+ nTrackHits+= t.NHits();
+ fNTracks++;
+ }
+ }
+
//std::cout<<"\n\nRejected: "<<nRejected<<"\n"<<std::endl;
timerMerge2.Stop();
fStatTime[11]+=timerMerge2.CpuTime();
//* selection
//std::cout<<"Selection..."<<std::endl;
- {
+ if(0){
AliHLTTPCCAGBTrack *vtracks = new AliHLTTPCCAGBTrack [fNTracks];
Int_t *vhits = new Int_t [fNHits];
AliHLTTPCCAGBTrack **vptracks = new AliHLTTPCCAGBTrack* [fNTracks];
AliHLTTPCCAGBTrack &t = *(vptracks[itr]);
AliHLTTPCCAGBTrack &to = vtracks[nTracks];
to=*(vptracks[itr]);
- to.FirstHitRef() = nHits;
- to.NHits() = 0;
+ to.SetFirstHitRef( nHits );
+ to.SetNHits( 0 );
for( Int_t ih=0; ih<t.NHits(); ih++ ){
Int_t jh = fTrackHits[t.FirstHitRef()+ih];
AliHLTTPCCAGBHit &h = fHits[jh];
if( h.IsUsed() ) continue;
vhits[to.FirstHitRef() + to.NHits()] = jh;
- to.NHits()++;
- h.IsUsed() = 1;
+ to.SetNHits( to.NHits()+1);
+ h.SetIsUsed( 1 );
}
- if( to.NHits()<10 ) continue;//SG!!!
+ //if( to.NHits()<10 ) continue;//SG!!!
nHits+=to.NHits();
nTracks++;
//std::cout<<to.Param().GetErr2Y()<<" "<<to.Param().GetErr2Z()<<std::endl;
if( fTracks ) delete[] fTracks;
fTrackHits = vhits;
fTracks = vtracks;
- delete[] vptracks;
+ if( vptracks ) delete[] vptracks;
}
timerMerge3.Stop();
fStatTime[12]+=timerMerge3.CpuTime();
+
+#ifdef DRAW
+ std::cout<<"Global tracks: "<<std::endl;
+ AliHLTTPCCADisplay::Instance().ClearView();
+ AliHLTTPCCADisplay::Instance().SetTPCView();
+ AliHLTTPCCADisplay::Instance().DrawTPC();
+ AliHLTTPCCADisplay::Instance().DrawGBHits( *this );
+ for( Int_t itr=0; itr<fNTracks; itr++ ){
+ std::cout<<itr<<" nhits= "<<fTracks[itr].NHits()<<std::endl;
+ AliHLTTPCCADisplay::Instance().DrawGBTrack( itr, kBlue, 2. );
+ //AliHLTTPCCADisplay::Instance().Ask();
+ }
+ AliHLTTPCCADisplay::Instance().Ask();
+#endif
}
+
+
+
+
+
+
void AliHLTTPCCAGBTracker::GetErrors2( Int_t iSlice, Int_t iRow, AliHLTTPCCATrackParam &t, Float_t &Err2Y, Float_t &Err2Z )
{
//
out<<NTracks()<<std::endl;
for( Int_t itr=0; itr<fNTracks; itr++ ){
AliHLTTPCCAGBTrack &t = fTracks[itr];
- AliHLTTPCCATrackParam &p = t.Param();
+ const AliHLTTPCCATrackParam &p = t.Param();
out<< t.NHits()<<" ";
out<< t.FirstHitRef()<<" ";
out<< t.Alpha()<<" ";
out<< t.DeDx()<<std::endl;
- out<< p.X()<<" ";
- out<< p.CosPhi()<<" ";
- out<< p.Chi2()<<" ";
- out<< p.NDF()<<std::endl;
- for( Int_t i=0; i<5; i++ ) out<<p.Par()[i]<<" ";
+ out<< p.GetX()<<" ";
+ out<< p.GetCosPhi()<<" ";
+ out<< p.GetChi2()<<" ";
+ out<< p.GetNDF()<<std::endl;
+ for( Int_t i=0; i<5; i++ ) out<<p.GetPar()[i]<<" ";
out<<std::endl;
- for( Int_t i=0; i<15; i++ ) out<<p.Cov()[i]<<" ";
+ for( Int_t i=0; i<15; i++ ) out<<p.GetCov()[i]<<" ";
out<<std::endl;
}
}
fTracks = new AliHLTTPCCAGBTrack[fNTracks];
for( Int_t itr=0; itr<NTracks(); itr++ ){
AliHLTTPCCAGBTrack &t = Tracks()[itr];
- AliHLTTPCCATrackParam &p = t.Param();
- in>> t.NHits();
- in>> t.FirstHitRef();
- in>> t.Alpha();
- in>> t.DeDx();
- in>> p.X();
- in>> p.CosPhi();
- in>> p.Chi2();
- in>> p.NDF();
- for( Int_t i=0; i<5; i++ ) in>>p.Par()[i];
- for( Int_t i=0; i<15; i++ ) in>>p.Cov()[i];
+ AliHLTTPCCATrackParam p;
+ Int_t i;
+ Float_t f;
+ in>>i;
+ t.SetNHits(i);
+ in>>i;
+ t.SetFirstHitRef( i );
+ in>>f;
+ t.SetAlpha(f);
+ in>>f;
+ t.SetDeDx( f );
+ in>>f;
+ p.SetX( f );
+ in>>f;
+ p.SetCosPhi( f );
+ in>>f;
+ p.SetChi2( f );
+ in>>i;
+ p.SetNDF( i );
+ for( Int_t j=0; j<5; j++ ){ in>>f; p.SetPar( j, f); }
+ for( Int_t j=0; j<15; j++ ){ in>>f; p.SetCov(j,f); }
+ t.SetParam(p);
}
}
#define ALIHLTTPCCAGBTRACKER_H
#include "AliHLTTPCCADef.h"
+#include "AliHLTTPCCATrackParam.h"
#if !defined(HLTCA_GPUCODE)
#include <iostream>
void FindTracks2();
+ void Refit();
+
+ struct AliHLTTPCCABorderTrack{
+ AliHLTTPCCABorderTrack(): fParam(), fITrack(0), fIRow(0), fNHits(0), fX(0), fOK(0){};
+ AliHLTTPCCATrackParam fParam; // track parameters at the border
+ Int_t fITrack; // track index
+ Int_t fIRow; // row number of the closest cluster
+ Int_t fNHits; // n hits
+ Float_t fX; // X coordinate of the closest cluster
+ Bool_t fOK; // is the trak rotated and extrapolated correctly
+ };
+
+ void MakeBorderTracks( Int_t iSlice, Int_t iBorder, AliHLTTPCCABorderTrack B[], Int_t &nB);
+ void SplitBorderTracks( Int_t iSlice1, AliHLTTPCCABorderTrack B1[], Int_t N1,
+ Int_t iSlice2, AliHLTTPCCABorderTrack B2[], Int_t N2,
+ Float_t Alpha =-1 );
+ Float_t GetChi2( Float_t x1, Float_t y1, Float_t a00, Float_t a10, Float_t a11,
+ Float_t x2, Float_t y2, Float_t b00, Float_t b10, Float_t b11 );
+
void Merging();
+
AliHLTTPCCATracker *Slices(){ return fSlices; }
AliHLTTPCCAGBHit *Hits(){ return fHits; }
Int_t NHits() const { return fNHits; }
void WriteTracks( std::ostream &out ) const;
void ReadTracks( std::istream &in );
- Double_t &SliceTrackerTime(){ return fSliceTrackerTime; }
+ Double_t SliceTrackerTime() const { return fSliceTrackerTime; }
+ void SetSliceTrackerTime( Double_t v ){ fSliceTrackerTime = v; }
+ const Int_t *FirstSliceHit() const { return fFirstSliceHit; }
+ Bool_t FitTrack( AliHLTTPCCATrackParam &T, AliHLTTPCCATrackParam t0,
+ Float_t &Alpha, Int_t hits[], Int_t &NHits,
+ Float_t &DeDx, Bool_t dir=0 );
protected:
fN = fNy*fNz;
fStepYInv = (fYMax - fYMin);
fStepZInv = (fZMax - fZMin);
- Int_t ky = (fNy>1) ?fNy-1 :1;
- Int_t kz = (fNz>1) ?fNz-1 :1;
- fStepYInv = ( fStepYInv>1.e-4 ) ?ky/fStepYInv :1;
- fStepZInv = ( fStepZInv>1.e-4 ) ?kz/fStepZInv :1;
+ //Int_t ky = (fNy>1) ?fNy-1 :1;
+ //Int_t kz = (fNz>1) ?fNz-1 :1;
+ fStepYInv = ( fStepYInv>1.e-4 ) ?fNy/fStepYInv :1;
+ fStepZInv = ( fStepZInv>1.e-4 ) ?fNz/fStepZInv :1;
}
GPUd() void AliHLTTPCCAGrid::Create( Float_t yMin, Float_t yMax, Float_t zMin, Float_t zMax, Float_t sy, Float_t sz )
}
- GPUd() UInt_t N() const { return fN; }
- GPUd() UInt_t Ny() const { return fNy; }
- GPUd() UInt_t Nz() const { return fNz; }
- GPUd() Float_t YMin() const { return fYMin; }
- GPUd() Float_t YMax() const { return fYMax; }
- GPUd() Float_t ZMin() const { return fZMin; }
- GPUd() Float_t ZMax() const { return fZMax; }
+ GPUd() UInt_t N() const { return fN; }
+ GPUd() UInt_t Ny() const { return fNy; }
+ GPUd() UInt_t Nz() const { return fNz; }
+ GPUd() Float_t YMin() const { return fYMin; }
+ GPUd() Float_t YMax() const { return fYMax; }
+ GPUd() Float_t ZMin() const { return fZMin; }
+ GPUd() Float_t ZMax() const { return fZMax; }
GPUd() Float_t StepYInv() const { return fStepYInv; }
GPUd() Float_t StepZInv() const { return fStepZInv; }
- private:
+private:
UInt_t fNy; //* N bins in Y
UInt_t fNz; //* N bins in Z
{
public:
- GPUhd() Float_t &Y() { return fY; }
- GPUhd() Float_t &Z() { return fZ; }
+ GPUhd() Float_t Y() const { return fY; }
+ GPUhd() Float_t Z() const { return fZ; }
+
+ GPUhd() void SetY( Float_t v ){ fY = v; }
+ GPUhd() void SetZ( Float_t v ){ fZ = v; }
- //protected:
+protected:
Float_t fY, fZ; // Y and Z position of the TPC cluster
#include "AliHLTTPCCAHit.h"
#include "AliHLTTPCCARow.h"
-
+/*
GPUd() void AliHLTTPCCAHitAreaInit( AliHLTTPCCAHitArea &a, AliHLTTPCCAGrid &grid, UShort_t *content, UInt_t hitoffset, Float_t y, Float_t z, Float_t dy, Float_t dz )
{
// initialisation
a.HitYlst() = content[a.IndYmin() + a.BDY()];
a.Ih() = a.HitYfst();
}
+*/
-GPUd() void AliHLTTPCCAHitArea::Init( AliHLTTPCCAGrid &grid, UShort_t *content, UInt_t hitoffset, Float_t y, Float_t z, Float_t dy, Float_t dz )
+GPUd() void AliHLTTPCCAHitArea::Init( const AliHLTTPCCAGrid &grid, UShort_t *content, UInt_t hitoffset, Float_t y, Float_t z, Float_t dy, Float_t dz )
{
//initialisation
- AliHLTTPCCAHitAreaInit(*this, grid, content, hitoffset, y, z, dy, dz);
+
+ fHitOffset = hitoffset;
+ fY = y;
+ fZ = z;
+ fMinZ = z-dz;
+ fMaxZ = z+dz;
+ fMinY = y-dy;
+ fMaxY = y+dy;
+ UInt_t bYmin, bZmin, bYmax;
+ grid.GetBin( fMinY, fMinZ, bYmin, bZmin);
+ grid.GetBin( fMaxY, fMaxZ, bYmax, fBZmax);
+ fBDY = bYmax - bYmin + 1;
+ fNy = grid.Ny();
+ fIndYmin = bZmin*fNy + bYmin;
+ fIz = bZmin;
+ fHitYfst = content[fIndYmin];
+ fHitYlst = content[fIndYmin + fBDY];
+ fIh = fHitYfst;
}
-GPUd() Int_t AliHLTTPCCAHitArea::GetNext(AliHLTTPCCATracker &tracker, AliHLTTPCCARow &row, UShort_t *content, AliHLTTPCCAHit &h)
+
+GPUd() Int_t AliHLTTPCCAHitArea::GetNext(AliHLTTPCCATracker &tracker, const AliHLTTPCCARow &row, UShort_t *content, AliHLTTPCCAHit &h)
{
// get next hit index
Float_t y0 = row.Grid().YMin();
Float_t z0 = row.Grid().ZMin();
Float_t stepY = row.HstepY();
Float_t stepZ = row.HstepZ();
- uint4* tmpint4 = tracker.RowData() + row.FullOffset();
- ushort2 *hits = reinterpret_cast<ushort2*>(tmpint4);
+ const uint4* tmpint4 = tracker.RowData() + row.FullOffset();
+ const ushort2 *hits = reinterpret_cast<const ushort2*>(tmpint4);
Int_t ret = -1;
do{
{
ushort2 hh = hits[fIh];
- h.Y() = y0 + hh.x*stepY;
- h.Z() = z0 + hh.y*stepZ;
+ h.SetY( y0 + hh.x*stepY );
+ h.SetZ( z0 + hh.y*stepZ );
}
//h = tracker.Hits()[ fHitOffset + fIh ];
- if( h.fZ>fMaxZ || h.fZ<fMinZ || h.fY<fMinY || h.fY>fMaxY ){
+ if( 0 && (h.Z()>fMaxZ || h.Z()<fMinZ || h.Y()<fMinY || h.Y()>fMaxY )){ //SG!!!
fIh++;
continue;
}
-GPUd() Int_t AliHLTTPCCAHitArea::GetBest(AliHLTTPCCATracker &tracker, AliHLTTPCCARow &row, UShort_t *content, AliHLTTPCCAHit &h)
+GPUd() Int_t AliHLTTPCCAHitArea::GetBest(AliHLTTPCCATracker &tracker, const AliHLTTPCCARow &row, UShort_t *content, AliHLTTPCCAHit &h)
{
// get closest hit in the area
Int_t best = -1;
AliHLTTPCCAHit hh;
Int_t ih=GetNext( tracker, row, content, hh );
if( ih<0 ) break;
- Float_t dy = hh.fY - fY;
- Float_t dz = hh.fZ - fZ;
+ Float_t dy = hh.Y() - fY;
+ Float_t dz = hh.Z() - fZ;
Float_t dds = dy*dy+dz*dz;
if( dds<ds ){
ds = dds;
{
public:
- GPUd() void Init( AliHLTTPCCAGrid &grid, UShort_t *content, UInt_t hitoffset, Float_t y, Float_t z, Float_t dy, Float_t dz );
- GPUd() Int_t GetNext(AliHLTTPCCATracker &tracker, AliHLTTPCCARow &row, UShort_t *content,AliHLTTPCCAHit &h);
- GPUd() Int_t GetBest(AliHLTTPCCATracker &tracker, AliHLTTPCCARow &row, UShort_t *content,AliHLTTPCCAHit &h );
-
- GPUhd() Float_t& Y(){ return fY;}
- GPUhd() Float_t& Z(){ return fZ;}
- GPUhd() Float_t& MinZ(){ return fMinZ;}
- GPUhd() Float_t& MaxZ(){ return fMaxZ;}
- GPUhd() Float_t& MinY(){ return fMinY;}
- GPUhd() Float_t& MaxY(){ return fMaxY;}
- GPUhd() UInt_t& BZmax(){ return fBZmax;}
- GPUhd() UInt_t& BDY(){ return fBDY;}
- GPUhd() UInt_t& IndYmin(){ return fIndYmin;}
- GPUhd() UInt_t& Iz(){ return fIz;}
- GPUhd() UInt_t& HitYfst(){ return fHitYfst;}
- GPUhd() UInt_t& HitYlst(){ return fHitYlst;}
- GPUhd() UInt_t& Ih(){ return fIh;}
- GPUhd() UInt_t& Ny(){ return fNy;}
- GPUhd() UInt_t& HitOffset(){ return fHitOffset;}
+ GPUd() void Init( const AliHLTTPCCAGrid &grid, UShort_t *content, UInt_t hitoffset, Float_t y, Float_t z, Float_t dy, Float_t dz );
+
+ GPUd() Int_t GetNext(AliHLTTPCCATracker &tracker, const AliHLTTPCCARow &row, UShort_t *content,AliHLTTPCCAHit &h);
+
+ GPUd() Int_t GetBest(AliHLTTPCCATracker &tracker, const AliHLTTPCCARow &row, UShort_t *content,AliHLTTPCCAHit &h );
+
+ GPUhd() Float_t Y() const { return fY;}
+ GPUhd() Float_t Z() const { return fZ;}
+ GPUhd() Float_t MinZ() const { return fMinZ;}
+ GPUhd() Float_t MaxZ() const { return fMaxZ;}
+ GPUhd() Float_t MinY() const { return fMinY;}
+ GPUhd() Float_t MaxY() const { return fMaxY;}
+ GPUhd() UInt_t BZmax() const { return fBZmax;}
+ GPUhd() UInt_t BDY() const { return fBDY;}
+ GPUhd() UInt_t IndYmin() const { return fIndYmin;}
+ GPUhd() UInt_t Iz() const { return fIz;}
+ GPUhd() UInt_t HitYfst() const { return fHitYfst;}
+ GPUhd() UInt_t HitYlst() const { return fHitYlst;}
+ GPUhd() UInt_t Ih() const { return fIh;}
+ GPUhd() UInt_t Ny() const { return fNy;}
+ GPUhd() UInt_t HitOffset() const { return fHitOffset;}
protected:
AliHLTTPCCAMCPoint();
- Float_t &X() { return fX; }
- Float_t &Y() { return fY; }
- Float_t &Z() { return fZ; }
- Float_t &Sx() { return fSx; }
- Float_t &Sy() { return fSy; }
- Float_t &Sz() { return fSz; }
- Float_t &Time() { return fTime; }
- Int_t &ISlice() { return fISlice; }
- Int_t &TrackID() { return fTrackID; }
+ Float_t X() const { return fX; }
+ Float_t Y() const { return fY; }
+ Float_t Z() const { return fZ; }
+ Float_t Sx() const { return fSx; }
+ Float_t Sy() const { return fSy; }
+ Float_t Sz() const { return fSz; }
+ Float_t Time() const { return fTime; }
+ Int_t ISlice() const { return fISlice; }
+ Int_t TrackID() const { return fTrackID; }
+
+ void SetX( Float_t v ) { fX=v; }
+ void SetY( Float_t v ) { fY=v; }
+ void SetZ( Float_t v ) { fZ=v; }
+ void SetSx( Float_t v ) { fSx=v; }
+ void SetSy( Float_t v ) { fSy=v; }
+ void SetSz( Float_t v ) { fSz=v; }
+ void SetTime( Float_t v ) { fTime=v; }
+ void SetISlice( Int_t v ) { fISlice=v; }
+ void SetTrackID( Int_t v ) { fTrackID=v; }
static Bool_t Compare( const AliHLTTPCCAMCPoint &p1, const AliHLTTPCCAMCPoint &p2 )
{
if( s.fIRow <= s.fNRows-2 ){
Int_t iRowUp = s.fIRow+1;
Int_t iRowDn = s.fIRow-1;
- s.fFirstHit = tracker.Rows()[s.fIRow].FirstHit();
- AliHLTTPCCARow &row = tracker.Rows()[s.fIRow];
- AliHLTTPCCARow &rowUp = tracker.Rows()[iRowUp];
- AliHLTTPCCARow &rowDn = tracker.Rows()[iRowDn];
+ s.fFirstHit = tracker.Row(s.fIRow).FirstHit();
+ const AliHLTTPCCARow &row = tracker.Row(s.fIRow);
+ const AliHLTTPCCARow &rowUp = tracker.Row(iRowUp);
+ const AliHLTTPCCARow &rowDn = tracker.Row(iRowDn);
s.fHitLinkUp = ((Short_t*)(tracker.RowData() + row.FullOffset())) + row.FullLinkOffset();
s.fHitLinkDown = s.fHitLinkUp + row.NHits();
s.fDnHitLinkUp = ((Short_t*)(tracker.RowData() + rowDn.FullOffset())) + rowDn.FullLinkOffset();
s.fUpHitLinkDown = ((Short_t*)(tracker.RowData() + rowUp.FullOffset())) + rowUp.FullLinkOffset() + rowUp.NHits();
- s.fNHits = tracker.Rows()[s.fIRow].NHits();
+ s.fNHits = tracker.Row(s.fIRow).NHits();
}
}
}
AliHLTTPCCASharedMemory &s, AliHLTTPCCATracker &tracker )
{
//* find neighbours
-
+
if( iSync==0 )
{
if( iThread==0 ){
s.fNRows = tracker.Param().NRows();
s.fIRow = iBlock;
if( s.fIRow < s.fNRows ){
- AliHLTTPCCARow &row = tracker.Rows()[s.fIRow];
+ const AliHLTTPCCARow &row = tracker.Row(s.fIRow);
s.fFirst = row.FirstHit();
s.fNHits = row.NHits();
if( (s.fIRow>0) && (s.fIRow<s.fNRows-1) ){
s.fIRowUp = s.fIRow+1;
s.fIRowDn = s.fIRow-1;
- s.fFirstDn = tracker.Rows()[s.fIRowDn].FirstHit();
- s.fFirstUp = tracker.Rows()[s.fIRowUp].FirstHit();
- Float_t xDn = tracker.Rows()[s.fIRowDn].X();
- Float_t x = tracker.Rows()[s.fIRow].X();
- Float_t xUp = tracker.Rows()[s.fIRowUp].X();
- s.fUpNHits = tracker.Rows()[s.fIRowUp].NHits();
+ s.fFirstDn = tracker.Row(s.fIRowDn).FirstHit();
+ s.fFirstUp = tracker.Row(s.fIRowUp).FirstHit();
+ Float_t xDn = tracker.Row(s.fIRowDn).X();
+ Float_t x = tracker.Row(s.fIRow).X();
+ Float_t xUp = tracker.Row(s.fIRowUp).X();
+ s.fUpNHits = tracker.Row(s.fIRowUp).NHits();
s.fDnNHits = s.fFirst - s.fFirstDn;
s.fUpDx = xUp - x;
s.fDnDx = xDn - x;
s.fUpTx = xUp/x;
s.fDnTx = xDn/x;
- s.fGridUp = tracker.Rows()[s.fIRowUp].Grid();
- s.fGridDn = tracker.Rows()[s.fIRowDn].Grid();
+ s.fGridUp = tracker.Row(s.fIRowUp).Grid();
+ s.fGridDn = tracker.Row(s.fIRowDn).Grid();
}
}
}
s.fHitLinkDn[ih] = -1;
}
}else {
- AliHLTTPCCARow &rowUp = tracker.Rows()[s.fIRowUp];
- AliHLTTPCCARow &rowDn = tracker.Rows()[s.fIRowDn];
- UShort_t *gContentUp = (reinterpret_cast<UShort_t*>(tracker.RowData() + rowUp.FullOffset())) + rowUp.FullGridOffset();
- UShort_t *gContentDn = (reinterpret_cast<UShort_t*>(tracker.RowData() + rowDn.FullOffset())) + rowDn.FullGridOffset();
-
+ const AliHLTTPCCARow &rowUp = tracker.Row(s.fIRowUp);
+ const AliHLTTPCCARow &rowDn = tracker.Row(s.fIRowDn);
+ const UShort_t *gContentUp = (reinterpret_cast<const UShort_t*>(tracker.RowData() + rowUp.FullOffset())) + rowUp.FullGridOffset();
+ const UShort_t *gContentDn = (reinterpret_cast<const UShort_t*>(tracker.RowData() + rowDn.FullOffset())) + rowDn.FullGridOffset();
+
for( UInt_t ih=iThread; ih<s.fGridUp.N()+s.fGridUp.Ny()+2; ih+=nThreads ){
s.fGridContentUp[ih] = gContentUp[ih];
}
else if( iSync==2 )
{
if( (s.fIRow<=0) || (s.fIRow >= s.fNRows-1) ) return;
-
+
const Float_t kAreaSize = 3;
Float_t chi2Cut = 3.*3.*4*(s.fUpDx*s.fUpDx + s.fDnDx*s.fDnDx );
- const Int_t kMaxN = 5;
+ //const Float_t kAreaSize = 3;
+ //Float_t chi2Cut = 3.*3.*(s.fUpDx*s.fUpDx + s.fDnDx*s.fDnDx ); //SG
+ const Int_t kMaxN = 5;
- AliHLTTPCCARow &row = tracker.Rows()[s.fIRow];
- AliHLTTPCCARow &rowUp = tracker.Rows()[s.fIRowUp];
- AliHLTTPCCARow &rowDn = tracker.Rows()[s.fIRowDn];
+ const AliHLTTPCCARow &row = tracker.Row(s.fIRow);
+ const AliHLTTPCCARow &rowUp = tracker.Row(s.fIRowUp);
+ const AliHLTTPCCARow &rowDn = tracker.Row(s.fIRowDn);
Float_t y0 = row.Grid().YMin();
Float_t z0 = row.Grid().ZMin();
Float_t stepY = row.HstepY();
Float_t stepZ = row.HstepZ();
- uint4* tmpint4 = tracker.RowData() + row.FullOffset();
- ushort2 *hits = reinterpret_cast<ushort2*>(tmpint4);
-
+ const uint4* tmpint4 = tracker.RowData() + row.FullOffset();
+ const ushort2 *hits = reinterpret_cast<const ushort2*>(tmpint4);
for( Int_t ih=iThread; ih<s.fNHits; ih+=nThreads ){
AliHLTTPCCAHit h0;
{
ushort2 hh = hits[ih];
- h0.Y() = y0 + hh.x*stepY;
- h0.Z() = z0 + hh.y*stepZ;
+ h0.SetY( y0 + hh.x*stepY );
+ h0.SetZ( z0 + hh.y*stepZ );
}
//h0 = tracker.Hits()[ s.fFirst + ih ];
AliHLTTPCCAHit h;
Int_t i = areaDn.GetNext( tracker, rowDn,s.fGridContentDn,h );
if( i<0 ) break;
- nNeighDn++;
+ nNeighDn++;
float2 yzdn = make_float2( s.fUpDx*(h.Y()-y), s.fUpDx*(h.Z()-z) );
-
+
for( Int_t iUp=0; iUp<nNeighUp; iUp++ ){
float2 yzup = yzUp[iUp];
Float_t dy = yzdn.x - yzup.x;
AliHLTTPCCAOutTrack():fFirstHitRef(0),fNHits(0),fStartPoint(),fEndPoint(),fOrigTrackID(0){}
virtual ~AliHLTTPCCAOutTrack(){}
- GPUhd() Int_t &NHits() { return fNHits; }
- GPUhd() Int_t &FirstHitRef() { return fFirstHitRef; }
+ GPUhd() Int_t NHits() const { return fNHits; }
+ GPUhd() Int_t FirstHitRef() const { return fFirstHitRef; }
- GPUhd() AliHLTTPCCATrackParam &StartPoint() { return fStartPoint; }
- GPUhd() AliHLTTPCCATrackParam &EndPoint() { return fEndPoint; }
- GPUhd() Int_t &OrigTrackID() { return fOrigTrackID; }
+ GPUhd() const AliHLTTPCCATrackParam &StartPoint() const { return fStartPoint; }
+ GPUhd() const AliHLTTPCCATrackParam &EndPoint() const { return fEndPoint; }
+ GPUhd() Int_t OrigTrackID() const { return fOrigTrackID; }
+
+ GPUhd() void SetNHits( Int_t v ) { fNHits = v; }
+ GPUhd() void SetFirstHitRef( Int_t v) { fFirstHitRef = v; }
+
+ GPUhd() void SetStartPoint( const AliHLTTPCCATrackParam &v) { fStartPoint = v; }
+ GPUhd() void SetEndPoint( const AliHLTTPCCATrackParam &v) { fEndPoint = v; }
+ GPUhd() void SetOrigTrackID( Int_t v) { fOrigTrackID = v; }
protected:
: fISlice(0),fNRows(63),fAlpha(0.174533), fDAlpha(0.349066),
fCosAlpha(0), fSinAlpha(0), fAngleMin(0), fAngleMax(0), fRMin(83.65), fRMax(133.3),
fZMin(0.0529937), fZMax(249.778), fErrX(0), fErrY(0), fErrZ(0.228808),fPadPitch(0.4),fBz(-5.),
- fYErrorCorrection(0.33), fZErrorCorrection(0.45),
- fCellConnectionAngleXY(45./180.*CAMath::Pi()),
- fCellConnectionAngleXZ(45./180.*CAMath::Pi()),
+ fHitPickUpFactor(2.),
fMaxTrackMatchDRow(4), fTrackConnectionFactor(3.5), fTrackChiCut(3.5), fTrackChi2Cut(10)
{
// constructor
out << fErrZ<<std::endl;
out << fPadPitch<<std::endl;
out << fBz<<std::endl;
- out << fYErrorCorrection<<std::endl;
- out << fZErrorCorrection<<std::endl;
- out << fCellConnectionAngleXY<<std::endl;
- out << fCellConnectionAngleXZ<<std::endl;
+ out << fHitPickUpFactor<<std::endl;
out << fMaxTrackMatchDRow<<std::endl;
out << fTrackConnectionFactor<<std::endl;
out << fTrackChiCut<<std::endl;
in >> fErrZ;
in >> fPadPitch;
in >> fBz;
- in >> fYErrorCorrection;
- in >> fZErrorCorrection;
- in >> fCellConnectionAngleXY;
- in >> fCellConnectionAngleXZ;
+ in >> fHitPickUpFactor;
in >> fMaxTrackMatchDRow;
in >> fTrackConnectionFactor;
in >> fTrackChiCut;
Float_t *X, Float_t *Y, Float_t *Z ) const;
GPUd() GPUd() void Global2Slice( Float_t x, Float_t y, Float_t z,
Float_t *X, Float_t *Y, Float_t *Z ) const;
- GPUhd() Int_t &ISlice(){ return fISlice;}
- GPUhd() Int_t &NRows(){ return fNRows;}
-
- GPUhd() Float_t &RowX( Int_t iRow ){ return fRowX[iRow]; }
-
- GPUd() Float_t &Alpha(){ return fAlpha;}
- GPUd() Float_t &DAlpha(){ return fDAlpha;}
- GPUd() Float_t &CosAlpha(){ return fCosAlpha;}
- GPUd() Float_t &SinAlpha(){ return fSinAlpha;}
- GPUd() Float_t &AngleMin(){ return fAngleMin;}
- GPUd() Float_t &AngleMax(){ return fAngleMax;}
- GPUd() Float_t &RMin(){ return fRMin;}
- GPUd() GPUd() Float_t &RMax(){ return fRMax;}
- GPUd() GPUd() Float_t &ZMin(){ return fZMin;}
- GPUd() Float_t &ZMax(){ return fZMax;}
- GPUd() Float_t &ErrZ(){ return fErrZ;}
- GPUd() Float_t &ErrX(){ return fErrX;}
- GPUd() Float_t &ErrY(){ return fErrY;}
- GPUd() Float_t &Bz(){ return fBz;}
-
- GPUd() Float_t &TrackConnectionFactor(){ return fTrackConnectionFactor; }
- GPUd() Float_t &TrackChiCut() { return fTrackChiCut; }
- GPUd() Float_t &TrackChi2Cut(){ return fTrackChi2Cut; }
- GPUd() Int_t &MaxTrackMatchDRow(){ return fMaxTrackMatchDRow; }
- GPUd() Float_t &YErrorCorrection(){ return fYErrorCorrection; }
- GPUd() Float_t &ZErrorCorrection(){ return fZErrorCorrection; }
- GPUd() Float_t &CellConnectionAngleXY(){ return fCellConnectionAngleXY; }
- GPUd() Float_t &CellConnectionAngleXZ(){ return fCellConnectionAngleXZ; }
+
+
+ GPUhd() Int_t ISlice() const { return fISlice;}
+ GPUhd() Int_t NRows() const { return fNRows;}
+
+ GPUhd() Float_t RowX( Int_t iRow ) const { return fRowX[iRow]; }
+
+ GPUd() Float_t Alpha() const { return fAlpha;}
+ GPUd() Float_t DAlpha() const { return fDAlpha;}
+ GPUd() Float_t CosAlpha() const { return fCosAlpha;}
+ GPUd() Float_t SinAlpha() const { return fSinAlpha;}
+ GPUd() Float_t AngleMin() const { return fAngleMin;}
+ GPUd() Float_t AngleMax() const { return fAngleMax;}
+ GPUd() Float_t RMin() const { return fRMin;}
+ GPUd() Float_t RMax() const { return fRMax;}
+ GPUd() Float_t ZMin() const { return fZMin;}
+ GPUd() Float_t ZMax() const { return fZMax;}
+ GPUd() Float_t ErrZ() const { return fErrZ;}
+ GPUd() Float_t ErrX() const { return fErrX;}
+ GPUd() Float_t ErrY() const { return fErrY;}
+ GPUd() Float_t Bz() const { return fBz;}
+
+ GPUd() Float_t TrackConnectionFactor() const { return fTrackConnectionFactor; }
+ GPUd() Float_t TrackChiCut() const { return fTrackChiCut; }
+ GPUd() Float_t TrackChi2Cut() const { return fTrackChi2Cut; }
+ GPUd() Int_t MaxTrackMatchDRow() const { return fMaxTrackMatchDRow; }
+ GPUd() Float_t HitPickUpFactor() const { return fHitPickUpFactor; }
+
+
+
+ GPUhd() void SetISlice( Int_t v ){ fISlice = v;}
+ GPUhd() void SetNRows( Int_t v ){ fNRows = v;}
+ GPUhd() void SetRowX( Int_t iRow, Float_t v ){ fRowX[iRow] = v; }
+ GPUd() void SetAlpha( Float_t v ){ fAlpha = v;}
+ GPUd() void SetDAlpha( Float_t v ){ fDAlpha = v;}
+ GPUd() void SetCosAlpha( Float_t v ){ fCosAlpha = v;}
+ GPUd() void SetSinAlpha( Float_t v ){ fSinAlpha = v;}
+ GPUd() void SetAngleMin( Float_t v ){ fAngleMin = v;}
+ GPUd() void SetAngleMax( Float_t v ){ fAngleMax = v;}
+ GPUd() void SetRMin( Float_t v ){ fRMin = v;}
+ GPUd() void SetRMax( Float_t v ){ fRMax = v;}
+ GPUd() void SetZMin( Float_t v ){ fZMin = v;}
+ GPUd() void SetZMax( Float_t v ){ fZMax = v;}
+ GPUd() void SetErrZ( Float_t v ){ fErrZ = v;}
+ GPUd() void SetErrX( Float_t v ){ fErrX = v;}
+ GPUd() void SetErrY( Float_t v ){ fErrY = v;}
+ GPUd() void SetBz( Float_t v ){ fBz = v;}
+ GPUd() void SetTrackConnectionFactor( Float_t v ){ fTrackConnectionFactor = v;}
+ GPUd() void SetTrackChiCut( Float_t v ) { fTrackChiCut = v; }
+ GPUd() void SetTrackChi2Cut( Float_t v ){ fTrackChi2Cut = v; }
+ GPUd() void SetMaxTrackMatchDRow( Int_t v ){ fMaxTrackMatchDRow = v; }
+ GPUd() void SetHitPickUpFactor( Float_t v ){ fHitPickUpFactor = v; }
+
GPUd() Float_t GetClusterError2(Int_t yz, Int_t type, Float_t z, Float_t angle ) const;
void WriteSettings( std::ostream &out ) const;
void ReadSettings( std::istream &in );
+
+ GPUd() void SetParamS0Par(Int_t i, Int_t j, Int_t k, Float_t val ){
+ fParamS0Par[i][j][k] = val;
+ }
protected:
Float_t fPadPitch; // pad pitch
Float_t fBz; // magnetic field value (only constant field can be used)
- Float_t fYErrorCorrection;// correction factor for Y error of input clusters
- Float_t fZErrorCorrection;// correction factor for Z error of input clusters
+ Float_t fHitPickUpFactor;// multiplier for the chi2 window for hit pick up procedure
- Float_t fCellConnectionAngleXY; // max phi angle between connected cells
- Float_t fCellConnectionAngleXZ; // max psi angle between connected cells
Int_t fMaxTrackMatchDRow;// maximal jump in TPC row for connecting track segments
Float_t fTrackConnectionFactor; // allowed distance in Chi^2/3.5 for neighbouring tracks
Float_t fTrackChiCut; // cut for track Sqrt(Chi2/NDF);
#include "TH2.h"
#include "TProfile.h"
+AliHLTTPCCAPerformance &AliHLTTPCCAPerformance::Instance()
+{
+ // reference to static object
+ static AliHLTTPCCAPerformance gAliHLTTPCCAPerformance;
+ return gAliHLTTPCCAPerformance;
+}
AliHLTTPCCAPerformance::AliHLTTPCCAPerformance()
:
fhPullSinPhi(0),
fhPullDzDs(0),
fhPullQPt(0),
+ fhPullYS(0),
+ fhPullZT(0),
fhHitErrY(0),
fhHitErrZ(0),
fhHitResY(0),
fhNeighDyVsPt(0),
fhNeighDzVsPt(0),
fhNeighChiVsPt(0),
- fhNeighNCombVsArea(0)
+ fhNeighNCombVsArea(0),
+ fhNHitsPerSeed (0),
+ fhNHitsPerTrackCand(0),
+ fhTrackLengthRef(0),
+ fhRefRecoX(0),
+ fhRefRecoY(0),
+ fhRefRecoZ(0),
+ fhRefRecoP(0),
+ fhRefRecoPt(0),
+ fhRefRecoAngleY(0),
+ fhRefRecoAngleZ(0),
+ fhRefRecoNHits(0),
+ fhRefNotRecoX(0),
+ fhRefNotRecoY(0),
+ fhRefNotRecoZ(0),
+ fhRefNotRecoP(0),
+ fhRefNotRecoPt(0),
+ fhRefNotRecoAngleY(0),
+ fhRefNotRecoAngleZ(0),
+ fhRefNotRecoNHits(0)
{
//* constructor
}
fhPullSinPhi(0),
fhPullDzDs(0),
fhPullQPt(0),
+ fhPullYS(0),
+ fhPullZT(0),
fhHitErrY(0),
fhHitErrZ(0),
fhHitResY(0),
fhNeighDyVsPt(0),
fhNeighDzVsPt(0),
fhNeighChiVsPt(0),
- fhNeighNCombVsArea(0)
+ fhNeighNCombVsArea(0),
+ fhNHitsPerSeed (0),
+ fhNHitsPerTrackCand(0),
+ fhTrackLengthRef(0),
+ fhRefRecoX(0),
+ fhRefRecoY(0),
+ fhRefRecoZ(0),
+ fhRefRecoP(0),
+ fhRefRecoPt(0),
+ fhRefRecoAngleY(0),
+ fhRefRecoAngleZ(0),
+ fhRefRecoNHits(0),
+ fhRefNotRecoX(0),
+ fhRefNotRecoY(0),
+ fhRefNotRecoZ(0),
+ fhRefNotRecoP(0),
+ fhRefNotRecoPt(0),
+ fhRefNotRecoAngleY(0),
+ fhRefNotRecoAngleZ(0),
+ fhRefNotRecoNHits(0)
{
//* dummy
}
fNHits = NHits;
}
-void AliHLTTPCCAPerformance::SetNMCTracks( Int_t NMCTracks )
+void AliHLTTPCCAPerformance::SetNMCTracks( Int_t NumberOfMCTracks )
{
//* set number of MC tracks
if( fMCTracks ) delete[] fMCTracks;
fMCTracks = 0;
- fMCTracks = new AliHLTTPCCAMCTrack[ NMCTracks ];
- fNMCTracks = NMCTracks;
+ fMCTracks = new AliHLTTPCCAMCTrack[ NumberOfMCTracks ];
+ fNMCTracks = NumberOfMCTracks;
}
void AliHLTTPCCAPerformance::SetNMCPoints( Int_t NMCPoints )
{
//* read mc point to the local array
AliHLTTPCCAMCPoint &p = fMCPoints[fNMCPoints];
- p.TrackID() = TrackID;
- p.X() = X;
- p.Y() = Y;
- p.Z() = Z;
- p.Time() = Time;
- p.ISlice() = iSlice;
- fTracker->Slices()[iSlice].Param().Global2Slice( X, Y, Z,
- &p.Sx(), &p.Sy(), &p.Sz() );
+ p.SetTrackID( TrackID );
+ p.SetX( X );
+ p.SetY( Y );
+ p.SetZ( Z );
+ p.SetTime( Time );
+ p.SetISlice( iSlice );
+ Float_t sx, sy, sz;
+ fTracker->Slices()[iSlice].Param().Global2Slice( X, Y, Z, &sx, &sy, &sz );
+ p.SetSx(sx);
+ p.SetSy(sy);
+ p.SetSz(sz);
if( X*X + Y*Y>10.) fNMCPoints++;
}
gDirectory->cd("..");
+ gDirectory->mkdir("Tracklets");
+ gDirectory->cd("Tracklets");
+
+ fhNHitsPerSeed = new TH1D("NHitsPerSeed","NHitsPerSeed", 160,0,160);
+ fhNHitsPerTrackCand = new TH1D("NHitsPerTrackCand","NHitsPerTrackCand", 160,0,160);
+ gDirectory->cd("..");
+
+ gDirectory->mkdir("Tracks");
+ gDirectory->cd("Tracks");
+
+ fhTrackLengthRef = new TH1D("TrackLengthRef", "TrackLengthRef", 100,0,1);
+
+ fhRefRecoX = new TH1D("fhRefRecoX","fhRefRecoX",100,0,200.);
+ fhRefRecoY = new TH1D("fhRefRecoY","fhRefRecoY",100,-200,200.);
+ fhRefRecoZ = new TH1D("fhRefRecoZ","fhRefRecoZ",100,-250,250.);
+
+
+ fhRefRecoP = new TH1D("fhRefRecoP","fhRefRecoP",100,0,10.);
+ fhRefRecoPt = new TH1D("fhRefRecoPt","fhRefRecoPt",100,0,10.);
+ fhRefRecoAngleY = new TH1D("fhRefRecoAngleY","fhRefRecoAngleY",100,-180.,180.);
+ fhRefRecoAngleZ = new TH1D("fhRefRecoAngleZ","fhRefRecoAngleZ",100,-180.,180);
+ fhRefRecoNHits = new TH1D("fhRefRecoNHits","fhRefRecoNHits",100,0.,200);
+
+ fhRefNotRecoX = new TH1D("fhRefNotRecoX","fhRefNotRecoX",100,0,200.);
+ fhRefNotRecoY = new TH1D("fhRefNotRecoY","fhRefNotRecoY",100,-200,200.);
+ fhRefNotRecoZ = new TH1D("fhRefNotRecoZ","fhRefNotRecoZ",100,-250,250.);
+
+
+ fhRefNotRecoP = new TH1D("fhRefNotRecoP","fhRefNotRecoP",100,0,10.);
+ fhRefNotRecoPt = new TH1D("fhRefNotRecoPt","fhRefNotRecoPt",100,0,10.);
+ fhRefNotRecoAngleY = new TH1D("fhRefNotRecoAngleY","fhRefNotRecoAngleY",100,-180.,180.);
+ fhRefNotRecoAngleZ = new TH1D("fhRefNotRecoAngleZ","fhRefNotRecoAngleZ",100,-180.,180);
+ fhRefNotRecoNHits = new TH1D("fhRefNotRecoNHits","fhRefNotRecoNHits",100,0.,200);
+
+ gDirectory->cd("..");
gDirectory->mkdir("TrackFit");
gDirectory->cd("TrackFit");
fhPullSinPhi = new TH1D("pullSinPhi", "track SinPhi pull", 30, -10., 10.);
fhPullDzDs = new TH1D("pullDzDs", "track DzDs pull", 30, -10., 10.);
fhPullQPt = new TH1D("pullQPt", "track Q/Pt pull", 30, -10., 10.);
+ fhPullYS = new TH1D("pullYS", "track Y+SinPhi chi deviation", 100, 0., 30.);
+ fhPullZT = new TH1D("pullZT", "track Z+DzDs chi deviation ", 100, 0., 30.);
gDirectory->cd("..");
*/
fStatNEvents++;
for( Int_t islice=0; islice<fTracker->NSlices(); islice++){
- SlicePerformance(islice,1);
+ SlicePerformance(islice,0);
}
nGhost++;
continue;
}
-
+ AliHLTTPCCAGBTrack &tCA = fTracker->Tracks()[itr];
AliHLTTPCCAMCTrack &mc = fMCTracks[traLabels[itr]];
-
+
mc.NReconstructed()++;
if( mc.Set()== 0 ) nRecOut++;
else{
if( mc.Set()==2 ){
if( mc.NReconstructed()==1 ) nRecRef++;
else if(mc.NReconstructed() > mc.NTurns() ) nClonesRef++;
+ fhTrackLengthRef->Fill( tCA.NHits()/((Double_t) mc.NHits()));
}
}
// track resolutions
- while( TMath::Abs(mc.TPCPar()[0]) + TMath::Abs(mc.TPCPar()[1])>1 ){
+ while( mc.Set()==2 && TMath::Abs(mc.TPCPar()[0]) + TMath::Abs(mc.TPCPar()[1])>1 ){
if( traPurity[itr]<.90 ) break;
AliHLTTPCCAGBTrack &t = fTracker->Tracks()[itr];
AliHLTTPCCATrackParam p = t.Param();
if( p.GetErr2Y()>0 ) fhPullY->Fill( (p.GetY() - mcY)/TMath::Sqrt(p.GetErr2Y()) );
if( p.GetErr2Z()>0 ) fhPullZ->Fill( (p.GetZ() - mcZ)/TMath::Sqrt(p.GetErr2Z()) );
+
if( p.GetErr2SinPhi()>0 ) fhPullSinPhi->Fill( (p.GetSinPhi() - mcSinPhi)/TMath::Sqrt(p.GetErr2SinPhi()) );
if( p.GetErr2DzDs()>0 ) fhPullDzDs->Fill( (p.DzDs() - mcDzDs)/TMath::Sqrt(p.GetErr2DzDs()) );
if( p.GetErr2Kappa()>0 ) fhPullQPt->Fill( (qPt - mcQPt)/TMath::Sqrt(p.GetErr2Kappa()*k2QPt*k2QPt) );
+ fhPullYS->Fill( TMath::Sqrt(fTracker->GetChi2( p.GetY(), p.GetSinPhi(), p.GetCov()[0], p.GetCov()[3], p.GetCov()[5],
+ mcY, mcSinPhi, 0,0,0 )));
+ fhPullZT->Fill( TMath::Sqrt(fTracker->GetChi2( p.GetZ(), p.GetDzDs(), p.GetCov()[2], p.GetCov()[7], p.GetCov()[9],
+ mcZ, mcDzDs, 0,0,0 ) ));
+
break;
}
}
AliHLTTPCCAMCTrack &mc = fMCTracks[ipart];
if( mc.Set()>0 ) fhGBEffVsP->Fill(mc.P(), ( mc.NReconstructed()>0 ?1 :0));
if( mc.Set()>0 ) fhGBEffVsPt->Fill(mc.Pt(), ( mc.NReconstructed()>0 ?1 :0));
+ if( mc.Set()==2 ){
+ const Double_t *p = mc.TPCPar();
+ Double_t r = TMath::Sqrt(p[0]*p[0] + p[1]*p[1]);
+ Double_t cosA = p[0]/r;
+ Double_t sinA = p[1]/r;
+
+
+ Double_t phipos = TMath::Pi()+TMath::ATan2(-p[1], -p[0]);
+ Double_t alpha = TMath::Pi()*(20*((((Int_t)(phipos*180/TMath::Pi()))/20))+10)/180.;
+ cosA = TMath::Cos(alpha);
+ sinA = TMath::Sin(alpha);
+
+ Double_t mcX = p[0]*cosA + p[1]*sinA;
+ Double_t mcY = -p[0]*sinA + p[1]*cosA;
+ Double_t mcZ = p[2];
+ Double_t mcEx = p[3]*cosA + p[4]*sinA;
+ Double_t mcEy = -p[3]*sinA + p[4]*cosA;
+ Double_t mcEz = p[5];
+ //Double_t mcEt = TMath::Sqrt(mcEx*mcEx + mcEy*mcEy);
+ Double_t angleY = TMath::ATan2(mcEy, mcEx)*180./TMath::Pi();
+ Double_t angleZ = TMath::ATan2(mcEz, mcEx)*180./TMath::Pi();
+
+ if( mc.NReconstructed()>0 ){
+ fhRefRecoX->Fill(mcX);
+ fhRefRecoY->Fill(mcY);
+ fhRefRecoZ->Fill(mcZ);
+ fhRefRecoP->Fill(mc.P());
+ fhRefRecoPt->Fill(mc.Pt());
+ fhRefRecoAngleY->Fill(angleY);
+ fhRefRecoAngleZ->Fill(angleZ);
+ fhRefRecoNHits->Fill(mc.NHits());
+ } else {
+ fhRefNotRecoX->Fill(mcX);
+ fhRefNotRecoY->Fill(mcY);
+ fhRefNotRecoZ->Fill(mcZ);
+ fhRefNotRecoP->Fill(mc.P());
+ fhRefNotRecoPt->Fill(mc.Pt());
+ fhRefNotRecoAngleY->Fill(angleY);
+ fhRefNotRecoAngleZ->Fill(angleZ);
+ fhRefNotRecoNHits->Fill(mc.NHits());
+ }
+ }
}
if( traLabels ) delete[] traLabels;
Float_t errY, errZ;
{
AliHLTTPCCATrackParam t;
- t.Z() = sz;
- t.SinPhi() = dy/TMath::Sqrt(dx*dx+dy*dy);
- t.CosPhi() = dx/TMath::Sqrt(dx*dx+dy*dy);
- t.DzDs() = dz/TMath::Sqrt(dx*dx+dy*dy);
+ t.SetZ( sz );
+ t.SetSinPhi( dy/TMath::Sqrt(dx*dx+dy*dy) );
+ t.SetCosPhi( dx/TMath::Sqrt(dx*dx+dy*dy) );
+ t.SetDzDs( dz/TMath::Sqrt(dx*dx+dy*dy) );
fTracker->GetErrors2(hit,t,errY, errZ );
errY = TMath::Sqrt(errY);
errZ = TMath::Sqrt(errZ);
}
{
- cout<<"\nGlobal tracker performance: \n"<<endl;
+ cout<<"\nGlobal tracker performance for "<<fStatNEvents<<" events: \n"<<endl;
cout<<" N tracks : "
+ <<fStatGBNMCAll<<" mc all, "
+ <<fStatGBNMCRef<<" mc ref, "
+ <<fStatGBNRecTot<<" rec total, "
+ <<fStatGBNRecAll<<" rec all, "
+ <<fStatGBNClonesAll<<" clones all, "
+ <<fStatGBNRecRef<<" rec ref, "
+ <<fStatGBNClonesRef<<" clones ref, "
+ <<fStatGBNRecOut<<" out, "
+ <<fStatGBNGhost<<" ghost"<<endl;
+ cout<<" N tracks average : "
<<fStatGBNMCAll/fStatNEvents<<" mc all, "
<<fStatGBNMCRef/fStatNEvents<<" mc ref, "
<<fStatGBNRecTot/fStatNEvents<<" rec total, "
fMCPoints = new AliHLTTPCCAMCPoint[fNMCPoints];
for( Int_t ip=0; ip<fNMCPoints; ip++ ){
AliHLTTPCCAMCPoint &p = fMCPoints[ip];
- in>> p.X();
- in>> p.Y();
- in>> p.Z();
- in>> p.Sx();
- in>> p.Sy();
- in>> p.Sz();
- in>> p.Time();
- in>> p.ISlice();
- in>> p.TrackID();
+ Float_t f;
+ Int_t i;
+ in>> f;
+ p.SetX( f );
+ in >> f;
+ p.SetY( f );
+ in >> f;
+ p.SetZ( f );
+ in >> f;
+ p.SetSx( f );
+ in >> f;
+ p.SetSy( f );
+ in >> f;
+ p.SetSz( f );
+ in >> f;
+ p.SetTime( f );
+ in >> i;
+ p.SetISlice( i );
+ in >> i;
+ p.SetTrackID( i );
}
}
public:
+ struct AliHLTTPCCAHitLabel{
+ Int_t fLab[3]; //* array of 3 MC labels
+ };
+
AliHLTTPCCAPerformance();
AliHLTTPCCAPerformance(const AliHLTTPCCAPerformance&);
AliHLTTPCCAPerformance &operator=(const AliHLTTPCCAPerformance&);
virtual ~AliHLTTPCCAPerformance();
+ static AliHLTTPCCAPerformance &Instance();
+
void SetTracker( AliHLTTPCCAGBTracker *Tracker );
void StartEvent();
void SetNHits( Int_t NHits );
void ReadMCEvent( istream &in );
void WriteMCPoints( ostream &out ) const;
void ReadMCPoints( istream &in );
- Bool_t& DoClusterPulls(){ return fDoClusterPulls; }
+ Bool_t DoClusterPulls() const { return fDoClusterPulls; }
+ void SetDoClusterPulls( Bool_t v ) { fDoClusterPulls = v; }
+ AliHLTTPCCAHitLabel *HitLabels(){ return fHitLabels;}
+ AliHLTTPCCAMCTrack *MCTracks(){ return fMCTracks; }
+ Int_t NMCTracks() const { return fNMCTracks; }
+
+ TH1D *HNHitsPerSeed() const { return fhNHitsPerSeed;}
+ TH1D *HNHitsPerTrackCand() const { return fhNHitsPerTrackCand; }
protected:
AliHLTTPCCAGBTracker *fTracker; //* pointer to the tracker
- struct AliHLTTPCCAHitLabel{
- Int_t fLab[3]; //* array of 3 MC labels
- };
AliHLTTPCCAHitLabel *fHitLabels; //* array of hit MC labels
Int_t fNHits; //* number of hits
*fhPullZ, //* track Z pull at the TPC entrance
*fhPullSinPhi, //* track SinPhi pull at the TPC entrance
*fhPullDzDs, //* track DzDs pull at the TPC entrance
- *fhPullQPt; //* track Q/Pt pull at the TPC entrance
+ *fhPullQPt, //* track Q/Pt pull at the TPC entrance
+ *fhPullYS, //* sqrt(chi2/ndf) deviation of the track parameters Y and SinPhi at the TPC entrance
+ *fhPullZT; //* sqrt(chi2/ndf) deviation of the track parameters Z and DzDs at the TPC entrance
TH1D
*fhHitErrY, //* hit error in Y
*fhNeighChiVsPt, // chi2^0.5 for neighbours vs track Pt
*fhNeighNCombVsArea; // N neighbours in the search area
+ TH1D
+ *fhNHitsPerSeed, // n hits per track seed
+ *fhNHitsPerTrackCand; // n hits per track candidate
+
+ TH1D
+ *fhTrackLengthRef, // reconstructed track length, %
+ *fhRefRecoX,// parameters of non-reconstructed ref. mc track
+ *fhRefRecoY,// parameters of non-reconstructed ref. mc track
+ *fhRefRecoZ,// parameters of non-reconstructed ref. mc track
+ *fhRefRecoP, // parameters of non-reconstructed ref. mc track
+ *fhRefRecoPt,// parameters of non-reconstructed ref. mc track
+ *fhRefRecoAngleY,// parameters of non-reconstructed ref. mc track
+ *fhRefRecoAngleZ,// parameters of non-reconstructed ref. mc track
+ *fhRefRecoNHits,// parameters of non-reconstructed ref. mc track
+ *fhRefNotRecoX,// parameters of non-reconstructed ref. mc track
+ *fhRefNotRecoY,// parameters of non-reconstructed ref. mc track
+ *fhRefNotRecoZ,// parameters of non-reconstructed ref. mc track
+ *fhRefNotRecoP, // parameters of non-reconstructed ref. mc track
+ *fhRefNotRecoPt,// parameters of non-reconstructed ref. mc track
+ *fhRefNotRecoAngleY,// parameters of non-reconstructed ref. mc track
+ *fhRefNotRecoAngleZ,// parameters of non-reconstructed ref. mc track
+ *fhRefNotRecoNHits;// parameters of non-reconstructed ref. mc track
+
static void WriteDir2Current( TObject *obj );
};
template<class TProcess>
GPUg() void AliHLTTPCCAProcess( Int_t nBlocks, Int_t nThreads, AliHLTTPCCATracker &tracker )
-{
+{
for( Int_t iB=0; iB<nBlocks; iB++ ){
typename TProcess::AliHLTTPCCASharedMemory smem;
for( Int_t iS=0; iS<=TProcess::NThreadSyncPoints(); iS++)
- for( Int_t iT=0; iT<nThreads; iT++ )
+ for( Int_t iT=0; iT<nThreads; iT++ ){
TProcess::Thread( nBlocks, nThreads, iB, iT, iS, smem, tracker );
+ }
}
}
AliHLTTPCCARow();
#endif
- //AliHLTTPCCARow &operator=( const AliHLTTPCCARow &);
-
- GPUhd() Int_t &FirstHit(){ return fFirstHit; }
- GPUhd() Int_t &NHits() { return fNHits; }
- GPUhd() Float_t &X() { return fX; }
- GPUhd() Float_t &MaxY() { return fMaxY; }
- GPUhd() AliHLTTPCCAGrid &Grid(){ return fGrid; }
-
- GPUhd() Float_t &Hy0() { return fHy0;}
- GPUhd() Float_t &Hz0() { return fHz0;}
- GPUhd() Float_t &HstepY() { return fHstepY;}
- GPUhd() Float_t &HstepZ() { return fHstepZ;}
- GPUhd() Float_t &HstepYi() { return fHstepYi;}
- GPUhd() Float_t &HstepZi() { return fHstepZi;}
- GPUhd() Int_t &FullSize() { return fFullSize;}
- GPUhd() Int_t &FullOffset() { return fFullOffset;}
- GPUhd() Int_t &FullGridOffset() { return fFullGridOffset;}
- GPUhd() Int_t &FullLinkOffset() { return fFullLinkOffset;}
+ GPUhd() Int_t FirstHit() const { return fFirstHit; }
+ GPUhd() Int_t NHits() const { return fNHits; }
+ GPUhd() Float_t X() const { return fX; }
+ GPUhd() Float_t MaxY() const { return fMaxY; }
+ GPUhd() const AliHLTTPCCAGrid &Grid() const { return fGrid; }
+
+ GPUhd() Float_t Hy0() const { return fHy0;}
+ GPUhd() Float_t Hz0() const { return fHz0;}
+ GPUhd() Float_t HstepY() const { return fHstepY;}
+ GPUhd() Float_t HstepZ() const { return fHstepZ;}
+ GPUhd() Float_t HstepYi() const { return fHstepYi;}
+ GPUhd() Float_t HstepZi() const { return fHstepZi;}
+ GPUhd() Int_t FullSize() const { return fFullSize;}
+ GPUhd() Int_t FullOffset() const { return fFullOffset;}
+ GPUhd() Int_t FullGridOffset() const { return fFullGridOffset;}
+ GPUhd() Int_t FullLinkOffset() const { return fFullLinkOffset;}
+
+
+ GPUhd() void SetFirstHit( Int_t v ){ fFirstHit = v; }
+ GPUhd() void SetNHits( Int_t v ) { fNHits = v; }
+ GPUhd() void SetX( Float_t v ) { fX = v; }
+ GPUhd() void SetMaxY( Float_t v ) { fMaxY = v; }
+ GPUhd() void SetGrid( const AliHLTTPCCAGrid &v ){ fGrid = v; }
+
+ GPUhd() void SetHy0( Float_t v ) { fHy0 = v;}
+ GPUhd() void SetHz0( Float_t v ) { fHz0 = v;}
+ GPUhd() void SetHstepY( Float_t v ) { fHstepY = v;}
+ GPUhd() void SetHstepZ( Float_t v ) { fHstepZ = v;}
+ GPUhd() void SetHstepYi( Float_t v ) { fHstepYi = v;}
+ GPUhd() void SetHstepZi( Float_t v ) { fHstepZi = v;}
+ GPUhd() void SetFullSize( Int_t v ) { fFullSize = v;}
+ GPUhd() void SetFullOffset( Int_t v ) { fFullOffset = v;}
+ GPUhd() void SetFullGridOffset( Int_t v ) { fFullGridOffset = v;}
+ GPUhd() void SetFullLinkOffset( Int_t v ) { fFullLinkOffset = v;}
private:
s.fIRow = iBlock+1;
s.fNRowStartHits = 0;
if( s.fIRow <= s.fNRows-4 ){
- s.fNHits = tracker.Rows()[s.fIRow].NHits();
+ s.fNHits = tracker.Row(s.fIRow).NHits();
if( s.fNHits>=1024 ) s.fNHits = 1023;
- AliHLTTPCCARow &row = tracker.Rows()[s.fIRow];
+ const AliHLTTPCCARow &row = tracker.Row(s.fIRow);
s.fHitLinkUp = ((Short_t*)(tracker.RowData() + row.FullOffset())) + row.FullLinkOffset();
s.fHitLinkDown = s.fHitLinkUp + row.NHits();
~AliHLTTPCCATrack(){}
#endif
- GPUhd() Bool_t &Alive() { return fAlive; }
- GPUhd() Int_t &NHits() { return fNHits; }
- GPUhd() Int_t &FirstHitID() { return fFirstHitID; }
- GPUhd() AliHLTTPCCATrackParam &Param(){ return fParam; };
+ GPUhd() Bool_t Alive() const { return fAlive; }
+ GPUhd() Int_t NHits() const { return fNHits; }
+ GPUhd() Int_t FirstHitID() const { return fFirstHitID; }
+ GPUhd() const AliHLTTPCCATrackParam &Param() const { return fParam; };
+
+ GPUhd() void SetAlive( Bool_t v ) { fAlive=v; }
+ GPUhd() void SetNHits( Int_t v ) { fNHits=v; }
+ GPUhd() void SetFirstHitID( Int_t v ) { fFirstHitID=v; }
+ GPUhd() void SetParam( AliHLTTPCCATrackParam v ){ fParam=v; };
private:
{
//* Convert from AliExternalTrackParam parameterisation
- for( Int_t i=0; i<5; i++ ) T1.Par()[i] = T2.GetParameter()[i];
- for( Int_t i=0; i<15; i++ ) T1.Cov()[i] = T2.GetCovariance()[i];
- T1.X() = T2.GetX();
- if(T1.SinPhi()>.99 ) T1.SinPhi()=.99;
- if(T1.SinPhi()<-.99 ) T1.SinPhi()=-.99;
- T1.CosPhi() = CAMath::Sqrt(1.-T1.SinPhi()*T1.SinPhi());
+ for( Int_t i=0; i<5; i++ ) T1.SetPar( i, T2.GetParameter()[i] );
+ for( Int_t i=0; i<15; i++ ) T1.SetCov( i, T2.GetCovariance()[i] );
+ T1.SetX( T2.GetX() );
+ if(T1.SinPhi()>.99 ) T1.SetSinPhi( .99 );
+ if(T1.SinPhi()<-.99 ) T1.SetSinPhi( -.99 );
+ T1.SetCosPhi( CAMath::Sqrt(1.-T1.SinPhi()*T1.SinPhi()));
const Double_t kCLight = 0.000299792458;
Double_t c = Bz*kCLight;
{ // 1/pt -> kappa
- T1.Par()[4] *= c;
- T1.Cov()[10]*= c;
- T1.Cov()[11]*= c;
- T1.Cov()[12]*= c;
- T1.Cov()[13]*= c;
- T1.Cov()[14]*= c*c;
+ T1.SetPar( 4, T1.Par()[4]*c );
+ T1.SetCov( 10, T1.Cov()[10]*c );
+ T1.SetCov( 11, T1.Cov()[10]*c );
+ T1.SetCov( 12, T1.Cov()[10]*c );
+ T1.SetCov( 13, T1.Cov()[10]*c );
+ T1.SetCov( 14, T1.Cov()[10]*c*c );
}
}
#include "AliHLTTPCCATrackParam.h"
#include "AliHLTTPCCAMath.h"
-
+#include <iostream>
//
// Circle in XY:
// Yc = Y + cos(Phi)/Kappa;
//
+GPUd() Float_t AliHLTTPCCATrackParam::GetDist2( const AliHLTTPCCATrackParam &t ) const
+{
+ // get squared distance between tracks
+
+ Float_t dx = GetX() - t.GetX();
+ Float_t dy = GetY() - t.GetY();
+ Float_t dz = GetZ() - t.GetZ();
+ return dx*dx + dy*dy + dz*dz;
+}
+
+GPUd() Float_t AliHLTTPCCATrackParam::GetDistXZ2( const AliHLTTPCCATrackParam &t ) const
+{
+ // get squared distance between tracks in X&Z
+
+ Float_t dx = GetX() - t.GetX();
+ Float_t dz = GetZ() - t.GetZ();
+ return dx*dx + dz*dz;
+}
GPUd() void AliHLTTPCCATrackParam::ConstructXY3( const Float_t x[3], const Float_t y[3],
d2[1] = -d2[1];
}
- X() = x0;
- Y() = y0;
- SinPhi() = sinPhi;
- Kappa() = kappa;
- CosPhi() = cosPhi;
+ SetX( x0 );
+ SetY( y0 );
+ SetSinPhi( sinPhi );
+ SetKappa( kappa );
+ SetCosPhi( cosPhi );
Float_t s0 = sigmaY2[0];
Float_t s1 = sigmaY2[1];
Float_t ss = pS[0]*pS[0] + pS[1]*pS[1] + pS[2]*pS[2];
Float_t a = 3*ss-s*s;
- Z() = (z*ss-sz*s)/a; // z0
- DzDs() = (3*sz-z*s)/a; // t = dz/ds
+ SetZ( (z*ss-sz*s)/a ); // z0
+ SetDzDs( (3*sz-z*s)/a ); // t = dz/ds
Float_t dz0[3] = {ss - pS[0]*s,ss - pS[1]*s,ss - pS[2]*s };
Float_t dt [3] = {3*pS[0] - s, 3*pS[1] - s, 3*pS[2] - s };
Float_t exi = 1./ex;
Float_t ex1i = 1./ex1;
- CosPhi() = ex1;
- X() += dx;
+ fCosPhi = ex1;
+ fX += dx;
fP[0]+= dy;
fP[1]+= dz;
fP[2] = ey1;
fP[3] = fP[3];
fP[4] = fP[4];
- Float_t h2 = dx*(1+ ex*ex1 + ey*ey1 )*cci*exi*ex1i;
+ Float_t h2 = dx*(1+ey*ey1 + ex*ex1)*exi*ex1i*cci;
Float_t h4 = dx2*(cc + ss*ey1*ex1i )*cci*cci;
Float_t c00 = fC[0];
return 1;
}
-GPUd() Int_t AliHLTTPCCATrackParam::TransportToX0( Float_t x, Float_t /**/ )
+
+GPUd() Int_t AliHLTTPCCATrackParam::TransportToX( Float_t x, AliHLTTPCCATrackParam &t0, Float_t maxSinPhi )
{
//* Transport the track parameters to X=x
- Float_t ex = fCosPhi;
- if( CAMath::Abs(ex)<1.e-4 ) return 0;
+ Float_t x0 = t0.X();
+ Float_t k = t0.Kappa();
+ Float_t ex = t0.CosPhi();
+ Float_t ey = t0.SinPhi();
+ Float_t dx = x - x0;
+
+ Float_t ey1 = k*dx + ey;
+ Float_t ex1;
+ if( CAMath::Abs(ey1)>maxSinPhi ){ // no intersection
+ return 0;
+ }else{
+ ex1 = CAMath::Sqrt(1 - ey1*ey1);
+ if( ex<0 ) ex1 = -ex1;
+ }
+
+ Float_t dx2 = dx*dx;
+ Float_t ss = ey+ey1;
+ Float_t cc = ex+ex1;
+
+ if( CAMath::Abs(cc)<1.e-4 || CAMath::Abs(ex)<1.e-4 || CAMath::Abs(ex1)<1.e-4 ) return 0;
+
+ Float_t tg = ss/cc; // tan((phi1+phi)/2)
+
+ Float_t dy = dx*tg;
+ Float_t dl = dx*CAMath::Sqrt(1+tg*tg);
- Float_t ey = fP[2];
- Float_t dx = x - fX;
+ if( cc<0 ) dl = -dl;
+ Float_t dSin = dl*k/2;
+ if( dSin > 1 ) dSin = 1;
+ if( dSin <-1 ) dSin = -1;
+ Float_t dS = ( CAMath::Abs(k)>1.e-4) ? (2*CAMath::ASin(dSin)/k) :dl;
+ Float_t dz = dS*t0.DzDs();
+
+
+ Float_t cci = 1./cc;
Float_t exi = 1./ex;
- Float_t dS = dx*exi;
- Float_t dy = dS*ey;
- Float_t dz = dS*fP[3];
- Float_t h2 = dS*exi*exi;
- Float_t h4 = 0.5*dx*h2;
+ Float_t ex1i = 1./ex1;
- fX = x;
- fP[0]+= dy + h4*fP[4];
- fP[1]+= dz;
- fP[2]+= dx*fP[4];
+ Float_t c00 = fC[0];
+ Float_t c10 = fC[1];
+ Float_t c11 = fC[2];
+ Float_t c20 = fC[3];
+ Float_t c21 = fC[4];
+ Float_t c22 = fC[5];
+ Float_t c30 = fC[6];
+ Float_t c31 = fC[7];
+ Float_t c32 = fC[8];
+ Float_t c33 = fC[9];
+ Float_t c40 = fC[10];
+ Float_t c41 = fC[11];
+ Float_t c42 = fC[12];
+ Float_t c43 = fC[13];
+ Float_t c44 = fC[14];
+
+ Float_t d[5] = { fP[0]-t0.fP[0],
+ fP[1]-t0.fP[1],
+ fP[2]-t0.fP[2],
+ fP[3]-t0.fP[3],
+ fP[4]-t0.fP[4] };
//Float_t H0[5] = { 1,0, h2, 0, h4 };
//Float_t H1[5] = { 0, 1, 0, dS, 0 };
//Float_t H3[5] = { 0, 0, 0, 1, 0 };
//Float_t H4[5] = { 0, 0, 0, 0, 1 };
+ Float_t h2 = dx*(1+ey*ey1 + ex*ex1)*exi*ex1i*cci;
+ Float_t h4 = dx2*(cc + ss*ey1*ex1i )*cci*cci;
+
+ t0.SetCosPhi( ex1 );
+ t0.SetX( t0.GetX() + dx );
+ t0.SetY( t0.GetY() + dy );
+ t0.SetZ( t0.Z() + dz );
+ t0.SetSinPhi( ey1 );
+
+ fX = t0.X();
+ fP[0] = t0.fP[0] + d[0] + h2*d[2] + h4*d[4];
+ fP[1] = t0.fP[1] + d[1] + dS*d[3];
+ fP[2] = t0.fP[2] +d[2] + dx*d[4];
+
+ //CosPhi() = CosPhi()>=0 ?CAMath::Sqrt(1-fP[2]*fP[2]) :-CAMath::Sqrt(1-fP[2]*fP[2]);
+
+ fC[0]=( c00 + h2*h2*c22 + h4*h4*c44
+ + 2*( h2*c20 + h4*c40 + h2*h4*c42 ) );
+
+ fC[1]= c10 + h2*c21 + h4*c41 + dS*(c30 + h2*c32 + h4*c43);
+ fC[2]= c11 + 2*dS*c31 + dS*dS*c33;
+
+ fC[3]= c20 + h2*c22 + h4*c42 + dx*( c40 + h2*c42 + h4*c44);
+ fC[4]= c21 + dS*c32 + dx*(c41 + dS*c43);
+ fC[5]= c22 +2*dx*c42 + dx2*c44;
+
+ fC[6]= c30 + h2*c32 + h4*c43;
+ fC[7]= c31 + dS*c33;
+ fC[8]= c32 + dx*c43;
+ fC[9]= c33;
+
+ fC[10]= c40 + h2*c42 + h4*c44;
+ fC[11]= c41 + dS*c43;
+ fC[12]= c42 + dx*c44;
+ fC[13]= c43;
+ fC[14]= c44;
+
+ return 1;
+}
+
+
+GPUd() Int_t AliHLTTPCCATrackParam::TransportToX0( Float_t x, Float_t sinPhi, Float_t cosPhi )
+{
+ //* Transport the track parameters to X=x
+
+ Float_t ex = cosPhi;
+ Float_t ey = sinPhi;
+ Float_t dx = x - X();
+
+ if( CAMath::Abs(ex)<1.e-4 ) return 0;
+ Float_t exi = 1./ex;
+
+ Float_t dl = dx*exi;
+ Float_t dy = dl*ey;
+ Float_t dS = dl;
+ Float_t dz = dS*DzDs();
+
+
+ Float_t h2 = dx*exi*exi*exi;
+ Float_t h4 = dx*h2/2;
+ Float_t h5 = dx;
Float_t c00 = fC[0];
+ Float_t c10 = fC[1];
Float_t c11 = fC[2];
Float_t c20 = fC[3];
+ Float_t c21 = fC[4];
Float_t c22 = fC[5];
+ Float_t c30 = fC[6];
Float_t c31 = fC[7];
+ Float_t c32 = fC[8];
Float_t c33 = fC[9];
Float_t c40 = fC[10];
+ Float_t c41 = fC[11];
Float_t c42 = fC[12];
+ Float_t c43 = fC[13];
Float_t c44 = fC[14];
- Float_t c40ph4c44 = c40 + h4*c44;
- Float_t c20ph4c42 = c20 + h4*c42;
- Float_t c20ph2c22ph4c42 = h2*c22 + c20ph4c42;
- Float_t fC10 = c40ph4c44 + h2*c42;
- Float_t fC12 = c42 + dx*c44;
- Float_t fC7 = c31 + dS*c33;
-
- fC[10]= fC10;
- fC[12]= fC12;
- fC[7]= fC7;
- fC[0]= c00 + h2*( c20ph2c22ph4c42 + c20ph4c42) + h4*(c40ph4c44 + c40 ) ;
- fC[3]= c20ph2c22ph4c42 + dx*fC10;
- fC[5]= c22 + dx*( c42 + fC12 );
- fC[2]= c11 + dS*(c31 + fC7);
-
+ //Float_t H0[5] = { 1,0, h2, 0, h4 };
+ //Float_t H1[5] = { 0, 1, 0, dS, 0 };
+ //Float_t H2[5] = { 0, 0, 1, 0, h5 };
+ //Float_t H3[5] = { 0, 0, 0, 1, 0 };
+ //Float_t H4[5] = { 0, 0, 0, 0, 1 };
+
+ Float_t ey1 = SinPhi() + h5*Kappa();
+ //if( TMath::Abs(ey1)>maxSinPhi ){
+ //std::cout<<" TransportToX0 error: sinPhi="<<ey<<" -> "<<ey1<<std::endl;
+ //return 0;
+ //}
+ fX += dx ;
+ fP[0]+= dy + h2*(SinPhi()-ey) + h4*Kappa();
+ fP[1]+= dz ;
+ fP[2] = ey1;
+
+ //CosPhi() = CAMath::Sqrt(1-ey1*ey1);
+ //if( ex<0 ) CosPhi() = -CosPhi();
+
+ fC[0]=( c00 + h2*h2*c22 + h4*h4*c44
+ + 2*( h2*c20 + h4*c40 + h2*h4*c42 ) );
+
+ fC[1]= c10 + h2*c21 + h4*c41 + dS*(c30 + h2*c32 + h4*c43);
+ fC[2]= c11 + 2*dS*c31 + dS*dS*c33;
+
+ fC[3]= c20 + h2*c22 + h4*c42 + h5*( c40 + h2*c42 + h4*c44);
+ fC[4]= c21 + dS*c32 + h5*(c41 + dS*c43);
+ fC[5]= c22 +2*h5*c42 + h5*h5*c44;
+
+ fC[6]= c30 + h2*c32 + h4*c43;
+ fC[7]= c31 + dS*c33;
+ fC[8]= c32 + h5*c43;
+ fC[9]= c33;
+
+ fC[10]= c40 + h2*c42 + h4*c44;
+ fC[11]= c41 + dS*c43;
+ fC[12]= c42 + h5*c44;
+ fC[13]= c43;
+ fC[14]= c44;
+
return 1;
}
+GPUd() Int_t AliHLTTPCCATrackParam::TransportToX0( Float_t x, Float_t maxSinPhi)
+{
+ //* Transport the track parameters to X=x
+
+ Float_t ex = CosPhi();
+ Float_t ey = SinPhi();
+ Float_t dx = x - X();
+
+ if( CAMath::Abs(ex)<1.e-4 ) return 0;
+ Float_t exi = 1./ex;
+
+ Float_t dl = dx*exi;
+ Float_t dy = dl*ey;
+ Float_t dS = dl;
+ Float_t dz = dS*DzDs();
+
+
+ Float_t h2 = dx*exi*exi*exi;
+ Float_t h4 = dx*h2/2;
+ Float_t h5 = dx;
+
+ Float_t c00 = fC[0];
+ Float_t c10 = fC[1];
+ Float_t c11 = fC[2];
+ Float_t c20 = fC[3];
+ Float_t c21 = fC[4];
+ Float_t c22 = fC[5];
+ Float_t c30 = fC[6];
+ Float_t c31 = fC[7];
+ Float_t c32 = fC[8];
+ Float_t c33 = fC[9];
+ Float_t c40 = fC[10];
+ Float_t c41 = fC[11];
+ Float_t c42 = fC[12];
+ Float_t c43 = fC[13];
+ Float_t c44 = fC[14];
+
+ //Float_t H0[5] = { 1,0, h2, 0, h4 };
+ //Float_t H1[5] = { 0, 1, 0, dS, 0 };
+ //Float_t H2[5] = { 0, 0, 1, 0, h5 };
+ //Float_t H3[5] = { 0, 0, 0, 1, 0 };
+ //Float_t H4[5] = { 0, 0, 0, 0, 1 };
+
+ Float_t ey1 = SinPhi() + h5*Kappa();
+ if( CAMath::Abs(ey1)>maxSinPhi ){
+ //std::cout<<" TransportToX0 error: sinPhi="<<ey<<" -> "<<ey1<<std::endl;
+ return 0;
+ }
+ fX += dx ;
+ fP[0]+= dy + h4*Kappa();
+ fP[1]+= dz;
+ fP[2] = ey1;
+ fP[3] = fP[3];
+ fP[4] = fP[4];
+ fCosPhi = CAMath::Sqrt(1-ey1*ey1);
+ if( ex<0 ) fCosPhi = -fCosPhi;
+
+ fC[0]=( c00 + h2*h2*c22 + h4*h4*c44
+ + 2*( h2*c20 + h4*c40 + h2*h4*c42 ) );
+ fC[1]= c10 + h2*c21 + h4*c41 + dS*(c30 + h2*c32 + h4*c43);
+ fC[2]= c11 + 2*dS*c31 + dS*dS*c33;
+
+ fC[3]= c20 + h2*c22 + h4*c42 + h5*( c40 + h2*c42 + h4*c44);
+ fC[4]= c21 + dS*c32 + h5*(c41 + dS*c43);
+ fC[5]= c22 +2*h5*c42 + h5*h5*c44;
+
+ fC[6]= c30 + h2*c32 + h4*c43;
+ fC[7]= c31 + dS*c33;
+ fC[8]= c32 + h5*c43;
+ fC[9]= c33;
+
+ fC[10]= c40 + h2*c42 + h4*c44;
+ fC[11]= c41 + dS*c43;
+ fC[12]= c42 + h5*c44;
+ fC[13]= c43;
+ fC[14]= c44;
+
+ return 1;
+}
GPUd() Bool_t AliHLTTPCCATrackParam::TransportToXWithMaterial( Float_t Xto, Float_t Bz )
}
Float_t dx2 = dx*dx;
- CosPhi() = ex1;
+ fCosPhi = ex1;
Float_t ss = ey+ey1;
Float_t cc = ex+ex1;
Float_t tg = 0;
if( !ret ) return ret;
- X() += dx;
+ fX += dx;
fP[0]+= dy;
fP[1]+= dz;
fP[2] = ey1;
+GPUd() Bool_t AliHLTTPCCATrackParam::TransportToXWithMaterial( Float_t x, AliHLTTPCCATrackParam &t0, AliHLTTPCCATrackFitParam &par )
+{
+ //* Transport the track parameters to X=x
+
+ Bool_t ret = 1;
+
+ Float_t oldX=t0.GetX();
+
+ Float_t x0 = t0.X();
+ //Float_t y0 = t0.Y();
+ Float_t k = t0.Kappa();
+ Float_t ex = t0.CosPhi();
+ Float_t ey = t0.SinPhi();
+ Float_t dx = x - x0;
+
+ Float_t ey1 = k*dx + ey;
+ Float_t ex1;
+ if( CAMath::Abs(ey1)>.99 ){ // no intersection -> check the border
+ ey1 = ( ey1>0 ) ?1 :-1;
+ ex1 = 0;
+ dx = ( CAMath::Abs(k)>1.e-4) ? ( (ey1-ey)/k ) :0;
+
+ Float_t ddx = CAMath::Abs(x0+dx - x)*k*k;
+ Float_t hx[] = {0, -k, 1+ey };
+ Float_t sx2 = hx[1]*hx[1]*fC[ 3] + hx[2]*hx[2]*fC[ 5];
+ if( ddx*ddx>3.5*3.5*sx2 ) ret = 0; // x not withing the error
+ ret = 0; // any case
+ return ret;
+ }else{
+ ex1 = CAMath::Sqrt(1 - ey1*ey1);
+ if( ex<0 ) ex1 = -ex1;
+ }
+
+ Float_t dx2 = dx*dx;
+ Float_t ss = ey+ey1;
+ Float_t cc = ex+ex1;
+ Float_t tg = 0;
+ if( CAMath::Abs(cc)>1.e-4 ) tg = ss/cc; // tan((phi1+phi)/2)
+ else ret = 0;
+ Float_t dy = dx*tg;
+ Float_t dl = dx*CAMath::Sqrt(1+tg*tg);
+
+ if( cc<0 ) dl = -dl;
+ Float_t dSin = dl*k/2;
+ if( dSin > 1 ) dSin = 1;
+ if( dSin <-1 ) dSin = -1;
+ Float_t dS = ( CAMath::Abs(k)>1.e-4) ? (2*CAMath::ASin(dSin)/k) :dl;
+ Float_t dz = dS*t0.DzDs();
+
+ Float_t cci = 0, exi = 0, ex1i = 0;
+ if( CAMath::Abs(cc)>1.e-4 ) cci = 1./cc;
+ else ret = 0;
+ if( CAMath::Abs(ex)>1.e-4 ) exi = 1./ex;
+ else ret = 0;
+ if( CAMath::Abs(ex1)>1.e-4 ) ex1i = 1./ex1;
+ else ret = 0;
+
+ if( !ret ) return ret;
+
+ Float_t h2 = dx*(1+ ex*ex1 + ey*ey1 )*cci*exi*ex1i;
+ Float_t h4 = dx2*(cc + ss*ey1*ex1i )*cci*cci;
+
+ Float_t c00 = fC[0];
+ Float_t c10 = fC[1];
+ Float_t c11 = fC[2];
+ Float_t c20 = fC[3];
+ Float_t c21 = fC[4];
+ Float_t c22 = fC[5];
+ Float_t c30 = fC[6];
+ Float_t c31 = fC[7];
+ Float_t c32 = fC[8];
+ Float_t c33 = fC[9];
+ Float_t c40 = fC[10];
+ Float_t c41 = fC[11];
+ Float_t c42 = fC[12];
+ Float_t c43 = fC[13];
+ Float_t c44 = fC[14];
+
+ //Float_t H0[5] = { 1,0, h2, 0, h4 };
+ //Float_t H1[5] = { 0, 1, 0, dS, 0 };
+ //Float_t H2[5] = { 0, 0, 1, 0, dx };
+ //Float_t H3[5] = { 0, 0, 0, 1, 0 };
+ //Float_t H4[5] = { 0, 0, 0, 0, 1 };
+
+ Float_t d[5] = { fP[0]-t0.fP[0], fP[1]-t0.fP[1], fP[2]-t0.fP[2],
+ fP[3]-t0.fP[3], fP[4]-t0.fP[4] };
+
+ t0.SetCosPhi( ex1 );
+ t0.SetX( t0.X() + dx );
+ t0.SetY( t0.Y() + dy );
+ t0.SetZ( t0.Z() + dz );
+ t0.SetSinPhi( ey1 );
+
+ fX = t0.X();
+ fP[0] = t0.fP[0] + d[0] + h2*d[2] + h4*d[4];
+ fP[1] = t0.fP[1] + d[1] + dS*d[3];
+ fP[2] = t0.fP[2] +d[2] + dx*d[4];
+ fP[3] = fP[3];
+ fP[4] = fP[4];
+
+ //CosPhi() = CAMath::Sqrt(1-fP[2]*fP[2]);
+
+ fC[0]=( c00 + h2*h2*c22 + h4*h4*c44
+ + 2*( h2*c20 + h4*c40 + h2*h4*c42 ) );
+
+ fC[1]= c10 + h2*c21 + h4*c41 + dS*(c30 + h2*c32 + h4*c43);
+ fC[2]= c11 + 2*dS*c31 + dS*dS*c33;
+
+ fC[3]= c20 + h2*c22 + h4*c42 + dx*( c40 + h2*c42 + h4*c44);
+ fC[4]= c21 + dS*c32 + dx*(c41 + dS*c43);
+ fC[5]= c22 +2*dx*c42 + dx2*c44;
+
+ fC[6]= c30 + h2*c32 + h4*c43;
+ fC[7]= c31 + dS*c33;
+ fC[8]= c32 + dx*c43;
+ fC[9]= c33;
+
+ fC[10]= c40 + h2*c42 + h4*c44;
+ fC[11]= c41 + dS*c43;
+ fC[12]= c42 + dx*c44;
+ fC[13]= c43;
+ fC[14]= c44;
+
+ Float_t dd = CAMath::Sqrt(dS*dS + dz*dz );
+
+ if (oldX > GetX() ) dd = -dd;
+ {
+ Float_t rho=0.9e-3;
+ Float_t radLen=28.94;
+ CorrectForMeanMaterial(dd*rho/radLen,dd*rho,par);
+ t0.CorrectForMeanMaterial(dd*rho/radLen,dd*rho,par);
+ }
+
+ return ret;
+}
+
+
GPUd() Float_t AliHLTTPCCATrackParam::ApproximateBetheBloch( Float_t beta2 )
{
//------------------------------------------------------------------
Float_t theta2 = par.fTheta2*CAMath::Abs(xOverX0);
fC22 += theta2*par.fK22*(1.- fP[2]*fP[2]);
fC33 += theta2*par.fK33;
- fC43 += theta2*par.fK43;
+ fC43 += theta2*par.fK43;
fC44 += theta2*par.fK44;
return 1;
-GPUd() Bool_t AliHLTTPCCATrackParam::Rotate( Float_t alpha )
+GPUd() Bool_t AliHLTTPCCATrackParam::Rotate( Float_t alpha, Float_t maxSinPhi )
{
//* Rotate the coordinate system in XY on the angle alpha
Float_t cosPhi = cP*cA + sP*sA;
Float_t sinPhi =-cP*sA + sP*cA;
- if( CAMath::Abs(sinPhi)>.99 || CAMath::Abs(cosPhi)<1.e-2 || CAMath::Abs(cP)<1.e-2 ) return 0;
+ if( CAMath::Abs(sinPhi)> maxSinPhi || CAMath::Abs(cosPhi)<1.e-2 || CAMath::Abs(cP)<1.e-2 ) return 0;
Float_t j0 = cP/cosPhi;
Float_t j2 = cosPhi/cP;
- X() = x*cA + y*sA;
- Y() = -x*sA + y*cA;
- CosPhi() = cosPhi;
- SinPhi() = sinPhi;
+ SetX( x*cA + y*sA );
+ SetY(-x*sA + y*cA );
+ SetCosPhi( cosPhi );
+ SetSinPhi( sinPhi );
//Float_t J[5][5] = { { j0, 0, 0, 0, 0 }, // Y
//cout<<" "<<fC[0]<<" "<<fC[1]<<" "<<fC[6]<<" "<<fC[10]<<" "<<fC[4]<<" "<<fC[5]<<" "<<fC[8]<<" "<<fC[12]<<endl;
fC[0]*= j0*j0;
fC[1]*= j0;
- //fC[3]*= j0;
+ fC[3]*= j0;
fC[6]*= j0;
fC[10]*= j0;
- //fC[3]*= j2;
+ fC[3]*= j2;
fC[4]*= j2;
fC[5]*= j2*j2;
fC[8]*= j2;
}
+GPUd() Bool_t AliHLTTPCCATrackParam::RotateNoCos( Float_t alpha, AliHLTTPCCATrackParam &t0, Float_t maxSinPhi )
+{
+ //* Rotate the coordinate system in XY on the angle alpha
+
+ Float_t cA = CAMath::Cos( alpha );
+ Float_t sA = CAMath::Sin( alpha );
+ Float_t x0 = t0.X(), y0= t0.Y(), sP= t0.SinPhi(), cP= t0.CosPhi();
+ Float_t cosPhi = cP*cA + sP*sA;
+ Float_t sinPhi =-cP*sA + sP*cA;
+
+ if( CAMath::Abs(sinPhi)> maxSinPhi || CAMath::Abs(cosPhi)<1.e-2 || CAMath::Abs(cP)<1.e-2 ) return 0;
+
+ Float_t j0 = cP/cosPhi;
+ Float_t j2 = cosPhi/cP;
+ Float_t d[2] = {Y() - y0, SinPhi() - sP};
+
+ t0.SetX( x0*cA + y0*sA );
+ t0.SetY(-x0*sA + y0*cA );
+ t0.SetCosPhi( cosPhi );
+ t0.SetSinPhi( sinPhi );
+
+ //Float_t J[5][5] = { { j0, 0, 0, 0, 0 }, // Y
+ // { 0, 1, 0, 0, 0 }, // Z
+ // { 0, 0, j2, 0, 0 }, // SinPhi
+ // { 0, 0, 0, 1, 0 }, // DzDs
+ // { 0, 0, 0, 0, 1 } }; // Kappa
+
+ SetX( t0.X() );
+ SetY( t0.Y() + j0*d[0] );
+ SetSinPhi( sinPhi + j2*d[1] );
+
+ fC[0]*= j0*j0;
+ fC[1]*= j0;
+ fC[3]*= j0;
+ fC[6]*= j0;
+ fC[10]*= j0;
+
+ fC[3]*= j2;
+ fC[4]*= j2;
+ fC[5]*= j2*j2;
+ fC[8]*= j2;
+ fC[12]*= j2;
+
+ return 1;
+}
+
+
GPUd() Bool_t AliHLTTPCCATrackParam::Filter2( Float_t y, Float_t z, Float_t err2Y, Float_t err2Z, Float_t maxSinPhi )
{
//* Add the y,z measurement with the Kalman filter
fC[13]-= k40*c30 + k41*c31 ;
fC[14]-= k40*c40 + k41*c41 ;
+ if( fCosPhi >=0 ){
+ fCosPhi = CAMath::Sqrt(1-SinPhi()*SinPhi());
+ }else{
+ fCosPhi = -CAMath::Sqrt(1-SinPhi()*SinPhi());
+ }
+ return 1;
+}
+
+GPUd() Bool_t AliHLTTPCCATrackParam::Filter2NoCos( Float_t y, Float_t z, Float_t err2Y, Float_t err2Z )
+{
+ //* Add the y,z measurement with the Kalman filter
+
+ Float_t
+ c00 = fC[ 0],
+ c10 = fC[ 1], c11 = fC[ 2],
+ c20 = fC[ 3], c21 = fC[ 4],
+ c30 = fC[ 6], c31 = fC[ 7],
+ c40 = fC[10], c41 = fC[11];
+
+ Float_t
+ z0 = y-fP[0],
+ z1 = z-fP[1];
+
+ Float_t v[3] = {err2Y, 0, err2Z};
+
+ Float_t mS[3] = { c00+v[0], c10+v[1], c11+v[2] };
+
+ Float_t mSi[3];
+ Float_t det = (mS[0]*mS[2] - mS[1]*mS[1]);
+
+ if( det < 1.e-8 ) return 0;
+ det = 1./det;
+ mSi[0] = mS[2]*det;
+ mSi[1] = -mS[1]*det;
+ mSi[2] = mS[0]*det;
+
+ // K = CHtS
+
+ Float_t k00, k01 , k10, k11, k20, k21, k30, k31, k40, k41;
+
+ k00 = c00*mSi[0] + c10*mSi[1]; k01 = c00*mSi[1] + c10*mSi[2];
+ k10 = c10*mSi[0] + c11*mSi[1]; k11 = c10*mSi[1] + c11*mSi[2];
+ k20 = c20*mSi[0] + c21*mSi[1]; k21 = c20*mSi[1] + c21*mSi[2];
+ k30 = c30*mSi[0] + c31*mSi[1]; k31 = c30*mSi[1] + c31*mSi[2] ;
+ k40 = c40*mSi[0] + c41*mSi[1]; k41 = c40*mSi[1] + c41*mSi[2] ;
+
+ Float_t sinPhi = fP[2] + k20*z0 + k21*z1 ;
+ //if( CAMath::Abs(sinPhi)>= maxSinPhi ) return 0;
+
+ fNDF += 2;
+ fChi2 += ( +(mSi[0]*z0 + mSi[1]*z1 )*z0
+ +(mSi[1]*z0 + mSi[2]*z1 )*z1 );
+
+ fP[ 0]+= k00*z0 + k01*z1 ;
+ fP[ 1]+= k10*z0 + k11*z1 ;
+ fP[ 2] = sinPhi;
+ fP[ 3]+= k30*z0 + k31*z1 ;
+ fP[ 4]+= k40*z0 + k41*z1 ;
+
+
+ fC[ 0]-= k00*c00 + k01*c10 ;
+
+ fC[ 1]-= k10*c00 + k11*c10 ;
+ fC[ 2]-= k10*c10 + k11*c11 ;
+
+ fC[ 3]-= k20*c00 + k21*c10 ;
+ fC[ 4]-= k20*c10 + k21*c11 ;
+ fC[ 5]-= k20*c20 + k21*c21 ;
+
+ fC[ 6]-= k30*c00 + k31*c10 ;
+ fC[ 7]-= k30*c10 + k31*c11 ;
+ fC[ 8]-= k30*c20 + k31*c21 ;
+ fC[ 9]-= k30*c30 + k31*c31 ;
+
+ fC[10]-= k40*c00 + k41*c10 ;
+ fC[11]-= k40*c10 + k41*c11 ;
+ fC[12]-= k40*c20 + k41*c21 ;
+ fC[13]-= k40*c30 + k41*c31 ;
+ fC[14]-= k40*c40 + k41*c41 ;
+ /*
if( CosPhi()>=0 ){
CosPhi() = CAMath::Sqrt(1-SinPhi()*SinPhi());
}else{
CosPhi() = -CAMath::Sqrt(1-SinPhi()*SinPhi());
- }
+ }
+ */
return 1;
}
+
GPUd() Bool_t AliHLTTPCCATrackParam::Filter2v1( Float_t y, Float_t z, Float_t err2Y, Float_t err2Z, Float_t maxSinPhi )
{
//* Add the y,z measurement with the Kalman filter
fC[13]-= k40*c30 + k41*c31 ;
fC[14]-= k40*c40 + k41*c41 ;
- if( CosPhi()>=0 ){
- CosPhi() = CAMath::Sqrt(1-sinPhi*sinPhi);
+ if( fCosPhi>=0 ){
+ fCosPhi = CAMath::Sqrt(1-sinPhi*sinPhi);
}else{
- CosPhi() = -CAMath::Sqrt(1-sinPhi*sinPhi);
+ fCosPhi = -CAMath::Sqrt(1-sinPhi*sinPhi);
}
return 1;
}
k31 = c31*mS2;
Float_t sinPhi = fP[2] + k20*z0 ;
- if( CAMath::Abs(sinPhi)>= maxSinPhi ) return 0;
+
+ if( CAMath::Abs(sinPhi)>= maxSinPhi ){
+ std::cout<<"Filter20: sinPhi ="<<fP[2]<<" -> "<<sinPhi<<std::endl;
+ std::cout<<"z0,z1="<<z0<<" "<<z1<<std::endl;
+ std::cout<<"c="<<fC[0]<<std::endl;
+ std::cout<<" "<<fC[1]<<" "<<fC[2]<<std::endl;
+ std::cout<<" "<<fC[3]<<" "<<fC[4]<<" "<<fC[5]<<std::endl;
+ }
+ if( CAMath::Abs(sinPhi)>= maxSinPhi ){
+ return 0;
+ }
Float_t cosPhi = CAMath::Sqrt(1-sinPhi*sinPhi);
fNDF += 2;
fChi2 += mS0*z0*z0 + mS2*z1*z1 ;
+GPUd() Bool_t AliHLTTPCCATrackParam::Filter200( Float_t y, Float_t z, Float_t err2Y, Float_t err2Z )
+{
+ //* Add the y,z measurement with the Kalman filter
+
+ Float_t
+ c00 = fC[ 0],
+ c11 = fC[ 2],
+ c20 = fC[ 3],
+ c31 = fC[ 7],
+ c40 = fC[10];
+
+ err2Y+=c00;
+ err2Z+=c11;
+
+ Float_t
+ z0 = y-fP[0],
+ z1 = z-fP[1];
+
+ if( err2Y < 1.e-8 || err2Z<1.e-8 ) return 0;
+
+ Float_t mS0 = 1./err2Y;
+ Float_t mS2 = 1./err2Z;
+
+ // K = CHtS
+
+ Float_t k00, k11, k20, k31, k40;
+
+ k00 = c00*mS0;
+ k20 = c20*mS0;
+ k40 = c40*mS0;
+
+ k11 = c11*mS2;
+ k31 = c31*mS2;
+
+ Float_t sinPhi = fP[2] + k20*z0 ;
+
+
+ //if( CAMath::Abs(sinPhi)>= maxSinPhi ){
+ //std::cout<<"Filter20: sinPhi ="<<fP[2]<<" -> "<<sinPhi<<std::endl;
+ //std::cout<<"z0,z1="<<z0<<" "<<z1<<std::endl;
+ //std::cout<<"c="<<fC[0]<<std::endl;
+ //std::cout<<" "<<fC[1]<<" "<<fC[2]<<std::endl;
+ //std::cout<<" "<<fC[3]<<" "<<fC[4]<<" "<<fC[5]<<std::endl;
+ //}
+ //if( CAMath::Abs(sinPhi)>= maxSinPhi ){
+ //return 0;
+ //}
+ //Float_t cosPhi = CAMath::Sqrt(1-sinPhi*sinPhi);
+ fNDF += 2;
+ fChi2 += mS0*z0*z0 + mS2*z1*z1 ;
+
+ fP[ 0]+= k00*z0 ;
+ fP[ 1]+= k11*z1 ;
+ fP[ 2] = sinPhi ;
+ fP[ 3]+= k31*z1 ;
+ fP[ 4]+= k40*z0 ;
+
+ fC[ 0]-= k00*c00 ;
+ fC[ 3]-= k20*c00 ;
+ fC[ 5]-= k20*c20 ;
+ fC[10]-= k40*c00 ;
+ fC[12]-= k40*c20 ;
+ fC[14]-= k40*c40 ;
+
+ fC[ 2]-= k11*c11 ;
+ fC[ 7]-= k31*c11 ;
+ fC[ 9]-= k31*c31 ;
+
+ //fCosPhi = ( fCosPhi >=0 ) ?cosPhi :-cosPhi;
+ return 1;
+}
+
+
GPUd() void AliHLTTPCCATrackParam::FilterY( Float_t y, Float_t erry )
{
//* Add the y measurement with the Kalman filter
fC[13]-= k4*c30;
fC[14]-= k4*c40;
- if( CosPhi()>=0 ){
- CosPhi() = CAMath::Sqrt(1-SinPhi()*SinPhi());
+ if( fCosPhi>=0 ){
+ fCosPhi = CAMath::Sqrt(1-SinPhi()*SinPhi());
}else{
- CosPhi() = -CAMath::Sqrt(1-SinPhi()*SinPhi());
+ fCosPhi = -CAMath::Sqrt(1-SinPhi()*SinPhi());
}
}
fC[13]-= k4*c31 ;
fC[14]-= k4*c41 ;
- if( CosPhi()>=0 ){
- CosPhi() = CAMath::Sqrt(1-SinPhi()*SinPhi());
+ if( fCosPhi>=0 ){
+ fCosPhi = CAMath::Sqrt(1-SinPhi()*SinPhi());
}else{
- CosPhi() = -CAMath::Sqrt(1-SinPhi()*SinPhi());
+ fCosPhi = -CAMath::Sqrt(1-SinPhi()*SinPhi());
}
}
//* print parameters
#if !defined(HLTCA_GPUCODE)
- std::cout<<"track: "<<GetX()<<" "<<GetY()<<" "<<GetZ()<<" "<<GetSinPhi()<<" "<<GetDzDs()<<" "<<GetKappa()<<std::endl;
+ std::cout<<"track: x="<<GetX()<<" c="<<GetCosPhi()<<", P= "<<GetY()<<" "<<GetZ()<<" "<<GetSinPhi()<<" "<<GetDzDs()<<" "<<GetKappa()<<std::endl;
std::cout<<"errs2: "<<GetErr2Y()<<" "<<GetErr2Z()<<" "<<GetErr2SinPhi()<<" "<<GetErr2DzDs()<<" "<<GetErr2Kappa()<<std::endl;
#endif
}
~AliHLTTPCCATrackParam(){}
#endif
- GPUd() Float_t &X() { return fX; }
- GPUd() Float_t &Y() { return fP[0]; }
- GPUd() Float_t &Z() { return fP[1]; }
- GPUd() Float_t &SinPhi(){ return fP[2]; }
- GPUd() Float_t &DzDs() { return fP[3]; }
- GPUd() Float_t &Kappa() { return fP[4]; }
- GPUd() Float_t &CosPhi(){ return fCosPhi; }
- GPUd() Float_t &Chi2() { return fChi2; }
- GPUd() Int_t &NDF() { return fNDF; }
-
- Float_t &Err2Y() { return fC[0]; }
- Float_t &Err2Z() { return fC[2]; }
- Float_t &Err2SinPhi() { return fC[5]; }
- Float_t &Err2DzDs() { return fC[9]; }
- Float_t &Err2Kappa() { return fC[14]; }
+ GPUd() Float_t X() const { return fX; }
+ GPUd() Float_t Y() const { return fP[0]; }
+ GPUd() Float_t Z() const { return fP[1]; }
+ GPUd() Float_t SinPhi()const { return fP[2]; }
+ GPUd() Float_t DzDs() const { return fP[3]; }
+ GPUd() Float_t Kappa() const { return fP[4]; }
+ GPUd() Float_t CosPhi()const { return fCosPhi; }
+ GPUd() Float_t Chi2() const { return fChi2; }
+ GPUd() Int_t NDF() const { return fNDF; }
+
+ Float_t Err2Y() const { return fC[0]; }
+ Float_t Err2Z() const { return fC[2]; }
+ Float_t Err2SinPhi() const { return fC[5]; }
+ Float_t Err2DzDs() const { return fC[9]; }
+ Float_t Err2Kappa() const { return fC[14]; }
GPUd() Float_t GetX() const { return fX; }
GPUd() Float_t GetY() const { return fP[0]; }
GPUd() Float_t GetErr2DzDs() const { return fC[9]; }
GPUd() Float_t GetErr2Kappa() const { return fC[14]; }
- GPUhd() Float_t *Par(){ return fP; }
- GPUhd() Float_t *Cov(){ return fC; }
+ GPUhd() const Float_t *Par() const { return fP; }
+ GPUhd() const Float_t *Cov() const { return fC; }
const Float_t *GetPar() const { return fP; }
const Float_t *GetCov() const { return fC; }
+ GPUhd() void SetPar( Int_t i, Float_t v ){ fP[i] = v; }
+ GPUhd() void SetCov( Int_t i, Float_t v ){ fC[i] = v; }
+
+ GPUd() void SetX( Float_t v ) { fX = v; }
+ GPUd() void SetY( Float_t v ) { fP[0] = v; }
+ GPUd() void SetZ( Float_t v ) { fP[1] = v; }
+ GPUd() void SetSinPhi( Float_t v ){ fP[2] = v; }
+ GPUd() void SetDzDs( Float_t v ) { fP[3] = v; }
+ GPUd() void SetKappa( Float_t v ) { fP[4] = v; }
+ GPUd() void SetCosPhi( Float_t v ){ fCosPhi = v; }
+ GPUd() void SetChi2( Float_t v ) { fChi2 = v; }
+ GPUd() void SetNDF( Int_t v ) { fNDF = v; }
+
+
+ GPUd() Float_t GetDist2( const AliHLTTPCCATrackParam &t ) const;
+ GPUd() Float_t GetDistXZ2( const AliHLTTPCCATrackParam &t ) const;
+
GPUd() void ConstructXY3( const Float_t x[3], const Float_t y[3], const Float_t sigmaY2[3], Float_t CosPhi0 );
GPUd() void ConstructXYZ3( const Float_t p0[5], const Float_t p1[5], const Float_t p2[5],
Float_t &px, Float_t &py, Float_t &pz ) const;
GPUd() Int_t TransportToX( Float_t X, Float_t maxSinPhi );
+ GPUd() Int_t TransportToX( Float_t X, AliHLTTPCCATrackParam &t0, Float_t maxSinPhi );
+
GPUd() Bool_t TransportToXWithMaterial( Float_t X, AliHLTTPCCATrackFitParam &par );
+ GPUd() Bool_t TransportToXWithMaterial( Float_t X, AliHLTTPCCATrackParam &t0, AliHLTTPCCATrackFitParam &par );
GPUd() Bool_t TransportToXWithMaterial( Float_t X, Float_t Bz );
- GPUd() Bool_t Rotate( Float_t alpha );
+ GPUd() Bool_t Rotate( Float_t alpha, Float_t maxSinPhi=.99 );
+ GPUd() Bool_t RotateNoCos( Float_t alpha, AliHLTTPCCATrackParam &t0, Float_t maxSinPhi=.99 );
GPUd() Bool_t Filter2( Float_t y, Float_t z, Float_t err2Y, Float_t err2Z, Float_t maxSinPhi=.99 );
+ GPUd() Bool_t Filter2NoCos( Float_t y, Float_t z, Float_t err2Y, Float_t err2Z );
- GPUd() Int_t TransportToX0( Float_t X, Float_t /*maxSinPhi*/ );
+ GPUd() Int_t TransportToX0( Float_t X, Float_t sinPhi, Float_t cosPhi );
+ GPUd() Int_t TransportToX0( Float_t X, Float_t maxSinPhi );
GPUd() Bool_t Filter20( Float_t y, Float_t z, Float_t err2Y, Float_t err2Z, Float_t maxSinPhi=.99 );
+ GPUd() Bool_t Filter200( Float_t y, Float_t z, Float_t err2Y, Float_t err2Z );
GPUd() Bool_t Filter2v1( Float_t y, Float_t z, Float_t err2Y, Float_t err2Z, Float_t maxSinPhi=.99 );
GPUd() void FilterY( Float_t y, Float_t erry );
fNOutTracks(0),
fOutTracks(0),
fNOutTrackHits(0),
- fOutTrackHits(0)
+ fOutTrackHits(0),
+ fTmpHitInputIDs(0)
{
// constructor
}
fNOutTracks(0),
fOutTracks(0),
fNOutTrackHits(0),
- fOutTrackHits(0)
+ fOutTrackHits(0),
+ fTmpHitInputIDs(0)
{
// dummy
}
{
// destructor
if( fCommonMemory ) delete[] fCommonMemory;
+ if( fTmpHitInputIDs ) delete[] fTmpHitInputIDs;
}
#endif
fParam = param;
fParam.Update();
for( Int_t irow=0; irow<fParam.NRows(); irow++ ){
- fRows[irow].X() = fParam.RowX(irow);
- fRows[irow].MaxY() = CAMath::Tan( fParam.DAlpha()/2.)*fRows[irow].X();
+ fRows[irow].SetX( fParam.RowX(irow) );
+ fRows[irow].SetMaxY( CAMath::Tan( fParam.DAlpha()/2.)*fRows[irow].X() );
}
StartEvent();
}
*fNTrackHits = 0;
*fNOutTracks = 0;
*fNOutTrackHits = 0;
+ if( fTmpHitInputIDs ) delete[] fTmpHitInputIDs;
+ fTmpHitInputIDs = 0;
}
GPUhd() void AliHLTTPCCATracker::SetPointers()
hitsYZ[iHit*2 ] = Y[iHit];
hitsYZ[iHit*2+1] = Z[iHit];
}
+
+ //SG cell finder - test code
+
+ if( fTmpHitInputIDs ) delete[] fTmpHitInputIDs;
+ fTmpHitInputIDs = new Int_t [NHits];
+ const Float_t areaY = .5;
+ const Float_t areaZ = 1.;
+ Int_t newRowNHitsTotal = 0;
+ Bool_t *usedHits = new Bool_t [NHits];
+ for( Int_t iHit=0; iHit<NHits; iHit++ ) usedHits[iHit] = 0;
+ for( Int_t iRow=0; iRow<fParam.NRows(); iRow++ ){
+ rowHeaders[iRow*2 ] = newRowNHitsTotal; // new first hit
+ rowHeaders[iRow*2+1] = 0; // new N hits
+ Int_t newRowNHits = 0;
+ Int_t oldRowFirstHit = RowFirstHit[iRow];
+ Int_t oldRowLastHit = oldRowFirstHit + RowNHits[iRow];
+ for( Int_t iHit=oldRowFirstHit; iHit<oldRowLastHit; iHit++ ){
+ if( usedHits[iHit] ) continue;
+ Float_t y0 = Y[iHit];
+ Float_t z0 = Z[iHit];
+ Float_t cy = y0;
+ Float_t cz = z0;
+ Int_t nclu = 1;
+ usedHits[iHit]=1;
+ if(0) for( Int_t jHit=iHit+1; jHit<oldRowLastHit; jHit++ ){//SG!!!
+ //if( usedHits[jHit] ) continue;
+ Float_t dy = Y[jHit] - y0;
+ Float_t dz = Z[jHit] - z0;
+ if( CAMath::Abs(dy)<areaY && CAMath::Abs(dz)<areaZ ){
+ cy+=Y[jHit];
+ cz+=Z[jHit];
+ nclu++;
+ usedHits[jHit]=1;
+ }
+ }
+ Int_t id = newRowNHitsTotal+newRowNHits;
+ hitsYZ[id*2 ] = cy/nclu;
+ hitsYZ[id*2+1] = cz/nclu;
+ fTmpHitInputIDs[id] = iHit;
+ newRowNHits++;
+ }
+ rowHeaders[iRow*2+1] = newRowNHits;
+ newRowNHitsTotal+=newRowNHits;
+ }
+ fNHitsTotal = newRowNHitsTotal;
+ reinterpret_cast<Int_t*>( fInputEvent )[1+fParam.NRows()*2] = newRowNHitsTotal;
+
+ delete[] usedHits;
SetupRowData();
}
fNHitsTotal = reinterpret_cast<Int_t*>( fInputEvent )[1+fParam.NRows()*2];
Int_t *rowHeaders = reinterpret_cast<Int_t*>( fInputEvent ) +1;
Float_t *hitsYZ = reinterpret_cast<Float_t*>( fInputEvent ) + 1+fParam.NRows()*2+1;
+
for( Int_t iRow=0; iRow<fParam.NRows(); iRow++ ){
+
AliHLTTPCCARow &row = fRows[iRow];
- row.FirstHit() = rowHeaders[iRow*2];
- row.NHits() = rowHeaders[iRow*2+1];
+ row.SetFirstHit( rowHeaders[iRow*2] );
+ row.SetNHits( rowHeaders[iRow*2+1] );
Float_t yMin=1.e3, yMax=-1.e3, zMin=1.e3, zMax=-1.e3;
Int_t nGrid = row.NHits();
for( Int_t i=0; i<row.NHits(); i++ ){
nGrid = 1;
}
- row.Grid().Create( yMin, yMax, zMin, zMax, nGrid );
+ AliHLTTPCCAGrid grid;
+ grid.Create( yMin, yMax, zMin, zMax, nGrid );
- Float_t sy = ( CAMath::Abs( row.Grid().StepYInv() ) >1.e-4 ) ?1./row.Grid().StepYInv() :1;
- Float_t sz = ( CAMath::Abs( row.Grid().StepZInv() ) >1.e-4 ) ?1./row.Grid().StepZInv() :1;
+ Float_t sy = ( CAMath::Abs( grid.StepYInv() ) >1.e-4 ) ?1./grid.StepYInv() :1;
+ Float_t sz = ( CAMath::Abs( grid.StepZInv() ) >1.e-4 ) ?1./grid.StepZInv() :1;
//cout<<"grid n = "<<row.Grid().N()<<" "<<sy<<" "<<sz<<" "<<yMin<<" "<<yMax<<" "<<zMin<<" "<<zMax<<endl;
Bool_t recreate=0;
if( sy < 2. ) { recreate = 1; sy = 2; }
if( sz < 2. ) { recreate = 1; sz = 2; }
- if( recreate ) row.Grid().Create( yMin, yMax, zMin, zMax, sy, sz );
-
- //cout<<"grid row "<<iRow<<", n = "<<row.Grid().N()<<endl;
+ if( recreate ) grid.Create( yMin, yMax, zMin, zMax, sy, sz );
+ row.SetGrid( grid );
}
AliHLTTPCCAHit ffHits[fNHitsTotal];
Int_t rowDataOffset = 0;
for( Int_t iRow=0; iRow<fParam.NRows(); iRow++ ){
+
AliHLTTPCCARow &row = fRows[iRow];
- AliHLTTPCCAGrid &grid = row.Grid();
+ const AliHLTTPCCAGrid &grid = row.Grid();
Int_t c[grid.N()+3+10];
Int_t bins[row.NHits()];
n+=filled[bin];
}
}
+
for( Int_t i=0; i<row.NHits(); i++ ){
Int_t bin = bins[i];
Int_t ind = c[bin] + filled[bin]-1;
AliHLTTPCCAHit &h = ffHits[row.FirstHit()+ind];
- fHitInputIDs[row.FirstHit()+ind] = row.FirstHit()+i;
- h.Y() = hitsYZ[2*(row.FirstHit()+i)];
- h.Z() = hitsYZ[2*(row.FirstHit()+i)+1];
+ fHitInputIDs[row.FirstHit()+ind] = fTmpHitInputIDs[row.FirstHit()+i];
+ h.SetY( hitsYZ[2*(row.FirstHit()+i)] );
+ h.SetZ( hitsYZ[2*(row.FirstHit()+i)+1] );
filled[bin]--;
}
Float_t stepY = (row.Grid().YMax() - y0)*(1./65535.);
Float_t z0 = row.Grid().ZMin();
Float_t stepZ = (row.Grid().ZMax() - z0)*(1./65535.);
+ if( stepY<1.e-4 ) stepY = 1.e-4;
+ if( stepZ<1.e-4 ) stepZ = 1.e-4;
Float_t stepYi = 1./stepY;
Float_t stepZi = 1./stepZ;
- row.Hy0() = y0;
- row.Hz0() = z0;
- row.HstepY() = stepY;
- row.HstepZ() = stepZ;
- row.HstepYi() = stepYi;
- row.HstepZi() = stepZi;
-
- row.FullOffset() = rowDataOffset;
+ row.SetHy0( y0 );
+ row.SetHz0( z0 );
+ row.SetHstepY( stepY );
+ row.SetHstepZ( stepZ );
+ row.SetHstepYi( stepYi );
+ row.SetHstepZi( stepZi );
+
+ row.SetFullOffset( rowDataOffset );
ushort2 *p= (ushort2*)( fRowData + row.FullOffset() );
for( Int_t ih=0; ih<row.NHits(); ih++ ){
Int_t ihTot = row.FirstHit()+ih;
}
Int_t size = row.NHits()*sizeof(ushort2);
- row.FullGridOffset() = row.NHits()*2;
+ row.SetFullGridOffset( row.NHits()*2 );
UShort_t *p1 = ((UShort_t *)p) + row.FullGridOffset();
Int_t n = grid.N();
for( Int_t i=n; i<nn; i++ ) p1[i] = a;
size+= (nn)*sizeof(UShort_t);
- row.FullLinkOffset() = row.NHits()*2 + nn;
+ row.SetFullLinkOffset( row.NHits()*2 + nn );
size+= row.NHits()*2*sizeof(Short_t);
if( size%16 ) size = size/sizeof(uint4)+1;
else size = size/sizeof(uint4);
- row.FullSize()=size;
+ row.SetFullSize( size );
//cout<<iRow<<", "<<row.fNHits<<"= "<<size*16<<"b: "<<row.fFullOffset<<" "<<row.fFullSize<<" "<<row.fFullGridOffset<<" "<<row.fFullLinkOffset<<std::endl;
rowDataOffset+=size;
- }
+ }
}
}
GPUh() void AliHLTTPCCATracker::Reconstruct()
{
//* reconstruction of event
-
-#ifdef DRAW
- if( !gApplication ){
- TApplication *myapp = new TApplication("myapp",0,0);
- }
- //AliHLTTPCCADisplay::Instance().Init();
-
- AliHLTTPCCADisplay::Instance().SetCurrentSlice( this );
- AliHLTTPCCADisplay::Instance().SetSliceView();
- AliHLTTPCCADisplay::Instance().DrawSlice( this );
- //for( Int_t iRow=0; iRow<fParam.NRows(); iRow++ )
- //for (Int_t i = 0; i<fRows[iRow].NHits(); i++)
- //AliHLTTPCCADisplay::Instance().DrawHit( iRow, i );
- //AliHLTTPCCADisplay::Instance().Ask();
-#endif
+ //std::cout<<"Reconstruct slice "<<fParam.ISlice()<<", nHits="<<fNHitsTotal<<std::endl;
fTimers[0] = 0; // find neighbours
fTimers[1] = 0; // construct tracklets
fTimers[5] = 0; // write output
fTimers[6] = 0;
fTimers[7] = 0;
+
+ //if( fParam.ISlice()<1 ) return; //SG!!!
- if( fNHitsTotal < 1 ) return;
TStopwatch timer0;
+ //SetupRowData();
+ if( fNHitsTotal < 1 ) return;
+
+#ifdef DRAW
+ if( !gApplication ){
+ TApplication *myapp = new TApplication("myapp",0,0);
+ }
+ //AliHLTTPCCADisplay::Instance().Init();
+
+ AliHLTTPCCADisplay::Instance().ClearView();
+ AliHLTTPCCADisplay::Instance().SetSliceView();
+ AliHLTTPCCADisplay::Instance().SetCurrentSlice( this );
+ AliHLTTPCCADisplay::Instance().DrawSlice( this, 1 );
+ if( fNHitsTotal>0 ){
+ AliHLTTPCCADisplay::Instance().DrawSliceHits( -1, .5);
+ AliHLTTPCCADisplay::Instance().Ask();
+ }
+#endif
+
*fNTracks = 0;
*fNTracklets = 0;
#if !defined(HLTCA_GPUCODE)
AliHLTTPCCAProcess<AliHLTTPCCANeighboursFinder>( Param().NRows(), 1, *this );
+
AliHLTTPCCAProcess<AliHLTTPCCANeighboursCleaner>( Param().NRows()-2, 1, *this );
AliHLTTPCCAProcess<AliHLTTPCCAStartHitsFinder>( Param().NRows()-4, 1, *this );
nThreads = nStartHits/12+1;
nThreads = (nThreads/32+1)*32;
}
-
+
*fNTrackHits = 0;
nThreads = nStartHits;
AliHLTTPCCAProcess<AliHLTTPCCATrackletSelector>(nBlocks, nThreads,*this);
- //cout<<"Slice "<<Param().ISlice()<<": N start hits/tracklets/tracks = "<<nStartHits<<" "<<nStartHits<<" "<<*fNTracks<<std::endl;
- WriteOutput();
- }
+ //std::cout<<"Slice "<<Param().ISlice()<<": N start hits/tracklets/tracks = "<<nStartHits<<" "<<nStartHits<<" "<<*fNTracks<<std::endl;
+ }
+
+ WriteOutput();
+
+#endif
+
+#ifdef DRAW
+ {
+ AliHLTTPCCADisplay &disp = AliHLTTPCCADisplay::Instance();
+ AliHLTTPCCATracker &slice = *this;
+ std::cout<<"N out tracks = "<<*slice.NOutTracks()<<std::endl;
+ //disp.Ask();
+ AliHLTTPCCADisplay::Instance().SetCurrentSlice( this );
+ AliHLTTPCCADisplay::Instance().DrawSlice( this, 1 );
+ disp.DrawSliceHits(-1,.5);
+ for( Int_t itr=0; itr<*slice.NOutTracks(); itr++ ){
+ std::cout<<"track N "<<itr<<", nhits="<<slice.OutTracks()[itr].NHits()<<std::endl;
+ disp.DrawSliceOutTrack( itr, kBlue );
+ //disp.Ask();
+ //int id = slice.OutTracks()[itr].OrigTrackID();
+ //AliHLTTPCCATrack &tr = Tracks()[id];
+ //for( Int_t ih=0; ih<tr.NHits(); ih++ ){
+ //Int_t ic = (fTrackHits[tr.FirstHitID()+ih]);
+ //std::cout<<ih<<" "<<ID2IRow(ic)<<" "<<ID2IHit(ic)<<std::endl;
+ //}
+ //disp.DrawSliceTrack( id, kBlue );
+ //disp.Ask();
+ }
+ disp.Ask();
+ }
#endif
timer0.Stop();
AliHLTTPCCATrack &iTrack = fTracks[iTr];
//cout<<"iTr = "<<iTr<<", nHits="<<iTrack.NHits()<<std::endl;
-
- if( !iTrack.Alive() ) continue;
+
+ //if( !iTrack.Alive() ) continue;
if( iTrack.NHits()<3 ) continue;
AliHLTTPCCAOutTrack &out = fOutTracks[*fNOutTracks];
- out.FirstHitRef() = *fNOutTrackHits;
- out.NHits() = 0;
- out.OrigTrackID() = iTr;
- {
- out.StartPoint() = iTrack.Param();
- out.EndPoint() = iTrack.Param();
- }
+ out.SetFirstHitRef( *fNOutTrackHits );
+ out.SetNHits( 0 );
+ out.SetOrigTrackID( iTr );
+ out.SetStartPoint( iTrack.Param() );
+ out.SetEndPoint( iTrack.Param() );
Int_t iID = iTrack.FirstHitID();
Int_t nOutTrackHitsOld = *fNOutTrackHits;
for( Int_t ith=0; ith<iTrack.NHits(); ith++ ){
Int_t ic = (fTrackHits[iID+ith]);
- AliHLTTPCCARow &row = ID2Row(ic);
+ const AliHLTTPCCARow &row = ID2Row(ic);
Int_t ih = ID2IHit(ic);
fOutTrackHits[*fNOutTrackHits] = fHitInputIDs[row.FirstHit()+ih];
(*fNOutTrackHits)++;
//exit(0);
return;
}
- out.NHits()++;
+ out.SetNHits( out.NHits() + 1 );
}
if( out.NHits() >= 2 ){
(*fNOutTracks)++;
+GPUd() void AliHLTTPCCATracker::GetErrors2( Int_t iRow, Float_t z, Float_t sinPhi, Float_t cosPhi, Float_t DzDs, Float_t &Err2Y, Float_t &Err2Z ) const
+{
+ //
+ // Use calibrated cluster error from OCDB
+ //
+
+ z = CAMath::Abs((250.-0.275)-CAMath::Abs(z));
+ Int_t type = (iRow<63) ? 0: ( (iRow>126) ? 1:2 );
+ Float_t cosPhiInv = CAMath::Abs(cosPhi)>1.e-2 ?1./cosPhi :0;
+ Float_t angleY = sinPhi*cosPhiInv ;
+ Float_t angleZ = DzDs*cosPhiInv ; // SG was bug???
+
+ Err2Y = fParam.GetClusterError2(0,type, z,angleY);
+ Err2Z = fParam.GetClusterError2(1,type, z,angleZ);
+}
+
GPUd() void AliHLTTPCCATracker::GetErrors2( Int_t iRow, const AliHLTTPCCATrackParam &t, Float_t &Err2Y, Float_t &Err2Z ) const
{
//
//
Float_t z = CAMath::Abs((250.-0.275)-CAMath::Abs(t.GetZ()));
- Int_t type = (iRow<63) ? 0: (iRow>126) ? 1:2;
+ Int_t type = (iRow<63) ? 0: ( (iRow>126) ? 1:2 );
Float_t cosPhiInv = CAMath::Abs(t.GetCosPhi())>1.e-2 ?1./t.GetCosPhi() :0;
Float_t angleY = t.GetSinPhi()*cosPhiInv ;
- Float_t angleZ = t.GetDzDs()*cosPhiInv ;
+ Float_t angleZ = t.GetDzDs()*cosPhiInv ; // SG was bug???
Err2Y = fParam.GetClusterError2(0,type, z,angleY);
Err2Z = fParam.GetClusterError2(1,type, z,angleZ);
Float_t y[fNHitsTotal], z[fNHitsTotal];
for( Int_t iRow=0; iRow<fParam.NRows(); iRow++){
- AliHLTTPCCARow &row = Rows()[iRow];
+ AliHLTTPCCARow &row = fRows[iRow];
Float_t y0 = row.Grid().YMin();
Float_t z0 = row.Grid().ZMin();
Float_t stepY = row.HstepY();
Float_t stepZ = row.HstepZ();
- uint4* tmpint4 = RowData() + row.FullOffset();
- ushort2 *hits = reinterpret_cast<ushort2*>(tmpint4);
+ const uint4* tmpint4 = RowData() + row.FullOffset();
+ const ushort2 *hits = reinterpret_cast<const ushort2*>(tmpint4);
for( Int_t ih=0; ih<fRows[iRow].NHits(); ih++ ){
Int_t ihTot = row.FirstHit() + ih;
Int_t id = fHitInputIDs[ihTot];
for( Int_t itr=0; itr<*fNOutTracks; itr++ ){
AliHLTTPCCAOutTrack &t = fOutTracks[itr];
- AliHLTTPCCATrackParam &p1 = t.StartPoint();
- AliHLTTPCCATrackParam &p2 = t.EndPoint();
+ AliHLTTPCCATrackParam p1 = t.StartPoint();
+ AliHLTTPCCATrackParam p2 = t.EndPoint();
out<< t.NHits()<<" ";
out<< t.FirstHitRef()<<" ";
out<< t.OrigTrackID()<<" ";
for( Int_t itr=0; itr<*fNOutTracks; itr++ ){
AliHLTTPCCAOutTrack &t = fOutTracks[itr];
- AliHLTTPCCATrackParam &p1 = t.StartPoint();
- AliHLTTPCCATrackParam &p2 = t.EndPoint();
- in>> t.NHits();
- in>> t.FirstHitRef();
- in>> t.OrigTrackID();
- in>> p1.X();
- in>> p1.CosPhi();
- in>> p1.Chi2();
- in>> p1.NDF();
- for( Int_t i=0; i<5; i++ ) in>>p1.Par()[i];
- for( Int_t i=0; i<15; i++ ) in>>p1.Cov()[i];
- in>> p2.X();
- in>> p2.CosPhi();
- in>> p2.Chi2();
- in>> p2.NDF();
- for( Int_t i=0; i<5; i++ ) in>>p2.Par()[i];
- for( Int_t i=0; i<15; i++ ) in>>p2.Cov()[i];
+ AliHLTTPCCATrackParam p1, p2;
+ Int_t i;
+ Float_t f;
+ in>> i; t.SetNHits( i );
+ in>> i; t.SetFirstHitRef( i );
+ in>> i; t.SetOrigTrackID( i );
+ in>> f; p1.SetX( f );
+ in>> f; p1.SetCosPhi( f );
+ in>> f; p1.SetChi2( f );
+ in>> i; p1.SetNDF( i );
+ for( Int_t j=0; j<5; j++ ){ in>>f; p1.SetPar(j,f); }
+ for( Int_t j=0; j<15; j++ ){ in>>f; p1.SetCov(j,f); }
+ in>> f; p2.SetX( f );
+ in>> f; p2.SetCosPhi( f );
+ in>> f; p2.SetChi2( f );
+ in>> i; p2.SetNDF( i );
+ for( Int_t j=0; j<5; j++ ){ in>>f; p2.SetPar(j,f); }
+ for( Int_t j=0; j<15; j++ ){ in>>f; p2.SetCov(j,f); }
+ t.SetStartPoint( p1 );
+ t.SetEndPoint( p2 );
}
}
#endif
void WriteOutput();
GPUd() void GetErrors2( Int_t iRow, const AliHLTTPCCATrackParam &t, Float_t &Err2Y, Float_t &Err2Z ) const;
+ GPUd() void GetErrors2( Int_t iRow, Float_t z, Float_t sinPhi, Float_t cosPhi, Float_t DzDs, Float_t &Err2Y, Float_t &Err2Z ) const;
GPUhd() static Int_t IRowIHit2ID( Int_t iRow, Int_t iHit ){
return (iHit<<8)+iRow;
//GPUhd() AliHLTTPCCAHit &ID2Hit( Int_t HitID ) {
//return fHits[fRows[HitID%256].FirstHit() + (HitID>>8)];
//}
- GPUhd() AliHLTTPCCARow &ID2Row( Int_t HitID ) {
+ GPUhd() const AliHLTTPCCARow &ID2Row( Int_t HitID ) const {
return fRows[HitID%256];
}
GPUh() void ReadTracks( std::istream &in );
#endif
- GPUhd() AliHLTTPCCAParam &Param(){ return fParam; }
- GPUhd() AliHLTTPCCARow *Rows(){ return fRows; }
- GPUhd() Double_t *Timers(){ return fTimers; }
- GPUhd() Int_t &NHitsTotal(){ return fNHitsTotal;}
+ GPUhd() const AliHLTTPCCAParam &Param() const { return fParam; }
+ GPUhd() void SetParam( const AliHLTTPCCAParam &v ){ fParam = v; }
- GPUhd() Char_t *InputEvent() { return fInputEvent; }
- GPUhd() Int_t &InputEventSize(){ return fInputEventSize; }
+ GPUhd() const AliHLTTPCCARow &Row(Int_t i){ return fRows[i]; }
+ GPUhd() Double_t Timer(Int_t i) const { return fTimers[i]; }
+ GPUhd() void SetTimer(Int_t i, Double_t v ){ fTimers[i] = v; }
- GPUhd() uint4 *RowData() { return fRowData; }
- GPUhd() Int_t &RowDataSize() { return fRowDataSize; }
+ GPUhd() Int_t NHitsTotal() const { return fNHitsTotal;}
+
+ GPUhd() const Char_t *InputEvent() const { return fInputEvent; }
+ GPUhd() Int_t InputEventSize() const { return fInputEventSize; }
+
+ GPUhd() const uint4 *RowData() const { return fRowData; }
+ GPUhd() Int_t RowDataSize() const { return fRowDataSize; }
- GPUhd() Int_t * HitInputIDs(){ return fHitInputIDs; }
- GPUhd() Int_t *HitWeights(){ return fHitWeights; }
+ GPUhd() Int_t *HitInputIDs() const { return fHitInputIDs; }
+ GPUhd() Int_t *HitWeights() const { return fHitWeights; }
- GPUhd() Int_t *NTracklets(){ return fNTracklets; }
- GPUhd() Int_t *TrackletStartHits(){ return fTrackletStartHits; }
- GPUhd() AliHLTTPCCATracklet *Tracklets(){ return fTracklets;}
+ GPUhd() Int_t *NTracklets() const { return fNTracklets; }
+ GPUhd() Int_t *TrackletStartHits() const { return fTrackletStartHits; }
+ GPUhd() AliHLTTPCCATracklet *Tracklets() const { return fTracklets;}
- GPUhd() Int_t *NTracks() { return fNTracks; }
- GPUhd() AliHLTTPCCATrack *Tracks(){ return fTracks; }
- GPUhd() Int_t *NTrackHits() { return fNTrackHits; }
- GPUhd() Int_t *TrackHits(){ return fTrackHits; }
+ GPUhd() Int_t *NTracks() const { return fNTracks; }
+ GPUhd() AliHLTTPCCATrack *Tracks() const { return fTracks; }
+ GPUhd() Int_t *NTrackHits() const { return fNTrackHits; }
+ GPUhd() Int_t *TrackHits() const { return fTrackHits; }
GPUhd() Int_t *NOutTracks() const { return fNOutTracks; }
- GPUhd() AliHLTTPCCAOutTrack *OutTracks(){ return fOutTracks; }
+ GPUhd() AliHLTTPCCAOutTrack *OutTracks() const { return fOutTracks; }
GPUhd() Int_t *NOutTrackHits() const { return fNOutTrackHits; }
- GPUhd() Int_t *OutTrackHits(){ return fOutTrackHits; }
+ GPUhd() Int_t *OutTrackHits() const { return fOutTrackHits; }
GPUh() void SetCommonMemory( Char_t *mem ){ fCommonMemory = mem; }
AliHLTTPCCAOutTrack *fOutTracks; // output array of the reconstructed tracks
Int_t *fNOutTrackHits; // number of hits in fOutTrackHits array
Int_t *fOutTrackHits; // output array of ID's of the reconstructed hits
+
+ //temporary
+
+ Int_t *fTmpHitInputIDs; // temporary step
};
AliHLTTPCCAParam param;
param.Initialize( iSec, nRows, rowX, alpha, dalpha,
inRmin, outRmax, zMin, zMax, padPitch, sigmaZ, fSolenoidBz );
- param.YErrorCorrection() = 1;
- param.ZErrorCorrection() = 2;
+ param.SetHitPickUpFactor( 2 );
param.Update();
fTracker->Initialize( param );
delete[] rowX;
~AliHLTTPCCATracklet(){}
#endif
- GPUhd() Int_t &StartHitID() { return fStartHitID; }
- GPUhd() Int_t &NHits() { return fNHits; }
- GPUhd() Int_t &FirstRow() { return fFirstRow; }
- GPUhd() Int_t &LastRow() { return fLastRow; }
- GPUhd() AliHLTTPCCATrackParam &Param(){ return fParam; }
- GPUhd() Int_t *RowHits() { return fRowHits; }
+ GPUhd() Int_t StartHitID() const { return fStartHitID; }
+ GPUhd() Int_t NHits() const { return fNHits; }
+ GPUhd() Int_t FirstRow() const { return fFirstRow; }
+ GPUhd() Int_t LastRow() const { return fLastRow; }
+ GPUhd() const AliHLTTPCCATrackParam &Param() const { return fParam; }
+ GPUhd() Int_t RowHits(Int_t i) const { return fRowHits[i]; }
+
+ GPUhd() void SetStartHitID( Int_t v ) { fStartHitID = v; }
+ GPUhd() void SetNHits( Int_t v ) { fNHits = v; }
+ GPUhd() void SetFirstRow( Int_t v ) { fFirstRow = v; }
+ GPUhd() void SetLastRow( Int_t v ) { fLastRow = v; }
+ GPUhd() void SetParam( const AliHLTTPCCATrackParam &v ){ fParam = v; }
+ GPUhd() void SetRowHit( Int_t irow, Int_t ih) { fRowHits[irow] = ih; }
+
private:
#include "AliHLTTPCCAMath.h"
#include "AliHLTTPCCADef.h"
#include "AliHLTTPCCATrackletConstructor.h"
+//#include "AliHLTTPCCAPerformance.h"
+//#include "TH1D.h"
+
+//#define DRAW
+
+#ifdef DRAW
+#include "AliHLTTPCCADisplay.h"
+#endif
GPUd() void AliHLTTPCCATrackletConstructor::Step0
CAMath::atomicMin( &s.fMinStartRow32[kThread], r.fFirstRow);
CAMath::atomicMax( &s.fMaxStartRow32[kThread], r.fFirstRow);
- tParam.SinPhi() = 0;
- tParam.DzDs() = 0;
- tParam.Kappa() = 0;
- tParam.CosPhi() = 1;
- tParam.Chi2() = 0;
- tParam.NDF() = -3;
-
- tParam.Cov()[0] = 1;
-
- tParam.Cov()[1] = 0;
- tParam.Cov()[2] = 1;
-
- tParam.Cov()[3] = 0;
- tParam.Cov()[4] = 0;
- tParam.Cov()[5] = 1.;
-
- tParam.Cov()[6] = 0;
- tParam.Cov()[7] = 0;
- tParam.Cov()[8] = 0;
- tParam.Cov()[9] = 1;
-
- tParam.Cov()[10] = 0;
- tParam.Cov()[11] = 0;
- tParam.Cov()[12] = 0;
- tParam.Cov()[13] = 0;
- tParam.Cov()[14] = 1.;
+ tParam.SetSinPhi(0);
+ tParam.SetDzDs(0);
+ tParam.SetKappa(0);
+ tParam.SetCosPhi(1);
+ tParam.SetChi2(0);
+ tParam.SetNDF(-3);
+ tParam.SetCov( 0,1);
+ tParam.SetCov( 1,0);
+ tParam.SetCov( 2,1);
+ tParam.SetCov( 3,0);
+ tParam.SetCov( 4,0);
+ tParam.SetCov( 5,1);
+ tParam.SetCov( 6,0);
+ tParam.SetCov( 7,0);
+ tParam.SetCov( 8,0);
+ tParam.SetCov( 9,1);
+ tParam.SetCov(10,0);
+ tParam.SetCov(11,0);
+ tParam.SetCov(12,0);
+ tParam.SetCov(13,0);
+ tParam.SetCov(14,1);
r.fLastRow = r.fFirstRow;
}
// reconstruction of tracklets, read data step
if( r.fIsMemThread ){
- AliHLTTPCCARow &row = tracker.Rows()[iRow];
+ const AliHLTTPCCARow &row = tracker.Row(iRow);
Bool_t jr = !r.fCurrentData;
Int_t n = row.FullSize();
- uint4* gMem = tracker.RowData() + row.FullOffset();
+ const uint4* gMem = tracker.RowData() + row.FullOffset();
uint4 *sMem = s.fData[jr];
for( Int_t i=iThread; i<n; i+=NMemThreads() ) sMem[i] = gMem[i];
}
if( !r.fSave ) return;
+ //AliHLTTPCCAPerformance::Instance().HNHitsPerTrackCand()->Fill(r.fNHits);
+
do{
- if( r.fNHits<10 ){
+ {
+ //std::cout<<"tracklet to store: "<<r.fItr<<", nhits = "<<r.fNHits<<std::endl;
+ }
+
+ if( r.fNHits<5 ){
r.fNHits = 0;
break;
}
{
Bool_t ok=1;
- Float_t *c = tParam.Cov();
+ const Float_t *c = tParam.Cov();
for( Int_t i=0; i<15; i++ ) ok = ok && CAMath::Finite(c[i]);
for( Int_t i=0; i<5; i++ ) ok = ok && CAMath::Finite(tParam.Par()[i]);
ok = ok && (tParam.X()>50);
store[0] = r.fNHits;
if( r.fNHits>0 ){
+#ifdef DRAW
+ if(0){
+ std::cout<<"store tracklet "<<r.fItr<<", nhits = "<<r.fNHits<<std::endl;
+ if( AliHLTTPCCADisplay::Instance().DrawTracklet(tParam, hitstore, kBlue,1.) ){
+ AliHLTTPCCADisplay::Instance().Ask();
+ }
+ }
+#endif
store[3] = r.fFirstRow;
- store[4] = r.fLastRow;
- if( CAMath::Abs(tParam.Par()[4])<1.e-8 ) tParam.Par()[4] = 1.e-8;
+ store[4] = r.fLastRow;
+ if( CAMath::Abs(tParam.Par()[4])<1.e-8 ) tParam.SetPar( 4, 1.e-8);
*((AliHLTTPCCATrackParam*)(store+5)) = tParam;
Int_t w = (r.fNHits<<16)+r.fItr;
for( Int_t iRow=0; iRow<160; iRow++ ){
Int_t ih = hitstore[iRow];
if( ih>=0 ){
- Int_t ihTot = tracker.Rows()[iRow].FirstHit() + ih;
+ Int_t ihTot = tracker.Row(iRow).FirstHit() + ih;
CAMath::atomicMax( tracker.HitWeights() + ihTot, w );
}
}
{
// reconstruction of tracklets, tracklets update step
+ //std::cout<<"Update tracklet: "<<r.fItr<<" "<<r.fGo<<" "<<r.fStage<<" "<<iRow<<std::endl;
+ Bool_t drawSearch = 0;//r.fItr==356;
+ Bool_t drawFit = 0;//r.fItr==356;
+ Bool_t drawFitted = drawFit ;//|| 1;//r.fItr==16;
+
if( !r.fGo ) return;
-
- const Int_t kMaxRowGap = 5;
+
+ const Int_t kMaxRowGap = 4;
Int_t *hitstore = ((Int_t*) tracker.Tracklets()) +r.fHitStoreOffset;
- AliHLTTPCCARow &row = tracker.Rows()[iRow];
+ const AliHLTTPCCARow &row = tracker.Row(iRow);
Float_t y0 = row.Grid().YMin();
Float_t stepY = row.HstepY();
Float_t x = row.X();
Float_t y = y0 + hh.x*stepY;
Float_t z = z0 + hh.y*stepZ;
-
+ if( drawFit ) std::cout<<" fit tracklet: new hit "<<oldIH<<", xyz="<<x<<" "<<y<<" "<<z<<std::endl;
+
if( iRow==r.fFirstRow ){
- tParam.X() = x;
- tParam.Y() = y;
- tParam.Z() = z;
- Float_t err2Y, err2Z;
- tracker.GetErrors2( iRow, tParam, err2Y, err2Z );
- tParam.Cov()[0] = err2Y;
- tParam.Cov()[2] = err2Z;
+ tParam.SetX( x );
+ tParam.SetY( y );
+ tParam.SetZ( z );
+ r.fLastY = y;
+ r.fLastZ = z;
+ //#ifdef DRAW
+ if( drawFit ) std::cout<<" fit tracklet "<<r.fItr<<", row "<<iRow<<" first row"<<std::endl;
+ //#endif
}else{
- if( !tParam.TransportToX0( x, .95 ) ){
+
+ Float_t err2Y, err2Z;
+ Float_t dx = x - tParam.X();
+ Float_t dy = y - r.fLastY;//tParam.Y();
+ Float_t dz = z - r.fLastZ;//tParam.Z();
+ r.fLastY = y;
+ r.fLastZ = z;
+
+ Float_t ri = 1./CAMath::Sqrt(dx*dx+dy*dy);
+ if( iRow==r.fFirstRow+1 ){
+ tParam.SetSinPhi( dy*ri );
+ tParam.SetCosPhi( dx*ri );
+ tParam.SetDzDs( dz*ri );
+ tracker.GetErrors2( iRow, tParam, err2Y, err2Z );
+ tParam.SetCov( 0, err2Y );
+ tParam.SetCov( 2, err2Z );
+ }
+ if( drawFit ){
+ //#ifdef DRAW
+ std::cout<<" fit tracklet "<<r.fItr<<", row "<<iRow<<" transporting.."<<std::endl;
+ std::cout<<" params before transport="<<std::endl;
+ tParam.Print();
+ //#endif
+ }
+ Float_t sinPhi, cosPhi;
+ if( r.fNHits>=10 && CAMath::Abs(tParam.SinPhi())<.99 ){
+ sinPhi = tParam.SinPhi();
+ cosPhi = CAMath::Sqrt(1-sinPhi*sinPhi);
+ }else{
+ sinPhi = dy*ri;
+ cosPhi = dx*ri;
+ }
+ //#ifdef DRAW
+ if( drawFit ) std::cout<<"sinPhi0 = "<<sinPhi<<", cosPhi0 = "<<cosPhi<<std::endl;
+ //#endif
+ if( !tParam.TransportToX0( x, sinPhi, cosPhi ) ){
+ //#ifdef DRAW
+ if( drawFit ) std::cout<<" tracklet "<<r.fItr<<", row "<<iRow<<": can not transport!!"<<std::endl;
+//#endif
if( SAVE() ) hitstore[iRow] = -1;
break;
}
- Float_t err2Y, err2Z;
- tracker.GetErrors2( iRow, *((AliHLTTPCCATrackParam*)&tParam), err2Y, err2Z );
- if( !tParam.Filter20( y, z, err2Y, err2Z, .95 ) ) {
+
+ tracker.GetErrors2( iRow, tParam.GetZ(), sinPhi, cosPhi, tParam.GetDzDs(), err2Y, err2Z );
+
+ if( drawFit ){
+ //#ifdef DRAW
+ std::cout<<" params after transport="<<std::endl;
+ tParam.Print();
+ std::cout<<"fit tracklet before filter: "<<r.fItr<<", row "<<iRow<<" errs="<<err2Y<<" "<<err2Z<<std::endl;
+ //#endif
+#ifdef DRAW
+ AliHLTTPCCADisplay::Instance().DrawTracklet(tParam, hitstore, kBlue, 2.,1);
+ AliHLTTPCCADisplay::Instance().Ask();
+#endif
+ }
+ if( !tParam.Filter200( y, z, err2Y, err2Z ) ) {
+ //#ifdef DRAW
+ if( drawFit ) std::cout<<" tracklet "<<r.fItr<<", row "<<iRow<<": can not filter!!"<<std::endl;
+ //#endif
if( SAVE() ) hitstore[iRow] = -1;
break;
}
}
if( SAVE() ) hitstore[iRow] = oldIH;
+ if( drawFit ){
+ //#ifdef DRAW
+ std::cout<<"fit tracklet after filter "<<r.fItr<<", row "<<iRow<<std::endl;
+ tParam.Print();
+ //#endif
+#ifdef DRAW
+ AliHLTTPCCADisplay::Instance().DrawTracklet(tParam, hitstore, kGreen,2.);
+ AliHLTTPCCADisplay::Instance().Ask();
+#endif
+ }
r.fNHits++;
r.fLastRow = iRow;
- if( r.fCurrIH<0 ){
- r.fStage = 1;
- if( r.fNHits<3 ){ r.fNHits=0; r.fGo = 0;}
- }
break;
} while(0);
+
+ if( r.fCurrIH<0 ){
+ //#ifdef DRAW
+ if( drawFitted ) std::cout<<"fitted tracklet "<<r.fItr<<", nhits="<<r.fNHits<<std::endl;
+ //#endif
+ r.fStage = 1;
+ //AliHLTTPCCAPerformance::Instance().HNHitsPerSeed()->Fill(r.fNHits);
+ if( r.fNHits<5 ){ r.fNHits=0; r.fGo = 0;}//SG!!!
+ if( CAMath::Abs(tParam.SinPhi())>.999 ){
+ //#ifdef DRAW
+ if( drawFitted ) std::cout<<" fitted tracklet error: sinPhi="<<tParam.SinPhi()<<std::endl;
+ //#endif
+ r.fNHits=0; r.fGo = 0;
+ }else{
+ tParam.SetCosPhi( CAMath::Sqrt(1-tParam.SinPhi()*tParam.SinPhi()) );
+ }
+ if( drawFitted ){
+ //#ifdef DRAW
+ std::cout<<"fitted tracklet "<<r.fItr<<" miss="<<r.fNMissed<<" go="<<r.fGo<<std::endl;
+ tParam.Print();
+#ifdef DRAW
+ AliHLTTPCCADisplay::Instance().DrawTracklet(tParam, hitstore, kBlue);
+ AliHLTTPCCADisplay::Instance().Ask();
+#endif
+ }
+ }
}
else // forward/backward searching part
- {
+ {
do{
+ if( drawSearch ){
+ //#ifdef DRAW
+ std::cout<<"search tracklet "<<r.fItr<<" row "<<iRow<<" miss="<<r.fNMissed<<" go="<<r.fGo<<" stage="<<r.fStage<<std::endl;
+ //#endif
+ }
if( r.fStage == 2 && iRow>=r.fFirstRow ) break;
- if( r.fNMissed>kMaxRowGap ){
- r.fGo = 0;
+ if( r.fNMissed>kMaxRowGap ){
break;
}
-
+
r.fNMissed++;
-
+
Float_t x = row.X();
Float_t err2Y, err2Z;
- if( !tParam.TransportToX0( x, .95 ) ) break;
+ if( drawSearch ){
+ //#ifdef DRAW
+ std::cout<<"tracklet "<<r.fItr<<" before transport to row "<<iRow<<" : "<<std::endl;
+ tParam.Print();
+ //#endif
+ }
+ if( !tParam.TransportToX0( x, .999 ) ){
+ //#ifdef DRAW
+ if( drawSearch ) std::cout<<" tracklet "<<r.fItr<<", row "<<iRow<<": can not transport!!"<<std::endl;
+ //#endif
+ break;
+ }
+ if( drawSearch ){
+ //#ifdef DRAW
+ std::cout<<"tracklet "<<r.fItr<<" after transport to row "<<iRow<<" : "<<std::endl;
+ tParam.Print();
+#ifdef DRAW
+ AliHLTTPCCADisplay::Instance().DrawTracklet(tParam, hitstore, kBlue,2.,1);
+ AliHLTTPCCADisplay::Instance().Ask();
+#endif
+ }
uint4 *tmpint4 = s.fData[r.fCurrentData];
ushort2 *hits = reinterpret_cast<ushort2*>(tmpint4);
UInt_t fHitYfst=1, fHitYlst=0, fHitYfst1=1, fHitYlst1=0;
fIndYmin = row.Grid().GetBin( (float)(fY-1.), (float)(fZ-1.) );
-
+ if( drawSearch ){
+#ifdef DRAW
+ std::cout<<" tracklet "<<r.fItr<<", row "<<iRow<<": grid N="<<row.Grid().N() <<std::endl;
+ std::cout<<" tracklet "<<r.fItr<<", row "<<iRow<<": minbin="<<fIndYmin <<std::endl;
+#endif
+ }
{
Int_t nY = row.Grid().Ny();
+
UShort_t *sGridP = (reinterpret_cast<UShort_t*>(tmpint4)) + row.FullGridOffset();
fHitYfst = sGridP[fIndYmin];
fHitYlst = sGridP[fIndYmin+2];
fHitYfst1 = sGridP[fIndYmin+nY];
fHitYlst1 = sGridP[fIndYmin+nY+2];
+ if( drawSearch ){
+#ifdef DRAW
+ std::cout<<" Grid, row "<<iRow<<": nHits="<<row.NHits()<<", grid n="<<row.Grid().N()<<", c[n]="<<sGridP[row.Grid().N()]<<std::endl;
+ std::cout<<"hit steps = "<<stepY<<" "<<stepZ<<std::endl;
+ std::cout<<" Grid bins:"<<std::endl;
+ for( unsigned int i=0; i<row.Grid().N(); i++ ){
+ std::cout<<" bin "<<i<<": ";
+ for( int j=sGridP[i]; j<sGridP[i+1]; j++){
+ ushort2 hh = hits[j];
+ Float_t y = y0 + hh.x*stepY;
+ Float_t z = z0 + hh.y*stepZ;
+ std::cout<<"["<<j<<"|"<<y<<","<<z<<"] ";
+ }
+ std::cout<<std::endl;
+ }
+#endif
+ }
+ if( sGridP[row.Grid().N()]!=row.NHits() ){
+#ifdef DRAW
+ std::cout<<" grid, row "<<iRow<<": nHits="<<row.NHits()<<", grid n="<<row.Grid().N()<<", c[n]="<<sGridP[row.Grid().N()]<<std::endl;
+ //exit(0);
+#endif
+ }
+ }
+ if( drawSearch ){
+ //#ifdef DRAW
+ std::cout<<" tracklet "<<r.fItr<<", row "<<iRow<<", yz= "<<fY<<","<<fZ<<": search hits="<<fHitYfst<<" "<<fHitYlst<<" / "<< fHitYfst1<<" "<<fHitYlst1<<std::endl;
+ std::cout<<" hit search :"<<std::endl;
+ //#endif
}
-
for( UInt_t fIh = fHitYfst; fIh<fHitYlst; fIh++ ){
ushort2 hh = hits[fIh];
Int_t ddy = (Int_t)(hh.x) - fY0;
Int_t ddz = (Int_t)(hh.y) - fZ0;
- Int_t dds = CAMath::mul24(ddy,ddy) + CAMath::mul24(ddz,ddz);
+ Int_t dds = CAMath::Abs(ddy) + CAMath::Abs(ddz);
+ if( drawSearch ){
+ //#ifdef DRAW
+ std::cout<<fIh<<": hityz= "<<hh.x<<" "<<hh.y<<"("<<hh.x*stepY<<" "<<hh.y*stepZ<<"), trackyz="<<fY0<<" "<<fZ0<<"("<<fY0*stepY<<" "<<fZ0*stepZ<<"), dy,dz,ds= "<<ddy<<" "<<ddz<<" "<<dds<<"("<<ddy*stepY<<" "<<ddz*stepZ<<std::endl;
+ //#endif
+ }
if( dds<ds ){
ds = dds;
best = fIh;
ushort2 hh = hits[fIh];
Int_t ddy = (Int_t)(hh.x) - fY0;
Int_t ddz = (Int_t)(hh.y) - fZ0;
- Int_t dds = CAMath::mul24(ddy,ddy) + CAMath::mul24(ddz,ddz);
+ Int_t dds = CAMath::Abs(ddy) + CAMath::Abs(ddz);
+ if( drawSearch ){
+ //#ifdef DRAW
+ std::cout<<fIh<<": hityz= "<<hh.x<<" "<<hh.y<<"("<<hh.x*stepY<<" "<<hh.y*stepZ<<"), trackyz="<<fY0<<" "<<fZ0<<"("<<fY0*stepY<<" "<<fZ0*stepZ<<"), dy,dz,ds= "<<ddy<<" "<<ddz<<" "<<dds<<"("<<ddy*stepY<<" "<<ddz*stepZ<<std::endl;
+ //#endif
+ }
if( dds<ds ){
ds = dds;
best = fIh;
}// end of search for the closest hit
if( best<0 ) break;
-
+ if( drawSearch ){
+ //#ifdef DRAW
+ std::cout<<"hit search "<<r.fItr<<", row "<<iRow<<" hit "<<best<<" found"<<std::endl;
+#ifdef DRAW
+ AliHLTTPCCADisplay::Instance().DrawSliceHit( iRow, best, kRed, 1. );
+ AliHLTTPCCADisplay::Instance().Ask();
+ AliHLTTPCCADisplay::Instance().DrawSliceHit( iRow, best, kWhite, 1 );
+ AliHLTTPCCADisplay::Instance().DrawSliceHit( iRow, best );
+#endif
+ }
+
ushort2 hh = hits[best];
tracker.GetErrors2( iRow, *((AliHLTTPCCATrackParam*)&tParam), err2Y, err2Z );
Float_t dy = y - fY;
Float_t dz = z - fZ;
- const Float_t kFactor = 3.5*3.5;
+ //const Float_t kFactor = tracker.Param().HitPickUpFactor()*tracker.Param().HitPickUpFactor()*3.5*3.5;
+ const Float_t kFactor = 3.5*3.5;//SG!!!
Float_t sy2 = kFactor*( tParam.GetErr2Y() + err2Y );
Float_t sz2 = kFactor*( tParam.GetErr2Z() + err2Z );
- if( sy2 > 1. ) sy2 = 1.;
- if( sz2 > 1. ) sz2 = 1.;
+ if( sy2 > 2. ) sy2 = 2.;//SG
+ if( sz2 > 2. ) sz2 = 2.;
if( iRow==63 || iRow==64 || iRow==65 ){
- if( sy2 < 4. ) sy2 = 4.;
- if( sz2 < 4. ) sz2 = 4.;
+ //if( sy2 < 4. ) sy2 = 4.; //SG!!!
+ //if( sz2 < 4. ) sz2 = 4.;
}
-
-
- if( CAMath::fmul_rz(dy,dy)>sy2 || CAMath::fmul_rz(dz,dz)>sz2 ) break;
-
- if( !tParam.Filter20( y, z, err2Y, err2Z, .95 ) ) break;
+ if( drawSearch ){
+ //#ifdef DRAW
+ std::cout<<"dy,sy= "<< dy <<" "<<CAMath::Sqrt(sy2)<<", dz,sz= "<< dz<<" "<<CAMath::Sqrt(sz2)<<std::endl;
+ std::cout<<"dy,dz= "<< dy <<" "<<dz<<", sy,sz= "<<CAMath::Sqrt(sy2)<<" "<<CAMath::Sqrt(sz2)<<", sy,sz= "<<CAMath::Sqrt(kFactor*( tParam.GetErr2Y() + err2Y ))<<" "<<CAMath::Sqrt(kFactor*( tParam.GetErr2Z() + err2Z ))<<std::endl;
+ //#endif
+ }
+ if( CAMath::fmul_rz(dy,dy)>sy2 || CAMath::fmul_rz(dz,dz)>sz2 ){
+ if( drawSearch ){
+ //#ifdef DRAW
+ std::cout<<"found hit is out of the chi2 window\n "<<std::endl;
+ //#endif
+ }
+ break;
+ }
+#ifdef DRAW
+ //if( SAVE() ) hitstore[ iRow ] = best;
+ //std::cout<<"hit search before filter: "<<r.fItr<<", row "<<iRow<<std::endl;
+ //AliHLTTPCCADisplay::Instance().DrawTracklet(tParam, hitstore, kBlue);
+ //AliHLTTPCCADisplay::Instance().Ask();
+#endif
+ if( !tParam.Filter2( y, z, err2Y, err2Z, .999 ) ){
+ if( drawSearch ){
+ //#ifdef DRAW
+ std::cout<<"tracklet "<<r.fItr<<" at row "<<iRow<<" : can not filter!!!! "<<std::endl;
+ //#endif
+ }
+ break;
+ }
if( SAVE() ) hitstore[ iRow ] = best;
- r.fNHits++;
+ if( drawSearch ){
+ //#ifdef DRAW
+ std::cout<<"tracklet "<<r.fItr<<" after filter at row "<<iRow<<" : "<<std::endl;
+ tParam.Print();
+#ifdef DRAW
+ AliHLTTPCCADisplay::Instance().DrawTracklet(tParam, hitstore, kRed);
+ AliHLTTPCCADisplay::Instance().Ask();
+#endif
+ }
+ r.fNHits++;
r.fNMissed=0;
+ if( r.fStage ==1 ) r.fLastRow = iRow;
+ else r.fFirstRow = iRow;
}while(0);
}
}
r.fCurrentData = 0;
r.fNMissed = 0;
r.fStage = 2;
+ if( r.fGo ){
+ const AliHLTTPCCARow &row = tracker.Row(r.fFirstRow);
+ Float_t x = row.X();
+ if( !tParam.TransportToX( x, .999 ) ) r.fGo = 0;
+ }
}
else if( iSync<=3+159+1+159 )
public:
#if !defined(HLTCA_GPUCODE)
AliHLTTPCCAThreadMemory()
- : fItr(0), fFirstRow(0), fLastRow(0), fCurrIH(0), fIsMemThread(0), fGo(0), fSave(0), fCurrentData(0), fStage(0), fNHits(0), fNMissed(0), fTrackStoreOffset(0), fHitStoreOffset(0)
+ : fItr(0), fFirstRow(0), fLastRow(0), fCurrIH(0), fIsMemThread(0), fGo(0), fSave(0), fCurrentData(0), fStage(0), fNHits(0), fNMissed(0), fTrackStoreOffset(0), fHitStoreOffset(0), fLastY(0), fLastZ(0)
{}
AliHLTTPCCAThreadMemory( const AliHLTTPCCAThreadMemory& /*dummy*/)
- : fItr(0), fFirstRow(0), fLastRow(0), fCurrIH(0), fIsMemThread(0), fGo(0), fSave(0), fCurrentData(0), fStage(0), fNHits(0), fNMissed(0), fTrackStoreOffset(0), fHitStoreOffset(0)
+ : fItr(0), fFirstRow(0), fLastRow(0), fCurrIH(0), fIsMemThread(0), fGo(0), fSave(0), fCurrentData(0), fStage(0), fNHits(0), fNMissed(0), fTrackStoreOffset(0), fHitStoreOffset(0), fLastY(0), fLastZ(0)
{}
AliHLTTPCCAThreadMemory& operator=(const AliHLTTPCCAThreadMemory& /*dummy*/){ return *this; }
#endif
Int_t fNMissed; // n missed hits during search
Int_t fTrackStoreOffset; // offset in the global array
Int_t fHitStoreOffset; // offset in the global array
+ Float_t fLastY; // Y of the last fitted cluster
+ Float_t fLastZ; // Z of the last fitted cluster
};
GPUd() static Int_t NThreadSyncPoints(){ return 4+159*2 +1+1; }
Int_t *t = ((Int_t*)tracker.Tracklets()) + itr*(5+ sizeof(AliHLTTPCCATrackParam)/4 + 160 );
Int_t tNHits = *t;
if( tNHits<=0 ) continue;
-
- tout.NHits() = 0;
+
+ const Int_t kMaxRowGap = 4;
+ Int_t firstRow = t[3];
+ Int_t lastRow = t[4];
+
+ tout.SetNHits( 0 );
Int_t *hitstore = t + 5+ sizeof(AliHLTTPCCATrackParam)/4 ;
Int_t w = (tNHits<<16)+itr;
- Int_t nRows = tracker.Param().NRows();
+ //Int_t nRows = tracker.Param().NRows();
Int_t gap = 0;
- for( Int_t irow=0; irow<nRows; irow++ ){
+
+ //std::cout<<" store tracklet: "<<firstRow<<" "<<lastRow<<std::endl;
+ for( Int_t irow=firstRow; irow<=lastRow; irow++ ){
+ gap++;
Int_t ih = hitstore[irow];
- if( ih<0 ) continue;
- AliHLTTPCCARow &row = tracker.Rows()[irow];
- Int_t ihTot = row.FirstHit()+ih;
- if( tracker.HitWeights()[ihTot] > w ){
- if( ++gap>6){ tout.NHits()=0; break; }
- continue;
- } else gap = 0;
- Int_t th = AliHLTTPCCATracker::IRowIHit2ID(irow,ih);
- trackHits[tout.NHits()] = th;
- tout.NHits()++;
- }
- if( tout.NHits()<10 ) continue;//SG!!!
- Int_t itrout = CAMath::atomicAdd(tracker.NTracks(),1);
- tout.FirstHitID() = CAMath::atomicAdd( tracker.NTrackHits(), tout.NHits() );
- tout.Param() = *( (AliHLTTPCCATrackParam*)( t+5) );
- tout.Alive() = 1;
- tracker.Tracks()[itrout] = tout;
- for( Int_t ih=0; ih<tout.NHits(); ih++ ){//SG
- tracker.TrackHits()[tout.FirstHitID() + ih] = trackHits[ih];
+ if( ih>=0 ){
+ Int_t ihTot = tracker.Row(irow).FirstHit()+ih;
+ if( tracker.HitWeights()[ihTot] <= w ){
+ gap = 0;
+ Int_t th = AliHLTTPCCATracker::IRowIHit2ID(irow,ih);
+ trackHits[tout.NHits()] = th;
+ tout.SetNHits( tout.NHits() + 1 );
+ }
+ }
+ if( gap>kMaxRowGap || irow==lastRow ){ // store
+ if( tout.NHits()>=10 ){ //SG!!!
+ Int_t itrout = CAMath::atomicAdd(tracker.NTracks(),1);
+ tout.SetFirstHitID( CAMath::atomicAdd( tracker.NTrackHits(), tout.NHits() ));
+ tout.SetParam( *( (AliHLTTPCCATrackParam*)( t+5) ));
+ tout.SetAlive( 1 );
+ tracker.Tracks()[itrout] = tout;
+ for( Int_t jh=0; jh<tout.NHits(); jh++ ){
+ tracker.TrackHits()[tout.FirstHitID() + jh] = trackHits[jh];
+ }
+ }
+ tout.SetNHits( 0 );
+ gap = 0;
+ }
}
}
}
//#include "AliCluster.h"
#include "AliTPCClustersRow.h"
#include "AliTPCParam.h"
+#include "AliTPCClusterParam.h"
+
#include "AliRun.h"
#include "AliRunLoader.h"
#include "AliStack.h"
#include "AliTPCTransform.h"
#include "AliTPCcalibDB.h"
#include "AliTPCtrack.h"
+#include "AliTPCseed.h"
#include "AliESDtrack.h"
#include "AliESDEvent.h"
#include "AliTrackReference.h"
ClassImp(AliTPCtrackerCA)
AliTPCtrackerCA::AliTPCtrackerCA()
- :AliTracker(),fParam(0), fClusters(0), fNClusters(0), fHLTTracker(0),fHLTPerformance(0),fDoHLTPerformance(0),fDoHLTPerformanceClusters(0),fStatNEvents(0)
+ :AliTracker(),fParam(0), fClusters(0), fNClusters(0), fHLTTracker(0),fDoHLTPerformance(0),fDoHLTPerformanceClusters(0),fStatNEvents(0)
{
//* default constructor
}
AliTPCtrackerCA::AliTPCtrackerCA(const AliTPCtrackerCA &):
- AliTracker(),fParam(0), fClusters(0), fNClusters(0), fHLTTracker(0),fHLTPerformance(0),fDoHLTPerformance(0),fDoHLTPerformanceClusters(0),fStatNEvents(0)
+ AliTracker(),fParam(0), fClusters(0), fNClusters(0), fHLTTracker(0),fDoHLTPerformance(0),fDoHLTPerformanceClusters(0),fStatNEvents(0)
{
//* dummy
}
//* destructor
if( fClusters ) delete[] fClusters;
if( fHLTTracker ) delete fHLTTracker;
- if( fHLTPerformance ) delete fHLTPerformance;
}
+//#include "AliHLTTPCCADisplay.h"
+
AliTPCtrackerCA::AliTPCtrackerCA(const AliTPCParam *par):
- AliTracker(),fParam(par), fClusters(0), fNClusters(0), fHLTTracker(0), fHLTPerformance(0),fDoHLTPerformance(0),fDoHLTPerformanceClusters(0),fStatNEvents(0)
+ AliTracker(),fParam(par), fClusters(0), fNClusters(0), fHLTTracker(0),fDoHLTPerformance(0),fDoHLTPerformanceClusters(0),fStatNEvents(0)
{
//* constructor
- DoHLTPerformance() = 1;
- DoHLTPerformanceClusters() = 0;
+ fDoHLTPerformance = 0;
+ fDoHLTPerformanceClusters = 0;
fHLTTracker = new AliHLTTPCCAGBTracker;
fHLTTracker->SetNSlices( fParam->GetNSector()/2 );
if( fDoHLTPerformance ){
- fHLTPerformance = new AliHLTTPCCAPerformance;
- fHLTPerformance->SetTracker( fHLTTracker );
+ AliHLTTPCCAPerformance::Instance().SetTracker( fHLTTracker );
}
for( Int_t iSlice=0; iSlice<fHLTTracker->NSlices(); iSlice++ ){
AliHLTTPCCAParam param;
param.Initialize( iSlice, nRows, rowX, alpha, dalpha,
inRmin, outRmax, zMin, zMax, padPitch, sigmaZ, bz );
- param.YErrorCorrection() = 1.;// .33;
- param.ZErrorCorrection() = 1.;//.33;
- param.MaxTrackMatchDRow() = 5;
- param.TrackConnectionFactor() = 3.5;
+ param.SetHitPickUpFactor( 3. );
+ param.SetMaxTrackMatchDRow( 5 );
+ param.SetTrackConnectionFactor( 3.5 );
+
+ AliTPCClusterParam * clparam = AliTPCcalibDB::Instance()->GetClusterParam();
+ for( Int_t iRow=0; iRow<nRows; iRow++ ){
+ Int_t type = (iRow<63) ? 0: ( (iRow>126) ? 1:2 );
+ for( int iyz=0; iyz<2; iyz++ ){
+ for( int k=0; k<7; k++ ){
+ //std::cout<<param.fParamS0Par[iyz][type][k]<<" "<<clparam->fParamS0Par[iyz][type][k] - param.fParamS0Par[iyz][type][k]<<std::endl;
+ param.SetParamS0Par(iyz,type,k,clparam->fParamS0Par[iyz][type][k]);
+ }
+ }
+ }
fHLTTracker->Slices()[iSlice].Initialize( param );
}
}
if( fClusters ) delete[] fClusters;
fHLTTracker->StartEvent();
- if( fDoHLTPerformance ) fHLTPerformance->StartEvent();
+ if( fDoHLTPerformance ) AliHLTTPCCAPerformance::Instance().StartEvent();
if( !fParam ) return 1;
AliStack *stack = rl->Stack();
if( !stack ) break;
- fHLTPerformance->SetNMCTracks( stack->GetNtrack() );
+ AliHLTTPCCAPerformance::Instance().SetNMCTracks( stack->GetNtrack() );
for( Int_t itr=0; itr<stack->GetNtrack(); itr++ ){
TParticle *part = stack->Particle(itr);
- fHLTPerformance->ReadMCTrack( itr, part );
+ AliHLTTPCCAPerformance::Instance().ReadMCTrack( itr, part );
}
{ // check for MC tracks at the TPC entrance
+
Bool_t *isTPC = 0;
isTPC = new Bool_t [stack->GetNtrack()];
for( Int_t i=0; i<stack->GetNtrack(); i++ ) isTPC[i] = 0;
if( isTPC[tpcRef->Label()] ) continue;
- fHLTPerformance->ReadMCTPCTrack(tpcRef->Label(),
+ AliHLTTPCCAPerformance::Instance().ReadMCTPCTrack(tpcRef->Label(),
tpcRef->X(),tpcRef->Y(),tpcRef->Z(),
tpcRef->Px(),tpcRef->Py(),tpcRef->Pz() );
isTPC[tpcRef->Label()] = 1;
AliTPChit *phit = (AliTPChit*)tpc->FirstHit(-1);
for ( ; phit; phit=(AliTPChit*)tpc->NextHit() ) nPoints++;
}
- fHLTPerformance->SetNMCPoints( nPoints );
+ AliHLTTPCCAPerformance::Instance().SetNMCPoints( nPoints );
for (Int_t iEnt=0; iEnt<nEnt; iEnt++) {
tpc->ResetHits();
tpcl->TreeH()->GetEvent(iEnt);
AliTPChit *phit = (AliTPChit*)tpc->FirstHit(-1);
for ( ; phit; phit=(AliTPChit*)tpc->NextHit() ){
- fHLTPerformance->ReadMCPoint( phit->GetTrack(),phit->X(), phit->Y(),phit->Z(),phit->Time(), phit->fSector%36);
+ AliHLTTPCCAPerformance::Instance().ReadMCPoint( phit->GetTrack(),phit->X(), phit->Y(),phit->Z(),phit->Time(), phit->fSector%36);
}
}
break;
fClusters = new AliTPCclusterMI [fNClusters];
fHLTTracker->SetNHits( fNClusters );
- if( fDoHLTPerformance ) fHLTPerformance->SetNHits( fNClusters );
+ if( fDoHLTPerformance ) AliHLTTPCCAPerformance::Instance().SetNHits( fNClusters );
Int_t ind=0;
for (Int_t i=0; i<nEnt; i++) {
br->GetEntry(i);
fHLTTracker->ReadHit( x, y, z,
TMath::Sqrt(cluster->GetSigmaY2()), TMath::Sqrt(cluster->GetSigmaZ2()),
cluster->GetMax(), index, sec, row );
- if( fDoHLTPerformance ) fHLTPerformance->ReadHitLabel(index, lab0, lab1, lab2 );
+ if( fDoHLTPerformance ) AliHLTTPCCAPerformance::Instance().ReadHitLabel(index, lab0, lab1, lab2 );
}
}
delete clrow;
Int_t AliTPCtrackerCA::Clusters2Tracks( AliESDEvent *event )
{
// reconstruction
- cout<<"Start of AliTPCtrackerCA"<<endl;
+ //cout<<"Start of AliTPCtrackerCA"<<endl;
TStopwatch timer;
fHLTTracker->FindTracks();
- cout<<"Do performance.."<<endl;
- if( fDoHLTPerformance ) fHLTPerformance->Performance();
+ //cout<<"Do performance.."<<endl;
+ if( fDoHLTPerformance ) AliHLTTPCCAPerformance::Instance().Performance();
if( 0 ) {// Write Event
if( fStatNEvents == 0 ){
sprintf( mcname,"CAEvents/%i.mcevent.dat",fStatNEvents );
mcevent.open(mcname, ios::out);
if( mcevent.is_open() ){
- fHLTPerformance->WriteMCEvent(mcevent);
+ AliHLTTPCCAPerformance::Instance().WriteMCEvent(mcevent);
}
if(1 && fDoHLTPerformanceClusters ){
sprintf( mcname,"CAEvents/%i.mcpoints.dat",fStatNEvents );
mcpoints.open(mcname, ios::out);
if( mcpoints.is_open() ){
- fHLTPerformance->WriteMCPoints(mcpoints);
+ AliHLTTPCCAPerformance::Instance().WriteMCPoints(mcpoints);
}
mcpoints.close();
}
Float_t bz = fHLTTracker->Slices()[0].Param().Bz();
for( Int_t itr=0; itr<fHLTTracker->NTracks(); itr++ ){
- AliTPCtrack tTPC;
+ //AliTPCtrack tTPC;
+ AliTPCseed tTPC;
AliHLTTPCCAGBTrack &tCA = fHLTTracker->Tracks()[itr];
- AliHLTTPCCATrackParam &par = tCA.Param();
+ AliHLTTPCCATrackParam par = tCA.Param();
AliHLTTPCCATrackConvertor::GetExtParam( par, tTPC, tCA.Alpha(), bz );
tTPC.SetMass(0.13957);
tTPC.SetdEdx( tCA.DeDx() );
if( TMath::Abs(tTPC.GetSigned1Pt())>1./0.02 ) continue;
Int_t nhits = tCA.NHits();
- if( nhits>kMaxRow ) nhits = kMaxRow;
- tTPC.SetNumberOfClusters(nhits);
+ if( nhits>199 ) nhits=199;// kMaxRow ) nhits = kMaxRow;
+ tTPC.SetNumberOfClusters(nhits);
+
+ Float_t alpha = tCA.Alpha();
+ AliHLTTPCCATrackParam t0 = par;
for( Int_t ih=0; ih<nhits; ih++ ){
Int_t index = fHLTTracker->TrackHits()[tCA.FirstHitRef()+ih];
- Int_t extIndex = fHLTTracker->Hits()[index].ID();
+ AliHLTTPCCAGBHit &h = fHLTTracker->Hits()[index];
+ Int_t extIndex = h.ID();
tTPC.SetClusterIndex(ih, extIndex);
- }
- CookLabel(&tTPC,0.1);
- if(0){
- Double_t xTPC=fParam->GetInnerRadiusLow();
- Double_t dAlpha = fParam->GetInnerAngle()/180.*TMath::Pi();
- if (tTPC.AliExternalTrackParam::PropagateTo(xTPC,bz)) {
- Double_t y=tTPC.GetY();
- Double_t ymax=xTPC*TMath::Tan(dAlpha/2.);
- if (y > ymax) {
- if (tTPC.Rotate(dAlpha)) tTPC.AliExternalTrackParam::PropagateTo(xTPC,bz);
- } else if (y <-ymax) {
- if (tTPC.Rotate(-dAlpha)) tTPC.AliExternalTrackParam::PropagateTo(xTPC,bz);
- }
+
+ AliTPCclusterMI *c = &(fClusters[extIndex]);
+ tTPC.SetClusterPointer(h.IRow(), c );
+ AliTPCTrackerPoint &point = *(tTPC.GetTrackPoint(h.IRow()));
+ {
+ Int_t iSlice = h.ISlice();
+ AliHLTTPCCATracker &slice = fHLTTracker->Slices()[iSlice];
+ if( slice.Param().Alpha()!=alpha ){
+ if( ! t0.Rotate( slice.Param().Alpha() - alpha, .999 ) ) continue;
+ alpha = slice.Param().Alpha();
+ }
+ Float_t x = slice.Row(h.IRow()).X();
+ if( !t0.TransportToX( x, .999 ) ) continue;
+ Float_t sy2, sz2;
+ slice.GetErrors2( h.IRow(), t0, sy2, sz2 );
+ point.SetSigmaY(c->GetSigmaY2()/sy2);
+ point.SetSigmaZ(c->GetSigmaZ2()/sz2);
+ point.SetAngleY(TMath::Abs(t0.GetSinPhi()/t0.GetCosPhi()));
+ point.SetAngleZ(TMath::Abs(t0.GetDzDs()));
+ }
+
}
- }
+ tTPC.CookdEdx(0.02,0.6);
+
+ CookLabel(&tTPC,0.1);
AliESDtrack tESD;
tESD.UpdateTrackParams( &(tTPC),AliESDtrack::kTPCin);
//tESD.SetStatus( AliESDtrack::kTPCrefit );
//tESD.SetTPCPoints(tTPC.GetPoints());
- //tESD.myTPC = tTPC;
+ Int_t ndedx = tTPC.GetNCDEDX(0);
+ Float_t sdedx = tTPC.GetSDEDX(0);
+ Float_t dedx = tTPC.GetdEdx();
+ tESD.SetTPCsignal(dedx, sdedx, ndedx);
+ tESD.myTPC = tTPC;
+
event->AddTrack(&tESD);
}
}
time+=timer.CpuTime();
time1+=timer.RealTime();
ncalls++;
- cout<<"\n\nCA tracker speed: cpu = "<<time/ncalls*1.e3<<" [ms/ev], real = "<<time1/ncalls*1.e3<<" [ms/ev], n calls = "<<ncalls<<endl<<endl;
+ //cout<<"\n\nCA tracker speed: cpu = "<<time/ncalls*1.e3<<" [ms/ev], real = "<<time1/ncalls*1.e3<<" [ms/ev], n calls = "<<ncalls<<endl<<endl;
//cout<<"End of AliTPCtrackerCA"<<endl;
return 0;
class AliESD;
class TTree;
class AliHLTTPCCAGBTracker;
-class AliHLTTPCCAPerformance;
class AliTPCclusterMI;
class AliTPCtrack;
Int_t LoadClusters (TTree * tree);
void UnloadClusters(){ return ; }
AliCluster * GetCluster(Int_t index) const;
- Bool_t &DoHLTPerformance(){ return fDoHLTPerformance; }
- Bool_t &DoHLTPerformanceClusters(){ return fDoHLTPerformanceClusters; }
+ Bool_t DoHLTPerformance() const { return fDoHLTPerformance; }
+ Bool_t DoHLTPerformanceClusters() const { return fDoHLTPerformanceClusters; }
//
protected:
AliTPCclusterMI *fClusters; //* array of clusters
Int_t fNClusters; //* N clusters
AliHLTTPCCAGBTracker *fHLTTracker; //* pointer to the HLT tracker
- AliHLTTPCCAPerformance *fHLTPerformance; //* performance calculations
Bool_t fDoHLTPerformance; //* flag for call AliHLTTPCCAPerformance
Bool_t fDoHLTPerformanceClusters; //* flag for call AliHLTTPCCAPerformance with cluster pulls (takes some time to load TPC MC points)
Int_t fStatNEvents; //* N of reconstructed events