agile is hosted by Hepforge, IPPP Durham

Charybdis Class Reference

#include <Charybdis.hh>

Inheritance diagram for Charybdis:
Collaboration diagram for Charybdis:

List of all members.

Public Types

enum  Result { SUCCESS = 1, FAILURE = 0 }
 

Really just syntactic sugar for bool returns from setParam.

More...

Public Member Functions

 Charybdis ()
 Standard constructor.
 ~Charybdis ()
 Destructor.
bool setParam (const string &name, const string &value)
 Pass a parameter to the generator.
void finalize ()
 Finalise.
void setGenSpecificInitialState (int, double, int, double)
 Set initial state implementation details.
void setInitialState (int p1=PROTON, double e1=7000.0, int p2=PROTON, double e2=7000.0)
 Define initial state.
virtual const GeneratorStategetState ()
 Get a generator state object.
virtual void setState (const GeneratorState &state)
 Setup the generator from a generator state object.
virtual const std::string getName () const
 Get the generator name.
virtual void setVersion (const std::string &version)
 Set the generator version.
virtual const std::string getVersion ()
 Get the generator version. This implementation is used as a last resort to determine the generator version. Ideally a specific generator will know its own version and overwrite this. Some generators (e.g. FHerwig) don't know this.
virtual std::string getPDFSet (PdgCode pid)
virtual int getPDFMember (PdgCode pid)
 Get the PDF id number for a given particle.
virtual std::string getPDFScheme (PdgCode pid) const
 Get the PDF scheme used by the generator (LHAPDF or other).
virtual void setSeed (const int value)
 Set the random number generator seed.
virtual bool setParam (const std::string &name, const int &value)
 Pass an int-valued parameter to the generator.
virtual bool setParam (const std::string &name, const unsigned int &value)
 Pass an int-valued parameter to the generator.
virtual bool setParam (const std::string &name, const long &value)
 Pass an int-valued parameter to the generator.
virtual bool setParam (const std::string &name, const unsigned long &value)
 Pass an int-valued parameter to the generator.
virtual bool setParam (const std::string &name, const double &value)
 Pass a double/float-valued parameter to the generator.
virtual bool setParam (const std::string &name, const float &value)
 Pass a double/float-valued parameter to the generator.
virtual bool setParam (const std::string &name, const bool &value)
 Pass a bool-valued parameter to the generator.
virtual bool setParam (const std::string &name, const std::string &value)
 Pass a string-valued parameter to the generator.
virtual void makeEvent (HepMC::GenEvent &evt)
 Run one event.
virtual const double getCrossSection ()
 Return the generated cross section in pb.

Protected Member Functions

LoggetLog () const
 Get named logger.
virtual void initialize ()
 Initialise.
virtual void clearEvent (HepMC::GenEvent &evt)
 Clear the supplied event.

Protected Attributes

double _crossSection
bool _initialstateset
 Flag for detecting whether the setInitialState method has run.
bool _initialized
 Flag for detecting whether the initialization method has run.
map< PdgCode, std::string > _particleNames
 Collection of translated names for particles.
string _myName
 Generator name.

Detailed Description

Abstract base class for Charybdis interface

Author:
Andy Buckley

Definition at line 12 of file Charybdis.hh.


Member Enumeration Documentation

enum Result [inherited]

Really just syntactic sugar for bool returns from setParam.

Enumerator:
SUCCESS 
FAILURE 

Definition at line 37 of file Generator.hh.

00037 { SUCCESS=1, FAILURE=0 };


Constructor & Destructor Documentation

Charybdis (  )  [inline]

Standard constructor.

Definition at line 15 of file Charybdis.hh.

00015 { }

~Charybdis (  )  [inline]

Destructor.

Definition at line 18 of file Charybdis.hh.

00018 { }


Member Function Documentation

virtual void clearEvent ( HepMC::GenEvent &  evt  )  [inline, protected, virtual, inherited]

Clear the supplied event.

Definition at line 275 of file Generator.hh.

Referenced by Generator::makeEvent(), FHerwigJimmy::makeEvent(), and AlpGenFHerwigJimmy::makeEvent().

00275                                                 {
00276       evt.clear();
00277     }

void finalize (  )  [inline, virtual]

Finalise.

Implements Generator.

Definition at line 27 of file Charybdis.hh.

00027 { }

