[Rivet-svn] r3201 - in branches/2011-07-aida2yoda: . include/Rivet src/Core

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Jul 19 13:45:42 BST 2011


Author: dgrell
Date: Tue Jul 19 13:45:41 2011
New Revision: 3201

Log:
example analysis works

Modified:
   branches/2011-07-aida2yoda/configure.ac
   branches/2011-07-aida2yoda/include/Rivet/Analysis.hh
   branches/2011-07-aida2yoda/src/Core/Analysis.cc
   branches/2011-07-aida2yoda/src/Core/AnalysisHandler.cc

Modified: branches/2011-07-aida2yoda/configure.ac
==============================================================================
--- branches/2011-07-aida2yoda/configure.ac	Tue Jul 19 13:44:17 2011	(r3200)
+++ branches/2011-07-aida2yoda/configure.ac	Tue Jul 19 13:45:41 2011	(r3201)
@@ -1,7 +1,7 @@
 ## Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT([Rivet],[1.5.2a0],[rivet at projects.hepforge.org],[Rivet])
+AC_INIT([Rivet],[2.0.0a0],[rivet at projects.hepforge.org],[Rivet])
 AC_CONFIG_SRCDIR([src/Core/Analysis.cc])
 AC_CONFIG_HEADERS([include/Rivet/Config/DummyConfig.hh include/Rivet/Config/RivetConfig.hh include/Rivet/Config/BuildOptions.hh])
 AM_INIT_AUTOMAKE(dist-bzip2)

Modified: branches/2011-07-aida2yoda/include/Rivet/Analysis.hh
==============================================================================
--- branches/2011-07-aida2yoda/include/Rivet/Analysis.hh	Tue Jul 19 13:44:17 2011	(r3200)
+++ branches/2011-07-aida2yoda/include/Rivet/Analysis.hh	Tue Jul 19 13:45:41 2011	(r3201)
@@ -500,8 +500,10 @@
 
     //@}
 
+  public:
     /// List of registered plot objects
     const vector<AnalysisObjectPtr> & plots() const {
+      cerr << "\nPLOTS\n" << _plotobjects.size() << '\n';
       return _plotobjects;
     }
 
@@ -510,9 +512,6 @@
     /// @name Utility functions
     //@{
 
-    /// Make the histogram directory.
-    void _makeHistoDir();
-
     // /// Get the bin edges for this paper from the reference AIDA file, and cache them.
     // void _cacheBinEdges() const;
 
@@ -548,9 +547,6 @@
     /// The controlling AnalysisHandler object.
     AnalysisHandler* _analysishandler;
 
-    /// Flag to indicate whether the histogram directory is present
-    mutable bool _madeHistoDir;
-
     // /// Collection of x-axis point data to speed up many autobookings: the
     // /// reference data file should only be read once.
     // /// @todo Reduce memory occupancy, or clear after initialisation?

Modified: branches/2011-07-aida2yoda/src/Core/Analysis.cc
==============================================================================
--- branches/2011-07-aida2yoda/src/Core/Analysis.cc	Tue Jul 19 13:44:17 2011	(r3200)
+++ branches/2011-07-aida2yoda/src/Core/Analysis.cc	Tue Jul 19 13:45:41 2011	(r3201)
@@ -30,8 +30,7 @@
   Analysis::Analysis(const string& name)
     : _crossSection(-1.0),
       _gotCrossSection(false),
