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