]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCTransformation.cxx
use the new AliCaloRawStreamV3 decoder (from Yuri), based on the new AliAltroRawStrea...
[u/mrichter/AliRoot.git] / TPC / AliTPCTransformation.cxx
index 9536c3a4a261547221f94e511e76bea9572feeb2..3635a7f586275ef2a603221ffddf6febc2210194 100644 (file)
@@ -70,9 +70,11 @@ Int_t  AliTPCTransformation::BuildBasicFormulas(){
   RegisterFormula("TPCscalingRIFC",(GenFuncG)(AliTPCTransformation::TPCscalingRIFC));
   RegisterFormula("TPCscalingROFC",(GenFuncG)(AliTPCTransformation::TPCscalingROFC));
   //
-  RegisterFormula("TPCscalingZDr",(GenFuncG)(AliTPCTransformation::TPCscalingZDr));
-  RegisterFormula("TPCscalingZDrGy",(GenFuncG)(AliTPCTransformation::TPCscalingZDrGy));
+  RegisterFormula("TPCscalingZDr",(GenFuncG)(AliTPCTransformation::TPCscalingZDrift));
+  RegisterFormula("TPCscalingZDrGy",(GenFuncG)(AliTPCTransformation::TPCscalingZDriftGy));
+  RegisterFormula("TPCscalingZDriftT0",(GenFuncG)(AliTPCTransformation::TPCscalingZDriftT0));
   RegisterFormula("TPCscalingPhiLocal",(GenFuncG)(AliTPCTransformation::TPCscalingPhiLocal));
+  RegisterFormula("TPClocalRPhiEdge",(GenFuncG)(AliTPCTransformation::TPClocalRPhiEdge));
   //
   // TPC Local X and Y misalignment + rotation 
   //
@@ -126,6 +128,7 @@ AliTPCTransformation::AliTPCTransformation():
   fCoordSystem(0),    // coord system of  output deltas 
   fParam(0),          // free parameter of transformation 
   fSigma(0),          // uncertainty of the parameter
+  fSigmaMax(0),       //maximal sigma (Not allowed to increase in propagate time by bigger factor)
   fSigma2Time(0),     // change of the error in time - (For kalman filter) 
   fFixedParam(0),     // fixed parameters of tranformation  
   fIsActive(kTRUE),   // swith - On/Off
@@ -152,6 +155,7 @@ AliTPCTransformation::AliTPCTransformation(const char *name, TBits *mask, const
   fCoordSystem(coordSystem), // coordinate system of output deltas
   fParam(0),          // free parameter of transformation 
   fSigma(0),
+  fSigmaMax(0),       //maximal sigma (Not allowed to increase in propagate time by bigger factor)
   fSigma2Time(0),     // change of sigma in time
   fFixedParam(0),     // fixed parameters of tranformation  
   fIsActive(kTRUE),   // swith - On/Off
@@ -180,6 +184,7 @@ AliTPCTransformation::AliTPCTransformation(const AliTPCTransformation&trafo):
   fCoordSystem(0),    // coord system of  output deltas 
   fParam(trafo.fParam),          // free parameter of transformation 
   fSigma(trafo.fSigma),          // uncertainty of the parameter
+  fSigmaMax(trafo.fSigma),       //maximal sigma (Not allowed to increase in propagate time by bigger factor)
   fSigma2Time(trafo.fSigma2Time),     // change of the error in time - (For kalman filter) 
   fFixedParam(0),     // fixed parameters of tranformation
   fIsActive(trafo.fIsActive),   // swith - On/Off
@@ -211,6 +216,7 @@ void AliTPCTransformation::SetParams(Double_t param, Double_t sigma, Double_t si
   //
   fParam = param;
   fSigma = sigma;
+  fSigmaMax = sigma;
   fSigma2Time = sigma2Time;
   if (fFixedParam) delete fFixedParam;
   fFixedParam = new TVectorD(*fixedParams);
@@ -263,6 +269,43 @@ TBits * AliTPCTransformation::BitsAll(){
   return bits;
 }
 
+// Double_t AliTPCTransformation::GetDeltaXYZ(Int_t coord, Int_t volID, Double_t param, Double_t x, Double_t y, Double_t z){
+//   //
+//   //
+//   // coord - type of coordinate
+//   //       - 0 -X
+//   //         1 -Y
+//   //         2 -Z
+//   //         3 -R
+//   //         4 -RPhi
+//   if (!fIsActive) return 0;
+//   if (fBitMask && (!(*fBitMask)[volID])) return 0;
+//   Double_t xyz[5]={x,y,z, param,volID};
+//   if (fCoordSystem==0){
+//     // cartezian system
+//     if (coord==0 && fFormulaX) return fFormulaX(xyz,fFixedParam->GetMatrixArray()); 
+//     if (coord==1 && fFormulaY) return fFormulaY(xyz,fFixedParam->GetMatrixArray()); 
+//     if (coord==2 && fFormulaZ) return fFormulaZ(xyz,fFixedParam->GetMatrixArray());
+//   }
+//   if (fCoordSystem==1){  
+//     // cylindrical system
+//     if (coord==2) {
+//       if (fFormulaZ==0) return 0;
+//       return fFormulaZ(xyz,fFixedParam->GetMatrixArray());
+//     }
+//     Double_t rrphiz[3]={0,0,0};
+//     if (fFormulaX) rrphiz[0] = fFormulaX(xyz,fFixedParam->GetMatrixArray());
+//     if (fFormulaY) rrphiz[1] = fFormulaY(xyz,fFixedParam->GetMatrixArray());
+//     Double_t alpha = TMath::ATan2(y,x);
+//     Double_t ca    = TMath::Cos(alpha);
+//     Double_t sa    = TMath::Sin(alpha);
+//     if (coord==0) return ca*rrphiz[0]-sa*rrphiz[1];
+//     if (coord==1) return sa*rrphiz[0]+ca*rrphiz[1];
+//   }
+//   return 0;
+// }
+
+
 Double_t AliTPCTransformation::GetDeltaXYZ(Int_t coord, Int_t volID, Double_t param, Double_t x, Double_t y, Double_t z){
   //
   //
@@ -272,18 +315,31 @@ Double_t AliTPCTransformation::GetDeltaXYZ(Int_t coord, Int_t volID, Double_t pa
   //         2 -Z
   //         3 -R
   //         4 -RPhi
+  //         5 -Z
   if (!fIsActive) return 0;
   if (fBitMask && (!(*fBitMask)[volID])) return 0;
   Double_t xyz[5]={x,y,z, param,volID};
+  Double_t alpha = TMath::ATan2(y,x);
+  Double_t ca    = TMath::Cos(alpha);
+  Double_t sa    = TMath::Sin(alpha);
+
   if (fCoordSystem==0){
     // cartezian system
-    if (coord==0 && fFormulaX) return fFormulaX(xyz,fFixedParam->GetMatrixArray()); 
-    if (coord==1 && fFormulaY) return fFormulaY(xyz,fFixedParam->GetMatrixArray()); 
-    if (coord==2 && fFormulaZ) return fFormulaZ(xyz,fFixedParam->GetMatrixArray());
+    Double_t dxdydz[3]={0,0,0};
+    if(fFormulaX) dxdydz[0]=fFormulaX(xyz,fFixedParam->GetMatrixArray());
+    if(fFormulaY) dxdydz[1]=fFormulaY(xyz,fFixedParam->GetMatrixArray());
+    if(fFormulaZ) dxdydz[2]=fFormulaZ(xyz,fFixedParam->GetMatrixArray());
+
+    if (coord==0) return dxdydz[0];
+    if (coord==1) return dxdydz[1];
+    if (coord==2) return dxdydz[2];
+    if (coord==3) return dxdydz[0]*ca+dxdydz[1]*sa;
+    if (coord==4) return -dxdydz[0]*sa+dxdydz[1]*ca;
+    if (coord==5) return dxdydz[2];
   }
   if (fCoordSystem==1){  
     // cylindrical system
-    if (coord==2) {
+    if (coord==2||coord==5) {
       if (fFormulaZ==0) return 0;
       return fFormulaZ(xyz,fFixedParam->GetMatrixArray());
     }
@@ -295,10 +351,14 @@ Double_t AliTPCTransformation::GetDeltaXYZ(Int_t coord, Int_t volID, Double_t pa
     Double_t sa    = TMath::Sin(alpha);
     if (coord==0) return ca*rrphiz[0]-sa*rrphiz[1];
     if (coord==1) return sa*rrphiz[0]+ca*rrphiz[1];
+    if (coord==3) return rrphiz[0];
+    if (coord==4) return rrphiz[1];
   }
   return 0;
 }
 
+
+
 Double_t  AliTPCTransformation::TPCscalingRPol(Double_t *xyz, Double_t * param){
   //
   // Scaling and shift of TPC radius
@@ -319,19 +379,33 @@ Double_t  AliTPCTransformation::TPCscalingRPol(Double_t *xyz, Double_t * param){
 }
 
 
-Double_t  AliTPCTransformation::TPCscalingZDr(Double_t *xyz, Double_t * param){
+Double_t  AliTPCTransformation::TPCscalingZDrift(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 deltaZ  = (xyz[2]>0) ? -driftP : driftP;
+  Int_t    sector = TMath::Nint(xyz[4]);
+  Double_t deltaZ  = (sector%36<18) ? -driftP : driftP;
   return deltaZ*xyz[3];
 }
 
+Double_t  AliTPCTransformation::TPCscalingZDriftT0(Double_t *xyz, Double_t * /*param*/){
+  //
+  //
+  // Z shift because time 0 offset
+  // opposite on A and C side
+  //
+  // xyz[0..2] - global xyz of point 
+  // xyz[3]    - scale parameter
+  Int_t    sector = TMath::Nint(xyz[4]);
+  Double_t sign  = (sector%36<18) ? -1 : 1;
+  return sign*xyz[3];
+}
 
-Double_t  AliTPCTransformation::TPCscalingZDrGy(Double_t *xyz, Double_t * param){
+
+Double_t  AliTPCTransformation::TPCscalingZDriftGy(Double_t *xyz, Double_t * param){
   //
   //
   // Scaling and shift of TPC radius
@@ -339,7 +413,8 @@ Double_t  AliTPCTransformation::TPCscalingZDrGy(Double_t *xyz, Double_t * param)
   // 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;
+  Int_t    sector = TMath::Nint(xyz[4]);
+  Double_t deltaZ  = (sector%36<18) ? -driftP : driftP;
   return deltaZ*xyz[3]*gy;
 }
 
@@ -361,6 +436,24 @@ Double_t  AliTPCTransformation::TPCscalingPhiLocal(Double_t *xyz, Double_t * par
   return deltaAlpha*xyz[3];
 }
 
+Double_t  AliTPCTransformation::TPClocalRPhiEdge(Double_t *xyz, Double_t * param){
+  //
+  //
+  // Scaling if the local y -phi
+  // xyz[0..2] - global xyz of point 
+  // xyz[3]    - scale parameter
+  // param[0]  - dedge offset - should be around gap size/2.
+  // param[1]  - dedge factor - should be around gap size/2.
+  Double_t alpha       = TMath::ATan2(xyz[1],xyz[0]);
+  Double_t sector      = TMath::Nint(9*alpha/TMath::Pi()-0.5);
+  Double_t localAlpha  = (alpha-(sector+0.5)*TMath::Pi()/9.);
+  Double_t radius      = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
+  Double_t deltaAlpha  = TMath::Pi()/18.-TMath::Abs(localAlpha);
+  Double_t distEdge    = (deltaAlpha*radius);
+  Double_t factor      = 1./(1.+(distEdge-param[0])/param[1]);
+  return factor*xyz[3]*((localAlpha>0)? -1.:1.);
+}
+
 
 Double_t       AliTPCTransformation::TPCscalingRIFC(Double_t *xyz, Double_t * param){
   //