AliRoot Core  a565103 (a565103)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliTPCExBEffectiveSector.cxx
Go to the documentation of this file.
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 
40 
41 #include "AliMagF.h"
42 #include "TGeoGlobalMagField.h"
43 #include "AliTPCcalibDB.h"
44 #include "AliTPCParam.h"
45 #include "AliLog.h"
46 
47 #include "TMath.h"
48 #include "AliTPCROC.h"
49 #include "TFile.h"
50 #include "TAxis.h"
51 #include "TTree.h"
52 #include "TTreeStream.h"
53 #include "THnSparse.h"
54 #include "THnBase.h"
55 #include "TProfile.h"
56 #include "TH2F.h"
57 #include "TH3F.h"
58 #include "TROOT.h"
63 
65  : AliTPCCorrection("ExB_effectiveSector","ExB effective sector"),
66  fC0(1.),fC1(0.),
67  fCorrectionR(0), // radial correction
68  fCorrectionRPhi(0), // r-phi correction
69  fCorrectionZ(0) // z correction
70 {
71  //
72  // default constructor
73  //
74 }
75 
78 
79  delete fCorrectionR; // radial correction
80  delete fCorrectionRPhi; // r-phi correction
81  delete fCorrectionZ; // z correction
82 }
83 
84 
85 
88 
89  AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
90  if (!magF) AliError("Magneticd field - not initialized");
91  Double_t bzField = magF->SolenoidField()/10.; //field in T
93  if (!param) AliError("Parameters - not initialized");
94  Double_t vdrift = param->GetDriftV()/1000000.; // [cm/us] // From dataBase: to be updated: per second (ideally)
95  Double_t ezField = 400; // [V/cm] // to be updated: never (hopefully)
96  Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ;
97  // Correction Terms for effective omegaTau; obtained by a laser calibration run
99 }
100 
101 void AliTPCExBEffectiveSector::Update(const TTimeStamp &/*timeStamp*/) {
103 
104  AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
105  if (!magF) AliError("Magneticd field - not initialized");
106  Double_t bzField = magF->SolenoidField()/10.; //field in T
108  if (!param) AliError("Parameters - not initialized");
109  Double_t vdrift = param->GetDriftV()/1000000.; // [cm/us] // From dataBase: to be updated: per second (ideally)
110  Double_t ezField = 400; // [V/cm] // to be updated: never (hopefully)
111  Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ;
112  // Correction Terms for effective omegaTau; obtained by a laser calibration run
113  SetOmegaTauT1T2(wt,fT1,fT2);
114 }
115 
116 
117 
118 void AliTPCExBEffectiveSector::GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]) {
121 
122  dx[0]=0;
123  dx[1]=0;
124  dx[2]=0;
125  if (!fCorrectionRPhi) return;
126  Double_t phi = TMath::ATan2(x[1],x[0]);
127  Double_t r = TMath::Sqrt(x[1]*x[1]+x[0]*x[0]);
128  Double_t sector = 9.*phi/TMath::Pi();
129  if (sector<0) sector+=18.;
130  Double_t kZ=x[2]/r;
131  //
132  if (kZ>1.2) kZ= 1.2;
133  if (kZ<-1.2) kZ= -1.2;
134  if (roc%36<18) kZ= TMath::Abs(kZ);
135  if (roc%36>=18) kZ=-TMath::Abs(kZ);
136  if (TMath::Abs(kZ)<0.15){
137  kZ = (roc%36<18) ? 0.15:-0.15;
138  }
139  //
140  Double_t dlR=0;
141  Double_t dlRPhi=0;
142  Double_t dlZ=0;
143  Double_t rr=TMath::Max(r,fCorrectionRPhi->GetYaxis()->GetXmin()+0.01);
144  rr=TMath::Min(rr,fCorrectionRPhi->GetYaxis()->GetXmax()-0.01);
145  Double_t kZZ=TMath::Max(kZ,fCorrectionRPhi->GetZaxis()->GetXmin()+0.001);
146  kZZ=TMath::Min(kZZ,fCorrectionRPhi->GetZaxis()->GetXmax()-0.001);
147 
148  if (fCorrectionRPhi) {
149  // dlRPhi= -fCorrectionRPhi->Interpolate(sector,rr,kZZ);
150  dlRPhi= -fCorrectionRPhi->GetBinContent(fCorrectionRPhi->FindBin(sector,rr,kZZ));
151  }
152  if (fCorrectionR) {
153  // dlR= -fCorrectionR->Interpolate(sector,rr,kZZ);
154  dlR= -fCorrectionR->GetBinContent(fCorrectionR->FindBin(sector,rr,kZZ));
155  }
156  if (fCorrectionZ) {
157  // dlZ= -fCorrectionZ->Interpolate(sector,rr,kZZ);
158  dlZ= -fCorrectionZ->GetBinContent(fCorrectionZ->FindBin(sector,rr,kZZ));
159  }
160  Double_t dr = fC0*dlR + fC1*dlRPhi;
161  Double_t drphi = -fC1*dlR + fC0*dlRPhi;
162  // Calculate distorted position
163  if ( r > 0.0 ) {
164  r = r + dr;
165  phi = phi + drphi/r;
166  }
167  // Calculate correction in cartesian coordinates
168  dx[0] = r * TMath::Cos(phi) - x[0];
169  dx[1] = r * TMath::Sin(phi) - x[1];
170  dx[2] = dlZ;
171 
172 }
173 
174 void AliTPCExBEffectiveSector::Print(const Option_t* option) const {
177 
178  TString opt = option; opt.ToLower();
179  printf("%s\t%s\n",GetName(),GetTitle());
180  if (opt.Contains("a")) { // Print all details
181  printf(" - T1: %1.4f, T2: %1.4f \n",fT1,fT2);
182  printf(" - C0: %1.4f, C1: %1.4f \n",fC0,fC1);
183  }
184 }
185 
static AliTPCcalibDB * Instance()
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
TH3F * fCorrectionR
radial correction
virtual void SetOmegaTauT1T2(Float_t omegaTau, Float_t t1, Float_t t2)
virtual void GetCorrection(const Float_t x[], const Short_t roc, Float_t dx[])
Manager and of geomety classes for set: TPC.
Definition: AliTPCParam.h:18
Float_t GetDriftV() const
Definition: AliTPCParam.h:341
AliTPCParam * GetParameters() const
virtual void Update(const TTimeStamp &timeStamp)
Double_t fT1
tensor term of wt - T1
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
AliTPCCorrection class.
TH3F * fCorrectionRPhi
r-phi correction
Double_t fC1
coefficient C1 (compare Jim Thomas's notes for definitions)
void Print(const Option_t *option) const
Double_t fC0
coefficient C0 (compare Jim Thomas's notes for definitions)
Double_t fT2
tensor term of wt - T2
Double_t vdrift
Definition: DriftKalman.C:98
Correct for the rest of ExB effect which are not covered yet by physical models.