agile is hosted by Hepforge, IPPP Durham

AGILe Namespace Reference

Namespaces

namespace  Loader

Classes

class  AlpGen
class  AlpGenFHerwig
class  AlpGenFHerwigJimmy
class  AlpGenFPythia
class  Ariadne
class  Cascade
class  Charybdis
class  CharybdisFHerwig
class  CharybdisFHerwigJimmy
class  CharybdisFPythia
class  FHerwig
class  FHerwigJimmy
class  FPythia
class  Generator
struct  Beam
struct  PDF
class  GeneratorState
class  Phojet
class  Rapgap
class  Run
class  Log

Typedefs

typedef Generator *(* Creator )()
 Class factory for dynamic generator loading.
typedef void Destroyer (Generator *)
 Class destroyer for dynamic generator loading.
typedef int PdgCode

Enumerations

enum  ParticleName {
  ELECTRON = 11, POSITRON = -11, PROTON = 2212, ANTIPROTON = -2212,
  PHOTON = 22, NEUTRON = 2112, ANTINEUTRON = 2112, MUON = 13,
  ANTIMUON = -13, NU_E = 12, NU_EBAR = -12, NU_MU = 14,
  NU_MUBAR = -14, NU_TAU = 16, NU_TAUBAR = -16, PIPLUS = 211,
  PIMINUS = -211, TAU = 15, ANTITAU = -15, EMINUS = 11,
  EPLUS = -11, P = 2212, PBAR = -2212, GAMMA = 22,
  ANY = 10000, PHOTOELECTRON, PHOTOPOSITRON, PHOTOMUON,
  PHOTOANTIMUON, PHOTOTAU, PHOTOANTITAU
}
 

Enumeration of available beam particles (using PDG IDs where available).

More...

Functions

std::string version ()
 A function to get the AGILe version string.
ostream & operator<< (ostream &os, const GeneratorState &state)
void fixHepMCUnitsFromGeVmm (HepMC::GenEvent &evt)
std::string getLibPath ()
 Get library install path.
std::string getDataPath ()
 Get data install path.
std::string getAGILeDataPath ()
 Get Agile data install path.
std::vector< std::string > getGenPaths ()
 Get AGILe generator library search paths (cf. Genser root directory).
std::string getLCGPlatformTag ()
 Get LCG platform tag.
std::ostream & operator<< (Log &log, int level)
 Streaming output to a logger must have a Log::Level/int as its first argument.
int nocase_cmp (const string &s1, const string &s2)
string toLower (const string &s)
string toUpper (const string &s)
template<typename Real >
bool fuzzyEquals (Real a, Real b, Real tolerance=0.001)
std::vector< std::string > split (string path, const string delim=":")
template<typename T >
std::string toString (const T &value)
template<typename T >
as (const std::string &strvalue)
template<>
bool as< bool > (const std::string &value)
int asInt (const std::string &value)
double asDouble (const std::string &value)
bool asBool (const std::string &value)
void filterEvent (HepMC::GenEvent *ge, Run::FilterLevel filterlevel)

Typedef Documentation

typedef Generator*(* Creator)()

Class factory for dynamic generator loading.

Definition at line 311 of file Generator.hh.

typedef void Destroyer(Generator *)

Class destroyer for dynamic generator loading.

Definition at line 315 of file Generator.hh.

typedef int PdgCode

Definition at line 6 of file Particle.hh.


Enumeration Type Documentation

Enumeration of available beam particles (using PDG IDs where available).

Enumerator:
ELECTRON 
POSITRON 
PROTON 
ANTIPROTON 
PHOTON 
NEUTRON 
ANTINEUTRON 
MUON 
ANTIMUON 
NU_E 
NU_EBAR 
NU_MU 
NU_MUBAR 
NU_TAU 
NU_TAUBAR 
PIPLUS 
PIMINUS 
TAU 
ANTITAU 
EMINUS 
EPLUS 
P 
PBAR 
GAMMA 
ANY 
PHOTOELECTRON 
PHOTOPOSITRON 
PHOTOMUON 
PHOTOANTIMUON 
PHOTOTAU 
PHOTOANTITAU 

