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.2 2001/03/28 07:31:48 hristov
19 Loop variables declared only once (HP,Sun)
21 Revision 1.1 2001/03/24 10:04:44 morsch
22 MevSim interfaced through AliGenerator, first commit (Sylwester Radomski et al.)
23 //Piotr Skowronski Line 104: fThetaMin-->fThetaMax
27 // Wrapper for MEVSIM generator.
28 // It is using TMevSim to comunicate with fortarn code
31 // Sylwester Radomski <radomski@if.pw.edu.pl>
34 //#include "TSystem.h"
35 //#include "TUnixSystem.h"
36 #include "TParticle.h"
39 #include "AliGenMevSim.h"
43 ClassImp(AliGenMevSim)
45 //____________________________________________________________________________
46 AliGenMevSim::AliGenMevSim() : AliGenerator(-1)
52 fConfig = new AliMevSimConfig();
53 fMevSim = new TMevSim();
57 //____________________________________________________________________________
58 AliGenMevSim::AliGenMevSim(AliMevSimConfig *config): AliGenerator(-1) {
61 fMevSim = new TMevSim();
65 //____________________________________________________________________________
66 AliGenMevSim::~AliGenMevSim()
69 // Standard destructor
71 if (fMevSim) delete fMevSim;
73 //____________________________________________________________________________
74 void AliGenMevSim::SetConfig(AliMevSimConfig *config) {
78 //____________________________________________________________________________
79 void AliGenMevSim::AddParticleType(AliMevSimParticle *type) {
81 fMevSim->AddPartTypeParams((TMevSimPartTypeParams*)type);
83 //____________________________________________________________________________
84 void AliGenMevSim::Init()
87 // Generator initialisation method
90 // fill data from AliMevSimConfig;
92 TMevSim *mevsim = fMevSim;
94 // geometry & momentum cut
96 if (TestBit(kPtRange)) mevsim->SetPtCutRange(fPtMin, fPtMax);
98 if (TestBit(kPhiRange)) // from radians to 0 - 360 deg
99 mevsim->SetPhiCutRange( fPhiMin * 180 / TMath::Pi() , fPhiMax * 180 / TMath::Pi() );
101 if (TestBit(kThetaRange)) // from theta to eta
103 mevsim->SetEtaCutRange( -TMath::Log( TMath::Tan(fThetaMax/2)) , -TMath::Log( TMath::Tan(fThetaMin/2)) );
106 // mevsim specyfic parameters
108 mevsim->SetModelType(fConfig->fModelType);
109 mevsim->SetReacPlaneCntrl(fConfig->fReacPlaneCntrl);
110 mevsim->SetPsiRParams(fConfig->fPsiRMean, fConfig->fPsiRStDev);
111 mevsim->SetMultFacParams(fConfig->fMultFacMean, fConfig->fMultFacStDev);
113 // mevsim initialisation
115 mevsim->Initialize();
118 //____________________________________________________________________________
119 void AliGenMevSim::Generate()
122 // Read the formatted output file and load the particles
123 // Temporary solution
129 Float_t orgin[3] = {0,0,0};
130 Float_t polar[3] = {0,0,0};
131 Float_t p[3] = {1,1,1};
134 const Int_t parent = -1;
141 orgin[0] = fVertex[0];
142 orgin[1] = fVertex[1];
143 orgin[2] = fVertex[2];
147 cout << orgin[i] << "\t";
150 Int_t nParticles = 0;
152 TClonesArray *particles = new TClonesArray("TParticle");
155 fMevSim->GenerateEvent();
156 fNpart= fMevSim->ImportParticles(particles,"");
158 cout << "Found " << fNpart << " particles ..." << endl;
161 for (i=0; i<nParticles; i++) {
163 particle = (TParticle*) (*particles)[i];
165 pdg = (PDG_t) particle->GetPdgCode();
166 p[0] = particle->Px();
167 p[1] = particle->Py();
168 p[2] = particle->Pz();
170 SetTrack(fTrackIt, parent, pdg, p, orgin, polar, time, kPPrimary, id);
175 if (particles) delete particles;
177 //____________________________________________________________________________
178 //____________________________________________________________________________
183 # define type_of_call
186 # define type_of_call _stdcall
189 extern "C" Float_t type_of_call ran(Int_t &)
191 return sRandom->Rndm();
194 //____________________________________________________________________________