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 /// Get the name of the analysis. By default this is computed by 00040 /// combining the results of the experiment, year and Spires ID 00041 /// metadata methods and you should only override it if there's a 00042 /// good reason why those won't work. 00043 std::string name() const { 00044 if (!_name.empty()) return _name; 00045 if (!experiment().empty() && !year().empty() && !spiresId().empty()) { 00046 return experiment() + "_" + year() + "_S" + spiresId(); 00047 } 00048 return ""; 00049 } 00050 00051 /// Get a description of the analysis. 00052 const std::string& spiresId() const { return _spiresId; } 00053 00054 /// @brief Names & emails of paper/analysis authors. 00055 /// Names and email of authors in 'NAME <EMAIL>' format. The first 00056 /// name in the list should be the primary contact person. 00057 const std::vector<std::string>& authors() const { return _authors; } 00058 00059 /// @brief Get a short description of the analysis. 00060 /// Short (one sentence) description used as an index entry. 00061 /// Use @a description() to provide full descriptive paragraphs 00062 /// of analysis details. 00063 const std::string& summary() const { return _summary; } 00064 00065 /// @brief Get a full description of the analysis. 00066 /// Full textual description of this analysis, what it is useful for, 00067 /// what experimental techniques are applied, etc. Should be treated 00068 /// as a chunk of restructuredText (http://docutils.sourceforge.net/rst.html), 00069 /// with equations to be rendered as LaTeX with amsmath operators. 00070 const std::string& description() const { return _description; } 00071 00072 /// @brief Information about the events needed as input for this analysis. 00073 /// Event types, energies, kinematic cuts, particles to be considered 00074 /// stable, etc. etc. Should be treated as a restructuredText bullet list 00075 /// (http://docutils.sourceforge.net/rst.html) 00076 const std::string& runInfo() const { return _runInfo; } 00077 00078 /// Beam particle types 00079 const std::vector<std::pair<PdgId,PdgId> >& beams() const { return _beams; } 00080 00081 /// Sets of valid beam energy pairs 00082 const std::vector<std::pair<double,double> >& energies() const { return _energies; } 00083 00084 /// Experiment which performed and published this analysis. 00085 const std::string& experiment() const { return _experiment; } 00086 00087 /// Collider on which the experiment ran. 00088 const std::string& collider() const { return _collider; } 00089 00090 /// @brief When the original experimental analysis was published. 00091 /// When the refereed paper on which this is based was published, 00092 /// according to SPIRES. 00093 const std::string& year() const { return _year; } 00094 00095 /// Journal, and preprint references. 00096 const std::vector<std::string>& references() const { return _references; } 00097 00098 /// BibTeX citation key for this article. 00099 const std::string& bibKey() const { return _bibKey;} 00100 00101 /// BibTeX citation entry for this article. 00102 const std::string& bibTeX() const { 00103 //return "@Article{" + bibKey() + ",\n" + _bibTeXBody + "\n}"; 00104 return _bibTeX; 00105 } 00106 00107 /// Whether this analysis is trusted (in any way!) 00108 const std::string& status() const { return _status; } 00109 00110 /// Any work to be done on this analysis. 00111 const std::vector<std::string>& todos() const { return _todos; } 00112 //@} 00113 00114 /// Return true if this analysis needs to know the process cross-section. 00115 bool needsCrossSection() const { return _needsCrossSection; } 00116 00117 00118 private: 00119 00120 std::string _name; 00121 std::string _spiresId; 00122 std::vector<std::string> _authors; 00123 std::string _summary; 00124 std::string _description; 00125 std::string _runInfo; 00126 std::string _experiment; 00127 std::string _collider; 00128 std::vector<std::pair<PdgId, PdgId> > _beams; 00129 std::vector<std::pair<double, double> > _energies; 00130 std::string _year; 00131 std::vector<std::string> _references; 00132 std::string _bibKey; 00133 std::string _bibTeX; 00134 //std::string _bibTeXBody; //< Was thinking of avoiding duplication of BibKey... 00135 std::string _status; 00136 std::vector<std::string> _todos; 00137 bool _needsCrossSection; 00138 00139 void clear() { 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 } 00159 00160 }; 00161 00162 00163 /// String representation 00164 std::string toString(const AnalysisInfo& ai); 00165 00166 /// Stream an AnalysisInfo as a text description 00167 inline std::ostream& operator<<(std::ostream& os, const AnalysisInfo& ai) { 00168 os << toString(ai); 00169 return os; 00170 } 00171 00172 00173 } 00174 00175 #endif