Definition at line 9 of file Particle.hh.

00009                     { 
00010     ELECTRON = 11, 
00011     POSITRON = -11, 
00012     PROTON = 2212, 
00013     ANTIPROTON = -2212, 
00014     PHOTON = 22, 
00015     NEUTRON = 2112, 
00016     ANTINEUTRON = 2112, 
00017     MUON = 13, 
00018     ANTIMUON = -13,
00019     NU_E = 12, 
00020     NU_EBAR = -12,
00021     NU_MU = 14, 
00022     NU_MUBAR = -14,
00023     NU_TAU = 16, 
00024     NU_TAUBAR = -16, 
00025     PIPLUS = 211, 
00026     PIMINUS = -211,
00027     TAU = 15, 
00028     ANTITAU = -15,
00029     EMINUS = 11, 
00030     EPLUS = -11, 
00031     P = 2212, 
00032     PBAR = -2212,
00033     GAMMA = 22,
00034     ANY = 10000,
00035     PHOTOELECTRON,
00036     PHOTOPOSITRON,
00037     PHOTOMUON,     
00038     PHOTOANTIMUON,
00039     PHOTOTAU,      
00040     PHOTOANTITAU
00041   };


Function Documentation

T AGILe::as ( const std::string &  strvalue  )  [inline]

Definition at line 69 of file Utils.hh.

00069                                          {
00070     T tval = lexical_cast<T>(strvalue);
00071     return tval;
00072   }

bool AGILe::as< bool > ( const std::string &  value  )  [inline]

Referenced by asBool().

bool AGILe::asBool ( const std::string &  value  )  [inline]

Definition at line 83 of file Utils.hh.

References as< bool >().

Referenced by FHerwig::_processParams().

00083 {  return as<bool>(value); }

double AGILe::asDouble ( const std::string &  value  )  [inline]
int AGILe::asInt ( const std::string &  value  )  [inline]
void AGILe::filterEvent ( HepMC::GenEvent *  ge,
Run::FilterLevel  filterlevel 
)

Todo:
Have to build a list, since the GV::add_particle_out method modifies the end vertex!

Definition at line 35 of file Run.cc.

References Run::NOFILT, and Run::UNSTABLEFILT.

Referenced by Run::makeEvent().

