]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITStrackSA.cxx
Changes related to the extraction of the V0 finder into a separate class (A. Dainese...
[u/mrichter/AliRoot.git] / ITS / AliITStrackSA.cxx
index d8ccd60607db41e68238aee54e70c23706c7c965..22d48dee36373ae35895e9774a6ef37992842389 100755 (executable)
@@ -20,7 +20,7 @@
 //  Origin:  Elisabetta Crescio                   //
 //  e-mail:  crescio@to.infn.it                   //
 //  it is a V2 track with a possible number       //
-//  of cluster equal to fgkMaxNumberOfClusters    //
+//  of cluster equal to kMaxNumberOfClusters    //
 ////////////////////////////////////////////////////
 
 #include "AliITSgeomTGeo.h"
@@ -37,7 +37,7 @@ fNSA(0)
   SetNumberOfClusters(0);
   SetNumberOfClustersSA(0);
   ResetIndexSA();
-  for(Int_t nlay=0;nlay<fgkLayers;nlay++){ 
+  for(Int_t nlay=0;nlay<AliITSgeomTGeo::GetNLayers();nlay++){ 
     SetNumberOfMarked(nlay,0);
   }
   ResetMarked();
@@ -51,7 +51,7 @@ fNSA(0){
 // Copy a V2 track into a SA track
   SetNumberOfClustersSA(0);
   ResetIndexSA();
-  for(Int_t nlay=0;nlay<fgkLayers;nlay++){ 
+  for(Int_t nlay=0;nlay<AliITSgeomTGeo::GetNLayers();nlay++){ 
     SetNumberOfMarked(nlay,0);
   }
   ResetMarked();
@@ -68,13 +68,13 @@ fNSA(t.fNSA){
   ResetMarked();
   Int_t number = t.GetNumberOfClustersSA();
   SetNumberOfClustersSA(number);
-  for(Int_t nlay=0;nlay<fgkLayers;nlay++){
+  for(Int_t nlay=0;nlay<AliITSgeomTGeo::GetNLayers();nlay++){
     SetNumberOfMarked(nlay,t.GetNumberOfMarked(nlay));
   }
   for(Int_t i=0;i<number;i++){
     fSain[i]=t.fSain[i];
   }
-  for(Int_t nlay=0;nlay<fgkLayers;nlay++){
+  for(Int_t nlay=0;nlay<AliITSgeomTGeo::GetNLayers();nlay++){
     for(Int_t i=0;i<t.GetNumberOfMarked(nlay);i++){
       fCluMark[nlay][i]=t.fCluMark[nlay][i];
     }
@@ -88,28 +88,18 @@ fNSA(0)
 
   // get the azimuthal angle of the detector containing the innermost
   // cluster of this track (data member fAlpha)
-  Double_t rotmatr[9];
-  AliITSgeomTGeo::GetRotation(layer,ladder,detector,rotmatr);
-  Double_t sAlpha=TMath::ATan2(rotmatr[1],rotmatr[0])+TMath::Pi();
-  sAlpha+=TMath::Pi()/2.;
-  if(layer==1) sAlpha+=TMath::Pi();
 
+  TGeoHMatrix m; AliITSgeomTGeo::GetOrigMatrix(layer,ladder,detector,m);
+  const TGeoHMatrix *tm=AliITSgeomTGeo::GetTracking2LocalMatrix(layer,ladder,detector);
+  m.Multiply(tm);
+  Double_t txyz[3]={0.}, xyz[3]={0.};
+  m.LocalToMaster(txyz,xyz);
+  Double_t sAlpha=TMath::ATan2(xyz[1],xyz[0]);
 
-  // get the radius of this detector. Procedure taken from the 
-  // AliITStrackerV2 constructor
-  Float_t x=0,y=0,z=0;
-  Double_t xyz[3];
-  AliITSgeomTGeo::GetTranslation(layer,ladder,detector,xyz);
-  x=xyz[0];
-  y=xyz[1];
-  z=xyz[2];
-
-  Double_t fi=TMath::ATan2(rotmatr[1],rotmatr[0])+TMath::Pi();
-  fi+=TMath::Pi()/2;
-  if (layer==1) fi+=TMath::Pi();
-  Double_t cp=TMath::Cos(fi), sp=TMath::Sin(fi);
-  Double_t sX=x*cp+y*sp;
+  if (sAlpha<0) sAlpha+=TMath::TwoPi();
+  else if (sAlpha>=TMath::TwoPi()) sAlpha-=TMath::TwoPi();
 
+  Double_t sX=TMath::Sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]);
 
   fdEdx = 0;
 
@@ -136,15 +126,23 @@ fNSA(0)
                   tanlambda,
                   curv/conv};
 
+
+  // dealing with the case B=0 (taken from AliTPCtrack.cxx)
+  Double_t mostProbablePt=AliExternalTrackParam::GetMostProbablePt();
+  Double_t p0=TMath::Sign(1/mostProbablePt,sP[4]);
+  Double_t w0=sC[14]/(sC[14] + p0*p0), w1=p0*p0/(sC[14] + p0*p0);
+  sP[4] = w0*p0 + w1*sP[4];
+  sC[14]*=w1;
+                                                                              
   Set(sX,sAlpha,sP,sC);
 
-  for(Int_t i=0; i<kMaxLayer; i++) fIndex[i] = 0;  // to be set explicitely
+  for(Int_t i=0; i<AliITSgeomTGeo::GetNLayers(); i++) fIndex[i] = 0;  // to be set explicitely
 
   for(Int_t i=0; i<4; i++) fdEdxSample[i] = 0; 
 
   SetNumberOfClusters(0);
   SetNumberOfClustersSA(0);
-  for(Int_t nlay=0;nlay<fgkLayers;nlay++) SetNumberOfMarked(nlay,0);
+  for(Int_t nlay=0;nlay<AliITSgeomTGeo::GetNLayers();nlay++) SetNumberOfMarked(nlay,0);
   ResetIndexSA();
   ResetMarked();
   SetChi2(0);
@@ -155,9 +153,9 @@ fNSA(0)
 
 //____________________________________________________________
 void AliITStrackSA::AddClusterSA(Int_t layer, Int_t clnumb) {
-  // add one clusters to the list (maximum number=fgkMaxNumberOfClusters)
+  // add one clusters to the list (maximum number=kMaxNumberOfClusters)
   Int_t presnum = GetNumberOfClustersSA();
-  if(presnum>=fgkMaxNumberOfClusters){
+  if(presnum>=kMaxNumberOfClusters){
     Warning("AddClusterSA","Maximum number of clusters already reached. Nothing is done\n");
     return;
   }
@@ -169,10 +167,10 @@ void AliITStrackSA::AddClusterSA(Int_t layer, Int_t clnumb) {
 
 //____________________________________________________________
 void AliITStrackSA::AddClusterMark(Int_t layer, Int_t clnumb) {
-  // add one clusters to the list (maximum number=fgkMaxNumberOfClusters)
+  // add one clusters to the list (maximum number=kMaxNumberOfClusters)
   Int_t presnum = GetNumberOfMarked(layer);
   //  printf("presnum=%d\n",presnum);
-  if(presnum>=fgkMaxNumberOfClustersL){
+  if(presnum>=kMaxNumberOfClustersL){
     Warning("AddClusterMark","Maximum number of clusters already reached. Nothing is done\n");
     return;
   }
@@ -186,7 +184,7 @@ void AliITStrackSA::AddClusterMark(Int_t layer, Int_t clnumb) {
 void AliITStrackSA::AddClusterV2(Int_t layer,Int_t clnumb) {
   // add one clusters to the list (maximum number=6)
   Int_t presnum = GetNumberOfClusters();
-  if(presnum>=kMaxLayer){
+  if(presnum>=AliITSgeomTGeo::GetNLayers()){
     Warning("AddClusterV2","Maximum number of clusters already reached. Nothing is done\n");
     return;
    }    
@@ -200,21 +198,8 @@ void AliITStrackSA::AddClusterV2(Int_t layer,Int_t clnumb) {
 void AliITStrackSA::ResetMarked(){
 
   //Reset array of marked clusters
-  for(Int_t nlay=0;nlay<fgkLayers;nlay++){
-    for(Int_t k=0; k<fgkMaxNumberOfClustersL; k++) fCluMark[nlay][k]=0;
+  for(Int_t nlay=0;nlay<AliITSgeomTGeo::GetNLayers();nlay++){
+    for(Int_t k=0; k<kMaxNumberOfClustersL; k++) fCluMark[nlay][k]=0;
   }
 }
 
-
-
-
-
-
-
-
-
-
-
-
-
-