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