]>
Commit | Line | Data |
---|---|---|
c9a8628a | 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$ | |
c8f7f6f9 | 18 | Revision 1.3 2003/06/26 08:45:22 morsch |
19 | - Vertex using Vertex() method. | |
20 | - Use member data in GetNumberOfSlowNucleons call. | |
21 | ||
99f5114f | 22 | Revision 1.2 2003/03/25 09:55:24 morsch |
23 | Numbers of slow nucleons either from model or user set. | |
24 | ||
1c22a81e | 25 | Revision 1.1 2003/03/24 16:49:23 morsch |
26 | Slow nucleon generator and model. | |
27 | ||
c9a8628a | 28 | */ |
29 | ||
30 | /* | |
31 | Generator for slow nucluons in pA interactions. | |
32 | Source is modelled by a relativistic Maxwell distributions. | |
33 | Original code by Ferenc Sikler <sikler@rmki.kfki.hu> | |
34 | */ | |
35 | ||
36 | #include <TDatabasePDG.h> | |
37 | #include <TPDGCode.h> | |
38 | #include <TH2F.h> | |
c8f7f6f9 | 39 | #include <TCanvas.h> |
c9a8628a | 40 | |
41 | #include "AliCollisionGeometry.h" | |
42 | #include "AliGenSlowNucleons.h" | |
43 | #include "AliSlowNucleonModel.h" | |
44 | ||
45 | ClassImp(AliGenSlowNucleons) | |
46 | ||
47 | AliGenSlowNucleons::AliGenSlowNucleons():AliGenerator(-1) | |
48 | { | |
49 | // Default constructor | |
50 | fSlowNucleonModel = 0; | |
51 | fCollisionGeometry = 0; | |
52 | } | |
53 | ||
54 | AliGenSlowNucleons::AliGenSlowNucleons(Int_t npart) | |
55 | :AliGenerator(npart) | |
56 | { | |
57 | // Constructor | |
58 | fName = "SlowNucleons"; | |
59 | fTitle = "Generator for gray particles in pA collisions"; | |
60 | SetPmax(); | |
61 | SetTarget(); | |
62 | SetNominalCmsEnergy(); | |
63 | SetCharge(); | |
64 | SetTemperature(); | |
65 | SetBetaSource(); | |
66 | fSlowNucleonModel = new AliSlowNucleonModel(); | |
67 | fCollisionGeometry = 0; | |
68 | fDebug = 0; | |
69 | } | |
70 | ||
71 | //____________________________________________________________ | |
72 | AliGenSlowNucleons::~AliGenSlowNucleons() | |
73 | { | |
74 | // Destructor | |
75 | delete fSlowNucleonModel; | |
76 | } | |
77 | ||
78 | ||
79 | void AliGenSlowNucleons::Init() | |
80 | { | |
81 | // | |
82 | // Initialization | |
83 | // | |
84 | Float_t kMass = TDatabasePDG::Instance()->GetParticle(kProton)->Mass(); | |
85 | fMomentum = fCMS/2. * fZTarget / fATarget; | |
86 | fBeta = fMomentum / TMath::Sqrt(kMass * kMass + fMomentum * fMomentum); | |
87 | if (fDebug) { | |
c8f7f6f9 | 88 | fDebugHist1 = new TH2F("DebugHist1", "nu vs N_slow", 100, 0., 100., 20, 0., 20.); |
89 | fDebugHist2 = new TH2F("DebugHist2", "b vs N_slow", 100, 0., 100., 15, 0., 15.); | |
c9a8628a | 90 | } |
91 | } | |
92 | ||
93 | void AliGenSlowNucleons::FinishRun() | |
94 | { | |
95 | if (fDebug) { | |
c8f7f6f9 | 96 | TCanvas *c = new TCanvas("c","Canvas 1",400,10,600,700); |
97 | c->Divide(2,1); | |
98 | c->cd(1); | |
99 | fDebugHist1->Draw(); | |
100 | c->cd(2); | |
101 | fDebugHist2->Draw(); | |
c9a8628a | 102 | } |
103 | } | |
104 | ||
105 | ||
106 | void AliGenSlowNucleons::Generate() | |
107 | { | |
108 | // | |
109 | // Generate one event | |
110 | // | |
111 | // | |
112 | // Communication with Gray Particle Model | |
113 | // | |
1c22a81e | 114 | if (fCollisionGeometry) { |
115 | Float_t b = fCollisionGeometry->ImpactParameter(); | |
116 | Int_t nn = fCollisionGeometry->NN(); | |
117 | Int_t nwn = fCollisionGeometry->NwN(); | |
118 | Int_t nnw = fCollisionGeometry->NNw(); | |
119 | Int_t nwnw = fCollisionGeometry->NwNw(); | |
120 | ||
99f5114f | 121 | fSlowNucleonModel->GetNumberOfSlowNucleons(fCollisionGeometry, fNgp, fNgn, fNbp, fNbn); |
1c22a81e | 122 | if (fDebug) { |
123 | printf("Nucleons %d %d %d %d \n", fNgp, fNgn, fNbp, fNbn); | |
c8f7f6f9 | 124 | fDebugHist1->Fill(Float_t(fNgp + fNgn + fNbp + fNbn), fCollisionGeometry->NwN(), 1.); |
125 | fDebugHist2->Fill(Float_t(fNgp + fNgn + fNbp + fNbn), b, 1.); | |
1c22a81e | 126 | printf("AliGenSlowNucleons: Impact parameter from Collision Geometry %f %d %d %d %d\n", |
127 | b, nn, nwn, nnw, nwnw); | |
128 | } | |
129 | } | |
c9a8628a | 130 | |
131 | // | |
132 | Float_t p[3]; | |
133 | Float_t origin[3] = {0., 0., 0.}; | |
134 | Float_t polar [3] = {0., 0., 0.}; | |
99f5114f | 135 | Int_t nt, i, j; |
c9a8628a | 136 | Int_t kf; |
99f5114f | 137 | |
138 | if(fVertexSmear == kPerEvent) { | |
139 | Vertex(); | |
140 | for (j=0; j < 3; j++) origin[j] = fVertex[j]; | |
141 | } // if kPerEvent | |
c9a8628a | 142 | // |
143 | // Gray protons | |
144 | // | |
145 | fCharge = 1; | |
146 | kf = kProton; | |
1c22a81e | 147 | for(i = 0; i < fNgp; i++) { |
c9a8628a | 148 | GenerateSlow(fCharge, fTemperatureG, fBetaSourceG, p); |
149 | SetTrack(fTrackIt, -1, kf, p, origin, polar, | |
150 | 0., kPNoProcess, nt, 1.); | |
151 | KeepTrack(nt); | |
152 | } | |
153 | // | |
154 | // Gray neutrons | |
155 | // | |
156 | fCharge = 0; | |
157 | kf = kNeutron; | |
1c22a81e | 158 | for(i = 0; i < fNgn; i++) { |
c9a8628a | 159 | GenerateSlow(fCharge, fTemperatureG, fBetaSourceG, p); |
160 | SetTrack(fTrackIt, -1, kf, p, origin, polar, | |
161 | 0., kPNoProcess, nt, 1.); | |
162 | KeepTrack(nt); | |
163 | } | |
164 | // | |
165 | // Black protons | |
166 | // | |
167 | fCharge = 1; | |
168 | kf = kProton; | |
1c22a81e | 169 | for(i = 0; i < fNbp; i++) { |
c9a8628a | 170 | GenerateSlow(fCharge, fTemperatureB, fBetaSourceB, p); |
171 | SetTrack(fTrackIt, -1, kf, p, origin, polar, | |
172 | 0., kPNoProcess, nt, 1.); | |
173 | KeepTrack(nt); | |
174 | } | |
175 | // | |
176 | // Black neutrons | |
177 | // | |
178 | fCharge = 0; | |
179 | kf = kNeutron; | |
1c22a81e | 180 | for(i = 0; i < fNbn; i++) { |
c9a8628a | 181 | GenerateSlow(fCharge, fTemperatureB, fBetaSourceB, p); |
182 | SetTrack(fTrackIt, -1, kf, p, origin, polar, | |
183 | 0., kPNoProcess, nt, 1.); | |
184 | KeepTrack(nt); | |
185 | } | |
186 | } | |
187 | ||
188 | ||
189 | ||
190 | ||
191 | void AliGenSlowNucleons::GenerateSlow(Int_t charge, Double_t T, Double_t beta, Float_t* q) | |
192 | /* | |
193 | Emit a slow nucleon with "temperature" T [GeV], | |
194 | from a source moving with velocity beta | |
195 | Three-momentum [GeV/c] is given back in q[3] | |
196 | */ | |
197 | ||
198 | { | |
199 | Double_t m, pmax, p, f, theta, phi; | |
200 | ||
201 | TDatabasePDG * pdg = TDatabasePDG::Instance(); | |
202 | const Double_t kMassProton = pdg->GetParticle(kProton) ->Mass(); | |
203 | const Double_t kMassNeutron = pdg->GetParticle(kNeutron)->Mass(); | |
204 | ||
205 | /* Select nucleon type */ | |
206 | if(charge == 0) m = kMassNeutron; | |
207 | else m = kMassProton; | |
208 | ||
209 | /* Momentum at maximum of Maxwell-distribution */ | |
210 | ||
211 | pmax = TMath::Sqrt(2*T*(T+sqrt(T*T+m*m))); | |
212 | ||
213 | /* Try until proper momentum */ | |
214 | /* for lack of primitive function of the Maxwell-distribution */ | |
215 | /* a brute force trial-accept loop, normalized at pmax */ | |
216 | ||
217 | do | |
218 | { | |
219 | p = Rndm() * fPmax; | |
220 | f = Maxwell(m, p, T) / Maxwell(m , pmax, T); | |
221 | } | |
222 | while(f < Rndm()); | |
223 | ||
224 | /* Spherical symmetric emission */ | |
225 | theta = TMath::ACos(2. * Rndm() - 1.); | |
226 | phi = 2. * TMath::Pi() * Rndm(); | |
227 | ||
228 | /* Determine momentum components in system of the moving source */ | |
229 | q[0] = p * TMath::Sin(theta) * TMath::Cos(phi); | |
230 | q[1] = p * TMath::Sin(theta) * TMath::Sin(phi); | |
231 | q[2] = p * TMath::Cos(theta); | |
232 | ||
233 | /* Transform to system of the target nucleus */ | |
234 | /* beta is passed as negative, because the gray nucleons are slowed down */ | |
235 | Lorentz(m, -beta, q); | |
236 | ||
237 | /* Transform to laboratory system */ | |
238 | Lorentz(m, fBeta, q); | |
239 | } | |
240 | ||
241 | Double_t AliGenSlowNucleons::Maxwell(Double_t m, Double_t p, Double_t T) | |
242 | { | |
243 | /* Relativistic Maxwell-distribution */ | |
244 | Double_t ekin; | |
245 | ekin = TMath::Sqrt(p*p+m*m)-m; | |
246 | return (p*p * exp(-ekin/T)); | |
247 | } | |
248 | ||
249 | ||
250 | void AliGenSlowNucleons::Lorentz(Double_t m, Double_t beta, Float_t* q) | |
251 | { | |
252 | /* Lorentz transform in the direction of q[2] */ | |
253 | ||
254 | Double_t gamma = 1/sqrt(1-beta*beta); | |
255 | Double_t energy = sqrt(m*m + q[0]*q[0] + q[1]*q[1] + q[2]*q[2]); | |
256 | q[2] = gamma * (q[2] + beta*energy); | |
257 | } | |
258 | ||
259 | ||
260 | ||
261 | ||
262 | ||
263 | ||
264 |