PYTHIA  8.312
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
LHAup Class Referenceabstract

#include <LesHouches.h>

Inheritance diagram for LHAup:
LHAupAlpgen LHAupFortran LHAupFromPYTHIA8 LHAupH5 LHAupH5v2 LHAupHelaconia LHAupLHEF LHAupMadgraph LHEF3FromPythia8

Public Member Functions

virtual ~LHAup ()
 Destructor.
 
void setPtr (Info *infoPtrIn)
 Set pointers.
 
virtual void newEventFile (const char *)
 Method to be used for LHAupLHEF derived class.
 
virtual bool fileFound ()
 
virtual bool useExternal ()
 
virtual bool setInit ()=0
 
int idBeamA () const
 Give back info on beams.
 
int idBeamB () const
 
double eBeamA () const
 
double eBeamB () const
 
int pdfGroupBeamA () const
 
int pdfGroupBeamB () const
 
int pdfSetBeamA () const
 
int pdfSetBeamB () const
 
int strategy () const
 Give back weight strategy.
 
int sizeProc () const
 Give back info on processes.
 
int idProcess (int proc) const
 
double xSec (int proc) const
 
double xErr (int proc) const
 
double xMax (int proc) const
 
double xSecSum () const
 
double xErrSum () const
 
void listInit ()
 Print the initialization info; useful to check that setting it worked. More...
 
virtual bool setEvent (int idProcIn=0)=0
 
int idProcess () const
 Give back process number, weight, scale, alpha_em, alpha_s.
 
double weight () const
 
double scale () const
 
double alphaQED () const
 
double alphaQCD () const
 
int sizePart () const
 Give back info on separate particle.
 
int id (int part) const
 
int status (int part) const
 
int mother1 (int part) const
 
int mother2 (int part) const
 
int col1 (int part) const
 
int col2 (int part) const
 
double px (int part) const
 
double py (int part) const
 
double pz (int part) const
 
double e (int part) const
 
double m (int part) const
 
double tau (int part) const
 
double spin (int part) const
 
double scale (int part) const
 
int id1 () const
 Give back info on flavour and x values of hard-process initiators.
 
int id2 () const
 
double x1 () const
 
double x2 () const
 
bool pdfIsSet () const
 Optional: give back info on parton density values of event.
 
int id1pdf () const
 
int id2pdf () const
 
double x1pdf () const
 
double x2pdf () const
 
double scalePDF () const
 
double pdf1 () const
 
double pdf2 () const
 
bool scaleShowersIsSet () const
 Optional: give back info on parton shower scales.
 
double scaleShowers (int i) const
 
void listEvent ()
 Print the info; useful to check that reading an event worked. More...
 
virtual bool skipEvent (int nSkip)
 
virtual bool openLHEF (string fileNameIn)
 Four routines to write a Les Houches Event file in steps. More...
 
virtual bool closeLHEF (bool updateInit=false)
 Write end of a Les Houches Event File and close it. More...
 
bool initLHEF ()
 Write initialization information to a Les Houches Event File. More...
 
bool eventLHEF (bool verbose=true)
 
string getFileName () const
 Get access to the Les Houches Event file name.
 

Protected Member Functions

 LHAup (int strategyIn=3)
 Constructor. Sets default to be that events come with unit weight.
 
void setBeamA (int idIn, double eIn, int pdfGroupIn=0, int pdfSetIn=0)
 Input beam info.
 
void setBeamB (int idIn, double eIn, int pdfGroupIn=0, int pdfSetIn=0)
 
void setStrategy (int strategyIn)
 Input process weight strategy.
 
void addProcess (int idProcIn, double xSecIn=1., double xErrIn=0., double xMaxIn=1.)
 Input process info.
 
void setXSec (int iP, double xSecIn)
 Possibility to update some cross section info at end of run.
 
void setXErr (int iP, double xErrIn)
 
void setXMax (int iP, double xMaxIn)
 
void setProcess (int idProcIn=0, double weightIn=1., double scaleIn=0., double alphaQEDIn=0.0073, double alphaQCDIn=0.12)
 Input info on the selected process. More...
 
void addParticle (LHAParticle particleIn)
 Input particle info, one particle at the time.
 
void addParticle (int idIn, int statusIn=0, int mother1In=0, int mother2In=0, int col1In=0, int col2In=0, double pxIn=0., double pyIn=0., double pzIn=0., double eIn=0., double mIn=0., double tauIn=0., double spinIn=9., double scaleIn=-1.)
 
