[Rivet-svn] rivet: Use make_shared where possible

Rivet Mercurial rivet at projects.hepforge.org
Sat Apr 9 12:15:02 BST 2016


details:   https://rivet.hepforge.org/hg/rivet/rev/9d33624caa08
branches:  
changeset: 5115:9d33624caa08
user:      David Grellscheid <david.grellscheid at durham.ac.uk>
date:      Sat Apr 09 12:03:00 2016 +0100
description:
Use make_shared where possible

diffs (truncated from 191 to 50 lines):

--- a/src/Analyses/H1_1995_S3167097.cc	Fri Apr 08 20:17:04 2016 +0100
+++ b/src/Analyses/H1_1995_S3167097.cc	Sat Apr 09 12:03:00 2016 +0100
@@ -92,9 +92,9 @@
       for (size_t ibin = 0; ibin < 9; ++ibin)
         scale(_hEtFlow[ibin], 0.5/_sumw[ibin]);
       /// @todo Improve this!
-      addAnalysisObject(Scatter2DPtr( new Scatter2D(_tmphAvEt/_tmphN, histoPath("21")) ));
-      addAnalysisObject(Scatter2DPtr( new Scatter2D(_tmphAvX/_tmphN,  histoPath("22")) ));
-      addAnalysisObject(Scatter2DPtr( new Scatter2D(_tmphAvQ2/_tmphN, histoPath("23")) ));
+      addAnalysisObject(make_shared<Scatter2D>(_tmphAvEt/_tmphN, histoPath("21")) );
+      addAnalysisObject(make_shared<Scatter2D>(_tmphAvX/_tmphN,  histoPath("22")) );
+      addAnalysisObject(make_shared<Scatter2D>(_tmphAvQ2/_tmphN, histoPath("23")) );
     }
 
     //@}
--- a/src/Core/Analysis.cc	Fri Apr 08 20:17:04 2016 +0100
+++ b/src/Core/Analysis.cc	Sat Apr 09 12:03:00 2016 +0100
@@ -200,7 +200,7 @@
                                    // const string& xtitle,
                                    // const string& ytitle) {
     const string path = histoPath(cname);
-    CounterPtr ctr( new Counter(path, title) );
+    CounterPtr ctr = make_shared<Counter>(path, title);
     addAnalysisObject(ctr);
     MSG_TRACE("Made counter " << cname << " for " << name());
     // hist->setAnnotation("XLabel", xtitle);
@@ -215,7 +215,7 @@
                                    const string& xtitle,
                                    const string& ytitle) {
     const string path = histoPath(hname);
-    Histo1DPtr hist( new Histo1D(nbins, lower, upper, path, title) );
+    Histo1DPtr hist = make_shared<Histo1D>(nbins, lower, upper, path, title);
     addAnalysisObject(hist);
     MSG_TRACE("Made histogram " << hname <<  " for " << name());
     hist->setAnnotation("XLabel", xtitle);
@@ -230,7 +230,7 @@
                                    const string& xtitle,
                                    const string& ytitle) {
     const string path = histoPath(hname);
-    Histo1DPtr hist( new Histo1D(binedges, path, title) );
+    Histo1DPtr hist = make_shared<Histo1D>(binedges, path, title);
     addAnalysisObject(hist);
     MSG_TRACE("Made histogram " << hname <<  " for " << name());
     hist->setAnnotation("XLabel", xtitle);
@@ -245,7 +245,7 @@
                                    const string& xtitle,
                                    const string& ytitle) {
     const string path = histoPath(hname);
-    Histo1DPtr hist( new Histo1D(refscatter, path) );
+    Histo1DPtr hist = make_shared<Histo1D>(refscatter, path);


More information about the Rivet-svn mailing list