]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSTrackV1.cxx
Removing obsolete macros
[u/mrichter/AliRoot.git] / ITS / AliITSTrackV1.cxx
index d600acbd1dc015141112987599514dfc36300274..f718f71cfd0a92d7a481ce73e511a10ae743ae20 100644 (file)
@@ -4,7 +4,7 @@
 // The track is mainly caracterized by the state vector of elements (fX0, fX1, fX2, fX3, fX4) and the
 // corresponding covariance matrix of elements (C00, C10, ..... C44) that is triangular
 //
-#include <iostream.h>
+#include <Riostream.h>
 #include <TMath.h>
 #include <TVector.h>
 #include <TObjArray.h>
@@ -12,7 +12,7 @@
 #include "AliITSRad.h"
 #include "AliITSTrackV1.h"
 #include "AliGenerator.h"
-#include "AliMagF.h"
+//#include "AliMagF.h"
 
 
 ClassImp(AliITSTrackV1)
@@ -21,27 +21,53 @@ AliITSTrackV1::AliITSTrackV1() {
 //Origin  A. Badala' and G.S. Pappalardo:  e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it 
 // default constructor   
  
+  fTPCtrack = 0;
   fC00=fC10=fC11=fC20=fC21=fC22=fC30=fC31=fC32=fC33=fC40=fC41=fC42=fC43=fC44=0.;
-  flistCluster = new TObjArray; 
+  flistCluster = 0;   
+  fNumClustInTrack =0;
+  fChi2=-1;
+  flabel =0;
+  fLayer = -1; 
+  fClusterInTrack = 0; 
+  frtrack=0.;
+  fnoclust=0;
+  fMass=0.13956995; //a pion by default
+  fFieldFactor = 0.0;
+  fdEdx = 0.;                          // oggi
+  Int_t ia=0;                          // oggi
+  for( ia=0; ia<4; ia++) fcor[ia]=0.;  // oggi
+  
+}
+AliITSTrackV1::AliITSTrackV1(const char *opt, Double_t fieldfactor) {
+//Origin  A. Badala' and G.S. Pappalardo:  e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it 
+// default constructor   
+  fTPCtrack = 0;
+  fC00=fC10=fC11=fC20=fC21=fC22=fC30=fC31=fC32=fC33=fC40=fC41=fC42=fC43=fC44=0.;
+  flistCluster = 0;   
   fNumClustInTrack =0;
   fChi2=-1;
   flabel =0; 
   fVertex.ResizeTo(3); 
   fErrorVertex.ResizeTo(3);
   fLayer = -1; 
-  fClusterInTrack = new TMatrix(6,9);
-  Int_t i;
-  for(i=0; i<6; i++) (*fClusterInTrack)(i,6)=(*fClusterInTrack)(i,7)=
-                           (*fClusterInTrack)(i,8)=-1.;
-  frtrack=0.; 
+  fClusterInTrack = 0; 
+  frtrack=0.;
+  fnoclust=0;     
   fd2.ResizeTo(6);
   ftgl2.ResizeTo(6); 
   fdtgl.ResizeTo(6);
+  fMass=0.13956995; //a pion by default
+  fdEdx = 0.;
+  Int_t ia=0;
+  for( ia=0; ia<4; ia++) fcor[ia]=0.;   
+
   
 //////////////////////////////////////// gets magnetic field factor ////////////////////////////////
 
-  AliMagF * fieldPointer = gAlice->Field();
-  fFieldFactor = (Double_t)fieldPointer->Factor();
+ // AliMagF * fieldPointer = gAlice->Field();
+  // fFieldFactor =(Double_t)fieldPointer-> SolenoidField()/10/.2;
+    fFieldFactor = fieldfactor;
   //cout<< " field factor = "<<fFieldFactor<<"\n"; getchar();
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -55,9 +81,10 @@ AliITSTrackV1::AliITSTrackV1(const AliITSTrackV1 &cobj) {
 // copy constructor    
 
   fClusterInTrack = new TMatrix(6,9);
-  Int_t i;
-  for(i=0; i<6; i++) (*fClusterInTrack)(i,6)=(*fClusterInTrack)(i,7)=
-                           (*fClusterInTrack)(i,8)=-1.;
+  Int_t i,j;
+  for(i=0; i<6; i++){
+  for(j=0; j<9; j++) (*fClusterInTrack)(i,j)=-1.;   
+  }  
   flistCluster = new TObjArray; 
   fVertex.ResizeTo(3); 
   fErrorVertex.ResizeTo(3);
@@ -80,6 +107,11 @@ AliITSTrackV1::AliITSTrackV1(const AliITSTrackV1 &cobj) {
   fd2=cobj.fd2;
   ftgl2=cobj.ftgl2;
   fdtgl=cobj.fdtgl;
+  fnoclust=cobj.fnoclust; 
+  fdEdx = cobj.fdEdx;
+  Int_t ia=0;
+  for( ia=0; ia<4; ia++) fcor[ia]=cobj.fcor[ia];    
+
     
   fC00=cobj.fC00; fC10=cobj.fC10; fC11=cobj.fC11; fC20=cobj.fC20; fC21=cobj.fC21;
   fC22=cobj.fC22; fC30=cobj.fC30; fC31=cobj.fC31; fC32=cobj.fC32; fC33=cobj.fC33; 
@@ -88,22 +120,24 @@ AliITSTrackV1::AliITSTrackV1(const AliITSTrackV1 &cobj) {
   *fClusterInTrack = *cobj.fClusterInTrack;
   
   fFieldFactor=cobj.fFieldFactor;
+  fMass=cobj.fMass; 
+   
   for(i=0; i<cobj.flistCluster->GetSize(); i++) 
     flistCluster->AddLast(cobj.flistCluster->At(i));
  
 }
 
-AliITSTrackV1::AliITSTrackV1(AliTPCtrack &obj)
+AliITSTrackV1::AliITSTrackV1(AliTPCtrack &obj, Double_t fieldfactor)
 { 
 //Origin  A. Badala' and G.S. Pappalardo:  e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it 
 // special constructor to convert a TPC track into an ITS track
 
 //////////////////////////////////////// gets magnetic field factor ////////////////////////////////
 
-  AliMagF * fieldPointer = gAlice->Field();
-  fFieldFactor = (Double_t)fieldPointer->Factor();
-  //cout<< " field factor = "<<fFieldFactor<<"\n"; getchar();
+   // AliMagF * fieldPointer = gAlice->Field();
+  // fFieldFactor =(Double_t)fieldPointer-> SolenoidField()/10/.2;
+    fFieldFactor = fieldfactor;
+ // cout<< " field factor dentro alitrack = "<<fFieldFactor<<"\n";/* getchar();*/
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -125,14 +159,18 @@ AliITSTrackV1::AliITSTrackV1(AliTPCtrack &obj)
   fVertex(2)=(Double_t)vzg;    
   
   fLayer = 7;
-  //fmCovariance = new TMatrix(5,5);
   fClusterInTrack = new TMatrix(6,9);
   
-  Int_t i;
-  for(i=0; i<6; i++) (*fClusterInTrack)(i,6)=(*fClusterInTrack)(i,7)=
-                           (*fClusterInTrack)(i,8)=-1.;
+  Int_t i,j;
+  for(i=0; i<6; i++){
+  for(j=0; j<9; j++) (*fClusterInTrack)(i,j)=-1.;   
+  }  
   flistCluster = new TObjArray; 
-  fNumClustInTrack = 0; 
+  fNumClustInTrack = 0;
+  fnoclust=0;
+  fdEdx = 0.;
+  Int_t ia=0;
+  for( ia=0; ia<4; ia++) fcor[ia]=0.;          
   LmTPC(); 
 
 }
@@ -142,7 +180,10 @@ AliITSTrackV1::~AliITSTrackV1() {
 //Origin  A. Badala' and G.S. Pappalardo:  e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it 
 //destructor
  
-  if(flistCluster) delete flistCluster; 
+  if(flistCluster) {
+    flistCluster->Delete();
+    delete flistCluster;
+  }
   if(fClusterInTrack) delete fClusterInTrack;
 
 }     
@@ -216,7 +257,6 @@ void AliITSTrackV1::LmTPC() {
   Double_t xo,yo, signy;
   Double_t r = 1./cTPC;
   xo =  etaTPC / cTPC;
-  fxoTPC=xo;
   Double_t yo1, yo2, diffsq1, diffsq2;  
   yo1 = yTPC +  TMath::Sqrt(r*r - (xl-xo)*(xl-xo)); 
   yo2 = yTPC -  TMath::Sqrt(r*r - (xl-xo)*(xl-xo));   
@@ -230,22 +270,8 @@ void AliITSTrackV1::LmTPC() {
   y0m = xo * sina + yo * cosa;  
 
   frtrack=TMath::Sqrt(xm*xm+ym*ym);
-  Double_t pigre=TMath::Pi();
-  Double_t phi=0.0;
-  if(ym == 0. || xm == 0.) {
-    if(ym == 0. && xm == 0.) {cout << "  Error in AliITSTrackV1::LmTPC x=0 and y=0 \n"; getchar();}
-    if(ym ==0. && xm>0.) phi=0.;
-    if(ym==0. && xm<0.) phi=pigre;
-    if(xm==0 && ym>0.) phi=pigre/2.;
-    if(xm==0 && ym<0.) phi=1.5*pigre;   
-  }
-  else {
-    if (xm>0. && ym>0.) phi=TMath::ATan(ym/xm);
-    if (xm<0. && ym>0.) phi=pigre+TMath::ATan(ym/xm);
-    if (xm<0. && ym<0.) phi=pigre+TMath::ATan(ym/xm); 
-    if (xm>0. && ym<0.) phi=(2*pigre)+TMath::ATan(ym/xm);     
-  };
-  if(phi<0. || phi>(2*pigre)) {cout<<"attention error on phi in  AliITSTrackV1:LmTPC \n"; getchar();}  
+       
+  Double_t phi=TMath::ATan2(ym,xm);  if(phi<0) phi=2.*TMath::Pi()+phi;     
 
   fX0=phi;
   fX1=zm;
@@ -302,7 +328,6 @@ void AliITSTrackV1::LmTPC() {
   fC43=cov[13];
   fC44=cov[9];
   
-  //cout<<" C32 e C44 = "<<fC32<<" "<<fC44<<"\n"; getchar();
    
 }
 
@@ -311,7 +336,10 @@ AliITSTrackV1 &AliITSTrackV1::operator=(AliITSTrackV1 obj) {
 //Origin  A. Badala' and G.S. Pappalardo:  e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it  
 // assignement operator
 
-  delete flistCluster;
+  if (flistCluster) {
+    flistCluster->Delete();
+    delete flistCluster;
+  }
   delete fClusterInTrack;
   fClusterInTrack = new TMatrix(6,9);
   flistCluster = new TObjArray; 
@@ -330,12 +358,18 @@ AliITSTrackV1 &AliITSTrackV1::operator=(AliITSTrackV1 obj) {
   fsigmaZv=obj.fsigmaZv;
   fd2=obj.fd2;
   ftgl2=obj.ftgl2; 
-  fdtgl=obj.fdtgl; 
+  fdtgl=obj.fdtgl;
+  fnoclust=obj.fnoclust; 
   
   fC00=obj.fC00; fC10=obj.fC10; fC11=obj.fC11; fC20=obj.fC20; fC21=obj.fC21;
   fC22=obj.fC22; fC30=obj.fC30; fC31=obj.fC31; fC32=obj.fC32; fC33=obj.fC33; 
-  fC40=obj.fC40; fC41=obj.fC41; fC42=obj.fC42; fC43=obj.fC43; fC44=obj.fC44; 
-  
+  fC40=obj.fC40; fC41=obj.fC41; fC42=obj.fC42; fC43=obj.fC43; fC44=obj.fC44;
+   
+  fMass=obj.fMass; 
+  fdEdx = obj.fdEdx; 
+  Int_t ia=0;
+  for( ia=0; ia<4; ia++) fcor[ia]=obj.fcor[ia];   
+
   
   *fClusterInTrack = *obj.fClusterInTrack;
   Int_t i;
@@ -486,6 +520,8 @@ void AliITSTrackV1::AddEL(AliITSRad *rl, Double_t signdE, Bool_t flagtot, Double
 //Origin  A. Badala' and G.S. Pappalardo:  e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it  
 //  add energy loss
 
+  mass=fMass;  
+  
   TVector s(6);  
   s(0)=0.0026+0.00283; s(1)=0.018; s(2)=0.0094; s(3)=0.0095; s(4)=0.0091; s(5)=0.0087;
   //s(0)=0.0026+0.00283*2.; s(1)=0.018*2.; s(2)=0.0094; s(3)=0.0095; s(4)=0.0091; s(5)=0.0087;
@@ -493,8 +529,8 @@ void AliITSTrackV1::AddEL(AliITSRad *rl, Double_t signdE, Bool_t flagtot, Double
 
   //for(int k=0; k<6; k++) cout<<s(k)<<" "; cout<<"\n";
   Int_t k;
-  for(k=0; k<6; k++) s(k)=s(k)*1.6;    //forint
+  //for(k=0; k<6; k++) s(k)=s(k)*1.6;    //forint
+  for(k=0; k<6; k++) s(k)=s(k)*1.7;    //forint
   
   Double_t phi=fX0;
   
@@ -502,7 +538,7 @@ void AliITSTrackV1::AddEL(AliITSRad *rl, Double_t signdE, Bool_t flagtot, Double
   if(phi>6.1 ) s(5)=s(5)+0.012; // to take into account rail 
   if(phi>2.96 && phi<3.31 ) s(5)=s(5)+0.012;   
   
-   
+  /* 
   Double_t tgl=fX3;
   Double_t theta=((TMath::Pi())/2.)-TMath::ATan(tgl);
   //phi*=180./TMath::Pi();
@@ -521,7 +557,7 @@ void AliITSTrackV1::AddEL(AliITSRad *rl, Double_t signdE, Bool_t flagtot, Double
   if(i>=imax) i=imax-1;
   if(j<0) j=0;
   if(j>=jmax) j=jmax-1;
-  /*
+  
   s(0) = 0.0028/TMath::Sin(theta)+( rl->GetRadMatrix1() )(i,j);   // 0.0028 takes into account the beam pipe
   s(1) = ( rl->GetRadMatrix2() )(i,j);
   s(2) = ( rl->GetRadMatrix3() )(i,j);
@@ -538,7 +574,7 @@ void AliITSTrackV1::AddEL(AliITSRad *rl, Double_t signdE, Bool_t flagtot, Double
   //if(theta<45 || theta>135) {cout<<" theta = "<<theta<<"\n"; getchar();}
   //cout<<" dentro AddEl: phi, theta = "<<phi<<" "<<theta<<"\n"; getchar(); 
     
-  Double_t cl=1.+fX3*fX3;  // cl=1/(cosl)**2 = 1 + (tgl)**2 
+  Double_t cl=1.+fX3*fX3;  // cl=1/(cosl)**2 = 1 + (tgl)**2
   Double_t sqcl=TMath::Sqrt(cl);
   Double_t pt=GetPt();
      
@@ -586,10 +622,12 @@ void  AliITSTrackV1::Correct(Double_t rk) {
                
 }
 
-void AliITSTrackV1::AddMS(AliITSRad *rl) {
+void AliITSTrackV1::AddMS(AliITSRad *rl, Double_t mass) {
 //Origin  A. Badala' and G.S. Pappalardo:  e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it       
 //////////   Modification of the covariance matrix to take into account multiple scattering  ///////////     
    
+  mass=fMass;
   TVector s(6);
 
   s(0)=0.0026+0.00283; s(1)=0.018; s(2)=0.0094; s(3)=0.0095; s(4)=0.0091; s(5)=0.0087;
@@ -597,14 +635,17 @@ void AliITSTrackV1::AddMS(AliITSRad *rl) {
 //0.00277 is added in the first layer to take into account the energy loss in the beam pipe 
 
   Int_t k;
-  for(k=0; k<6; k++) s(k)=s(k)*1.6;   // forint
+  //for(k=0; k<6; k++) s(k)=s(k)*1.6;   // forint
+  for(k=0; k<6; k++) s(k)=s(k)*1.7;   // forint
   
   Double_t phi=fX0;
  if(phi<0.174 ) s(5)=s(5)+0.012; //aggiunta provvisoria
   if(phi>6.1 ) s(5)=s(5)+0.012; //aggiunta provvisoria  
    if(phi>2.96 && phi< 3.31) s(5)=s(5)+0.012; //aggiunta provvisoria 
+  
       
   Double_t tgl=fX3;
+  /*
   Double_t theta=((TMath::Pi())/2.)-TMath::ATan(tgl);
   Double_t rad40=(TMath::Pi())*40./180.;      // rivedere
   Double_t rad100=(TMath::Pi())*100/180;
@@ -618,7 +659,7 @@ void AliITSTrackV1::AddMS(AliITSRad *rl) {
   if(i>=imax) i=imax-1;
   if(j<0) j=0;
   if(j>=jmax) j=jmax-1;
-  /*
+  
   s(0) = 0.0028/TMath::Sin(theta)+( rl->GetRadMatrix1() )(i,j);   // 0.0028 takes into account the beam pipe
   s(1) = ( rl->GetRadMatrix2() )(i,j);
   s(2) = ( rl->GetRadMatrix3() )(i,j);
@@ -626,7 +667,7 @@ void AliITSTrackV1::AddMS(AliITSRad *rl) {
   s(4) = ( rl->GetRadMatrix5() )(i,j);
   s(5) = ( rl->GetRadMatrix6() )(i,j);
    */   
-  Double_t mass=0.1396;
+  //Double_t mass=0.1396;
   Int_t layer=(Int_t)GetLayer();
   
   Double_t cosl=TMath::Cos(TMath::ATan(tgl));  
@@ -644,7 +685,8 @@ void AliITSTrackV1::AddMS(AliITSRad *rl) {
                
   Double_t p2=(GetPt()*GetPt())/(cosl*cosl);
   Double_t beta2=p2/(p2+mass*mass);
-  Double_t theta2=14.1*14.1/(beta2*p2*1.e6)*(s(layer-1)/cosl);
+ // Double_t theta2=14.1*14.1/(beta2*p2*1.e6)*(s(layer-1)/cosl);
+   Double_t theta2=14.1*14.1/(beta2*p2*1.e6)*(s(layer-1)/TMath::Abs(cosl));
 
   fC22+=theta2*(q40*q40+q41*q41);
   fC32+=theta2*q20*q40;
@@ -741,4 +783,19 @@ Double_t AliITSTrackV1::ArgC(Double_t rk) const {
 }
 
 
-
+Double_t AliITSTrackV1::GetPredChi2(Double_t m[2], Double_t sigma[2] ) const {
+//Origin  A. Badala' and G.S. Pappalardo:  e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it
+// This function calculates a predicted chi2 increment.
+  Double_t r00=sigma[0], r01=0., r11=sigma[1];
+  r00+=fC00; r01+=fC10; r11+=fC11;
+  Double_t det=r00*r11-r01*r01;
+  if(TMath::Abs(det) < 1.e-15) {cout<<" Problems on matrix in GetPredChi2 "<<det<<"\n";
+  return 1e10;}
+  Double_t tmp=r00; r00=r11; r11=tmp; r01=-r01;
+  Double_t dphi=m[0]-fX0; 
+  Double_t dz=m[1]-fX1;
+  Double_t chi2 = (dphi*r00*dphi +2.*r01*dphi*dz + dz*r11*dz)/det;
+  return chi2;
+  
+}