#include <AnalysisInfo.hh>
Definition at line 11 of file AnalysisInfo.hh.
Public Member Functions | |
bool | needsCrossSection () const |
Return true if this analysis needs to know the process cross-section. | |
Standard constructors and destructors. | |
AnalysisInfo () | |
The default constructor. | |
~AnalysisInfo () | |
The destructor. | |
Metadata | |
Metadata is used for querying from the command line and also for building web pages and the analysis pages in the Rivet manual. | |
std::string | name () const |
const std::string & | spiresId () const |
Get a description of the analysis. | |
const std::vector< std::string > & | authors () const |
Names & emails of paper/analysis authors. Names and email of authors in 'NAME <EMAIL>' format. The first name in the list should be the primary contact person. | |
const std::string & | summary () const |
Get a short description of the analysis. Short (one sentence) description used as an index entry. Use description() to provide full descriptive paragraphs of analysis details. | |
const std::string & | description () const |
Get a full description of the analysis. Full textual description of this analysis, what it is useful for, what experimental techniques are applied, etc. Should be treated as a chunk of restructuredText (http://docutils.sourceforge.net/rst.html), with equations to be rendered as LaTeX with amsmath operators. | |
const std::string & | runInfo () const |
Information about the events needed as input for this analysis. Event types, energies, kinematic cuts, particles to be considered stable, etc. etc. Should be treated as a restructuredText bullet list (http://docutils.sourceforge.net/rst.html). | |
const std::vector< std::pair < PdgId, PdgId > > & | beams () const |
Beam particle types. | |
const std::vector< std::pair < double, double > > & | energies () const |
Sets of valid beam energy pairs. | |
const std::string & | experiment () const |
Experiment which performed and published this analysis. | |
const std::string & | collider () const |
Collider on which the experiment ran. | |
const std::string & | year () const |
When the original experimental analysis was published. When the refereed paper on which this is based was published, according to SPIRES. | |
const std::vector< std::string > & | references () const |
Journal, and preprint references. | |
const std::string & | bibKey () const |
BibTeX citation key for this article. | |
const std::string & | bibTeX () const |
BibTeX citation entry for this article. | |
const std::string & | status () const |
Whether this analysis is trusted (in any way!). | |
const std::vector< std::string > & | todos () const |
Any work to be done on this analysis. | |
Static Public Member Functions | |
static AnalysisInfo * | make (const std::string &name) |
Static factory method: returns null pointer if no metadata found. | |
Private Member Functions | |
void | clear () |
Private Attributes | |
std::string | _name |
std::string | _spiresId |
std::vector< std::string > | _authors |
std::string | _summary |
std::string | _description |
std::string | _runInfo |
std::string | _experiment |
std::string | _collider |
std::vector< std::pair< PdgId, PdgId > > | _beams |
std::vector< std::pair< double, double > > | _energies |
std::string | _year |
std::vector< std::string > | _references |
std::string | _bibKey |
std::string | _bibTeX |
std::string | _status |
std::vector< std::string > | _todos |
bool | _needsCrossSection |
Friends | |
class | Analysis |
AnalysisInfo | ( | ) | [inline] |
The default constructor.
Definition at line 25 of file AnalysisInfo.hh.
References AnalysisInfo::clear().
Referenced by AnalysisInfo::make().
00025 { clear(); }
~AnalysisInfo | ( | ) | [inline] |
AnalysisInfo * make | ( | const std::string & | ananame | ) | [static] |
Static factory method: returns null pointer if no metadata found.
Static factory method.
Ideas: search RIVET_INFO_PATH etc. for <name>.info.yaml how to determine the name? only populate pointer on Analysis when requested use smart pointer: deletes automatically when Analysis goes out of scope
If no ana data file found, return null AI
Definition at line 23 of file AnalysisInfo.cc.
References AnalysisInfo::_authors, AnalysisInfo::_beams, AnalysisInfo::_bibKey, AnalysisInfo::_bibTeX, AnalysisInfo::_collider, AnalysisInfo::_description, AnalysisInfo::_energies, AnalysisInfo::_experiment, AnalysisInfo::_name, AnalysisInfo::_needsCrossSection, AnalysisInfo::_references, AnalysisInfo::_runInfo, AnalysisInfo::_spiresId, AnalysisInfo::_status, AnalysisInfo::_summary, AnalysisInfo::_todos, AnalysisInfo::_year, AnalysisInfo::AnalysisInfo(), Rivet::ANY, AnalysisInfo::authors(), Log::DEBUG, AnalysisInfo::energies(), Log::ERROR, Log::getLog(), Rivet::getRivetDataPath(), Rivet::make_pdgid_pair(), Rivet::s, Rivet::split(), AnalysisInfo::todos(), Log::TRACE, and Log::WARN.
00023 { 00024 // Build the list of directories to search 00025 vector<string> dirs; 00026 char* env = 0; 00027 // First try to use the Rivet data path variable 00028 env = getenv("RIVET_INFO_PATH"); 00029 if (env) dirs += split(env); 00030 // Then try to use the Rivet data install path 00031 dirs += getRivetDataPath(); 00032 // And the current dir 00033 dirs += "."; 00034 00035 bool found = false; 00036 string datapath = ""; 00037 foreach (const string& d, dirs) { 00038 if (d.empty()) continue; 00039 /// @todo Use system-independent separator (e.g. Boost.File) 00040 datapath = d + "/" + ananame + ".info"; 00041 Log::getLog("Rivet.AnalysisInfo") 00042 << Log::TRACE << "Looking for analysis data file '" << datapath << "'" << endl; 00043 if (access(datapath.c_str(), R_OK) == 0) { 00044 found = true; 00045 break; 00046 } 00047 } 00048 00049 // Returned AI, in semi-null state 00050 AnalysisInfo* ai = new AnalysisInfo(); 00051 ai->_beams += make_pair(ANY,ANY); 00052 ai->_name = ananame; 00053 00054 /// If no ana data file found, return null AI 00055 if (!found) return ai; 00056 00057 // Read data from YAML document 00058 Log::getLog("Rivet.AnalysisInfo") 00059 << Log::DEBUG << "Reading analysis data from " << datapath << endl; 00060 std::ifstream io(datapath.c_str()); 00061 YAML::Parser parser(io); 00062 YAML::Node doc; 00063 try { 00064 parser.GetNextDocument(doc); 00065 //cout << doc << endl; 00066 } catch (const YAML::ParserException& ex) { 00067 Log::getLog("Rivet.AnalysisInfo") 00068 << Log::ERROR << "Parse error when reading analysis data from " 00069 << datapath << endl; 00070 return ai; 00071 } 00072 00073 for (YAML::Iterator it = doc.begin(); it != doc.end(); ++it) { 00074 string key; 00075 it.first() >> key; 00076 stringstream sec; 00077 // sec << it.second(); 00078 // const string secstr = sec.str().substr(0, sec.str().length()-1); 00079 // Log::getLog("Rivet.AnalysisInfo") 00080 // << Log::TRACE << key << ": " << secstr << endl; 00081 try { 00082 if (key == "Name") { 00083 it.second() >> ai->_name; 00084 } else if (key == "Summary") { 00085 it.second() >> ai->_summary; 00086 } else if (key == "Experiment") { 00087 it.second() >> ai->_experiment; 00088 } else if (key == "Beams") { 00089 const YAML::Node& beampairs = it.second(); 00090 vector<PdgIdPair> beam_pairs; 00091 if (beampairs.size() == 2 && 00092 beampairs[0].GetType() == YAML::CT_SCALAR && 00093 beampairs[1].GetType() == YAML::CT_SCALAR) { 00094 string bstr0, bstr1; 00095 beampairs[0] >> bstr0; 00096 beampairs[1] >> bstr1; 00097 beam_pairs += make_pdgid_pair(bstr0, bstr1); 00098 } else { 00099 for (YAML::Iterator bpi = beampairs.begin(); bpi != beampairs.end(); ++bpi) { 00100 const YAML::Node& bp = *bpi; 00101 if (bp.size() == 2 && 00102 bp[0].GetType() == YAML::CT_SCALAR && 00103 bp[1].GetType() == YAML::CT_SCALAR) { 00104 string bstr0, bstr1; 00105 bp[0] >> bstr0; 00106 bp[1] >> bstr1; 00107 beam_pairs += make_pdgid_pair(bstr0, bstr1); 00108 } else { 00109 assert(0 && "Beam ID pairs have to be either a 2-tuple or a list of 2-tuples of particle names"); 00110 } 00111 } 00112 } 00113 ai->_beams = beam_pairs; 00114 } 00115 else if (key == "Energies") { 00116 const YAML::Node& energies = it.second(); 00117 vector<pair<double,double> > beam_energy_pairs; 00118 for (YAML::Iterator be = energies.begin(); be != energies.end(); ++be) { 00119 if (be->GetType() == YAML::CT_SCALAR) { 00120 // If beam energy is a scalar, then assume symmetric beams each with half that energy 00121 double sqrts; 00122 *be >> sqrts; 00123 beam_energy_pairs += make_pair(sqrts/2.0, sqrts/2.0); 00124 } else if (be->GetType() == YAML::CT_SEQUENCE) { 00125 const YAML::Node& beseq = *be; 00126 // If the sub-sequence is of length 1, then it's another scalar sqrt(s)! 00127 if (beseq.size() == 1) { 00128 double sqrts; 00129 (*be)[0] >> sqrts; 00130 beam_energy_pairs += make_pair(sqrts/2.0, sqrts/2.0); 00131 } else if (beseq.size() == 2) { 00132 vector<double> beamenergies; 00133 double beamenergy0, beamenergy1; 00134 beseq[0] >> beamenergy0; 00135 beseq[1] >> beamenergy1; 00136 beam_energy_pairs += make_pair(beamenergy0, beamenergy1); 00137 } else { 00138 assert(0 && "Beam energies have to be a list of either numbers or pairs of numbers"); 00139 } 00140 } else { 00141 assert(0 && "Beam energies have to be a list of either numbers or pairs of numbers"); 00142 } 00143 } 00144 ai->_energies = beam_energy_pairs; 00145 } else if (key == "Collider") { 00146 it.second() >> ai->_collider; 00147 } else if (key == "SpiresID") { 00148 it.second() >> ai->_spiresId; 00149 } else if (key == "BibKey") { 00150 it.second() >> ai->_bibKey; 00151 } else if (key == "BibTeX") { 00152 it.second() >> ai->_bibTeX;//Body; 00153 } else if (key == "Status") { 00154 it.second() >> ai->_status; 00155 } else if (key == "ToDo") { 00156 const YAML::Node& todos = it.second(); 00157 for (YAML::Iterator todo = todos.begin(); todo != todos.end(); ++todo) { 00158 string s; 00159 *todo >> s; 00160 ai->_todos += s; 00161 } 00162 } else if (key == "NeedCrossSection") { 00163 it.second() >> ai->_needsCrossSection; 00164 } else if (key == "RunInfo") { 00165 it.second() >> ai->_runInfo; 00166 } else if (key == "Description") { 00167 it.second() >> ai->_description; 00168 } else if (key == "Year") { 00169 it.second() >> ai->_year; 00170 } else if (key == "Authors") { 00171 const YAML::Node& authors = it.second(); 00172 for (YAML::Iterator a = authors.begin(); a != authors.end(); ++a) { 00173 string astr; 00174 *a >> astr; 00175 ai->_authors += astr; 00176 } 00177 } else if (key == "References") { 00178 const YAML::Node& refs = it.second(); 00179 for (YAML::Iterator r = refs.begin(); r != refs.end(); ++r) { 00180 string rstr; 00181 *r >> rstr; 00182 ai->_references += rstr; 00183 } 00184 } 00185 } catch (const YAML::RepresentationException& ex) { 00186 Log::getLog("Rivet.Analysis") 00187 << Log::WARN << "Type error when reading analysis data '" 00188 << key << "' from " << datapath << endl; 00189 } 00190 } 00191 Log::getLog("Rivet.AnalysisInfo") << Log::TRACE << "AnalysisInfo pointer = " << ai << endl; 00192 return ai; 00193 }
std::string name | ( | ) | const [inline] |
Get the name of the analysis. By default this is computed by combining the results of the experiment, year and Spires ID metadata methods and you should only override it if there's a good reason why those won't work.
Definition at line 43 of file AnalysisInfo.hh.
References AnalysisInfo::_name, AnalysisInfo::experiment(), AnalysisInfo::spiresId(), and AnalysisInfo::year().
Referenced by Rivet::toString().
00043 { 00044 if (!_name.empty()) return _name; 00045 if (!experiment().empty() && !year().empty() && !spiresId().empty()) { 00046 return experiment() + "_" + year() + "_S" + spiresId(); 00047 } 00048 return ""; 00049 }
const std::string& spiresId | ( | ) | const [inline] |
Get a description of the analysis.
Definition at line 52 of file AnalysisInfo.hh.
References AnalysisInfo::_spiresId.
Referenced by AnalysisInfo::name().
00052 { return _spiresId; }
const std::vector<std::string>& authors | ( | ) | const [inline] |
Names & emails of paper/analysis authors. Names and email of authors in 'NAME <EMAIL>' format. The first name in the list should be the primary contact person.
Definition at line 57 of file AnalysisInfo.hh.
References AnalysisInfo::_authors.
Referenced by AnalysisInfo::make().
00057 { return _authors; }
const std::string& summary | ( | ) | const [inline] |
Get a short description of the analysis. Short (one sentence) description used as an index entry. Use description() to provide full descriptive paragraphs of analysis details.
Definition at line 63 of file AnalysisInfo.hh.
References AnalysisInfo::_summary.
Referenced by Rivet::toString().
00063 { return _summary; }
const std::string& description | ( | ) | const [inline] |
Get a full description of the analysis. Full textual description of this analysis, what it is useful for, what experimental techniques are applied, etc. Should be treated as a chunk of restructuredText (http://docutils.sourceforge.net/rst.html), with equations to be rendered as LaTeX with amsmath operators.
Definition at line 70 of file AnalysisInfo.hh.
References AnalysisInfo::_description.
00070 { return _description; }
const std::string& runInfo | ( | ) | const [inline] |
Information about the events needed as input for this analysis. Event types, energies, kinematic cuts, particles to be considered stable, etc. etc. Should be treated as a restructuredText bullet list (http://docutils.sourceforge.net/rst.html).
Definition at line 76 of file AnalysisInfo.hh.
References AnalysisInfo::_runInfo.
00076 { return _runInfo; }
Beam particle types.
Definition at line 79 of file AnalysisInfo.hh.
References AnalysisInfo::_beams.
Referenced by Analysis::requiredBeams().
00079 { return _beams; }
const std::vector<std::pair<double,double> >& energies | ( | ) | const [inline] |
Sets of valid beam energy pairs.
Definition at line 82 of file AnalysisInfo.hh.
References AnalysisInfo::_energies.
Referenced by Analysis::energies(), and AnalysisInfo::make().
00082 { return _energies; }
const std::string& experiment | ( | ) | const [inline] |
Experiment which performed and published this analysis.
Definition at line 85 of file AnalysisInfo.hh.
References AnalysisInfo::_experiment.
Referenced by AnalysisInfo::name().
00085 { return _experiment; }
const std::string& collider | ( | ) | const [inline] |
Collider on which the experiment ran.
Definition at line 88 of file AnalysisInfo.hh.
References AnalysisInfo::_collider.
00088 { return _collider; }
const std::string& year | ( | ) | const [inline] |
When the original experimental analysis was published. When the refereed paper on which this is based was published, according to SPIRES.
Definition at line 93 of file AnalysisInfo.hh.
References AnalysisInfo::_year.
Referenced by AnalysisInfo::name().
00093 { return _year; }
const std::vector<std::string>& references | ( | ) | const [inline] |
Journal, and preprint references.
Definition at line 96 of file AnalysisInfo.hh.
References AnalysisInfo::_references.
00096 { return _references; }
const std::string& bibKey | ( | ) | const [inline] |
BibTeX citation key for this article.
Definition at line 99 of file AnalysisInfo.hh.
References AnalysisInfo::_bibKey.
00099 { return _bibKey;}
const std::string& bibTeX | ( | ) | const [inline] |
BibTeX citation entry for this article.
Definition at line 102 of file AnalysisInfo.hh.
References AnalysisInfo::_bibTeX.
00102 { 00103 //return "@Article{" + bibKey() + ",\n" + _bibTeXBody + "\n}"; 00104 return _bibTeX; 00105 }
const std::string& status | ( | ) | const [inline] |
Whether this analysis is trusted (in any way!).
Definition at line 108 of file AnalysisInfo.hh.
References AnalysisInfo::_status.
Referenced by Rivet::toString().
00108 { return _status; }
const std::vector<std::string>& todos | ( | ) | const [inline] |
Any work to be done on this analysis.
Definition at line 111 of file AnalysisInfo.hh.
References AnalysisInfo::_todos.
Referenced by AnalysisInfo::make().
00111 { return _todos; }
bool needsCrossSection | ( | ) | const [inline] |
Return true if this analysis needs to know the process cross-section.
Definition at line 115 of file AnalysisInfo.hh.
References AnalysisInfo::_needsCrossSection.
00115 { return _needsCrossSection; }
void clear | ( | ) | [inline, private] |
Definition at line 139 of file AnalysisInfo.hh.
References AnalysisInfo::_authors, AnalysisInfo::_beams, AnalysisInfo::_bibKey, AnalysisInfo::_bibTeX, AnalysisInfo::_collider, AnalysisInfo::_description, AnalysisInfo::_energies, AnalysisInfo::_experiment, AnalysisInfo::_name, AnalysisInfo::_needsCrossSection, AnalysisInfo::_references, AnalysisInfo::_runInfo, AnalysisInfo::_spiresId, AnalysisInfo::_status, AnalysisInfo::_summary, AnalysisInfo::_todos, and AnalysisInfo::_year.
Referenced by AnalysisInfo::AnalysisInfo().
00139 { 00140 _name = ""; 00141 _spiresId = ""; 00142 _authors.clear(); 00143 _summary = ""; 00144 _description = ""; 00145 _runInfo = ""; 00146 _experiment = ""; 00147 _collider = ""; 00148 _beams.clear(); 00149 _energies.clear(); 00150 _year = ""; 00151 _references.clear(); 00152 _bibKey = ""; 00153 _bibTeX = ""; 00154 //_bibTeXBody = ""; 00155 _status = ""; 00156 _todos.clear(); 00157 _needsCrossSection = false; 00158 }
friend class Analysis [friend] |
std::string _name [private] |
Definition at line 120 of file AnalysisInfo.hh.
Referenced by AnalysisInfo::clear(), AnalysisInfo::make(), and AnalysisInfo::name().
std::string _spiresId [private] |
Definition at line 121 of file AnalysisInfo.hh.
Referenced by AnalysisInfo::clear(), AnalysisInfo::make(), and AnalysisInfo::spiresId().
std::vector<std::string> _authors [private] |
Definition at line 122 of file AnalysisInfo.hh.
Referenced by AnalysisInfo::authors(), AnalysisInfo::clear(), and AnalysisInfo::make().
std::string _summary [private] |
Definition at line 123 of file AnalysisInfo.hh.
Referenced by AnalysisInfo::clear(), AnalysisInfo::make(), and AnalysisInfo::summary().
std::string _description [private] |
Definition at line 124 of file AnalysisInfo.hh.
Referenced by AnalysisInfo::clear(), AnalysisInfo::description(), and AnalysisInfo::make().
std::string _runInfo [private] |
Definition at line 125 of file AnalysisInfo.hh.
Referenced by AnalysisInfo::clear(), AnalysisInfo::make(), and AnalysisInfo::runInfo().
std::string _experiment [private] |
Definition at line 126 of file AnalysisInfo.hh.
Referenced by AnalysisInfo::clear(), AnalysisInfo::experiment(), and AnalysisInfo::make().
std::string _collider [private] |
Definition at line 127 of file AnalysisInfo.hh.
Referenced by AnalysisInfo::clear(), AnalysisInfo::collider(), and AnalysisInfo::make().
Definition at line 128 of file AnalysisInfo.hh.
Referenced by AnalysisInfo::beams(), AnalysisInfo::clear(), and AnalysisInfo::make().
std::vector<std::pair<double, double> > _energies [private] |
Definition at line 129 of file AnalysisInfo.hh.
Referenced by AnalysisInfo::clear(), AnalysisInfo::energies(), and AnalysisInfo::make().
std::string _year [private] |
Definition at line 130 of file AnalysisInfo.hh.
Referenced by AnalysisInfo::clear(), AnalysisInfo::make(), and AnalysisInfo::year().
std::vector<std::string> _references [private] |
Definition at line 131 of file AnalysisInfo.hh.
Referenced by AnalysisInfo::clear(), AnalysisInfo::make(), and AnalysisInfo::references().
std::string _bibKey [private] |
Definition at line 132 of file AnalysisInfo.hh.
Referenced by AnalysisInfo::bibKey(), AnalysisInfo::clear(), and AnalysisInfo::make().
std::string _bibTeX [private] |
Definition at line 133 of file AnalysisInfo.hh.
Referenced by AnalysisInfo::bibTeX(), AnalysisInfo::clear(), and AnalysisInfo::make().
std::string _status [private] |
Definition at line 135 of file AnalysisInfo.hh.
Referenced by AnalysisInfo::clear(), AnalysisInfo::make(), and AnalysisInfo::status().
std::vector<std::string> _todos [private] |
Definition at line 136 of file AnalysisInfo.hh.
Referenced by AnalysisInfo::clear(), AnalysisInfo::make(), and AnalysisInfo::todos().
bool _needsCrossSection [private] |
Definition at line 137 of file AnalysisInfo.hh.
Referenced by AnalysisInfo::clear(), AnalysisInfo::make(), and AnalysisInfo::needsCrossSection().