virtual const double getCrossSection (  )  [inline, virtual, inherited]

Return the generated cross section in pb.

Reimplemented in Ariadne, Cascade, FHerwig, FPythia, Phojet, and Rapgap.

Definition at line 243 of file Generator.hh.

References Generator::_crossSection, Generator::getName(), and MSG_ERROR.

Referenced by Generator::getState().

00243                                            {
00244       MSG_ERROR("getCrossSection not implemented in generator " << getName());
00245       throw runtime_error("Tried to access cross-section in Generator base class");
00246       return _crossSection;
00247     }

virtual const std::string getName (  )  const [inline, virtual, inherited]

Get the generator name.

Reimplemented in Ariadne, Cascade, FHerwigJimmy, FPythia, Phojet, and Rapgap.

Definition at line 96 of file Generator.hh.

References Generator::_myName.

Referenced by Generator::getCrossSection(), Generator::getLog(), Generator::getPDFMember(), Generator::getPDFScheme(), Generator::getPDFSet(), and Generator::getState().

00096                                             {
00097       return _myName;
00098     }

virtual int getPDFMember ( PdgCode  pid  )  [inline, virtual, inherited]

Get the PDF id number for a given particle.

Reimplemented in Ariadne, FHerwig, FPythia, and Phojet.

Definition at line 132 of file Generator.hh.

References Generator::getName().

Referenced by Generator::getState().

00132                                           {
00133       throw runtime_error("Have not implemented getPDFMember in " + getName());
00134     }

virtual std::string getPDFScheme ( PdgCode  pid  )  const [inline, virtual, inherited]

Get the PDF scheme used by the generator (LHAPDF or other).

Reimplemented in Ariadne, FHerwig, FPythia, and Phojet.

Definition at line 138 of file Generator.hh.

References Generator::getName().

Referenced by Generator::getState().

00138                                                       {
00139       throw runtime_error("Have not implemented getPDFScheme in " + getName());
00140     }

virtual std::string getPDFSet ( PdgCode  pid  )  [inline, virtual, inherited]

Get the PDF set used by the generator, e.g. HWLHAPDF (for herwig) or one of the default sets.

Reimplemented in Ariadne, FHerwig, FPythia, and Phojet.

Definition at line 126 of file Generator.hh.

References Generator::getName().

Referenced by Generator::getState().

00126                                              {
00127       throw runtime_error("Have not implemented getPDFSet in " + getName());
00128     }

virtual const GeneratorState& getState (  )  [inline, virtual, inherited]

Get a generator state object.

Definition at line 72 of file Generator.hh.

References Generator::_myState, GeneratorState::addPDF(), GeneratorState::getBeams(), Generator::getCrossSection(), Generator::getName(), Generator::getPDFMember(), Generator::getPDFScheme(), Generator::getPDFSet(), Generator::getVersion(), PDF::member, Beam::name, PDF::particleId, PDF::scheme, PDF::set, GeneratorState::setCrossSection(), GeneratorState::setName(), and GeneratorState::setVersion().

00072                                              {
00073       string myName = getName();
00074       _myState.setName(myName);
00075       _myState.setVersion(getVersion());
00076       _myState.setCrossSection(getCrossSection());
00077       PDF pdf;
00078       foreach (Beam b, _myState.getBeams()) {
00079         pdf.particleId = b.name;
00080         pdf.set = getPDFSet(b.name);
00081         pdf.member = getPDFMember(b.name);
00082         pdf.scheme = getPDFScheme(b.name);
00083         _myState.addPDF(pdf);
00084       }
00085       return _myState;
00086     }

virtual const std::string getVersion (  )  [inline, virtual, inherited]

Get the generator version. This implementation is used as a last resort to determine the generator version. Ideally a specific generator will know its own version and overwrite this. Some generators (e.g. FHerwig) don't know this.

Todo:
This getName() doesn't get used polymophically: fix it!

Reimplemented in Ariadne, FPythia, and Phojet.

Definition at line 112 of file Generator.hh.

References Generator::_myVersion, Generator::_versionSet, and MSG_ERROR.

Referenced by Generator::getState().

00112                                          {
00113       if (!_versionSet) {
00115         MSG_ERROR("You asked the generator " //<< getName()
00116                   << " what version it is, but it doesn't know!\n"
00117                   << "You should set the version with a call to setVersion(string)");
00118         throw runtime_error("Version unknown for generator");
00119       }
00120       return _myVersion;
00121     }

