]>
Commit | Line | Data |
---|---|---|
4c039060 | 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$ | |
2685bf00 | 18 | Revision 1.42 2001/10/15 08:21:55 morsch |
19 | Vertex truncation settings moved to AliGenMC. | |
20 | ||
4c07486d | 21 | Revision 1.41 2001/10/08 08:45:42 morsch |
22 | Possibility of vertex cut added. | |
23 | ||
a0b2b296 | 24 | Revision 1.40 2001/09/25 11:30:23 morsch |
25 | Pass event vertex to header. | |
26 | ||
c5d36e84 | 27 | Revision 1.39 2001/07/27 17:09:36 morsch |
28 | Use local SetTrack, KeepTrack and SetHighWaterMark methods | |
29 | to delegate either to local stack or to stack owned by AliRun. | |
30 | (Piotr Skowronski, A.M.) | |
31 | ||
a99cf51f | 32 | Revision 1.38 2001/07/13 10:58:54 morsch |
33 | - Some coded moved to AliGenMC | |
34 | - Improved handling of secondary vertices. | |
35 | ||
fff02fee | 36 | Revision 1.37 2001/06/28 11:17:28 morsch |
37 | SetEventListRange setter added. Events in specified range are listed for | |
38 | debugging. (Yuri Kharlov) | |
39 | ||
11dfaf8d | 40 | Revision 1.36 2001/03/30 07:05:49 morsch |
41 | Final print-out in finish run. | |
42 | Write parton system for jet-production (preliminary solution). | |
43 | ||
9be6226f | 44 | Revision 1.35 2001/03/09 13:03:40 morsch |
45 | Process_t and Struc_Func_t moved to AliPythia.h | |
46 | ||
f1a48a38 | 47 | Revision 1.34 2001/02/14 15:50:40 hristov |
48 | The last particle in event marked using SetHighWaterMark | |
49 | ||
28adac24 | 50 | Revision 1.33 2001/01/30 09:23:12 hristov |
51 | Streamers removed (R.Brun) | |
52 | ||
a8a6107b | 53 | Revision 1.32 2001/01/26 19:55:51 hristov |
54 | Major upgrade of AliRoot code | |
55 | ||
2ab0c725 | 56 | Revision 1.31 2001/01/17 10:54:31 hristov |
57 | Better protection against FPE | |
58 | ||
0f9e52a3 | 59 | Revision 1.30 2000/12/18 08:55:35 morsch |
60 | Make AliPythia dependent generartors work with new scheme of random number generation | |
61 | ||
3356c022 | 62 | Revision 1.29 2000/12/04 11:22:03 morsch |
63 | Init of sRandom as in 1.15 | |
64 | ||
097ec7c1 | 65 | Revision 1.28 2000/12/02 11:41:39 morsch |
66 | Use SetRandom() to initialize random number generator in constructor. | |
67 | ||
1ed25e11 | 68 | Revision 1.27 2000/11/30 20:29:02 morsch |
69 | Initialise static variable sRandom in constructor: sRandom = fRandom; | |
70 | ||
ad1df918 | 71 | Revision 1.26 2000/11/30 07:12:50 alibrary |
72 | Introducing new Rndm and QA classes | |
73 | ||
65fb704d | 74 | Revision 1.25 2000/10/18 19:11:27 hristov |
75 | Division by zero fixed | |
76 | ||
919c2096 | 77 | Revision 1.24 2000/09/18 10:41:35 morsch |
78 | Add possibility to use nuclear structure functions from PDF library V8. | |
79 | ||
811826d8 | 80 | Revision 1.23 2000/09/14 14:05:40 morsch |
81 | dito | |
82 | ||
819f84ad | 83 | Revision 1.22 2000/09/14 14:02:22 morsch |
84 | - Correct conversion from mm to cm when passing particle vertex to MC. | |
85 | - Correct handling of fForceDecay == all. | |
86 | ||
4451ef92 | 87 | Revision 1.21 2000/09/12 14:14:55 morsch |
88 | Call fDecayer->ForceDecay() at the beginning of Generate(). | |
89 | ||
00d6ce7d | 90 | Revision 1.20 2000/09/06 14:29:33 morsch |
91 | Use AliPythia for event generation an AliDecayPythia for decays. | |
92 | Correct handling of "nodecay" option | |
93 | ||
18edb254 | 94 | Revision 1.19 2000/07/11 18:24:56 fca |
95 | Coding convention corrections + few minor bug fixes | |
96 | ||
aee8290b | 97 | Revision 1.18 2000/06/30 12:40:34 morsch |
98 | Pythia takes care of vertex smearing. Correct conversion from Pythia units (mm) to | |
99 | Geant units (cm). | |
100 | ||
1512e357 | 101 | Revision 1.17 2000/06/09 20:34:07 morsch |
102 | All coding rule violations except RS3 corrected | |
103 | ||
f87cfe57 | 104 | Revision 1.16 2000/05/15 15:04:20 morsch |
105 | The full event is written for fNtrack = -1 | |
106 | Coding rule violations corrected. | |
107 | ||
5ddeb374 | 108 | Revision 1.15 2000/04/26 10:14:24 morsch |
109 | Particles array has one entry more than pythia particle list. Upper bound of | |
110 | particle loop changed to np-1 (R. Guernane, AM) | |
111 | ||
2a0e6f5b | 112 | Revision 1.14 2000/04/05 08:36:13 morsch |
113 | Check status code of particles in Pythia event | |
114 | to avoid double counting as partonic state and final state particle. | |
115 | ||
23211d3e | 116 | Revision 1.13 1999/11/09 07:38:48 fca |
117 | Changes for compatibility with version 2.23 of ROOT | |
118 | ||
084c1b4a | 119 | Revision 1.12 1999/11/03 17:43:20 fca |
120 | New version from G.Martinez & A.Morsch | |
121 | ||
886b6f73 | 122 | Revision 1.11 1999/09/29 09:24:14 fca |
123 | Introduction of the Copyright and cvs Log | |
4c039060 | 124 | */ |
125 | ||
fe4da5cc | 126 | #include "AliGenPythia.h" |
fff02fee | 127 | #include "AliGenPythiaEventHeader.h" |
18edb254 | 128 | #include "AliDecayerPythia.h" |
fe4da5cc | 129 | #include "AliRun.h" |
130 | #include "AliPythia.h" | |
18edb254 | 131 | #include "AliPDG.h" |
1578254f | 132 | #include <TParticle.h> |
18edb254 | 133 | #include <TSystem.h> |
f87cfe57 | 134 | |
fe4da5cc | 135 | ClassImp(AliGenPythia) |
136 | ||
137 | AliGenPythia::AliGenPythia() | |
fff02fee | 138 | :AliGenMC() |
fe4da5cc | 139 | { |
18edb254 | 140 | // Default Constructor |
2685bf00 | 141 | fParticles = 0; |
142 | fPythia = 0; | |
18edb254 | 143 | fDecayer = new AliDecayerPythia(); |
11dfaf8d | 144 | SetEventListRange(); |
fe4da5cc | 145 | } |
146 | ||
147 | AliGenPythia::AliGenPythia(Int_t npart) | |
fff02fee | 148 | :AliGenMC(npart) |
fe4da5cc | 149 | { |
150 | // default charm production at 5. 5 TeV | |
151 | // semimuonic decay | |
152 | // structure function GRVHO | |
153 | // | |
154 | fXsection = 0.; | |
811826d8 | 155 | fNucA1=0; |
156 | fNucA2=0; | |
fe4da5cc | 157 | SetProcess(); |
158 | SetStrucFunc(); | |
886b6f73 | 159 | SetForceDecay(); |
fe4da5cc | 160 | SetPtHard(); |
161 | SetEnergyCMS(); | |
18edb254 | 162 | fDecayer = new AliDecayerPythia(); |
1ed25e11 | 163 | // Set random number generator |
097ec7c1 | 164 | sRandom=fRandom; |
11dfaf8d | 165 | SetEventListRange(); |
fff02fee | 166 | fFlavorSelect = 0; |
167 | // Produced particles | |
168 | fParticles = new TClonesArray("TParticle",1000); | |
c5d36e84 | 169 | fEventVertex.Set(3); |
fe4da5cc | 170 | } |
171 | ||
f87cfe57 | 172 | AliGenPythia::AliGenPythia(const AliGenPythia & Pythia) |
173 | { | |
174 | // copy constructor | |
175 | } | |
176 | ||
fe4da5cc | 177 | AliGenPythia::~AliGenPythia() |
178 | { | |
5ddeb374 | 179 | // Destructor |
fe4da5cc | 180 | } |
181 | ||
11dfaf8d | 182 | void AliGenPythia::SetEventListRange(Int_t eventFirst, Int_t eventLast) |
183 | { | |
184 | // Set a range of event numbers, for which a table | |
185 | // of generated particle will be printed | |
186 | fDebugEventFirst = eventFirst; | |
187 | fDebugEventLast = eventLast; | |
188 | if (fDebugEventLast==-1) fDebugEventLast=fDebugEventFirst; | |
189 | } | |
190 | ||
fe4da5cc | 191 | void AliGenPythia::Init() |
192 | { | |
5ddeb374 | 193 | // Initialisation |
18edb254 | 194 | SetMC(AliPythia::Instance()); |
fe4da5cc | 195 | fPythia=(AliPythia*) fgMCEvGen; |
196 | // | |
197 | fParentWeight=1./Float_t(fNpart); | |
198 | // | |
199 | // Forward Paramters to the AliPythia object | |
00d6ce7d | 200 | fDecayer->SetForceDecay(fForceDecay); |
18edb254 | 201 | fDecayer->Init(); |
00d6ce7d | 202 | |
18edb254 | 203 | |
fe4da5cc | 204 | fPythia->SetCKIN(3,fPtHardMin); |
205 | fPythia->SetCKIN(4,fPtHardMax); | |
811826d8 | 206 | if (fNucA1 > 0 && fNucA2 > 0) fPythia->SetNuclei(fNucA1, fNucA2); |
fe4da5cc | 207 | fPythia->ProcInit(fProcess,fEnergyCMS,fStrucFunc); |
18edb254 | 208 | |
209 | // fPythia->Pylist(0); | |
210 | // fPythia->Pystat(2); | |
fe4da5cc | 211 | // Parent and Children Selection |
212 | switch (fProcess) | |
213 | { | |
f1a48a38 | 214 | case kPyCharm: |
fff02fee | 215 | fParentSelect[0] = 411; |
216 | fParentSelect[1] = 421; | |
217 | fParentSelect[2] = 431; | |
218 | fParentSelect[3] = 4122; | |
219 | fFlavorSelect = 4; | |
fe4da5cc | 220 | break; |
f1a48a38 | 221 | case kPyCharmUnforced: |
fff02fee | 222 | fParentSelect[0] = 411; |
223 | fParentSelect[1] = 421; | |
224 | fParentSelect[2] = 431; | |
225 | fParentSelect[3]= 4122; | |
226 | fFlavorSelect = 4; | |
fe4da5cc | 227 | break; |
f1a48a38 | 228 | case kPyBeauty: |
fff02fee | 229 | fParentSelect[0]= 511; |
230 | fParentSelect[1]= 521; | |
231 | fParentSelect[2]= 531; | |
232 | fParentSelect[3]= 5122; | |
233 | fParentSelect[4]= 5132; | |
234 | fParentSelect[5]= 5232; | |
235 | fParentSelect[6]= 5332; | |
236 | fFlavorSelect = 5; | |
fe4da5cc | 237 | break; |
f1a48a38 | 238 | case kPyBeautyUnforced: |
fff02fee | 239 | fParentSelect[0] = 511; |
240 | fParentSelect[1] = 521; | |
241 | fParentSelect[2] = 531; | |
242 | fParentSelect[3] = 5122; | |
243 | fParentSelect[4] = 5132; | |
244 | fParentSelect[5] = 5232; | |
245 | fParentSelect[6] = 5332; | |
246 | fFlavorSelect = 5; | |
fe4da5cc | 247 | break; |
f1a48a38 | 248 | case kPyJpsiChi: |
249 | case kPyJpsi: | |
fff02fee | 250 | fParentSelect[0] = 443; |
fe4da5cc | 251 | break; |
f1a48a38 | 252 | case kPyMb: |
253 | case kPyJets: | |
254 | case kPyDirectGamma: | |
5be1fe76 | 255 | break; |
fe4da5cc | 256 | } |
fff02fee | 257 | AliGenMC::Init(); |
fe4da5cc | 258 | } |
259 | ||
260 | void AliGenPythia::Generate() | |
261 | { | |
5ddeb374 | 262 | // Generate one event |
00d6ce7d | 263 | fDecayer->ForceDecay(); |
a0b2b296 | 264 | |
9be6226f | 265 | Float_t polar[3] = {0,0,0}; |
266 | Float_t origin[3] = {0,0,0}; | |
fff02fee | 267 | Float_t p[3]; |
5be1fe76 | 268 | // converts from mm/c to s |
269 | const Float_t kconv=0.001/2.999792458e8; | |
fe4da5cc | 270 | // |
fe4da5cc | 271 | Int_t nt=0; |
272 | Int_t jev=0; | |
7921755b | 273 | Int_t j, kf; |
fe4da5cc | 274 | fTrials=0; |
fff02fee | 275 | |
276 | // Set collision vertex position | |
aee8290b | 277 | if(fVertexSmear==kPerEvent) { |
1512e357 | 278 | fPythia->SetMSTP(151,1); |
fe4da5cc | 279 | for (j=0;j<3;j++) { |
fff02fee | 280 | fPythia->SetPARP(151+j, fOsigma[j]*10.); |
fe4da5cc | 281 | } |
aee8290b | 282 | } else if (fVertexSmear==kPerTrack) { |
fe4da5cc | 283 | fPythia->SetMSTP(151,0); |
fe4da5cc | 284 | } |
fff02fee | 285 | // event loop |
fe4da5cc | 286 | while(1) |
287 | { | |
084c1b4a | 288 | fPythia->Pyevnt(); |
11dfaf8d | 289 | if (gAlice->GetEvNumber()>=fDebugEventFirst && |
290 | gAlice->GetEvNumber()<=fDebugEventLast) fPythia->Pylist(1); | |
fe4da5cc | 291 | fTrials++; |
fff02fee | 292 | fPythia->ImportParticles(fParticles,"All"); |
293 | ||
294 | // | |
295 | // | |
296 | // | |
297 | Int_t i; | |
298 | ||
299 | Int_t np = fParticles->GetEntriesFast(); | |
a0b2b296 | 300 | if (np == 0 ) continue; |
301 | // Get event vertex and discard the event if the Z coord. is too big | |
4c07486d | 302 | TParticle *iparticle = (TParticle *) fParticles->At(0); |
303 | Float_t distz = iparticle->Vz()/10.; | |
304 | if(TMath::Abs(distz)>fCutVertexZ*fOsigma[2]) continue; | |
a0b2b296 | 305 | // |
4c07486d | 306 | fEventVertex[0] = iparticle->Vx()/10.+fOrigin.At(0); |
307 | fEventVertex[1] = iparticle->Vy()/10.+fOrigin.At(1); | |
308 | fEventVertex[2] = iparticle->Vz()/10.+fOrigin.At(2); | |
a0b2b296 | 309 | // |
fff02fee | 310 | Int_t* pParent = new Int_t[np]; |
311 | Int_t* pSelected = new Int_t[np]; | |
312 | Int_t* trackIt = new Int_t[np]; | |
313 | for (i=0; i< np-1; i++) { | |
314 | pParent[i] = -1; | |
315 | pSelected[i] = 0; | |
316 | } | |
fe4da5cc | 317 | printf("\n **************************************************%d\n",np); |
fff02fee | 318 | Int_t nc = 0; |
f1a48a38 | 319 | if (fProcess != kPyMb && fProcess != kPyJets && fProcess != kPyDirectGamma) { |
fff02fee | 320 | for (i = 0; i<np-1; i++) { |
c5d36e84 | 321 | iparticle = (TParticle *) fParticles->At(i); |
23211d3e | 322 | Int_t ks = iparticle->GetStatusCode(); |
a8228d85 | 323 | kf = CheckPDGCode(iparticle->GetPdgCode()); |
fff02fee | 324 | // No initial state partons |
2a0e6f5b | 325 | if (ks==21) continue; |
fe4da5cc | 326 | // |
fff02fee | 327 | // Heavy Flavor Selection |
5be1fe76 | 328 | // |
fff02fee | 329 | // quark ? |
330 | kf = TMath::Abs(kf); | |
331 | Int_t kfl = kf; | |
332 | // meson ? | |
333 | if (kfl > 10) kfl/=100; | |
334 | // baryon | |
335 | if (kfl > 10) kfl/=10; | |
336 | if (kfl > 10) kfl/=10; | |
337 | ||
338 | Int_t ipa = iparticle->GetFirstMother()-1; | |
339 | Int_t kfMo = 0; | |
340 | ||
341 | if (ipa > -1) { | |
342 | TParticle * mother = (TParticle *) fParticles->At(ipa); | |
343 | kfMo = TMath::Abs(mother->GetPdgCode()); | |
344 | } | |
345 | // printf("\n particle (all) %d %d %d", i, pSelected[i], kf); | |
346 | if (kfl >= fFlavorSelect) { | |
5be1fe76 | 347 | // |
fff02fee | 348 | // Heavy flavor hadron or quark |
fe4da5cc | 349 | // |
fff02fee | 350 | // Kinematic seletion on final state heavy flavor mesons |
351 | if (ParentSelected(kf) && !KinematicSelection(iparticle, 0)) | |
352 | { | |
353 | nc = -1; | |
354 | break; | |
355 | } | |
356 | pSelected[i] = 1; | |
357 | // printf("\n particle (HF) %d %d %d", i, pSelected[i], kf); | |
358 | } else { | |
359 | // Kinematic seletion on decay products | |
360 | if (fCutOnChild && ParentSelected(kfMo) && ChildSelected(kf) | |
361 | && !KinematicSelection(iparticle, 1)) | |
362 | { | |
363 | nc = -1; | |
364 | break; | |
365 | } | |
fe4da5cc | 366 | // |
fff02fee | 367 | // Decay products |
368 | // Select if mother was selected and is not tracked | |
369 | ||
370 | if (pSelected[ipa] && | |
371 | !trackIt[ipa] && // mother will be tracked ? | |
372 | kfMo != 5 && // mother is b-quark, don't store fragments | |
373 | kfMo != 4 && // mother is c-quark, don't store fragments | |
374 | kf != 92) // don't store string | |
375 | { | |
fe4da5cc | 376 | // |
fff02fee | 377 | // Semi-stable or de-selected: diselect decay products: |
fe4da5cc | 378 | // |
5be1fe76 | 379 | // |
fff02fee | 380 | if (pSelected[i] == -1 || fDecayer->GetLifetime(kf) > 10e-15) |
381 | { | |
382 | Int_t ipF = iparticle->GetFirstDaughter(); | |
383 | Int_t ipL = iparticle->GetLastDaughter(); | |
384 | if (ipF > 0) for (j = ipF-1; j < ipL; j++) pSelected[j] = -1; | |
385 | } | |
386 | // printf("\n particle (decay) %d %d %d", i, pSelected[i], kf); | |
387 | pSelected[i] = (pSelected[i] == -1) ? 0 : 1; | |
388 | } | |
389 | } | |
390 | if (pSelected[i] == -1) pSelected[i] = 0; | |
391 | if (!pSelected[i]) continue; | |
392 | nc++; | |
393 | // Decision on tracking | |
394 | trackIt[i] = 0; | |
395 | // | |
396 | // Track final state particle | |
397 | if (ks == 1) trackIt[i] = 1; | |
398 | // Track semi-stable particles | |
399 | if ((ks ==1) || (fDecayer->GetLifetime(kf)> 10e-15)) trackIt[i] = 1; | |
400 | // Track particles selected by process if undecayed. | |
401 | if (fForceDecay == kNoDecay) { | |
402 | if (ParentSelected(kf)) trackIt[i] = 1; | |
403 | } else { | |
404 | if (ParentSelected(kf)) trackIt[i] = 0; | |
405 | } | |
406 | // | |
407 | // | |
408 | ||
409 | } // particle selection loop | |
410 | if (nc > -1) { | |
411 | for (i = 0; i<np-1; i++) { | |
412 | if (!pSelected[i]) continue; | |
413 | TParticle * iparticle = (TParticle *) fParticles->At(i); | |
414 | kf = CheckPDGCode(iparticle->GetPdgCode()); | |
a0b2b296 | 415 | p[0] = iparticle->Px(); |
416 | p[1] = iparticle->Py(); | |
417 | p[2] = iparticle->Pz(); | |
418 | origin[0] = fOrigin[0]+iparticle->Vx()/10.; | |
419 | origin[1] = fOrigin[1]+iparticle->Vy()/10.; | |
420 | origin[2] = fOrigin[2]+iparticle->Vz()/10.; | |
421 | Float_t tof = kconv*iparticle->T(); | |
422 | Int_t ipa = iparticle->GetFirstMother()-1; | |
fff02fee | 423 | Int_t iparent = (ipa > -1) ? pParent[ipa] : -1; |
a99cf51f | 424 | SetTrack(fTrackIt*trackIt[i] , |
fff02fee | 425 | iparent, kf, p, origin, polar, tof, kPPrimary, nt, 1.); |
426 | pParent[i] = nt; | |
a99cf51f | 427 | KeepTrack(nt); |
fff02fee | 428 | } // SetTrack loop |
429 | } | |
430 | } else { | |
431 | nc = GenerateMB(); | |
5be1fe76 | 432 | } // mb ? |
fff02fee | 433 | |
fe4da5cc | 434 | if (nc > 0) { |
5be1fe76 | 435 | jev+=nc; |
5ddeb374 | 436 | if (jev >= fNpart || fNpart == -1) { |
fe4da5cc | 437 | fKineBias=Float_t(fNpart)/Float_t(fTrials); |
23211d3e | 438 | printf("\n Trials: %i %i %i\n",fTrials, fNpart, jev); |
fe4da5cc | 439 | break; |
440 | } | |
441 | } | |
442 | } // event loop | |
a99cf51f | 443 | SetHighWaterMark(nt); |
fe4da5cc | 444 | // adjust weight due to kinematic selection |
445 | AdjustWeights(); | |
446 | // get cross-section | |
447 | fXsection=fPythia->GetPARI(1); | |
448 | } | |
449 | ||
fff02fee | 450 | Int_t AliGenPythia::GenerateMB() |
fe4da5cc | 451 | { |
fff02fee | 452 | Int_t i, kf, nt, iparent; |
453 | Int_t nc = 0; | |
454 | Float_t p[3]; | |
455 | Float_t polar[3] = {0,0,0}; | |
456 | Float_t origin[3] = {0,0,0}; | |
fff02fee | 457 | // converts from mm/c to s |
458 | const Float_t kconv=0.001/2.999792458e8; | |
4451ef92 | 459 | |
fff02fee | 460 | Int_t np = fParticles->GetEntriesFast(); |
461 | Int_t* pParent = new Int_t[np]; | |
462 | for (i=0; i< np-1; i++) pParent[i] = -1; | |
463 | ||
464 | for (i = 0; i<np-1; i++) { | |
465 | Int_t trackIt = 0; | |
466 | TParticle * iparticle = (TParticle *) fParticles->At(i); | |
467 | kf = CheckPDGCode(iparticle->GetPdgCode()); | |
468 | Int_t ks = iparticle->GetStatusCode(); | |
469 | Int_t km = iparticle->GetFirstMother(); | |
470 | // printf("\n Particle: %d %d %d", i, kf, ks); | |
471 | ||
472 | if ((ks == 1 && kf!=0 && KinematicSelection(iparticle, 0)) || | |
473 | (ks != 1) || | |
474 | (fProcess == kPyJets && ks == 21 && km == 0 && i>1)) { | |
475 | nc++; | |
476 | if (ks == 1) trackIt = 1; | |
477 | Int_t ipa = iparticle->GetFirstMother()-1; | |
fe4da5cc | 478 | |
fff02fee | 479 | iparent = (ipa > -1) ? pParent[ipa] : -1; |
fe4da5cc | 480 | |
481 | // | |
fff02fee | 482 | // store track information |
a0b2b296 | 483 | p[0] = iparticle->Px(); |
484 | p[1] = iparticle->Py(); | |
485 | p[2] = iparticle->Pz(); | |
486 | origin[0] = fOrigin[0]+iparticle->Vx()/10.; | |
487 | origin[1] = fOrigin[1]+iparticle->Vy()/10.; | |
488 | origin[2] = fOrigin[2]+iparticle->Vz()/10.; | |
fff02fee | 489 | Float_t tof=kconv*iparticle->T(); |
a99cf51f | 490 | SetTrack(fTrackIt*trackIt, iparent, kf, p, origin, polar, |
a0b2b296 | 491 | tof, kPPrimary, nt); |
a99cf51f | 492 | KeepTrack(nt); |
fff02fee | 493 | pParent[i] = nt; |
494 | } // select particle | |
495 | } // particle loop | |
496 | ||
497 | if (pParent) delete[] pParent; | |
fe4da5cc | 498 | |
fff02fee | 499 | printf("\n I've put %i particles on the stack \n",nc); |
500 | MakeHeader(); | |
501 | return nc; | |
502 | } | |
fe4da5cc | 503 | |
fe4da5cc | 504 | |
fff02fee | 505 | void AliGenPythia::FinishRun() |
506 | { | |
507 | // Print x-section summary | |
508 | fPythia->Pystat(1); | |
fe4da5cc | 509 | } |
fff02fee | 510 | |
fe4da5cc | 511 | void AliGenPythia::AdjustWeights() |
512 | { | |
5ddeb374 | 513 | // Adjust the weights after generation of all events |
514 | // | |
5ddeb374 | 515 | TParticle *part; |
fe4da5cc | 516 | Int_t ntrack=gAlice->GetNtrack(); |
517 | for (Int_t i=0; i<ntrack; i++) { | |
2ab0c725 | 518 | part= gAlice->Particle(i); |
5ddeb374 | 519 | part->SetWeight(part->GetWeight()*fKineBias); |
fe4da5cc | 520 | } |
521 | } | |
811826d8 | 522 | |
523 | void AliGenPythia::SetNuclei(Int_t a1, Int_t a2) | |
524 | { | |
525 | // Treat protons as inside nuclei with mass numbers a1 and a2 | |
526 | fNucA1 = a1; | |
527 | fNucA2 = a2; | |
528 | } | |
fff02fee | 529 | |
530 | ||
531 | void AliGenPythia::MakeHeader() | |
532 | { | |
533 | // Builds the event header, to be called after each event | |
534 | AliGenEventHeader* header = new AliGenPythiaEventHeader("Pythia"); | |
c5d36e84 | 535 | ((AliGenPythiaEventHeader*) header)->SetProcessType(fPythia->GetMSTI(1)); |
536 | header->SetPrimaryVertex(fEventVertex); | |
537 | gAlice->SetGenEventHeader(header); | |
fff02fee | 538 | } |
811826d8 | 539 | |
540 | ||
f87cfe57 | 541 | AliGenPythia& AliGenPythia::operator=(const AliGenPythia& rhs) |
542 | { | |
543 | // Assignment operator | |
544 | return *this; | |
545 | } | |
fe4da5cc | 546 | |
547 | ||
811826d8 | 548 | |
a8a6107b | 549 | #ifdef never |
18edb254 | 550 | void AliGenPythia::Streamer(TBuffer &R__b) |
551 | { | |
552 | // Stream an object of class AliGenPythia. | |
553 | ||
554 | if (R__b.IsReading()) { | |
555 | Version_t R__v = R__b.ReadVersion(); if (R__v) { } | |
556 | AliGenerator::Streamer(R__b); | |
557 | R__b >> (Int_t&)fProcess; | |
558 | R__b >> (Int_t&)fStrucFunc; | |
559 | R__b >> (Int_t&)fForceDecay; | |
560 | R__b >> fEnergyCMS; | |
561 | R__b >> fKineBias; | |
562 | R__b >> fTrials; | |
563 | fParentSelect.Streamer(R__b); | |
564 | fChildSelect.Streamer(R__b); | |
565 | R__b >> fXsection; | |
566 | // (AliPythia::Instance())->Streamer(R__b); | |
567 | R__b >> fPtHardMin; | |
568 | R__b >> fPtHardMax; | |
569 | // if (fDecayer) fDecayer->Streamer(R__b); | |
570 | } else { | |
571 | R__b.WriteVersion(AliGenPythia::IsA()); | |
572 | AliGenerator::Streamer(R__b); | |
573 | R__b << (Int_t)fProcess; | |
574 | R__b << (Int_t)fStrucFunc; | |
575 | R__b << (Int_t)fForceDecay; | |
576 | R__b << fEnergyCMS; | |
577 | R__b << fKineBias; | |
578 | R__b << fTrials; | |
579 | fParentSelect.Streamer(R__b); | |
580 | fChildSelect.Streamer(R__b); | |
581 | R__b << fXsection; | |
582 | // R__b << fPythia; | |
583 | R__b << fPtHardMin; | |
584 | R__b << fPtHardMax; | |
585 | // fDecayer->Streamer(R__b); | |
586 | } | |
587 | } | |
a8a6107b | 588 | #endif |
18edb254 | 589 |