]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/Base/AliTPCExBTwist.cxx
o remove printf
[u/mrichter/AliRoot.git] / TPC / Base / 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 // AliTPCExBTwist class                                                   //
18 ////////////////////////////////////////////////////////////////////////////
19
20
21 #include "AliMagF.h"
22 #include "TGeoGlobalMagField.h"
23 #include "AliTPCcalibDB.h"
24 #include "AliTPCParam.h"
25 #include "AliLog.h"
26
27 #include "AliTPCExBTwist.h"
28
29 AliTPCExBTwist::AliTPCExBTwist()
30   : AliTPCCorrection("exb_twist","ExB twist"),
31     fC1(0.),fC2(0.),
32     fXTwist(0.),fYTwist(0.)
33 {
34   //
35   // default constructor
36   //
37 }
38
39 AliTPCExBTwist::~AliTPCExBTwist() {
40   //
41   // default destructor
42   //
43 }
44
45
46
47 void AliTPCExBTwist::Init() {
48   //
49   // Initialization funtion
50   //
51   
52   AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
53   if (!magF) AliError("Magneticd field - not initialized");
54   Double_t bzField = magF->SolenoidField()/10.; //field in T
55   AliTPCParam *param= AliTPCcalibDB::Instance()->GetParameters();
56   if (!param) AliError("Parameters - not initialized");
57   Double_t vdrift = param->GetDriftV()/1000000.; // [cm/us]   // From dataBase: to be updated: per second (ideally)
58   Double_t ezField = 400; // [V/cm]   // to be updated: never (hopefully)
59   Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ; 
60   // Correction Terms for effective omegaTau; obtained by a laser calibration run
61   SetOmegaTauT1T2(wt,fT1,fT2);
62
63
64 }
65
66 void AliTPCExBTwist::Update(const TTimeStamp &/*timeStamp*/) {
67   //
68   // Update function 
69   //
70   AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
71   if (!magF) AliError("Magneticd field - not initialized");
72   Double_t bzField = magF->SolenoidField()/10.; //field in T
73   AliTPCParam *param= AliTPCcalibDB::Instance()->GetParameters();
74   if (!param) AliError("Parameters - not initialized");
75   Double_t vdrift = param->GetDriftV()/1000000.; // [cm/us]   // From dataBase: to be updated: per second (ideally)
76   Double_t ezField = 400; // [V/cm]   // to be updated: never (hopefully)
77   Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ; 
78   // Correction Terms for effective omegaTau; obtained by a laser calibration run
79   SetOmegaTauT1T2(wt,fT1,fT2);
80
81
82 }
83
84
85
86 void AliTPCExBTwist::GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]) {
87   //
88   // Calculates the correction of a mismatch between the E and B field axis
89   // 
90   
91   const Float_t zstart=x[2];
92   const Float_t zend  =(roc%36<18?fgkTPCZ0:-fgkTPCZ0);
93   const Float_t zdrift=zstart-zend;
94   
95   dx[0]=(fC2*fXTwist-fC1*fYTwist)*zdrift;
96   dx[1]=(fC1*fXTwist+fC2*fYTwist)*zdrift;
97   dx[2]=0.;
98 }
99
100 void AliTPCExBTwist::Print(const Option_t* option) const {
101   //
102   // Print function to check the settings (e.g. the twist in the X direction)
103   // option=="a" prints the C0 and C1 coefficents for calibration purposes
104   //
105
106   TString opt = option; opt.ToLower();
107   printf("%s\n",GetTitle());
108   
109   printf(" - Twist settings: X-Twist: %1.5f rad, Y-Twist: %1.5f rad \n",fXTwist,fYTwist);
110   if (opt.Contains("a")) { // Print all details
111     printf(" - T1: %1.4f, T2: %1.4f \n",fT1,fT2);
112     printf(" - C1: %1.4f, C2: %1.4f \n",fC1,fC2);
113   }    
114  
115  
116 }