00035                                                                   {
00036     // Escape fast if there's nothing to do
00037     if (filterlevel == Run::NOFILT) return;
00038 
00039     // We treat beam particles a bit specially
00040     const std::pair<HepMC::GenParticle*, HepMC::GenParticle*> beams = ge->beam_particles();
00041 
00042     // Make list of non-physical particle entries
00043     std::vector<HepMC::GenParticle*> unphys_particles;
00044     for (HepMC::GenEvent::particle_const_iterator pi = ge->particles_begin();
00045          pi != ge->particles_end(); ++pi) {
00046       // Beam particles might not have status = 4, but we want them anyway
00047       if (beams.first == *pi || beams.second == *pi) continue;
00048       // Filter by status
00049       const int status = (*pi)->status();
00050       const bool keep = (status == 1 || status == 4 || (filterlevel != Run::UNSTABLEFILT && status == 2));
00051       if (!keep) {
00052         unphys_particles.push_back(*pi);
00053       }
00054     }
00055 
00056     // Remove each unphysical particle from the list
00057     while (unphys_particles.size()) {
00058       HepMC::GenParticle* gp = unphys_particles.back();
00059 
00060       // Get start and end vertices
00061       HepMC::GenVertex* vstart = gp->production_vertex();
00062       HepMC::GenVertex* vend = gp->end_vertex();
00063 
00064       if (vend == vstart) {
00065         // Deal with loops
00066         vstart->remove_particle(gp);
00067       } else {
00068 
00069         // Connect decay particles from end vertex to start vertex
00071         if (vend && vend->particles_out_size()) {
00072           std::vector<HepMC::GenParticle*> end_particles;
00073           for (HepMC::GenVertex::particles_out_const_iterator gpe = vend->particles_out_const_begin();
00074                gpe != vend->particles_out_const_end(); ++gpe) {
00075             end_particles.push_back(*gpe);
00076           }
00077           // Reset production vertices of child particles to bypass unphysical particle
00078           for (std::vector<HepMC::GenParticle*>::const_iterator gpe = end_particles.begin();
00079                gpe != end_particles.end(); ++gpe) {
00080             //std::cout << vstart << ", " << vend << std::endl;
00081             if (vstart) vstart->add_particle_out(*gpe);
00082           }
00083         } else {
00084           // If null end_vertex... stable unphysical particle?
00085         }
00086 
00087         // Delete unphysical particle and its orphaned end vertex
00088         delete vend;
00089         if (vstart) {
00090           delete vstart->remove_particle(gp);
00091         }
00092       }
00093 
00094       // Remove deleted particle from list
00095       unphys_particles.pop_back();
00096       //std::cout << unphys_particles.size() << std::endl;
00097     }
00098 
00099     // Delete any orphaned vertices
00100     std::vector<HepMC::GenVertex*> orphaned_vtxs;
00101     for (HepMC::GenEvent::vertex_const_iterator vi = ge->vertices_begin();
00102          vi != ge->vertices_end(); ++vi) {
00103       if ((*vi)->particles_in_size() == 0 && (*vi)->particles_out_size() == 0) {
00104         orphaned_vtxs.push_back(*vi);
00105       }
00106     }
00107     while (orphaned_vtxs.size()) {
00108       delete orphaned_vtxs.back();
00109       orphaned_vtxs.pop_back();
00110     }
00111   }

void AGILe::fixHepMCUnitsFromGeVmm ( HepMC::GenEvent &  evt  )  [inline]

Definition at line 10 of file HepMCTools.hh.

References p.

Referenced by Rapgap::fillEvent(), Phojet::fillEvent(), FPythia::fillEvent(), FHerwig::fillEvent(), Cascade::fillEvent(), and Ariadne::fillEvent().

00010                                                          {
00011     #ifdef HEPMC_HAS_UNITS
00012     if (evt.momentum_unit() == HepMC::Units::MEV) {
00013       for (HepMC::GenEvent::particle_iterator p = evt.particles_begin(); p != evt.particles_end(); ++p) {
00014         const HepMC::FourVector fv((*p)->momentum().px() * 1000,
00015                                    (*p)->momentum().py() * 1000,
00016                                    (*p)->momentum().pz() * 1000,
00017                                    (*p)->momentum().e()  * 1000);
00018         (*p)->set_momentum( fv);
00019       }
00020     }
00021     if (evt.length_unit() == HepMC::Units::CM) {
00022       for (HepMC::GenEvent::vertex_iterator vtx = evt.vertices_begin(); vtx != evt.vertices_end(); ++vtx) {
00023         const HepMC::FourVector fv((*vtx)->position().x() / 10.,
00024                                    (*vtx)->position().y() / 10.,
00025                                    (*vtx)->position().z() / 10.,
00026                                    (*vtx)->position().t() / 10.);
00027         (*vtx)->set_position(fv);
00028       }
00029     }
00030     #endif
00031   }

bool AGILe::fuzzyEquals ( Real  a,
Real  b,
Real  tolerance = 0.001 
) [inline]

Definition at line 40 of file Utils.hh.

Referenced by FPythia::initialize(), and Ariadne::initialize().

00040                                                                   {
00041     const double absavg = fabs(a + b)/2.0;
00042     const double absdiff = fabs(a - b);
00043     return (absavg == 0.0 && absdiff == 0.0) || absdiff/absavg < tolerance;
00044   }

std::string AGILe::getAGILeDataPath (  ) 

Get Agile data install path.

std::string AGILe::getDataPath (  ) 

Get data install path.

std::vector<std::string> AGILe::getGenPaths (  ) 

Get AGILe generator library search paths (cf. Genser root directory).

