00001 // -*- C++ -*- 00002 #ifndef RIVET_AnalysisInfo_HH 00003 #define RIVET_AnalysisInfo_HH 00004 00005 #include "Rivet/Rivet.hh" 00006 #include <ostream> 00007 00008 namespace Rivet { 00009 00010 00011 class AnalysisInfo { 00012 /// @todo Remove this when all metadata taken from YAML 00013 friend class Analysis; 00014 00015 00016 public: 00017 00018 /// Static factory method: returns null pointer if no metadata found 00019 static AnalysisInfo* make(const std::string& name); 00020 00021 /// @name Standard constructors and destructors. 00022 //@{ 00023 00024 /// The default constructor. 00025 AnalysisInfo() { clear(); } 00026 00027 /// The destructor. 00028 ~AnalysisInfo() { } 00029 00030 //@} 00031 00032 00033 public: 00034 00035 /// @name Metadata 00036 /// Metadata is used for querying from the command line and also for 00037 /// building web pages and the analysis pages in the Rivet manual. 00038 //@{ 00039 00040 /// Get the name of the analysis. By default this is computed by 00041 /// combining the results of the experiment, year and Spires ID 00042 /// metadata methods and you should only override it if there's a 00043 /// good reason why those won't work. 00044 std::string name() const { 00045 if (!_name.empty()) return _name; 00046 if (!experiment().empty() && !year().empty() && !spiresId().empty()) { 00047 return experiment() + "_" + year() + "_S" + spiresId(); 00048 } 00049 return ""; 00050 } 00051 00052 /// Set the name of the analysis. 00053 void setName(const std::string& name) { _name = name; } 00054 00055 00056 /// Get the SPIRES ID code for this analysis. 00057 const std::string& spiresId() const { return _spiresId; } 00058 00059 /// Set the SPIRES ID code for this analysis. 00060 void setSpiresId(const std::string& spiresId) { _spiresId = spiresId; } 00061 00062 00063 /// @brief Names & emails of paper/analysis authors. 00064 /// Names and email of authors in 'NAME <EMAIL>' format. The first 00065 /// name in the list should be the primary contact person. 00066 const std::vector<std::string>& authors() const { return _authors; } 00067 00068 /// Set the author list. 00069 void setAuthors(const std::vector<std::string>& authors) { _authors = authors; } 00070 00071 00072 /// @brief Get a short description of the analysis. 00073 /// Short (one sentence) description used as an index entry. 00074 /// Use @a description() to provide full descriptive paragraphs 00075 /// of analysis details. 00076 const std::string& summary() const { return _summary; } 00077 00078 /// Set the short description for this analysis. 00079 void setSummary(const std::string& summary) { _summary = summary; } 00080 00081 00082 /// @brief Get a full description of the analysis. 00083 /// Full textual description of this analysis, what it is useful for, 00084 /// what experimental techniques are applied, etc. Should be treated 00085 /// as a chunk of restructuredText (http://docutils.sourceforge.net/rst.html), 00086 /// with equations to be rendered as LaTeX with amsmath operators. 00087 const std::string& description() const { return _description; } 00088 00089 /// Set the full description for this analysis. 00090 void setDescription(const std::string& description) { _description = description; } 00091 00092 00093 /// @brief Information about the events needed as input for this analysis. 00094 /// Event types, energies, kinematic cuts, particles to be considered 00095 /// stable, etc. etc. Should be treated as a restructuredText bullet list 00096 /// (http://docutils.sourceforge.net/rst.html) 00097 const std::string& runInfo() const { return _runInfo; } 00098 00099 /// Set the full description for this analysis. 00100 void setRunInfo(const std::string& runInfo) { _runInfo = runInfo; } 00101 00102 00103 /// Beam particle types 00104 const std::vector<PdgIdPair>& beams() const { return _beams; } 00105 00106 /// Set beam particle types 00107 void setBeams(const std::vector<PdgIdPair>& beams) { _beams = beams; } 00108 00109 00110 /// Sets of valid beam energies 00111 const std::vector<std::pair<double,double> >& energies() const { return _energies; } 00112 00113 /// Set the valid beam energies 00114 void setEnergies(const std::vector<std::pair<double, double> >& energies) { _energies = energies; } 00115 00116 00117 /// Experiment which performed and published this analysis. 00118 const std::string& experiment() const { return _experiment; } 00119 00120 /// Set the experiment which performed and published this analysis. 00121 void setExperiment(const std::string& experiment) { _experiment = experiment; } 00122 00123 00124 /// Collider on which the experiment ran. 00125 const std::string& collider() const { return _collider; } 00126 00127 /// Set the collider on which the experiment ran. 00128 void setCollider(const std::string& collider) { _collider = collider; } 00129 00130 00131 /// @brief When the original experimental analysis was published. 00132 /// When the refereed paper on which this is based was published, 00133 /// according to SPIRES. 00134 const std::string& year() const { return _year; } 00135 00136 /// Set the year in which the original experimental analysis was published. 00137 void setYear(const std::string& year) { _year = year; } 00138 00139 00140 /// Journal and preprint references. 00141 const std::vector<std::string>& references() const { return _references; } 00142 00143 /// Set the journal and preprint reference list. 00144 void setReferences(const std::vector<std::string>& references) { _references = references; } 00145 00146 00147 /// BibTeX citation key for this article. 00148 const std::string& bibKey() const { return _bibKey;} 00149 00150 /// Set the BibTeX citation key for this article. 00151 void setBibKey(const std::string& bibKey) { _bibKey = bibKey; } 00152 00153 00154 /// BibTeX citation entry for this article. 00155 const std::string& bibTeX() const { return _bibTeX; } 00156 00157 /// Set the BibTeX citation entry for this article. 00158 void setBibTeX(const std::string& bibTeX) { _bibTeX = bibTeX; } 00159 00160 00161 /// Whether this analysis is trusted (in any way!) 00162 const std::string& status() const { return _status; } 00163 00164 /// Set the analysis code status. 00165 void setStatus(const std::string& status) { _status = status; } 00166 00167 00168 /// Any work to be done on this analysis. 00169 const std::vector<std::string>& todos() const { return _todos; } 00170 00171 /// Set the to-do list. 00172 void setTodos(const std::vector<std::string>& todos) { _todos = todos; } 00173 00174 00175 /// Return true if this analysis needs to know the process cross-section. 00176 bool needsCrossSection() const { return _needsCrossSection; } 00177 00178 /// Return true if this analysis needs to know the process cross-section. 00179 void setNeedsCrossSection(bool needXsec) { _needsCrossSection = needXsec; } 00180 00181 //@} 00182 00183 00184 private: 00185 00186 std::string _name; 00187 std::string _spiresId; 00188 std::vector<std::string> _authors; 00189 std::string _summary; 00190 std::string _description; 00191 std::string _runInfo; 00192 std::string _experiment; 00193 std::string _collider; 00194 std::vector<std::pair<PdgId, PdgId> > _beams; 00195 std::vector<std::pair<double, double> > _energies; 00196 std::string _year; 00197 std::vector<std::string> _references; 00198 std::string _bibKey; 00199 std::string _bibTeX; 00200 //std::string _bibTeXBody; //< Was thinking of avoiding duplication of BibKey... 00201 std::string _status; 00202 std::vector<std::string> _todos; 00203 bool _needsCrossSection; 00204 00205 void clear() { 00206 _name = ""; 00207 _spiresId = ""; 00208 _authors.clear(); 00209 _summary = ""; 00210 _description = ""; 00211 _runInfo = ""; 00212 _experiment = ""; 00213 _collider = ""; 00214 _beams.clear(); 00215 _energies.clear(); 00216 _year = ""; 00217 _references.clear(); 00218 _bibKey = ""; 00219 _bibTeX = ""; 00220 //_bibTeXBody = ""; 00221 _status = ""; 00222 _todos.clear(); 00223 _needsCrossSection = false; 00224 } 00225 00226 }; 00227 00228 00229 /// String representation 00230 std::string toString(const AnalysisInfo& ai); 00231 00232 /// Stream an AnalysisInfo as a text description 00233 inline std::ostream& operator<<(std::ostream& os, const AnalysisInfo& ai) { 00234 os << toString(ai); 00235 return os; 00236 } 00237 00238 00239 } 00240 00241 #endif