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 **************************************************************************/
19 // Wrapper for MEVSIM generator.
20 // It is using TMevSim to comunicate with fortarn code
23 // Sylwester Radomski <radomski@if.pw.edu.pl>
26 //#include "TSystem.h"
27 //#include "TUnixSystem.h"
28 #include "TParticle.h"
31 #include "AliGenMevSim.h"
34 static TRandom * sRandom;
36 ClassImp(AliGenMevSim)
38 //____________________________________________________________________________
39 AliGenMevSim::AliGenMevSim() : AliGenerator(-1)
45 fConfig = new AliMevSimConfig();
46 fMevSim = new TMevSim();
50 //____________________________________________________________________________
51 AliGenMevSim::AliGenMevSim(AliMevSimConfig *config): AliGenerator(-1) {
54 fMevSim = new TMevSim();
58 //____________________________________________________________________________
59 AliGenMevSim::~AliGenMevSim()
62 // Standard destructor
64 if (fMevSim) delete fMevSim;
66 //____________________________________________________________________________
67 void AliGenMevSim::SetConfig(AliMevSimConfig *config) {
71 //____________________________________________________________________________
72 void AliGenMevSim::AddParticleType(AliMevSimParticle *type) {
74 fMevSim->AddPartTypeParams((TMevSimPartTypeParams*)type);
76 //____________________________________________________________________________
77 void AliGenMevSim::Init()
80 // Generator initialisation method
83 // fill data from AliMevSimConfig;
85 TMevSim *mevsim = fMevSim;
87 // geometry & momentum cut
89 if (TestBit(kPtRange)) mevsim->SetPtCutRange(fPtMin, fPtMax);
91 if (TestBit(kPhiRange)) // from radians to 0 - 360 deg
92 mevsim->SetPhiCutRange( fPhiMin * 180 / TMath::Pi() , fPhiMax * 180 / TMath::Pi() );
94 if (TestBit(kThetaRange)) // from theta to eta
96 mevsim->SetEtaCutRange( -TMath::Log( TMath::Tan(fThetaMax/2)) , -TMath::Log( TMath::Tan(fThetaMin/2)) );
99 // mevsim specyfic parameters
101 mevsim->SetModelType(fConfig->fModelType);
102 mevsim->SetReacPlaneCntrl(fConfig->fReacPlaneCntrl);
103 mevsim->SetPsiRParams(fConfig->fPsiRMean, fConfig->fPsiRStDev);
104 mevsim->SetMultFacParams(fConfig->fMultFacMean, fConfig->fMultFacStDev);
106 // mevsim initialisation
108 mevsim->Initialize();
111 //____________________________________________________________________________
112 void AliGenMevSim::Generate()
115 // Read the formatted output file and load the particles
116 // Temporary solution
122 Float_t orgin[3] = {0,0,0};
123 Float_t polar[3] = {0,0,0};
124 Float_t p[3] = {1,1,1};
127 const Int_t parent = -1;
134 orgin[0] = fVertex[0];
135 orgin[1] = fVertex[1];
136 orgin[2] = fVertex[2];
140 cout << orgin[i] << "\t";
143 Int_t nParticles = 0;
145 TClonesArray *particles = new TClonesArray("TParticle");
148 fMevSim->GenerateEvent();
149 fNpart= fMevSim->ImportParticles(particles,"");
151 cout << "Found " << fNpart << " particles ..." << endl;
154 for (i=0; i<nParticles; i++) {
156 particle = (TParticle*) (*particles)[i];
158 pdg = (PDG_t) particle->GetPdgCode();
159 p[0] = particle->Px();
160 p[1] = particle->Py();
161 p[2] = particle->Pz();
163 PushTrack(fTrackIt, parent, pdg, p, orgin, polar, time, kPPrimary, id);
168 if (particles) delete particles;
170 //____________________________________________________________________________
171 //____________________________________________________________________________
176 # define type_of_call
179 # define type_of_call _stdcall
182 extern "C" Float_t type_of_call ran(Int_t &)
184 return sRandom->Rndm();
187 //____________________________________________________________________________