13 #ifndef Pythia8_LesHouches_H
14 #define Pythia8_LesHouches_H
16 #include "Pythia8/Event.h"
17 #include "Pythia8/Info.h"
18 #include "Pythia8/PythiaStdlib.h"
19 #include "Pythia8/Settings.h"
32 LHAProcess() : idProc(0), xSecProc(0.), xErrProc(0.), xMaxProc(0.) { }
33 LHAProcess(
int idProcIn,
double xSecIn,
double xErrIn,
double xMaxIn) :
34 idProc(idProcIn), xSecProc(xSecIn), xErrProc(xErrIn),
39 double xSecProc, xErrProc, xMaxProc;
52 LHAParticle() : idPart(0), statusPart(0), mother1Part(0),
53 mother2Part(0), col1Part(0), col2Part(0), pxPart(0.), pyPart(0.),
54 pzPart(0.), ePart(0.), mPart(0.), tauPart(0.), spinPart(9.),
56 LHAParticle(
int idIn,
int statusIn,
int mother1In,
int mother2In,
57 int col1In,
int col2In,
double pxIn,
double pyIn,
double pzIn,
58 double eIn,
double mIn,
double tauIn,
double spinIn,
60 idPart(idIn), statusPart(statusIn), mother1Part(mother1In),
61 mother2Part(mother2In), col1Part(col1In), col2Part(col2In),
62 pxPart(pxIn), pyPart(pyIn), pzPart(pzIn), ePart(eIn), mPart(mIn),
63 tauPart(tauIn), spinPart(spinIn), scalePart(scaleIn) { }
66 int idPart, statusPart, mother1Part, mother2Part, col1Part, col2Part;
67 double pxPart, pyPart, pzPart, ePart, mPart, tauPart, spinPart,
85 void setPtr(Info* infoPtrIn) {infoPtr = infoPtrIn;}
88 virtual void newEventFile(
const char*) {}
89 virtual bool fileFound() {
return true;}
94 virtual bool setInit() = 0;
97 int idBeamA()
const {
return idBeamASave;}
98 int idBeamB()
const {
return idBeamBSave;}
99 double eBeamA()
const {
return eBeamASave;}
100 double eBeamB()
const {
return eBeamBSave;}
101 int pdfGroupBeamA()
const {
return pdfGroupBeamASave;}
102 int pdfGroupBeamB()
const {
return pdfGroupBeamBSave;}
103 int pdfSetBeamA()
const {
return pdfSetBeamASave;}
104 int pdfSetBeamB()
const {
return pdfSetBeamBSave;}
107 int strategy()
const {
return strategySave;}
110 int sizeProc()
const {
return processes.size();}
111 int idProcess(
int proc)
const {
return processes[proc].idProc;}
112 double xSec(
int proc)
const {
return processes[proc].xSecProc;}
113 double xErr(
int proc)
const {
return processes[proc].xErrProc;}
114 double xMax(
int proc)
const {
return processes[proc].xMaxProc;}
115 double xSecSum()
const {
return xSecSumSave;}
116 double xErrSum()
const {
return xErrSumSave;}
119 void listInit(ostream& os = cout);
128 virtual bool setEvent(
int idProcIn = 0,
double mRecalculate = -1.) = 0;
131 int idProcess()
const {
return idProc;}
132 double weight()
const {
return weightProc;}
133 double scale()
const {
return scaleProc;}
134 double alphaQED()
const {
return alphaQEDProc;}
135 double alphaQCD()
const {
return alphaQCDProc;}
138 int sizePart()
const {
return particles.size();}
139 int id(
int part)
const {
return particles[part].idPart;}
140 int status(
int part)
const {
return particles[part].statusPart;}
141 int mother1(
int part)
const {
return particles[part].mother1Part;}
142 int mother2(
int part)
const {
return particles[part].mother2Part;}
143 int col1(
int part)
const {
return particles[part].col1Part;}
144 int col2(
int part)
const {
return particles[part].col2Part;}
145 double px(
int part)
const {
return particles[part].pxPart;}
146 double py(
int part)
const {
return particles[part].pyPart;}
147 double pz(
int part)
const {
return particles[part].pzPart;}
148 double e(
int part)
const {
return particles[part].ePart;}
149 double m(
int part)
const {
return particles[part].mPart;}
150 double tau(
int part)
const {
return particles[part].tauPart;}
151 double spin(
int part)
const {
return particles[part].spinPart;}
152 double scale(
int part)
const {
return particles[part].scalePart;}
155 int id1()
const {
return id1Save;}
156 int id2()
const {
return id2Save;}
157 double x1()
const {
return x1Save;}
158 double x2()
const {
return x2Save;}
161 bool pdfIsSet()
const {
return pdfIsSetSave;}
162 int id1pdf()
const {
return id1pdfSave;}
163 int id2pdf()
const {
return id2pdfSave;}
164 double x1pdf()
const {
return x1pdfSave;}
165 double x2pdf()
const {
return x2pdfSave;}
166 double scalePDF()
const {
return scalePDFSave;}
167 double pdf1()
const {
return pdf1Save;}
168 double pdf2()
const {
return pdf2Save;}
171 void listEvent(ostream& os = cout);
175 virtual bool skipEvent(
int nSkip) {
176 for (
int iSkip = 0; iSkip < nSkip; ++iSkip)
177 if (!setEvent())
return false;
return true;}
180 bool openLHEF(
string fileNameIn);
182 bool eventLHEF(
bool verbose =
true);
183 bool closeLHEF(
bool updateInit =
false);
186 string getFileName()
const {
return fileName;}
191 LHAup(
int strategyIn = 3) : fileName(
"void"), strategySave(strategyIn)
192 { processes.reserve(10); particles.reserve(20);
193 setBeamA( 0, 0., 0, 0); setBeamB( 0, 0., 0, 0); }
196 static const double CONVERTMB2PB;
202 void setBeamA(
int idIn,
double eIn,
int pdfGroupIn = 0,
int pdfSetIn = 0)
203 { idBeamASave = idIn; eBeamASave = eIn; pdfGroupBeamASave = pdfGroupIn;
204 pdfSetBeamASave = pdfSetIn;}
205 void setBeamB(
int idIn,
double eIn,
int pdfGroupIn = 0,
int pdfSetIn = 0)
206 { idBeamBSave = idIn; eBeamBSave = eIn; pdfGroupBeamBSave = pdfGroupIn;
207 pdfSetBeamBSave = pdfSetIn;}
210 void setStrategy(
int strategyIn) {strategySave = strategyIn;}
213 void addProcess(
int idProcIn,
double xSecIn = 1.,
double xErrIn = 0.,
214 double xMaxIn = 1.) { processes.push_back( LHAProcess( idProcIn,
215 xSecIn, xErrIn, xMaxIn)); }
218 void setXSec(
int iP,
double xSecIn) {processes[iP].xSecProc = xSecIn;}
219 void setXErr(
int iP,
double xErrIn) {processes[iP].xErrProc = xErrIn;}
220 void setXMax(
int iP,
double xMaxIn) {processes[iP].xMaxProc = xMaxIn;}
223 void setProcess(
int idProcIn = 0,
double weightIn = 1.,
double
224 scaleIn = 0.,
double alphaQEDIn = 0.0073,
double alphaQCDIn = 0.12) {
225 idProc = idProcIn; weightProc = weightIn; scaleProc = scaleIn;
226 alphaQEDProc = alphaQEDIn; alphaQCDProc = alphaQCDIn;
228 particles.clear(); addParticle(0); pdfIsSetSave =
false;}
231 void addParticle(LHAParticle particleIn) {
232 particles.push_back(particleIn);}
233 void addParticle(
int idIn,
int statusIn = 0,
int mother1In = 0,
234 int mother2In = 0,
int col1In = 0,
int col2In = 0,
double pxIn = 0.,
235 double pyIn = 0.,
double pzIn = 0.,
double eIn = 0.,
double mIn = 0.,
236 double tauIn = 0.,
double spinIn = 9.,
double scaleIn = -1.) {
237 particles.push_back( LHAParticle( idIn, statusIn, mother1In, mother2In,
238 col1In, col2In, pxIn, pyIn, pzIn, eIn, mIn, tauIn, spinIn,
242 void setIdX(
int id1In,
int id2In,
double x1In,
double x2In)
243 { id1Save = id1In; id2Save = id2In; x1Save = x1In; x2Save = x2In;}
246 void setPdf(
int id1pdfIn,
int id2pdfIn,
double x1pdfIn,
double x2pdfIn,
247 double scalePDFIn,
double pdf1In,
double pdf2In,
bool pdfIsSetIn)
248 { id1pdfSave = id1pdfIn; id2pdfSave = id2pdfIn; x1pdfSave = x1pdfIn;
249 x2pdfSave = x2pdfIn; scalePDFSave = scalePDFIn; pdf1Save = pdf1In;
250 pdf2Save = pdf2In; pdfIsSetSave = pdfIsSetIn;}
253 bool setInitLHEF(istream& is,
bool readHeaders =
false);
254 bool setNewEventLHEF(istream& is,
double mRecalculate = -1.);
255 bool setOldEventLHEF();
262 istream* openFile(
const char *fn, ifstream &ifs);
263 void closeFile(istream *&is, ifstream &ifs);
268 void setInfoHeader(
const string &key,
const string &val) {
269 infoPtr->setHeader(key, val); }
272 int nupSave, idprupSave;
273 double xwgtupSave, scalupSave, aqedupSave, aqcdupSave, xSecSumSave,
275 vector<LHAParticle> particlesSave;
276 bool getPDFSave, getScale;
277 int id1InSave, id2InSave, id1pdfInSave, id2pdfInSave;
278 double x1InSave, x2InSave, x1pdfInSave, x2pdfInSave, scalePDFInSave,
279 pdf1InSave, pdf2InSave;
293 int idBeamASave, idBeamBSave;
294 double eBeamASave, eBeamBSave;
295 int pdfGroupBeamASave, pdfGroupBeamBSave, pdfSetBeamASave,
299 vector<LHAProcess> processes;
303 double weightProc, scaleProc, alphaQEDProc, alphaQCDProc;
306 vector<LHAParticle> particles;
310 int id1Save, id2Save, id1pdfSave, id2pdfSave;
311 double x1Save, x2Save, x1pdfSave, x2pdfSave, scalePDFSave, pdf1Save,
320 class LHAupLHEF :
public LHAup {
325 LHAupLHEF(
const char* fileIn,
const char* headerIn = NULL,
326 bool readHeaders =
false);
332 void closeAllFiles() {
334 if (isHead != is) closeFile(isHead, ifsHead);
339 void newEventFile(
const char* fileIn) {
342 is = openFile(fileIn, ifs);
350 bool fileFound() {
return (isHead->good() && is->good()); }
353 bool setInit() {
return setInitLHEF(*isHead, readHeaders);}
356 bool setEvent(
int = 0,
double mRecalculate = -1.) {
357 if (!setNewEventLHEF(*is, mRecalculate))
return false;
358 return setOldEventLHEF();
362 bool skipEvent(
int nSkip) {
for (
int iSkip = 0; iSkip < nSkip; ++iSkip)
363 if (!setNewEventLHEF(*is))
return false;
return true;}
369 ifstream ifs, ifsHead;
370 istream *is, *isHead;
380 class LHAupFromPYTHIA8 :
public LHAup {
385 LHAupFromPYTHIA8(
Event* processPtrIn, Info* infoPtrIn) {
386 processPtr = processPtrIn; infoPtr = infoPtrIn;}
389 ~LHAupFromPYTHIA8() {}
395 bool setEvent(
int = 0,
double = -1.);
412 #endif // Pythia8_LesHouches_H