]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCCorrection.h
Added extra protection to avoid zero division to complement the one already adopted...
[u/mrichter/AliRoot.git] / TPC / AliTPCCorrection.h
index a11422fa448ffa99fc559928a9083b4e33af640b..d3518e60359db15f4319ed498634872c5b4c17d1 100644 (file)
@@ -4,56 +4,6 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
-// _________________________________________________________________
-//
-// Begin_Html
-//   <h2>  AliTPCCorrection class   </h2>    
-//                                                                          
-//   This class provides a general framework to deal with space point         
-//   distortions. An correction class which inherits from here is for example 
-//   AliTPCExBBShape or AliTPCExBTwist                                        
-//   <p>                                                                        
-//   General functions are (for example):  <br>                                    
-//   CorrectPoint(x,roc) where x is the vector of inital positions in        
-//   cartesian coordinates and roc represents the Read Out chamber number    
-//   according to the offline naming convention. The vector x is overwritten 
-//   with the corrected coordinates.                                         
-//   <p>                                                                        
-//   An alternative usage would be CorrectPoint(x,roc,dx), which leaves the    
-//   vector x untouched, put returns the distortions via the vector dx      
-//   <p>
-//   Several plot functionalities (see example below), general solvers as well as simplified interpolation techniques are implemented.
-//   <p>                                                                       
-//   The class allows "effective Omega Tau" corrections to be shifted to the 
-//   single distortion classes.                                              
-//   <p>                                                                      
-//   Note: This class is normally used via the class AliTPCComposedCorrection
-// End_Html
-//
-// Begin_Macro(source) 
-//   {
-//   gROOT->SetStyle("Plain"); gStyle->SetPalette(1);
-//   TCanvas *c2 = new TCanvas("c2","c2",800,1200);  c2->Divide(2,3);
-//   AliTPCROCVoltError3D roc; // EXAMPLE PLOTS - SEE BELOW
-//   roc.SetOmegaTauT1T2(0,1,1); // B=0
-//   Float_t z0 = 1; // at +1 cm -> A side
-//   c2->cd(1); roc.CreateHistoDRinXY(1.,300,300)->Draw("cont4z"); 
-//   c2->cd(3);roc.CreateHistoDRPhiinXY(1.,300,300)->Draw("cont4z"); 
-//   c2->cd(5);roc.CreateHistoDZinXY(1.,300,300)->Draw("cont4z"); 
-//   Float_t phi0=0.5;
-//   c2->cd(2);roc.CreateHistoDRinZR(phi0)->Draw("surf2"); 
-//   c2->cd(4);roc.CreateHistoDRPhiinZR(phi0)->Draw("surf2"); 
-//   c2->cd(6);roc.CreateHistoDZinZR(phi0)->Draw("surf2"); 
-//   return c2;
-//   } 
-// End_Macro
-//
-// Begin_Html
-//   <p>
-//   Date: 27/04/2010  <br>
-//   Authors: Magnus Mager, Stefan Rossegger, Jim Thomas                     
-// End_Html 
-// _________________________________________________________________
 
 ////////////////////////////////////////////////////////////////////////////////
 // AliTPCCorrection class                                                     //
@@ -62,6 +12,7 @@
 
 #include <TNamed.h>
 #include "TMatrixD.h"
+#include "TMatrixF.h"
 class TH2F;
 class TTimeStamp;
 class TCollection;
@@ -83,11 +34,13 @@ public:
 
   // functions to correct a space point
           void CorrectPoint (      Float_t x[],const Short_t roc);
+          void CorrectPointLocal(Float_t x[],const Short_t roc);
           void CorrectPoint (const Float_t x[],const Short_t roc,Float_t xp[]);
   virtual void GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]);
 
   // functions to distort a space point
           void DistortPoint (      Float_t x[],const Short_t roc);
+          void DistortPointLocal(Float_t x[],const Short_t roc);
           void DistortPoint (const Float_t x[],const Short_t roc,Float_t xp[]);
   virtual void GetDistortion(const Float_t x[],const Short_t roc,Float_t dx[]);
 
@@ -108,12 +61,16 @@ public:
 
 
   TTree* CreateDistortionTree(Double_t step=5);
