**************************************************************************/
////////////////////////////////////////////////////////////////////////////
-// //
-// AliExBBShape class //
-// The class calculates the space point distortions due to the B field //
-// shape imperfections using a second order technique based on integrals //
-// over Bz (e.g. int By/Bz) obtained via the AliMagF class //
-// The class allows "effective Omega Tau" corrections. //
-// //
-// date: 27/04/2010 //
-// Authors: Magnus Mager, Jim Thomas, Stefan Rossegger //
-// //
-// Example usage: //
-// AliMagF mag("mag","mag"); //
-// AliTPCExBBShape exb; //
-// exb.SetBField(&mag); // use Bfield from AliMagF //
-// exb.SetOmegaTauT1T2(0.32,1.,1.); // values ideally from OCDB //
-// // plot dRPhi distortions ... //
-// exb.CreateHistoDRPhiinZR(0,100,100)->Draw("surf2"); //
+// AliTPCExBBShape class //
////////////////////////////////////////////////////////////////////////////
#include <AliMagF.h>
+#include "TGeoGlobalMagField.h"
+#include "AliTPCcalibDB.h"
+#include "AliTPCParam.h"
+#include "AliLog.h"
#include "AliTPCExBBShape.h"
void AliTPCExBBShape::Init() {
//
- // Initialization funtion (not used at the moment)
+ // Initialization funtion
//
- // Set default parameters
- // FIXME: Ask the database for these entries
-
-
- AliMagF * mag = new AliMagF("mag","mag"); // from database (GRP?)
- SetBField(mag);
-
- Double_t vdrift = 2.6; // [cm/us] // From dataBase: to be updated: per second (ideally)
- Double_t bzField = -0.5; // [Tesla] // From dataBase: to be updated: per run
-
+ AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
+ if (!magF) AliError("Magneticd field - not initialized");
+ Double_t bzField = magF->SolenoidField()/10.; //field in T
+ SetBField(magF);
+ 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 ;
-
// Correction Terms for effective omegaTau; obtained by a laser calibration run
- Double_t t1 = 0.9; // ideally from database
- Double_t t2 = 1.5; // ideally from database
-
- SetOmegaTauT1T2(wt,t1,t2);
+ SetOmegaTauT1T2(wt,fT1,fT2);
}
//
// Update function
//
-
- Double_t vdrift = 2.6; // [cm/us] // From dataBase: to be updated: per second (ideally)
- Double_t bzField = -0.5; // [Tesla] // From dataBase: to be updated: per run
-
+ AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
+ if (!magF) AliError("Magneticd field - not initialized");
+ Double_t bzField = magF->SolenoidField()/10.; //field in T
+ SetBField(magF);
+ 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 ;
-
// Correction Terms for effective omegaTau; obtained by a laser calibration run
- Double_t t1 = 0.9; // ideally from database
- Double_t t2 = 1.5; // ideally from database
-
- SetOmegaTauT1T2(wt,t1,t2);
+ SetOmegaTauT1T2(wt,fT1,fT2);
}
}
const Double_t xStart[3]={ x[0], x[1], x[2] };
- const Double_t xEnd[3]={ x[0], x[1], roc%36<18?fgkTPC_Z0:-fgkTPC_Z0 };
+ const Double_t xEnd[3]={ x[0], x[1], roc%36<18?fgkTPCZ0:-fgkTPCZ0 };
Double_t intBStart[3];
Double_t intBEnd[3];
}
const Double_t xStart[3]={ x[0], x[1], x[2] };
- const Double_t xEnd[3]={ x[0], x[1], roc%36<18?fgkTPC_Z0:-fgkTPC_Z0 };
+ const Double_t xEnd[3]={ x[0], x[1], roc%36<18?fgkTPCZ0:-fgkTPCZ0 };
Double_t intBStart[3];
Double_t intBEnd[3];
// C0 and C1 coefficents (for calibration purposes)
//
TString opt = option; opt.ToLower();
- printf("%s\n - B field settings:\n",GetTitle());
+ printf("%s\t%s\n - B field settings:\n",GetTitle(),GetName());
fBField->Print(option);
// printf(" - B field: X-Twist: %1.5lf rad, Y-Twist: %1.5lf rad \n",fBField->Print(option));
- if (opt.Contains("a")) { // Print all details
+ if (opt.Contains("a")) { // Print all details
+ printf(" - T1: %1.4f, T2: %1.4f \n",fT1,fT2);
printf(" - C1: %1.4f, C2: %1.4f \n",fC1,fC2);
}
-
+}
+
+Double_t AliTPCExBBShape::GetBFieldXYZ(Double_t gx, Double_t gy, Double_t gz, Int_t axisType){
+ //
+ // return B field at given x,y,z
+ //
+ AliMagF* field = (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
+ if (!field) return 0;
+ Double_t xyz[3]={gx,gy,gz};
+ Double_t bxyz[3]={0};
+ field->Field(xyz,bxyz);
+ //
+ Double_t r=TMath::Sqrt(gx*gx+gy*gy);
+ // Double_t b=TMath::Sqrt(bxyz[0]*bxyz[0]+bxyz[1]*bxyz[1]);
+ if (axisType==0) {
+ return (xyz[0]*bxyz[1]-xyz[1]*bxyz[0])/(bxyz[2]*r);
+ }
+ if (axisType==1){
+ return (xyz[0]*bxyz[0]+xyz[1]*bxyz[1])/(bxyz[2]*r);
+ }
+ if (axisType==2) return bxyz[2];
+ if (axisType==3) return bxyz[0];
+ if (axisType==4) return bxyz[1];
+ if (axisType==5) return bxyz[2];
+ return bxyz[2];
}