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 **************************************************************************/
18 Revision 1.5 2003/01/07 14:11:43 morsch
19 Comminication with gray particle model and collision geometry added.
21 Revision 1.4 2003/01/06 10:09:57 morsch
22 Use AliGrayParticleModel.
24 Revision 1.3 2002/12/02 10:02:40 morsch
25 Corrections introduced by F. Silker:
27 - Particle type according to charge.
29 Revision 1.2 2002/10/14 14:55:35 hristov
30 Merging the VirtualMC branch to the main development branch (HEAD)
32 Revision 1.1.2.1 2002/10/10 16:40:08 hristov
33 Updating VirtualMC to v3-09-02
35 Revision 1.1 2002/10/08 13:53:17 morsch
36 Gray particle generator, first commit.
41 Generator for gray nucluons in pA interactions.
42 Source is modelled by a relativistic Maxwell distributions.
43 Original code by Ferenc Sikler <sikler@rmki.kfki.hu>
46 #include <TDatabasePDG.h>
49 #include "AliCollisionGeometry.h"
50 #include "AliGenGrayParticles.h"
51 #include "AliGrayParticleModel.h"
53 ClassImp(AliGenGrayParticles)
55 AliGenGrayParticles::AliGenGrayParticles():AliGenerator(-1)
57 // Default constructor
58 fGrayParticleModel = 0;
59 fCollisionGeometry = 0;
62 AliGenGrayParticles::AliGenGrayParticles(Int_t npart)
66 fName = "GrayParticles";
67 fTitle = "Generator for gray particles in pA collisions";
70 SetNominalCmsEnergy();
74 fGrayParticleModel = new AliGrayParticleModel();
75 fCollisionGeometry = 0;
78 //____________________________________________________________
79 AliGenGrayParticles::~AliGenGrayParticles()
82 delete fGrayParticleModel;
86 void AliGenGrayParticles::Init()
91 Float_t kMass = TDatabasePDG::Instance()->GetParticle(kProton)->Mass();
92 fMomentum = fCMS/2. * fZTarget / fATarget;
93 fBeta = fMomentum / TMath::Sqrt(kMass * kMass + fMomentum * fMomentum);
97 void AliGenGrayParticles::Generate()
100 // Generate one event
103 // Communication with Gray Particle Model
107 Float_t b = fCollisionGeometry->ImpactParameter();
108 printf("AliGenGrayParticles: Impact parameter from Collision Geometry %f \n", b);
110 fGrayParticleModel->GetNumberOfGrayNucleons(fCollisionGeometry, np, nn);
114 Float_t origin[3] = {0., 0., 0.};
115 Float_t polar [3] = {0., 0., 0.};
117 for(i = 0;i < fNpart; i++) {
119 if(fCharge==1) kf = kProton;
121 GenerateSlow(fCharge, fTemperature, fBetaSource, p);
123 SetTrack(fTrackIt, -1, kf, p, origin, polar,
124 0., kPNoProcess, nt, 1.);
133 void AliGenGrayParticles::GenerateSlow(Int_t charge, Double_t T, Double_t beta, Float_t* q)
135 Emit a slow nucleon with "temperature" T [GeV],
136 from a source moving with velocity beta
137 Three-momentum [GeV/c] is given back in q[3]
141 Double_t m, pmax, p, f, theta, phi;
143 TDatabasePDG * pdg = TDatabasePDG::Instance();
144 const Double_t kMassProton = pdg->GetParticle(kProton) ->Mass();
145 const Double_t kMassNeutron = pdg->GetParticle(kNeutron)->Mass();
147 /* Select nucleon type */
148 if(charge == 0) m = kMassNeutron;
149 else m = kMassProton;
151 /* Momentum at maximum of Maxwell-distribution */
153 pmax = TMath::Sqrt(2*T*(T+sqrt(T*T+m*m)));
155 /* Try until proper momentum */
156 /* for lack of primitive function of the Maxwell-distribution */
157 /* a brute force trial-accept loop, normalized at pmax */
162 f = Maxwell(m, p, T) / Maxwell(m , pmax, T);
166 /* Spherical symmetric emission */
167 theta = TMath::ACos(2. * Rndm() - 1.);
168 phi = 2. * TMath::Pi() * Rndm();
170 /* Determine momentum components in system of the moving source */
171 q[0] = p * TMath::Sin(theta) * TMath::Cos(phi);
172 q[1] = p * TMath::Sin(theta) * TMath::Sin(phi);
173 q[2] = p * TMath::Cos(theta);
175 /* Transform to system of the target nucleus */
176 /* beta is passed as negative, because the gray nucleons are slowed down */
177 Lorentz(m, -beta, q);
179 /* Transform to laboratory system */
180 Lorentz(m, fBeta, q);
183 Double_t AliGenGrayParticles::Maxwell(Double_t m, Double_t p, Double_t T)
185 /* Relativistic Maxwell-distribution */
187 ekin = TMath::Sqrt(p*p+m*m)-m;
188 return (p*p * exp(-ekin/T));
192 void AliGenGrayParticles::Lorentz(Double_t m, Double_t beta, Float_t* q)
194 /* Lorentz transform in the direction of q[2] */
196 Double_t gamma = 1/sqrt(1-beta*beta);
197 Double_t energy = sqrt(m*m + q[0]*q[0] + q[1]*q[1] + q[2]*q[2]);
198 q[2] = gamma * (q[2] + beta*energy);