]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCGGVoltError.cxx
- Adding initialisation of detector variable - Adding functions to get hadronic contr...
[u/mrichter/AliRoot.git] / TPC / AliTPCGGVoltError.cxx
index 04d1a691c14a63dc9f765cb4cc004a1709e357f0..27b47a105a28518b637cd322a1ec413f633ae350 100644 (file)
  **************************************************************************/
 
 ////////////////////////////////////////////////////////////////////////////
-//                                                                        //
 // AliTPCGGVoltError class                                                //
-// The class calculates the electric field and space point distortions    //
-// due a Gating Grid (GG) Error voltage. It uses the exact calculation    //
-// technique based on bessel functions. (original code from STAR)         //
-// The class allows "effective Omega Tau" corrections.                    // 
-//                                                                        //
-// date: 27/04/2010                                                       //
-// Authors: Jim Thomas, Stefan Rossegger, Magnus Mager                    //
-//                                                                        //
-// Example usage:                                                         //
-//  AliTPCGGVoltError GGerror;                                            //
-//  GGerror.SetOmegaTauT1T2(0.32,1.,1.); // values ideally from OCDB      //
-//  GGerror.SetDeltaVGGA(50.);           // voltage offset A-side         //
-//  GGerror.SetDeltaVGGC(50.);           // voltage offset C-side         //
-//  GGerror.InitGGVoltErrorDistortion(); // initialization of the look up //
-//  // plot dRPhi distortions ...                                         //
-//  GGerror.CreateHistoDRPhiinZR(1.,100,100)->Draw("surf2");              //
 ////////////////////////////////////////////////////////////////////////////
 
 
@@ -47,7 +30,8 @@
 AliTPCGGVoltError::AliTPCGGVoltError()
   : AliTPCCorrection("GGVoltError","GatingGrid (GG) Voltage Error"),
     fC0(0.),fC1(0.),
-    fDeltaVGGA(0.),fDeltaVGGC(0.)
+    fDeltaVGGA(0.),fDeltaVGGC(0.),
+    fInitLookUp(kFALSE)
 {
   //
   // default constructor
@@ -93,7 +77,7 @@ void AliTPCGGVoltError::Update(const TTimeStamp &/*timeStamp*/) {
   Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ; 
 
   SetOmegaTauT1T2(wt,fT1,fT2);
-  InitGGVoltErrorDistortion();
+  //  InitGGVoltErrorDistortion(); // not necessary in here since the Voltage should not change!
 }
 
 
@@ -108,6 +92,8 @@ void AliTPCGGVoltError::GetCorrection(const Float_t x[],const Short_t roc,Float_
   // Electrostatic Equations from StarNote SN0253 by Howard Wieman.
   //
   
+  if (!fInitLookUp) AliError("Lookup table was not initialized! You should do InitGGVoltErrorDistortion() ...");
+  
   Int_t   order     = 1 ;               // FIXME: hardcoded? Linear interpolation = 1, Quadratic = 2         
  
   Double_t intEr, intEphi ;
@@ -144,7 +130,9 @@ void AliTPCGGVoltError::GetCorrection(const Float_t x[],const Short_t roc,Float_
   // Calculate correction in cartesian coordinates
   dx[0] = r * TMath::Cos(phi) - x[0];
   dx[1] = r * TMath::Sin(phi) - x[1]; 
-  dx[2] = 0.; // z distortion not implemented (1st order distortions)
+  dx[2] = 0.; // z distortion not implemented (1st order distortions) - see e.g. AliTPCBoundaryVoltError-class
+
+
 
 }
 
@@ -154,7 +142,9 @@ Float_t AliTPCGGVoltError::GetIntErOverEz(const Float_t x[],const Short_t roc) {
   // This function is purely for calibration purposes
   // Calculates the integral (int Er/Ez dz) for the setted GG voltage offset 
   // 
-  
+
+  if (!fInitLookUp) AliError("Lookup table was not initialized! You should do InitGGVoltErrorDistortion() ...");
+
   Int_t   order     = 1 ;     // FIXME: so far hardcoded? Linear interpolation = 1, Quadratic = 2         
   
   Double_t intEr;
@@ -227,6 +217,8 @@ void AliTPCGGVoltError::InitGGVoltErrorDistortion() {
 
     }
   }
+  
+  fInitLookUp = kTRUE;
 }
 
 
@@ -245,6 +237,7 @@ void AliTPCGGVoltError::Print(const Option_t* option) const {
     printf(" - C1: %1.4f, C0: %1.4f \n",fC1,fC0);
   }    
 
+  if (!fInitLookUp) AliError("Lookup table was not initialized! You should do InitGGVoltErrorDistortion() ...");
 
   
 }