1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
21 Generator for slow nucluons in pA interactions.
22 Source is modelled by a relativistic Maxwell distributions.
23 Original code by Ferenc Sikler <sikler@rmki.kfki.hu>
26 #include <TDatabasePDG.h>
30 #include "AliCollisionGeometry.h"
31 #include "AliGenSlowNucleons.h"
32 #include "AliSlowNucleonModel.h"
34 ClassImp(AliGenSlowNucleons)
36 AliGenSlowNucleons::AliGenSlowNucleons():AliGenerator(-1)
38 // Default constructor
39 fSlowNucleonModel = 0;
40 fCollisionGeometry = 0;
43 AliGenSlowNucleons::AliGenSlowNucleons(Int_t npart)
47 fName = "SlowNucleons";
48 fTitle = "Generator for gray particles in pA collisions";
51 SetNominalCmsEnergy();
55 fSlowNucleonModel = new AliSlowNucleonModel();
56 fCollisionGeometry = 0;
60 //____________________________________________________________
61 AliGenSlowNucleons::~AliGenSlowNucleons()
64 delete fSlowNucleonModel;
68 void AliGenSlowNucleons::Init()
73 Float_t kMass = TDatabasePDG::Instance()->GetParticle(kProton)->Mass();
74 fMomentum = fCMS/2. * fZTarget / fATarget;
75 fBeta = fMomentum / TMath::Sqrt(kMass * kMass + fMomentum * fMomentum);
77 fDebugHist = new TH2F("DebugHist", "N_heavy vs nu", 50, 0., 50., 50, 0., 50.);
81 void AliGenSlowNucleons::FinishRun()
89 void AliGenSlowNucleons::Generate()
95 // Communication with Gray Particle Model
97 Int_t ngp, ngn, nbp, nbn;
99 Float_t b = fCollisionGeometry->ImpactParameter();
100 Int_t nn = fCollisionGeometry->NN();
101 Int_t nwn = fCollisionGeometry->NwN();
102 Int_t nnw = fCollisionGeometry->NNw();
103 Int_t nwnw = fCollisionGeometry->NwNw();
105 printf("AliGenSlowNucleons: Impact parameter from Collision Geometry %f %d %d %d %d\n",
106 b, nn, nwn, nnw, nwnw);
108 fSlowNucleonModel->GetNumberOfSlowNucleons(fCollisionGeometry, ngp, ngn, nbp, nbn);
111 printf("nucleons %d %d %d %d \n", ngp, ngn, nbp, nbn);
113 fDebugHist->Fill(Float_t(ngp + ngn + nbp + nbn), fCollisionGeometry->NwN(), 1.);
119 Float_t origin[3] = {0., 0., 0.};
120 Float_t polar [3] = {0., 0., 0.};
128 for(i = 0; i < ngp; i++) {
129 GenerateSlow(fCharge, fTemperatureG, fBetaSourceG, p);
130 SetTrack(fTrackIt, -1, kf, p, origin, polar,
131 0., kPNoProcess, nt, 1.);
139 for(i = 0; i < ngn; i++) {
140 GenerateSlow(fCharge, fTemperatureG, fBetaSourceG, p);
141 SetTrack(fTrackIt, -1, kf, p, origin, polar,
142 0., kPNoProcess, nt, 1.);
150 for(i = 0; i < nbp; i++) {
151 GenerateSlow(fCharge, fTemperatureB, fBetaSourceB, p);
152 SetTrack(fTrackIt, -1, kf, p, origin, polar,
153 0., kPNoProcess, nt, 1.);
161 for(i = 0; i < nbn; i++) {
162 GenerateSlow(fCharge, fTemperatureB, fBetaSourceB, p);
163 SetTrack(fTrackIt, -1, kf, p, origin, polar,
164 0., kPNoProcess, nt, 1.);
172 void AliGenSlowNucleons::GenerateSlow(Int_t charge, Double_t T, Double_t beta, Float_t* q)
174 Emit a slow nucleon with "temperature" T [GeV],
175 from a source moving with velocity beta
176 Three-momentum [GeV/c] is given back in q[3]
180 Double_t m, pmax, p, f, theta, phi;
182 TDatabasePDG * pdg = TDatabasePDG::Instance();
183 const Double_t kMassProton = pdg->GetParticle(kProton) ->Mass();
184 const Double_t kMassNeutron = pdg->GetParticle(kNeutron)->Mass();
186 /* Select nucleon type */
187 if(charge == 0) m = kMassNeutron;
188 else m = kMassProton;
190 /* Momentum at maximum of Maxwell-distribution */
192 pmax = TMath::Sqrt(2*T*(T+sqrt(T*T+m*m)));
194 /* Try until proper momentum */
195 /* for lack of primitive function of the Maxwell-distribution */
196 /* a brute force trial-accept loop, normalized at pmax */
201 f = Maxwell(m, p, T) / Maxwell(m , pmax, T);
205 /* Spherical symmetric emission */
206 theta = TMath::ACos(2. * Rndm() - 1.);
207 phi = 2. * TMath::Pi() * Rndm();
209 /* Determine momentum components in system of the moving source */
210 q[0] = p * TMath::Sin(theta) * TMath::Cos(phi);
211 q[1] = p * TMath::Sin(theta) * TMath::Sin(phi);
212 q[2] = p * TMath::Cos(theta);
214 /* Transform to system of the target nucleus */
215 /* beta is passed as negative, because the gray nucleons are slowed down */
216 Lorentz(m, -beta, q);
218 /* Transform to laboratory system */
219 Lorentz(m, fBeta, q);
222 Double_t AliGenSlowNucleons::Maxwell(Double_t m, Double_t p, Double_t T)
224 /* Relativistic Maxwell-distribution */
226 ekin = TMath::Sqrt(p*p+m*m)-m;
227 return (p*p * exp(-ekin/T));
231 void AliGenSlowNucleons::Lorentz(Double_t m, Double_t beta, Float_t* q)
233 /* Lorentz transform in the direction of q[2] */
235 Double_t gamma = 1/sqrt(1-beta*beta);
236 Double_t energy = sqrt(m*m + q[0]*q[0] + q[1]*q[1] + q[2]*q[2]);
237 q[2] = gamma * (q[2] + beta*energy);