]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
1. Adding sorting of the Points in point array
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 11 Jun 2009 21:33:58 +0000 (21:33 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 11 Jun 2009 21:33:58 +0000 (21:33 +0000)
2. Adding drift velocity global y scaling

TPC/AliTPCTransformation.cxx
TPC/AliTPCTransformation.h
TPC/AliTPCkalmanFit.cxx
TPC/AliTPCkalmanFit.h

index 20d3b2eb308ae5555c1166b5ee0d393beaf76e16..9536c3a4a261547221f94e511e76bea9572feeb2 100644 (file)
@@ -71,6 +71,7 @@ Int_t  AliTPCTransformation::BuildBasicFormulas(){
   RegisterFormula("TPCscalingROFC",(GenFuncG)(AliTPCTransformation::TPCscalingROFC));
   //
   RegisterFormula("TPCscalingZDr",(GenFuncG)(AliTPCTransformation::TPCscalingZDr));
+  RegisterFormula("TPCscalingZDrGy",(GenFuncG)(AliTPCTransformation::TPCscalingZDrGy));
   RegisterFormula("TPCscalingPhiLocal",(GenFuncG)(AliTPCTransformation::TPCscalingPhiLocal));
   //
   // TPC Local X and Y misalignment + rotation 
@@ -329,6 +330,21 @@ Double_t  AliTPCTransformation::TPCscalingZDr(Double_t *xyz, Double_t * param){
   return deltaZ*xyz[3];
 }
 
+
+Double_t  AliTPCTransformation::TPCscalingZDrGy(Double_t *xyz, Double_t * param){
+  //
+  //
+  // Scaling and shift of TPC radius
+  // xyz[0..2] - global xyz of point 
+  // xyz[3]    - scale parameter
+  Double_t driftP  = TMath::Power(1. - TMath::Abs(xyz[2]/250.), param[0]);
+  Double_t gy      = xyz[1]/250.;
+  Double_t deltaZ  = (xyz[2]>0) ? -driftP : driftP;
+  return deltaZ*xyz[3]*gy;
+}
+
+
+
 Double_t  AliTPCTransformation::TPCscalingPhiLocal(Double_t *xyz, Double_t * param){
   //
   //
@@ -532,51 +548,71 @@ Double_t AliTPCTransformation::TPClocaldRzdGY(Double_t *xyz, Double_t * param){
 }
 
 
-Double_t        AliTPCTransformation::TPCDeltaZ(Double_t *xyz, Double_t * param){
+
+Double_t        AliTPCTransformation::TPCDeltaZMediumLong(Double_t *xyz, Double_t * /*param*/){
   //
   // xyz - [0..2] - position 
   //        [3]    - scale parameter
   //        [4]    - volID
-  // return delta in global coordiante system
+  // return delta in global coordinate system 
   //
   Int_t    sector = TMath::Nint(xyz[4]);
   Double_t signZ  = (sector%36<18) ? 1: -1;  // drift direction
-  return signZ*xyz[3];     // IROC shift
+  if    (sector<36) return 0;     
+  //
+  const Double_t radiusLong = 198.1;
+  //
+  Double_t alpha  = TMath::Pi()*(sector+0.5)/9;
+  Double_t ca     = TMath::Cos(alpha);  
+  Double_t sa     = TMath::Sin(alpha);
+  Double_t lx     =  xyz[0]*ca + xyz[1]*sa;
+  Double_t sign   = (lx<radiusLong) ? 1:-1;
+  return xyz[3]*sign*signZ;
 }
 
-Double_t        AliTPCTransformation::TPCDeltaZMediumLong(Double_t *xyz, Double_t * /*param*/){
+Double_t        AliTPCTransformation::TPCDeltaZ(Double_t *xyz, Double_t * param){
   //
   // xyz - [0..2] - position 
   //        [3]    - scale parameter
   //        [4]    - volID
-  // return delta in global coordinate system 
+  // return delta in global coordiante system
   //
   Int_t    sector = TMath::Nint(xyz[4]);
-  Double_t signZ  = (sector%36<18) ? 1: -1;  // drift direction
-  if    (sector<36) return 0;     
+  Double_t delta  = (sector%36<18) ? 1: -1;  // drift direction
+  Double_t alpha  = TMath::Pi()*(sector+0.5)/9;
+  Double_t ca     = TMath::Cos(alpha);  
+  Double_t sa     = TMath::Sin(alpha);
+  Double_t lx     =  xyz[0]*ca + xyz[1]*sa;
   //
-  Double_t radius  = (TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1])); 
-  const Double_t radiusLong = 198.1;
-  Double_t sign   = (radius<radiusLong) ? 1:-1;
-  return xyz[3]*sign*signZ;
+  const Double_t xIROCOROC = 133.4;  
+  if (param[0]>0) delta     *= TMath::Cos(param[0]*alpha);
+  if (param[1]>0) delta     *= TMath::Sin(param[1]*alpha);
+  if (param[2]>0.5 && lx >xIROCOROC) delta *=-1;
+  return delta*xyz[3];     // IROC shift
 }
 
+
 Double_t       AliTPCTransformation::TPCTiltingZ(Double_t *xyz, Double_t * param){
   // xyz - [0..2] - position 
   //        [3]    - scale parameter
   //        [4]    - volID
   // param[0]      - n for cos
   // param[1]      - n for sin
+  // param[2]      - IROC-ORC relative (if >0.5 )
   // return delta in global coordinate system 
-  Double_t radius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
   const Double_t rFirst=85.2; 
   const Double_t rLast =245.8;
-  Double_t radiusC  = (rFirst+rLast)*0.5;
-  Double_t deltaR = 2.0*(radius-radiusC)/(rLast-rFirst);
-  Double_t alpha       = TMath::ATan2(xyz[1],xyz[0]);
-  
+  const Double_t xIROCOROC = 133.4;  
+  //
+  Int_t    sector = TMath::Nint(xyz[4]);
+  Double_t alpha  = TMath::Pi()*(sector+0.5)/9;
+  Double_t ca     = TMath::Cos(alpha);  
+  Double_t sa     = TMath::Sin(alpha);
+  Double_t lx     =  xyz[0]*ca + xyz[1]*sa;
+  Double_t deltaR = 2.0*(lx-xIROCOROC)/(rLast-rFirst);  
   if (param[0]>0) deltaR *= TMath::Cos(param[0]*alpha);
   if (param[1]>0) deltaR *= TMath::Sin(param[1]*alpha);
+  if (param[2]>0.5 && lx >xIROCOROC) deltaR *=-1;
   return deltaR*xyz[3];
 }
 
index f9f85609cc5d1906cdf2c6e8a3aebecfc490eef8..13b208d00d09f7813c88e2b4e5923236ef2f3fcb 100644 (file)
@@ -51,6 +51,7 @@ public:
   static  Int_t          BuildBasicFormulas(); //build list of basic formulas
   static  Double_t       TPCscalingRPol(Double_t *xyz, Double_t * param);
   static  Double_t       TPCscalingZDr(Double_t *xyz, Double_t * param);
+  static  Double_t       TPCscalingZDrGy(Double_t *xyz, Double_t * param);
   static  Double_t       TPCscalingPhiLocal(Double_t *xyz, Double_t * param);
   //
   // TPC Field cage + ROC misalingment induced distortion
index c3c7bf5f0385f611fad423c9f0fe19174cb3323a..783223e8e4fe7958f7dfea1bb4b67e90931a0ae0 100644 (file)
@@ -713,6 +713,40 @@ void  AliTPCkalmanFit::UpdateLinear(AliTrackPoint &point, TTreeSRedirector *debu
 }
 
 
+AliTrackPointArray * AliTPCkalmanFit::SortPoints(AliTrackPointArray &points){
+  //
+  //Creates the array  - points sorted according radius - neccessay for kalman fit
+  // 
+  //
+  // 0. choose the frame - rotation angle
+  //
+  Int_t npoints = points.GetNPoints();
+  if (npoints<1) return 0;
+  Double_t currentAlpha = TMath::ATan2(points.GetY()[npoints-1]-points.GetY()[0], points.GetX()[npoints-1]-points.GetX()[0]);  
+  Double_t ca = TMath::Cos(currentAlpha);
+  Double_t sa = TMath::Sin(currentAlpha);
+  //
+  // 1. sort the points
+  //
+  Double_t *rxvector = new Double_t[npoints];
+  Int_t    *indexes  = new Int_t[npoints];
+  for (Int_t ipoint=0; ipoint<npoints-1; ipoint++){
+    rxvector[ipoint]=ca*points.GetX()[ipoint]+sa*points.GetY()[ipoint];
+  }
+  TMath::Sort(npoints, rxvector,indexes,kFALSE);
+  AliTrackPoint point;
+  AliTrackPointArray *pointsSorted= new AliTrackPointArray(npoints);
+  for (Int_t ipoint=0; ipoint<npoints; ipoint++){
+    if (!points.GetPoint(point,indexes[ipoint])) continue;
+    pointsSorted->AddPoint(ipoint,&point);
+  }
+  delete [] rxvector;
+  delete [] indexes;
+  return pointsSorted;
+}
+
+
+
 AliTrackPointArray * AliTPCkalmanFit::MakePointArrayLinear(Double_t alpha, Double_t y0, Double_t z0, Double_t ky, Double_t kz, Double_t err){
   //
   //
index 1317830768ac1966a192a95b7d018e42aaebae93..59a38d9161f17774f65df6cad542896c610ee78e 100644 (file)
@@ -35,6 +35,7 @@ public:
   void PropagateTime(Int_t time);
   void Update(const AliTPCkalmanFit * kalman);
 
+  static AliTrackPointArray * SortPoints(AliTrackPointArray &points);
   static AliTrackPointArray * MakePointArrayLinear(Double_t alpha, Double_t y0, Double_t z0, Double_t ky, Double_t kz, Double_t err=0.02); 
   void  ApplyCalibration(AliTrackPointArray *array, Double_t csign);
   Bool_t  CheckCovariance(TMatrixD &covar, Float_t maxEl);