virtual void initialize (  )  [inline, protected, virtual, inherited]

Initialise.

Reimplemented in Ariadne, Cascade, FHerwig, FHerwigJimmy, FPythia, Phojet, and Rapgap.

Definition at line 269 of file Generator.hh.

References Generator::_initialstateset, and Generator::setInitialState().

Referenced by Generator::makeEvent().

00269                               {
00270       if (!_initialstateset) setInitialState();
00271     }

virtual void makeEvent ( HepMC::GenEvent &  evt  )  [inline, virtual, inherited]

Run one event.

Reimplemented in AlpGenFHerwig, AlpGenFHerwigJimmy, Ariadne, Cascade, FHerwig, FHerwigJimmy, FPythia, Phojet, and Rapgap.

Definition at line 235 of file Generator.hh.

References Generator::_initialized, Generator::_myState, GeneratorState::addEvent(), Generator::clearEvent(), and Generator::initialize().

Referenced by Run::makeEvent().

00235                                                {
00236       if (!_initialized) initialize();
00237       clearEvent(evt);
00238       _myState.addEvent();
00239     }

void setGenSpecificInitialState ( int  p1,
double  e1,
int  p2,
double  e2 
) [inline, virtual]

Set initial state implementation details.

Implements Generator.

Definition at line 28 of file Charybdis.hh.

00028 { }

void setInitialState ( int  p1 = PROTON,
double  e1 = 7000.0,
int  p2 = PROTON,
double  e2 = 7000.0 
) [inline, inherited]

Define initial state.

Todo:
Make sure it was successful - exception handling

Definition at line 54 of file Generator.hh.

References Generator::_initialstateset, Generator::_myState, Beam::energy, Beam::name, Beam::position, GeneratorState::setBeams(), and Generator::setGenSpecificInitialState().

Referenced by Generator::initialize().

00056     {
00057       setGenSpecificInitialState(p1, e1, p2, e2);
00059       _initialstateset = true;
00060       Beam beam1, beam2;
00061       beam1.name = p1;
00062       beam2.name = p2;
00063       beam1.energy = e1;
00064       beam2.energy = e2;
00065       beam1.position = 1;
00066       beam2.position = 2;
00067       _myState.setBeams(beam1, beam2);
00068     }

virtual bool setParam ( const std::string &  name,
const std::string &  value 
) [inline, virtual, inherited]

Pass a string-valued parameter to the generator.

Definition at line 224 of file Generator.hh.

References Generator::_initialized, Generator::_myState, MSG_ERROR, and GeneratorState::setParam().

00224                                                                          {
00225       if (_initialized) {
00226         MSG_ERROR("Can't set parameter " << name << ": generator has already been initialized");
00227         throw runtime_error("Tried to set param after generator initialization");
00228       }
00229       _myState.setParam(name, value);
00230       return true;
00231     }

virtual bool setParam ( const std::string &  name,
const bool &  value 
) [inline, virtual, inherited]

Pass a bool-valued parameter to the generator.

Definition at line 214 of file Generator.hh.

References Generator::_initialized, MSG_ERROR, Generator::setParam(), and AGILe::toString().

00214                                                                     {
00215       if (_initialized) {
00216         MSG_ERROR("Can't set parameter " << name << ": generator has already been initialized");
00217         throw runtime_error("Tried to set param after generator initialization");
00218       }
00219       return setParam(name, toString(value));
00220     }

virtual bool setParam ( const std::string &  name,
const float &  value 
) [inline, virtual, inherited]

Pass a double/float-valued parameter to the generator.

Definition at line 204 of file Generator.hh.

References Generator::_initialized, MSG_ERROR, Generator::setParam(), and AGILe::toString().

00204                                                                      {
00205       if (_initialized) {
00206         MSG_ERROR("Can't set parameter " << name << ": generator has already been initialized");
00207         throw runtime_error("Tried to set param after generator initialization");
00208       }
00209       return setParam(name, toString(value));
00210     }

virtual bool setParam ( const std::string &  name,
const double &  value 
) [inline, virtual, inherited]

Pass a double/float-valued parameter to the generator.

Definition at line 194 of file Generator.hh.

References Generator::_initialized, MSG_ERROR, Generator::setParam(), and AGILe::toString().

