-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathAliPythia8_dev.cxx
245 lines (208 loc) · 6.35 KB
/
AliPythia8_dev.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
/**************************************************************************
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* *
* Author: The ALICE Off-line Project. *
* Contributors are mentioned in the code where appropriate. *
* *
* Permission to use, copy, modify and distribute this software and its *
* documentation strictly for non-commercial purposes is hereby granted *
* without fee, provided that the above copyright notice appears in all *
* copies and that both the copyright notice and this permission notice *
* appear in the supporting documentation. The authors make no claims *
* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
#include <AliLog.h>
#include <AliStack.h>
#include <AliPythiaRndm.h>
#include <Pythia8/Analysis.h>
#include "AliPythia8_dev.h"
ClassImp(AliPythia8_dev)
AliPythia8_dev::AliPythia8_dev():
AliTPythia8(),
AliPythiaBase_dev(),
fProcess(kPyMbDefault),
fItune(-1),
fEcms(0.),
fStrucFunc(-1),
fLHEFile()
{
// Default Constructor
//
// Set random number
if (!AliPythiaRndm::GetPythiaRandom()) AliPythiaRndm::SetPythiaRandom(GetRandom());
}
void AliPythia8_dev::ProcInit(Process_t process, Float_t energy, Int_t strucfunc, Int_t tune)
{
// Initialise the process to generate
if (!AliPythiaRndm::GetPythiaRandom())
AliPythiaRndm::SetPythiaRandom(GetRandom());
fProcess = process;
fEcms = energy;
fStrucFunc = strucfunc;
fItune = tune;
if (tune > -1) ReadString(Form("Tune:pp = %3d", tune));
// Pythia initialisation for selected processes
switch (process) {
case kPyMbDefault:
// All soft QCD processes
ReadString("SoftQCD:inelastic = on");
break;
case kPyMbNonDiffr:
// Inelastic non-diffractive collisions -> should correspond to experimental minimum-bias
ReadString("SoftQCD:nonDiffractive = on");
break;
case kPyJets:
// QCD Jets
ReadString("HardQCD:all = on");
break;
case kPyCharm:
ReadString("HardQCD:gg2ccbar = on");
ReadString("HardQCD:qqbar2ccbar = on");
// heavy quark mass
ReadString("ParticleData:mcRun = 1.5");
break;
case kPyBeauty:
ReadString("HardQCD:gg2bbbar = on");
ReadString("HardQCD:qqbar2bbbar = on");
// heavy quark mass
ReadString("ParticleData:mbRun = 4.75");
break;
case kPyJetsPWHG:
case kPyCharmPWHG:
case kPyBeautyPWHG:
// POWHEG
if (!fLHEFile.IsNull()) {
ReadConfigFile("powheg_pythia8_conf.cmnd");
ReadString(TString::Format("Beams:LHEF = %s", fLHEFile.Data()));
}
break;
default:
AliWarningStream() << "Process '" << process << "' not implemented!!" << std::endl;
break;
}
// Select structure function
if (fStrucFunc >= 0) {
// In order to use LHAPDF PYTHIA8 must be configured and compiled with the correct settings
// This is not the case in AliRoot
//ReadString("PDF:useLHAPDF = on");
//ReadString(TString::Format("PDF:LHAPDFset = %s", AliStructFuncType::PDFsetName((StrucFunc_t)fStrucFunc).Data()));
Int_t pdf_code = PYTHIA8PDFsetName((StrucFunc_t)fStrucFunc);
if (pdf_code == 0) {
AliErrorStream() << "PDF '" << AliStructFuncType::PDFsetName((StrucFunc_t)fStrucFunc).Data() << "(" << fStrucFunc << ") not available for PYTHIA8" << std::endl;
}
else {
ReadString(TString::Format("PDF:pSet = %d", pdf_code));
}
}
// Initialize PYTHIA
Initialize(2212, 2212, fEcms);
}
Int_t AliPythia8_dev::PYTHIA8PDFsetName(StrucFunc_t s)
{
switch(s) {
case kCTEQ5L:
return 2;
break;
case kCTEQ6l:
return 7;
break;
default:
return 0;
break;
}
}
void AliPythia8_dev::SetDecayOff(const std::set<int>& pdg_codes)
{
for (auto pdg : pdg_codes) ReadString(Form("%d:onMode = off",pdg));
}
void AliPythia8_dev::SetSeed(UInt_t seed)
{
// set seed in PYTHIA8
// NB. 900000000 is the maximum seed (0 is not allowed)
SetPythiaSeed(seed);
}
void AliPythia8_dev::SetNuclei(Int_t /*a1*/, Int_t /*a2*/, Int_t /*pdg*/)
{
AliErrorStream() << "AliPythia8_dev::SetNuclei not implemented!" << std::endl;
}
Bool_t AliPythia8_dev::EndOfLHEFileReached()
{
if (!fPythia) return kFALSE;
if (fLHEFile.IsNull()) return kFALSE;
return fPythia->info.atEndOfFile();
}
void AliPythia8_dev::GenerateEvent()
{
// Generate one event
AliTPythia8::GenerateEvent();
}
void AliPythia8_dev::PrintStatistics()
{
// End of run statistics
AliTPythia8::PrintStatistics();
}
void AliPythia8_dev::EventListing()
{
// End of run statistics
AliTPythia8::EventListing();
}
Int_t AliPythia8_dev::ProcessCode()
{
// Returns the subprocess code for the current event
return Pythia8()->info.code();
}
void AliPythia8_dev::SetPtHardRange(Float_t ptmin, Float_t ptmax)
{
// Set the pt hard range
ReadString(Form("PhaseSpace:pTHatMin = %13.3f", ptmin));
ReadString(Form("PhaseSpace:pTHatMax = %13.3f", ptmax));
}
void AliPythia8_dev::SetYHardRange(Float_t /*ymin*/, Float_t /*ymax*/)
{
// Set the y hard range
AliWarningStream() << "YHardRange not implemented in PYTHIA 8." << std::endl;
}
void AliPythia8_dev::SetInitialAndFinalStateRadiation(Int_t flag1, Int_t flag2)
{
// initial state radiation
if (flag1) {
ReadString("PartonLevel:ISR = on");
} else {
ReadString("PartonLevel:ISR = off");
}
// final state radiation
if (flag2) {
ReadString("PartonLevel:FSR = on");
} else {
ReadString("PartonLevel:FSR = off");
}
}
void AliPythia8_dev::GetXandQ(Float_t& x1, Float_t& x2, Float_t& q)
{
// Get x1, x2 and Q for this event
q = Pythia8()->info.QFac();
x1 = Pythia8()->info.x1();
x2 = Pythia8()->info.x2();
}
Float_t AliPythia8_dev::GetXSection()
{
// Get the total cross-section
return Pythia8()->info.sigmaGen();
}
Float_t AliPythia8_dev::GetPtHard()
{
// Get the pT hard for this event
return Pythia8()->info.pTHat();
}
Float_t AliPythia8_dev::GetEventWeight()
{
// Get the event weight
Float_t w = Pythia8()->info.weight();
return w;
}
void AliPythia8_dev::PrintParticles()
{
// Print list of particl properties
ReadString("Main:showAllParticleData");
}