]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PYTHIA6/AliPythia6.cxx
To create back-to-back partons we need to call the function pyjoin from Pythia.
[u/mrichter/AliRoot.git] / PYTHIA6 / AliPythia6.cxx
CommitLineData
39d810c8 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/* $Id: AliPythia.cxx,v 1.40 2007/10/09 08:43:24 morsch Exp $ */
17
18#include "AliPythia6.h"
19#include "AliStack.h"
20#include "AliPythiaRndm.h"
21#include "AliFastGlauber.h"
22#include "AliQuenchingWeights.h"
23
24#include "TVector3.h"
25#include "TParticle.h"
26#include "PyquenCommon.h"
27
28ClassImp(AliPythia6)
29
30#ifndef WIN32
31# define pyclus pyclus_
32# define pycell pycell_
33# define pyshow pyshow_
34# define pyrobo pyrobo_
35# define pyquen pyquen_
36# define pyevnw pyevnw_
8b9bb87a 37# define pyjoin pyjoin_
39d810c8 38# define type_of_call
39#else
40# define pyclus PYCLUS
41# define pycell PYCELL
42# define pyrobo PYROBO
43# define pyquen PYQUEN
44# define pyevnw PYEVNW
8b9bb87a 45# define pyjoin PYJOIN
39d810c8 46# define type_of_call _stdcall
47#endif
48
8b9bb87a 49extern "C" void type_of_call pyjoin(Int_t &, Int_t * );
39d810c8 50extern "C" void type_of_call pyclus(Int_t & );
51extern "C" void type_of_call pycell(Int_t & );
52extern "C" void type_of_call pyshow(Int_t &, Int_t &, Double_t &);
53extern "C" void type_of_call pyrobo(Int_t &, Int_t &, Double_t &, Double_t &, Double_t &, Double_t &, Double_t &);
54extern "C" void type_of_call pyquen(Double_t &, Int_t &, Double_t &);
55extern "C" void type_of_call pyevnw();
56
57
58//_____________________________________________________________________________
59
60AliPythia6* AliPythia6::fgAliPythia=NULL;
61
62AliPythia6::AliPythia6():
63 TPythia6(),
64 AliPythiaBase(),
65 fProcess(kPyMb),
66 fEcms(0.),
67 fStrucFunc(kCTEQ5L),
68 fXJet(0.),
69 fYJet(0.),
70 fNGmax(30),
71 fZmax(0.97),
72 fGlauber(0),
73 fQuenchingWeights(0)
74{
75// Default Constructor
76//
77// Set random number
a23e397a 78 Int_t i;
79 for (i = 0; i < 501; i++) fDefMDCY[i] = 0;
80 for (i = 0; i < 2001; i++) fDefMDME[i] = 0;
81 for (i = 0; i < 4; i++) fZQuench[i] = 0;
82
39d810c8 83 if (!AliPythiaRndm::GetPythiaRandom())
84 AliPythiaRndm::SetPythiaRandom(GetRandom());
85 fGlauber = 0;
86 fQuenchingWeights = 0;
87}
88
89AliPythia6::AliPythia6(const AliPythia6& pythia):
90 TPythia6(),
91 AliPythiaBase(),
92 fProcess(kPyMb),
93 fEcms(0.),
94 fStrucFunc(kCTEQ5L),
95 fXJet(0.),
96 fYJet(0.),
97 fNGmax(30),
98 fZmax(0.97),
99 fGlauber(0),
100 fQuenchingWeights(0)
101{
102 // Copy Constructor
a23e397a 103 Int_t i;
104 for (i = 0; i < 501; i++) fDefMDCY[i] = 0;
105 for (i = 0; i < 2001; i++) fDefMDME[i] = 0;
106 for (i = 0; i < 4; i++) fZQuench[i] = 0;
39d810c8 107 pythia.Copy(*this);
108}
109
110void AliPythia6::ProcInit(Process_t process, Float_t energy, StrucFunc_t strucfunc)
111{
112// Initialise the process to generate
113 if (!AliPythiaRndm::GetPythiaRandom())
114 AliPythiaRndm::SetPythiaRandom(GetRandom());
115
116 fProcess = process;
117 fEcms = energy;
118 fStrucFunc = strucfunc;
119//...Switch off decay of pi0, K0S, Lambda, Sigma+-, Xi0-, Omega-.
120 SetMDCY(Pycomp(111) ,1,0);
121 SetMDCY(Pycomp(310) ,1,0);
122 SetMDCY(Pycomp(3122),1,0);
123 SetMDCY(Pycomp(3112),1,0);
124 SetMDCY(Pycomp(3212),1,0);
125 SetMDCY(Pycomp(3222),1,0);
126 SetMDCY(Pycomp(3312),1,0);
127 SetMDCY(Pycomp(3322),1,0);
128 SetMDCY(Pycomp(3334),1,0);
129 // Select structure function
130 SetMSTP(52,2);
131 SetMSTP(51,AliStructFuncType::PDFsetIndex(strucfunc));
132 // Particles produced in string fragmentation point directly to either of the two endpoints
133 // of the string (depending in the side they were generated from).
134 SetMSTU(16,2);
135
136//
137// Pythia initialisation for selected processes//
138//
139// Make MSEL clean
140//
141 for (Int_t i=1; i<= 200; i++) {
142 SetMSUB(i,0);
143 }
144// select charm production
145 switch (process)
146 {
147 case kPyOldUEQ2ordered: //Old underlying events with Q2 ordered QCD processes
148// Multiple interactions on.
149 SetMSTP(81,1);
150// Double Gaussian matter distribution.
151 SetMSTP(82,4);
152 SetPARP(83,0.5);
153 SetPARP(84,0.4);
154// pT0.
155 SetPARP(82,2.0);
156// Reference energy for pT0 and energy rescaling pace.
157 SetPARP(89,1800);
158 SetPARP(90,0.25);
159// String drawing almost completely minimizes string length.
160 SetPARP(85,0.9);
161 SetPARP(86,0.95);
162// ISR and FSR activity.
163 SetPARP(67,4);
164 SetPARP(71,4);
165// Lambda_FSR scale.
166 SetPARJ(81,0.29);
167 break;
168 case kPyOldUEQ2ordered2:
169// Old underlying events with Q2 ordered QCD processes
170// Multiple interactions on.
171 SetMSTP(81,1);
172// Double Gaussian matter distribution.
173 SetMSTP(82,4);
174 SetPARP(83,0.5);
175 SetPARP(84,0.4);
176// pT0.
177 SetPARP(82,2.0);
178// Reference energy for pT0 and energy rescaling pace.
179 SetPARP(89,1800);
180 SetPARP(90,0.16); // here is the difference with kPyOldUEQ2ordered
181// String drawing almost completely minimizes string length.
182 SetPARP(85,0.9);
183 SetPARP(86,0.95);
184// ISR and FSR activity.
185 SetPARP(67,4);
186 SetPARP(71,4);
187// Lambda_FSR scale.
188 SetPARJ(81,0.29);
189 break;
190 case kPyOldPopcorn:
191// Old production mechanism: Old Popcorn
192 SetMSEL(1);
193 SetMSTJ(12,3);
194// (D=2) Like MSTJ(12)=2 but added prod ofthe 1er rank baryon
195 SetMSTP(88,2);
196// (D=1)see can be used to form baryons (BARYON JUNCTION)
197 SetMSTJ(1,1);
198 AtlasTuning();
199 break;
200 case kPyCharm:
201 SetMSEL(4);
202// heavy quark masses
203
204 SetPMAS(4,1,1.2);
205//
206// primordial pT
207 SetMSTP(91,1);
208 SetPARP(91,1.);
209 SetPARP(93,5.);
210//
211 break;
212 case kPyBeauty:
213 SetMSEL(5);
214 SetPMAS(5,1,4.75);
215 break;
216 case kPyJpsi:
217 SetMSEL(0);
218// gg->J/Psi g
219 SetMSUB(86,1);
220 break;
221 case kPyJpsiChi:
222 SetMSEL(0);
223// gg->J/Psi g
224 SetMSUB(86,1);
225// gg-> chi_0c g
226 SetMSUB(87,1);
227// gg-> chi_1c g
228 SetMSUB(88,1);
229// gg-> chi_2c g
230 SetMSUB(89,1);
231 break;
232 case kPyCharmUnforced:
233 SetMSEL(0);
234// gq->qg
235 SetMSUB(28,1);
236// gg->qq
237 SetMSUB(53,1);
238// gg->gg
239 SetMSUB(68,1);
240 break;
241 case kPyBeautyUnforced:
242 SetMSEL(0);
243// gq->qg
244 SetMSUB(28,1);
245// gg->qq
246 SetMSUB(53,1);
247// gg->gg
248 SetMSUB(68,1);
249 break;
250 case kPyMb:
251// Minimum Bias pp-Collisions
252//
253//
254// select Pythia min. bias model
255 SetMSEL(0);
256 SetMSUB(92,1); // single diffraction AB-->XB
257 SetMSUB(93,1); // single diffraction AB-->AX
258 SetMSUB(94,1); // double diffraction
259 SetMSUB(95,1); // low pt production
260
261 AtlasTuning();
262 break;
67b7bb0e 263 case kPyMbAtlasTuneMC09:
264// Minimum Bias pp-Collisions
265//
266//
267// select Pythia min. bias model
268 SetMSEL(0);
269 SetMSUB(92,1); // single diffraction AB-->XB
270 SetMSUB(93,1); // single diffraction AB-->AX
271 SetMSUB(94,1); // double diffraction
272 SetMSUB(95,1); // low pt production
273
274 AtlasTuning_MC09();
275 break;
04081a91 276
277 case kPyMbWithDirectPhoton:
278// Minimum Bias pp-Collisions with direct photon processes added
279//
280//
281// select Pythia min. bias model
282 SetMSEL(0);
283 SetMSUB(92,1); // single diffraction AB-->XB
284 SetMSUB(93,1); // single diffraction AB-->AX
285 SetMSUB(94,1); // double diffraction
286 SetMSUB(95,1); // low pt production
287
288 SetMSUB(14,1); //
289 SetMSUB(18,1); //
290 SetMSUB(29,1); //
291 SetMSUB(114,1); //
292 SetMSUB(115,1); //
293
294
295 AtlasTuning();
296 break;
297
39d810c8 298 case kPyMbDefault:
299// Minimum Bias pp-Collisions
300//
301//
302// select Pythia min. bias model
303 SetMSEL(0);
304 SetMSUB(92,1); // single diffraction AB-->XB
305 SetMSUB(93,1); // single diffraction AB-->AX
306 SetMSUB(94,1); // double diffraction
307 SetMSUB(95,1); // low pt production
308
309 break;
310 case kPyLhwgMb:
311// Les Houches Working Group 05 Minimum Bias pp-Collisions: hep-ph/0604120
312// -> Pythia 6.3 or above is needed
313//
314 SetMSEL(0);
315 SetMSUB(92,1); // single diffraction AB-->XB
316 SetMSUB(93,1); // single diffraction AB-->AX
317 SetMSUB(94,1); // double diffraction
318 SetMSUB(95,1); // low pt production
319 SetMSTP(51,AliStructFuncType::PDFsetIndex(kCTEQ6ll));
320 SetMSTP(52,2);
321 SetMSTP(68,1);
322 SetMSTP(70,2);
323 SetMSTP(81,1); // Multiple Interactions ON
324 SetMSTP(82,4); // Double Gaussian Model
325 SetMSTP(88,1);
326
327 SetPARP(82,2.3); // [GeV] PT_min at Ref. energy
328 SetPARP(83,0.5); // Core density in proton matter distribution (def.value)
329 SetPARP(84,0.5); // Core radius
330 SetPARP(85,0.9); // Regulates gluon prod. mechanism
331 SetPARP(90,0.2); // 2*epsilon (exponent in power law)
332
333 break;
334 case kPyMbNonDiffr:
335// Minimum Bias pp-Collisions
336//
337//
338// select Pythia min. bias model
339 SetMSEL(0);
340 SetMSUB(95,1); // low pt production
341
342 AtlasTuning();
343 break;
344 case kPyMbMSEL1:
345 ConfigHeavyFlavor();
346// Intrinsic <kT^2>
347 SetMSTP(91,1);// Width (1=gaussian) primordial kT dist. inside hadrons
348 SetPARP(91,1.); // <kT^2> = PARP(91,1.)^2
349 SetPARP(93,5.); // Upper cut-off
350// Set Q-quark mass
351 SetPMAS(4,1,1.2); // Charm quark mass
352 SetPMAS(5,1,4.78); // Beauty quark mass
353 SetPARP(71,4.); // Defaut value
354// Atlas Tuning
355 AtlasTuning();
356 break;
357 case kPyJets:
358//
359// QCD Jets
360//
361 SetMSEL(1);
362 // Pythia Tune A (CDF)
363 //
364 SetPARP(67,2.5); // Regulates Initial State Radiation (value from best fit to D0 dijet analysis)
365 SetMSTP(82,4); // Double Gaussian Model
366 SetPARP(82,2.0); // [GeV] PT_min at Ref. energy
367 SetPARP(84,0.4); // Core radius
368 SetPARP(85,0.90) ; // Regulates gluon prod. mechanism
369 SetPARP(86,0.95); // Regulates gluon prod. mechanism
370 SetPARP(89,1800.); // [GeV] Ref. energy
371 SetPARP(90,0.25); // 2*epsilon (exponent in power law)
372 break;
373 case kPyDirectGamma:
374 SetMSEL(10);
375 break;
376 case kPyCharmPbPbMNR:
377 case kPyD0PbPbMNR:
378 case kPyDPlusPbPbMNR:
379 case kPyDPlusStrangePbPbMNR:
380 // Tuning of Pythia parameters aimed to get a resonable agreement
381 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
382 // c-cbar single inclusive and double differential distributions.
383 // This parameter settings are meant to work with Pb-Pb collisions
384 // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
385 // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
386 // has to be set to 2.1GeV. Example in ConfigCharmPPR.C.
387 ConfigHeavyFlavor();
388 // Intrinsic <kT>
389 SetMSTP(91,1);
390 SetPARP(91,1.304);
391 SetPARP(93,6.52);
392 // Set c-quark mass
393 SetPMAS(4,1,1.2);
394 break;
395 case kPyCharmpPbMNR:
396 case kPyD0pPbMNR:
397 case kPyDPluspPbMNR:
398 case kPyDPlusStrangepPbMNR:
399 // Tuning of Pythia parameters aimed to get a resonable agreement
400 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
401 // c-cbar single inclusive and double differential distributions.
402 // This parameter settings are meant to work with p-Pb collisions
403 // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
404 // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
405 // has to be set to 2.1GeV. Example in ConfigCharmPPR.C.
406 ConfigHeavyFlavor();
407 // Intrinsic <kT>
408 SetMSTP(91,1);
409 SetPARP(91,1.16);
410 SetPARP(93,5.8);
411
412 // Set c-quark mass
413 SetPMAS(4,1,1.2);
414 break;
415 case kPyCharmppMNR:
416 case kPyD0ppMNR:
417 case kPyDPlusppMNR:
418 case kPyDPlusStrangeppMNR:
68504d42 419 case kPyLambdacppMNR:
39d810c8 420 // Tuning of Pythia parameters aimed to get a resonable agreement
421 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
422 // c-cbar single inclusive and double differential distributions.
423 // This parameter settings are meant to work with pp collisions
424 // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
425 // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
426 // has to be set to 2.1GeV. Example in ConfigCharmPPR.C.
427 ConfigHeavyFlavor();
428 // Intrinsic <kT^2>
429 SetMSTP(91,1);
430 SetPARP(91,1.);
431 SetPARP(93,5.);
432
433 // Set c-quark mass
434 SetPMAS(4,1,1.2);
435 break;
436 case kPyCharmppMNRwmi:
437 // Tuning of Pythia parameters aimed to get a resonable agreement
438 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
439 // c-cbar single inclusive and double differential distributions.
440 // This parameter settings are meant to work with pp collisions
441 // and with kCTEQ5L PDFs.
442 // Added multiple interactions according to ATLAS tune settings.
443 // To get a "reasonable" agreement with MNR results, events have to be
444 // generated with the minimum ptHard (AliGenPythia::SetPtHard)
445 // set to 2.76 GeV.
446 // To get a "perfect" agreement with MNR results, events have to be
447 // generated in four ptHard bins with the following relative
448 // normalizations:
449 // 2.76-3 GeV: 25%
450 // 3-4 GeV: 40%
451 // 4-8 GeV: 29%
452 // >8 GeV: 6%
453 ConfigHeavyFlavor();
454 // Intrinsic <kT^2>
455 SetMSTP(91,1);
456 SetPARP(91,1.);
457 SetPARP(93,5.);
458
459 // Set c-quark mass
460 SetPMAS(4,1,1.2);
461 AtlasTuning();
462 break;
463 case kPyBeautyPbPbMNR:
464 // Tuning of Pythia parameters aimed to get a resonable agreement
465 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
466 // b-bbar single inclusive and double differential distributions.
467 // This parameter settings are meant to work with Pb-Pb collisions
468 // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
469 // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
470 // has to be set to 2.75GeV. Example in ConfigBeautyPPR.C.
471 ConfigHeavyFlavor();
472 // QCD scales
473 SetPARP(67,1.0);
474 SetPARP(71,1.0);
475 // Intrinsic <kT>
476 SetMSTP(91,1);
477 SetPARP(91,2.035);
478 SetPARP(93,10.17);
479 // Set b-quark mass
480 SetPMAS(5,1,4.75);
481 break;
482 case kPyBeautypPbMNR:
483 // Tuning of Pythia parameters aimed to get a resonable agreement
484 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
485 // b-bbar single inclusive and double differential distributions.
486 // This parameter settings are meant to work with p-Pb collisions
487 // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
488 // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
489 // has to be set to 2.75GeV. Example in ConfigBeautyPPR.C.
490 ConfigHeavyFlavor();
491 // QCD scales
492 SetPARP(67,1.0);
493 SetPARP(71,1.0);
494 // Intrinsic <kT>
495 SetMSTP(91,1);
496 SetPARP(91,1.60);
497 SetPARP(93,8.00);
498 // Set b-quark mass
499 SetPMAS(5,1,4.75);
500 break;
501 case kPyBeautyppMNR:
502 // Tuning of Pythia parameters aimed to get a resonable agreement
503 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
504 // b-bbar single inclusive and double differential distributions.
505 // This parameter settings are meant to work with pp collisions
506 // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
507 // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
508 // has to be set to 2.75GeV. Example in ConfigBeautyPPR.C.
509 ConfigHeavyFlavor();
510 // QCD scales
511 SetPARP(67,1.0);
512 SetPARP(71,1.0);
513
514 // Intrinsic <kT>
515 SetMSTP(91,1);
516 SetPARP(91,1.);
517 SetPARP(93,5.);
518
519 // Set b-quark mass
520 SetPMAS(5,1,4.75);
521 break;
70574ff8 522 case kPyBeautyJets:
39d810c8 523 case kPyBeautyppMNRwmi:
524 // Tuning of Pythia parameters aimed to get a resonable agreement
525 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
526 // b-bbar single inclusive and double differential distributions.
527 // This parameter settings are meant to work with pp collisions
528 // and with kCTEQ5L PDFs.
529 // Added multiple interactions according to ATLAS tune settings.
530 // To get a "reasonable" agreement with MNR results, events have to be
531 // generated with the minimum ptHard (AliGenPythia::SetPtHard)
532 // set to 2.76 GeV.
533 // To get a "perfect" agreement with MNR results, events have to be
534 // generated in four ptHard bins with the following relative
535 // normalizations:
536 // 2.76-4 GeV: 5%
537 // 4-6 GeV: 31%
538 // 6-8 GeV: 28%
539 // >8 GeV: 36%
540 ConfigHeavyFlavor();
541 // QCD scales
542 SetPARP(67,1.0);
543 SetPARP(71,1.0);
544
545 // Intrinsic <kT>
546 SetMSTP(91,1);
547 SetPARP(91,1.);
548 SetPARP(93,5.);
549
550 // Set b-quark mass
551 SetPMAS(5,1,4.75);
552
553 AtlasTuning();
554 break;
555 case kPyW:
556
557 //Inclusive production of W+/-
558 SetMSEL(0);
559 //f fbar -> W+
560 SetMSUB(2,1);
561 // //f fbar -> g W+
562 // SetMSUB(16,1);
563 // //f fbar -> gamma W+
564 // SetMSUB(20,1);
565 // //f g -> f W+
566 // SetMSUB(31,1);
567 // //f gamma -> f W+
568 // SetMSUB(36,1);
569
570 // Initial/final parton shower on (Pythia default)
571 // With parton showers on we are generating "W inclusive process"
572 SetMSTP(61,1); //Initial QCD & QED showers on
573 SetMSTP(71,1); //Final QCD & QED showers on
574
575 break;
576
577 case kPyZ:
578
579 //Inclusive production of Z
580 SetMSEL(0);
581 //f fbar -> Z/gamma
582 SetMSUB(1,1);
583
584 // // f fbar -> g Z/gamma
585 // SetMSUB(15,1);
586 // // f fbar -> gamma Z/gamma
587 // SetMSUB(19,1);
588 // // f g -> f Z/gamma
589 // SetMSUB(30,1);
590 // // f gamma -> f Z/gamma
591 // SetMSUB(35,1);
592
593 //only Z included, not gamma
594 SetMSTP(43,2);
595
596 // Initial/final parton shower on (Pythia default)
597 // With parton showers on we are generating "Z inclusive process"
598 SetMSTP(61,1); //Initial QCD & QED showers on
599 SetMSTP(71,1); //Final QCD & QED showers on
600
601 break;
602
603 }
604//
605// Initialize PYTHIA
606 SetMSTP(41,1); // all resonance decays switched on
607 Initialize("CMS","p","p",fEcms);
608
609}
610
611Int_t AliPythia6::CheckedLuComp(Int_t kf)
612{
613// Check Lund particle code (for debugging)
614 Int_t kc=Pycomp(kf);
615 return kc;
616}
617
618void AliPythia6::SetNuclei(Int_t a1, Int_t a2)
619{
620// Treat protons as inside nuclei with mass numbers a1 and a2
621// The MSTP array in the PYPARS common block is used to enable and
622// select the nuclear structure functions.
623// MSTP(52) : (D=1) choice of proton and nuclear structure-function library
624// =1: internal PYTHIA acording to MSTP(51)
625// =2: PDFLIB proton s.f., with MSTP(51) = 1000xNGROUP+NSET
626// If the following mass number both not equal zero, nuclear corrections of the stf are used.
627// MSTP(192) : Mass number of nucleus side 1
628// MSTP(193) : Mass number of nucleus side 2
629 SetMSTP(52,2);
630 SetMSTP(192, a1);
631 SetMSTP(193, a2);
632}
633
634
635AliPythia6* AliPythia6::Instance()
636{
637// Set random number generator
638 if (fgAliPythia) {
639 return fgAliPythia;
640 } else {
641 fgAliPythia = new AliPythia6();
642 return fgAliPythia;
643 }
644}
645
646void AliPythia6::PrintParticles()
647{
648// Print list of particl properties
649 Int_t np = 0;
650 char* name = new char[16];
651 for (Int_t kf=0; kf<1000000; kf++) {
652 for (Int_t c = 1; c > -2; c-=2) {
653 Int_t kc = Pycomp(c*kf);
654 if (kc) {
655 Float_t mass = GetPMAS(kc,1);
656 Float_t width = GetPMAS(kc,2);
657 Float_t tau = GetPMAS(kc,4);
658
659 Pyname(kf,name);
660
661 np++;
662
663 printf("\n mass, width, tau: %6d %s %10.3f %10.3e %10.3e",
664 c*kf, name, mass, width, tau);
665 }
666 }
667 }
668 printf("\n Number of particles %d \n \n", np);
669}
670
671void AliPythia6::ResetDecayTable()
672{
673// Set default values for pythia decay switches
674 Int_t i;
675 for (i = 1; i < 501; i++) SetMDCY(i,1,fDefMDCY[i]);
676 for (i = 1; i < 2001; i++) SetMDME(i,1,fDefMDME[i]);
677}
678
679void AliPythia6::SetDecayTable()
680{
681// Set default values for pythia decay switches
682//
683 Int_t i;
684 for (i = 1; i < 501; i++) fDefMDCY[i] = GetMDCY(i,1);
685 for (i = 1; i < 2001; i++) fDefMDME[i] = GetMDME(i,1);
686}
687
8b9bb87a 688void AliPythia6::Pyjoin(Int_t& npart, Int_t *ipart)
689{
690// Call Pythia join alogorithm to set up a string between
691// npart partons, given by indices in array ipart[npart]
692//
693 pyjoin(npart, ipart);
694}
695
39d810c8 696void AliPythia6::Pyclus(Int_t& njet)
697{
698// Call Pythia clustering algorithm
699//
700 pyclus(njet);
701}
702
703void AliPythia6::Pycell(Int_t& njet)
704{
705// Call Pythia jet reconstruction algorithm
706//
707 pycell(njet);
708}
709
710void AliPythia6::GetJet(Int_t i, Float_t& px, Float_t& py, Float_t& pz, Float_t& e)
711{
712 // Get jet number i
713 Int_t n = GetN();
714 px = GetPyjets()->P[0][n+i];
715 py = GetPyjets()->P[1][n+i];
716 pz = GetPyjets()->P[2][n+i];
717 e = GetPyjets()->P[3][n+i];
718}
719
720void AliPythia6::Pyshow(Int_t ip1, Int_t ip2, Double_t qmax)
721{
722// Call Pythia showering
723//
724 pyshow(ip1, ip2, qmax);
725}
726
727void AliPythia6::Pyrobo(Int_t imi, Int_t ima, Double_t the, Double_t phi, Double_t bex, Double_t bey, Double_t bez)
728{
729 pyrobo(imi, ima, the, phi, bex, bey, bez);
730}
731
732
733
734void AliPythia6::InitQuenching(Float_t cMin, Float_t cMax, Float_t k, Int_t iECMethod, Float_t zmax, Int_t ngmax)
735{
736// Initializes
737// (1) The quenching model using quenching weights according to C. Salgado and U. Wiedemann
738// (2) The nuclear geometry using the Glauber Model
739//
740
18b7a4a1 741 fGlauber = AliFastGlauber::Instance();
39d810c8 742 fGlauber->Init(2);
743 fGlauber->SetCentralityClass(cMin, cMax);
744
745 fQuenchingWeights = new AliQuenchingWeights();
746 fQuenchingWeights->InitMult();
747 fQuenchingWeights->SetK(k);
748 fQuenchingWeights->SetECMethod(AliQuenchingWeights::kECMethod(iECMethod));
749 fNGmax = ngmax;
750 fZmax = zmax;
751
752}
753
754
755void AliPythia6::Quench()
756{
757//
758//
759// Simple Jet Quenching routine:
760// =============================
761// The jet formed by all final state partons radiated by the parton created
762// in the hard collisions is quenched by a factor (1-z) using light cone variables in
763// the initial parton reference frame:
764// (E + p_z)new = (1-z) (E + p_z)old
765//
766//
767//
768//
769// The lost momentum is first balanced by one gluon with virtuality > 0.
770// Subsequently the gluon splits to yield two gluons with E = p.
771//
772//
773//
774 static Float_t eMean = 0.;
775 static Int_t icall = 0;
776
777 Double_t p0[4][5];
778 Double_t p1[4][5];
779 Double_t p2[4][5];
780 Int_t klast[4] = {-1, -1, -1, -1};
781
782 Int_t numpart = fPyjets->N;
783 Double_t px = 0., py = 0., pz = 0., e = 0., m = 0., p = 0., pt = 0., theta = 0., phi = 0.;
784 Double_t pxq[4], pyq[4], pzq[4], eq[4], yq[4], mq[4], pq[4], phiq[4], thetaq[4], ptq[4];
785 Bool_t quenched[4];
a23e397a 786 Double_t wjtKick[4] = {0., 0., 0., 0.};
39d810c8 787 Int_t nGluon[4];
788 Int_t qPdg[4];
789 Int_t imo, kst, pdg;
790
791//
792// Sore information about Primary partons
793//
794// j =
795// 0, 1 partons from hard scattering
796// 2, 3 partons from initial state radiation
797//
798 for (Int_t i = 2; i <= 7; i++) {
799 Int_t j = 0;
800 // Skip gluons that participate in hard scattering
801 if (i == 4 || i == 5) continue;
802 // Gluons from hard Scattering
803 if (i == 6 || i == 7) {
804 j = i - 6;
805 pxq[j] = fPyjets->P[0][i];
806 pyq[j] = fPyjets->P[1][i];
807 pzq[j] = fPyjets->P[2][i];
808 eq[j] = fPyjets->P[3][i];
809 mq[j] = fPyjets->P[4][i];
810 } else {
811 // Gluons from initial state radiation
812 //
813 // Obtain 4-momentum vector from difference between original parton and parton after gluon
814 // radiation. Energy is calculated independently because initial state radition does not
815 // conserve strictly momentum and energy for each partonic system independently.
816 //
817 // Not very clean. Should be improved !
818 //
819 //
820 j = i;
821 pxq[j] = fPyjets->P[0][i] - fPyjets->P[0][i+2];
822 pyq[j] = fPyjets->P[1][i] - fPyjets->P[1][i+2];
823 pzq[j] = fPyjets->P[2][i] - fPyjets->P[2][i+2];
824 mq[j] = fPyjets->P[4][i];
825 eq[j] = TMath::Sqrt(pxq[j] * pxq[j] + pyq[j] * pyq[j] + pzq[j] * pzq[j] + mq[j] * mq[j]);
826 }
827//
828// Calculate some kinematic variables
829//
830 yq[j] = 0.5 * TMath::Log((eq[j] + pzq[j] + 1.e-14) / (eq[j] - pzq[j] + 1.e-14));
831 pq[j] = TMath::Sqrt(pxq[j] * pxq[j] + pyq[j] * pyq[j] + pzq[j] * pzq[j]);
832 phiq[j] = TMath::Pi()+TMath::ATan2(-pyq[j], -pxq[j]);
833 ptq[j] = TMath::Sqrt(pxq[j] * pxq[j] + pyq[j] * pyq[j]);
834 thetaq[j] = TMath::ATan2(ptq[j], pzq[j]);
835 qPdg[j] = fPyjets->K[1][i];
836 }
837
838 Double_t int0[4];
839 Double_t int1[4];
840
841 fGlauber->GetI0I1ForPythiaAndXY(4, phiq, int0, int1, fXJet, fYJet, 15.);
842
843 for (Int_t j = 0; j < 4; j++) {
844 //
845 // Quench only central jets and with E > 10.
846 //
847
848
849 Int_t itype = (qPdg[j] == 21) ? 2 : 1;
850 Double_t eloss = fQuenchingWeights->GetELossRandomKFast(itype, int0[j], int1[j], eq[j]);
851
852 if (TMath::Abs(yq[j]) > 2.5 || eq[j] < 10.) {
853 fZQuench[j] = 0.;
854 } else {
855 if (eq[j] > 40. && TMath::Abs(yq[j]) < 0.5) {
856 icall ++;
857 eMean += eloss;
858 }
859 //
860 // Extra pt
861 Double_t l = fQuenchingWeights->CalcLk(int0[j], int1[j]);
862 wjtKick[j] = TMath::Sqrt(l * fQuenchingWeights->CalcQk(int0[j], int1[j]));
863 //
864 // Fractional energy loss
865 fZQuench[j] = eloss / eq[j];
866 //
867 // Avoid complete loss
868 //
1044c4d8 869 if (fZQuench[j] > fZmax) fZQuench[j] = fZmax;
39d810c8 870 //
871 // Some debug printing
872
873
874// printf("Initial parton # %3d, Type %3d Energy %10.3f Phi %10.3f Length %10.3f Loss %10.3f Kick %10.3f Mean: %10.3f %10.3f\n",
875// j, itype, eq[j], phiq[j], l, eloss, wjtKick[j], eMean / Float_t(icall+1), yq[j]);
876
877// fZQuench[j] = 0.8;
878// while (fZQuench[j] >= 0.95) fZQuench[j] = gRandom->Exp(0.2);
879 }
880
881 quenched[j] = (fZQuench[j] > 0.01);
882 } // primary partons
883
884
885
886 Double_t pNew[1000][4];
887 Int_t kNew[1000];
888 Int_t icount = 0;
889 Double_t zquench[4];
890
891//
892// System Loop
893 for (Int_t isys = 0; isys < 4; isys++) {
894// Skip to next system if not quenched.
895 if (!quenched[isys]) continue;
896
897 nGluon[isys] = 1 + Int_t(fZQuench[isys] / (1. - fZQuench[isys]));
898 if (nGluon[isys] > fNGmax) nGluon[isys] = fNGmax;
899 zquench[isys] = 1. - TMath::Power(1. - fZQuench[isys], 1./Double_t(nGluon[isys]));
900 wjtKick[isys] = wjtKick[isys] / TMath::Sqrt(Double_t(nGluon[isys]));
901
902
903
904 Int_t igMin = -1;
905 Int_t igMax = -1;
906 Double_t pg[4] = {0., 0., 0., 0.};
907
908//
909// Loop on radiation events
910
911 for (Int_t iglu = 0; iglu < nGluon[isys]; iglu++) {
912 while (1) {
913 icount = 0;
914 for (Int_t k = 0; k < 4; k++)
915 {
916 p0[isys][k] = 0.;
917 p1[isys][k] = 0.;
918 p2[isys][k] = 0.;
919 }
920// Loop over partons
921 for (Int_t i = 0; i < numpart; i++)
922 {
923 imo = fPyjets->K[2][i];
924 kst = fPyjets->K[0][i];
925 pdg = fPyjets->K[1][i];
926
927
928
929// Quarks and gluons only
930 if (pdg != 21 && TMath::Abs(pdg) > 6) continue;
931// Particles from hard scattering only
932
933 if (imo > 8 && imo < 1000) imo = fPyjets->K[2][imo - 1];
934 Int_t imom = imo % 1000;
935 if ((isys == 0 || isys == 1) && ((imom != (isys + 7)))) continue;
936 if ((isys == 2 || isys == 3) && ((imom != (isys + 1)))) continue;
937
938
939// Skip comment lines
940 if (kst != 1 && kst != 2) continue;
941//
942// Parton kinematic
943 px = fPyjets->P[0][i];
944 py = fPyjets->P[1][i];
945 pz = fPyjets->P[2][i];
946 e = fPyjets->P[3][i];
947 m = fPyjets->P[4][i];
948 pt = TMath::Sqrt(px * px + py * py);
949 p = TMath::Sqrt(px * px + py * py + pz * pz);
950 phi = TMath::Pi() + TMath::ATan2(-py, -px);
951 theta = TMath::ATan2(pt, pz);
952
953//
954// Save 4-momentum sum for balancing
955 Int_t index = isys;
956
957 p0[index][0] += px;
958 p0[index][1] += py;
959 p0[index][2] += pz;
960 p0[index][3] += e;
961
962 klast[index] = i;
963
964//
965// Fractional energy loss
966 Double_t z = zquench[index];
967
968
969// Don't fully quench radiated gluons
970//
971 if (imo > 1000) {
972// This small factor makes sure that the gluons are not too close in phase space to avoid recombination
973//
974
975 z = 0.02;
976 }
977// printf("z: %d %f\n", imo, z);
978
979
980//
981
982 //
983 //
984 // Transform into frame in which initial parton is along z-axis
985 //
986 TVector3 v(px, py, pz);
987 v.RotateZ(-phiq[index]); v.RotateY(-thetaq[index]);
988 Double_t pxs = v.X(); Double_t pys = v.Y(); Double_t pl = v.Z();
989
990 Double_t jt = TMath::Sqrt(pxs * pxs + pys * pys);
991 Double_t mt2 = jt * jt + m * m;
992 Double_t zmax = 1.;
993 //
994 // Kinematic limit on z
995 //
996 if (m > 0.) zmax = 1. - m / TMath::Sqrt(m * m + jt * jt);
997 //
998 // Change light-cone kinematics rel. to initial parton
999 //
1000 Double_t eppzOld = e + pl;
1001 Double_t empzOld = e - pl;
1002
1003 Double_t eppzNew = (1. - z) * eppzOld;
1004 Double_t empzNew = empzOld - mt2 * z / eppzOld;
1005 Double_t eNew = 0.5 * (eppzNew + empzNew);
1006 Double_t plNew = 0.5 * (eppzNew - empzNew);
1007
1008 Double_t jtNew;
1009 //
1010 // if mt very small (or sometimes even < 0 for numerical reasons) set it to 0
1011 Double_t mt2New = eppzNew * empzNew;
1012 if (mt2New < 1.e-8) mt2New = 0.;
1013 if (z < zmax) {
1014 if (m * m > mt2New) {
1015 //
1016 // This should not happen
1017 //
1018 Fatal("Quench()", "This should never happen %e %e %e!", m, eppzNew, empzNew);
1019 jtNew = 0;
1020 } else {
1021 jtNew = TMath::Sqrt(mt2New - m * m);
1022 }
1023 } else {
1024 // If pT is to small (probably a leading massive particle) we scale only the energy
1025 // This can cause negative masses of the radiated gluon
1026 // Let's hope for the best ...
1027 jtNew = jt;
1028 eNew = TMath::Sqrt(plNew * plNew + mt2);
1029
1030 }
1031 //
1032 // Calculate new px, py
1033 //
1044c4d8 1034 Double_t pxNew = 0;
1035 Double_t pyNew = 0;
1036
1037 if (jt > 0.) {
1038 pxNew = jtNew / jt * pxs;
1039 pyNew = jtNew / jt * pys;
1040 }
39d810c8 1041
1042// Double_t dpx = pxs - pxNew;
1043// Double_t dpy = pys - pyNew;
1044// Double_t dpz = pl - plNew;
1045// Double_t de = e - eNew;
1046// Double_t dmass2 = de * de - dpx * dpx - dpy * dpy - dpz * dpz;
1047// printf("New mass (1) %e %e %e %e %e %e %e \n", dmass2, jt, jtNew, pl, plNew, e, eNew);
1048// printf("New mass (2) %e %e \n", pxNew, pyNew);
1049 //
1050 // Rotate back
1051 //
1052 TVector3 w(pxNew, pyNew, plNew);
1053 w.RotateY(thetaq[index]); w.RotateZ(phiq[index]);
1054 pxNew = w.X(); pyNew = w.Y(); plNew = w.Z();
1055
1056 p1[index][0] += pxNew;
1057 p1[index][1] += pyNew;
1058 p1[index][2] += plNew;
1059 p1[index][3] += eNew;
1060 //
1061 // Updated 4-momentum vectors
1062 //
1063 pNew[icount][0] = pxNew;
1064 pNew[icount][1] = pyNew;
1065 pNew[icount][2] = plNew;
1066 pNew[icount][3] = eNew;
1067 kNew[icount] = i;
1068 icount++;
1069 } // parton loop
1070 //
1071 // Check if there was phase-space for quenching
1072 //
1073
1074 if (icount == 0) quenched[isys] = kFALSE;
1075 if (!quenched[isys]) break;
1076
1077 for (Int_t j = 0; j < 4; j++)
1078 {
1079 p2[isys][j] = p0[isys][j] - p1[isys][j];
1080 }
1081 p2[isys][4] = p2[isys][3] * p2[isys][3] - p2[isys][0] * p2[isys][0] - p2[isys][1] * p2[isys][1] - p2[isys][2] * p2[isys][2];
1082 if (p2[isys][4] > 0.) {
1083 p2[isys][4] = TMath::Sqrt(p2[isys][4]);
1084 break;
1085 } else {
1086 printf("Warning negative mass squared in system %d %f ! \n", isys, zquench[isys]);
1087 printf("4-Momentum: %10.3e %10.3e %10.3e %10.3e %10.3e \n", p2[isys][0], p2[isys][1], p2[isys][2], p2[isys][3], p2[isys][4]);
1088 if (p2[isys][4] < -0.01) {
1089 printf("Negative mass squared !\n");
1090 // Here we have to put the gluon back to mass shell
1091 // This will lead to a small energy imbalance
1092 p2[isys][4] = 0.;
1093 p2[isys][3] = TMath::Sqrt(p2[isys][0] * p2[isys][0] + p2[isys][1] * p2[isys][1] + p2[isys][2] * p2[isys][2]);
1094 break;
1095 } else {
1096 p2[isys][4] = 0.;
1097 break;
1098 }
1099 }
1100 /*
1101 zHeavy *= 0.98;
1102 printf("zHeavy lowered to %f\n", zHeavy);
1103 if (zHeavy < 0.01) {
1104 printf("No success ! \n");
1105 icount = 0;
1106 quenched[isys] = kFALSE;
1107 break;
1108 }
1109 */
1110 } // iteration on z (while)
1111
1112// Update event record
1113 for (Int_t k = 0; k < icount; k++) {
1114// printf("%6d %6d %10.3e %10.3e %10.3e %10.3e\n", k, kNew[k], pNew[k][0],pNew[k][1], pNew[k][2], pNew[k][3] );
1115 fPyjets->P[0][kNew[k]] = pNew[k][0];
1116 fPyjets->P[1][kNew[k]] = pNew[k][1];
1117 fPyjets->P[2][kNew[k]] = pNew[k][2];
1118 fPyjets->P[3][kNew[k]] = pNew[k][3];
1119 }
1120 //
1121 // Add the gluons
1122 //
1123 Int_t ish = 0;
1124 Int_t iGlu;
1125 if (!quenched[isys]) continue;
1126//
1127// Last parton from shower i
1128 Int_t in = klast[isys];
1129//
1130// Continue if no parton in shower i selected
1131 if (in == -1) continue;
1132//
1133// If this is the second initial parton and it is behind the first move pointer by previous ish
1134 if (isys == 1 && klast[1] > klast[0]) in += ish;
1135//
1136// Starting index
1137
1138// jmin = in - 1;
1139// How many additional gluons will be generated
1140 ish = 1;
1141 if (p2[isys][4] > 0.05) ish = 2;
1142//
1143// Position of gluons
1144 iGlu = numpart;
1145 if (iglu == 0) igMin = iGlu;
1146 igMax = iGlu;
1147 numpart += ish;
1148 (fPyjets->N) += ish;
1149
1150 if (ish == 1) {
1151 fPyjets->P[0][iGlu] = p2[isys][0];
1152 fPyjets->P[1][iGlu] = p2[isys][1];
1153 fPyjets->P[2][iGlu] = p2[isys][2];
1154 fPyjets->P[3][iGlu] = p2[isys][3];
1155 fPyjets->P[4][iGlu] = p2[isys][4];
1156
1157 fPyjets->K[0][iGlu] = 1;
1158 if (iglu == nGluon[isys] - 1) fPyjets->K[0][iGlu] = 1;
1159 fPyjets->K[1][iGlu] = 21;
1160 fPyjets->K[2][iGlu] = fPyjets->K[2][in] + 1000;
1161 fPyjets->K[3][iGlu] = -1;
1162 fPyjets->K[4][iGlu] = -1;
1163
1164 pg[0] += p2[isys][0];
1165 pg[1] += p2[isys][1];
1166 pg[2] += p2[isys][2];
1167 pg[3] += p2[isys][3];
1168 } else {
1169 //
1170 // Split gluon in rest frame.
1171 //
1172 Double_t bx = p2[isys][0] / p2[isys][3];
1173 Double_t by = p2[isys][1] / p2[isys][3];
1174 Double_t bz = p2[isys][2] / p2[isys][3];
1175 Double_t pst = p2[isys][4] / 2.;
1176 //
1177 // Isotropic decay ????
1178 Double_t cost = 2. * gRandom->Rndm() - 1.;
60e55aee 1179 Double_t sint = TMath::Sqrt((1.-cost)*(1.+cost));
2ab330c9 1180 Double_t phis = 2. * TMath::Pi() * gRandom->Rndm();
39d810c8 1181
1182 Double_t pz1 = pst * cost;
1183 Double_t pz2 = -pst * cost;
1184 Double_t pt1 = pst * sint;
1185 Double_t pt2 = -pst * sint;
2ab330c9 1186 Double_t px1 = pt1 * TMath::Cos(phis);
1187 Double_t py1 = pt1 * TMath::Sin(phis);
1188 Double_t px2 = pt2 * TMath::Cos(phis);
1189 Double_t py2 = pt2 * TMath::Sin(phis);
39d810c8 1190
1191 fPyjets->P[0][iGlu] = px1;
1192 fPyjets->P[1][iGlu] = py1;
1193 fPyjets->P[2][iGlu] = pz1;
1194 fPyjets->P[3][iGlu] = pst;
1195 fPyjets->P[4][iGlu] = 0.;
1196
1197 fPyjets->K[0][iGlu] = 1 ;
1198 fPyjets->K[1][iGlu] = 21;
1199 fPyjets->K[2][iGlu] = fPyjets->K[2][in] + 1000;
1200 fPyjets->K[3][iGlu] = -1;
1201 fPyjets->K[4][iGlu] = -1;
1202
1203 fPyjets->P[0][iGlu+1] = px2;
1204 fPyjets->P[1][iGlu+1] = py2;
1205 fPyjets->P[2][iGlu+1] = pz2;
1206 fPyjets->P[3][iGlu+1] = pst;
1207 fPyjets->P[4][iGlu+1] = 0.;
1208
1209 fPyjets->K[0][iGlu+1] = 1;
1210 if (iglu == nGluon[isys] - 1) fPyjets->K[0][iGlu+1] = 1;
1211 fPyjets->K[1][iGlu+1] = 21;
1212 fPyjets->K[2][iGlu+1] = fPyjets->K[2][in] + 1000;
1213 fPyjets->K[3][iGlu+1] = -1;
1214 fPyjets->K[4][iGlu+1] = -1;
1215 SetMSTU(1,0);
1216 SetMSTU(2,0);
1217 //
1218 // Boost back
1219 //
1220 Pyrobo(iGlu + 1, iGlu + 2, 0., 0., bx, by, bz);
1221 }
1222/*
1223 for (Int_t ig = iGlu; ig < iGlu+ish; ig++) {
1224 Double_t px, py, pz;
1225 px = fPyjets->P[0][ig];
1226 py = fPyjets->P[1][ig];
1227 pz = fPyjets->P[2][ig];
1228 TVector3 v(px, py, pz);
1229 v.RotateZ(-phiq[isys]);
1230 v.RotateY(-thetaq[isys]);
1231 Double_t pxs = v.X(); Double_t pys = v.Y(); Double_t pzs = v.Z();
1232 Double_t r = AliPythiaRndm::GetPythiaRandom()->Rndm();
1233 Double_t jtKick = 0.3 * TMath::Sqrt(-TMath::Log(r));
1234 if (ish == 2) jtKick = wjtKick[i] * TMath::Sqrt(-TMath::Log(r)) / TMath::Sqrt(2.);
1235 Double_t phiKick = 2. * TMath::Pi() * AliPythiaRndm::GetPythiaRandom()->Rndm();
1236 pxs += jtKick * TMath::Cos(phiKick);
1237 pys += jtKick * TMath::Sin(phiKick);
1238 TVector3 w(pxs, pys, pzs);
1239 w.RotateY(thetaq[isys]);
1240 w.RotateZ(phiq[isys]);
1241 fPyjets->P[0][ig] = w.X();
1242 fPyjets->P[1][ig] = w.Y();
1243 fPyjets->P[2][ig] = w.Z();
1244 fPyjets->P[2][ig] = w.Mag();
1245 }
1246*/
1247 } // kGluon
1248
1249
1250 // Check energy conservation
1251 Double_t pxs = 0.;
1252 Double_t pys = 0.;
1253 Double_t pzs = 0.;
1254 Double_t es = 14000.;
1255
1256 for (Int_t i = 0; i < numpart; i++)
1257 {
1258 kst = fPyjets->K[0][i];
1259 if (kst != 1 && kst != 2) continue;
1260 pxs += fPyjets->P[0][i];
1261 pys += fPyjets->P[1][i];
1262 pzs += fPyjets->P[2][i];
1263 es -= fPyjets->P[3][i];
1264 }
1265 if (TMath::Abs(pxs) > 1.e-2 ||
1266 TMath::Abs(pys) > 1.e-2 ||
1267 TMath::Abs(pzs) > 1.e-1) {
1268 printf("%e %e %e %e\n", pxs, pys, pzs, es);
1269// Fatal("Quench()", "4-Momentum non-conservation");
1270 }
1271
1272 } // end quenching loop (systems)
1273// Clean-up
1274 for (Int_t i = 0; i < numpart; i++)
1275 {
1276 imo = fPyjets->K[2][i];
1277 if (imo > 1000) {
1278 fPyjets->K[2][i] = fPyjets->K[2][i] % 1000;
1279 }
1280 }
1281// this->Pylist(1);
1282} // end quench
1283
1284
1285void AliPythia6::Pyquen(Double_t a, Int_t ibf, Double_t b)
1286{
1287 // Igor Lokthine's quenching routine
1288 // http://lokhtin.web.cern.ch/lokhtin/pyquen/pyquen.txt
1289
1290 pyquen(a, ibf, b);
1291}
1292
1293void AliPythia6::SetPyquenParameters(Double_t t0, Double_t tau0, Int_t nf, Int_t iengl, Int_t iangl)
1294{
1295 // Set the parameters for the PYQUEN package.
1296 // See comments in PyquenCommon.h
1297
1298
1299 PYQPAR.t0 = t0;
1300 PYQPAR.tau0 = tau0;
1301 PYQPAR.nf = nf;
1302 PYQPAR.iengl = iengl;
1303 PYQPAR.iangl = iangl;
1304}
1305
1306void AliPythia6::LoadEvent(AliStack* stack, Int_t flag, Int_t reHadr)
1307{
1308//
1309// Load event into Pythia Common Block
1310//
1311
1312 Int_t npart = stack -> GetNprimary();
1313 Int_t n0 = 0;
1314
1315 if (!flag) {
1316 GetPyjets()->N = npart;
1317 } else {
1318 n0 = GetPyjets()->N;
1319 GetPyjets()->N = n0 + npart;
1320 }
1321
1322
1323 for (Int_t part = 0; part < npart; part++) {
1324 TParticle *mPart = stack->Particle(part);
1325
1326 Int_t kf = mPart->GetPdgCode();
1327 Int_t ks = mPart->GetStatusCode();
1328 Int_t idf = mPart->GetFirstDaughter();
1329 Int_t idl = mPart->GetLastDaughter();
1330
1331 if (reHadr) {
1332 if (ks == 11 || ks == 12) {
1333 ks -= 10;
1334 idf = -1;
1335 idl = -1;
1336 }
1337 }
1338
1339 Float_t px = mPart->Px();
1340 Float_t py = mPart->Py();
1341 Float_t pz = mPart->Pz();
1342 Float_t e = mPart->Energy();
1343 Float_t m = mPart->GetCalcMass();
1344
1345
1346 (GetPyjets())->P[0][part+n0] = px;
1347 (GetPyjets())->P[1][part+n0] = py;
1348 (GetPyjets())->P[2][part+n0] = pz;
1349 (GetPyjets())->P[3][part+n0] = e;
1350 (GetPyjets())->P[4][part+n0] = m;
1351
1352 (GetPyjets())->K[1][part+n0] = kf;
1353 (GetPyjets())->K[0][part+n0] = ks;
1354 (GetPyjets())->K[3][part+n0] = idf + 1;
1355 (GetPyjets())->K[4][part+n0] = idl + 1;
1356 (GetPyjets())->K[2][part+n0] = mPart->GetFirstMother() + 1;
1357 }
1358}
1359
1360
1361void AliPythia6::Pyevnw()
1362{
1363 // New multiple interaction scenario
1364 pyevnw();
1365}
1366
1367void AliPythia6::GetQuenchingParameters(Double_t& xp, Double_t& yp, Double_t z[4])
1368{
1369 // Return event specific quenching parameters
1370 xp = fXJet;
1371 yp = fYJet;
1372 for (Int_t i = 0; i < 4; i++) z[i] = fZQuench[i];
1373
1374}
1375
1376void AliPythia6::ConfigHeavyFlavor()
1377{
1378 //
1379 // Default configuration for Heavy Flavor production
1380 //
1381 // All QCD processes
1382 //
1383 SetMSEL(1);
1384
1385 // No multiple interactions
1386 SetMSTP(81,0);
1387 SetPARP(81, 0.);
1388 SetPARP(82, 0.);
1389 // Initial/final parton shower on (Pythia default)
1390 SetMSTP(61,1);
1391 SetMSTP(71,1);
1392
1393 // 2nd order alpha_s
1394 SetMSTP(2,2);
1395
1396 // QCD scales
1397 SetMSTP(32,2);
1398 SetPARP(34,1.0);
1399}
1400
1401void AliPythia6::AtlasTuning()
1402{
1403 //
1404 // Configuration for the ATLAS tuning
1405 SetMSTP(51,AliStructFuncType::PDFsetIndex(kCTEQ5L));
1406 SetMSTP(81,1); // Multiple Interactions ON
1407 SetMSTP(82,4); // Double Gaussian Model
1408 SetPARP(81,1.9); // Min. pt for multiple interactions (default in 6.2-14)
1409 SetPARP(82,1.8); // [GeV] PT_min at Ref. energy
1410 SetPARP(89,1000.); // [GeV] Ref. energy
1411 SetPARP(90,0.16); // 2*epsilon (exponent in power law)
1412 SetPARP(83,0.5); // Core density in proton matter distribution (def.value)
1413 SetPARP(84,0.5); // Core radius
1414 SetPARP(85,0.33); // Regulates gluon prod. mechanism
1415 SetPARP(86,0.66); // Regulates gluon prod. mechanism
1416 SetPARP(67,1); // Regulates Initial State Radiation
1417}
1418
67b7bb0e 1419void AliPythia6::AtlasTuning_MC09()
1420{
1421 //
1422 // Configuration for the ATLAS tuning
1423 printf("ATLAS New TUNE MC09\n");
1424 SetMSTP(81,21); // treatment for MI, ISR, FSR and beam remnants: MI on, new model
1425 SetMSTP(82, 4); // Double Gaussian Model
1426 SetMSTP(52, 2); // External PDF
1427 SetMSTP(51, 20650); // MRST LO*
1428
1429
1430 SetMSTP(70, 0); // (was 2: def manual 1, def code 0) virtuality scale for ISR
1431 SetMSTP(72, 1); // (was 0: def 1) maximum scale for FSR
1432 SetMSTP(88, 1); // (was 0: def 1) strategy for qq junction to di-quark or baryon in beam remnant
1433 SetMSTP(90, 0); // (was 1: def 0) strategy of compensate the primordial kT
1434
1435 SetPARP(78, 0.3); // the amount of color reconnection in the final state
1436 SetPARP(80, 0.1); // probability of color partons kicked out from beam remnant
1437 SetPARP(82, 2.3); // [GeV] PT_min at Ref. energy
1438 SetPARP(83, 0.8); // Core density in proton matter distribution (def.value)
1439 SetPARP(84, 0.7); // Core radius
1440 SetPARP(90, 0.25); // 2*epsilon (exponent in power law)
1441 SetPARJ(81, 0.29); // (was 0.14: def 0.29) Labmda value in running alpha_s for parton showers
1442
1443 SetMSTP(95, 6);
1444 SetPARJ(41, 0.3); // a and b parameters of the symmm. Lund FF
1445 SetPARJ(42, 0.58);
1446 SetPARJ(46, 0.75); // mod. of the Lund FF for heavy end-point quarks
1447 SetPARP(89,1800.); // [GeV] Ref. energy
1448}
1449
39d810c8 1450void AliPythia6::SetPtHardRange(Float_t ptmin, Float_t ptmax)
1451{
1452 // Set the pt hard range
1453 SetCKIN(3, ptmin);
1454 SetCKIN(4, ptmax);
1455}
1456
1457void AliPythia6::SetYHardRange(Float_t ymin, Float_t ymax)
1458{
1459 // Set the y hard range
1460 SetCKIN(7, ymin);
1461 SetCKIN(8, ymax);
1462}
1463
1464
1465void AliPythia6::SetFragmentation(Int_t flag)
1466{
1467 // Switch fragmentation on/off
1468 SetMSTP(111, flag);
1469}
1470
1471void AliPythia6::SetInitialAndFinalStateRadiation(Int_t flag1, Int_t flag2)
1472{
1473// initial state radiation
1474 SetMSTP(61, flag1);
1475// final state radiation
1476 SetMSTP(71, flag2);
1477}
1478
1479void AliPythia6::SetIntrinsicKt(Float_t kt)
1480{
1481 // Set the inreinsic kt
1482 if (kt > 0.) {
1483 SetMSTP(91,1);
1484 SetPARP(91,kt);
1485 SetPARP(93, 4. * kt);
1486 } else {
1487 SetMSTP(91,0);
1488 }
1489}
1490
1491void AliPythia6::SwitchHFOff()
1492{
1493 // Switch off heavy flavor
1494 // Maximum number of quark flavours used in pdf
1495 SetMSTP(58, 3);
1496 // Maximum number of flavors that can be used in showers
1497 SetMSTJ(45, 3);
1498}
1499
1500void AliPythia6::SetPycellParameters(Float_t etamax, Int_t neta, Int_t nphi,
1501 Float_t thresh, Float_t etseed, Float_t minet, Float_t r)
1502{
1503// Set pycell parameters
1504 SetPARU(51, etamax);
1505 SetMSTU(51, neta);
1506 SetMSTU(52, nphi);
1507 SetPARU(58, thresh);
1508 SetPARU(52, etseed);
1509 SetPARU(53, minet);
1510 SetPARU(54, r);
1511 SetMSTU(54, 2);
1512}
1513
1514void AliPythia6::ModifiedSplitting()
1515{
1516 // Modified splitting probability as a model for quenching
1517 SetPARJ(200, 0.8);
1518 SetMSTJ(41, 1); // QCD radiation only
1519 SetMSTJ(42, 2); // angular ordering
1520 SetMSTJ(44, 2); // option to run alpha_s
1521 SetMSTJ(47, 0); // No correction back to hard scattering element
1522 SetMSTJ(50, 0); // No coherence in first branching
1523 SetPARJ(82, 1.); // Cut off for parton showers
1524}
1525
1526void AliPythia6::SwitchHadronisationOff()
1527{
1528 // Switch off hadronisarion
1529 SetMSTJ(1, 0);
1530}
1531
1532void AliPythia6::SwitchHadronisationOn()
1533{
1534 // Switch on hadronisarion
1535 SetMSTJ(1, 1);
1536}
1537
1538
1539void AliPythia6::GetXandQ(Float_t& x1, Float_t& x2, Float_t& q)
1540{
1541 // Get x1, x2 and Q for this event
1542
1543 q = GetVINT(51);
1544 x1 = GetVINT(41);
1545 x2 = GetVINT(42);
1546}
1547
1548Float_t AliPythia6::GetXSection()
1549{
1550 // Get the total cross-section
1551 return (GetPARI(1));
1552}
1553
1554Float_t AliPythia6::GetPtHard()
1555{
1556 // Get the pT hard for this event
1557 return GetVINT(47);
1558}
1559
1560Int_t AliPythia6::ProcessCode()
1561{
1562 // Get the subprocess code
1563 return GetMSTI(1);
1564}
1565
1566void AliPythia6::PrintStatistics()
1567{
1568 // End of run statistics
1569 Pystat(1);
1570}
1571
1572void AliPythia6::EventListing()
1573{
1574 // End of run statistics
1575 Pylist(2);
1576}
1577
1578AliPythia6& AliPythia6::operator=(const AliPythia6& rhs)
1579{
1580// Assignment operator
1581 rhs.Copy(*this);
1582 return *this;
1583}
1584
1585 void AliPythia6::Copy(TObject&) const
1586{
1587 //
1588 // Copy
1589 //
1590 Fatal("Copy","Not implemented!\n");
1591}