00194                                                                       {
00195       if (_initialized) {
00196         MSG_ERROR("Can't set parameter " << name << ": generator has already been initialized");
00197         throw runtime_error("Tried to set param after generator initialization.");
00198       }
00199       return setParam(name, toString(value));
00200     }

virtual bool setParam ( const std::string &  name,
const unsigned long &  value 
) [inline, virtual, inherited]

Pass an int-valued parameter to the generator.

Definition at line 184 of file Generator.hh.

References Generator::_initialized, MSG_ERROR, Generator::setParam(), and AGILe::toString().

00184                                                                              {
00185       if (_initialized) {
00186         MSG_ERROR("Can't set parameter " << name << ": generator has already been initialized");
00187       throw runtime_error("Tried to set param after generator initialization");
00188       }
00189       return setParam(name, toString(value));
00190     }

virtual bool setParam ( const std::string &  name,
const long &  value 
) [inline, virtual, inherited]

Pass an int-valued parameter to the generator.

Definition at line 174 of file Generator.hh.

References Generator::_initialized, MSG_ERROR, Generator::setParam(), and AGILe::toString().

00174                                                                     {
00175       if (_initialized) {
00176         MSG_ERROR("Can't set parameter " << name << ": generator has already been initialized");
00177         throw runtime_error("Tried to set param after generator initialization");
00178       }
00179       return setParam(name, toString(value));
00180     }

virtual bool setParam ( const std::string &  name,
const unsigned int &  value 
) [inline, virtual, inherited]

Pass an int-valued parameter to the generator.

Definition at line 164 of file Generator.hh.

References Generator::_initialized, MSG_ERROR, Generator::setParam(), and AGILe::toString().

00164                                                                             {
00165       if (_initialized) {
00166         MSG_ERROR("Can't set parameter " << name << ": generator has already been initialized");
00167         throw runtime_error("Tried to set param after generator initialization");
00168       }
00169       return setParam(name, toString(value));
00170     }

virtual bool setParam ( const std::string &  name,
const int &  value 
) [inline, virtual, inherited]

Pass an int-valued parameter to the generator.

Definition at line 154 of file Generator.hh.

References Generator::_initialized, MSG_ERROR, and AGILe::toString().

Referenced by Generator::setParam().

00154                                                                    {
00155       if (_initialized) {
00156         MSG_ERROR("Can't set parameter " << name << ": generator has already been initialized");
00157         throw runtime_error("Tried to set param after generator initialization");
00158       }
00159       return setParam(name, toString(value));
00160     }

bool setParam ( const string &  name,
const string &  value 
)

Pass a parameter to the generator.

Definition at line 21 of file Charybdis.cc.

References AGILe::asDouble(), AGILe::asInt(), Generator::FAILURE, FC_BH1003, FC_BHPARM, FC_BLACKH, FC_HEPRUP, MSG_ERROR, MSG_INFO, and Generator::SUCCESS.

Referenced by CharybdisFPythia::setParam(), CharybdisFHerwigJimmy::setParam(), and CharybdisFHerwig::setParam().

