Fixes for building of DA (Anshul)
[u/mrichter/AliRoot.git] / TPC / AliTPCCorrectionDrift.cxx
CommitLineData
80d3b55a 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// AliTPCCorrectionDrift class
19// linear drift corrections //
20//
21////////////////////////////////////////////////////////////////////////////
22#include "AliMagF.h"
23#include "TGeoGlobalMagField.h"
24#include "AliTPCcalibDB.h"
25#include "AliTPCParam.h"
26#include "AliLog.h"
27
28#include "TMath.h"
29#include "AliTPCROC.h"
30#include "AliTPCCorrectionDrift.h"
31ClassImp(AliTPCCorrectionDrift)
32
33AliTPCCorrectionDrift::AliTPCCorrectionDrift()
34 : AliTPCCorrection("CorrectionDrift","CorrectionDrift") ,
35 fZ0Aside(0), // z- t0*vdrift shift A side
36 fZ0Cside(0), // z- t0*vdrift shift C side
37 fVScale0(0), // drift velocity scaling - constant
38 fVScaleR(0), // drift velocity scaling - radial
39 fVScaleX(0), // drift velocity scaling - global x
40 fVScaleY(0), // drift velocity scaling - global y
41 fIROCZ0(0),
42 fOROCDZ(0)
43{
44 //
45 // default constructor
46 //
47}
48
49AliTPCCorrectionDrift::~AliTPCCorrectionDrift() {
50 //
51 // default destructor
52 //
53}
54
55
56
57void AliTPCCorrectionDrift::Init() {
58 //
59 // Initialization funtion
60 //
61
62
63
64}
65
66void AliTPCCorrectionDrift::Update(const TTimeStamp &/*timeStamp*/) {
67 //
68 // Update function
69 //
70
71}
72
73
74
75void AliTPCCorrectionDrift::GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]) {
76 //
77 // Calculates the correction due conical shape
78 //
79 AliTPCROC * calROC = AliTPCROC::Instance();
80 //const Double_t kRTPC0 =calROC->GetPadRowRadii(0,0);
81 const Double_t kRTPC1 =calROC->GetPadRowRadii(36,calROC->GetNRows(36)-1);
82 const Double_t kRIO =0.5*(calROC->GetPadRowRadii(0,calROC->GetNRows(0)-1)+calROC->GetPadRowRadii(36,0));
83 // Float_t rmiddle=(kRTPC0+kRTPC1)/2.;
84 //
85 //Double_t phi = TMath::ATan2(x[1],x[0]);
86 Double_t r = TMath::Sqrt(x[1]*x[1]+x[0]*x[0]);
87 Double_t driftN = 1.-TMath::Abs(x[2])/calROC->GetZLength(0); // drift from 0 to 1
88 //
89 Double_t dz0 =(roc%36<18) ? fZ0Aside:-fZ0Cside;
90 Double_t dscale= (fVScale0+(fVScaleR*r+fVScaleX*x[0]+fVScaleY*x[1])/kRTPC1);
91 Double_t ddrift=(roc%36<18) ? driftN*dscale*calROC->GetZLength(0):-driftN*dscale*calROC->GetZLength(0);
92 if (r<kRIO) dz0+=(roc%36<18) ? fIROCZ0:-fIROCZ0;
93 if (r>kRIO) dz0+=(roc%36<18) ? fOROCDZ*(r-kRIO):-fOROCDZ*(r-kRIO);
94 // Calculate correction in cartesian coordinates
95 dx[0] = 0;
96 dx[1] = 0;
97 dx[2] = dz0+ddrift; // z distortion not implemented (1st order distortions)
98
99}
100
101
102
103
104
105void AliTPCCorrectionDrift::Print(const Option_t* option) const {
106 //
107 // Print function to check the settings (e.g. the twist in the X direction)
108 //
109 //
110
111 TString opt = option; opt.ToLower();
112 printf("%s\t%s\n",GetName(),GetTitle());
113
114 if (opt.Contains("a")) { // Print all details
115 printf(" - T0A: %1.4f, T0C: %1.4f (cm)\n",fZ0Aside,fZ0Cside);
116 printf(" - Scale0: %1.4f, ScaleR: %1.4f \n",fVScale0,fVScaleR);
117 printf(" - ScaleX: %1.4f, ScaleY: %1.4f \n",fVScaleX,fVScaleY);
118
119 }
120
121
122}