Referenced by AGILe::Loader::_findGenVersions(), and AGILe::Loader::getLibSearchDirs().

std::string AGILe::getLCGPlatformTag (  ) 

Get LCG platform tag.

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

std::string AGILe::getLibPath (  ) 

Get library install path.

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

int AGILe::nocase_cmp ( const string &  s1,
const string &  s2 
) [inline]

Definition at line 10 of file Utils.hh.

00010                                                             {
00011     string::const_iterator it1 = s1.begin();
00012     string::const_iterator it2 = s2.begin();
00013     while ( (it1 != s1.end()) && (it2 != s2.end()) ) {
00014       if(::toupper(*it1) != ::toupper(*it2)) { // < Letters differ?
00015         // Return -1 to indicate smaller than, 1 otherwise
00016         return (::toupper(*it1) < ::toupper(*it2)) ? -1 : 1;
00017       }
00018       // Proceed to the next character in each string
00019       ++it1;
00020       ++it2;
00021     }
00022     size_t size1 = s1.size(), size2 = s2.size(); // Cache lengths
00023     // Return -1,0 or 1 according to strings' lengths
00024     if (size1 == size2) return 0;
00025     return (size1 < size2) ? -1 : 1;
00026   }

std::ostream& AGILe::operator<< ( Log &  log,
int  level 
)

Streaming output to a logger must have a Log::Level/int as its first argument.

The streaming operator can use Log's internals.

ostream & operator<< ( ostream &  os,
const GeneratorState &  state 
)

Definition at line 10 of file AGILeIO.cc.

References GeneratorState::getBeams(), GeneratorState::getCrossSection(), GeneratorState::getNEvents(), GeneratorState::getPDF(), GeneratorState::getSeeds(), PDF::member, GeneratorState::name(), PDF::particleId, PDF::scheme, PDF::set, and GeneratorState::version().

