]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PYTHIA6/AliPythia.cxx
Fixed warnings
[u/mrichter/AliRoot.git] / PYTHIA6 / AliPythia.cxx
CommitLineData
6b435cde 1
8d2cd130 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
7cdba479 17/* $Id$ */
8d2cd130 18
19#include "AliPythia.h"
7cdba479 20#include "AliPythiaRndm.h"
12cb0bc0 21#include "AliFastGlauber.h"
22#include "AliQuenchingWeights.h"
0f482ae4 23#include "TVector3.h"
12cb0bc0 24#include "PyquenCommon.h"
8d2cd130 25
26ClassImp(AliPythia)
27
28#ifndef WIN32
29# define pyclus pyclus_
30# define pycell pycell_
452af8c7 31# define pyshow pyshow_
32# define pyrobo pyrobo_
992f2843 33# define pyquen pyquen_
16a82508 34# define pyevnw pyevnw_
cd07c39b 35# define pyshowq pyshowq_
6c43eccb 36# define qpygin0 qpygin0_
694b39f9 37# define pytune pytune_
9b61ba2a 38# define py2ent py2ent_
8d2cd130 39# define type_of_call
40#else
41# define pyclus PYCLUS
42# define pycell PYCELL
452af8c7 43# define pyrobo PYROBO
992f2843 44# define pyquen PYQUEN
16a82508 45# define pyevnw PYEVNW
cd07c39b 46# define pyshowq PYSHOWQ
6c43eccb 47# define qpygin0 QPYGIN0
9b61ba2a 48# define pytune PYTUNE
49# define py2ent PY2ENT
8d2cd130 50# define type_of_call _stdcall
51#endif
52
53extern "C" void type_of_call pyclus(Int_t & );
54extern "C" void type_of_call pycell(Int_t & );
452af8c7 55extern "C" void type_of_call pyshow(Int_t &, Int_t &, Double_t &);
56extern "C" void type_of_call pyrobo(Int_t &, Int_t &, Double_t &, Double_t &, Double_t &, Double_t &, Double_t &);
992f2843 57extern "C" void type_of_call pyquen(Double_t &, Int_t &, Double_t &);
0a2cfc0a 58extern "C" void type_of_call pyevnw(){;}
cd07c39b 59extern "C" void type_of_call pyshowq(Int_t &, Int_t &, Double_t &);
694b39f9 60extern "C" void type_of_call pytune(Int_t &);
9b61ba2a 61extern "C" void type_of_call py2ent(Int_t &, Int_t&, Int_t&, Double_t&);
6c43eccb 62extern "C" void type_of_call qpygin0();
8d2cd130 63//_____________________________________________________________________________
64
65AliPythia* AliPythia::fgAliPythia=NULL;
66
e8a8adcd 67AliPythia::AliPythia():
68 fProcess(kPyMb),
69 fEcms(0.),
70 fStrucFunc(kCTEQ5L),
71 fXJet(0.),
72 fYJet(0.),
32c8e463 73 fNGmax(30),
74 fZmax(0.97),
e8a8adcd 75 fGlauber(0),
0bd3d7c5 76 fQuenchingWeights(0),
77 fItune(-1)
8d2cd130 78{
79// Default Constructor
80//
81// Set random number
7cdba479 82 if (!AliPythiaRndm::GetPythiaRandom())
83 AliPythiaRndm::SetPythiaRandom(GetRandom());
0f482ae4 84 fGlauber = 0;
85 fQuenchingWeights = 0;
8d2cd130 86}
87
e8a8adcd 88AliPythia::AliPythia(const AliPythia& pythia):
6b435cde 89 TPythia6(pythia),
90 AliRndm(pythia),
e8a8adcd 91 fProcess(kPyMb),
92 fEcms(0.),
93 fStrucFunc(kCTEQ5L),
94 fXJet(0.),
95 fYJet(0.),
32c8e463 96 fNGmax(30),
97 fZmax(0.97),
e8a8adcd 98 fGlauber(0),
0bd3d7c5 99 fQuenchingWeights(0),
100 fItune(-1)
e8a8adcd 101{
102 // Copy Constructor
103 pythia.Copy(*this);
104}
105
efe3b1cd 106void AliPythia::ProcInit(Process_t process, Float_t energy, StrucFunc_t strucfunc, Int_t itune)
8d2cd130 107{
108// Initialise the process to generate
7cdba479 109 if (!AliPythiaRndm::GetPythiaRandom())
110 AliPythiaRndm::SetPythiaRandom(GetRandom());
8d2cd130 111
0bd3d7c5 112 fItune = itune;
113
8d2cd130 114 fProcess = process;
115 fEcms = energy;
116 fStrucFunc = strucfunc;
1d5b1b20 117//...Switch off decay of pi0, K0S, Lambda, Sigma+-, Xi0-, Omega-.
e2de0ce1 118 SetMDCY(Pycomp(111) ,1,0); // pi0
119 SetMDCY(Pycomp(310) ,1,0); // K0S
120 SetMDCY(Pycomp(3122),1,0); // kLambda
121 SetMDCY(Pycomp(3112),1,0); // sigma -
122 SetMDCY(Pycomp(3212),1,0); // sigma 0
123 SetMDCY(Pycomp(3222),1,0); // sigma +
124 SetMDCY(Pycomp(3312),1,0); // xi -
125 SetMDCY(Pycomp(3322),1,0); // xi 0
126 SetMDCY(Pycomp(3334),1,0); // omega-
1c50ec12 127 // Select structure function
8d2cd130 128 SetMSTP(52,2);
e2de0ce1 129 SetMSTP(51, AliStructFuncType::PDFsetIndex(strucfunc));
1c50ec12 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
8d2cd130 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 {
65f2626c 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);
e0e89f40 196 AtlasTuning();
65f2626c 197 break;
8d2cd130 198 case kPyCharm:
199 SetMSEL(4);
8d2cd130 200// heavy quark masses
201
202 SetPMAS(4,1,1.2);
8d2cd130 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);
8d2cd130 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);
511db649 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
e0e89f40 259 AtlasTuning();
f529e69b 260 break;
0bd3d7c5 261
262 case kPyMbAtlasTuneMC09:
263// Minimum Bias pp-Collisions
264//
265//
266// select Pythia min. bias model
267 SetMSEL(0);
268 SetMSUB(92,1); // single diffraction AB-->XB
269 SetMSUB(93,1); // single diffraction AB-->AX
270 SetMSUB(94,1); // double diffraction
271 SetMSUB(95,1); // low pt production
272
273 AtlasTuning_MC09();
274 break;
04081a91 275
276 case kPyMbWithDirectPhoton:
277// Minimum Bias pp-Collisions with direct photon processes added
278//
279//
280// select Pythia min. bias model
281 SetMSEL(0);
282 SetMSUB(92,1); // single diffraction AB-->XB
283 SetMSUB(93,1); // single diffraction AB-->AX
284 SetMSUB(94,1); // double diffraction
285 SetMSUB(95,1); // low pt production
286
287 SetMSUB(14,1); //
288 SetMSUB(18,1); //
289 SetMSUB(29,1); //
290 SetMSUB(114,1); //
291 SetMSUB(115,1); //
292
293
294 AtlasTuning();
295 break;
296
f529e69b 297 case kPyMbDefault:
298// Minimum Bias pp-Collisions
299//
300//
301// select Pythia min. bias model
302 SetMSEL(0);
6d2ec66d 303 SetMSUB(92,1); // single diffraction AB-->XB
304 SetMSUB(93,1); // single diffraction AB-->AX
f529e69b 305 SetMSUB(94,1); // double diffraction
306 SetMSUB(95,1); // low pt production
0a0cbcfd 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
e2de0ce1 318 SetMSTP(51,AliStructFuncType::PDFsetIndex(kCTEQ6ll)); // CTEQ6ll pdf
0a0cbcfd 319 SetMSTP(52,2);
320 SetMSTP(68,1);
321 SetMSTP(70,2);
322 SetMSTP(81,1); // Multiple Interactions ON
323 SetMSTP(82,4); // Double Gaussian Model
324 SetMSTP(88,1);
325
326 SetPARP(82,2.3); // [GeV] PT_min at Ref. energy
327 SetPARP(83,0.5); // Core density in proton matter distribution (def.value)
328 SetPARP(84,0.5); // Core radius
329 SetPARP(85,0.9); // Regulates gluon prod. mechanism
330 SetPARP(90,0.2); // 2*epsilon (exponent in power law)
331
511db649 332 break;
8d2cd130 333 case kPyMbNonDiffr:
334// Minimum Bias pp-Collisions
335//
336//
337// select Pythia min. bias model
338 SetMSEL(0);
511db649 339 SetMSUB(95,1); // low pt production
0f482ae4 340
d7de4a67 341 AtlasTuning();
342 break;
343 case kPyMbMSEL1:
344 ConfigHeavyFlavor();
345// Intrinsic <kT^2>
346 SetMSTP(91,1);// Width (1=gaussian) primordial kT dist. inside hadrons
347 SetPARP(91,1.); // <kT^2> = PARP(91,1.)^2
348 SetPARP(93,5.); // Upper cut-off
349// Set Q-quark mass
350 SetPMAS(4,1,1.2); // Charm quark mass
351 SetPMAS(5,1,4.78); // Beauty quark mass
352 SetPARP(71,4.); // Defaut value
353// Atlas Tuning
e0e89f40 354 AtlasTuning();
8d2cd130 355 break;
356 case kPyJets:
357//
358// QCD Jets
359//
360 SetMSEL(1);
65f2626c 361 // Pythia Tune A (CDF)
362 //
4167b79f 363 SetPARP(67,2.5); // Regulates Initial State Radiation (value from best fit to D0 dijet analysis)
65f2626c 364 SetMSTP(82,4); // Double Gaussian Model
365 SetPARP(82,2.0); // [GeV] PT_min at Ref. energy
366 SetPARP(84,0.4); // Core radius
367 SetPARP(85,0.90) ; // Regulates gluon prod. mechanism
368 SetPARP(86,0.95); // Regulates gluon prod. mechanism
369 SetPARP(89,1800.); // [GeV] Ref. energy
0bd3d7c5 370 SetPARP(90,0.25); // 2*epsilon (exponent in power law)
65f2626c 371 break;
8d2cd130 372 case kPyDirectGamma:
373 SetMSEL(10);
374 break;
adf4d898 375 case kPyCharmPbPbMNR:
376 case kPyD0PbPbMNR:
90d7b703 377 case kPyDPlusPbPbMNR:
e0e89f40 378 case kPyDPlusStrangePbPbMNR:
90d7b703 379 // Tuning of Pythia parameters aimed to get a resonable agreement
380 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
381 // c-cbar single inclusive and double differential distributions.
382 // This parameter settings are meant to work with Pb-Pb collisions
383 // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
384 // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
385 // has to be set to 2.1GeV. Example in ConfigCharmPPR.C.
3dc3ec94 386 ConfigHeavyFlavor();
90d7b703 387 // Intrinsic <kT>
388 SetMSTP(91,1);
389 SetPARP(91,1.304);
390 SetPARP(93,6.52);
90d7b703 391 // Set c-quark mass
392 SetPMAS(4,1,1.2);
8d2cd130 393 break;
adf4d898 394 case kPyCharmpPbMNR:
395 case kPyD0pPbMNR:
90d7b703 396 case kPyDPluspPbMNR:
e0e89f40 397 case kPyDPlusStrangepPbMNR:
90d7b703 398 // Tuning of Pythia parameters aimed to get a resonable agreement
399 // between with the NLO calculation by Mangano, Nason, Ridolfi for the
400 // c-cbar single inclusive and double differential distributions.
401 // This parameter settings are meant to work with p-Pb collisions
402 // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
403 // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
404 // has to be set to 2.1GeV. Example in ConfigCharmPPR.C.
3dc3ec94 405 ConfigHeavyFlavor();
90d7b703 406 // Intrinsic <kT>
3dc3ec94 407 SetMSTP(91,1);
408 SetPARP(91,1.16);
409 SetPARP(93,5.8);
410
90d7b703 411 // Set c-quark mass
3dc3ec94 412 SetPMAS(4,1,1.2);
adf4d898 413 break;
414 case kPyCharmppMNR:
415 case kPyD0ppMNR:
90d7b703 416 case kPyDPlusppMNR:
e0e89f40 417 case kPyDPlusStrangeppMNR:
90d7b703 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.
3dc3ec94 425 ConfigHeavyFlavor();
90d7b703 426 // Intrinsic <kT^2>
3dc3ec94 427 SetMSTP(91,1);
428 SetPARP(91,1.);
429 SetPARP(93,5.);
430
90d7b703 431 // Set c-quark mass
3dc3ec94 432 SetPMAS(4,1,1.2);
adf4d898 433 break;
e0e89f40 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;
adf4d898 461 case kPyBeautyPbPbMNR:
8d2cd130 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.
3dc3ec94 469 ConfigHeavyFlavor();
8d2cd130 470 // QCD scales
3dc3ec94 471 SetPARP(67,1.0);
472 SetPARP(71,1.0);
adf4d898 473 // Intrinsic <kT>
3dc3ec94 474 SetMSTP(91,1);
475 SetPARP(91,2.035);
476 SetPARP(93,10.17);
8d2cd130 477 // Set b-quark mass
3dc3ec94 478 SetPMAS(5,1,4.75);
adf4d898 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.
3dc3ec94 488 ConfigHeavyFlavor();
adf4d898 489 // QCD scales
3dc3ec94 490 SetPARP(67,1.0);
491 SetPARP(71,1.0);
adf4d898 492 // Intrinsic <kT>
3dc3ec94 493 SetMSTP(91,1);
494 SetPARP(91,1.60);
495 SetPARP(93,8.00);
adf4d898 496 // Set b-quark mass
3dc3ec94 497 SetPMAS(5,1,4.75);
adf4d898 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.
3dc3ec94 507 ConfigHeavyFlavor();
adf4d898 508 // QCD scales
3dc3ec94 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);
8d2cd130 519 break;
9dfe63b3 520 case kPyBeautyJets:
e0e89f40 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;
589380c6 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;
0f6ee828 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
8d2cd130 601 }
602//
603// Initialize PYTHIA
efe3b1cd 604//
605// Select the tune
606 if (itune > -1) Pytune(itune);
607
608//
8d2cd130 609 SetMSTP(41,1); // all resonance decays switched on
d95b55fa 610 Initialize("CMS","p","p",fEcms);
4167b79f 611
8d2cd130 612}
613
614Int_t AliPythia::CheckedLuComp(Int_t kf)
615{
616// Check Lund particle code (for debugging)
617 Int_t kc=Pycomp(kf);
618 printf("\n Lucomp kf,kc %d %d",kf,kc);
619 return kc;
620}
621
20e47f08 622void AliPythia::SetNuclei(Int_t a1, Int_t a2, Int_t pdf)
8d2cd130 623{
624// Treat protons as inside nuclei with mass numbers a1 and a2
625// The MSTP array in the PYPARS common block is used to enable and
626// select the nuclear structure functions.
627// MSTP(52) : (D=1) choice of proton and nuclear structure-function library
628// =1: internal PYTHIA acording to MSTP(51)
629// =2: PDFLIB proton s.f., with MSTP(51) = 1000xNGROUP+NSET
630// If the following mass number both not equal zero, nuclear corrections of the stf are used.
631// MSTP(192) : Mass number of nucleus side 1
632// MSTP(193) : Mass number of nucleus side 2
20e47f08 633// MSTP(194) : Nuclear structure function: 0: EKS98 1:EPS08
8d2cd130 634 SetMSTP(52,2);
635 SetMSTP(192, a1);
20e47f08 636 SetMSTP(193, a2);
637 SetMSTP(194, pdf);
8d2cd130 638}
639
640
641AliPythia* AliPythia::Instance()
642{
643// Set random number generator
644 if (fgAliPythia) {
645 return fgAliPythia;
646 } else {
647 fgAliPythia = new AliPythia();
648 return fgAliPythia;
649 }
650}
651
652void AliPythia::PrintParticles()
653{
654// Print list of particl properties
655 Int_t np = 0;
c31f1d37 656 char* name = new char[16];
8d2cd130 657 for (Int_t kf=0; kf<1000000; kf++) {
658 for (Int_t c = 1; c > -2; c-=2) {
8d2cd130 659 Int_t kc = Pycomp(c*kf);
660 if (kc) {
661 Float_t mass = GetPMAS(kc,1);
662 Float_t width = GetPMAS(kc,2);
663 Float_t tau = GetPMAS(kc,4);
c31f1d37 664
8d2cd130 665 Pyname(kf,name);
666
667 np++;
668
669 printf("\n mass, width, tau: %6d %s %10.3f %10.3e %10.3e",
670 c*kf, name, mass, width, tau);
671 }
672 }
673 }
674 printf("\n Number of particles %d \n \n", np);
675}
676
677void AliPythia::ResetDecayTable()
678{
679// Set default values for pythia decay switches
680 Int_t i;
681 for (i = 1; i < 501; i++) SetMDCY(i,1,fDefMDCY[i]);
682 for (i = 1; i < 2001; i++) SetMDME(i,1,fDefMDME[i]);
683}
684
685void AliPythia::SetDecayTable()
686{
687// Set default values for pythia decay switches
688//
689 Int_t i;
690 for (i = 1; i < 501; i++) fDefMDCY[i] = GetMDCY(i,1);
691 for (i = 1; i < 2001; i++) fDefMDME[i] = GetMDME(i,1);
692}
693
694void AliPythia::Pyclus(Int_t& njet)
695{
696// Call Pythia clustering algorithm
697//
698 pyclus(njet);
699}
700
701void AliPythia::Pycell(Int_t& njet)
702{
703// Call Pythia jet reconstruction algorithm
704//
705 pycell(njet);
706}
707
452af8c7 708void AliPythia::Pyshow(Int_t ip1, Int_t ip2, Double_t qmax)
709{
710// Call Pythia jet reconstruction algorithm
711//
452af8c7 712 pyshow(ip1, ip2, qmax);
713}
714
715void AliPythia::Pyrobo(Int_t imi, Int_t ima, Double_t the, Double_t phi, Double_t bex, Double_t bey, Double_t bez)
716{
717 pyrobo(imi, ima, the, phi, bex, bey, bez);
718}
719
694b39f9 720void AliPythia::Pytune(Int_t itune)
721{
c5e2801a 722/*
723C
724C ITUNE NAME (detailed descriptions below)
725C 0 Default : No settings changed => linked Pythia version's defaults.
726C ====== Old UE, Q2-ordered showers ==========================================
727C 100 A : Rick Field's CDF Tune A
728C 101 AW : Rick Field's CDF Tune AW
729C 102 BW : Rick Field's CDF Tune BW
730C 103 DW : Rick Field's CDF Tune DW
731C 104 DWT : Rick Field's CDF Tune DW with slower UE energy scaling
732C 105 QW : Rick Field's CDF Tune QW (NB: needs CTEQ6.1M pdfs externally)
733C 106 ATLAS-DC2: Arthur Moraes' (old) ATLAS tune (ATLAS DC2 / Rome)
734C 107 ACR : Tune A modified with annealing CR
735C 108 D6 : Rick Field's CDF Tune D6 (NB: needs CTEQ6L pdfs externally)
736C 109 D6T : Rick Field's CDF Tune D6T (NB: needs CTEQ6L pdfs externally)
737C ====== Intermediate Models =================================================
738C 200 IM 1 : Intermediate model: new UE, Q2-ordered showers, annealing CR
739C 201 APT : Tune A modified to use pT-ordered final-state showers
740C ====== New UE, interleaved pT-ordered showers, annealing CR ================
741C 300 S0 : Sandhoff-Skands Tune 0
742C 301 S1 : Sandhoff-Skands Tune 1
743C 302 S2 : Sandhoff-Skands Tune 2
744C 303 S0A : S0 with "Tune A" UE energy scaling
745C 304 NOCR : New UE "best try" without colour reconnections
746C 305 Old : New UE, original (primitive) colour reconnections
747C 306 ATLAS-CSC: Arthur Moraes' (new) ATLAS tune (needs CTEQ6L externally)
748C ======= The Uppsala models =================================================
749C ( NB! must be run with special modified Pythia 6.215 version )
750C ( available from http://www.isv.uu.se/thep/MC/scigal/ )
751C 400 GAL 0 : Generalized area-law model. Old parameters
752C 401 SCI 0 : Soft-Colour-Interaction model. Old parameters
753C 402 GAL 1 : Generalized area-law model. Tevatron MB retuned (Skands)
754*/
694b39f9 755 pytune(itune);
756}
757
9b61ba2a 758void AliPythia::Py2ent(Int_t idx, Int_t pdg1, Int_t pdg2, Double_t p){
759 // Inset 2-parton system at line idx
760 py2ent(idx, pdg1, pdg2, p);
761}
452af8c7 762
763
32c8e463 764void AliPythia::InitQuenching(Float_t cMin, Float_t cMax, Float_t k, Int_t iECMethod, Float_t zmax, Int_t ngmax)
0f482ae4 765{
766// Initializes
767// (1) The quenching model using quenching weights according to C. Salgado and U. Wiedemann
768// (2) The nuclear geometry using the Glauber Model
769//
6b435cde 770
18b7a4a1 771 fGlauber = AliFastGlauber::Instance();
0f482ae4 772 fGlauber->Init(2);
773 fGlauber->SetCentralityClass(cMin, cMax);
774
775 fQuenchingWeights = new AliQuenchingWeights();
776 fQuenchingWeights->InitMult();
86b6ad68 777 fQuenchingWeights->SetK(k);
0f482ae4 778 fQuenchingWeights->SetECMethod(AliQuenchingWeights::kECMethod(iECMethod));
32c8e463 779 fNGmax = ngmax;
780 fZmax = zmax;
781
0f482ae4 782}
783
784
452af8c7 785void AliPythia::Quench()
786{
787//
788//
789// Simple Jet Quenching routine:
790// =============================
791// The jet formed by all final state partons radiated by the parton created
0f482ae4 792// in the hard collisions is quenched by a factor (1-z) using light cone variables in
793// the initial parton reference frame:
452af8c7 794// (E + p_z)new = (1-z) (E + p_z)old
795//
0f482ae4 796//
797//
798//
452af8c7 799// The lost momentum is first balanced by one gluon with virtuality > 0.
800// Subsequently the gluon splits to yield two gluons with E = p.
801//
0f482ae4 802//
803//
4e383037 804 static Float_t eMean = 0.;
805 static Int_t icall = 0;
0f482ae4 806
c2c598a3 807 Double_t p0[4][5];
808 Double_t p1[4][5];
809 Double_t p2[4][5];
810 Int_t klast[4] = {-1, -1, -1, -1};
452af8c7 811
812 Int_t numpart = fPyjets->N;
86b6ad68 813 Double_t px = 0., py = 0., pz = 0., e = 0., m = 0., p = 0., pt = 0., theta = 0., phi = 0.;
c2c598a3 814 Double_t pxq[4], pyq[4], pzq[4], eq[4], yq[4], mq[4], pq[4], phiq[4], thetaq[4], ptq[4];
815 Bool_t quenched[4];
b280c4cc 816 Double_t wjtKick[4];
c2c598a3 817 Int_t nGluon[4];
86b6ad68 818 Int_t qPdg[4];
0f482ae4 819 Int_t imo, kst, pdg;
b280c4cc 820
511db649 821//
c2c598a3 822// Sore information about Primary partons
823//
824// j =
825// 0, 1 partons from hard scattering
826// 2, 3 partons from initial state radiation
827//
828 for (Int_t i = 2; i <= 7; i++) {
829 Int_t j = 0;
830 // Skip gluons that participate in hard scattering
831 if (i == 4 || i == 5) continue;
832 // Gluons from hard Scattering
833 if (i == 6 || i == 7) {
834 j = i - 6;
835 pxq[j] = fPyjets->P[0][i];
836 pyq[j] = fPyjets->P[1][i];
837 pzq[j] = fPyjets->P[2][i];
838 eq[j] = fPyjets->P[3][i];
839 mq[j] = fPyjets->P[4][i];
840 } else {
841 // Gluons from initial state radiation
842 //
843 // Obtain 4-momentum vector from difference between original parton and parton after gluon
844 // radiation. Energy is calculated independently because initial state radition does not
845 // conserve strictly momentum and energy for each partonic system independently.
846 //
847 // Not very clean. Should be improved !
848 //
849 //
850 j = i;
851 pxq[j] = fPyjets->P[0][i] - fPyjets->P[0][i+2];
852 pyq[j] = fPyjets->P[1][i] - fPyjets->P[1][i+2];
853 pzq[j] = fPyjets->P[2][i] - fPyjets->P[2][i+2];
854 mq[j] = fPyjets->P[4][i];
855 eq[j] = TMath::Sqrt(pxq[j] * pxq[j] + pyq[j] * pyq[j] + pzq[j] * pzq[j] + mq[j] * mq[j]);
856 }
857//
858// Calculate some kinematic variables
511db649 859//
4e383037 860 yq[j] = 0.5 * TMath::Log((eq[j] + pzq[j] + 1.e-14) / (eq[j] - pzq[j] + 1.e-14));
0f482ae4 861 pq[j] = TMath::Sqrt(pxq[j] * pxq[j] + pyq[j] * pyq[j] + pzq[j] * pzq[j]);
862 phiq[j] = TMath::Pi()+TMath::ATan2(-pyq[j], -pxq[j]);
863 ptq[j] = TMath::Sqrt(pxq[j] * pxq[j] + pyq[j] * pyq[j]);
864 thetaq[j] = TMath::ATan2(ptq[j], pzq[j]);
86b6ad68 865 qPdg[j] = fPyjets->K[1][i];
866 }
867
868 Double_t int0[4];
869 Double_t int1[4];
86b6ad68 870
b280c4cc 871 fGlauber->GetI0I1ForPythiaAndXY(4, phiq, int0, int1, fXJet, fYJet, 15.);
872
86b6ad68 873 for (Int_t j = 0; j < 4; j++) {
c2c598a3 874 //
875 // Quench only central jets and with E > 10.
876 //
86b6ad68 877
878
879 Int_t itype = (qPdg[j] == 21) ? 2 : 1;
880 Double_t eloss = fQuenchingWeights->GetELossRandomKFast(itype, int0[j], int1[j], eq[j]);
881
c2c598a3 882 if (TMath::Abs(yq[j]) > 2.5 || eq[j] < 10.) {
b280c4cc 883 fZQuench[j] = 0.;
0f482ae4 884 } else {
c2c598a3 885 if (eq[j] > 40. && TMath::Abs(yq[j]) < 0.5) {
4e383037 886 icall ++;
887 eMean += eloss;
888 }
0f482ae4 889 //
890 // Extra pt
86b6ad68 891 Double_t l = fQuenchingWeights->CalcLk(int0[j], int1[j]);
892 wjtKick[j] = TMath::Sqrt(l * fQuenchingWeights->CalcQk(int0[j], int1[j]));
0f482ae4 893 //
894 // Fractional energy loss
b280c4cc 895 fZQuench[j] = eloss / eq[j];
0f482ae4 896 //
897 // Avoid complete loss
898 //
1044c4d8 899 if (fZQuench[j] > fZmax) fZQuench[j] = fZmax;
0f482ae4 900 //
901 // Some debug printing
86b6ad68 902
903
bf9bb016 904// 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",
905// j, itype, eq[j], phiq[j], l, eloss, wjtKick[j], eMean / Float_t(icall+1), yq[j]);
4e383037 906
b280c4cc 907// fZQuench[j] = 0.8;
908// while (fZQuench[j] >= 0.95) fZQuench[j] = gRandom->Exp(0.2);
0f482ae4 909 }
4e383037 910
b280c4cc 911 quenched[j] = (fZQuench[j] > 0.01);
4e383037 912 } // primary partons
c2c598a3 913
b280c4cc 914
915
6e90ad26 916 Double_t pNew[1000][4];
917 Int_t kNew[1000];
918 Int_t icount = 0;
b280c4cc 919 Double_t zquench[4];
920
6e90ad26 921//
4e383037 922// System Loop
c2c598a3 923 for (Int_t isys = 0; isys < 4; isys++) {
6e90ad26 924// Skip to next system if not quenched.
4e383037 925 if (!quenched[isys]) continue;
926
b280c4cc 927 nGluon[isys] = 1 + Int_t(fZQuench[isys] / (1. - fZQuench[isys]));
32c8e463 928 if (nGluon[isys] > fNGmax) nGluon[isys] = fNGmax;
b280c4cc 929 zquench[isys] = 1. - TMath::Power(1. - fZQuench[isys], 1./Double_t(nGluon[isys]));
4e383037 930 wjtKick[isys] = wjtKick[isys] / TMath::Sqrt(Double_t(nGluon[isys]));
0f482ae4 931
4e383037 932
933
934 Int_t igMin = -1;
935 Int_t igMax = -1;
936 Double_t pg[4] = {0., 0., 0., 0.};
937
938//
939// Loop on radiation events
940
941 for (Int_t iglu = 0; iglu < nGluon[isys]; iglu++) {
6e90ad26 942 while (1) {
943 icount = 0;
944 for (Int_t k = 0; k < 4; k++)
945 {
946 p0[isys][k] = 0.;
947 p1[isys][k] = 0.;
948 p2[isys][k] = 0.;
949 }
950// Loop over partons
951 for (Int_t i = 0; i < numpart; i++)
952 {
953 imo = fPyjets->K[2][i];
954 kst = fPyjets->K[0][i];
955 pdg = fPyjets->K[1][i];
956
957
958
0f482ae4 959// Quarks and gluons only
6e90ad26 960 if (pdg != 21 && TMath::Abs(pdg) > 6) continue;
0f482ae4 961// Particles from hard scattering only
c2c598a3 962
6e90ad26 963 if (imo > 8 && imo < 1000) imo = fPyjets->K[2][imo - 1];
c2c598a3 964 Int_t imom = imo % 1000;
965 if ((isys == 0 || isys == 1) && ((imom != (isys + 7)))) continue;
966 if ((isys == 2 || isys == 3) && ((imom != (isys + 1)))) continue;
967
6e90ad26 968
0f482ae4 969// Skip comment lines
6e90ad26 970 if (kst != 1 && kst != 2) continue;
0f482ae4 971//
972// Parton kinematic
6e90ad26 973 px = fPyjets->P[0][i];
974 py = fPyjets->P[1][i];
975 pz = fPyjets->P[2][i];
976 e = fPyjets->P[3][i];
977 m = fPyjets->P[4][i];
978 pt = TMath::Sqrt(px * px + py * py);
979 p = TMath::Sqrt(px * px + py * py + pz * pz);
980 phi = TMath::Pi() + TMath::ATan2(-py, -px);
981 theta = TMath::ATan2(pt, pz);
982
0f482ae4 983//
c2c598a3 984// Save 4-momentum sum for balancing
985 Int_t index = isys;
6e90ad26 986
987 p0[index][0] += px;
988 p0[index][1] += py;
989 p0[index][2] += pz;
990 p0[index][3] += e;
6e90ad26 991
992 klast[index] = i;
993
0f482ae4 994//
995// Fractional energy loss
b280c4cc 996 Double_t z = zquench[index];
4e383037 997
c2c598a3 998
4e383037 999// Don't fully quench radiated gluons
1000//
1001 if (imo > 1000) {
1002// This small factor makes sure that the gluons are not too close in phase space to avoid recombination
1003//
1004
c2c598a3 1005 z = 0.02;
4e383037 1006 }
c2c598a3 1007// printf("z: %d %f\n", imo, z);
1008
4e383037 1009
1010//
6e90ad26 1011
1012 //
1013 //
1014 // Transform into frame in which initial parton is along z-axis
1015 //
1016 TVector3 v(px, py, pz);
1017 v.RotateZ(-phiq[index]); v.RotateY(-thetaq[index]);
1018 Double_t pxs = v.X(); Double_t pys = v.Y(); Double_t pl = v.Z();
1019
1020 Double_t jt = TMath::Sqrt(pxs * pxs + pys * pys);
1021 Double_t mt2 = jt * jt + m * m;
1022 Double_t zmax = 1.;
1023 //
1024 // Kinematic limit on z
1025 //
4e383037 1026 if (m > 0.) zmax = 1. - m / TMath::Sqrt(m * m + jt * jt);
6e90ad26 1027 //
1028 // Change light-cone kinematics rel. to initial parton
1029 //
1030 Double_t eppzOld = e + pl;
1031 Double_t empzOld = e - pl;
1032
1033 Double_t eppzNew = (1. - z) * eppzOld;
1034 Double_t empzNew = empzOld - mt2 * z / eppzOld;
1035 Double_t eNew = 0.5 * (eppzNew + empzNew);
1036 Double_t plNew = 0.5 * (eppzNew - empzNew);
1037
1038 Double_t jtNew;
1039 //
1040 // if mt very small (or sometimes even < 0 for numerical reasons) set it to 0
1041 Double_t mt2New = eppzNew * empzNew;
1042 if (mt2New < 1.e-8) mt2New = 0.;
4e383037 1043 if (z < zmax) {
1044 if (m * m > mt2New) {
1045 //
1046 // This should not happen
1047 //
1048 Fatal("Quench()", "This should never happen %e %e %e!", m, eppzNew, empzNew);
1049 jtNew = 0;
1050 } else {
1051 jtNew = TMath::Sqrt(mt2New - m * m);
1052 }
6e90ad26 1053 } else {
4e383037 1054 // If pT is to small (probably a leading massive particle) we scale only the energy
1055 // This can cause negative masses of the radiated gluon
1056 // Let's hope for the best ...
1057 jtNew = jt;
1058 eNew = TMath::Sqrt(plNew * plNew + mt2);
1059
6e90ad26 1060 }
6e90ad26 1061 //
1062 // Calculate new px, py
1063 //
b07be423 1064 Double_t pxNew = 0;
1065 Double_t pyNew = 0;
6e90ad26 1066
b07be423 1067 if (jt>0) {
6b118b3c 1068 pxNew = jtNew / jt * pxs;
1069 pyNew = jtNew / jt * pys;
b07be423 1070 }
6e90ad26 1071// Double_t dpx = pxs - pxNew;
1072// Double_t dpy = pys - pyNew;
1073// Double_t dpz = pl - plNew;
1074// Double_t de = e - eNew;
1075// Double_t dmass2 = de * de - dpx * dpx - dpy * dpy - dpz * dpz;
1076// printf("New mass (1) %e %e %e %e %e %e %e \n", dmass2, jt, jtNew, pl, plNew, e, eNew);
1077// printf("New mass (2) %e %e \n", pxNew, pyNew);
1078 //
1079 // Rotate back
1080 //
1081 TVector3 w(pxNew, pyNew, plNew);
1082 w.RotateY(thetaq[index]); w.RotateZ(phiq[index]);
1083 pxNew = w.X(); pyNew = w.Y(); plNew = w.Z();
1084
1085 p1[index][0] += pxNew;
1086 p1[index][1] += pyNew;
1087 p1[index][2] += plNew;
1088 p1[index][3] += eNew;
1089 //
1090 // Updated 4-momentum vectors
1091 //
1092 pNew[icount][0] = pxNew;
1093 pNew[icount][1] = pyNew;
1094 pNew[icount][2] = plNew;
1095 pNew[icount][3] = eNew;
1096 kNew[icount] = i;
1097 icount++;
1098 } // parton loop
0f482ae4 1099 //
6e90ad26 1100 // Check if there was phase-space for quenching
0f482ae4 1101 //
0f482ae4 1102
6e90ad26 1103 if (icount == 0) quenched[isys] = kFALSE;
1104 if (!quenched[isys]) break;
1105
1106 for (Int_t j = 0; j < 4; j++)
1107 {
1108 p2[isys][j] = p0[isys][j] - p1[isys][j];
1109 }
1110 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];
6e90ad26 1111 if (p2[isys][4] > 0.) {
1112 p2[isys][4] = TMath::Sqrt(p2[isys][4]);
1113 break;
1114 } else {
b280c4cc 1115 printf("Warning negative mass squared in system %d %f ! \n", isys, zquench[isys]);
4e383037 1116 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]);
6e90ad26 1117 if (p2[isys][4] < -0.01) {
4e383037 1118 printf("Negative mass squared !\n");
1119 // Here we have to put the gluon back to mass shell
1120 // This will lead to a small energy imbalance
1121 p2[isys][4] = 0.;
1122 p2[isys][3] = TMath::Sqrt(p2[isys][0] * p2[isys][0] + p2[isys][1] * p2[isys][1] + p2[isys][2] * p2[isys][2]);
1123 break;
6e90ad26 1124 } else {
1125 p2[isys][4] = 0.;
1126 break;
1127 }
1128 }
6e90ad26 1129 /*
6e90ad26 1130 zHeavy *= 0.98;
1131 printf("zHeavy lowered to %f\n", zHeavy);
1132 if (zHeavy < 0.01) {
1133 printf("No success ! \n");
1134 icount = 0;
1135 quenched[isys] = kFALSE;
1136 break;
1137 }
4e383037 1138 */
1139 } // iteration on z (while)
1140
6e90ad26 1141// Update event record
1142 for (Int_t k = 0; k < icount; k++) {
1143// 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] );
1144 fPyjets->P[0][kNew[k]] = pNew[k][0];
1145 fPyjets->P[1][kNew[k]] = pNew[k][1];
1146 fPyjets->P[2][kNew[k]] = pNew[k][2];
1147 fPyjets->P[3][kNew[k]] = pNew[k][3];
0f482ae4 1148 }
4e383037 1149 //
1150 // Add the gluons
1151 //
1152 Int_t ish = 0;
1837e95c 1153 Int_t iGlu;
4e383037 1154 if (!quenched[isys]) continue;
0f482ae4 1155//
1156// Last parton from shower i
4e383037 1157 Int_t in = klast[isys];
0f482ae4 1158//
1159// Continue if no parton in shower i selected
1160 if (in == -1) continue;
1161//
1162// If this is the second initial parton and it is behind the first move pointer by previous ish
4e383037 1163 if (isys == 1 && klast[1] > klast[0]) in += ish;
0f482ae4 1164//
1165// Starting index
452af8c7 1166
4e383037 1167// jmin = in - 1;
0f482ae4 1168// How many additional gluons will be generated
1169 ish = 1;
4e383037 1170 if (p2[isys][4] > 0.05) ish = 2;
0f482ae4 1171//
1172// Position of gluons
4e383037 1173 iGlu = numpart;
1174 if (iglu == 0) igMin = iGlu;
1175 igMax = iGlu;
0f482ae4 1176 numpart += ish;
1177 (fPyjets->N) += ish;
4e383037 1178
0f482ae4 1179 if (ish == 1) {
4e383037 1180 fPyjets->P[0][iGlu] = p2[isys][0];
1181 fPyjets->P[1][iGlu] = p2[isys][1];
1182 fPyjets->P[2][iGlu] = p2[isys][2];
1183 fPyjets->P[3][iGlu] = p2[isys][3];
1184 fPyjets->P[4][iGlu] = p2[isys][4];
0f482ae4 1185
4e383037 1186 fPyjets->K[0][iGlu] = 1;
1187 if (iglu == nGluon[isys] - 1) fPyjets->K[0][iGlu] = 1;
0f482ae4 1188 fPyjets->K[1][iGlu] = 21;
4e383037 1189 fPyjets->K[2][iGlu] = fPyjets->K[2][in] + 1000;
0f482ae4 1190 fPyjets->K[3][iGlu] = -1;
1191 fPyjets->K[4][iGlu] = -1;
4e383037 1192
1193 pg[0] += p2[isys][0];
1194 pg[1] += p2[isys][1];
1195 pg[2] += p2[isys][2];
1196 pg[3] += p2[isys][3];
0f482ae4 1197 } else {
1198 //
1199 // Split gluon in rest frame.
1200 //
4e383037 1201 Double_t bx = p2[isys][0] / p2[isys][3];
1202 Double_t by = p2[isys][1] / p2[isys][3];
1203 Double_t bz = p2[isys][2] / p2[isys][3];
1204 Double_t pst = p2[isys][4] / 2.;
0f482ae4 1205 //
1206 // Isotropic decay ????
1207 Double_t cost = 2. * gRandom->Rndm() - 1.;
60e55aee 1208 Double_t sint = TMath::Sqrt((1.-cost)*(1.+cost));
2ab330c9 1209 Double_t phis = 2. * TMath::Pi() * gRandom->Rndm();
0f482ae4 1210
1211 Double_t pz1 = pst * cost;
1212 Double_t pz2 = -pst * cost;
1213 Double_t pt1 = pst * sint;
1214 Double_t pt2 = -pst * sint;
2ab330c9 1215 Double_t px1 = pt1 * TMath::Cos(phis);
1216 Double_t py1 = pt1 * TMath::Sin(phis);
1217 Double_t px2 = pt2 * TMath::Cos(phis);
1218 Double_t py2 = pt2 * TMath::Sin(phis);
0f482ae4 1219
1220 fPyjets->P[0][iGlu] = px1;
1221 fPyjets->P[1][iGlu] = py1;
1222 fPyjets->P[2][iGlu] = pz1;
1223 fPyjets->P[3][iGlu] = pst;
1224 fPyjets->P[4][iGlu] = 0.;
1225
4e383037 1226 fPyjets->K[0][iGlu] = 1 ;
0f482ae4 1227 fPyjets->K[1][iGlu] = 21;
4e383037 1228 fPyjets->K[2][iGlu] = fPyjets->K[2][in] + 1000;
0f482ae4 1229 fPyjets->K[3][iGlu] = -1;
1230 fPyjets->K[4][iGlu] = -1;
1231
1232 fPyjets->P[0][iGlu+1] = px2;
1233 fPyjets->P[1][iGlu+1] = py2;
1234 fPyjets->P[2][iGlu+1] = pz2;
1235 fPyjets->P[3][iGlu+1] = pst;
1236 fPyjets->P[4][iGlu+1] = 0.;
1237
4e383037 1238 fPyjets->K[0][iGlu+1] = 1;
1239 if (iglu == nGluon[isys] - 1) fPyjets->K[0][iGlu+1] = 1;
0f482ae4 1240 fPyjets->K[1][iGlu+1] = 21;
4e383037 1241 fPyjets->K[2][iGlu+1] = fPyjets->K[2][in] + 1000;
0f482ae4 1242 fPyjets->K[3][iGlu+1] = -1;
1243 fPyjets->K[4][iGlu+1] = -1;
1244 SetMSTU(1,0);
1245 SetMSTU(2,0);
1246 //
1247 // Boost back
1248 //
1249 Pyrobo(iGlu + 1, iGlu + 2, 0., 0., bx, by, bz);
1250 }
4e383037 1251/*
1252 for (Int_t ig = iGlu; ig < iGlu+ish; ig++) {
1253 Double_t px, py, pz;
1254 px = fPyjets->P[0][ig];
1255 py = fPyjets->P[1][ig];
1256 pz = fPyjets->P[2][ig];
1257 TVector3 v(px, py, pz);
1258 v.RotateZ(-phiq[isys]);
1259 v.RotateY(-thetaq[isys]);
1260 Double_t pxs = v.X(); Double_t pys = v.Y(); Double_t pzs = v.Z();
1261 Double_t r = AliPythiaRndm::GetPythiaRandom()->Rndm();
1262 Double_t jtKick = 0.3 * TMath::Sqrt(-TMath::Log(r));
1263 if (ish == 2) jtKick = wjtKick[i] * TMath::Sqrt(-TMath::Log(r)) / TMath::Sqrt(2.);
1264 Double_t phiKick = 2. * TMath::Pi() * AliPythiaRndm::GetPythiaRandom()->Rndm();
1265 pxs += jtKick * TMath::Cos(phiKick);
1266 pys += jtKick * TMath::Sin(phiKick);
1267 TVector3 w(pxs, pys, pzs);
1268 w.RotateY(thetaq[isys]);
1269 w.RotateZ(phiq[isys]);
1270 fPyjets->P[0][ig] = w.X();
1271 fPyjets->P[1][ig] = w.Y();
1272 fPyjets->P[2][ig] = w.Z();
1273 fPyjets->P[2][ig] = w.Mag();
1274 }
1275*/
1276 } // kGluon
1277
6e90ad26 1278
4e383037 1279 // Check energy conservation
0f482ae4 1280 Double_t pxs = 0.;
1281 Double_t pys = 0.;
1282 Double_t pzs = 0.;
1283 Double_t es = 14000.;
1284
1285 for (Int_t i = 0; i < numpart; i++)
1286 {
1287 kst = fPyjets->K[0][i];
1288 if (kst != 1 && kst != 2) continue;
1289 pxs += fPyjets->P[0][i];
1290 pys += fPyjets->P[1][i];
1291 pzs += fPyjets->P[2][i];
1292 es -= fPyjets->P[3][i];
1293 }
1294 if (TMath::Abs(pxs) > 1.e-2 ||
1295 TMath::Abs(pys) > 1.e-2 ||
1296 TMath::Abs(pzs) > 1.e-1) {
1297 printf("%e %e %e %e\n", pxs, pys, pzs, es);
4e383037 1298// Fatal("Quench()", "4-Momentum non-conservation");
452af8c7 1299 }
4e383037 1300
1301 } // end quenching loop (systems)
6e90ad26 1302// Clean-up
0f482ae4 1303 for (Int_t i = 0; i < numpart; i++)
1304 {
4e383037 1305 imo = fPyjets->K[2][i];
1306 if (imo > 1000) {
1307 fPyjets->K[2][i] = fPyjets->K[2][i] % 1000;
1308 }
0f482ae4 1309 }
4e383037 1310// this->Pylist(1);
0f482ae4 1311} // end quench
90d7b703 1312
992f2843 1313
1314void AliPythia::Pyquen(Double_t a, Int_t ibf, Double_t b)
1315{
1316 // Igor Lokthine's quenching routine
12cb0bc0 1317 // http://lokhtin.web.cern.ch/lokhtin/pyquen/pyquen.txt
1318
992f2843 1319 pyquen(a, ibf, b);
1320}
b280c4cc 1321
12cb0bc0 1322void AliPythia::SetPyquenParameters(Double_t t0, Double_t tau0, Int_t nf, Int_t iengl, Int_t iangl)
1323{
1324 // Set the parameters for the PYQUEN package.
1325 // See comments in PyquenCommon.h
1326
1327
1328 PYQPAR.t0 = t0;
1329 PYQPAR.tau0 = tau0;
1330 PYQPAR.nf = nf;
1331 PYQPAR.iengl = iengl;
1332 PYQPAR.iangl = iangl;
1333}
1334
1335
16a82508 1336void AliPythia::Pyevnw()
1337{
1338 // New multiple interaction scenario
1339 pyevnw();
1340}
1341
cd07c39b 1342void AliPythia::Pyshowq(Int_t ip1, Int_t ip2, Double_t qmax)
1343{
1344 // Call medium-modified Pythia jet reconstruction algorithm
1345 //
1346 pyshowq(ip1, ip2, qmax);
1347}
6c43eccb 1348 void AliPythia::Qpygin0()
1349 {
1350 // New multiple interaction scenario
1351 qpygin0();
1352 }
cd07c39b 1353
b280c4cc 1354void AliPythia::GetQuenchingParameters(Double_t& xp, Double_t& yp, Double_t z[4])
1355{
1356 // Return event specific quenching parameters
1357 xp = fXJet;
1358 yp = fYJet;
1359 for (Int_t i = 0; i < 4; i++) z[i] = fZQuench[i];
1360
1361}
1362
3dc3ec94 1363void AliPythia::ConfigHeavyFlavor()
1364{
1365 //
1366 // Default configuration for Heavy Flavor production
1367 //
1368 // All QCD processes
1369 //
1370 SetMSEL(1);
1371
1372 // No multiple interactions
1373 SetMSTP(81,0);
39c2e610 1374 SetPARP(81, 0.);
1375 SetPARP(82, 0.);
3dc3ec94 1376 // Initial/final parton shower on (Pythia default)
1377 SetMSTP(61,1);
1378 SetMSTP(71,1);
1379
1380 // 2nd order alpha_s
1381 SetMSTP(2,2);
1382
1383 // QCD scales
1384 SetMSTP(32,2);
1385 SetPARP(34,1.0);
1386}
e0e89f40 1387
1388void AliPythia::AtlasTuning()
1389{
1390 //
1391 // Configuration for the ATLAS tuning
0bd3d7c5 1392 if (fItune > -1) return;
1393 printf("ATLAS TUNE \n");
1394
1395 SetMSTP(51, AliStructFuncType::PDFsetIndex(kCTEQ5L)); // CTEQ5L pdf
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
1409void AliPythia::AtlasTuning_MC09()
1410{
1411 //
1412 // Configuration for the ATLAS tuning
1413 if (fItune > -1) return;
1414 printf("ATLAS New TUNE MC09\n");
1415 SetMSTP(81,21); // treatment for MI, ISR, FSR and beam remnants: MI on, new model
1416 SetMSTP(82, 4); // Double Gaussian Model
1417 SetMSTP(52, 2); // External PDF
1418 SetMSTP(51, 20650); // MRST LO*
1419
1420
1421 SetMSTP(70, 0); // (was 2: def manual 1, def code 0) virtuality scale for ISR
1422 SetMSTP(72, 1); // (was 0: def 1) maximum scale for FSR
1423 SetMSTP(88, 1); // (was 0: def 1) strategy for qq junction to di-quark or baryon in beam remnant
1424 SetMSTP(90, 0); // (was 1: def 0) strategy of compensate the primordial kT
1425
1426 SetPARP(78, 0.3); // the amount of color reconnection in the final state
1427 SetPARP(80, 0.1); // probability of color partons kicked out from beam remnant
1428 SetPARP(82, 2.3); // [GeV] PT_min at Ref. energy
1429 SetPARP(83, 0.8); // Core density in proton matter distribution (def.value)
1430 SetPARP(84, 0.7); // Core radius
1431 SetPARP(90, 0.25); // 2*epsilon (exponent in power law)
1432 SetPARJ(81, 0.29); // (was 0.14: def 0.29) Labmda value in running alpha_s for parton showers
1433
1434 SetMSTP(95, 6);
1435 SetPARJ(41, 0.3); // a and b parameters of the symmm. Lund FF
1436 SetPARJ(42, 0.58);
1437 SetPARJ(46, 0.75); // mod. of the Lund FF for heavy end-point quarks
1438 SetPARP(89,1800.); // [GeV] Ref. energy
e0e89f40 1439}
e8a8adcd 1440
1441AliPythia& AliPythia::operator=(const AliPythia& rhs)
1442{
1443// Assignment operator
1444 rhs.Copy(*this);
1445 return *this;
1446}
1447
1448 void AliPythia::Copy(TObject&) const
1449{
1450 //
1451 // Copy
1452 //
1453 Fatal("Copy","Not implemented!\n");
1454}
cd07c39b 1455