|
[Rivet-svn] r1668 - in trunk: include/Rivet src src/Toolsblackhole at projects.hepforge.org blackhole at projects.hepforge.orgWed Jul 8 11:04:18 BST 2009
Author: buckley Date: Wed Jul 8 11:04:18 2009 New Revision: 1668 Log: Adding the start of an analysis metadata system where the data will be taken from the YAML files rather than being hard-coded into the analysis classes. Added: trunk/include/Rivet/AnalysisInfo.hh trunk/src/AnalysisInfo.cc Modified: trunk/include/Rivet/Makefile.am trunk/src/Makefile.am trunk/src/Tools/RivetPaths.cc Added: trunk/include/Rivet/AnalysisInfo.hh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/include/Rivet/AnalysisInfo.hh Wed Jul 8 11:04:18 2009 (r1668) @@ -0,0 +1,124 @@ +// -*- C++ -*- +#ifndef RIVET_AnalysisInfo_HH +#define RIVET_AnalysisInfo_HH + +#include "Rivet/Rivet.hh" +#include <ostream> + +namespace Rivet { + + + class AnalysisInfo { + + public: + + /// Static factory method: returns null pointer if no metadata found + static const AnalysisInfo* make(const std::string& name); + + + /// @name Standard constructors and destructors. + //@{ + /// The default constructor. + AnalysisInfo() { } + + /// The destructor. + ~AnalysisInfo() { } + //@} + + public: + + /// @name Metadata + /// Metadata is used for querying from the command line and also for + /// building web pages and the analysis pages in the Rivet manual. + //@{ + /// Get the name of the analysis. By default this is computed by + /// combining the results of the experiment, year and Spires ID + /// metadata methods and you should only override it if there's a + /// good reason why those won't work. + std::string name() const { + return experiment() + "_" + year() + "_S" + spiresId(); + } + + /// Get a description of the analysis. + const std::string& spiresId() const { return _spiresId; } + + /// @brief Names & emails of paper/analysis authors. + /// Names and email of authors in 'NAME <EMAIL>' format. The first + /// name in the list should be the primary contact person. + const std::vector<std::string>& authors() const { return _authors; } + + /// @brief Get a short description of the analysis. + /// Short (one sentence) description used as an index entry. + /// Use @a description() to provide full descriptive paragraphs + /// of analysis details. + const std::string& summary() const { return _summary; } + + /// @brief Get a full description of the analysis. + /// Full textual description of this analysis, what it is useful for, + /// what experimental techniques are applied, etc. Should be treated + /// as a chunk of restructuredText (http://docutils.sourceforge.net/rst.html), + /// with equations to be rendered as LaTeX with amsmath operators. + const std::string& description() const { return _description; } + + /// @brief Information about the events needed as input for this analysis. + /// Event types, energies, kinematic cuts, particles to be considered + /// stable, etc. etc. Should be treated as a restructuredText bullet list + /// (http://docutils.sourceforge.net/rst.html) + const std::string& runInfo() const { return _runInfo; } + + /// Experiment which performed and published this analysis. + const std::string& experiment() const { return _experiment; } + + /// Collider on which the experiment ran. + const std::string& collider() const { return _collider; } + + /// Incoming beams required by this analysis. + // const BeamPair& beams() const { return _beams; } + + /// @brief When the original experimental analysis was published. + /// When the refereed paper on which this is based was published, + /// according to SPIRES. + const std::string& year() const { return _year; } + + /// Journal, and preprint references. + const std::vector<std::string>& references() const { return _references; } + + /// Whether this analysis is trusted (in any way!) + const std::string& status() const { return _status; } + //@} + + /// Return true if this analysis needs to know the process cross-section. + bool needsCrossSection() const { return _needsCrossSection; } + + private: + + std::string _name; + std::string _spiresId; + std::vector<std::string> _authors; + std::string _summary; + std::string _description; + std::string _runInfo; + std::string _experiment; + std::string _collider; + //std::pair<BeamParticle,BeamParticle> _beams; + std::string _year; + std::vector<std::string> _references; + std::string _status; + bool _needsCrossSection; + + }; + + + /// String representation + std::string toString(const AnalysisInfo& ai); + + /// Stream an AnalysisInfo as a text description + std::ostream& operator<<(std::ostream& os, const AnalysisInfo& ai) { + os << toString(ai); + return os; + } + + +} + +#endif Modified: trunk/include/Rivet/Makefile.am ============================================================================== --- trunk/include/Rivet/Makefile.am Wed Jul 8 10:57:35 2009 (r1667) +++ trunk/include/Rivet/Makefile.am Wed Jul 8 11:04:18 2009 (r1668) @@ -6,22 +6,21 @@ ## Rivet interface nobase_pkginclude_HEADERS += \ - Rivet.hh Exceptions.hh \ - RivetBoost.hh RivetHepMC.hh \ - Constraints.hh BeamConstraint.hh \ - Event.hh Event.fhh \ - ParticleBase.hh \ - Particle.hh Particle.fhh \ - RivetAIDA.hh RivetAIDA.fhh \ - Analysis.hh Analysis.fhh \ - AnalysisHandler.hh AnalysisHandler.fhh \ - ProjectionHandler.hh \ + Rivet.hh Exceptions.hh \ + RivetBoost.hh RivetHepMC.hh \ + Constraints.hh BeamConstraint.hh \ + Event.hh Event.fhh \ + ParticleBase.hh Jet.hh \ + Particle.hh Particle.fhh \ + RivetAIDA.hh RivetAIDA.fhh \ + Analysis.hh Analysis.fhh \ + AnalysisHandler.hh AnalysisHandler.fhh \ + AnalysisInfo.hh ProjectionHandler.hh \ ProjectionApplier.hh ProjectionApplier.fhh \ - Projection.hh Projection.fhh \ - Cmp.hh Cmp.fhh \ - ParticleName.hh HistoFormat.hh \ - Jet.hh AnalysisLoader.hh \ - HistoHandler.hh + Projection.hh Projection.fhh \ + Cmp.hh Cmp.fhh \ + ParticleName.hh AnalysisLoader.hh \ + HistoHandler.hh HistoFormat.hh nobase_pkginclude_HEADERS += \ Added: trunk/src/AnalysisInfo.cc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/src/AnalysisInfo.cc Wed Jul 8 11:04:18 2009 (r1668) @@ -0,0 +1,47 @@ +#include "Rivet/AnalysisInfo.hh" +#include "yaml.h" + +namespace Rivet { + + + /// Ideas: + /// * store as pointer on Analysis: populate only when requested + /// * search RIVET_DATA_PATH for <name>.info.yaml + /// * AnalysisInfo::make(name) returns (possibly null) pointer + /// - require smart pointer to delete automatically when Analysis + /// goes out of scope + + + /// Static factory method + const AnalysisInfo* AnalysisInfo::make(const std::string& name) { + /// @todo Search metadata path and read first matching file + //if (notfound) return 0; + + /// @todo Get document + + AnalysisInfo* ai = new AnalysisInfo(); + ai->_name = "NAME"; + ai->_spiresId = "12345678"; + ai->_authors += "foo <bar at baz.tld"; + ai->_summary = "blah"; + // ai->_description; + // ai->_runInfo; + // ai->_experiment; + // ai->_collider; + // ai->_beams; + ai->_year = "2009"; + //ai->_references; + ai->_status = "VALIDATED"; + ai->_needsCrossSection = false; + + /// @todo Push values into read-only private members + return ai; + } + + + string toString(const AnalysisInfo& ai) { + /// @todo Fill in the gap... + return "TODO"; + } + +} Modified: trunk/src/Makefile.am ============================================================================== --- trunk/src/Makefile.am Wed Jul 8 10:57:35 2009 (r1667) +++ trunk/src/Makefile.am Wed Jul 8 11:04:18 2009 (r1668) @@ -8,10 +8,11 @@ libRivet_la_SOURCES = \ Event.cc Jet.cc \ - ProjectionApplier.cc Projection.cc Analysis.cc AnalysisLoader.cc \ + ProjectionApplier.cc Projection.cc \ + Analysis.cc AnalysisLoader.cc AnalysisInfo.cc \ AnalysisHandler.cc ProjectionHandler.cc HistoHandler.cc -libRivet_la_CPPFLAGS = $(CPPFLAGS) $(AM_CPPFLAGS) +libRivet_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/Tools/YAML $(CPPFLAGS) libRivet_la_LDFLAGS = -L$(prefix)/lib \ -L$(GSLLIBPATH) -L$(GSLCBLASLIBPATH) -export-dynamic $(VERSIONINFOFLAGS) Modified: trunk/src/Tools/RivetPaths.cc ============================================================================== --- trunk/src/Tools/RivetPaths.cc Wed Jul 8 10:57:35 2009 (r1667) +++ trunk/src/Tools/RivetPaths.cc Wed Jul 8 11:04:18 2009 (r1668) @@ -3,6 +3,7 @@ namespace Rivet { + const string getLibPath() { BrInitError error; br_init_lib(&error);
More information about the Rivet-svn mailing list |