void setIdX (int id1In, int id2In, double x1In, double x2In)
 Input info on flavour and x values of hard-process initiators.
 
void setPdf (int id1pdfIn, int id2pdfIn, double x1pdfIn, double x2pdfIn, double scalePDFIn, double pdf1In, double pdf2In, bool pdfIsSetIn)
 Optionally input info on parton density values of event.
 
void setScaleShowers (double scaleIn1, double scaleIn2=0.)
 Optionally input info on parton shower starting scale; two for DPS.
 
bool setInitLHEF (istream &is, bool readHeaders=false)
 Three routines for LHEF files, but put here for flexibility. More...
 
bool setNewEventLHEF (istream &is)
 
bool setOldEventLHEF ()
 Make current event information read in by setNewEventLHEF. More...
 
istream * openFile (const char *fn, ifstream &ifs)
 
void closeFile (istream *&is, ifstream &ifs)
 
void setInfoHeader (const string &key, const string &val)
 

Protected Attributes

InfoinfoPtr
 Pointer to various information on the generation.
 
LoggerloggerPtr
 
int nupSave
 Event properties from LHEF files, for repeated use.
 
int idprupSave
 
double xwgtupSave
 
double scalupSave
 
double aqedupSave
 
double aqcdupSave
 
double xSecSumSave
 
double xErrSumSave
 
vector< LHAParticleparticlesSave
 
bool getPDFSave
 
bool getScale
 
bool getScaleShowers
 
int id1InSave
 
int id2InSave
 
int id1pdfInSave
 
int id2pdfInSave
 
double x1InSave
 
double x2InSave
 
double x1pdfInSave
 
double x2pdfInSave
 
double scalePDFInSave
 
double pdf1InSave
 
double pdf2InSave
 
double scaleShowersInSave [2]
 
string fileName
 File to which to write Les Houches Event File information.
 
fstream osLHEF
 
char dateNow [12]
 
char timeNow [9]
 

Static Protected Attributes

static const double CONVERTMB2PB = 1e9
 Allow conversion from mb to pb. More...
 

Detailed Description

LHAup is base class for initialization and event information from an external parton-level generator.

Member Function Documentation

void closeFile ( istream *&  is,
ifstream &  ifs 
)
protected

Companion method to 'openFile', above. Correctly deallocates memory if required before closing the file.

If the istream pointer is not NULL and is not the same as the ifstream, then delete pointer.

Close the file

bool closeLHEF ( bool  updateInit = false)
virtual

Write end of a Les Houches Event File and close it.

Write an end to the file.

Optionally update the cross section information.

Rewrite header; identically with what openLHEF did.

Redo initialization information.

Done.

Reimplemented in LHEF3FromPythia8.

bool eventLHEF ( bool  verbose = true)

Write event information to a Les Houches Event File. Normal mode is to line up event info in columns, but the non-verbose alternative saves space at the expense of human readability.

Default verbose option.

Write information on process as such.

Write information on the particles, excluding zeroth.

Optionally write information on PDF values at hard interaction.

Optionally write information on shower scales, primarily in DPS events.

Alternative non-verbose option.

Write information on process as such.

Write information on the particles, excluding zeroth.

Optionally write information on PDF values at hard interaction.

Optionally write information on shower scales, primarily in DPS events.

Done.

bool initLHEF ( )

Write initialization information to a Les Houches Event File.

Write information on beams.

Write information on all the subprocesses.

Done.

void listEvent ( )

Print the info; useful to check that reading an event worked.

Print the event info; to check it worked.

Header.

Basic event info.

Particle list

PDF info - optional.

Finished.

void listInit ( )

Print the initialization info; useful to check that setting it worked.

Print the initialization info; to check it worked.

Header.

Beam info.

Event weighting strategy.

Process list.

Finished.

istream * openFile ( const char *  fn,
ifstream &  ifs 
)
protected

Helper routines to open and close a file handling GZIP: ifstream ifs; istream *is = openFile("myFile.txt", ifs); – Process file using is – closeFile(is, ifs);

Open a file using provided ifstream and return a pointer to an istream that can be used to process the file.

Open the file

bool openLHEF ( string  fileNameIn)
virtual

Four routines to write a Les Houches Event file in steps.

Open and write header to a Les Houches Event File.

Open file for writing. Reset it to be empty.

Read out current date and time.

Write header.

Done.

Reimplemented in LHEF3FromPythia8.

virtual bool setEvent ( int  idProcIn = 0)
pure virtual

