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