[Rivet-svn] r3216 - branches/2011-07-aida2yoda/src/Analyses

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Jul 19 18:21:30 BST 2011


Author: dgrell
Date: Tue Jul 19 18:21:30 2011
New Revision: 3216

Log:
fixed my vroken reset for datapointsets

Modified:
   branches/2011-07-aida2yoda/src/Analyses/CDF_1994_S2952106.cc
   branches/2011-07-aida2yoda/src/Analyses/STAR_2006_S6860818.cc
   branches/2011-07-aida2yoda/src/Analyses/UA5_1988_S1867512.cc

Modified: branches/2011-07-aida2yoda/src/Analyses/CDF_1994_S2952106.cc
==============================================================================
--- branches/2011-07-aida2yoda/src/Analyses/CDF_1994_S2952106.cc	Tue Jul 19 18:19:57 2011	(r3215)
+++ branches/2011-07-aida2yoda/src/Analyses/CDF_1994_S2952106.cc	Tue Jul 19 18:21:30 2011	(r3216)
@@ -43,9 +43,9 @@
       _histAlpha   = bookScatter2D(5,1,1);
 
       // Temporary histos: these are the ones we actually fill for the plots which require correction
-      _tmphistJet3eta.reset(new LWH::Histogram1D(binEdges(3,1,1)));
-      _tmphistR23.reset(    new LWH::Histogram1D(binEdges(4,1,1)));
-      _tmphistAlpha.reset(  new LWH::Histogram1D(binEdges(5,1,1)));
+      _tmphistJet3eta.reset(new Histo1D(binEdges(3,1,1)));
+      _tmphistR23.reset(    new Histo1D(binEdges(4,1,1)));
+      _tmphistAlpha.reset(  new Histo1D(binEdges(5,1,1)));
     }
 
 

Modified: branches/2011-07-aida2yoda/src/Analyses/STAR_2006_S6860818.cc
==============================================================================
--- branches/2011-07-aida2yoda/src/Analyses/STAR_2006_S6860818.cc	Tue Jul 19 18:19:57 2011	(r3215)
+++ branches/2011-07-aida2yoda/src/Analyses/STAR_2006_S6860818.cc	Tue Jul 19 18:21:30 2011	(r3216)
@@ -142,25 +142,18 @@
 
     /// Finalize
     void finalize() {
-      std::vector<double> xval;
-      std::vector<double> xerr;
-      std::vector<double> yval;
-      std::vector<double> yerr;
+      std::vector<Point2D> points;
       for (size_t i=0 ; i<4 ; i++) {
-        xval.push_back(i);
-        xerr.push_back(0.5);
         if (_nWeightedBaryon[i]==0 || _nWeightedAntiBaryon[i]==0) {
-          yval.push_back(0);
-          yerr.push_back(0);
+	  points.push_back(Point2D(i,0,0.5,0));
         }
         else {
           double y  = _nWeightedAntiBaryon[i]/_nWeightedBaryon[i];
           double dy = sqrt( 1./_nAntiBaryon[i] + 1./_nBaryon[i] );
-          yval.push_back(y);
-          yerr.push_back(y*dy);
+	  points.push_back(Point2D(i,y,0.5,y*dy));
         }
       }
-      _h_antibaryon_baryon_ratio.reset( new Scatter2D(xval, yval, xerr, yerr) );
+      _h_antibaryon_baryon_ratio->addPoints( points );
 
       // \todo YODA divide
       // AIDA::IHistogramFactory& hf = histogramFactory();
@@ -176,8 +169,8 @@
       scale(_h_pT_ximinus,   1./(2*M_PI*_sumWeightSelected));
       scale(_h_pT_xiplus,    1./(2*M_PI*_sumWeightSelected));
       //scale(_h_pT_omega,     1./(2*M_PI*_sumWeightSelected));
-      getLog() << Log::DEBUG << "sumOfWeights()     = " << sumOfWeights() << std::endl;
-      getLog() << Log::DEBUG << "_sumWeightSelected = " << _sumWeightSelected << std::endl;
+      MSG_DEBUG("sumOfWeights()     = " << sumOfWeights());
+      MSG_DEBUG("_sumWeightSelected = " << _sumWeightSelected);
     }
 
   private:

