]>
Commit | Line | Data |
---|---|---|
0116859c | 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 | ||
7d855b04 | 16 | /// \class AliTPCExBBShape |
17 | /// \brief AliTPCExBBShape class | |
0116859c | 18 | |
19 | #include <AliMagF.h> | |
534fd34a | 20 | #include "TGeoGlobalMagField.h" |
21 | #include "AliTPCcalibDB.h" | |
22 | #include "AliTPCParam.h" | |
23 | #include "AliLog.h" | |
0116859c | 24 | |
25 | #include "AliTPCExBBShape.h" | |
26 | ||
27 | AliTPCExBBShape::AliTPCExBBShape() | |
28 | : AliTPCCorrection("exb_bshape","ExB B-shape"), | |
29 | fC1(0.),fC2(0.), | |
b3abc262 | 30 | fScaling(1.), |
0116859c | 31 | fBField(0) |
32 | { | |
7d855b04 | 33 | /// default constructor |
34 | ||
0116859c | 35 | } |
36 | ||
37 | AliTPCExBBShape::~AliTPCExBBShape() { | |
7d855b04 | 38 | /// virtual destructor |
39 | ||
0116859c | 40 | } |
41 | ||
b3abc262 | 42 | |
43 | ||
44 | ||
45 | Bool_t AliTPCExBBShape::AddCorrectionCompact(AliTPCCorrection* corr, Double_t weight){ | |
7d855b04 | 46 | /// Add correction and make them compact |
47 | /// Assumptions: | |
48 | /// - origin of distortion/correction are additive | |
49 | /// - only correction ot the same type supported () | |
50 | ||
b3abc262 | 51 | if (corr==NULL) { |
7d855b04 | 52 | AliError("Zerro pointer - correction"); |
b3abc262 | 53 | return kFALSE; |
7d855b04 | 54 | } |
b3abc262 | 55 | AliTPCExBBShape* corrC = dynamic_cast<AliTPCExBBShape *>(corr); |
56 | if (corrC == NULL) { | |
57 | AliError(TString::Format("Inconsistent class types: %s\%s",IsA()->GetName(),corr->IsA()->GetName()).Data()); | |
58 | return kFALSE; | |
59 | } | |
60 | fScaling= weight; | |
61 | // | |
62 | return kTRUE; | |
63 | } | |
64 | ||
65 | ||
e527a1b9 | 66 | void AliTPCExBBShape::Init() { |
7d855b04 | 67 | /// Initialization funtion |
68 | ||
534fd34a | 69 | AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField(); |
70 | if (!magF) AliError("Magneticd field - not initialized"); | |
71 | Double_t bzField = magF->SolenoidField()/10.; //field in T | |
72 | SetBField(magF); | |
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) | |
e527a1b9 | 76 | Double_t ezField = 400; // [V/cm] // to be updated: never (hopefully) |
7d855b04 | 77 | Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ; |
e527a1b9 | 78 | // Correction Terms for effective omegaTau; obtained by a laser calibration run |
534fd34a | 79 | SetOmegaTauT1T2(wt,fT1,fT2); |
e527a1b9 | 80 | |
81 | ||
82 | } | |
83 | ||
84 | void AliTPCExBBShape::Update(const TTimeStamp &/*timeStamp*/) { | |
7d855b04 | 85 | /// Update function |
86 | ||
534fd34a | 87 | AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField(); |
88 | if (!magF) AliError("Magneticd field - not initialized"); | |
89 | Double_t bzField = magF->SolenoidField()/10.; //field in T | |
90 | SetBField(magF); | |
91 | AliTPCParam *param= AliTPCcalibDB::Instance()->GetParameters(); | |
92 | if (!param) AliError("Parameters - not initialized"); | |
93 | Double_t vdrift = param->GetDriftV()/1000000.; // [cm/us] // From dataBase: to be updated: per second (ideally) | |
e527a1b9 | 94 | Double_t ezField = 400; // [V/cm] // to be updated: never (hopefully) |
7d855b04 | 95 | Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ; |
e527a1b9 | 96 | // Correction Terms for effective omegaTau; obtained by a laser calibration run |
534fd34a | 97 | SetOmegaTauT1T2(wt,fT1,fT2); |
e527a1b9 | 98 | |
99 | ||
100 | } | |
101 | ||
102 | ||
103 | ||
0116859c | 104 | void AliTPCExBBShape::GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]) { |
7d855b04 | 105 | /// Calculates the space point corrections of the B field inperfections (B field shape) |
0116859c | 106 | |
107 | if (!fBField) { | |
108 | for (Int_t j=0;j<3;++j) dx[j]=0.; | |
109 | return; | |
110 | } | |
111 | ||
112 | const Double_t xStart[3]={ x[0], x[1], x[2] }; | |
b1f0a2a5 | 113 | const Double_t xEnd[3]={ x[0], x[1], roc%36<18?fgkTPCZ0:-fgkTPCZ0 }; |
0116859c | 114 | |
115 | Double_t intBStart[3]; | |
116 | Double_t intBEnd[3]; | |
117 | ||
118 | fBField->GetTPCRatInt(xStart,intBStart); | |
119 | fBField->GetTPCRatInt(xEnd, intBEnd ); | |
120 | ||
b3abc262 | 121 | const Float_t intBxOverBz=fScaling*(intBEnd[0]-intBStart[0]); |
122 | const Float_t intByOverBz=fScaling*(intBEnd[1]-intBStart[1]); | |
7d855b04 | 123 | |
0116859c | 124 | dx[0]=fC2*intBxOverBz-fC1*intByOverBz; |
125 | dx[1]=fC1*intBxOverBz+fC2*intByOverBz; | |
126 | dx[2]=0.; | |
127 | ||
128 | ||
129 | } | |
130 | ||
131 | void AliTPCExBBShape::GetBxAndByOverBz(const Float_t x[],const Short_t roc,Float_t BxByOverBz[]) { | |
7d855b04 | 132 | /// This function is purely for calibration purposes |
133 | /// Returns the via AliMagF obtaind B field integrals | |
0116859c | 134 | |
135 | if (!fBField) { | |
136 | for (Int_t j=0;j<3;++j) BxByOverBz[j]=0.; | |
137 | return; | |
138 | } | |
139 | ||
140 | const Double_t xStart[3]={ x[0], x[1], x[2] }; | |
b1f0a2a5 | 141 | const Double_t xEnd[3]={ x[0], x[1], roc%36<18?fgkTPCZ0:-fgkTPCZ0 }; |
0116859c | 142 | |
143 | Double_t intBStart[3]; | |
144 | Double_t intBEnd[3]; | |
145 | ||
146 | fBField->GetTPCRatInt(xStart,intBStart); | |
147 | fBField->GetTPCRatInt(xEnd, intBEnd ); | |
148 | ||
b3abc262 | 149 | const Float_t intBxOverBz=fScaling*(intBEnd[0]-intBStart[0]); |
150 | const Float_t intByOverBz=fScaling*(intBEnd[1]-intBStart[1]); | |
7d855b04 | 151 | |
0116859c | 152 | BxByOverBz[0]=intBxOverBz; |
153 | BxByOverBz[1]=intByOverBz; | |
154 | ||
155 | } | |
156 | ||
157 | void AliTPCExBBShape::Print(Option_t* option) const { | |
7d855b04 | 158 | /// Print function to check the settings (e.g. voltage offsets) |
159 | /// option=="a" prints details of the B field settings and the | |
160 | /// C0 and C1 coefficents (for calibration purposes) | |
161 | ||
0116859c | 162 | TString opt = option; opt.ToLower(); |
534fd34a | 163 | printf("%s\t%s\n - B field settings:\n",GetTitle(),GetName()); |
0116859c | 164 | fBField->Print(option); |
165 | // printf(" - B field: X-Twist: %1.5lf rad, Y-Twist: %1.5lf rad \n",fBField->Print(option)); | |
7d855b04 | 166 | if (opt.Contains("a")) { // Print all details |
534fd34a | 167 | printf(" - T1: %1.4f, T2: %1.4f \n",fT1,fT2); |
0116859c | 168 | printf(" - C1: %1.4f, C2: %1.4f \n",fC1,fC2); |
7d855b04 | 169 | } |
0116859c | 170 | } |
46e89793 | 171 | |
172 | Double_t AliTPCExBBShape::GetBFieldXYZ(Double_t gx, Double_t gy, Double_t gz, Int_t axisType){ | |
7d855b04 | 173 | /// return B field at given x,y,z |
174 | ||
46e89793 | 175 | AliMagF* field = (AliMagF*)TGeoGlobalMagField::Instance()->GetField(); |
176 | if (!field) return 0; | |
177 | Double_t xyz[3]={gx,gy,gz}; | |
178 | Double_t bxyz[3]={0}; | |
179 | field->Field(xyz,bxyz); | |
180 | // | |
181 | Double_t r=TMath::Sqrt(gx*gx+gy*gy); | |
a8ef8a9c | 182 | // Double_t b=TMath::Sqrt(bxyz[0]*bxyz[0]+bxyz[1]*bxyz[1]); |
46e89793 | 183 | if (axisType==0) { |
184 | return (xyz[0]*bxyz[1]-xyz[1]*bxyz[0])/(bxyz[2]*r); | |
185 | } | |
186 | if (axisType==1){ | |
187 | return (xyz[0]*bxyz[0]+xyz[1]*bxyz[1])/(bxyz[2]*r); | |
188 | } | |
189 | if (axisType==2) return bxyz[2]; | |
190 | if (axisType==3) return bxyz[0]; | |
191 | if (axisType==4) return bxyz[1]; | |
192 | if (axisType==5) return bxyz[2]; | |
193 | return bxyz[2]; | |
194 | } |