]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCExBTwist.cxx
f9e2dd2b310ced4dad36ab15c57451b8c6820f01
[u/mrichter/AliRoot.git] / TPC / AliTPCExBTwist.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 ////////////////////////////////////////////////////////////////////////////
17 //                                                                        //
18 // AliTPCExBTwist class                                                   //
19 // The class calculates the space point distortions due to a mismatch     //
20 // of the E and B field axis (original code from STAR)                    //
21 // The class allows "effective Omega Tau" corrections.                    // 
22 //                                                                        //
23 // date: 27/04/2010                                                       //
24 // Authors: Jim Thomas, Magnus Mager, Stefan Rossegger                    //
25 //                                                                        //
26 // Example usage:                                                         //
27 //  AliTPCExBTwist twist;                                                 //
28 //  twist.SetOmegaTauT1T2(0.32,1.,1.); // values ideally from OCDB        //
29 //  twist.SetXTwist(0.001);   // set twist in X direction (in rad)        //
30 //  // plot dRPhi distortions ...                                         //
31 //  twist.CreateHistoDRPhiinZR(1.,100,100)->Draw("surf2");                //
32 ////////////////////////////////////////////////////////////////////////////
33 #include "AliMagF.h"
34 #include "TGeoGlobalMagField.h"
35 #include "AliTPCcalibDB.h"
36 #include "AliTPCParam.h"
37 #include "AliLog.h"
38
39 #include "AliTPCExBTwist.h"
40
41 AliTPCExBTwist::AliTPCExBTwist()
42   : AliTPCCorrection("exb_twist","ExB twist"),
43     fC1(0.),fC2(0.),
44     fXTwist(0.),fYTwist(0.)
45 {
46   //
47   // default constructor
48   //
49 }
50
51 AliTPCExBTwist::~AliTPCExBTwist() {
52   //
53   // default destructor
54   //
55 }
56
57
58
59 void AliTPCExBTwist::Init() {
60   //
61   // Initialization funtion
62   //
63   
64   AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
65   if (!magF) AliError("Magneticd field - not initialized");
66   Double_t bzField = magF->SolenoidField()/10.; //field in T
67   AliTPCParam *param= AliTPCcalibDB::Instance()->GetParameters();
68   if (!param) AliError("Parameters - not initialized");
69   Double_t vdrift = param->GetDriftV()/1000000.; // [cm/us]   // From dataBase: to be updated: per second (ideally)
70   Double_t ezField = 400; // [V/cm]   // to be updated: never (hopefully)
71   Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ; 
72   // Correction Terms for effective omegaTau; obtained by a laser calibration run
73   SetOmegaTauT1T2(wt,fT1,fT2);
74
75
76 }
77
78 void AliTPCExBTwist::Update(const TTimeStamp &/*timeStamp*/) {
79   //
80   // Update function 
81   //
82   AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
83   if (!magF) AliError("Magneticd field - not initialized");
84   Double_t bzField = magF->SolenoidField()/10.; //field in T
85   AliTPCParam *param= AliTPCcalibDB::Instance()->GetParameters();
86   if (!param) AliError("Parameters - not initialized");
87   Double_t vdrift = param->GetDriftV()/1000000.; // [cm/us]   // From dataBase: to be updated: per second (ideally)
88   Double_t ezField = 400; // [V/cm]   // to be updated: never (hopefully)
89   Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ; 
90   // Correction Terms for effective omegaTau; obtained by a laser calibration run
91   SetOmegaTauT1T2(wt,fT1,fT2);
92
93
94 }
95
96
97
98 void AliTPCExBTwist::GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]) {
99   //
100   // Calculates the correction of a mismatch between the E and B field axis
101   // 
102   
103   const Float_t zstart=x[2];
104   const Float_t zend  =(roc%36<18?fgkTPC_Z0:-fgkTPC_Z0);
105   const Float_t zdrift=zstart-zend;
106   
107   dx[0]=(fC2*fXTwist-fC1*fYTwist)*zdrift;
108   dx[1]=(fC1*fXTwist+fC2*fYTwist)*zdrift;
109   dx[2]=0.;
110 }
111
112 void AliTPCExBTwist::Print(Option_t* option) const {
113   //
114   // Print function to check the settings (e.g. the twist in the X direction)
115   // option=="a" prints the C0 and C1 coefficents for calibration purposes
116   //
117
118   TString opt = option; opt.ToLower();
119   printf("%s\n",GetTitle());
120   
121   printf(" - Twist settings: X-Twist: %1.5f rad, Y-Twist: %1.5f rad \n",fXTwist,fYTwist);
122   if (opt.Contains("a")) { // Print all details
123     printf(" - T1: %1.4f, T2: %1.4f \n",fT1,fT2);
124     printf(" - C1: %1.4f, C2: %1.4f \n",fC1,fC2);
125   }    
126  
127  
128 }