doxy: all TPC root converted
[u/mrichter/AliRoot.git] / TPC / AliTPCExBConical.cxx
CommitLineData
ffab0c37 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
0fd1fc0b 16/// \class AliTPCExBConical
3a4edebe 17///
0fd1fc0b 18/// Calculates the space point distortions due to the conical shape of ALICE TPC.
3a4edebe 19///
0fd1fc0b 20/// Becasue of mechanical deformation ALICE TPC, chambers are misaligned in z direction
21/// TPC has roughly conical shape
3a4edebe 22///
0fd1fc0b 23/// For the moment ONLY efective correction used - NOT EDGE EFFECT calcualted
3a4edebe 24///
0fd1fc0b 25/// The class allows "effective Omega Tau" corrections.
3a4edebe 26///
0fd1fc0b 27/// Example usage:
28///
29/// ~~~{.cxx}
30/// AliTPCExBConical conical;
31/// conical.SetOmegaTauT1T2(0.32,1.,1.); // values ideally from OCDB
32/// conical.SetXConical(0.001); // set conical in X direction (in rad)
33/// // plot dRPhi distortions ...
34/// conical.CreateHistoDRPhiinZR(1.,100,100)->Draw("surf2");
35/// ~~~
3a4edebe 36///
0fd1fc0b 37/// \author Marian Ivanov, Jim Thomas, Magnus Mager, Stefan Rossegger
38/// \date 02/05/2010
39
534fd34a 40#include "AliMagF.h"
41#include "TGeoGlobalMagField.h"
42#include "AliTPCcalibDB.h"
43#include "AliTPCParam.h"
44#include "AliLog.h"
ffab0c37 45
46#include "TMath.h"
47#include "AliTPCROC.h"
48#include "AliTPCExBConical.h"
3a4edebe 49/// \cond CLASSIMP
ffab0c37 50ClassImp(AliTPCExBConical)
3a4edebe 51/// \endcond
ffab0c37 52
53AliTPCExBConical::AliTPCExBConical()
54 : AliTPCCorrection("exb_conical","ExB conical"),
55 fC1(0.),fC2(0.),fConicalFactor(0)
56{
57 //
58 // default constructor
59 //
60 for (Int_t i=0; i<3; i++){
61 fConicalA[i]= 0;
62 fConicalC[i]= 0;
63 }
64}
65
66AliTPCExBConical::~AliTPCExBConical() {
0fd1fc0b 67 /// default destructor
68
ffab0c37 69}
70
534fd34a 71
72
ffab0c37 73void AliTPCExBConical::Init() {
0fd1fc0b 74 /// Initialization funtion
75
534fd34a 76 AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
77 if (!magF) AliError("Magneticd field - not initialized");
0fd1fc0b 78 Double_t bzField = magF->SolenoidField()/10.; ///< field in T
534fd34a 79 AliTPCParam *param= AliTPCcalibDB::Instance()->GetParameters();
80 if (!param) AliError("Parameters - not initialized");
0fd1fc0b 81 Double_t vdrift = param->GetDriftV()/1000000.; ///< [cm/us] // From dataBase: to be updated: per second (ideally)
82 Double_t ezField = 400; ///< [V/cm] // to be updated: never (hopefully)
ffab0c37 83 Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ;
ffab0c37 84 // Correction Terms for effective omegaTau; obtained by a laser calibration run
534fd34a 85 SetOmegaTauT1T2(wt,fT1,fT2);
ffab0c37 86
ffab0c37 87
88}
89
90void AliTPCExBConical::Update(const TTimeStamp &/*timeStamp*/) {
0fd1fc0b 91 /// Update function
92
534fd34a 93 AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
94 if (!magF) AliError("Magneticd field - not initialized");
0fd1fc0b 95 Double_t bzField = magF->SolenoidField()/10.; ///< field in T
534fd34a 96 AliTPCParam *param= AliTPCcalibDB::Instance()->GetParameters();
97 if (!param) AliError("Parameters - not initialized");
0fd1fc0b 98 Double_t vdrift = param->GetDriftV()/1000000.; ///< [cm/us] // From dataBase: to be updated: per second (ideally)
99 Double_t ezField = 400; ///< [V/cm] // to be updated: never (hopefully)
ffab0c37 100 Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ;
ffab0c37 101 // Correction Terms for effective omegaTau; obtained by a laser calibration run
534fd34a 102 SetOmegaTauT1T2(wt,fT1,fT2);
103
ffab0c37 104
ffab0c37 105}
106
107
108
109void AliTPCExBConical::GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]) {
0fd1fc0b 110 /// Calculates the correction due conical shape
111
ffab0c37 112 AliTPCROC * calROC = AliTPCROC::Instance();
113 const Double_t kRTPC0 =calROC->GetPadRowRadii(0,0);
114 const Double_t kRTPC1 =calROC->GetPadRowRadii(36,calROC->GetNRows(36)-1);
115 Float_t rmiddle=(kRTPC0+kRTPC1)/2.;
116 //
117 Double_t phi =TMath::ATan2(x[1],x[0]);
118 Double_t r =TMath::Sqrt(x[1]*x[1]+x[0]*x[0]);
119 Double_t dTheta=0;
120 if (roc%36<18) dTheta = fConicalA[0]+TMath::Cos(phi)*fConicalA[1]+TMath::Sin(phi)*fConicalA[2];
121 if (roc%36>=18) {
122 dTheta = fConicalC[0]+TMath::Cos(phi)*fConicalC[1]+TMath::Sin(phi)*fConicalC[2];
123 }
124 Double_t corr=dTheta*fConicalFactor;
125 if (roc%36>=18) corr*=-1.;
126 Double_t drphi=fC1*corr;
127 Double_t dr =fC2*corr;
128 dx[0]= TMath::Cos(phi)*dr-TMath::Sin(phi)*drphi;
129 dx[1]= TMath::Sin(phi)*dr+TMath::Cos(phi)*drphi;
be67055b 130 dx[2]= -0.001*dTheta*(r-rmiddle); // dtheta in mrad
ffab0c37 131
132}
133
b1f0a2a5 134void AliTPCExBConical::Print(const Option_t* option) const {
0fd1fc0b 135 /// Print function to check the settings (e.g. the conical in the X direction)
136 /// option=="a" prints the C0 and C1 coefficents for calibration purposes
ffab0c37 137
138 TString opt = option; opt.ToLower();
534fd34a 139 printf("%s:%s\n",GetTitle(), GetName());
140 printf(" - T1: %1.4f, T2: %1.4f \n",fT1,fT2);
ffab0c37 141 printf("Conical settings: Empirical: %1.5f mm/mrad\n",fConicalFactor);
142 printf("Conical settings: A-Conical: %1.5f mrad:%1.5f mrad:%1.5f mrad \n",fConicalA[0],fConicalA[1],fConicalA[2]);
143 printf("Conical settings: C-Conical: %1.5f mrad:%1.5f mrad:%1.5f mrad \n",fConicalC[0],fConicalC[1],fConicalC[2]);
144
145}
146
147
148void AliTPCExBConical::SetConicalA(Float_t conicalA[3]){
0fd1fc0b 149 /// set paramters of conical shape - A side - obtained from alignment
150
ffab0c37 151 fConicalA[0]= conicalA[0]; // constant
152 fConicalA[1]= conicalA[1]; // cos
153 fConicalA[2]= conicalA[2]; // sin
154}
155void AliTPCExBConical::SetConicalC(Float_t conicalC[3]){
0fd1fc0b 156 /// set paramters of conical shape -C side obtained form the alignemnt
157
ffab0c37 158 fConicalC[0]= conicalC[0]; // constant
159 fConicalC[1]= conicalC[1]; // cos
160 fConicalC[2]= conicalC[2]; // sin
161}