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.3 2001/07/27 17:24:28 morsch
19 Some bugs corrected. ( Piotr Skowronski)
21 Revision 1.2 2001/03/28 07:31:48 hristov
22 Loop variables declared only once (HP,Sun)
24 Revision 1.1 2001/03/24 10:04:44 morsch
25 MevSim interfaced through AliGenerator, first commit (Sylwester Radomski et al.)
26 //Piotr Skowronski Line 104: fThetaMin-->fThetaMax
30 // Wrapper for MEVSIM generator.
31 // It is using TMevSim to comunicate with fortarn code
34 // Sylwester Radomski <radomski@if.pw.edu.pl>
37 //#include "TSystem.h"
38 //#include "TUnixSystem.h"
39 #include "TParticle.h"
42 #include "AliGenMevSim.h"
46 ClassImp(AliGenMevSim)
48 //____________________________________________________________________________
49 AliGenMevSim::AliGenMevSim() : AliGenerator(-1)
55 fConfig = new AliMevSimConfig();
56 fMevSim = new TMevSim();
60 //____________________________________________________________________________
61 AliGenMevSim::AliGenMevSim(AliMevSimConfig *config): AliGenerator(-1) {
64 fMevSim = new TMevSim();
68 //____________________________________________________________________________
69 AliGenMevSim::~AliGenMevSim()
72 // Standard destructor
74 if (fMevSim) delete fMevSim;
76 //____________________________________________________________________________
77 void AliGenMevSim::SetConfig(AliMevSimConfig *config) {
81 //____________________________________________________________________________
82 void AliGenMevSim::AddParticleType(AliMevSimParticle *type) {
84 fMevSim->AddPartTypeParams((TMevSimPartTypeParams*)type);
86 //____________________________________________________________________________
87 void AliGenMevSim::Init()
90 // Generator initialisation method
93 // fill data from AliMevSimConfig;
95 TMevSim *mevsim = fMevSim;
97 // geometry & momentum cut
99 if (TestBit(kPtRange)) mevsim->SetPtCutRange(fPtMin, fPtMax);
101 if (TestBit(kPhiRange)) // from radians to 0 - 360 deg
102 mevsim->SetPhiCutRange( fPhiMin * 180 / TMath::Pi() , fPhiMax * 180 / TMath::Pi() );
104 if (TestBit(kThetaRange)) // from theta to eta
106 mevsim->SetEtaCutRange( -TMath::Log( TMath::Tan(fThetaMax/2)) , -TMath::Log( TMath::Tan(fThetaMin/2)) );
109 // mevsim specyfic parameters
111 mevsim->SetModelType(fConfig->fModelType);
112 mevsim->SetReacPlaneCntrl(fConfig->fReacPlaneCntrl);
113 mevsim->SetPsiRParams(fConfig->fPsiRMean, fConfig->fPsiRStDev);
114 mevsim->SetMultFacParams(fConfig->fMultFacMean, fConfig->fMultFacStDev);
116 // mevsim initialisation
118 mevsim->Initialize();
121 //____________________________________________________________________________
122 void AliGenMevSim::Generate()
125 // Read the formatted output file and load the particles
126 // Temporary solution
132 Float_t orgin[3] = {0,0,0};
133 Float_t polar[3] = {0,0,0};
134 Float_t p[3] = {1,1,1};
137 const Int_t parent = -1;
144 orgin[0] = fVertex[0];
145 orgin[1] = fVertex[1];
146 orgin[2] = fVertex[2];
150 cout << orgin[i] << "\t";
153 Int_t nParticles = 0;
155 TClonesArray *particles = new TClonesArray("TParticle");
158 fMevSim->GenerateEvent();
159 fNpart= fMevSim->ImportParticles(particles,"");
161 cout << "Found " << fNpart << " particles ..." << endl;
164 for (i=0; i<nParticles; i++) {
166 particle = (TParticle*) (*particles)[i];
168 pdg = (PDG_t) particle->GetPdgCode();
169 p[0] = particle->Px();
170 p[1] = particle->Py();
171 p[2] = particle->Pz();
173 SetTrack(fTrackIt, parent, pdg, p, orgin, polar, time, kPPrimary, id);
178 if (particles) delete particles;
180 //____________________________________________________________________________
181 //____________________________________________________________________________
186 # define type_of_call
189 # define type_of_call _stdcall
192 extern "C" Float_t type_of_call ran(Int_t &)
194 return sRandom->Rndm();
197 //____________________________________________________________________________