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