Project
Loading...
Searching...
No Matches
TRsim.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12/**************************************************************************
13 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
14 * *
15 * Author: The ALICE Off-line Project. *
16 * Contributors are mentioned in the code where appropriate. *
17 * *
18 * Permission to use, copy, modify and distribute this software and its *
19 * documentation strictly for non-commercial purposes is hereby granted *
20 * without fee, provided that the above copyright notice appears in all *
21 * copies and that both the copyright notice and this permission notice *
22 * appear in the supporting documentation. The authors make no claims *
23 * about the suitability of this software for any purpose. It is *
24 * provided "as is" without express or implied warranty. *
25 **************************************************************************/
26
27/* $Id$ */
28
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// 04.06.2004 - Momentum dependent parameters implemented (CBL) //
39// 28.01.2010 - Adapted code to O2 environment (J. Lopez) //
40// //
42
43#include <TH1.h>
44#include <TRandom.h>
45#include <TMath.h>
46#include <TVirtualMC.h>
47#include <TVirtualMCStack.h>
48
49#include "TRDSimulation/TRsim.h"
50
51#include "FairModule.h"
52
53using namespace o2::trd;
54
55//_____________________________________________________________________________
57{
58 //
59 // TRsim default constructor
60 //
61
62 init();
63}
64
65//_____________________________________________________________________________
66TRsim::~TRsim() = default;
67
68//_____________________________________________________________________________
70{
71 //
72 // Initialization
73 // The default radiator are prolypropilene foils of 10 mu thickness
74 // with gaps of 80 mu filled with N2.
75 //
76
77 mNFoils[0] = 170;
78 mNFoils[1] = 225;
79 mNFoils[2] = 275;
80 mNFoils[3] = 305;
81 mNFoils[4] = 325;
82 mNFoils[5] = 340;
83 mNFoils[6] = 350;
84
85 mNFoilsUp[0] = 1.25;
86 mNFoilsUp[1] = 1.75;
87 mNFoilsUp[2] = 2.50;
88 mNFoilsUp[3] = 3.50;
89 mNFoilsUp[4] = 4.50;
90 mNFoilsUp[5] = 5.50;
91 mNFoilsUp[6] = 10000.0;
92
93 mFoilThick = 0.0013;
94 mGapThick = 0.0060;
95 mFoilDens = 0.92;
96 mGapDens = 0.00125;
97
98 mFoilZ = 5.28571;
99 mGapZ = 7.0;
100 mFoilA = 10.4286;
101 mGapA = 14.00674;
102 mTemp = 293.16;
103
106
108 mSpLower = 1.0 - 0.5 * mSpBinWidth;
110
111 if (mSpectrum) {
112 delete mSpectrum;
113 }
114 mSpectrum = new TH1D("TRspectrum", "TR spectrum", mSpNBins, mSpLower, mSpUpper);
115 mSpectrum->SetDirectory(nullptr);
116
117 // Set the sigma values
118 setSigma();
119}
120
121//_____________________________________________________________________________
122int TRsim::createPhotons(int pdg, float p, std::vector<float>& ePhoton)
123{
124 //
125 // Create TRD photons for a charged particle of type <pdg> with the total
126 // momentum <p>.
127 // Energies of the produced TR photons: <ePhoton>
128 //
129
130 // PDG codes
131 const int kPdgEle = 11;
132 const int kPdgMuon = 13;
133 const int kPdgPion = 211;
134 const int kPdgKaon = 321;
135
136 float mass = 0;
137 switch (TMath::Abs(pdg)) {
138 case kPdgEle:
139 mass = 5.11e-4;
140 break;
141 case kPdgMuon:
142 mass = 0.10566;
143 break;
144 case kPdgPion:
145 mass = 0.13957;
146 break;
147 case kPdgKaon:
148 mass = 0.4937;
149 break;
150 default:
151 return 0;
152 break;
153 };
154
155 // Calculate the TR photons
156 return calculatePhotons(p, mass, ePhoton);
157}
158
159//_____________________________________________________________________________
160int TRsim::calculatePhotons(float p, float mass, std::vector<float>& ePhoton)
161{
162 //
163 // Produces TR photons using a parametric model for regular radiator. Photons
164 // with energy larger than 15 keV are included in the MC stack and tracked by VMC
165 // machinary.
166 //
167 // Input parameters:
168 // p - parent momentum (GeV/c)
169 // mass - parent mass
170 //
171 // Output :
172 // ePhoton - energy container of this photons in keV.
173 //
174
175 const double kAlpha = 0.0072973;
176 const int kSumMax = 30;
177 double tau = mGapThick / mFoilThick;
178 // Calculate gamma
179 double gamma = TMath::Sqrt(p * p + mass * mass) / mass;
180 // Select the number of foils corresponding to momentum
181 int foils = selectNFoils(p);
182
183 // The TR spectrum
184 double csi1;
185 double csi2;
186 double rho1;
187 double rho2;
188 double sigma;
189 double sum;
190 double nEqu;
191 double thetaN;
192 double aux;
193 double energyeV;
194 double energykeV;
195
196 mSpectrum->Reset();
197 for (int iBin = 1; iBin <= mSpNBins; iBin++) {
198
199 energykeV = mSpectrum->GetBinCenter(iBin);
200 energyeV = energykeV * 1.0e3;
201
202 sigma = getSigma(energykeV);
203
204 csi1 = mFoilOmega / energyeV;
205 csi2 = mGapOmega / energyeV;
206
207 rho1 = 2.5 * energyeV * mFoilThick * 1.0e4 * (1.0 / (gamma * gamma) + csi1 * csi1);
208 rho2 = 2.5 * energyeV * mFoilThick * 1.0e4 * (1.0 / (gamma * gamma) + csi2 * csi2);
209
210 // Calculate the sum
211 sum = 0.0;
212 for (int n = 1; n <= kSumMax; n++) {
213 thetaN = (TMath::Pi() * 2.0 * n - (rho1 + tau * rho2)) / (1.0 + tau);
214 if (thetaN < 0.0) {
215 thetaN = 0.0;
216 }
217 aux = 1.0 / (rho1 + thetaN) - 1.0 / (rho2 + thetaN);
218 sum += thetaN * (aux * aux) * (1.0 - TMath::Cos(rho1 + thetaN));
219 }
220
221 // Equivalent number of foils
222 nEqu = (1.0 - TMath::Exp(-foils * sigma)) / (1.0 - TMath::Exp(-sigma));
223
224 // dN / domega
225 mSpectrum->SetBinContent(iBin, 4.0 * kAlpha * nEqu * sum / (energykeV * (1.0 + tau)));
226 }
227
228 // <nTR> (binsize corr.)
229 float nTr = mSpBinWidth * mSpectrum->Integral();
230 // Number of TR photons from Poisson distribution with mean <nTr>
231 int nPhCand = gRandom->Poisson(nTr);
232
233 // Link the MC stack and get info about parent electron
234 TVirtualMCStack* stack = TVirtualMC::GetMC()->GetStack();
235 int track = stack->GetCurrentTrackNumber();
236 double px, py, pz, ptot;
237 TVirtualMC::GetMC()->TrackMomentum(px, py, pz, ptot);
238 ptot = TMath::Sqrt(px * px + py * py + pz * pz);
239 px /= ptot;
240 py /= ptot;
241 pz /= ptot;
242 // Current position of electron
243 double x, y, z;
244 TVirtualMC::GetMC()->TrackPosition(x, y, z);
245 double t = TVirtualMC::GetMC()->TrackTime();
246 for (int iPhoton = 0; iPhoton < nPhCand; ++iPhoton) {
247 double e = mSpectrum->GetRandom(); // Energy of the TR photon
248 // Put TR photon on particle stack
249 if (e > 15) {
250 e *= 1e-6; // Convert it to GeV
251 int phtrack;
252 stack->PushTrack(1, // Must be 1
253 track, // Identifier of the parent track, -1 for a primary
254 22, // Particle code.
255 px * e, // 4 momentum (The photon is generated on the same
256 py * e, // direction as the parent. For irregular radiator one
257 pz * e, // can calculate also the angle but this is a second
258 e, // order effect)
259 x, y, z, t, // 4 vertex
260 0.0, 0.0, 0.0, // Polarisation
261 kPFeedBackPhoton, // Production mechanism (there is no TR in G3 so one has to make some convention)
262 phtrack, // On output the number of the track stored
263 1.0,
264 1);
265 }
266 // Custom treatment of TR photons
267 else {
268 ePhoton.push_back(e);
269 }
270 }
271 return 1;
272}
273
274//_____________________________________________________________________________
276{
277 //
278 // Sets the absorbtion crosssection for the energies of the TR spectrum
279 //
280
281 for (int iBin = 0; iBin < mSpNBins; iBin++) {
282 double energykeV = iBin * mSpBinWidth + 1.0;
283 mSigma[iBin] = getSigma(energykeV);
284 }
285}
286
287//_____________________________________________________________________________
288double TRsim::getSigma(double energykeV)
289{
290 //
291 // Calculates the absorbtion crosssection for a one-foil-one-gap-radiator
292 //
293
294 // keV -> MeV
295 double energyMeV = energykeV * 0.001;
296 if (energyMeV >= 0.001) {
297 return (getMuPo(energyMeV) * mFoilDens * mFoilThick +
298 getMuAi(energyMeV) * mGapDens * mGapThick * getTemp());
299 } else {
300 return 1.0e6;
301 }
302}
303
304//_____________________________________________________________________________
305double TRsim::getMuPo(double energyMeV)
306{
307 //
308 // Returns the photon absorbtion cross section for polypropylene
309 //
310
311 constexpr int kN = 36;
312 double mu[kN] = {1.894E+03, 5.999E+02, 2.593E+02,
313 7.743E+01, 3.242E+01, 1.643E+01,
314 9.432E+00, 3.975E+00, 2.088E+00,
315 7.452E-01, 4.315E-01, 2.706E-01,
316 2.275E-01, 2.084E-01, 1.970E-01,
317 1.823E-01, 1.719E-01, 1.534E-01,
318 1.402E-01, 1.217E-01, 1.089E-01,
319 9.947E-02, 9.198E-02, 8.078E-02,
320 7.262E-02, 6.495E-02, 5.910E-02,
321 5.064E-02, 4.045E-02, 3.444E-02,
322 3.045E-02, 2.760E-02, 2.383E-02,
323 2.145E-02, 1.819E-02, 1.658E-02};
324 double en[kN] = {1.000E-03, 1.500E-03, 2.000E-03,
325 3.000E-03, 4.000E-03, 5.000E-03,
326 6.000E-03, 8.000E-03, 1.000E-02,
327 1.500E-02, 2.000E-02, 3.000E-02,
328 4.000E-02, 5.000E-02, 6.000E-02,
329 8.000E-02, 1.000E-01, 1.500E-01,
330 2.000E-01, 3.000E-01, 4.000E-01,
331 5.000E-01, 6.000E-01, 8.000E-01,
332 1.000E+00, 1.250E+00, 1.500E+00,
333 2.000E+00, 3.000E+00, 4.000E+00,
334 5.000E+00, 6.000E+00, 8.000E+00,
335 1.000E+01, 1.500E+01, 2.000E+01};
336 return interpolate(energyMeV, en, mu, kN);
337}
338
339//_____________________________________________________________________________
340double TRsim::getMuCO(double energyMeV)
341{
342 //
343 // Returns the photon absorbtion cross section for CO2
344 //
345
346 constexpr int kN = 36;
347 double mu[kN] = {0.39383E+04, 0.13166E+04, 0.58750E+03,
348 0.18240E+03, 0.77996E+02, 0.40024E+02,
349 0.23116E+02, 0.96997E+01, 0.49726E+01,
350 0.15543E+01, 0.74915E+00, 0.34442E+00,
351 0.24440E+00, 0.20589E+00, 0.18632E+00,
352 0.16578E+00, 0.15394E+00, 0.13558E+00,
353 0.12336E+00, 0.10678E+00, 0.95510E-01,
354 0.87165E-01, 0.80587E-01, 0.70769E-01,
355 0.63626E-01, 0.56894E-01, 0.51782E-01,
356 0.44499E-01, 0.35839E-01, 0.30825E-01,
357 0.27555E-01, 0.25269E-01, 0.22311E-01,
358 0.20516E-01, 0.18184E-01, 0.17152E-01};
359 double en[kN] = {0.10000E-02, 0.15000E-02, 0.20000E-02,
360 0.30000E-02, 0.40000E-02, 0.50000E-02,
361 0.60000E-02, 0.80000E-02, 0.10000E-01,
362 0.15000E-01, 0.20000E-01, 0.30000E-01,
363 0.40000E-01, 0.50000E-01, 0.60000E-01,
364 0.80000E-01, 0.10000E+00, 0.15000E+00,
365 0.20000E+00, 0.30000E+00, 0.40000E+00,
366 0.50000E+00, 0.60000E+00, 0.80000E+00,
367 0.10000E+01, 0.12500E+01, 0.15000E+01,
368 0.20000E+01, 0.30000E+01, 0.40000E+01,
369 0.50000E+01, 0.60000E+01, 0.80000E+01,
370 0.10000E+02, 0.15000E+02, 0.20000E+02};
371 return interpolate(energyMeV, en, mu, kN);
372}
373
374//_____________________________________________________________________________
375double TRsim::getMuXe(double energyMeV)
376{
377 //
378 // Returns the photon absorbtion cross section for xenon
379 //
380
381 constexpr int kN = 48;
382 double mu[kN] = {9.413E+03, 8.151E+03, 7.035E+03,
383 7.338E+03, 4.085E+03, 2.088E+03,
384 7.780E+02, 3.787E+02, 2.408E+02,
385 6.941E+02, 6.392E+02, 6.044E+02,
386 8.181E+02, 7.579E+02, 6.991E+02,
387 8.064E+02, 6.376E+02, 3.032E+02,
388 1.690E+02, 5.743E+01, 2.652E+01,
389 8.930E+00, 6.129E+00, 3.316E+01,
390 2.270E+01, 1.272E+01, 7.825E+00,
391 3.633E+00, 2.011E+00, 7.202E-01,
392 3.760E-01, 1.797E-01, 1.223E-01,
393 9.699E-02, 8.281E-02, 6.696E-02,
394 5.785E-02, 5.054E-02, 4.594E-02,
395 4.078E-02, 3.681E-02, 3.577E-02,
396 3.583E-02, 3.634E-02, 3.797E-02,
397 3.987E-02, 4.445E-02, 4.815E-02};
398 double en[kN] = {1.00000E-03, 1.07191E-03, 1.14900E-03,
399 1.14900E-03, 1.50000E-03, 2.00000E-03,
400 3.00000E-03, 4.00000E-03, 4.78220E-03,
401 4.78220E-03, 5.00000E-03, 5.10370E-03,
402 5.10370E-03, 5.27536E-03, 5.45280E-03,
403 5.45280E-03, 6.00000E-03, 8.00000E-03,
404 1.00000E-02, 1.50000E-02, 2.00000E-02,
405 3.00000E-02, 3.45614E-02, 3.45614E-02,
406 4.00000E-02, 5.00000E-02, 6.00000E-02,
407 8.00000E-02, 1.00000E-01, 1.50000E-01,
408 2.00000E-01, 3.00000E-01, 4.00000E-01,
409 5.00000E-01, 6.00000E-01, 8.00000E-01,
410 1.00000E+00, 1.25000E+00, 1.50000E+00,
411 2.00000E+00, 3.00000E+00, 4.00000E+00,
412 5.00000E+00, 6.00000E+00, 8.00000E+00,
413 1.00000E+01, 1.50000E+01, 2.00000E+01};
414 return interpolate(energyMeV, en, mu, kN);
415}
416
417//_____________________________________________________________________________
418double TRsim::getMuAr(double energyMeV)
419{
420 //
421 // Returns the photon absorbtion cross section for argon
422 //
423
424 constexpr int kN = 38;
425 double mu[kN] = {3.184E+03, 1.105E+03, 5.120E+02,
426 1.703E+02, 1.424E+02, 1.275E+03,
427 7.572E+02, 4.225E+02, 2.593E+02,
428 1.180E+02, 6.316E+01, 1.983E+01,
429 8.629E+00, 2.697E+00, 1.228E+00,
430 7.012E-01, 4.664E-01, 2.760E-01,
431 2.043E-01, 1.427E-01, 1.205E-01,
432 9.953E-02, 8.776E-02, 7.958E-02,
433 7.335E-02, 6.419E-02, 5.762E-02,
434 5.150E-02, 4.695E-02, 4.074E-02,
435 3.384E-02, 3.019E-02, 2.802E-02,
436 2.667E-02, 2.517E-02, 2.451E-02,
437 2.418E-02, 2.453E-02};
438 double en[kN] = {1.00000E-03, 1.50000E-03, 2.00000E-03,
439 3.00000E-03, 3.20290E-03, 3.20290E-03,
440 4.00000E-03, 5.00000E-03, 6.00000E-03,
441 8.00000E-03, 1.00000E-02, 1.50000E-02,
442 2.00000E-02, 3.00000E-02, 4.00000E-02,
443 5.00000E-02, 6.00000E-02, 8.00000E-02,
444 1.00000E-01, 1.50000E-01, 2.00000E-01,
445 3.00000E-01, 4.00000E-01, 5.00000E-01,
446 6.00000E-01, 8.00000E-01, 1.00000E+00,
447 1.25000E+00, 1.50000E+00, 2.00000E+00,
448 3.00000E+00, 4.00000E+00, 5.00000E+00,
449 6.00000E+00, 8.00000E+00, 1.00000E+01,
450 1.50000E+01, 2.00000E+01};
451 return interpolate(energyMeV, en, mu, kN);
452}
453
454//_____________________________________________________________________________
455double TRsim::getMuMy(double energyMeV)
456{
457 //
458 // Returns the photon absorbtion cross section for mylar
459 //
460
461 constexpr int kN = 36;
462 double mu[kN] = {2.911E+03, 9.536E+02, 4.206E+02,
463 1.288E+02, 5.466E+01, 2.792E+01,
464 1.608E+01, 6.750E+00, 3.481E+00,
465 1.132E+00, 5.798E-01, 3.009E-01,
466 2.304E-01, 2.020E-01, 1.868E-01,
467 1.695E-01, 1.586E-01, 1.406E-01,
468 1.282E-01, 1.111E-01, 9.947E-02,
469 9.079E-02, 8.395E-02, 7.372E-02,
470 6.628E-02, 5.927E-02, 5.395E-02,
471 4.630E-02, 3.715E-02, 3.181E-02,
472 2.829E-02, 2.582E-02, 2.257E-02,
473 2.057E-02, 1.789E-02, 1.664E-02};
474 double en[kN] = {1.00000E-03, 1.50000E-03, 2.00000E-03,
475 3.00000E-03, 4.00000E-03, 5.00000E-03,
476 6.00000E-03, 8.00000E-03, 1.00000E-02,
477 1.50000E-02, 2.00000E-02, 3.00000E-02,
478 4.00000E-02, 5.00000E-02, 6.00000E-02,
479 8.00000E-02, 1.00000E-01, 1.50000E-01,
480 2.00000E-01, 3.00000E-01, 4.00000E-01,
481 5.00000E-01, 6.00000E-01, 8.00000E-01,
482 1.00000E+00, 1.25000E+00, 1.50000E+00,
483 2.00000E+00, 3.00000E+00, 4.00000E+00,
484 5.00000E+00, 6.00000E+00, 8.00000E+00,
485 1.00000E+01, 1.50000E+01, 2.00000E+01};
486 return interpolate(energyMeV, en, mu, kN);
487}
488
489//_____________________________________________________________________________
490double TRsim::getMuN2(double energyMeV)
491{
492 //
493 // Returns the photon absorbtion cross section for nitrogen
494 //
495
496 constexpr int kN = 36;
497 double mu[kN] = {3.311E+03, 1.083E+03, 4.769E+02,
498 1.456E+02, 6.166E+01, 3.144E+01,
499 1.809E+01, 7.562E+00, 3.879E+00,
500 1.236E+00, 6.178E-01, 3.066E-01,
501 2.288E-01, 1.980E-01, 1.817E-01,
502 1.639E-01, 1.529E-01, 1.353E-01,
503 1.233E-01, 1.068E-01, 9.557E-02,
504 8.719E-02, 8.063E-02, 7.081E-02,
505 6.364E-02, 5.693E-02, 5.180E-02,
506 4.450E-02, 3.579E-02, 3.073E-02,
507 2.742E-02, 2.511E-02, 2.209E-02,
508 2.024E-02, 1.782E-02, 1.673E-02};
509 double en[kN] = {1.00000E-03, 1.50000E-03, 2.00000E-03,
510 3.00000E-03, 4.00000E-03, 5.00000E-03,
511 6.00000E-03, 8.00000E-03, 1.00000E-02,
512 1.50000E-02, 2.00000E-02, 3.00000E-02,
513 4.00000E-02, 5.00000E-02, 6.00000E-02,
514 8.00000E-02, 1.00000E-01, 1.50000E-01,
515 2.00000E-01, 3.00000E-01, 4.00000E-01,
516 5.00000E-01, 6.00000E-01, 8.00000E-01,
517 1.00000E+00, 1.25000E+00, 1.50000E+00,
518 2.00000E+00, 3.00000E+00, 4.00000E+00,
519 5.00000E+00, 6.00000E+00, 8.00000E+00,
520 1.00000E+01, 1.50000E+01, 2.00000E+01};
521 return interpolate(energyMeV, en, mu, kN);
522}
523
524//_____________________________________________________________________________
525double TRsim::getMuO2(double energyMeV)
526{
527 //
528 // Returns the photon absorbtion cross section for oxygen
529 //
530
531 constexpr int kN = 36;
532 double mu[kN] = {4.590E+03, 1.549E+03, 6.949E+02,
533 2.171E+02, 9.315E+01, 4.790E+01,
534 2.770E+01, 1.163E+01, 5.952E+00,
535 1.836E+00, 8.651E-01, 3.779E-01,
536 2.585E-01, 2.132E-01, 1.907E-01,
537 1.678E-01, 1.551E-01, 1.361E-01,
538 1.237E-01, 1.070E-01, 9.566E-02,
539 8.729E-02, 8.070E-02, 7.087E-02,
540 6.372E-02, 5.697E-02, 5.185E-02,
541 4.459E-02, 3.597E-02, 3.100E-02,
542 2.777E-02, 2.552E-02, 2.263E-02,
543 2.089E-02, 1.866E-02, 1.770E-02};
544 double en[kN] = {1.00000E-03, 1.50000E-03, 2.00000E-03,
545 3.00000E-03, 4.00000E-03, 5.00000E-03,
546 6.00000E-03, 8.00000E-03, 1.00000E-02,
547 1.50000E-02, 2.00000E-02, 3.00000E-02,
548 4.00000E-02, 5.00000E-02, 6.00000E-02,
549 8.00000E-02, 1.00000E-01, 1.50000E-01,
550 2.00000E-01, 3.00000E-01, 4.00000E-01,
551 5.00000E-01, 6.00000E-01, 8.00000E-01,
552 1.00000E+00, 1.25000E+00, 1.50000E+00,
553 2.00000E+00, 3.00000E+00, 4.00000E+00,
554 5.00000E+00, 6.00000E+00, 8.00000E+00,
555 1.00000E+01, 1.50000E+01, 2.00000E+01};
556 return interpolate(energyMeV, en, mu, kN);
557}
558
559//_____________________________________________________________________________
560double TRsim::getMuHe(double energyMeV)
561{
562 //
563 // Returns the photon absorbtion cross section for helium
564 //
565
566 constexpr int kN = 36;
567 double mu[kN] = {6.084E+01, 1.676E+01, 6.863E+00,
568 2.007E+00, 9.329E-01, 5.766E-01,
569 4.195E-01, 2.933E-01, 2.476E-01,
570 2.092E-01, 1.960E-01, 1.838E-01,
571 1.763E-01, 1.703E-01, 1.651E-01,
572 1.562E-01, 1.486E-01, 1.336E-01,
573 1.224E-01, 1.064E-01, 9.535E-02,
574 8.707E-02, 8.054E-02, 7.076E-02,
575 6.362E-02, 5.688E-02, 5.173E-02,
576 4.422E-02, 3.503E-02, 2.949E-02,
577 2.577E-02, 2.307E-02, 1.940E-02,
578 1.703E-02, 1.363E-02, 1.183E-02};
579 double en[kN] = {1.00000E-03, 1.50000E-03, 2.00000E-03,
580 3.00000E-03, 4.00000E-03, 5.00000E-03,
581 6.00000E-03, 8.00000E-03, 1.00000E-02,
582 1.50000E-02, 2.00000E-02, 3.00000E-02,
583 4.00000E-02, 5.00000E-02, 6.00000E-02,
584 8.00000E-02, 1.00000E-01, 1.50000E-01,
585 2.00000E-01, 3.00000E-01, 4.00000E-01,
586 5.00000E-01, 6.00000E-01, 8.00000E-01,
587 1.00000E+00, 1.25000E+00, 1.50000E+00,
588 2.00000E+00, 3.00000E+00, 4.00000E+00,
589 5.00000E+00, 6.00000E+00, 8.00000E+00,
590 1.00000E+01, 1.50000E+01, 2.00000E+01};
591 return interpolate(energyMeV, en, mu, kN);
592}
593
594//_____________________________________________________________________________
595double TRsim::getMuAi(double energyMeV)
596{
597 //
598 // Returns the photon absorbtion cross section for air
599 // Implemented by Oliver Busch
600 //
601
602 constexpr int kN = 38;
603 double mu[kN] = {0.35854E+04, 0.11841E+04, 0.52458E+03,
604 0.16143E+03, 0.14250E+03, 0.15722E+03,
605 0.77538E+02, 0.40099E+02, 0.23313E+02,
606 0.98816E+01, 0.51000E+01, 0.16079E+01,
607 0.77536E+00, 0.35282E+00, 0.24790E+00,
608 0.20750E+00, 0.18703E+00, 0.16589E+00,
609 0.15375E+00, 0.13530E+00, 0.12311E+00,
610 0.10654E+00, 0.95297E-01, 0.86939E-01,
611 0.80390E-01, 0.70596E-01, 0.63452E-01,
612 0.56754E-01, 0.51644E-01, 0.44382E-01,
613 0.35733E-01, 0.30721E-01, 0.27450E-01,
614 0.25171E-01, 0.22205E-01, 0.20399E-01,
615 0.18053E-01, 0.18057E-01};
616 double en[kN] = {0.10000E-02, 0.15000E-02, 0.20000E-02,
617 0.30000E-02, 0.32029E-02, 0.32029E-02,
618 0.40000E-02, 0.50000E-02, 0.60000E-02,
619 0.80000E-02, 0.10000E-01, 0.15000E-01,
620 0.20000E-01, 0.30000E-01, 0.40000E-01,
621 0.50000E-01, 0.60000E-01, 0.80000E-01,
622 0.10000E+00, 0.15000E+00, 0.20000E+00,
623 0.30000E+00, 0.40000E+00, 0.50000E+00,
624 0.60000E+00, 0.80000E+00, 0.10000E+01,
625 0.12500E+01, 0.15000E+01, 0.20000E+01,
626 0.30000E+01, 0.40000E+01, 0.50000E+01,
627 0.60000E+01, 0.80000E+01, 0.10000E+02,
628 0.15000E+02, 0.20000E+02};
629 return interpolate(energyMeV, en, mu, kN);
630}
631
632//_____________________________________________________________________________
633double TRsim::interpolate(double energyMeV, double* en, const double* const mu, int n)
634{
635 //
636 // interpolates the photon absorbtion cross section
637 // for a given energy <energyMeV>.
638 //
639
640 double de = 0;
641 int index = 0;
642 int istat = locate(en, n, energyMeV, index, de);
643 if (istat == 0) {
644 return (mu[index] - de * (mu[index] - mu[index + 1]) / (en[index + 1] - en[index]));
645 } else {
646 return 0.0;
647 }
648}
649
650//_____________________________________________________________________________
651int TRsim::locate(double* xv, int n, double xval, int& kl, double& dx)
652{
653 //
654 // locates a point (xval) in a 1-dim grid (xv(n))
655 //
656
657 if (xval >= xv[n - 1]) {
658 return 1;
659 }
660 if (xval < xv[0]) {
661 return -1;
662 }
663 int km;
664 int kh = n - 1;
665 kl = 0;
666 while (kh - kl > 1) {
667 if (xval < xv[km = (kl + kh) / 2]) {
668 kh = km;
669 } else {
670 kl = km;
671 }
672 }
673 if ((xval < xv[kl]) ||
674 (xval > xv[kl + 1]) ||
675 (kl >= n - 1)) {
676 LOG(fatal) << Form("locate failed xv[%d] %f xval %f xv[%d] %f!!!\n", kl, xv[kl], xval, kl + 1, xv[kl + 1]);
677 exit(1);
678 }
679 dx = xval - xv[kl];
680 return 0;
681}
682
683//_____________________________________________________________________________
684int TRsim::selectNFoils(float p) const
685{
686 //
687 // Selects the number of foils corresponding to the momentum
688 //
689
690 int foils = mNFoils[mNFoilsDim - 1];
691
692 for (int iFoil = 0; iFoil < mNFoilsDim; iFoil++) {
693 if (p < mNFoilsUp[iFoil]) {
694 foils = mNFoils[iFoil];
695 break;
696 }
697 }
698
699 return foils;
700}
uint32_t stack
Definition RawData.h:1
double mGapOmega
Definition TRsim.h:126
void setSigma()
Definition TRsim.cxx:275
double mFoilOmega
Definition TRsim.h:125
int createPhotons(int pdg, float p, std::vector< float > &ePhoton)
Definition TRsim.cxx:122
double getMuAr(double energyMeV)
Definition TRsim.cxx:418
double interpolate(double energyMeV, double *en, const double *const mu, int n)
Definition TRsim.cxx:633
double getSigma(double energykeV)
Definition TRsim.cxx:288
std::array< double, mSpNBins > mSigma
Definition TRsim.h:137
static constexpr int mNFoilsDim
Definition TRsim.h:118
float mFoilZ
Definition TRsim.h:127
float mSpLower
Definition TRsim.h:135
float mGapThick
Definition TRsim.h:122
float mGapDens
Definition TRsim.h:124
double getMuXe(double energyMeV)
Definition TRsim.cxx:375
float mFoilDens
Definition TRsim.h:123
float mSpBinWidth
Definition TRsim.h:134
float mGapA
Definition TRsim.h:130
std::array< int, mNFoilsDim > mNFoils
Definition TRsim.h:119
void init()
Definition TRsim.cxx:69
int locate(double *xv, int n, double xval, int &kl, double &dx)
Definition TRsim.cxx:651
double getMuPo(double energyMeV)
Definition TRsim.cxx:305
int calculatePhotons(float p, float mass, std::vector< float > &ePhoton)
Definition TRsim.cxx:160
double getMuO2(double energyMeV)
Definition TRsim.cxx:525
std::array< double, mNFoilsDim > mNFoilsUp
Definition TRsim.h:120
double getMuAi(double energyMeV)
Definition TRsim.cxx:595
float getTemp() const
Definition TRsim.h:114
float mFoilThick
Definition TRsim.h:121
float mTemp
Definition TRsim.h:131
double getMuN2(double energyMeV)
Definition TRsim.cxx:490
double getOmega(float rho, float z, float a)
Definition TRsim.h:46
double getMuCO(double energyMeV)
Definition TRsim.cxx:340
float mGapZ
Definition TRsim.h:128
int selectNFoils(float p) const
Definition TRsim.cxx:684
float mSpUpper
Definition TRsim.h:136
double getMuMy(double energyMeV)
Definition TRsim.cxx:455
static constexpr int mSpNBins
Definition TRsim.h:132
double getMuHe(double energyMeV)
Definition TRsim.cxx:560
float mFoilA
Definition TRsim.h:129
static constexpr float mSpRange
Definition TRsim.h:133
TH1D * mSpectrum
Definition TRsim.h:138
float sum(float s, o2::dcs::DataPointValue v)
Definition dcs-ccdb.cxx:39
GLdouble n
Definition glcorearb.h:1982
GLint GLenum GLint x
Definition glcorearb.h:403
GLuint index
Definition glcorearb.h:781
GLint y
Definition glcorearb.h:270
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
uint16_t de
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"