Rivet  1.8.0
AnalysisInfo.hh
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 
00015     static AnalysisInfo* make(const std::string& name);
00016 
00018 
00019 
00021     AnalysisInfo() { clear(); }
00022 
00024     ~AnalysisInfo() { }
00025 
00027 
00028 
00029   public:
00030 
00034 
00035 
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 
00051     void setName(const std::string& name) { _name = name; }
00052 
00053 
00055     const std::string& inspireId() const { return _inspireId; }
00056 
00058     void setInspireId(const std::string& inspireId) { _inspireId = inspireId; }
00059 
00060 
00062     const std::string& spiresId() const { return _spiresId; }
00063 
00065     void setSpiresId(const std::string& spiresId) { _spiresId = spiresId; }
00066 
00067 
00071     const std::vector<std::string>& authors() const { return _authors; }
00072 
00074     void setAuthors(const std::vector<std::string>& authors) { _authors = authors; }
00075 
00076 
00081     const std::string& summary() const { return _summary; }
00082 
00084     void setSummary(const std::string& summary) { _summary = summary; }
00085 
00086 
00092     const std::string& description() const { return _description; }
00093 
00095     void setDescription(const std::string& description) { _description = description; }
00096 
00097 
00102     const std::string& runInfo() const { return _runInfo; }
00103 
00105     void setRunInfo(const std::string& runInfo) { _runInfo = runInfo; }
00106 
00107 
00109     const std::vector<PdgIdPair>& beams() const { return _beams; }
00110 
00112     void setBeams(const std::vector<PdgIdPair>& beams) { _beams = beams; }
00113 
00114 
00116     const std::vector<std::pair<double,double> >& energies() const { return _energies; }
00117 
00119     void setEnergies(const std::vector<std::pair<double, double> >& energies) { _energies = energies; }
00120 
00121 
00123     const std::string& experiment() const { return _experiment; }
00124 
00126     void setExperiment(const std::string& experiment) { _experiment = experiment; }
00127 
00128 
00130     const std::string& collider() const { return _collider; }
00131 
00133     void setCollider(const std::string& collider) { _collider = collider; }
00134 
00135 
00139     const std::string& year() const { return _year; }
00140 
00142     void setYear(const std::string& year) { _year = year; }
00143 
00144 
00146     const std::vector<std::string>& references() const { return _references; }
00147 
00149     void setReferences(const std::vector<std::string>& references) { _references = references; }
00150 
00151 
00153     const std::string& bibKey() const { return _bibKey;}
00154 
00156     void setBibKey(const std::string& bibKey) { _bibKey = bibKey; }
00157 
00158 
00160     const std::string& bibTeX() const { return _bibTeX; }
00161 
00163     void setBibTeX(const std::string& bibTeX) { _bibTeX = bibTeX; }
00164 
00165 
00167     const std::string& status() const { return _status; }
00168 
00170     void setStatus(const std::string& status) { _status = status; }
00171 
00172 
00174     const std::vector<std::string>& todos() const { return _todos; }
00175 
00177     void setTodos(const std::vector<std::string>& todos) { _todos = todos; }
00178 
00179 
00181     bool needsCrossSection() const { return _needsCrossSection; }
00182 
00184     void setNeedsCrossSection(bool needXsec) { _needsCrossSection = needXsec; }
00185 
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 
00236   std::string toString(const AnalysisInfo& ai);
00237 
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