]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCGGVoltError.cxx
M AliTPCcalibDB.h - GetDistortion not inline function
[u/mrichter/AliRoot.git] / TPC / AliTPCGGVoltError.cxx
index e80d71fd751c97143893cd1af881a4d57eddb3ca..edf22649bc1bb7316169703462f88444ebc72824 100644 (file)
 ////////////////////////////////////////////////////////////////////////////
 
 
+#include "AliMagF.h"
+#include "TGeoGlobalMagField.h"
+#include "AliTPCcalibDB.h"
+#include "AliTPCParam.h"
+#include "AliLog.h"
 
 #include "AliTPCGGVoltError.h"
 #include <TMath.h>
@@ -55,6 +60,44 @@ AliTPCGGVoltError::~AliTPCGGVoltError() {
   //
 }
 
+void AliTPCGGVoltError::Init() {
+  //
+  //
+  //
+  AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
+  if (!magF) AliError("Magneticd field - not initialized");
+  Double_t bzField = magF->SolenoidField()/10.; //field in T
+  AliTPCParam *param= AliTPCcalibDB::Instance()->GetParameters();
+  if (!param) AliError("Parameters - not initialized");
+  Double_t vdrift = param->GetDriftV()/1000000.; // [cm/us]   // From dataBase: to be updated: per second (ideally)
+  Double_t ezField = 400; // [V/cm]   // to be updated: never (hopefully)
+  Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ; 
+  //
+  SetOmegaTauT1T2(wt,fT1,fT2);
+  InitGGVoltErrorDistortion();
+  //SetDeltaVGGA(0.0);//  ideally from the database
+  //SetDeltaVGGC(0.0);//  ideally from the database
+}
+
+void AliTPCGGVoltError::Update(const TTimeStamp &/*timeStamp*/) {
+  //
+  // Update function
+  //
+  AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
+  if (!magF) AliError("Magneticd field - not initialized");
+  Double_t bzField = magF->SolenoidField()/10.; //field in T
+  AliTPCParam *param= AliTPCcalibDB::Instance()->GetParameters();
+  if (!param) AliError("Parameters - not initialized");
+  Double_t vdrift = param->GetDriftV()/1000000.; // [cm/us]   // From dataBase: to be updated: per second (ideally)
+  Double_t ezField = 400; // [V/cm]   // to be updated: never (hopefully)
+  Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ; 
+
+  SetOmegaTauT1T2(wt,fT1,fT2);
+  InitGGVoltErrorDistortion();
+}
+
+
+
 void AliTPCGGVoltError::GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]) {
 
   //
@@ -178,7 +221,7 @@ void AliTPCGGVoltError::InitGGVoltErrorDistortion() {
        Double_t zterm = TMath::Cos( k*(fgkTPC_Z0-TMath::Abs(z)) ) - 1 ;
        intz += zterm * numerator / denominator ;
        // Assume series converges, break if small terms
-       if ( n>10 && fabs(intz)*1.e-10 > fabs(numerator/denominator) ) break;   
+       if ( n>10 && TMath::Abs(intz)*1.e-10 > TMath::Abs(numerator/denominator) ) break;   
       }
       fGGVoltErrorER[i][j] = (Double_t) intz ;
 
@@ -198,6 +241,7 @@ void AliTPCGGVoltError::Print(Option_t* option) const {
   printf("%s\n",GetTitle());
   printf(" - GG Voltage offset: A-side: %3.1f V, C-side: %3.1f V \n",fDeltaVGGA,fDeltaVGGC);  
   if (opt.Contains("a")) { // Print all details
+    printf(" - T1: %1.4f, T2: %1.4f \n",fT1,fT2);
     printf(" - C1: %1.4f, C0: %1.4f \n",fC1,fC0);
   }