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, TObject *SensPres, TObject *SensGasComp):
67 // Standard constructor
72 fSensGasComp = SensGasComp;
75 AliTPCCalibVdrift::AliTPCCalibVdrift(const AliTPCCalibVdrift& source) :
77 fSensTemp(source.fSensTemp),
78 fSensPres(source.fSensPres),
79 fSensGasComp(source.fSensGasComp)
86 //_____________________________________________________________________________
88 AliTPCCalibVdrift& AliTPCCalibVdrift::operator=(const AliTPCCalibVdrift& source){
90 // assignment operator
92 if (&source == this) return *this;
93 new (this) AliTPCCalibVdrift(source);
98 //_____________________________________________________________________________
99 AliTPCCalibVdrift::~AliTPCCalibVdrift()
102 // AliTPCCalibVdrift destructor
106 //_____________________________________________________________________________
107 Double_t AliTPCCalibVdrift::VdriftLinearHyperplaneApprox(Double_t dE, Double_t dT, Double_t dP, Double_t dCco2, Double_t dCn2)
110 // Returns approximated value for the driftvelocity based on
111 // linear Hyperplane approximation (~ Taylorapproximation of 1st order)
114 Double_t vdrift = (dE*kdvdE+dT*kdvdT+dP*kdvdP+dCco2*kdvdCco2+dCn2*kdvdCn2);
119 //_____________________________________________________________________________
121 Double_t AliTPCCalibVdrift::GetVdriftNominal()
123 // returns nominal Driftvelocity at StandardConditions
127 //_____________________________________________________________________________
129 Double_t AliTPCCalibVdrift::GetVdriftChange(Double_t x, Double_t y, Double_t z, UInt_t timeSec)
132 // Calculates Vdrift change in percent of Vdrift_nominal
133 // (under nominal conditions) at x,y,z,timeSec
136 // Get E-field Value --------------------------
137 Double_t dE = 0; //FIXME: eventually include Field-Inhomogenities
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;
144 // Get Main Pressure Value ---------------------
145 // FIXME: READ REAL PRESSURE SENSOR
146 // through TObject *fSensPres;
147 // e.g. Double_t PO = fSensPres->GetValue(timeSec);
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;
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.
159 // Calculate change in drift velocity in terms of Vdrift_nominal
160 Double_t vdrift = VdriftLinearHyperplaneApprox(dE, dT, dP, dCco2, dCn2);
164 tempMap->~AliTPCTempMap();
167 //_____________________________________________________________________________
169 Double_t AliTPCCalibVdrift::GetMeanZVdriftChange(Double_t x, Double_t y, UInt_t timeSec)
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
179 Double_t vdriftSum = 0;
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);
186 Double_t meanZVdrift = vdriftSum/nPoints;
192 //_____________________________________________________________________________
194 TGraph *AliTPCCalibVdrift::MakeGraphMeanZVdriftChange(Double_t x, Double_t y, Int_t nPoints)
197 // Make graph from start time to end time of Mean Drift Velocity in
198 // Z direction at given x and y position
201 UInt_t startTime = fSensTemp->GetStartTime();
202 UInt_t endTime = fSensTemp->GetEndTime();
204 UInt_t stepTime = (endTime - startTime)/nPoints;
207 Double_t *xvec = new Double_t[nPoints];
208 Double_t *yvec = new Double_t[nPoints];
210 for (Int_t ip=0; ip<nPoints; ip++) {
211 xvec[ip] = startTime+ip*stepTime;
212 yvec[ip] = GetMeanZVdriftChange(x, y, ip*stepTime);
215 TGraph *graph = new TGraph(nPoints,xvec,yvec);
220 graph->GetXaxis()->SetTimeDisplay(1);
221 graph->GetXaxis()->SetLabelOffset(0.02);
222 graph->GetXaxis()->SetTimeFormat("#splitline{%d/%m}{%H:%M}");