]>
Commit | Line | Data |
---|---|---|
930c0bb5 | 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$ | |
b9d0a01d | 18 | Revision 1.1.2.1 2002/10/10 16:40:08 hristov |
19 | Updating VirtualMC to v3-09-02 | |
20 | ||
21 | Revision 1.1 2002/10/08 13:53:17 morsch | |
22 | Gray particle generator, first commit. | |
23 | ||
930c0bb5 | 24 | */ |
25 | ||
26 | /* | |
27 | Generator for gray nucluons in pA interactions. | |
28 | Source is modelled by a relativistic Maxwell distributions. | |
29 | Original code by Ferenc Sikler <sikler@rmki.kfki.hu> | |
30 | */ | |
31 | #include "AliGenGrayParticles.h" | |
32 | #include "AliPDG.h" | |
33 | #include <TDatabasePDG.h> | |
34 | ||
35 | ClassImp(AliGenGrayParticles) | |
36 | ||
37 | AliGenGrayParticles::AliGenGrayParticles():AliGenerator(-1) | |
38 | { | |
39 | // Default constructor | |
40 | } | |
41 | ||
42 | AliGenGrayParticles::AliGenGrayParticles(Int_t npart) | |
43 | :AliGenerator(npart) | |
44 | { | |
45 | // Constructor | |
46 | fName = "GrayParticles"; | |
47 | fTitle = "Generator for gray particles in pA collisions"; | |
48 | SetPmax(); | |
49 | SetTarget(); | |
50 | SetNominalCmsEnergy(); | |
51 | SetTemperature(); | |
52 | } | |
53 | ||
54 | //____________________________________________________________ | |
55 | AliGenGrayParticles::~AliGenGrayParticles() | |
56 | { | |
57 | // Destructor | |
58 | } | |
59 | ||
60 | ||
61 | void AliGenGrayParticles::Init() | |
62 | { | |
63 | // | |
64 | // Initialization | |
65 | // | |
66 | Float_t kMass = TDatabasePDG::Instance()->GetParticle(kProton)->Mass(); | |
67 | fMomentum = fCMS/2. * fZTarget / fATarget; | |
68 | fBeta = fMomentum / TMath::Sqrt(kMass * kMass + fMomentum * fMomentum); | |
69 | } | |
70 | ||
71 | ||
72 | void AliGenGrayParticles::Generate() | |
73 | { | |
74 | // | |
75 | // Generate one event | |
76 | // | |
77 | Float_t p[3]; | |
78 | Float_t origin[3] = {0., 0., 0.}; | |
79 | Float_t polar [3] = {0., 0., 0.}; | |
80 | Int_t nt, i; | |
81 | for(i = 0;i < fNpart; i++) { | |
82 | Int_t kf = kProton; | |
83 | GenerateSlow(1, fTemperature, 0., p); | |
84 | ||
85 | SetTrack(fTrackIt, -1, kf, p, origin, polar, | |
86 | 0., kPNoProcess, nt, 1.); | |
87 | ||
88 | KeepTrack(nt); | |
89 | } | |
90 | } | |
91 | ||
92 | ||
93 | ||
94 | ||
95 | void AliGenGrayParticles::GenerateSlow(Int_t charge, Double_t T, Double_t beta, Float_t* q) | |
96 | /* | |
97 | Emit a slow nucleon with "temperature" T [GeV], | |
98 | from a source moving with velocity beta | |
99 | Three-momentum [GeV/c] is given back in q[3] | |
100 | */ | |
101 | ||
102 | { | |
103 | Double_t m, pmax, p, f, theta, phi; | |
104 | ||
105 | TDatabasePDG * pdg = TDatabasePDG::Instance(); | |
106 | const Double_t kMassProton = pdg->GetParticle(kProton) ->Mass(); | |
107 | const Double_t kMassNeutron = pdg->GetParticle(kNeutron)->Mass(); | |
108 | ||
109 | /* Select nucleon type */ | |
110 | if(charge == 0) m = kMassNeutron; | |
111 | else m = kMassProton; | |
112 | ||
113 | /* Momentum at maximum of Maxwell-distribution */ | |
114 | ||
115 | pmax = TMath::Sqrt(2*T*(T+sqrt(T*T+m*m))); | |
116 | ||
117 | /* Try until proper momentum */ | |
118 | /* for lack of primitive function of the Maxwell-distribution */ | |
119 | /* a brute force trial-accept loop, normalized at pmax */ | |
120 | ||
121 | do | |
122 | { | |
123 | p = Rndm() * fPmax; | |
124 | f = Maxwell(m, p, T) / Maxwell(m , pmax, T); | |
125 | } | |
126 | while(f < Rndm()); | |
127 | ||
128 | /* Spherical symmetric emission */ | |
129 | theta = TMath::ACos(2. * Rndm() - 1.); | |
130 | phi = 2. * TMath::Pi() * Rndm(); | |
131 | ||
132 | /* Determine momentum components in system of the moving source */ | |
133 | q[0] = p * TMath::Sin(theta) * TMath::Cos(phi); | |
134 | q[1] = p * TMath::Sin(theta) * TMath::Sin(phi); | |
135 | q[2] = p * TMath::Cos(theta); | |
136 | ||
137 | /* Transform to system of the target nucleus */ | |
138 | /* beta is passed as negative, because the gray nucleons are slowed down */ | |
139 | Lorentz(m, -beta, q); | |
140 | ||
141 | /* Transform to laboratory system */ | |
142 | Lorentz(m, fBeta, q); | |
143 | } | |
144 | ||
145 | Double_t AliGenGrayParticles::Maxwell(Double_t m, Double_t p, Double_t T) | |
146 | { | |
147 | /* Relativistic Maxwell-distribution */ | |
148 | Double_t ekin; | |
149 | ekin = TMath::Sqrt(p*p+m*m)-m; | |
150 | return (p*p * exp(-ekin/T)); | |
151 | } | |
152 | ||
153 | ||
154 | void AliGenGrayParticles::Lorentz(Double_t m, Double_t beta, Float_t* q) | |
155 | { | |
156 | /* Lorentz transform in the direction of q[2] */ | |
157 | ||
158 | Double_t gamma = 1/sqrt(1-beta*beta); | |
159 | Double_t energy = sqrt(m*m + q[0]*q[0] + q[1]*q[1] + q[2]*q[2]); | |
160 | q[2] = gamma * (q[2] + beta*energy); | |
161 | } | |
162 | ||
163 | ||
164 | ||
165 | ||
166 | ||
167 | ||
168 |