agile is hosted by Hepforge, IPPP Durham

GeneratorState.hh

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef AGILE_GENERATOR_STATE_HH
00003 #define AGILE_GENERATOR_STATE_HH
00004 
00005 #include "AGILe/AGILe.hh"
00006 #include "AGILe/Particle.hh"
00007 
00008 namespace AGILe {
00009 
00010   struct Beam{
00011     PdgCode name;
00012     double energy;
00013     int position;
00014   };
00015 
00016   
00017   struct PDF{
00018     PdgCode particleId;
00019     string set;
00020     int member;
00021     string scheme;
00022   };
00023 
00024   
00025   class GeneratorState {
00026   public:
00027 
00028     GeneratorState() {
00029       _nEvents = 0;
00030       _crossSection = 0.0;
00031     }
00032 
00033 
00034     template <typename T>
00035     const GeneratorState& setParam(const string &name, const T &value) {
00036       stringstream s;
00037       s << value;
00038       return setParam(name, s.str());
00039     }
00040 
00041 
00042     const GeneratorState& setParam(const string & name, const string &value) {
00043       _stringParams[name] = value;
00044       return *this;
00045     }
00046 
00047 
00048     const GeneratorState& addSeed(const int &seed) {
00049       _seeds.push_back(seed);
00050       return *this;
00051     }
00052 
00053 
00054     const vector<int>& getSeeds() const {
00055       return _seeds;
00056     }
00057 
00058     
00060     const bool setCrossSection(const double xs) {
00061       _crossSection = xs;
00062       return true;
00063     }
00064 
00065     
00066     const double getCrossSection() const {
00067       return _crossSection;
00068     }
00069 
00070 
00071     const int getNEvents()const {
00072       return _nEvents;
00073     }
00074 
00075 
00076     const GeneratorState& addEvent() {
00077       ++_nEvents;
00078       return *this;
00079     }
00080 
00081 
00082     const GeneratorState& setBeams(const Beam beam1,
00083                                    const Beam beam2) {
00084       _beams.clear();
00085       _beams.push_back(beam1);
00086       _beams.push_back(beam2);
00087       return *this;
00088     }
00089 
00090 
00091     const void addPDF(PDF pdf) {
00092       _pDFs[pdf.particleId] = pdf;
00093     }
00094 
00095 
00096     const GeneratorState& setName(const string& name) {
00097       _genName = name;
00098       return *this;
00099     }
00100 
00101 
00102     const void setVersion(const string& ver) {
00103       _genVersion = ver;
00104     }
00105 
00106     
00107     const string version() const {
00108       return _genVersion;
00109     }
00110 
00111     
00112     const string& name() const {
00113       return _genName;
00114     }
00115 
00116     
00117     const vector<Beam>& getBeams() const {
00118       return _beams;
00119     }
00120 
00121 
00122     const PDF& getPDF(PdgCode pid) const {
00123       map<PdgCode, PDF>::const_iterator pdfIt = _pDFs.find(pid);
00124       if (pdfIt!=_pDFs.end()) {
00125         return pdfIt->second;
00126       }
00127       throw runtime_error("PDF unknown for PDG code "+ pid);
00128     }
00129     
00130 
00131   private:
00132 
00133     vector<Beam> _beams;
00134     
00135     int _nEvents;
00136     double _luminosity;
00137     double _crossSection;
00138 
00139     string _genName;
00140     string _genVersion;
00141     
00142     map<PdgCode, PDF> _pDFs;
00143     
00144     vector<int> _seeds;
00145     map<string, string> _stringParams;
00146     
00147   };
00148   
00149 
00150   ostream &operator<<(ostream& os, const GeneratorState& state);
00151 
00152 }
00153 #endif
Generated on Tue Mar 6 10:39:38 2012 for AGILe - A Generator Interface Library (+ executable) by  doxygen 1.6.3