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