00021                                                                   {
00022     Generator::setParam(name, value);
00023 
00024     // Set double-valued params
00025     if (name == "MPLNCK") {
00026       MSG_INFO("Setting ... (MPLNCK) = " << value);
00027       FC_BHPARM.MPLNCK = asDouble(value);
00028     } else if (name == "MINMSS") {
00029       MSG_INFO("Setting ... (MINMSS) = " << value);
00030       FC_BHPARM.MINMSS = asDouble(value);
00031     } else if (name == "MAXMSS") {
00032       MSG_INFO("Setting ... (MAXMSS) = " << value);
00033       FC_BHPARM.MAXMSS = asDouble(value);
00034     } else if (name == "THWMAX") {
00035       MSG_INFO("Setting ... (THWMAX) = " << value);
00036       FC_BH1003.THWMAX = asDouble(value);
00037     } else if (name == "RMMINM") {
00038       MSG_INFO("Setting ... (RMMINM) = " << value);
00039       FC_BH1003.RMMINM = asDouble(value);
00040 
00041     // Set int-valued params
00042     } else if (name == "PDFGUP") {
00043       MSG_INFO("Setting Charybdis PDFGUP = " << value);
00044       FC_HEPRUP.PDFGUP[0] = asInt(value);
00045       FC_HEPRUP.PDFGUP[1] = asInt(value);
00046     } else if (name == "PDFSUP") {
00047       MSG_INFO("Setting Charybdis = " << value);
00048       FC_HEPRUP.PDFSUP[0] = asInt(value);
00049       FC_HEPRUP.PDFSUP[1] = asInt(value);
00050     } else if (name == "MSSDEF") {
00051       MSG_INFO("Setting ... (MSSDEF) = " << value);
00052       FC_BHPARM.MSSDEF = asInt(value);
00053     } else if (name == "NBODY") {
00054       MSG_INFO("Setting ... (NBODY) = " << value);
00055       FC_BHPARM.NBODY = asInt(value);
00056     } else if (name == "IBHPRN") {
00057       MSG_INFO("Setting ... (IBHPRN) = " << value);
00058       FC_BHPARM.IBHPRN = asInt(value);
00059     } else if (name == "MSSDEC") {
00060       MSG_INFO("Setting ... (MSSDEC) = " << value);
00061       FC_BHPARM.MSSDEC = asInt(value);
00062     } else if (name == "TOTDIM") {
00063       MSG_INFO("Setting ... (TOTDIM) = " << value);
00064       FC_BLACKH.TOTDIM = asInt(value);
00065 
00066     // Set bool-valued params
00067     } else if (name == "TIMVAR") {
00068       MSG_INFO("Setting ... (TIMVAR) = " << value);
00069       FC_BHPARM.TIMVAR = asInt(value);
00070     } else if (name == "GTSCA") {
00071       MSG_INFO("Setting ... (GTSCA) = " << value);
00072       FC_BHPARM.GTSCA = asInt(value);
00073     } else if (name == "GRYBDY") {
00074       MSG_INFO("Setting ... (GRYBDY) = " << value);
00075       FC_BHPARM.GRYBDY = asInt(value);
00076     } else if (name == "KINCUT") {
00077       MSG_INFO("Setting ... (KINCUT) = " << value);
00078       FC_BHPARM.KINCUT = asInt(value);
00079     } else if (name == "YRCSEC") {
00080       MSG_INFO("Setting ... (YRCSEC) = " << value);
00081       FC_BH1003.YRCSEC = asInt(value);
00082     } else if (name == "RMBOIL") {
00083       MSG_INFO("Setting ... (RMBOIL) = " << value);
00084       FC_BH1003.RMBOIL = asInt(value);
00085     } else {
00086       MSG_ERROR("Charybdis doesn't have a parameter called " << name);
00087       return FAILURE;
00088     }
00089     return SUCCESS;
00090   }

virtual void setSeed ( const int  value  )  [inline, virtual, inherited]

Set the random number generator seed.

Reimplemented in Ariadne, FHerwig, FPythia, and Phojet.

Definition at line 144 of file Generator.hh.

References Generator::_initialized, Generator::_myState, GeneratorState::addSeed(), and MSG_ERROR.

00144                                           {
00145       if (_initialized) {
00146         MSG_ERROR("Can't set seed: generator has already been initialized");
00147         throw (runtime_error("Tried to set RNG seed after generator initialization"));
00148       }
00149       _myState.addSeed(value);
00150     }

virtual void setState ( const GeneratorState state  )  [inline, virtual, inherited]

Setup the generator from a generator state object.

Definition at line 90 of file Generator.hh.

00090                                                        {
00091       throw runtime_error("This ain't ready yet, it's just here as an interface placeholder. Sorry.");
00092     }

virtual void setVersion ( const std::string &  version  )  [inline, virtual, inherited]

Set the generator version.

Definition at line 102 of file Generator.hh.

References Generator::_myVersion, and Generator::_versionSet.

Referenced by AGILe::Loader::createGen().

00102                                                       {
00103       _myVersion = version;
00104       _versionSet = true;
00105     }


Member Data Documentation

bool _initialized [protected, inherited]
bool _initialstateset [protected, inherited]

Flag for detecting whether the setInitialState method has run.

Definition at line 285 of file Generator.hh.

Referenced by Generator::initialize(), and Generator::setInitialState().


The documentation for this class was generated from the following files:
Generated on Tue Mar 6 10:39:40 2012 for AGILe - A Generator Interface Library (+ executable) by  doxygen 1.6.3