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