]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCCalibVdrift.cxx
removing obsolete documant
[u/mrichter/AliRoot.git] / TPC / AliTPCCalibVdrift.cxx
1 /**************************************************************************
2  * Copyright(c) 2006-07, 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 //                                                                           //
19 // Class describing the Vdrift dependencies on E,T,P and GasComposition      //
20 // Authors: Stefan Rossegger, Haavard Helstrup                               //
21 //                                                                           //
22 ///////////////////////////////////////////////////////////////////////////////
23
24 #include "TSystem.h"
25 #include "TObject.h"
26 #include "TMath.h"
27 #include "AliTPCTempMap.h"
28 #include "AliTPCSensorTempArray.h"
29
30 #include "AliTPCCalibVdrift.h"
31
32 ClassImp(AliTPCCalibVdrift)
33
34   namespace paramDefinitions {
35     
36     // Standard Conditions used as origin in the Magbolz simulations
37     // Dimesions E [kV/cm], T [K], P [TORR], Cco2 [%], Cn2 [%]
38     const Double_t kstdE = 400;
39     const Double_t kstdT = 293;
40     const Double_t kstdP = 744;
41     const Double_t kstdCco2 = 9.52;
42     const Double_t kstdCn2 = 4.76;
43     // Driftvelocity at Standardcontitions [cm/microSec]
44     const Double_t kstdVdrift = 2.57563;
45     
46     // Vdrift dependencies simulated with Magbolz [%(Vdrift)/[unit]]
47     const Double_t kdvdE = 0.24;
48     const Double_t kdvdT = 0.30;
49     const Double_t kdvdP = -0.13;
50     const Double_t kdvdCco2 = -6.60;
51     const Double_t kdvdCn2 = -1.74;
52   
53     Double_t krho = 0.934246; // density of TPC-Gas [kg/m^3]
54                               // method of calculation: weighted average
55     Double_t kg = 9.81;
56 }
57
58 using namespace paramDefinitions;
59
60 AliTPCCalibVdrift::AliTPCCalibVdrift(AliTPCSensorTempArray *SensTemp, TObject *SensPres, TObject *SensGasComp):
61   TNamed(),
62   fSensTemp(0),
63   fSensPres(0),
64   fSensGasComp(0)
65 {
66   //
67   //  Standard constructor
68   //
69
70   fSensTemp = SensTemp;
71   fSensPres = SensPres;
72   fSensGasComp = SensGasComp;
73 }
74
75 AliTPCCalibVdrift::AliTPCCalibVdrift(const AliTPCCalibVdrift& source) :
76   TNamed(source),
77   fSensTemp(source.fSensTemp),
78   fSensPres(source.fSensPres),
79   fSensGasComp(source.fSensGasComp)
80 {
81   //
82   //  Copy constructor
83   //
84 }
85
86 //_____________________________________________________________________________
87
88 AliTPCCalibVdrift& AliTPCCalibVdrift::operator=(const AliTPCCalibVdrift& source){
89   //
90   // assignment operator
91   //
92   if (&source == this) return *this;
93   new (this) AliTPCCalibVdrift(source);
94   
95   return *this;  
96 }
97
98 //_____________________________________________________________________________
99 AliTPCCalibVdrift::~AliTPCCalibVdrift()
100 {
101   //
102   // AliTPCCalibVdrift destructor
103   //
104 }
105
106 //_____________________________________________________________________________
107 Double_t AliTPCCalibVdrift::VdriftLinearHyperplaneApprox(Double_t dE, Double_t dT, Double_t dP, Double_t dCco2, Double_t dCn2) 
108 {
109   //
110   // Returns approximated value for the driftvelocity based on  
111   // linear Hyperplane approximation (~ Taylorapproximation of 1st order)
112   //
113
114   Double_t vdrift = (dE*kdvdE+dT*kdvdT+dP*kdvdP+dCco2*kdvdCco2+dCn2*kdvdCn2);
115   
116   return vdrift; 
117
118 }
119 //_____________________________________________________________________________
120
121 Double_t AliTPCCalibVdrift::GetVdriftNominal() 
122 {
123   // returns nominal Driftvelocity at StandardConditions
124   return kstdVdrift;
125 }
126
127 //_____________________________________________________________________________
128
129 Double_t AliTPCCalibVdrift::GetVdriftChange(Double_t x, Double_t y, Double_t z, UInt_t timeSec)
130 {
131   // 
132   // Calculates Vdrift change in percent of Vdrift_nominal 
133   // (under nominal conditions) at x,y,z,timeSec
134   //
135
136   // Get E-field Value --------------------------
137   Double_t dE = 0; //FIXME: eventually include Field-Inhomogenities
138
139   // Get Temperature Value ----------------------  
140   AliTPCTempMap *tempMap = new AliTPCTempMap(fSensTemp);
141   Double_t tempValue = tempMap->GetTemperature(x, y, z, timeSec);
142   Double_t dT = tempValue+273.15 - kstdT;
143   
144   // Get Main Pressure Value ---------------------
145   // FIXME: READ REAL PRESSURE SENSOR  
146   //        through TObject *fSensPres; 
147   //        e.g. Double_t PO = fSensPres->GetValue(timeSec);  
148   Double_t p0 = 744;
149   // recalculate Pressure according to height in TPC and transform to
150   // TORR (with simplified hydrostatic formula)   
151   Double_t dP = p0 - krho*kg*y/10000 /1000*760 - kstdP;
152    
153   // Get GasComposition
154   // FIXME: include Goofy values for CO2 and N2 conzentration out of DCS? 
155   //   through TObject *fSensGasComp and calculate difference to stdCondit.
156   Double_t dCco2 = 0;
157   Double_t dCn2 = 0;
158
159   // Calculate change in drift velocity in terms of Vdrift_nominal
160   Double_t vdrift = VdriftLinearHyperplaneApprox(dE, dT, dP, dCco2, dCn2); 
161   
162   return vdrift;
163     
164   tempMap->~AliTPCTempMap();
165 }
166
167 //_____________________________________________________________________________
168
169 Double_t AliTPCCalibVdrift::GetMeanZVdriftChange(Double_t x, Double_t y, UInt_t timeSec)
170 {
171   // 
172   // Calculates Meanvalue in z direction of Vdrift change in percent 
173   // of Vdrift_nominal (under standard conditions) at position x,y,timeSec
174   // with help of 'nPopints' base points
175   //
176   
177   Int_t nPoints = 5;
178  
179   Double_t vdriftSum = 0;
180
181   for (Int_t i = 0; i<nPoints; i++) {
182     Double_t z = (Double_t)i/(nPoints-1)*500-250;
183     vdriftSum = vdriftSum + GetVdriftChange(x, y, z, timeSec);
184   }
185   
186   Double_t meanZVdrift = vdriftSum/nPoints;
187
188   return meanZVdrift;
189
190 }
191
192 //_____________________________________________________________________________
193
194 TGraph *AliTPCCalibVdrift::MakeGraphMeanZVdriftChange(Double_t x, Double_t y, Int_t nPoints)
195 {
196   //
197   // Make graph from start time to end time of Mean Drift Velocity in 
198   // Z direction at given x and y position
199   //
200
201   UInt_t startTime = fSensTemp->GetStartTime();
202   UInt_t endTime = fSensTemp->GetEndTime();
203   
204   UInt_t stepTime = (endTime - startTime)/nPoints;
205
206
207   Double_t *xvec = new Double_t[nPoints];
208   Double_t *yvec = new Double_t[nPoints];
209
210   for (Int_t ip=0; ip<nPoints; ip++) {
211     xvec[ip] = startTime+ip*stepTime;
212     yvec[ip] = GetMeanZVdriftChange(x, y, ip*stepTime);
213   }
214
215   TGraph *graph = new TGraph(nPoints,xvec,yvec);
216
217   delete [] xvec;
218   delete [] yvec;
219
220   graph->GetXaxis()->SetTimeDisplay(1);
221   graph->GetXaxis()->SetLabelOffset(0.02);
222   graph->GetXaxis()->SetTimeFormat("#splitline{%d/%m}{%H:%M}");
223
224   return graph;
225 }