Modified: branches/2011-07-aida2yoda/src/Analyses/UA5_1988_S1867512.cc
==============================================================================
--- branches/2011-07-aida2yoda/src/Analyses/UA5_1988_S1867512.cc	Tue Jul 19 18:19:57 2011	(r3215)
+++ branches/2011-07-aida2yoda/src/Analyses/UA5_1988_S1867512.cc	Tue Jul 19 18:21:30 2011	(r3216)
@@ -9,6 +9,15 @@
 
 namespace Rivet {
 
+  /// @brief helper function to fill correlation points into scatter plot
+  Point2D correlation_helper(double x, double xerr, 
+			     const vector<int> & nf, const vector<int> & nb, 
+			     double sumWPassed)
+  {
+    return Point2D( x, 	correlation(nf, nb),
+		    xerr,	correlation_err(nf, nb)/sqrt(sumWPassed)  );
+  }
+
 
   /// @brief UA5 charged particle correlations at 200, 546 and 900 GeV
   class UA5_1988_S1867512 : public Analysis {
@@ -91,7 +100,6 @@
       n_05 += applyProjection<ChargedFinalState>(event, "CFS05").size();
     }
 
-
     void finalize() {
       // The correlation strength is defined in formulas
       // 4.1 and 4.2
@@ -105,76 +113,37 @@
       //
       
       // Define vectors to be able to fill Scatter2Ds
-
-      vector<double> xvals;
-      vector<double> xerrs;
-      vector<double> yvals;
-      vector<double> yerrs;
-
-
-      // This defines the binning eventually
-      for (int i=0; i<7; i++) {
-        xvals.push_back(static_cast<double>(i));
-        xerrs.push_back(0.5);
-      }
-
+      vector<Point2D> points;
       // Fill the y-value vector
-      yvals.push_back(correlation(n_10f, n_10b));
-      yvals.push_back(correlation(n_15f, n_15b));
-      yvals.push_back(correlation(n_20f, n_20b));
-      yvals.push_back(correlation(n_25f, n_25b));
-      yvals.push_back(correlation(n_30f, n_30b));
-      yvals.push_back(correlation(n_35f, n_35b));
-      yvals.push_back(correlation(n_40f, n_40b));
-
-      // Fill the y-error vector
-      yerrs.push_back(correlation_err(n_10f, n_10b)/sqrt(_sumWPassed));
-      yerrs.push_back(correlation_err(n_15f, n_15b)/sqrt(_sumWPassed));
-      yerrs.push_back(correlation_err(n_20f, n_20b)/sqrt(_sumWPassed));
-      yerrs.push_back(correlation_err(n_25f, n_25b)/sqrt(_sumWPassed));
-      yerrs.push_back(correlation_err(n_30f, n_30b)/sqrt(_sumWPassed));
-      yerrs.push_back(correlation_err(n_35f, n_35b)/sqrt(_sumWPassed));
-      yerrs.push_back(correlation_err(n_40f, n_40b)/sqrt(_sumWPassed));
+      points.push_back(correlation_helper(0, 0.5, n_10f, n_10b, _sumWPassed));
+      points.push_back(correlation_helper(1, 0.5, n_15f, n_15b, _sumWPassed));
+      points.push_back(correlation_helper(2, 0.5, n_20f, n_20b, _sumWPassed));
+      points.push_back(correlation_helper(3, 0.5, n_25f, n_25b, _sumWPassed));
+      points.push_back(correlation_helper(4, 0.5, n_30f, n_30b, _sumWPassed));
+      points.push_back(correlation_helper(5, 0.5, n_35f, n_35b, _sumWPassed));
+      points.push_back(correlation_helper(6, 0.5, n_40f, n_40b, _sumWPassed));
 
       // Fill the DPS
-      _hist_correl.reset( new Scatter2D(xvals, yvals, xerrs, yerrs) );
-
-      // Now do the other histo -- clear already defined vectors first
-      xvals.clear();
-      xerrs.clear();
-      yvals.clear();
-      yerrs.clear();
-
-      // Different binning for this one
-      for (int i=0; i<6; i++) {
-        xvals.push_back(0.5* static_cast<double>(i));
-        xerrs.push_back(0.25);
-      }
+      _hist_correl->addPoints(points);
 
       // Fill gap-center histo (Fig 15)
       //
       // The first bin contains the c_str strengths of
       // the gap size histo that has ane eta gap of two
       //
-      // Fill the y-value vector
-      yvals.push_back(correlation(n_20f, n_20b));
-      yvals.push_back(correlation(n_25f, n_15b));
-      yvals.push_back(correlation(n_30f, n_10b));
-      yvals.push_back(correlation(n_35f, n_05 ));
-      yvals.push_back(correlation(n_40f, n_10f));
-
-      // Fill the y-error vector
-      yerrs.push_back(correlation_err(n_20f, n_20b)/sqrt(_sumWPassed));
-      yerrs.push_back(correlation_err(n_25f, n_15b)/sqrt(_sumWPassed));
-      yerrs.push_back(correlation_err(n_30f, n_10b)/sqrt(_sumWPassed));
-      yerrs.push_back(correlation_err(n_35f, n_05 )/sqrt(_sumWPassed));
-      yerrs.push_back(correlation_err(n_40f, n_10f)/sqrt(_sumWPassed));
+      // Now do the other histo -- clear already defined vectors first
+      points.clear();
 
+      points.push_back(correlation_helper(0,   0.25, n_20f, n_20b, _sumWPassed));
+      points.push_back(correlation_helper(0.5, 0.25, n_25f, n_15b, _sumWPassed));
+      points.push_back(correlation_helper(1,   0.25, n_30f, n_10b, _sumWPassed));
+      points.push_back(correlation_helper(1.5, 0.25, n_35f, n_05 , _sumWPassed));
+      points.push_back(correlation_helper(2,   0.25, n_40f, n_10f, _sumWPassed));
 
       // Fill in correlation strength for assymetric intervals,
       // see Tab. 5
       // Fill the DPS
-      _hist_correl_asym.reset( new Scatter2D(xvals, yvals, xerrs, yerrs) );
+      _hist_correl_asym->addPoints(points);
     }
 
     //@}


More information about the Rivet-svn mailing list