-  static void  MakeDistortionMap(THnSparse * his0, TTreeSRedirector *pcstream, const char* hname, Int_t run);
+  static void  MakeDistortionMap(THnSparse * his0, TTreeSRedirector *pcstream, const char* hname, Int_t run,  Float_t refX, Int_t type, Int_t integ=1);
+  static void  MakeDistortionMapCosmic(THnSparse * his0, TTreeSRedirector *pcstream, const char* hname, Int_t run,  Float_t refX, Int_t type);
+  static void  MakeDistortionMapSector(THnSparse * his0, TTreeSRedirector *pcstream, const char* hname, Int_t run, Int_t type);
   // normally called directly in the correction classes which inherit from this class
   virtual void SetOmegaTauT1T2(Float_t omegaTau,Float_t t1,Float_t t2);
   AliExternalTrackParam * FitDistortedTrack(AliExternalTrackParam & trackIn, Double_t refX, Int_t dir,TTreeSRedirector *pcstream);
   void StoreInOCDB(Int_t startRun, Int_t endRun, const char *comment=0);
-  static void MakeTrackDistortionTree(TTree *tinput, Int_t dtype, Int_t ptype, const TObjArray * corrArray, Int_t step=1, Bool_t debug=0);
+  static void MakeTrackDistortionTree(TTree *tinput, Int_t dtype, Int_t ptype, const TObjArray * corrArray, Int_t step=1, Int_t offset=0, Bool_t debug=0);
+  static void MakeSectorDistortionTree(TTree *tinput, Int_t dtype, Int_t ptype, const TObjArray * corrArray, Int_t step=1, Int_t offset=0, Bool_t debug=0);
+  static void MakeLaserDistortionTreeOld(TTree* tree, TObjArray *corrArray, Int_t itype);
   static void MakeLaserDistortionTree(TTree* tree, TObjArray *corrArray, Int_t itype);
 
   void FastSimDistortedVertex(Double_t orgVertex[3], Int_t nTracks, AliESDVertex &aV, AliESDVertex &avOrg, AliESDVertex &cV, AliESDVertex &cvOrg, TTreeSRedirector * const pcstream, Double_t etaCuts);
@@ -149,12 +106,14 @@ protected:
 
   // Simple Interpolation functions: e.g. with tricubic interpolation (not yet in TH3)
   Int_t fILow, fJLow, fKLow;          // variable to help in the interpolation 
+  // Double_t versions
   void Interpolate2DEdistortion( const Int_t order, const Double_t r, const Double_t z, 
                                 const Double_t er[kNZ][kNR], Double_t &erValue );
   void Interpolate3DEdistortion( const Int_t order, const Double_t r, const Float_t phi, const Double_t z, 
                                 const Double_t er[kNZ][kNPhi][kNR], const Double_t ephi[kNZ][kNPhi][kNR], 
                                 const Double_t ez[kNZ][kNPhi][kNR],
                                 Double_t &erValue, Double_t &ephiValue, Double_t &ezValue);
+  // TMatrixD versions (for e.g. Poisson relaxation)
   Double_t Interpolate2DTable( const Int_t order, const Double_t x, const Double_t y, 
                              const Int_t nx,  const Int_t ny, const Double_t xv[], const Double_t yv[], 
                              const TMatrixD &array );
@@ -165,6 +124,18 @@ protected:
   Double_t Interpolate( const Double_t xArray[], const Double_t yArray[], 
                        const Int_t order, const Double_t x );
   void Search( const Int_t n, const Double_t xArray[], const Double_t x, Int_t &low );
+  // TMatrixF versions (smaller size, e.g. for final look up table)
+  Float_t Interpolate2DTable( const Int_t order, const Double_t x, const Double_t y, 
+                             const Int_t nx,  const Int_t ny, const Double_t xv[], const Double_t yv[], 
+                             const TMatrixF &array );
+  Float_t Interpolate3DTable( const Int_t order, const Double_t x,   const Double_t y,   const Double_t z,
+                             const Int_t  nx,    const Int_t  ny,    const Int_t  nz,
+                             const Double_t xv[], const Double_t yv[], const Double_t zv[],
+                              TMatrixF **arrayofArrays ); 
+  Float_t Interpolate( const Double_t xArray[], const Float_t yArray[], 
+                       const Int_t order, const Double_t x );
+
   virtual Int_t IsPowerOfTwo ( Int_t i ) const  ;