[Rivet-svn] rivet: New book() method was necessary so we don't lose the conn...

Rivet Mercurial rivet at projects.hepforge.org
Wed Oct 26 19:30:01 BST 2016


details:   https://rivet.hepforge.org/hg/rivet/rev/f8df25a21a9a
branches:  multiweight
changeset: 5585:f8df25a21a9a
user:      David Grellscheid <david.grellscheid at durham.ac.uk>
date:      Wed Oct 26 19:23:11 2016 +0100
description:
New book() method was necessary so we don't lose the connection between analysisObjects() and the member variables held in each analysis. DELPHI_1996 processes simple LEP events, debugging of plot attributes needed.

diffs (truncated from 665 to 50 lines):

--- a/include/Rivet/Analysis.hh	Wed Oct 26 15:08:15 2016 +0100
+++ b/include/Rivet/Analysis.hh	Wed Oct 26 19:23:11 2016 +0100
@@ -426,7 +426,11 @@
                            const std::string& title="",
                            const std::string& xtitle="",
                            const std::string& ytitle="");
-
+void book(Histo1DPtr & bookedhisto, 
+            unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId,
+            const string& title,
+            const string& xtitle,
+            const string& ytitle);
     //@}
 
 
@@ -809,7 +813,7 @@
   public:
 
     /// List of registered analysis data objects
-    const vector<shared_ptr<MultiweightAOPtr> >& analysisObjects() const {
+    const vector<reference_wrapper<MultiweightAOPtr>>& analysisObjects() const {
       return _analysisobjects;
     }
 
@@ -820,7 +824,7 @@
     //@{
 
     /// Register a data object in the histogram system
-    void addAnalysisObject(const shared_ptr<MultiweightAOPtr>& ao);
+    void addAnalysisObject(MultiweightAOPtr & ao);
 
     /// @todo we need these separately since we *only* want to call this for scatters?
     void addAnalysisObject(const shared_ptr<Scatter1DPtr>& ao);
@@ -832,8 +836,8 @@
     // template <typename AO=AnalysisObjectPtr>
     template <typename AOPtr>
     const AOPtr& getAnalysisObject(const std::string& name) const {
-      for (const shared_ptr<MultiweightAOPtr>& ao : analysisObjects()) {
-        if ((*ao)->path() == histoPath(name)) return dynamic_cast<const AOPtr&>(*ao);
+      for (const auto & ao : analysisObjects()) {
+        if (ao.get()->path() == histoPath(name)) return dynamic_cast<const AOPtr&>(ao.get());
       }
       throw Exception("Data object " + histoPath(name) + " not found");
     }
@@ -843,8 +847,8 @@
     // template <typename AO=AnalysisObjectPtr>
     template <typename AOPtr>
     AOPtr& getAnalysisObject(const std::string& name) {
-      for (const shared_ptr<MultiweightAOPtr>& ao : _analysisobjects) {
-        if ((*ao)->path() == histoPath(name)) return dynamic_cast<AOPtr&>(*ao);


More information about the Rivet-svn mailing list