X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=ITS%2FAliITStrackerSA.cxx;h=ea8abebb330c94bfd3515b6d7877e8c36e4c35eb;hp=26a923a9877f4b1680fb8286b0b88f270b8ae189;hb=6b8d43785ead9dcd91c400f11fa9d584fc59dd71;hpb=5b4dedce08d6d9ca7e59b8d5ab5a26ed395a0f96 diff --git a/ITS/AliITStrackerSA.cxx b/ITS/AliITStrackerSA.cxx index 26a923a9877..ea8abebb330 100644 --- a/ITS/AliITStrackerSA.cxx +++ b/ITS/AliITStrackerSA.cxx @@ -15,12 +15,11 @@ /* $Id$ */ -//////////////////////////////////////////////////// -// Stand alone tracker class // -// Origin: Elisabetta Crescio // -// e-mail: crescio@to.infn.it // -// tracks are saved as AliITStrackV2 objects // -//////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +// Stand alone ITS tracker class // +// Origin: Elisabetta Crescio - crescio@to.infn.it // +// Updated: Francesco Prino - prino@to.infn.it // +/////////////////////////////////////////////////////////// #include @@ -39,6 +38,7 @@ #include "AliITStrackSA.h" #include "AliITStrackerSA.h" #include "AliITSReconstructor.h" +#include "AliLog.h" #include "AliRun.h" ClassImp(AliITStrackerSA) @@ -55,13 +55,14 @@ fCoef3(0), fNloop(0), fPhiWin(0), fLambdaWin(0), -fVert(0), -fVertexer(0), fListOfTracks(0), +fListOfSATracks(0), fITSclusters(0), -fSixPoints(0), +fInwardFlag(0), fOuterStartLayer(0), -fCluLayer(0), +fInnerStartLayer(5), +fMinNPoints(0), +fMinQ(0.), fCluCoord(0){ // Default constructor Init(); @@ -79,13 +80,14 @@ fCoef3(0), fNloop(0), fPhiWin(0), fLambdaWin(0), -fVert(0), -fVertexer(0), fListOfTracks(0), +fListOfSATracks(0), fITSclusters(0), -fSixPoints(0), +fInwardFlag(0), fOuterStartLayer(0), -fCluLayer(0), +fInnerStartLayer(5), +fMinNPoints(0), +fMinQ(0.), fCluCoord(0) { // Standard constructor (Vertex is known and passed to this obj.) @@ -94,140 +96,19 @@ fCluCoord(0) } Init(); - fVert = 0; - -} - -//____________________________________________________________________________ -AliITStrackerSA::AliITStrackerSA(const Char_t *geom, AliESDVertex *vert):AliITStrackerMI(0), -fPhiEstimate(0), -fITSStandAlone(0), -fLambdac(0), -fPhic(0), -fCoef1(0), -fCoef2(0), -fCoef3(0), -fNloop(0), -fPhiWin(0), -fLambdaWin(0), -fVert(vert), -fVertexer(0), -fListOfTracks(0), -fITSclusters(0), -fSixPoints(0), -fOuterStartLayer(0), -fCluLayer(0), -fCluCoord(0) -{ - // Standard constructor (Vertex is known and passed to this obj.) - if (geom) { - AliWarning("\"geom\" is actually a dummy argument !"); - } - Init(); - -} - -//____________________________________________________________________________ -AliITStrackerSA::AliITStrackerSA(const Char_t *geom, AliITSVertexer *vertexer):AliITStrackerMI(0), -fPhiEstimate(0), -fITSStandAlone(0), -fLambdac(0), -fPhic(0), -fCoef1(0), -fCoef2(0), -fCoef3(0), -fNloop(0), -fPhiWin(0), -fLambdaWin(0), -fVert(), -fVertexer(vertexer), -fListOfTracks(0), -fITSclusters(0), -fSixPoints(0), -fOuterStartLayer(0), -fCluLayer(0), -fCluCoord(0) -{ - // Standard constructor (Vertex is unknown - vertexer is passed to this obj) - if (geom) { - AliWarning("\"geom\" is actually a dummy argument !"); - } - Init(); - fVertexer = vertexer; - -} - -//____________________________________________________________________________ -AliITStrackerSA::AliITStrackerSA(const AliITStrackerSA& tracker):AliITStrackerMI(), -fPhiEstimate(tracker.fPhiEstimate), -fITSStandAlone(tracker.fITSStandAlone), -fLambdac(tracker.fLambdac), -fPhic(tracker.fPhic), -fCoef1(tracker.fCoef1), -fCoef2(tracker.fCoef2), -fCoef3(tracker.fCoef3), -fNloop(tracker.fNloop), -fPhiWin(tracker.fPhiWin), -fLambdaWin(tracker.fLambdaWin), -fVert(tracker.fVert), -fVertexer(tracker.fVertexer), -fListOfTracks(tracker.fListOfTracks), -fITSclusters(tracker.fITSclusters), -fSixPoints(tracker.fSixPoints), -fOuterStartLayer(tracker.fOuterStartLayer), -fCluLayer(tracker.fCluLayer), -fCluCoord(tracker.fCluCoord) { - // Copy constructor - for(Int_t i=0;i<2;i++){ - fPoint1[i]=tracker.fPoint1[i]; - fPoint2[i]=tracker.fPoint2[i]; - fPoint3[i]=tracker.fPoint3[i]; - fPointc[i]=tracker.fPointc[i]; - } - if(tracker.fVertexer && tracker.fVert){ - fVert = new AliESDVertex(*tracker.fVert); - } - else { - fVert = tracker.fVert; - } - for(Int_t i=0;i~AliITStrackerSA(); - new(this) AliITStrackerSA(source); - return *this; } //____________________________________________________________________________ AliITStrackerSA::~AliITStrackerSA(){ // destructor - // if fVertexer is not null, the AliESDVertex obj. is owned by this class - // and is deleted here - if(fVertexer){ - if(fVert)delete fVert; - } - fVert = 0; - fVertexer = 0; if(fPhiWin)delete []fPhiWin; if(fLambdaWin)delete []fLambdaWin; fListOfTracks->Delete(); delete fListOfTracks; - if(fCluLayer){ - for(Int_t i=0;iDelete(); - delete fCluLayer[i]; - } - } - delete [] fCluLayer; - } + fListOfSATracks->Delete(); + delete fListOfSATracks; if(fCluCoord){ for(Int_t i=0;iGetPrimaryVertexSPD(); + if(spdv) nSPDcontr = spdv->GetNContributors(); + if(AliITSReconstructor::GetRecoParam()->GetSAUseAllClusters()==kTRUE && + nSPDcontr<=AliITSReconstructor::GetRecoParam()->GetMaxSPDcontrForSAToUseAllClusters()) { + rc=FindTracks(event,kTRUE); + } + } return rc; } @@ -262,7 +152,7 @@ Int_t AliITStrackerSA::Clusters2Tracks(AliESDEvent *event){ void AliITStrackerSA::Init(){ // Reset all data members fPhiEstimate=0; - for(Int_t i=0;i<3;i++){fPoint1[i]=0;fPoint2[i]=0;fPoint3[i]=0;} + for(Int_t i=0;i<2;i++){fPoint1[i]=0;fPoint2[i]=0;fPoint3[i]=0;} fLambdac=0; fPhic=0; fCoef1=0; @@ -270,10 +160,8 @@ void AliITStrackerSA::Init(){ fCoef3=0; fPointc[0]=0; fPointc[1]=0; - fVert = 0; - fVertexer = 0; Int_t nLoops=AliITSReconstructor::GetRecoParam()->GetNLoopsSA(); - if(nLoops==33){ + if(nLoops==32){ SetFixedWindowSizes(); }else{ Double_t phimin=AliITSReconstructor::GetRecoParam()->GetMinPhiSA(); @@ -282,19 +170,20 @@ void AliITStrackerSA::Init(){ Double_t lambmax=AliITSReconstructor::GetRecoParam()->GetMaxLambdaSA(); SetCalculatedWindowSizes(nLoops,phimin,phimax,lambmin,lambmax); } + fMinQ=AliITSReconstructor::GetRecoParam()->GetSAMinClusterCharge(); fITSclusters = 0; - SetSixPoints(); - SetOuterStartLayer(0); + SetOuterStartLayer(1); SetSAFlag(kFALSE); - fListOfTracks=new TObjArray(0,0); - fCluLayer = 0; + fListOfTracks=new TClonesArray("AliITStrackMI",100); + fListOfSATracks=new TClonesArray("AliITStrackSA",100); fCluCoord = 0; + fMinNPoints = 3; } //_______________________________________________________________________ void AliITStrackerSA::ResetForFinding(){ // Reset data members used in all loops during track finding fPhiEstimate=0; - for(Int_t i=0;i<3;i++){fPoint1[i]=0;fPoint2[i]=0;fPoint3[i]=0;} + for(Int_t i=0;i<2;i++){fPoint1[i]=0;fPoint2[i]=0;fPoint3[i]=0;} fLambdac=0; fPhic=0; fCoef1=0; @@ -302,32 +191,30 @@ void AliITStrackerSA::ResetForFinding(){ fCoef3=0; fPointc[0]=0; fPointc[1]=0; - fListOfTracks->Delete(); + fListOfTracks->Clear(); + fListOfSATracks->Clear(); } //______________________________________________________________________ -Int_t AliITStrackerSA::FindTracks(AliESDEvent* event){ +Int_t AliITStrackerSA::FindTracks(AliESDEvent* event, Bool_t useAllClusters){ // Track finder using the ESD object - - //controllare numero cluster sui layer1 e 2 (morti?) - //non trova tracce...controllare.. + AliDebug(2,Form(" field is %f",event->GetMagneticField())); + AliDebug(2,Form("SKIPPING %d %d %d %d %d %d",ForceSkippingOfLayer(0),ForceSkippingOfLayer(1),ForceSkippingOfLayer(2),ForceSkippingOfLayer(3),ForceSkippingOfLayer(4),ForceSkippingOfLayer(5))); if(!fITSclusters){ - Fatal("FindTracks","ITS cluster tree is not accessed - Abort!!!\n Please use method SetClusterTree to pass the pointer to the tree\n"); + Fatal("FindTracks","ITS cluster tree is not accessed!!!\n Please use method SetClusterTree to pass the pointer to the tree\n"); return -1; } - - //Reads event and mark clusters of traks already found, with flag kITSin Int_t nentr=event->GetNumberOfTracks(); - if(AliITSReconstructor::GetRecoParam()->GetSAUseAllClusters()==kFALSE) { + if(!useAllClusters) { while (nentr--) { AliESDtrack *track=event->GetTrack(nentr); - if (track->GetStatus()&AliESDtrack::kITSin==AliESDtrack::kITSin){ + if ((track->GetStatus()&AliESDtrack::kITSin) == AliESDtrack::kITSin){ Int_t idx[12]; Int_t ncl = track->GetITSclusters(idx); for(Int_t k=0;kGetTrack(nentr); + if ((track->GetStatus()&AliESDtrack::kITSin) == AliESDtrack::kITSin){ + Int_t idx[12]; + Int_t ncl = track->GetITSclusters(idx); + for(Int_t k=0;kResetBit(kSAflag); + } + } + } } //Get primary vertex Double_t primaryVertex[3]; event->GetVertex()->GetXYZ(primaryVertex); //Creates TClonesArray with clusters for each layer. The clusters already used //by AliITStrackerMI are not considered - Int_t nclusters[6]={0,0,0,0,0,0}; - Int_t dmar[6]={0,0,0,0,0,0}; - if (fCluLayer == 0) { - fCluLayer = new TClonesArray*[AliITSgeomTGeo::GetNLayers()]; - fCluCoord = new TClonesArray*[AliITSgeomTGeo::GetNLayers()]; + Int_t nclusters[AliITSgeomTGeo::kNLayers]={0,0,0,0,0,0}; + Int_t dmar[AliITSgeomTGeo::kNLayers]={0,0,0,0,0,0}; + if (fCluCoord == 0) { + fCluCoord = new TClonesArray*[AliITSgeomTGeo::kNLayers]; for(Int_t i=0;iGetLayersToSkip(i)) { + if (!ForceSkippingOfLayer(i)) { for(Int_t cli=0;cliTestBit(kSAflag)==kTRUE) continue; //clusters used by TPC prol. if(cls->GetQ()==0) continue; //fake clusters dead zones + if(i>1 && cls->GetQ()<=fMinQ) continue; // cut on SDD and SSD cluster charge nclusters[i]++; } } dmar[i]=0; - delete fCluLayer[i]; - fCluLayer[i] = new TClonesArray("AliITSRecPoint",nclusters[i]); - delete fCluCoord[i]; - fCluCoord[i] = new TClonesArray("AliITSclusterTable",nclusters[i]); + if(!fCluCoord[i]){ + fCluCoord[i] = new TClonesArray("AliITSclusterTable",nclusters[i]); + }else{ + fCluCoord[i]->Delete(); + fCluCoord[i]->Expand(nclusters[i]); + } } for(Int_t ilay=0;ilayGetLayersToSkip(ilay)) { + if (!ForceSkippingOfLayer(ilay)) { for(Int_t cli=0;cliTestBit(kSAflag)==kTRUE) continue; if(cls->GetQ()==0) continue; + if(ilay>1 && cls->GetQ()<=fMinQ) continue; Double_t phi=0;Double_t lambda=0; - Float_t x=0;Float_t y=0;Float_t z=0; - Float_t sx=0;Float_t sy=0;Float_t sz=0; + Double_t x=0;Double_t y=0;Double_t z=0; + Double_t sx=0;Double_t sy=0;Double_t sz=0; GetCoorAngles(cls,phi,lambda,x,y,z,primaryVertex); GetCoorErrors(cls,sx,sy,sz); - new (clulay[dmar[ilay]]) AliITSRecPoint(*cls); new (clucoo[dmar[ilay]]) AliITSclusterTable(x,y,z,sx,sy,sz,phi,lambda,cli); dmar[ilay]++; } } + fCluCoord[ilay]->Sort(); } - Int_t minNPoints = (fSixPoints ? AliITSgeomTGeo::GetNLayers() : AliITSgeomTGeo::GetNLayers()-1); - for(Int_t i=0;iGetLayersToSkip(i)) { - minNPoints--; - } - } - - + // track counter Int_t ntrack=0; - //loop on the different windows - Int_t * nn = new Int_t[AliITSgeomTGeo::GetNLayers()];//counter for clusters on each layer - for(Int_t nloop=0;nloopGetEntries();ncl++){ //loop starting from layer 0 - - ResetForFinding(); - Int_t pflag=0; - - AliITSRecPoint* cl = (AliITSRecPoint*)fCluLayer[0]->At(ncl); - - if(!cl) continue; - if (cl->GetQ()<=0) continue; - - AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(0,ncl); - fPhic = arr->GetPhi(); - fLambdac = arr->GetLambda(); - if (TMath::Abs(fLambdac)>0.26*TMath::Pi()) continue; - fPhiEstimate = fPhic; - AliITStrackSA* trs = new AliITStrackSA(); - fPoint1[0]=primaryVertex[0]; - fPoint1[1]=primaryVertex[1]; - - - fPoint2[0]=arr->GetX(); - fPoint2[1]=arr->GetY(); - for(Int_t i=0;i0){ - pflag=1; - fPoint3[0] = fPointc[0]; - fPoint3[1] = fPointc[1]; - } - nn[2] = SearchClusters(2,fPhiWin[nloop],fLambdaWin[nloop],trs,primaryVertex[2],pflag); - if(nn[1]==0 && nn[2]==0) pflag=0; - if(nn[2]!=0 && nn[1]!=0){ pflag=1; UpdatePoints();} - if(nn[2]!=0 && nn[1]==0){ - pflag=1; - fPoint3[0]=fPointc[0]; - fPoint3[1]=fPointc[1]; - } - - nn[3] = SearchClusters(3,fPhiWin[nloop],fLambdaWin[nloop],trs,primaryVertex[2],pflag); - pflag=1; - if(nn[3]!=0) UpdatePoints(); - nn[4] = SearchClusters(4,fPhiWin[nloop],fLambdaWin[nloop],trs,primaryVertex[2],pflag); - pflag=1; - if(nn[4]!=0) UpdatePoints(); - nn[5] = SearchClusters(5,fPhiWin[nloop],fLambdaWin[nloop],trs,primaryVertex[2],pflag); - - - Int_t layOK=0; - //check of the candidate track - for(Int_t nnp=0;nnp=minNPoints) { - AliITStrackV2* tr2 = 0; - tr2 = FitTrack(trs,primaryVertex); - if(!tr2) continue; - - AliESDtrack outtrack; - outtrack.UpdateTrackParams(tr2,AliESDtrack::kITSin); - event->AddTrack(&outtrack); - ntrack++; - } - delete trs; - }//end loop on clusters of layer1 - //end loop2 + static Int_t nClusLay[AliITSgeomTGeo::kNLayers];//counter for clusters on each layer + Int_t startLayForSeed=0; + Int_t lastLayForSeed=fOuterStartLayer; + Int_t nSeedSteps=lastLayForSeed-startLayForSeed; + Int_t seedStep=1; + if(fInwardFlag){ + startLayForSeed=AliITSgeomTGeo::GetNLayers()-1; + lastLayForSeed=fInnerStartLayer; + nSeedSteps=startLayForSeed-lastLayForSeed; + seedStep=-1; } - delete[] nn; - - - minNPoints--; - - //if 5/6 points are required, second loop starting - //from second layer (SPD2), to find tracks with point of - //layer 1 missing - if(!fSixPoints) { - //printf("looking from SPD2\n"); - // counter for clusters on each layer - Int_t * nn = new Int_t[AliITSgeomTGeo::GetNLayers()-1]; - for(Int_t nloop=0;nloopGetEntries(); - while(ncl2--){ //loop starting from layer 2 - ResetForFinding(); - Int_t pflag=0; - AliITSRecPoint* cl = (AliITSRecPoint*)fCluLayer[1]->At(ncl2); - - if(!cl) continue; - AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(1,ncl2); - fPhic = arr->GetPhi(); - fLambdac = arr->GetLambda(); - fPhiEstimate = fPhic; - - AliITStrackSA* trs = new AliITStrackSA(); - fPoint1[0]=primaryVertex[0]; - fPoint1[1]=primaryVertex[1]; - - fPoint2[0]=arr->GetX(); - fPoint2[1]=arr->GetY(); - for(Int_t kk=0;kk=minNPoints){ // 5/6 - AliITStrackV2* tr2 = 0; - tr2 = FitTrack(trs,primaryVertex); - if(!tr2) continue; - - AliESDtrack outtrack; - outtrack.UpdateTrackParams(tr2,AliESDtrack::kITSin); - event->AddTrack(&outtrack); - ntrack++; - - } - - delete trs; - }//end loop on clusters of layer2 - } - - delete [] nn; - } //end opt="5/6" - - // search for tracks starting from SPD2, SDD1, SDD2, SSD2 - // for cosmics (A. Dainese 31.07.07) - if(fOuterStartLayer>0) { - for(Int_t innLay=1; innLay<=fOuterStartLayer; innLay++) { - //printf("Searching from layer %d outward\n",innLay); - minNPoints=AliITSgeomTGeo::GetNLayers()-innLay; - for(Int_t i=innLay;iGetLayersToSkip(i)) + // loop on minimum number of points + for(Int_t iMinNPoints=AliITSgeomTGeo::GetNLayers(); iMinNPoints>=fMinNPoints; iMinNPoints--) { + + // loop on starting layer for track finding + for(Int_t iSeedLay=0; iSeedLay<=nSeedSteps; iSeedLay++) { + Int_t theLay=startLayForSeed+iSeedLay*seedStep; + if(ForceSkippingOfLayer(theLay)) continue; + Int_t minNPoints=iMinNPoints-theLay; + if(fInwardFlag) minNPoints=iMinNPoints-(AliITSgeomTGeo::GetNLayers()-1-theLay); + for(Int_t i=theLay+1;iGetEntries(); - while(nclInnLay--){ //loop starting from layer innLay + Int_t nclTheLay=fCluCoord[theLay]->GetEntries(); + while(nclTheLay--){ ResetForFinding(); - Int_t pflag=0; - AliITSRecPoint* cl = (AliITSRecPoint*)fCluLayer[innLay]->At(nclInnLay); - - if(!cl) continue; - AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(innLay,nclInnLay); - fPhic = arr->GetPhi(); - fLambdac = arr->GetLambda(); - fPhiEstimate = fPhic; - - AliITStrackSA* trs = new AliITStrackSA(); - fPoint1[0]=primaryVertex[0]; - fPoint1[1]=primaryVertex[1]; - fPoint2[0]=arr->GetX(); - fPoint2[1]=arr->GetY(); - + Bool_t useRP=SetFirstPoint(theLay,nclTheLay,primaryVertex); + if(!useRP) continue; + AliITStrackSA trs; + + Int_t pflag=0; Int_t kk; - for(kk=0;kk=0; nnp--){ + if(nClusLay[nnp]!=0) layOK+=1; + } } if(layOK>=minNPoints){ + AliDebug(2,Form("---NPOINTS: %d; MAP: %d %d %d %d %d %d\n",layOK,nClusLay[0],nClusLay[1],nClusLay[2],nClusLay[3],nClusLay[4],nClusLay[5])); AliITStrackV2* tr2 = 0; - tr2 = FitTrack(trs,primaryVertex); - if(!tr2) continue; - - - AliESDtrack outtrack; - outtrack.UpdateTrackParams(tr2,AliESDtrack::kITSin); - event->AddTrack(&outtrack); + tr2 = FitTrack(&trs,primaryVertex); + if(!tr2){ + continue; + } + AliDebug(2,Form("---NPOINTS fit: %d\n",tr2->GetNumberOfClusters())); + + StoreTrack(tr2,event,useAllClusters); ntrack++; - + } - delete trs; - }//end loop on clusters of innLay + }//end loop on clusters of theLay } //end loop on window sizes - - delete [] nn; - } //end loop on innLay - } //end if(fOuterStartLayer>0) - + } //end loop on theLay + }//end loop on min points - // search for 1-point tracks, only for cosmics + // search for 1-point tracks in SPD, only for cosmics // (A.Dainese 21.03.08) if(AliITSReconstructor::GetRecoParam()->GetSAOnePointTracks() && TMath::Abs(event->GetMagneticField())<0.01) { - for(Int_t innLay=0; innLay<=fOuterStartLayer; innLay++) { + Int_t outerLayer=1; // only SPD + for(Int_t innLay=0; innLay<=TMath::Min(1,fOuterStartLayer); innLay++) { // counter for clusters on each layer - Int_t * nn = new Int_t[AliITSgeomTGeo::GetNLayers()-innLay]; + for(Int_t nloop=0;nloopGetEntries(); + Int_t nclInnLay=fCluCoord[innLay]->GetEntries(); while(nclInnLay--){ //loop starting from layer innLay ResetForFinding(); - Int_t pflag=0; - AliITSRecPoint* cl = (AliITSRecPoint*)fCluLayer[innLay]->At(nclInnLay); - - if(!cl) continue; - AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(innLay,nclInnLay); - fPhic = arr->GetPhi(); - fLambdac = arr->GetLambda(); - fPhiEstimate = fPhic; - - AliITStrackSA* trs = new AliITStrackSA(); - fPoint1[0]=primaryVertex[0]; - fPoint1[1]=primaryVertex[1]; - fPoint2[0]=arr->GetX(); - fPoint2[1]=arr->GetY(); - + Bool_t useRP=SetFirstPoint(innLay,nclInnLay,primaryVertex); + if(!useRP) continue; + AliITStrackSA trs; + + Int_t pflag=0; Int_t kk; - for(kk=0;kkGetNumberOfClusters())); - AliESDtrack outtrack; - outtrack.UpdateTrackParams(tr2,AliESDtrack::kITSin); - event->AddTrack(&outtrack); + StoreTrack(tr2,event,useAllClusters); ntrack++; } - delete trs; }//end loop on clusters of innLay } //end loop on window sizes - delete [] nn; } //end loop on innLay } // end search 1-point tracks - delete [] firstmod; - Info("FindTracks","Number of found tracks: %d",event->GetNumberOfTracks()); + if(!useAllClusters) AliInfo(Form("Number of found tracks: %d",event->GetNumberOfTracks())); + ResetForFinding(); return 0; } @@ -714,26 +461,24 @@ AliITStrackV2* AliITStrackerSA::FitTrack(AliITStrackSA* tr,Double_t *primaryVert // A.Dainese 16.11.07 - Int_t * firstmod = new Int_t[AliITSgeomTGeo::GetNLayers()]; - TObjArray** listlayer = new TObjArray*[AliITSgeomTGeo::GetNLayers()]; - Int_t ** clind=new Int_t*[AliITSgeomTGeo::GetNLayers()]; - Int_t ** clmark=new Int_t*[AliITSgeomTGeo::GetNLayers()]; - Int_t * nnn = new Int_t[AliITSgeomTGeo::GetNLayers()]; - Int_t * kkk = new Int_t[AliITSgeomTGeo::GetNLayers()]; + const Int_t kMaxClu=AliITStrackSA::kMaxNumberOfClusters; + + static Int_t firstmod[AliITSgeomTGeo::kNLayers]; + static Int_t clind[AliITSgeomTGeo::kNLayers][kMaxClu]; + static Int_t clmark[AliITSgeomTGeo::kNLayers][kMaxClu]; + static Int_t end[AliITSgeomTGeo::kNLayers]; + static Int_t indices[AliITSgeomTGeo::kNLayers]; - const Int_t maxclu=AliITStrackSA::GetMaxNumberOfClusters(); + static AliITSRecPoint *listlayer[AliITSgeomTGeo::kNLayers][kMaxClu]; for(Int_t i=0;iGetClusterIndexSA(ncl); AliITSRecPoint* cl = (AliITSRecPoint*)GetCluster(index); - if(cl->TestBit(kSAflag)==kTRUE) cl->ResetBit(kSAflag); Int_t lay = (index & 0xf0000000) >> 28; - listlayer[lay]->AddLast(cl); - Int_t ind=nnn[lay]; - clind[lay][ind]=index; + Int_t nInLay=end[lay]; + listlayer[lay][nInLay]=cl; + clind[lay][nInLay]=index; + end[lay]++; } - delete [] nnn; for(Int_t nlay=0;nlayGetNumberOfMarked(nlay);ncl++){ Int_t mark = tr->GetClusterMark(nlay,ncl); - Int_t ind=kkk[nlay]; - clmark[nlay][ind]=mark; + clmark[nlay][ncl]=mark; } } - delete [] kkk; Int_t firstLay=-1,secondLay=-1; - Int_t * end = new Int_t[AliITSgeomTGeo::GetNLayers()]; for(Int_t i=0;iGetEntries()==0) { + if(end[i]==0) { end[i]=1; - } else { - end[i]=listlayer[i]->GetEntries(); + }else{ if(firstLay==-1) { firstLay=i; } else if(secondLay==-1) { @@ -774,120 +514,52 @@ AliITStrackV2* AliITStrackerSA::FitTrack(AliITStrackSA* tr,Double_t *primaryVert } } - if(firstLay==-1 || (secondLay==-1 && !onePoint)) { - for(Int_t i=0;iAt(l0); + indices[0]=l0; for(Int_t l1=0;l1At(l1); + indices[1]=l1; for(Int_t l2=0;l2At(l2); + indices[2]=l2; for(Int_t l3=0;l3At(l3); + indices[3]=l3; for(Int_t l4=0;l4At(l4); + indices[4]=l4; for(Int_t l5=0;l5At(l5); - - - Double_t x1,y1,z1,sx1,sy1,sz1; - Double_t x2,y2,z2,sx2,sy2,sz2; - AliITSRecPoint* p1=0; - AliITSRecPoint* p2=0; - Int_t index1=0,index2=0; - Int_t mrk1=0,mrk2=0; - - switch(firstLay) { - case 0: - p1=cl0; - index1=clind[0][l0];mrk1=clmark[0][l0]; - break; - case 1: - p1=cl1; - index1=clind[1][l1];mrk1=clmark[1][l1]; - break; - case 2: - p1=cl2; - index1=clind[2][l2];mrk1=clmark[2][l2]; - break; - case 3: - p1=cl3; - index1=clind[3][l3];mrk1=clmark[3][l3]; - break; - case 4: - p1=cl4; - index1=clind[4][l4];mrk1=clmark[4][l4]; - break; - } + indices[5]=l5; - switch(secondLay) { - case 1: - p2=cl1; - index2=clind[1][l1];mrk2=clmark[1][l1]; - break; - case 2: - p2=cl2; - index2=clind[2][l2];mrk2=clmark[2][l2]; - break; - case 3: - p2=cl3; - index2=clind[3][l3];mrk2=clmark[3][l3]; - break; - case 4: - p2=cl4; - index2=clind[4][l4];mrk2=clmark[4][l4]; - break; - case 5: - p2=cl5; - index2=clind[5][l5];mrk2=clmark[5][l5]; - break; - default: - p2=0; - index2=-1;mrk2=-1; - break; - } + // estimate curvature from 2 innermost points (or innermost point + vertex) + + Int_t iFirstLay=indices[firstLay]; + Int_t mrk1=clmark[firstLay][iFirstLay]; + AliITSRecPoint* p1=(AliITSRecPoint*)listlayer[firstLay][iFirstLay]; Int_t module1 = p1->GetDetectorIndex()+firstmod[firstLay]; Int_t layer,ladder,detector; AliITSgeomTGeo::GetModuleId(module1,layer,ladder,detector); - Float_t yclu1 = p1->GetY(); - Float_t zclu1 = p1->GetZ(); + Double_t yclu1 = p1->GetY(); + Double_t zclu1 = p1->GetZ(); + + Double_t x1,y1,z1; + Double_t x2,y2,z2; Double_t cv=0,tgl2=0,phi2=0; - - Int_t cln1=mrk1; - AliITSclusterTable* arr1 = (AliITSclusterTable*)GetClusterCoord(firstLay,cln1); + AliITSclusterTable* arr1 = (AliITSclusterTable*)GetClusterCoord(firstLay,mrk1); x1 = arr1->GetX(); y1 = arr1->GetY(); z1 = arr1->GetZ(); - sx1 = arr1->GetSx(); - sy1 = arr1->GetSy(); - sz1 = arr1->GetSz(); if(secondLay>0) { - Int_t cln2=mrk2; - AliITSclusterTable* arr2 = (AliITSclusterTable*)GetClusterCoord(secondLay,cln2); + Int_t iSecondLay=indices[secondLay]; + Int_t mrk2=clmark[secondLay][iSecondLay]; + AliITSclusterTable* arr2 = (AliITSclusterTable*)GetClusterCoord(secondLay,mrk2); x2 = arr2->GetX(); y2 = arr2->GetY(); z2 = arr2->GetZ(); - sx2 = arr2->GetSx(); - sy2 = arr2->GetSy(); - sz2 = arr2->GetSz(); cv = Curvature(primaryVertex[0],primaryVertex[1],x1,y1,x2,y2); tgl2 = (z2-z1)/TMath::Sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); phi2 = TMath::ATan2((y2-y1),(x2-x1)); @@ -900,58 +572,39 @@ AliITStrackV2* AliITStrackerSA::FitTrack(AliITStrackSA* tr,Double_t *primaryVert phi2 = TMath::ATan2((y1-y2),(x1-x2)); } - - AliITStrackSA* trac = new AliITStrackSA(layer,ladder,detector,yclu1,zclu1,phi2,tgl2,cv,1); - - - if(cl5!=0) { - trac->AddClusterV2(5,(clind[5][l5] & 0x0fffffff)>>0); - trac->AddClusterMark(5,clmark[5][l5]); - } - if(cl4!=0){ - trac->AddClusterV2(4,(clind[4][l4] & 0x0fffffff)>>0); - trac->AddClusterMark(4,clmark[4][l4]); - } - if(cl3!=0){ - trac->AddClusterV2(3,(clind[3][l3] & 0x0fffffff)>>0); - trac->AddClusterMark(3,clmark[3][l3]); - } - if(cl2!=0){ - trac->AddClusterV2(2,(clind[2][l2] & 0x0fffffff)>>0); - trac->AddClusterMark(2,clmark[2][l2]); - } - if(cl1!=0){ - trac->AddClusterV2(1,(clind[1][l1] & 0x0fffffff)>>0); - trac->AddClusterMark(1,clmark[1][l1]); - } - if(cl0!=0){ - trac->AddClusterV2(0,(clind[0][l0] & 0x0fffffff)>>0); - trac->AddClusterMark(0,clmark[0][l0]); + // create track and attach it the RecPoints + AliITStrackSA trac(layer,ladder,detector,yclu1,zclu1,phi2,tgl2,cv,1); + for(Int_t iLay=5; iLay>=0; iLay--){ + Int_t iInLay=indices[iLay]; + AliITSRecPoint* cl=(AliITSRecPoint*)listlayer[iLay][iInLay]; + if(cl!=0){ + trac.AddClusterV2(iLay,(clind[iLay][iInLay] & 0x0fffffff)>>0); + trac.AddClusterMark(iLay,clmark[iLay][iInLay]); + } } //fit with Kalman filter using AliITStrackerMI::RefitAt() - AliITStrackMI* ot = new AliITStrackSA(*trac); - - ot->ResetCovariance(10.); - ot->ResetClusters(); + AliITStrackSA ot(trac); + + ot.ResetCovariance(10.); + ot.ResetClusters(); - if(RefitAt(AliITSRecoParam::GetrInsideITSscreen(),ot,trac)){ //fit from layer 1 to layer 6 - AliITStrackMI *otrack2 = new AliITStrackMI(*ot); - otrack2->ResetCovariance(10.); - otrack2->ResetClusters(); - //fit from layer 6 to layer 1 - if(RefitAt(AliITSRecoParam::GetrInsideSPD1(),otrack2,ot)) { - fListOfTracks->AddLast(otrack2); - new (tri[nlist]) AliITStrackSA(*trac); - nlist++; - } else { - delete otrack2; - } + // Propagate inside the innermost layer with a cluster + if(ot.Propagate(ot.GetX()-0.1*ot.GetX())) { + + if(RefitAt(AliITSRecoParam::GetrInsideITSscreen(),&ot,&trac)){ //fit from layer 1 to layer 6 + AliITStrackMI otrack2(ot); + otrack2.ResetCovariance(10.); + otrack2.ResetClusters(); + //fit from layer 6 to layer 1 + if(RefitAt(AliITSRecoParam::GetrInsideSPD1(),&otrack2,&ot)) { + new(arrMI[nFoundTracks]) AliITStrackMI(otrack2); + new(arrSA[nFoundTracks]) AliITStrackSA(trac); + ++nFoundTracks; + } - } - - delete ot; - delete trac; + } + } }//end loop layer 6 }//end loop layer 5 }//end loop layer 4 @@ -959,114 +612,91 @@ AliITStrackV2* AliITStrackerSA::FitTrack(AliITStrackSA* tr,Double_t *primaryVert }//end loop layer 2 }//end loop layer 1 - delete [] end; - Int_t dim=fListOfTracks->GetEntries(); - if(dim==0){ - for(Int_t i=0;iDelete(); - delete listSA; - delete [] firstmod; - return 0; - } + if(fListOfTracks->GetEntries()==0) return 0; - Int_t lowchi2 = FindTrackLowChiSquare(fListOfTracks,dim); + Int_t lowchi2 = FindTrackLowChiSquare(); AliITStrackV2* otrack =(AliITStrackV2*)fListOfTracks->At(lowchi2); - AliITStrackSA* trsa = (AliITStrackSA*)listSA->At(lowchi2); + AliITStrackSA* trsa = (AliITStrackSA*)fListOfSATracks->At(lowchi2); - if(otrack==0) { - for(Int_t i=0;iDelete(); - delete listSA; - delete [] firstmod; - delete [] clind; - delete [] clmark; - return 0; - } - Int_t * indexc = new Int_t[AliITSgeomTGeo::GetNLayers()]; - for(Int_t i=0;iGetNumberOfClusters();nind++){ - indexc[nind] = otrack->GetClusterIndex(nind); - } - Int_t labl[6][3]; - for(Int_t i=0;iGetNumberOfClusters()) { - AliITSRecPoint* cl = (AliITSRecPoint*)GetCluster(indexc[i]); - labl[i][0]=cl->GetLabel(0); - labl[i][1]=cl->GetLabel(1); - labl[i][2]=cl->GetLabel(2); - } else { - labl[i][0]=-1; - labl[i][1]=-1; - labl[i][2]=-1; - } - } - delete [] indexc; + if(otrack==0) return 0; CookLabel(otrack,0.); //MI change - to see fake ratio - - Int_t label=FindLabel(labl[0][0],labl[1][0],labl[2][0],labl[3][0],labl[4][0],labl[5][0]); - Int_t lflag=0; - for(Int_t i=0;iGetNumberOfClusters();i++) - if(labl[i][0]==label || labl[i][1]==label || labl[i][2]==label) lflag++; - - if(lflagGetNumberOfClusters()) label = -label; + Int_t label=FindLabel(otrack); otrack->SetLabel(label); + Double_t low=0.; + Double_t up=0.51; + otrack->CookdEdx(low,up); //remove clusters of found track for(Int_t nlay=0;nlayGetNumberOfMarked(nlay);cln++){ Int_t index = trsa->GetClusterMark(nlay,cln); - fCluLayer[nlay]->RemoveAt(index); RemoveClusterCoord(nlay,index); - fCluLayer[nlay]->Compress(); } } - listSA->Delete(); - delete listSA; - for(Int_t i=0;iGetModuleIndex(i)); + } + Double_t sdedx[4]={0.,0.,0.,0.}; + for(Int_t i=0; i<4; i++) sdedx[i]=t->GetSampledEdx(i); + outtrack.SetITSdEdxSamples(sdedx); + + + if(AliITSReconstructor::GetRecoParam()->GetSAUsedEdxInfo()){ + Double_t mom=t->P(); + Double_t ppid[AliPID::kSPECIES]; + for(Int_t isp=0;ispGetdEdx(); + Int_t ide=fITSPid->GetParticleIdFromdEdxVsP(mom,truncmean,kTRUE); + if(ide==AliPID::kProton){ + ppid[AliPID::kProton]=1.; + ppid[AliPID::kPion]=0.; + } + else if(ide==AliPID::kKaon){ + ppid[AliPID::kKaon]=1.; + ppid[AliPID::kPion]=0.; + } + } + outtrack.SetITSpid(ppid); + outtrack.SetESDpid(ppid); + } + event->AddTrack(&outtrack); + + return; +} //_______________________________________________________ Int_t AliITStrackerSA::SearchClusters(Int_t layer,Double_t phiwindow,Double_t lambdawindow, AliITStrackSA* trs,Double_t /*zvertex*/,Int_t pflag){ //function used to to find the clusters associated to the track - if(AliITSReconstructor::GetRecoParam()->GetLayersToSkip(layer)) return 0; + if(ForceSkippingOfLayer(layer)) return 0; + Int_t nc=0; AliITSlayer &lay = fgLayers[layer]; Double_t r=lay.GetR(); if(pflag==1){ - Float_t cx1,cx2,cy1,cy2; + Double_t cx1,cx2,cy1,cy2; FindEquation(fPoint1[0],fPoint1[1],fPoint2[0],fPoint2[1],fPoint3[0],fPoint3[1],fCoef1,fCoef2,fCoef3); if (FindIntersection(fCoef1,fCoef2,fCoef3,-r*r,cx1,cy1,cx2,cy2)==0) return 0; @@ -1076,36 +706,59 @@ Int_t AliITStrackerSA::SearchClusters(Int_t layer,Double_t phiwindow,Double_t la } - Int_t ncl = fCluLayer[layer]->GetEntries(); - for (Int_t index=0; indexAt(index); - if (!c) continue; - if (c->GetQ()<=0) continue; - - AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(layer,index); - Double_t phi = arr->GetPhi(); - if (TMath::Abs(phi-fPhiEstimate)>phiwindow) continue; - - Double_t lambda = arr->GetLambda(); - if (TMath::Abs(lambda-fLambdac)>lambdawindow) continue; - - if(trs->GetNumberOfClustersSA()==trs->GetMaxNumberOfClusters()) return 0; - if(trs->GetNumberOfMarked(layer)==trs->GetMaxNMarkedPerLayer()) return 0; - Int_t orind = arr->GetOrInd(); - trs->AddClusterSA(layer,orind); - trs->AddClusterMark(layer,index); - - nc++; - fLambdac=lambda; - fPhiEstimate=phi; - - fPointc[0]=arr->GetX(); - fPointc[1]=arr->GetY(); + Double_t phiExpect=fPhiEstimate; + Double_t lamExpect=fLambdac; + + Int_t ncl = fCluCoord[layer]->GetEntriesFast(); + Int_t startcl=FindIndex(layer,lamExpect-lambdawindow*1.02); + Int_t endcl=FindIndex(layer,lamExpect+lambdawindow*1.02)+1; + if(endcl>=ncl) endcl=ncl-1; + + for (Int_t index=startcl; index<=endcl; index++) { + //for (Int_t index=0; indexGetPhi(); + Double_t deltaPhi = phi-phiExpect; + if(deltaPhi>TMath::Pi()) deltaPhi-=2*TMath::Pi(); + else if(deltaPhi<-TMath::Pi()) deltaPhi+=2*TMath::Pi(); + if (TMath::Abs(deltaPhi)>phiwindow) continue; + + Double_t lambda = arr->GetLambda(); + if (TMath::Abs(lambda-lamExpect)>lambdawindow) continue; + + if(trs->GetNumberOfClustersSA()==trs->GetMaxNumberOfClusters()) return 0; + if(trs->GetNumberOfMarked(layer)==trs->GetMaxNMarkedPerLayer()) return 0; + Int_t orind = arr->GetOrInd(); + trs->AddClusterSA(layer,orind); + trs->AddClusterMark(layer,index); + nc++; + fLambdac=lambda; + fPhiEstimate=phi; + + fPointc[0]=arr->GetX(); + fPointc[1]=arr->GetY(); + } return nc; } +//________________________________________________________________ +Bool_t AliITStrackerSA::SetFirstPoint(Int_t lay, Int_t clu, Double_t* primaryVertex){ + // Sets the first point (seed) for tracking + + AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(lay,clu); + fPhic = arr->GetPhi(); + fLambdac = arr->GetLambda(); + fPhiEstimate = fPhic; + fPoint1[0]=primaryVertex[0]; + fPoint1[1]=primaryVertex[1]; + fPoint2[0]=arr->GetX(); + fPoint2[1]=arr->GetY(); + return kTRUE; +} + //________________________________________________________________ void AliITStrackerSA::UpdatePoints(){ //update of points for the estimation of the curvature @@ -1119,20 +772,27 @@ void AliITStrackerSA::UpdatePoints(){ } //___________________________________________________________________ -Int_t AliITStrackerSA::FindEquation(Float_t x1, Float_t y1, Float_t x2, Float_t y2, Float_t x3, Float_t y3,Float_t& a, Float_t& b, Float_t& c){ +Int_t AliITStrackerSA::FindEquation(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Double_t x3, Double_t y3,Double_t& a, Double_t& b, Double_t& c){ //given (x,y) of three recpoints (in global coordinates) //returns the parameters a,b,c of circonference x*x + y*y +a*x + b*y +c - - Float_t den = (x3-x1)*(y2-y1)-(x2-x1)*(y3-y1); + double dx31=x3-x1,dy31=y3-y1,dx21=x2-x1,dy21=y2-y1; + Double_t den = dx31*dy21-dx21*dy31; if(den==0) return 0; - a = ((y3-y1)*(x2*x2+y2*y2-x1*x1-y1*y1)-(y2-y1)*(x3*x3+y3*y3-x1*x1-y1*y1))/den; - b = -(x2*x2-x1*x1+y2*y2-y1*y1+a*(x2-x1))/(y2-y1); + else den = 1./den; + // + double r31 = -dx31*(x1+x3) - dy31*(y1+y3); + double r21 = -dx21*(x1+x2) - dy21*(y1+y2); + // + double da = r31*dy21 - r21*dy31; + double db = r21*dx31 - r31*dx21; + a = da*den; + b = db*den; c = -x1*x1-y1*y1-a*x1-b*y1; return 1; } //__________________________________________________________________________ - Int_t AliITStrackerSA::FindIntersection(Float_t a1, Float_t b1, Float_t c1, Float_t c2,Float_t& x1,Float_t& y1, Float_t& x2, Float_t& y2){ + Int_t AliITStrackerSA::FindIntersection(Double_t a1, Double_t b1, Double_t c1, Double_t c2,Double_t& x1,Double_t& y1, Double_t& x2, Double_t& y2){ //Finds the intersection between the circonference of the track and the circonference centered in (0,0) represented by one layer //c2 is -rlayer*rlayer @@ -1194,123 +854,93 @@ Double_t AliITStrackerSA::ChoosePoint(Double_t p1, Double_t p2, Double_t pp){ //_________________________________________________________________ -Int_t AliITStrackerSA::FindTrackLowChiSquare(TObjArray* tracklist, Int_t dim) const { - // returns track with lowers chi square - if(dim==1){ - //AliITStrackV2* trk = (AliITStrackV2*)tracklist->At(0); - //return trk; - return 0; - } - if(dim==0) return 0; - Double_t * chi2 = new Double_t[dim]; - Int_t * index = new Int_t[dim]; - for(Int_t i=0;iAt(i); - chi2[i]=trk->GetChi2(); - index[i]=i; - } - - Int_t w=0;Double_t value; - Int_t lp; - while(wGetEntries(); + if(dim<=1) return 0; + AliITStrackV2* trk = (AliITStrackV2*)fListOfTracks->At(0); + Double_t minChi2=trk->GetChi2(); + Int_t index=0; + for(Int_t i=1;iAt(i); + Double_t chi2=trk->GetChi2(); + if(chi2=0;i--) if(lb[i]==-1) num=i; - - while(kGetNumberOfClusters(); i++) { + Int_t indexc = track->GetClusterIndex(i); + AliITSRecPoint* cl = (AliITSRecPoint*)GetCluster(indexc); + Int_t iLayer=cl->GetLayer(); + for(Int_t k=0;k<3;k++){ + labl[iLayer][k]=cl->GetLabel(k); + if(labl[iLayer][k]<0) iNotLabel++; + } + } + if(iNotLabel==3*track->GetNumberOfClusters()) return -2; + + for(Int_t j1=0;j1=0 && labl[j1][k1]==labl[j2][k2] && cnts[j2][k2]>0){ + cnts[j2][k2]++; + cnts[j1][k1]=0; + } + } + } } - w++; } - - if(num<1) return -1; - return lb[num-1]; -} - -//_____________________________________________________________________________ -Int_t AliITStrackerSA::Label(Int_t gl1, Int_t gl2, Int_t gl3, Int_t gl4, Int_t gl5, Int_t gl6,Int_t gl7, Int_t gl8, Int_t gl9, Int_t gl10,Int_t gl11, -Int_t gl12, Int_t gl13, Int_t gl14,Int_t gl15, Int_t gl16, Int_t gl17, Int_t gl18, Int_t minNPoints){ - - - //function used to assign label to the found track. If track is fake, the label is negative - Int_t lb0[6] = {gl1,gl2,gl3,gl4,gl5,gl6}; - Int_t lb1[6] = {gl7,gl8,gl9,gl10,gl11,gl12}; - Int_t lb2[6] = {gl13,gl14,gl15,gl16,gl17,gl18}; - Int_t ll=FindLabel(lb0[0],lb0[1],lb0[2],lb0[3],lb0[4],lb0[5]); - Int_t lflag=0;Int_t num=6; - if(lb0[5]==-1 && lb1[5]==-1 && lb2[5]==-1) num=5; - for(Int_t i=0;icntMax && labl[j][k]>=0){ + cntMax=cnts[j][k]; + label=labl[j][k]; + } + } } - if(lflag>=minNPoints) return ll; - else return -ll; - + Int_t lflag=0; + for(Int_t i=0;iGetNumberOfClusters()) label = -label; + return label; } //_____________________________________________________________________________ -void AliITStrackerSA::SetCalculatedWindowSizes(Int_t n, Float_t phimin, Float_t phimax, Float_t lambdamin, Float_t lambdamax){ +void AliITStrackerSA::SetCalculatedWindowSizes(Int_t n, Double_t phimin, Double_t phimax, Double_t lambdamin, Double_t lambdamax){ // Set sizes of the phi and lambda windows used for track finding fNloop = n; if(fPhiWin) delete [] fPhiWin; if(fLambdaWin) delete [] fLambdaWin; fPhiWin = new Double_t[fNloop]; fLambdaWin = new Double_t[fNloop]; - Float_t stepPhi=(phimax-phimin)/(Float_t)(fNloop-1); - Float_t stepLambda=(lambdamax-lambdamin)/(Float_t)(fNloop-1); + Double_t stepPhi=(phimax-phimin)/(Double_t)(fNloop-1); + Double_t stepLambda=(lambdamax-lambdamin)/(Double_t)(fNloop-1); for(Int_t k=0;kGetRotMatrix(module,rot); Int_t lay,lad,det; fGeom->GetModuleId(module,lay,lad,det); - Float_t tx,ty,tz; fGeom->GetTrans(lay,lad,det,tx,ty,tz); + Double_t tx,ty,tz; fGeom->GetTrans(lay,lad,det,tx,ty,tz); Double_t alpha=TMath::ATan2(rot[1],rot[0])+TMath::Pi(); Double_t phi1=TMath::Pi()/2+alpha; if (lay==1) phi1+=TMath::Pi(); - Float_t cp=TMath::Cos(phi1), sp=TMath::Sin(phi1); - Float_t r=tx*cp+ty*sp; + Double_t cp=TMath::Cos(phi1), sp=TMath::Sin(phi1); + Double_t r=tx*cp+ty*sp; xyz= r*cp - cl->GetY()*sp; y= r*sp + cl->GetY()*cp; @@ -1388,7 +1022,7 @@ void AliITStrackerSA::GetCoorAngles(AliITSRecPoint* cl,Double_t &phi,Double_t &l } //________________________________________________________________________ -void AliITStrackerSA::GetCoorErrors(AliITSRecPoint* cl,Float_t &sx,Float_t &sy, Float_t &sz){ +void AliITStrackerSA::GetCoorErrors(AliITSRecPoint* cl,Double_t &sx,Double_t &sy, Double_t &sz){ //returns sigmax, y, z of cluster in global coordinates /* @@ -1400,7 +1034,7 @@ void AliITStrackerSA::GetCoorErrors(AliITSRecPoint* cl,Float_t &sx,Float_t &sy, Double_t phi=TMath::Pi()/2+alpha; if (lay==1) phi+=TMath::Pi(); - Float_t cp=TMath::Cos(phi), sp=TMath::Sin(phi); + Double_t cp=TMath::Cos(phi), sp=TMath::Sin(phi); */ Float_t covm[6]; cl->GetGlobalCov(covm); @@ -1413,3 +1047,27 @@ void AliITStrackerSA::GetCoorErrors(AliITSRecPoint* cl,Float_t &sx,Float_t &sy, sz = TMath::Sqrt(cl->GetSigmaZ2()); */ } + +//________________________________________________________________________ +Int_t AliITStrackerSA::FindIndex(Int_t lay, Double_t lamVal) const { + // Find the cluster at limit of lambda window + + Int_t base = 0; + Int_t last = fCluCoord[lay]->GetEntriesFast()-1; + if(last<0) return 0; + Int_t position; + Double_t lamfirst=((AliITSclusterTable*)fCluCoord[lay]->At(base))->GetLambda(); + if(lamfirst>lamVal) return base; + Double_t lamlast=((AliITSclusterTable*)fCluCoord[lay]->At(last))->GetLambda(); + if(lamlast<=lamVal) return last; + while (last >= base) { + position = (base+last) / 2; + Double_t a=((AliITSclusterTable*)fCluCoord[lay]->At(position))->GetLambda()-lamVal; + Double_t b=((AliITSclusterTable*)fCluCoord[lay]->At(position+1))->GetLambda()-lamVal; + if(a*b<=0) return position; + if(a>0) last = position; + else base = position; + } + return 0; +} +