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 public: 00016 00017 /// Static factory method: returns null pointer if no metadata found 00018 static AnalysisInfo* make(const std::string& name); 00019 00020 /// @name Standard constructors and destructors. 00021 //@{ 00022 00023 /// The default constructor. 00024 AnalysisInfo() { } 00025 00026 /// The destructor. 00027 ~AnalysisInfo() { } 00028 00029 //@} 00030 00031 00032 public: 00033 00034 /// @name Metadata 00035 /// Metadata is used for querying from the command line and also for 00036 /// building web pages and the analysis pages in the Rivet manual. 00037 //@{ 00038 /// Get the name of the analysis. By default this is computed by 00039 /// combining the results of the experiment, year and Spires ID 00040 /// metadata methods and you should only override it if there's a 00041 /// good reason why those won't work. 00042 std::string name() const { 00043 if (!_name.empty()) return _name; 00044 if (!experiment().empty() && !year().empty() && !spiresId().empty()) { 00045 return experiment() + "_" + year() + "_S" + spiresId(); 00046 } 00047 return ""; 00048 } 00049 00050 /// Get a description of the analysis. 00051 const std::string& spiresId() const { return _spiresId; } 00052 00053 /// @brief Names & emails of paper/analysis authors. 00054 /// Names and email of authors in 'NAME <EMAIL>' format. The first 00055 /// name in the list should be the primary contact person. 00056 const std::vector<std::string>& authors() const { return _authors; } 00057 00058 /// @brief Get a short description of the analysis. 00059 /// Short (one sentence) description used as an index entry. 00060 /// Use @a description() to provide full descriptive paragraphs 00061 /// of analysis details. 00062 const std::string& summary() const { return _summary; } 00063 00064 /// @brief Get a full description of the analysis. 00065 /// Full textual description of this analysis, what it is useful for, 00066 /// what experimental techniques are applied, etc. Should be treated 00067 /// as a chunk of restructuredText (http://docutils.sourceforge.net/rst.html), 00068 /// with equations to be rendered as LaTeX with amsmath operators. 00069 const std::string& description() const { return _description; } 00070 00071 /// @brief Information about the events needed as input for this analysis. 00072 /// Event types, energies, kinematic cuts, particles to be considered 00073 /// stable, etc. etc. Should be treated as a restructuredText bullet list 00074 /// (http://docutils.sourceforge.net/rst.html) 00075 const std::string& runInfo() const { return _runInfo; } 00076 00077 /// Beam particle types 00078 const std::pair<ParticleName,ParticleName>& beams() const { return _beams; } 00079 00080 /// Sets of valid beam energy pairs 00081 const std::vector<std::pair<double,double> >& energies() const { return _energies; } 00082 00083 /// Experiment which performed and published this analysis. 00084 const std::string& experiment() const { return _experiment; } 00085 00086 /// Collider on which the experiment ran. 00087 const std::string& collider() const { return _collider; } 00088 00089 /// Incoming beams required by this analysis. 00090 // const BeamPair& beams() const { return _beams; } 00091 00092 /// @brief When the original experimental analysis was published. 00093 /// When the refereed paper on which this is based was published, 00094 /// according to SPIRES. 00095 const std::string& year() const { return _year; } 00096 00097 /// Journal, and preprint references. 00098 const std::vector<std::string>& references() const { return _references; } 00099 00100 /// Whether this analysis is trusted (in any way!) 00101 const std::string& status() const { return _status; } 00102 //@} 00103 00104 /// Return true if this analysis needs to know the process cross-section. 00105 bool needsCrossSection() const { return _needsCrossSection; } 00106 00107 private: 00108 00109 std::string _name; 00110 std::string _spiresId; 00111 std::vector<std::string> _authors; 00112 std::string _summary; 00113 std::string _description; 00114 std::string _runInfo; 00115 std::string _experiment; 00116 std::string _collider; 00117 std::pair<ParticleName, ParticleName> _beams; 00118 std::vector<std::pair<double, double> > _energies; 00119 std::string _year; 00120 std::vector<std::string> _references; 00121 std::string _status; 00122 bool _needsCrossSection; 00123 00124 }; 00125 00126 00127 /// String representation 00128 std::string toString(const AnalysisInfo& ai); 00129 00130 /// Stream an AnalysisInfo as a text description 00131 inline std::ostream& operator<<(std::ostream& os, const AnalysisInfo& ai) { 00132 os << toString(ai); 00133 return os; 00134 } 00135 00136 00137 } 00138 00139 #endif