-      _analysishandler(NULL),
-      _madeHistoDir(false)
+      _analysishandler(NULL)
   {
     ProjectionApplier::_allowProjReg = false;
     _defaultname = name;
@@ -228,9 +227,9 @@
   {
     // Get the bin edges (only read the AIDA file once)
     const BinEdges edges = binEdges(hname);
-    _makeHistoDir();
     const string path = histoPath(hname);
     Histo1DPtr hist( new Histo1D(edges,path,title) );
+    addPlot(hist);
     MSG_TRACE("Made histogram " << hname <<  " for " << name());
     // hist->setXTitle(xtitle);
     // hist->setYTitle(ytitle);
@@ -242,9 +241,9 @@
 				   size_t nbins, double lower, double upper,
 				   const string& title,
 				   const string& xtitle, const string& ytitle) {
-    _makeHistoDir();
     const string path = histoPath(hname);
     Histo1DPtr hist( new Histo1D(nbins, lower, upper, path, title) );
+    addPlot(hist);
     MSG_TRACE("Made histogram " << hname <<  " for " << name());
     // hist->setXTitle(xtitle);
     // hist->setYTitle(ytitle);
@@ -257,9 +256,9 @@
 				   const string& title,
 				   const string& xtitle, 
 				   const string& ytitle) {
-    _makeHistoDir();
     const string path = histoPath(hname);
     Histo1DPtr hist( new Histo1D(binedges, path, title) );
+    addPlot(hist);
     MSG_TRACE("Made histogram " << hname <<  " for " << name());
     // hist->setXTitle(xtitle);
     // hist->setYTitle(ytitle);
@@ -319,9 +318,9 @@
   {
     // Get the bin edges (only read the AIDA file once)
     const BinEdges edges = binEdges(hname);
-    _makeHistoDir();
     const string path = histoPath(hname);
     Profile1DPtr prof( new Profile1D(edges, path, title) );
+    addPlot(prof);
     MSG_TRACE("Made profile histogram " << hname <<  " for " << name());
     // prof->setXTitle(xtitle);
     // prof->setYTitle(ytitle);
@@ -333,9 +332,9 @@
 				       size_t nbins, double lower, double upper,
 				       const string& title,
 				       const string& xtitle, const string& ytitle) {
-    _makeHistoDir();
     const string path = histoPath(hname);
     Profile1DPtr prof( new Profile1D(nbins, lower, upper, path, title) );
+    addPlot(prof);
     MSG_TRACE("Made profile histogram " << hname <<  " for " << name());
     // prof->setXTitle(xtitle);
     // prof->setYTitle(ytitle);
@@ -347,9 +346,9 @@
 				       const vector<double>& binedges,
 				       const string& title,
 				       const string& xtitle, const string& ytitle) {
-    _makeHistoDir();
     const string path = histoPath(hname);
     Profile1DPtr prof( new Profile1D(binedges, path, title) );
+    addPlot(prof);
     MSG_TRACE("Made profile histogram " << hname <<  " for " << name());
     // prof->setXTitle(xtitle);
     // prof->setYTitle(ytitle);
@@ -414,28 +413,6 @@
   // }
 
 
-  ////////////////////
-
-
-  void Analysis::_makeHistoDir() {
-    if (!_madeHistoDir) {
-      if (! name().empty()) {
-        // vector<string> dirs;
-        // split(dirs, histoDir(), "/");
-        // string pathpart;
-        // foreach (const string& d, dirs) {
-        //tree().mkdir();
-        //}
-        
-	// \todo YODA version
-
-	//tree().mkdirs(histoDir());
-      }
-      _madeHistoDir = true;
-    }
-  }
-
-
   void Analysis::normalize(Histo1DPtr histo, double norm) {
     if (!histo) {
       MSG_ERROR("Failed to normalize histo=NULL in analysis "

Modified: branches/2011-07-aida2yoda/src/Core/AnalysisHandler.cc
==============================================================================
--- branches/2011-07-aida2yoda/src/Core/AnalysisHandler.cc	Tue Jul 19 13:44:17 2011	(r3200)
+++ branches/2011-07-aida2yoda/src/Core/AnalysisHandler.cc	Tue Jul 19 13:45:41 2011	(r3201)
@@ -143,9 +143,9 @@
     // Print out number of events processed
     MSG_INFO("Processed " << _numEvents << " event" << (_numEvents == 1 ? "" : "s"));
 
-    // Delete analyses
-    MSG_DEBUG("Deleting analyses");
-    _analyses.clear();
+    // // Delete analyses
+    // MSG_DEBUG("Deleting analyses");
+    // _analyses.clear();
 
     // Print out MCnet boilerplate
     cout << endl;
@@ -194,9 +194,8 @@
   void AnalysisHandler::writeData(const string& filename) {
     vector<AnalysisObjectPtr> allPlots;
     foreach (const AnaHandle a, _analyses) {
-      allPlots.insert(allPlots.end(),
-		      a->plots().begin(), 
-		      a->plots().end());
+      const vector<AnalysisObjectPtr> & plots = a->plots();
+      allPlots.insert(allPlots.end(), plots.begin(), plots.end());
     }
     WriterYODA::write(filename, allPlots.begin(), allPlots.end());
   }


More information about the Rivet-svn mailing list