Merge with TRD-develop
[u/mrichter/AliRoot.git] / TRD / AliTRDsim.cxx
CommitLineData
46d29e70 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$Log$
0e9c2ad5 18Revision 1.4 2000/10/06 16:49:46 cblume
19Made Getters const
20
46d29e70 21Revision 1.3.2.1 2000/09/18 13:45:30 cblume
22New class AliTRDsim that simulates TR photons
23
24Revision 1.2 1999/09/29 09:24:35 fca
25Introduction of the Copyright and cvs Log
26
27*/
28
29///////////////////////////////////////////////////////////////////////////////
30// //
31// TRD simulation - multimodule (regular rad.) //
32// after: M. CASTELLANO et al., COMP. PHYS. COMM. 51 (1988) 431 //
33// + COMP. PHYS. COMM. 61 (1990) 395 //
34// //
35// 17.07.1998 - A.Andronic //
36// 08.12.1998 - simplified version //
37// 11.07.2000 - Adapted code to aliroot environment (C.Blume) //
38// //
39///////////////////////////////////////////////////////////////////////////////
40
41#include <stdlib.h>
42
0e9c2ad5 43#include <TH1.h>
44#include <TRandom.h>
45#include <TMath.h>
46#include <TParticle.h>
46d29e70 47
46d29e70 48#include "AliModule.h"
49
0e9c2ad5 50#include "AliTRDsim.h"
51
46d29e70 52ClassImp(AliTRDsim)
53
54//_____________________________________________________________________________
55AliTRDsim::AliTRDsim():TObject()
56{
57 //
58 // AliTRDsim default constructor
59 //
60
61 Init();
62
63}
64
65//_____________________________________________________________________________
66AliTRDsim::AliTRDsim(AliModule *mod, Int_t foil, Int_t gap)
67{
68 //
69 // AliTRDsim constructor. Takes the material properties of the radiator
70 // foils and the gas in the gaps from AliModule <mod>.
71 // The default number of foils is 100 with a thickness of 20 mu. The
72 // thickness of the gaps is 500 mu.
73 //
74
75 Float_t aFoil, zFoil, rhoFoil;
76 Float_t aGap, zGap, rhoGap;
77 Float_t rad, abs;
78 Char_t name[21];
79
80 Init();
81
82 mod->AliGetMaterial(foil,name,aFoil,zFoil,rhoFoil,rad,abs);
83 mod->AliGetMaterial(gap ,name,aGap ,zGap ,rhoGap ,rad,abs);
84
85 fFoilDens = rhoFoil;
86 fFoilA = aFoil;
87 fFoilZ = zFoil;
88 fFoilOmega = Omega(fFoilDens,fFoilZ,fFoilA);
89
90 fGapDens = rhoGap;
91 fGapA = aGap;
92 fGapZ = zGap;
93 fGapOmega = Omega(fGapDens ,fGapZ ,fGapA );
94
95}
96
97//_____________________________________________________________________________
98AliTRDsim::AliTRDsim(const AliTRDsim &s)
99{
100 //
101 // AliTRDsim copy constructor
102 //
103
104 ((AliTRDsim &) s).Copy(*this);
105
106}
107
108//_____________________________________________________________________________
109AliTRDsim::~AliTRDsim()
110{
111 //
112 // AliTRDsim destructor
113 //
114
115 if (fSpectrum) delete fSpectrum;
116 if (fSigma) delete fSigma;
117
118}
119
120//_____________________________________________________________________________
121AliTRDsim &AliTRDsim::operator=(const AliTRDsim &s)
122{
123 //
124 // Assignment operator
125 //
126
127 if (this != &s) ((AliTRDsim &) s).Copy(*this);
128 return *this;
129
130}
131
132//_____________________________________________________________________________
133void AliTRDsim::Copy(TObject &s)
134{
135 //
136 // Copy function
137 //
138
139 ((AliTRDsim &) s).fNFoils = fNFoils;
140 ((AliTRDsim &) s).fFoilThick = fFoilThick;
141 ((AliTRDsim &) s).fFoilDens = fFoilDens;
142 ((AliTRDsim &) s).fFoilOmega = fFoilOmega;
143 ((AliTRDsim &) s).fFoilZ = fFoilZ;
144 ((AliTRDsim &) s).fFoilA = fFoilA;
145 ((AliTRDsim &) s).fGapThick = fGapThick;
146 ((AliTRDsim &) s).fGapDens = fGapDens;
147 ((AliTRDsim &) s).fGapOmega = fGapOmega;
148 ((AliTRDsim &) s).fGapZ = fGapZ;
149 ((AliTRDsim &) s).fGapA = fGapA;
150 ((AliTRDsim &) s).fTemp = fTemp;
151 ((AliTRDsim &) s).fSpNBins = fSpNBins;
152 ((AliTRDsim &) s).fSpRange = fSpRange;
153 ((AliTRDsim &) s).fSpBinWidth = fSpBinWidth;
154 ((AliTRDsim &) s).fSpLower = fSpLower;
155 ((AliTRDsim &) s).fSpUpper = fSpUpper;
156
157 if (((AliTRDsim &) s).fSigma) delete ((AliTRDsim &) s).fSigma;
158 ((AliTRDsim &) s).fSigma = new Double_t[fSpNBins];
159 for (Int_t iBin = 0; iBin < fSpNBins; iBin++) {
160 ((AliTRDsim &) s).fSigma[iBin] = fSigma[iBin];
161 }
162
163 fSpectrum->Copy(*((AliTRDsim &) s).fSpectrum);
164
165}
166
167//_____________________________________________________________________________
168void AliTRDsim::Init()
169{
170 //
171 // Initialization
172 // The default radiator are 100 prolypropilene foils of 20 mu thickness
173 // with gaps of 500 mu filled with CO2.
174 //
175 //
176
177 fNFoils = 100;
178
179 fFoilThick = 0.0020;
180 fFoilDens = 0.92;
181 fFoilZ = 5.28571;
182 fFoilA = 10.4286;
183 fFoilOmega = Omega(fFoilDens,fFoilZ,fFoilA);
184
185 fGapThick = 0.0500;
186 fGapDens = 0.001977;
187 fGapZ = 7.45455;
188 fGapA = 14.9091;
189 fGapOmega = Omega(fGapDens ,fGapZ ,fGapA );
190
191 fTemp = 293.16;
192
193 fSpNBins = 200;
194 fSpRange = 100;
195 fSpBinWidth = fSpRange / fSpNBins;
196 fSpLower = 1.0 - 0.5 * fSpBinWidth;
197 fSpUpper = fSpLower + fSpRange;
198
199 if (fSpectrum) delete fSpectrum;
200 fSpectrum = new TH1D("TRspectrum","TR spectrum",fSpNBins,fSpLower,fSpUpper);
201
202 // Set the sigma values
203 SetSigma();
204
205}
206
207//_____________________________________________________________________________
208Int_t AliTRDsim::CreatePhotons(Int_t pdg, Float_t p
209 , Int_t &nPhoton, Float_t *ePhoton)
210{
211 //
212 // Create TRD photons for a charged particle of type <pdg> with the total
213 // momentum <p>.
214 // Number of produced TR photons: <nPhoton>
215 // Energies of the produced TR photons: <ePhoton>
216 //
217
218 // PDG codes
219 const Int_t kPdgEle = 11;
220 const Int_t kPdgMuon = 13;
221 const Int_t kPdgPion = 211;
222 const Int_t kPdgKaon = 321;
223
224 Float_t mass = 0;
225 switch (TMath::Abs(pdg)) {
226 case kPdgEle:
227 mass = 5.11e-4;
228 break;
229 case kPdgMuon:
230 mass = 0.10566;
231 break;
232 case kPdgPion:
233 mass = 0.13957;
234 break;
235 case kPdgKaon:
236 mass = 0.4937;
237 break;
238 default:
239 return 0;
240 break;
241 };
242
243 // Calculate gamma
244 Double_t gamma = TMath::Sqrt(p*p + mass*mass) / mass;
245
246 // Calculate the TR photons
247 return TrPhotons(gamma, nPhoton, ePhoton);
248
249}
250
251//_____________________________________________________________________________
252Int_t AliTRDsim::TrPhotons(Double_t gamma, Int_t &nPhoton, Float_t *ePhoton)
253{
254 //
255 // Produces TR photons.
256 //
257
258 const Double_t kAlpha = 0.0072973;
259 const Int_t kSumMax = 10;
260
261 Double_t kappa = fGapThick / fFoilThick;
262
263 fSpectrum->Reset();
264
265 // The TR spectrum
266 Double_t stemp = 0;
267 for (Int_t iBin = 0; iBin < fSpNBins; iBin++) {
268
269 // keV -> eV
270 Double_t energyeV = (fSpBinWidth * iBin + 1.0) * 1e3;
271
272 Double_t csFoil = fFoilOmega / energyeV;
273 Double_t csGap = fGapOmega / energyeV;
274
275 Double_t rho1 = energyeV * fFoilThick * 1e4 * 2.5
276 * (1.0 / (gamma*gamma) + csFoil*csFoil);
277 Double_t rho2 = energyeV * fFoilThick * 1e4 * 2.5
278 * (1.0 / (gamma*gamma) + csGap *csGap);
279
280 // Calculate the sum
281 Double_t sum = 0;
282 for (Int_t iSum = 0; iSum < kSumMax; iSum++) {
283 Double_t tetan = (TMath::Pi() * 2.0 * (iSum+1) - (rho1 + kappa * rho2))
284 / (kappa + 1.0);
285 if (tetan < 0.0) tetan = 0.0;
286 Double_t aux = 1.0 / (rho1 + tetan) - 1.0 / (rho2 + tetan);
287 sum += tetan * (aux*aux) * (1.0 - TMath::Cos(rho1 + tetan));
288 }
289
290 // Absorbtion
291 Double_t conv = 1.0 - TMath::Exp(-fNFoils * fSigma[iBin]);
292
293 // eV -> keV
294 Float_t energykeV = energyeV * 0.001;
295
296 // dN / domega
297 Double_t wn = kAlpha * 4.0 / (fSigma[iBin] * (kappa + 1.0))
298 * conv * sum / energykeV;
299 fSpectrum->SetBinContent(iBin,wn);
300
301 stemp += wn;
302
303 }
304
305 // <nTR> (binsize corr.)
306 Float_t ntr = stemp * fSpBinWidth;
307 // Number of TR photons from Poisson distribution with mean <ntr>
308 nPhoton = gRandom->Poisson(ntr);
309 // Energy of the TR photons
310 for (Int_t iPhoton = 0; iPhoton < nPhoton; iPhoton++) {
311 ePhoton[iPhoton] = fSpectrum->GetRandom();
312 }
313
314 return 1;
315
316}
317
318//_____________________________________________________________________________
319void AliTRDsim::SetSigma()
320{
321 //
322 // Sets the absorbtion crosssection for the energies of the TR spectrum
323 //
324
325 if (fSigma) delete fSigma;
326 fSigma = new Double_t[fSpNBins];
327 for (Int_t iBin = 0; iBin < fSpNBins; iBin++) {
328 Double_t energykeV = iBin * fSpBinWidth + 1.0;
329 fSigma[iBin] = Sigma(energykeV);
330 //printf("SetSigma(): iBin = %d fSigma %g\n",iBin,fSigma[iBin]);
331 }
332
333}
334
335//_____________________________________________________________________________
336Double_t AliTRDsim::Sigma(Double_t energykeV)
337{
338 //
339 // Calculates the absorbtion crosssection for a one-foil-one-gap-radiator
340 //
341
342 // Gas at 0 C
343 const Double_t kTemp0 = 273.16;
344
345 // keV -> MeV
346 Double_t energyMeV = energykeV * 0.001;
347 if (energyMeV >= 0.001) {
348 return(GetMuPo(energyMeV) * fFoilDens * fFoilThick +
349 GetMuCO(energyMeV) * fGapDens * fGapThick * fTemp/kTemp0);
350 }
351 else {
352 return 1e6;
353 }
354
355}
356
357//_____________________________________________________________________________
358Double_t AliTRDsim::GetMuPo(Double_t energyMeV)
359{
360 //
361 // Returns the photon absorbtion cross section for polypropylene
362 //
363
364 const Int_t kN = 36;
365
366 Double_t mu[kN] = { 1.894E+03, 5.999E+02, 2.593E+02
367 , 7.743E+01, 3.242E+01, 1.643E+01
368 , 9.432E+00, 3.975E+00, 2.088E+00
369 , 7.452E-01, 4.315E-01, 2.706E-01
370 , 2.275E-01, 2.084E-01, 1.970E-01
371 , 1.823E-01, 1.719E-01, 1.534E-01
372 , 1.402E-01, 1.217E-01, 1.089E-01
373 , 9.947E-02, 9.198E-02, 8.078E-02
374 , 7.262E-02, 6.495E-02, 5.910E-02
375 , 5.064E-02, 4.045E-02, 3.444E-02
376 , 3.045E-02, 2.760E-02, 2.383E-02
377 , 2.145E-02, 1.819E-02, 1.658E-02 };
378
379 Double_t en[kN] = { 1.000E-03, 1.500E-03, 2.000E-03
380 , 3.000E-03, 4.000E-03, 5.000E-03
381 , 6.000E-03, 8.000E-03, 1.000E-02
382 , 1.500E-02, 2.000E-02, 3.000E-02
383 , 4.000E-02, 5.000E-02, 6.000E-02
384 , 8.000E-02, 1.000E-01, 1.500E-01
385 , 2.000E-01, 3.000E-01, 4.000E-01
386 , 5.000E-01, 6.000E-01, 8.000E-01
387 , 1.000E+00, 1.250E+00, 1.500E+00
388 , 2.000E+00, 3.000E+00, 4.000E+00
389 , 5.000E+00, 6.000E+00, 8.000E+00
390 , 1.000E+01, 1.500E+01, 2.000E+01 };
391
392 return Interpolate(energyMeV,en,mu,kN);
393
394}
395
396//_____________________________________________________________________________
397Double_t AliTRDsim::GetMuCO(Double_t energyMeV)
398{
399 //
400 // Returns the photon absorbtion cross section for CO2
401 //
402
403 const Int_t kN = 36;
404
405 Double_t mu[kN] = { 0.39383E+04, 0.13166E+04, 0.58750E+03
406 , 0.18240E+03, 0.77996E+02, 0.40024E+02
407 , 0.23116E+02, 0.96997E+01, 0.49726E+01
408 , 0.15543E+01, 0.74915E+00, 0.34442E+00
409 , 0.24440E+00, 0.20589E+00, 0.18632E+00
410 , 0.16578E+00, 0.15394E+00, 0.13558E+00
411 , 0.12336E+00, 0.10678E+00, 0.95510E-01
412 , 0.87165E-01, 0.80587E-01, 0.70769E-01
413 , 0.63626E-01, 0.56894E-01, 0.51782E-01
414 , 0.44499E-01, 0.35839E-01, 0.30825E-01
415 , 0.27555E-01, 0.25269E-01, 0.22311E-01
416 , 0.20516E-01, 0.18184E-01, 0.17152E-01 };
417
418 Double_t en[kN] = { 0.10000E-02, 0.15000E-02, 0.20000E-02
419 , 0.30000E-02, 0.40000E-02, 0.50000E-02
420 , 0.60000E-02, 0.80000E-02, 0.10000E-01
421 , 0.15000E-01, 0.20000E-01, 0.30000E-01
422 , 0.40000E-01, 0.50000E-01, 0.60000E-01
423 , 0.80000E-01, 0.10000E+00, 0.15000E+00
424 , 0.20000E+00, 0.30000E+00, 0.40000E+00
425 , 0.50000E+00, 0.60000E+00, 0.80000E+00
426 , 0.10000E+01, 0.12500E+01, 0.15000E+01
427 , 0.20000E+01, 0.30000E+01, 0.40000E+01
428 , 0.50000E+01, 0.60000E+01, 0.80000E+01
429 , 0.10000E+02, 0.15000E+02, 0.20000E+02 };
430
431 return Interpolate(energyMeV,en,mu,kN);
432
433}
434
435//_____________________________________________________________________________
436Double_t AliTRDsim::GetMuXe(Double_t energyMeV)
437{
438 //
439 // Returns the photon absorbtion cross section for xenon
440 //
441
442 const Int_t kN = 48;
443
444 Double_t mu[kN] = { 9.413E+03, 8.151E+03, 7.035E+03
445 , 7.338E+03, 4.085E+03, 2.088E+03
446 , 7.780E+02, 3.787E+02, 2.408E+02
447 , 6.941E+02, 6.392E+02, 6.044E+02
448 , 8.181E+02, 7.579E+02, 6.991E+02
449 , 8.064E+02, 6.376E+02, 3.032E+02
450 , 1.690E+02, 5.743E+01, 2.652E+01
451 , 8.930E+00, 6.129E+00, 3.316E+01
452 , 2.270E+01, 1.272E+01, 7.825E+00
453 , 3.633E+00, 2.011E+00, 7.202E-01
454 , 3.760E-01, 1.797E-01, 1.223E-01
455 , 9.699E-02, 8.281E-02, 6.696E-02
456 , 5.785E-02, 5.054E-02, 4.594E-02
457 , 4.078E-02, 3.681E-02, 3.577E-02
458 , 3.583E-02, 3.634E-02, 3.797E-02
459 , 3.987E-02, 4.445E-02, 4.815E-02 };
460
461 Double_t en[kN] = { 1.00000E-03, 1.07191E-03, 1.14900E-03
462 , 1.14900E-03, 1.50000E-03, 2.00000E-03
463 , 3.00000E-03, 4.00000E-03, 4.78220E-03
464 , 4.78220E-03, 5.00000E-03, 5.10370E-03
465 , 5.10370E-03, 5.27536E-03, 5.45280E-03
466 , 5.45280E-03, 6.00000E-03, 8.00000E-03
467 , 1.00000E-02, 1.50000E-02, 2.00000E-02
468 , 3.00000E-02, 3.45614E-02, 3.45614E-02
469 , 4.00000E-02, 5.00000E-02, 6.00000E-02
470 , 8.00000E-02, 1.00000E-01, 1.50000E-01
471 , 2.00000E-01, 3.00000E-01, 4.00000E-01
472 , 5.00000E-01, 6.00000E-01, 8.00000E-01
473 , 1.00000E+00, 1.25000E+00, 1.50000E+00
474 , 2.00000E+00, 3.00000E+00, 4.00000E+00
475 , 5.00000E+00, 6.00000E+00, 8.00000E+00
476 , 1.00000E+01, 1.50000E+01, 2.00000E+01 };
477
478 return Interpolate(energyMeV,en,mu,kN);
479
480}
481
482//_____________________________________________________________________________
483Double_t AliTRDsim::GetMuBu(Double_t energyMeV)
484{
485 //
486 // Returns the photon absorbtion cross section for isobutane
487 //
488
489 const Int_t kN = 36;
490
491 Double_t mu[kN] = { 0.38846E+03, 0.12291E+03, 0.53225E+02
492 , 0.16091E+02, 0.69114E+01, 0.36541E+01
493 , 0.22282E+01, 0.11149E+01, 0.72887E+00
494 , 0.45053E+00, 0.38167E+00, 0.33920E+00
495 , 0.32155E+00, 0.30949E+00, 0.29960E+00
496 , 0.28317E+00, 0.26937E+00, 0.24228E+00
497 , 0.22190E+00, 0.19289E+00, 0.17288E+00
498 , 0.15789E+00, 0.14602E+00, 0.12829E+00
499 , 0.11533E+00, 0.10310E+00, 0.93790E-01
500 , 0.80117E-01, 0.63330E-01, 0.53229E-01
501 , 0.46390E-01, 0.41425E-01, 0.34668E-01
502 , 0.30267E-01, 0.23910E-01, 0.20509E-01 };
503
504 Double_t en[kN] = { 0.10000E-02, 0.15000E-02, 0.20000E-02
505 , 0.30000E-02, 0.40000E-02, 0.50000E-02
506 , 0.60000E-02, 0.80000E-02, 0.10000E-01
507 , 0.15000E-01, 0.20000E-01, 0.30000E-01
508 , 0.40000E-01, 0.50000E-01, 0.60000E-01
509 , 0.80000E-01, 0.10000E+00, 0.15000E+00
510 , 0.20000E+00, 0.30000E+00, 0.40000E+00
511 , 0.50000E+00, 0.60000E+00, 0.80000E+00
512 , 0.10000E+01, 0.12500E+01, 0.15000E+01
513 , 0.20000E+01, 0.30000E+01, 0.40000E+01
514 , 0.50000E+01, 0.60000E+01, 0.80000E+01
515 , 0.10000E+02, 0.15000E+02, 0.20000E+02 };
516
517 return Interpolate(energyMeV,en,mu,kN);
518
519}
520
521//_____________________________________________________________________________
522Double_t AliTRDsim::GetMuMy(Double_t energyMeV)
523{
524 //
525 // Returns the photon absorbtion cross section for mylar
526 //
527
528 const Int_t kN = 36;
529
530 Double_t mu[kN] = { 2.911E+03, 9.536E+02, 4.206E+02
531 , 1.288E+02, 5.466E+01, 2.792E+01
532 , 1.608E+01, 6.750E+00, 3.481E+00
533 , 1.132E+00, 5.798E-01, 3.009E-01
534 , 2.304E-01, 2.020E-01, 1.868E-01
535 , 1.695E-01, 1.586E-01, 1.406E-01
536 , 1.282E-01, 1.111E-01, 9.947E-02
537 , 9.079E-02, 8.395E-02, 7.372E-02
538 , 6.628E-02, 5.927E-02, 5.395E-02
539 , 4.630E-02, 3.715E-02, 3.181E-02
540 , 2.829E-02, 2.582E-02, 2.257E-02
541 , 2.057E-02, 1.789E-02, 1.664E-02 };
542
543 Double_t en[kN] = { 1.00000E-03, 1.50000E-03, 2.00000E-03
544 , 3.00000E-03, 4.00000E-03, 5.00000E-03
545 , 6.00000E-03, 8.00000E-03, 1.00000E-02
546 , 1.50000E-02, 2.00000E-02, 3.00000E-02
547 , 4.00000E-02, 5.00000E-02, 6.00000E-02
548 , 8.00000E-02, 1.00000E-01, 1.50000E-01
549 , 2.00000E-01, 3.00000E-01, 4.00000E-01
550 , 5.00000E-01, 6.00000E-01, 8.00000E-01
551 , 1.00000E+00, 1.25000E+00, 1.50000E+00
552 , 2.00000E+00, 3.00000E+00, 4.00000E+00
553 , 5.00000E+00, 6.00000E+00, 8.00000E+00
554 , 1.00000E+01, 1.50000E+01, 2.00000E+01 };
555
556 return Interpolate(energyMeV,en,mu,kN);
557
558}
559
560//_____________________________________________________________________________
561Double_t AliTRDsim::GetMuN2(Double_t energyMeV)
562{
563 //
564 // Returns the photon absorbtion cross section for nitrogen
565 //
566
567 const Int_t kN = 36;
568
569 Double_t mu[kN] = { 3.311E+03, 1.083E+03, 4.769E+02
570 , 1.456E+02, 6.166E+01, 3.144E+01
571 , 1.809E+01, 7.562E+00, 3.879E+00
572 , 1.236E+00, 6.178E-01, 3.066E-01
573 , 2.288E-01, 1.980E-01, 1.817E-01
574 , 1.639E-01, 1.529E-01, 1.353E-01
575 , 1.233E-01, 1.068E-01, 9.557E-02
576 , 8.719E-02, 8.063E-02, 7.081E-02
577 , 6.364E-02, 5.693E-02, 5.180E-02
578 , 4.450E-02, 3.579E-02, 3.073E-02
579 , 2.742E-02, 2.511E-02, 2.209E-02
580 , 2.024E-02, 1.782E-02, 1.673E-02 };
581
582 Double_t en[kN] = { 1.00000E-03, 1.50000E-03, 2.00000E-03
583 , 3.00000E-03, 4.00000E-03, 5.00000E-03
584 , 6.00000E-03, 8.00000E-03, 1.00000E-02
585 , 1.50000E-02, 2.00000E-02, 3.00000E-02
586 , 4.00000E-02, 5.00000E-02, 6.00000E-02
587 , 8.00000E-02, 1.00000E-01, 1.50000E-01
588 , 2.00000E-01, 3.00000E-01, 4.00000E-01
589 , 5.00000E-01, 6.00000E-01, 8.00000E-01
590 , 1.00000E+00, 1.25000E+00, 1.50000E+00
591 , 2.00000E+00, 3.00000E+00, 4.00000E+00
592 , 5.00000E+00, 6.00000E+00, 8.00000E+00
593 , 1.00000E+01, 1.50000E+01, 2.00000E+01 };
594
595 return Interpolate(energyMeV,en,mu,kN);
596
597}
598
599//_____________________________________________________________________________
600Double_t AliTRDsim::GetMuO2(Double_t energyMeV)
601{
602 //
603 // Returns the photon absorbtion cross section for oxygen
604 //
605
606 const Int_t kN = 36;
607
608 Double_t mu[kN] = { 4.590E+03, 1.549E+03, 6.949E+02
609 , 2.171E+02, 9.315E+01, 4.790E+01
610 , 2.770E+01, 1.163E+01, 5.952E+00
611 , 1.836E+00, 8.651E-01, 3.779E-01
612 , 2.585E-01, 2.132E-01, 1.907E-01
613 , 1.678E-01, 1.551E-01, 1.361E-01
614 , 1.237E-01, 1.070E-01, 9.566E-02
615 , 8.729E-02, 8.070E-02, 7.087E-02
616 , 6.372E-02, 5.697E-02, 5.185E-02
617 , 4.459E-02, 3.597E-02, 3.100E-02
618 , 2.777E-02, 2.552E-02, 2.263E-02
619 , 2.089E-02, 1.866E-02, 1.770E-02 };
620
621 Double_t en[kN] = { 1.00000E-03, 1.50000E-03, 2.00000E-03
622 , 3.00000E-03, 4.00000E-03, 5.00000E-03
623 , 6.00000E-03, 8.00000E-03, 1.00000E-02
624 , 1.50000E-02, 2.00000E-02, 3.00000E-02
625 , 4.00000E-02, 5.00000E-02, 6.00000E-02
626 , 8.00000E-02, 1.00000E-01, 1.50000E-01
627 , 2.00000E-01, 3.00000E-01, 4.00000E-01
628 , 5.00000E-01, 6.00000E-01, 8.00000E-01
629 , 1.00000E+00, 1.25000E+00, 1.50000E+00
630 , 2.00000E+00, 3.00000E+00, 4.00000E+00
631 , 5.00000E+00, 6.00000E+00, 8.00000E+00
632 , 1.00000E+01, 1.50000E+01, 2.00000E+01 };
633
634 return Interpolate(energyMeV,en,mu,kN);
635
636}
637
638//_____________________________________________________________________________
639Double_t AliTRDsim::GetMuHe(Double_t energyMeV)
640{
641 //
642 // Returns the photon absorbtion cross section for helium
643 //
644
645 const Int_t kN = 36;
646
647 Double_t mu[kN] = { 6.084E+01, 1.676E+01, 6.863E+00
648 , 2.007E+00, 9.329E-01, 5.766E-01
649 , 4.195E-01, 2.933E-01, 2.476E-01
650 , 2.092E-01, 1.960E-01, 1.838E-01
651 , 1.763E-01, 1.703E-01, 1.651E-01
652 , 1.562E-01, 1.486E-01, 1.336E-01
653 , 1.224E-01, 1.064E-01, 9.535E-02
654 , 8.707E-02, 8.054E-02, 7.076E-02
655 , 6.362E-02, 5.688E-02, 5.173E-02
656 , 4.422E-02, 3.503E-02, 2.949E-02
657 , 2.577E-02, 2.307E-02, 1.940E-02
658 , 1.703E-02, 1.363E-02, 1.183E-02 };
659
660 Double_t en[kN] = { 1.00000E-03, 1.50000E-03, 2.00000E-03
661 , 3.00000E-03, 4.00000E-03, 5.00000E-03
662 , 6.00000E-03, 8.00000E-03, 1.00000E-02
663 , 1.50000E-02, 2.00000E-02, 3.00000E-02
664 , 4.00000E-02, 5.00000E-02, 6.00000E-02
665 , 8.00000E-02, 1.00000E-01, 1.50000E-01
666 , 2.00000E-01, 3.00000E-01, 4.00000E-01
667 , 5.00000E-01, 6.00000E-01, 8.00000E-01
668 , 1.00000E+00, 1.25000E+00, 1.50000E+00
669 , 2.00000E+00, 3.00000E+00, 4.00000E+00
670 , 5.00000E+00, 6.00000E+00, 8.00000E+00
671 , 1.00000E+01, 1.50000E+01, 2.00000E+01 };
672
673 return Interpolate(energyMeV,en,mu,kN);
674
675}
676
677//_____________________________________________________________________________
678Double_t AliTRDsim::Interpolate(Double_t energyMeV
679 , Double_t *en, Double_t *mu, Int_t n)
680{
681 //
682 // Interpolates the photon absorbtion cross section
683 // for a given energy <energyMeV>.
684 //
685
686 Double_t de = 0;
687 Int_t index = 0;
688 Int_t istat = Locate(en,n,energyMeV,index,de);
689 if (istat == 0) {
690 return (mu[index] - de * (mu[index] - mu[index+1])
691 / (en[index+1] - en[index] ));
692 }
693 else {
694 return 0.0;
695 }
696
697}
698
699//_____________________________________________________________________________
700Int_t AliTRDsim::Locate(Double_t *xv, Int_t n, Double_t xval
701 , Int_t &kl, Double_t &dx)
702{
703 //
704 // Locates a point (xval) in a 1-dim grid (xv(n))
705 //
706
707 if (xval >= xv[n-1]) return 1;
708 if (xval < xv[0]) return -1;
709
710 Int_t km;
711 Int_t kh = n - 1;
712
713 kl = 0;
714 while (kh - kl > 1) {
715 if (xval < xv[km = (kl+kh)/2]) kh = km;
716 else kl = km;
717 }
718 if (xval < xv[kl] || xval > xv[kl+1] || kl >= n-1) {
719 printf("Locate failed xv[%d] %f xval %f xv[%d] %f!!!\n"
720 ,kl,xv[kl],xval,kl+1,xv[kl+1]);
721 exit(1);
722 }
723
724 dx = xval - xv[kl];
725
726 return 0;
727
728}
729
730//_____________________________________________________________________________
731void AliTRDsim::Streamer(TBuffer &R__b)
732{
733 //
734 // Stream an object of class AliTRDsim.
735 //
736
737 if (R__b.IsReading()) {
738 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
739 TObject::Streamer(R__b);
740 R__b >> fNFoils;
741 R__b >> fFoilThick;
742 R__b >> fGapThick;
743 R__b >> fFoilDens;
744 R__b >> fGapDens;
745 R__b >> fFoilOmega;
746 R__b >> fGapOmega;
747 R__b >> fFoilZ;
748 R__b >> fGapZ;
749 R__b >> fFoilA;
750 R__b >> fGapA;
751 R__b >> fTemp;
752 R__b >> fSpNBins;
753 R__b >> fSpRange;
754 R__b >> fSpBinWidth;
755 R__b >> fSpLower;
756 R__b >> fSpUpper;
757 R__b.ReadArray(fSigma);
758 R__b >> fSpectrum;
759 }
760 else {
761 R__b.WriteVersion(AliTRDsim::IsA());
762 TObject::Streamer(R__b);
763 R__b << fNFoils;
764 R__b << fFoilThick;
765 R__b << fGapThick;
766 R__b << fFoilDens;
767 R__b << fGapDens;
768 R__b << fFoilOmega;
769 R__b << fGapOmega;
770 R__b << fFoilZ;
771 R__b << fGapZ;
772 R__b << fFoilA;
773 R__b << fGapA;
774 R__b << fTemp;
775 R__b << fSpNBins;
776 R__b << fSpRange;
777 R__b << fSpBinWidth;
778 R__b << fSpLower;
779 R__b << fSpUpper;
780 R__b.WriteArray(fSigma, fSpNBins);
781 R__b << (TObject*) fSpectrum;
782 }
783
784}