00010                                                                {
00011 
00012     TiXmlDocument doc;
00013 
00014     TiXmlElement hepml("hepml");
00015 
00016     doc.InsertEndChild(hepml);
00017 
00018     TiXmlElement* docRoot = doc.RootElement();
00019 
00020     TiXmlElement collision("collision");
00021 
00022     vector<TiXmlElement> pdfElements;
00023     
00024     vector<Beam> beams = state.getBeams();
00025 
00026     bool gotBeams = false;
00027     
00028     for(vector<Beam>::iterator beamIt = beams.begin();
00029         beamIt != beams.end(); ++beamIt){
00030       TiXmlElement beamElement("particle");
00031       beamElement.SetAttribute("name", beamIt->name);
00032       beamElement.SetAttribute("id", beamIt->position);
00033 
00034       TiXmlElement momentumElement("momentum");
00035       momentumElement.SetAttribute("unit", "GeV");
00036 
00037       stringstream s;
00038       s<<beamIt->energy;
00039       TiXmlText val(s.str());
00040       momentumElement.InsertEndChild(val);
00041       beamElement.InsertEndChild(momentumElement);
00042       collision.InsertEndChild(beamElement);
00043       gotBeams = true;
00044       
00045       TiXmlElement pdfEl("pdf");
00046       PDF pdf = state.getPDF(beamIt->name);
00047       pdfEl.SetAttribute("set", pdf.set);
00048       pdfEl.SetAttribute("member", pdf.member);
00049       pdfEl.SetAttribute("scheme", pdf.scheme);
00050       TiXmlElement pdfParticle("particle");
00051       pdfParticle.SetAttribute("name", pdf.particleId);
00052       pdfEl.InsertEndChild(pdfParticle);
00053       pdfElements.push_back(pdfEl);
00054     }
00055 
00056     TiXmlElement reaction("reaction");
00057     
00058     if(gotBeams) reaction.InsertEndChild(collision);
00059 
00060     docRoot->InsertEndChild(reaction);
00061 
00062     TiXmlElement runseries("runseries");
00063 
00064     TiXmlElement run("run");
00065 
00066     TiXmlElement seedElements("randomSeed");
00067 
00068     vector<int> seeds = state.getSeeds();
00069     
00070     int seedIndex = 1;
00071     
00072     bool gotSeeds = false;
00073 
00074     for(vector<int>::iterator seedIt = seeds.begin();
00075     seedIt!=seeds.end(); ++seedIt){
00076       TiXmlElement seed("seed");
00077       seed.SetAttribute("index", seedIndex);
00078       stringstream s;
00079       s<<*seedIt;
00080       TiXmlText val(s.str());
00081       seed.InsertEndChild(val);
00082       seedElements.InsertEndChild(seed);
00083       ++seedIndex;
00084       gotSeeds = true;
00085     }
00086     
00087     if(gotSeeds) run.InsertEndChild(seedElements);
00088 
00089     TiXmlElement normalisation("normalisation");
00090     TiXmlElement crossSection("crossSection");
00091     crossSection.SetAttribute("unit", "pb^-1");
00092     stringstream s;
00093     s<<state.getCrossSection();
00094     TiXmlText csText(s.str());
00095     crossSection.InsertEndChild(csText);
00096     normalisation.InsertEndChild(crossSection);
00097     s.str("");
00098     s<<state.getNEvents();
00099     TiXmlElement nEvents("numberOfEvents");    
00100     TiXmlText nText(s.str());
00101     nEvents.InsertEndChild(nText);
00102     normalisation.InsertEndChild(nEvents);
00103     TiXmlElement lumi("luminosity");
00104     run.InsertEndChild(normalisation);
00105 
00106     TiXmlElement genSettings("generatorSettings");
00107     
00108     TiXmlElement gen("generator");
00109     gen.SetAttribute("name",state.name());
00110     gen.SetAttribute("version", state.version());
00111     genSettings.InsertEndChild(gen);
00112     
00113     for(vector<TiXmlElement>::iterator pdfIt = pdfElements.begin();
00114         pdfIt!=pdfElements.end(); ++pdfIt){
00115       genSettings.InsertEndChild(*pdfIt);
00116     }
00117     
00118     run.InsertEndChild(genSettings);
00119     runseries.InsertEndChild(run);
00120 
00121     docRoot->InsertEndChild(runseries);
00122 
00123     os<<doc;
00124     os<<endl;
00125 
00126     return os;
00127   }

std::vector<std::string> AGILe::split ( string  path,
const string  delim = ":" 
) [inline]

Split a string with single-character delimiters, ignoring zero-length substrings. Designed for getting elements of filesystem paths, naturally.

Todo:
Reduce copying of vectors somehow?

Definition at line 49 of file Utils.hh.

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

00049                                                                        :") {
00050     if (delim.length() != 1) {
00051       throw runtime_error("Rivet::split(string): delimiter must be a single character.");
00052     }
00054     std::vector<std::string> dirs;
00055     boost::split(dirs, path, boost::is_any_of(delim));
00056     return dirs;
00057   }

string AGILe::toLower ( const string &  s  )  [inline]

Definition at line 29 of file Utils.hh.

00029                                          {
00030     return boost::to_lower_copy(s);
00031   }

std::string AGILe::toString ( const T &  value  )  [inline]

Definition at line 62 of file Utils.hh.

Referenced by Generator::setParam().

00062                                             {
00063     std::string strval = lexical_cast<std::string>(value);
00064     //std::cout << "*" << value << "*" << strval << "*" << std::endl;
00065     return strval;
00066   }

string AGILe::toUpper ( const string &  s  )  [inline]

Definition at line 34 of file Utils.hh.

Referenced by Phojet::setParam(), FPythia::setParam(), and Ariadne::setParam().

00034                                          {
00035     return boost::to_upper_copy(s);
00036   }

string version (  ) 

A function to get the AGILe version string.

Definition at line 6 of file Version.cc.

00006                    {
00007     return AGILE_VERSION;
00008   }

Generated on Tue Mar 6 10:39:40 2012 for AGILe - A Generator Interface Library (+ executable) by  doxygen 1.6.3