1 /**************************************************************************
2 * Copyright(c) 2006-07, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 ///////////////////////////////////////////////////////////////////////////////
19 // Class describing the Vdrift dependencies on E,T,P and GasComposition //
20 // Authors: Stefan Rossegger, Haavard Helstrup //
22 ///////////////////////////////////////////////////////////////////////////////
27 #include "AliTPCTempMap.h"
28 #include "AliTPCSensorTempArray.h"
30 #include "AliTPCCalibVdrift.h"
32 ClassImp(AliTPCCalibVdrift)
34 namespace paramDefinitions {
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;
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;
53 Double_t krho = 0.934246; // density of TPC-Gas [kg/m^3]
54 // method of calculation: weighted average
58 using namespace paramDefinitions;
60 AliTPCCalibVdrift::AliTPCCalibVdrift(AliTPCSensorTempArray *SensTemp, AliDCSSensor *SensPres, TObject *SensGasComp):
68 // Standard constructor
73 fTempMap = new AliTPCTempMap(fSensTemp);
74 fSensGasComp = SensGasComp;
77 AliTPCCalibVdrift::AliTPCCalibVdrift(const AliTPCCalibVdrift& source) :
79 fSensTemp(source.fSensTemp),
80 fSensPres(source.fSensPres),
81 fTempMap(source.fTempMap),
82 fSensGasComp(source.fSensGasComp)
89 //_____________________________________________________________________________
91 AliTPCCalibVdrift& AliTPCCalibVdrift::operator=(const AliTPCCalibVdrift& source){
93 // assignment operator
95 if (&source == this) return *this;
96 new (this) AliTPCCalibVdrift(source);
101 //_____________________________________________________________________________
102 AliTPCCalibVdrift::~AliTPCCalibVdrift()
105 // AliTPCCalibVdrift destructor
110 Double_t AliTPCCalibVdrift::GetPTRelative(UInt_t timeSec, Int_t side){
112 // Get Relative difference of p/T for given time stamp
113 // timeSec - absolute time
114 // side - 0 - A side 1 -C side
116 TTimeStamp tstamp(timeSec);
117 if (!fSensPres) return 0;
118 Double_t pressure = fSensPres->GetValue(tstamp);
119 TLinearFitter * fitter = fTempMap->GetLinearFitter(3,side,tstamp);
120 if (!fitter) return 0;
122 fitter->GetParameters(vec);
124 if (vec[0]<10) return 0;
125 Double_t temperature = vec[0]+273.15;
126 Double_t povertMeas = pressure/temperature;
127 const Double_t torrTokPascal = 0.75006;
128 Double_t povertNom = kstdP/(torrTokPascal*kstdT);
129 return povertMeas/povertNom;
133 //_____________________________________________________________________________
134 Double_t AliTPCCalibVdrift::VdriftLinearHyperplaneApprox(Double_t dE, Double_t dT, Double_t dP, Double_t dCco2, Double_t dCn2)
137 // Returns approximated value for the driftvelocity based on
138 // linear Hyperplane approximation (~ Taylorapproximation of 1st order)
141 Double_t vdrift = (dE*kdvdE+dT*kdvdT+dP*kdvdP+dCco2*kdvdCco2+dCn2*kdvdCn2);
146 //_____________________________________________________________________________
148 Double_t AliTPCCalibVdrift::GetVdriftNominal()
150 // returns nominal Driftvelocity at StandardConditions
154 //_____________________________________________________________________________
156 Double_t AliTPCCalibVdrift::GetVdriftChange(Double_t x, Double_t y, Double_t z, UInt_t timeSec)
159 // Calculates Vdrift change in percent of Vdrift_nominal
160 // (under nominal conditions) at x,y,z,timeSec
163 // Get E-field Value --------------------------
164 Double_t dE = 0; //FIXME: eventually include Field-Inhomogenities
166 // Get Temperature Value ----------------------
167 AliTPCTempMap *tempMap = fTempMap;
168 Double_t tempValue = tempMap->GetTemperature(x, y, z, timeSec);
169 Double_t dT = tempValue+273.15 - kstdT;
171 // Get Main Pressure Value ---------------------
172 // FIXME: READ REAL PRESSURE SENSOR
173 // through TObject *fSensPres;
174 // e.g. Double_t PO = fSensPres->GetValue(timeSec);
176 // recalculate Pressure according to height in TPC and transform to
177 // TORR (with simplified hydrostatic formula)
178 Double_t dP = p0 - krho*kg*y/10000 /1000*760 - kstdP;
180 // Get GasComposition
181 // FIXME: include Goofy values for CO2 and N2 conzentration out of DCS?
182 // through TObject *fSensGasComp and calculate difference to stdCondit.
186 // Calculate change in drift velocity in terms of Vdrift_nominal
187 Double_t vdrift = VdriftLinearHyperplaneApprox(dE, dT, dP, dCco2, dCn2);
192 //_____________________________________________________________________________
194 Double_t AliTPCCalibVdrift::GetMeanZVdriftChange(Double_t x, Double_t y, UInt_t timeSec)
197 // Calculates Meanvalue in z direction of Vdrift change in percent
198 // of Vdrift_nominal (under standard conditions) at position x,y,timeSec
199 // with help of 'nPopints' base points
204 Double_t vdriftSum = 0;
206 for (Int_t i = 0; i<nPoints; i++) {
207 Double_t z = (Double_t)i/(nPoints-1)*500-250;
208 vdriftSum = vdriftSum + GetVdriftChange(x, y, z, timeSec);
211 Double_t meanZVdrift = vdriftSum/nPoints;
217 //_____________________________________________________________________________
219 TGraph *AliTPCCalibVdrift::MakeGraphMeanZVdriftChange(Double_t x, Double_t y, Int_t nPoints)
222 // Make graph from start time to end time of Mean Drift Velocity in
223 // Z direction at given x and y position
226 UInt_t startTime = fSensTemp->GetStartTime();
227 UInt_t endTime = fSensTemp->GetEndTime();
229 UInt_t stepTime = (endTime - startTime)/nPoints;
232 Double_t *xvec = new Double_t[nPoints];
233 Double_t *yvec = new Double_t[nPoints];
235 for (Int_t ip=0; ip<nPoints; ip++) {
236 xvec[ip] = startTime+ip*stepTime;
237 yvec[ip] = GetMeanZVdriftChange(x, y, ip*stepTime);
240 TGraph *graph = new TGraph(nPoints,xvec,yvec);
245 graph->GetXaxis()->SetTimeDisplay(1);
246 graph->GetXaxis()->SetLabelOffset(0.02);
247 graph->GetXaxis()->SetTimeFormat("#splitline{%d/%m}{%H:%M}");