A pure virtual method setEvent, wherein information on the next event is supposed to be set in the derived class. Strategies +-1 and +-2: idProcIn is the process type, selected by PYTHIA. Strategies +-3 and +-4: idProcIn is dummy; process choice is made locally. The method can find the next event by a runtime interface to another program, or by reading a file, as desired. The method should return false if it did not work.

Implemented in LHEF3FromPythia8, LHAupFromPYTHIA8, LHAupLHEF, LHAupH5, LHAupMadgraph, LHAupAlpgen, LHAupFortran, LHAupH5v2, and LHAupHelaconia.

void setInfoHeader ( const string &  key,
const string &  val 
)
inlineprotected

LHAup is a friend class to infoPtr, but derived classes are not. This wrapper function can be used by derived classes to set headers in the Info class.

virtual bool setInit ( )
pure virtual

A pure virtual method setInit, wherein all initialization information is supposed to be set in the derived class. Can do this by reading a file or some other way, as desired. Returns false if it did not work.

Implemented in LHEF3FromPythia8, LHAupFromPYTHIA8, LHAupLHEF, LHAupH5, LHAupAlpgen, LHAupMadgraph, LHAupH5v2, LHAupFortran, and LHAupHelaconia.

bool setInitLHEF ( istream &  is,
bool  readHeaders = false 
)
protected

Three routines for LHEF files, but put here for flexibility.

Read in initialization information from a Les Houches Event File.

Check that first line is consistent with proper LHEF file.

What to search for if reading headers; if not reading headers then return to default behaviour

Loop over lines until an <init (or optionally <header>) tag is found first on a line.

If header tag found, process if required

Temporary local storage

Loop over lines until an <init> tag is found.

Break lines containing multiple tags into two segments. (Could be generalized to multiple segments but this is sufficient to handle at least <tag>info</tag> on same line.

Loop over segments of current line

Clean line to contain only valid characters

Check for empty line

PZS Jan 2015: Allow multiple open/close tags on a single line.

Update remainder (non-tag) part of line, for later storage

Only take the first word of the tag,

Prepare for next while iteration: Look for next tag on line and update posBeg and posEnd.

Tag present, so handle here

Exit condition

End of header block; keep reading until <init> tag, but do not store any further information

Opening tag

Closing tag that matches current key

Also check for forgotten close tag: next-to-last element

if (getfirst)

Loop over tags

Exit condition

At this point the (rest of) the line is not a tag; If no longer reading anything, skip.

Check for key change

Check if anything remains to store of this line

Append information to local storage

Loop over line segments

Exit condition

while (true)

Copy information to info using LHAup::setInfoHeader

if (readHeaders == true && tag == headerTag)

Read in first info line; done if empty.

Read in beam and strategy info, and store it.

Read in process info, one process at a time, and store it.

Reading worked.

bool setNewEventLHEF ( istream &  is)
protected

Read in event information from a Les Houches Event File, into a staging area where it can be reused by setOldEventLHEF.

Loop over lines until an <event tag is found first on a line.

Read in process info and store it.

Reset particlesSave vector, add slot-0 empty particle.

Read in particle info one by one, and store it. Note unusual C++ loop range, to better reflect LHA/Fortran standard. (Recall that process(...) above added empty particle at index 0.)

Flavour and x values of hard-process initiators.

Continue parsing till </event>. Look for optional info on the way.

Extract PDF info if present.

Extract shower scales info if present.

Extract scale info if present.

Need id and x values even when no PDF info. Rest empty.

Reading worked.

bool setOldEventLHEF ( )
protected

Make current event information read in by setNewEventLHEF.

Store saved event, optionally also parton density and scale information.

Done;

void setProcess ( int  idProcIn = 0,
double  weightIn = 1.,
double  scaleIn = 0.,
double  alphaQEDIn = 0.0073,
double  alphaQCDIn = 0.12 
)
inlineprotected

Input info on the selected process.

Clear particle list. Add empty zeroth particle for correct indices.

virtual bool skipEvent ( int  nSkip)
inlinevirtual

Skip ahead a number of events, which are not considered further. Mainly intended for debug when using the LHAupLHEF class.

Reimplemented in LHAupLHEF.

Member Data Documentation

const double CONVERTMB2PB = 1e9
staticprotected

Allow conversion from mb to pb.

LHAup class.

Constants: could be changed here if desired, but normally should not. These are of technical nature, as described for each. LHA convention with cross section in pb may require conversion from mb.


The documentation for this class was generated from the following files: