]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVGEN/AliGenMevSim.cxx
AliGenSTRANGElib.cxx first commit.
[u/mrichter/AliRoot.git] / EVGEN / AliGenMevSim.cxx
CommitLineData
b7e18fda 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$
3f4b45cb 18Revision 1.2 2001/03/28 07:31:48 hristov
19Loop variables declared only once (HP,Sun)
20
87cc7ee3 21Revision 1.1 2001/03/24 10:04:44 morsch
22MevSim interfaced through AliGenerator, first commit (Sylwester Radomski et al.)
3f4b45cb 23//Piotr Skowronski Line 104: fThetaMin-->fThetaMax
b7e18fda 24*/
25
26//
27// Wrapper for MEVSIM generator.
28// It is using TMevSim to comunicate with fortarn code
29//
30//
31// Sylwester Radomski <radomski@if.pw.edu.pl>
32//
33
34//#include "TSystem.h"
35//#include "TUnixSystem.h"
36#include "TParticle.h"
37#include "TMevSim.h"
38
39#include "AliGenMevSim.h"
40#include "AliRun.h"
41
42
43ClassImp(AliGenMevSim)
44
45//____________________________________________________________________________
46AliGenMevSim::AliGenMevSim() : AliGenerator(-1)
47{
48 //
49 // Standard creator
50 //
51
52 fConfig = new AliMevSimConfig();
3f4b45cb 53 fMevSim = new TMevSim();
b7e18fda 54 sRandom = fRandom;
55
56}
57//____________________________________________________________________________
58AliGenMevSim::AliGenMevSim(AliMevSimConfig *config): AliGenerator(-1) {
59
60 fConfig = config;
3f4b45cb 61 fMevSim = new TMevSim();
b7e18fda 62 sRandom = fRandom;
63}
64
65//____________________________________________________________________________
66AliGenMevSim::~AliGenMevSim()
67{
68 //
69 // Standard destructor
70 //
3f4b45cb 71 if (fMevSim) delete fMevSim;
b7e18fda 72}
73//____________________________________________________________________________
74void AliGenMevSim::SetConfig(AliMevSimConfig *config) {
75
76 fConfig = config;
77}
78//____________________________________________________________________________
79void AliGenMevSim::AddParticleType(AliMevSimParticle *type) {
80
3f4b45cb 81 fMevSim->AddPartTypeParams((TMevSimPartTypeParams*)type);
b7e18fda 82}
83//____________________________________________________________________________
84void AliGenMevSim::Init()
85{
86 //
87 // Generator initialisation method
88 //
89
90 // fill data from AliMevSimConfig;
91
3f4b45cb 92 TMevSim *mevsim = fMevSim;
b7e18fda 93
94 // geometry & momentum cut
95
96 if (TestBit(kPtRange)) mevsim->SetPtCutRange(fPtMin, fPtMax);
97
98 if (TestBit(kPhiRange)) // from radians to 0 - 360 deg
99 mevsim->SetPhiCutRange( fPhiMin * 180 / TMath::Pi() , fPhiMax * 180 / TMath::Pi() );
100
101 if (TestBit(kThetaRange)) // from theta to eta
3f4b45cb 102 {
103 mevsim->SetEtaCutRange( -TMath::Log( TMath::Tan(fThetaMax/2)) , -TMath::Log( TMath::Tan(fThetaMin/2)) );
104 }
b7e18fda 105
106 // mevsim specyfic parameters
107
108 mevsim->SetModelType(fConfig->fModelType);
109 mevsim->SetReacPlaneCntrl(fConfig->fReacPlaneCntrl);
110 mevsim->SetPsiRParams(fConfig->fPsiRMean, fConfig->fPsiRStDev);
111 mevsim->SetMultFacParams(fConfig->fMultFacMean, fConfig->fMultFacStDev);
112
113 // mevsim initialisation
114
115 mevsim->Initialize();
116}
117
118//____________________________________________________________________________
119void AliGenMevSim::Generate()
120{
121 //
122 // Read the formatted output file and load the particles
123 // Temporary solution
124 //
125
87cc7ee3 126 Int_t i;
127
b7e18fda 128 PDG_t pdg;
129 Float_t orgin[3] = {0,0,0};
130 Float_t polar[3] = {0,0,0};
131 Float_t p[3] = {1,1,1};
132 Float_t time = 0;
133
134 const Int_t parent = -1;
135 Int_t id;
136
137 // vertexing
138
139 VertexInternal();
140
141 orgin[0] = fVertex[0];
142 orgin[1] = fVertex[1];
143 orgin[2] = fVertex[2];
144
145 cout << "Vertex ";
87cc7ee3 146 for (i =0; i<3; i++)
b7e18fda 147 cout << orgin[i] << "\t";
148 cout << endl;
149
150 Int_t nParticles = 0;
151
152 TClonesArray *particles = new TClonesArray("TParticle");
153 TParticle *particle;
154
3f4b45cb 155 fMevSim->GenerateEvent();
156 fNpart= fMevSim->ImportParticles(particles,"");
b7e18fda 157
3f4b45cb 158 cout << "Found " << fNpart << " particles ..." << endl;
159 nParticles = fNpart;
b7e18fda 160
87cc7ee3 161 for (i=0; i<nParticles; i++) {
b7e18fda 162
163 particle = (TParticle*) (*particles)[i];
164
165 pdg = (PDG_t) particle->GetPdgCode();
166 p[0] = particle->Px();
167 p[1] = particle->Py();
168 p[2] = particle->Pz();
169
3f4b45cb 170 SetTrack(fTrackIt, parent, pdg, p, orgin, polar, time, kPPrimary, id);
b7e18fda 171
172 }
173
174 particles->Clear();
175 if (particles) delete particles;
176}
177//____________________________________________________________________________
178//____________________________________________________________________________
179
180
181#ifndef WIN32
182# define ran ran_
183# define type_of_call
184#else
185# define ran RAN
186# define type_of_call _stdcall
187#endif
188
189extern "C" Float_t type_of_call ran(Int_t &)
190{
191 return sRandom->Rndm();
192}
193
194//____________________________________________________________________________