Rivet  1.8.0
AnalysisInfo.hh
1 // -*- C++ -*-
2 #ifndef RIVET_AnalysisInfo_HH
3 #define RIVET_AnalysisInfo_HH
4 
5 #include "Rivet/Rivet.hh"
6 #include <ostream>
7 
8 namespace Rivet {
9 
10 
11  class AnalysisInfo {
12  public:
13 
15  static AnalysisInfo* make(const std::string& name);
16 
18 
19 
21  AnalysisInfo() { clear(); }
22 
25 
27 
28 
29  public:
30 
34 
35 
38  std::string name() const {
39  if (!_name.empty()) return _name;
40  if (!experiment().empty() && !year().empty()) {
41  if (!inspireId().empty()) {
42  return experiment() + "_" + year() + "_I" + inspireId();
43  } else if (!spiresId().empty()) {
44  return experiment() + "_" + year() + "_S" + spiresId();
45  }
46  }
47  return "";
48  }
49 
51  void setName(const std::string& name) { _name = name; }
52 
53 
55  const std::string& inspireId() const { return _inspireId; }
56 
58  void setInspireId(const std::string& inspireId) { _inspireId = inspireId; }
59 
60 
62  const std::string& spiresId() const { return _spiresId; }
63 
65  void setSpiresId(const std::string& spiresId) { _spiresId = spiresId; }
66 
67 
71  const std::vector<std::string>& authors() const { return _authors; }
72 
74  void setAuthors(const std::vector<std::string>& authors) { _authors = authors; }
75 
76 
81  const std::string& summary() const { return _summary; }
82 
84  void setSummary(const std::string& summary) { _summary = summary; }
85 
86 
92  const std::string& description() const { return _description; }
93 
95  void setDescription(const std::string& description) { _description = description; }
96 
97 
102  const std::string& runInfo() const { return _runInfo; }
103 
105  void setRunInfo(const std::string& runInfo) { _runInfo = runInfo; }
106 
107 
109  const std::vector<PdgIdPair>& beams() const { return _beams; }
110 
112  void setBeams(const std::vector<PdgIdPair>& beams) { _beams = beams; }
113 
114 
116  const std::vector<std::pair<double,double> >& energies() const { return _energies; }
117 
119  void setEnergies(const std::vector<std::pair<double, double> >& energies) { _energies = energies; }
120 
121 
123  const std::string& experiment() const { return _experiment; }
124 
126  void setExperiment(const std::string& experiment) { _experiment = experiment; }
127 
128 
130  const std::string& collider() const { return _collider; }
131 
133  void setCollider(const std::string& collider) { _collider = collider; }
134 
135 
139  const std::string& year() const { return _year; }
140 
142  void setYear(const std::string& year) { _year = year; }
143 
144 
146  const std::vector<std::string>& references() const { return _references; }
147 
149  void setReferences(const std::vector<std::string>& references) { _references = references; }
150 
151 
153  const std::string& bibKey() const { return _bibKey;}
154 
156  void setBibKey(const std::string& bibKey) { _bibKey = bibKey; }
157 
158 
160  const std::string& bibTeX() const { return _bibTeX; }
161 
163  void setBibTeX(const std::string& bibTeX) { _bibTeX = bibTeX; }
164 
165 
167  const std::string& status() const { return _status; }
168 
170  void setStatus(const std::string& status) { _status = status; }
171 
172 
174  const std::vector<std::string>& todos() const { return _todos; }
175 
177  void setTodos(const std::vector<std::string>& todos) { _todos = todos; }
178 
179 
181  bool needsCrossSection() const { return _needsCrossSection; }
182 
184  void setNeedsCrossSection(bool needXsec) { _needsCrossSection = needXsec; }
185 
187 
188 
189  private:
190 
191  std::string _name;
192  std::string _spiresId, _inspireId;
193  std::vector<std::string> _authors;
194  std::string _summary;
195  std::string _description;
196  std::string _runInfo;
197  std::string _experiment;
198  std::string _collider;
199  std::vector<std::pair<PdgId, PdgId> > _beams;
200  std::vector<std::pair<double, double> > _energies;
201  std::string _year;
202  std::vector<std::string> _references;
203  std::string _bibKey;
204  std::string _bibTeX;
205  //std::string _bibTeXBody; //< Was thinking of avoiding duplication of BibKey...
206  std::string _status;
207  std::vector<std::string> _todos;
208  bool _needsCrossSection;
209 
210  void clear() {
211  _name = "";
212  _spiresId = "";
213  _inspireId = "";
214  _authors.clear();
215  _summary = "";
216  _description = "";
217  _runInfo = "";
218  _experiment = "";
219  _collider = "";
220  _beams.clear();
221  _energies.clear();
222  _year = "";
223  _references.clear();
224  _bibKey = "";
225  _bibTeX = "";
226  //_bibTeXBody = "";
227  _status = "";
228  _todos.clear();
229  _needsCrossSection = false;
230  }
231 
232  };
233 
234 
236  std::string toString(const AnalysisInfo& ai);
237 
239  inline std::ostream& operator<<(std::ostream& os, const AnalysisInfo& ai) {
240  os << toString(ai);
241  return os;
242  }
243 
244 
245 }
246 
247 #endif