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