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