[Rivet-svn] r4277 - trunk/src/Analyses

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue May 14 19:22:35 BST 2013


Author: buckley
Date: Tue May 14 19:22:35 2013
New Revision: 4277

Log:
Histogramming improvements in MC_GENERIC

Modified:
   trunk/src/Analyses/MC_GENERIC.cc

Modified: trunk/src/Analyses/MC_GENERIC.cc
==============================================================================
--- trunk/src/Analyses/MC_GENERIC.cc	Tue May 14 18:54:14 2013	(r4276)
+++ trunk/src/Analyses/MC_GENERIC.cc	Tue May 14 19:22:35 2013	(r4277)
@@ -4,7 +4,6 @@
 #include "Rivet/Tools/Logging.hh"
 #include "Rivet/Projections/FinalState.hh"
 #include "Rivet/Projections/ChargedFinalState.hh"
-//#include "Rivet/Projections/MissingMomentum.hh"
 
 namespace Rivet {
 
@@ -31,34 +30,33 @@
       const FinalState cnfs(-5.0, 5.0, 500*MeV);
       addProjection(cnfs, "FS");
       addProjection(ChargedFinalState(-5.0, 5.0, 500*MeV), "CFS");
-      //addProjection(MissingMomentum(cnfs), "ETmiss");
 
       // Histograms
       // @todo Choose E/pT ranged based on input energies... can't do anything about kin. cuts, though
       _histMult   = bookHisto1D("Mult", 100, -0.5, 199.5);
       _histMultCh = bookHisto1D("MultCh", 100, -0.5, 199.5);
 
-      _histPt    = bookHisto1D("Pt", 300, 0, 30);
-      _histPtCh  = bookHisto1D("PtCh", 300, 0, 30);
+      _histPt   = bookHisto1D("Pt", 300, 0, 30);
+      _histPtCh = bookHisto1D("PtCh", 300, 0, 30);
 
-      _histE    = bookHisto1D("E", 100, 0, 200);
-      _histECh  = bookHisto1D("ECh", 100, 0, 200);
+      _histE   = bookHisto1D("E", 100, 0, 200);
+      _histECh = bookHisto1D("ECh", 100, 0, 200);
+
+      _histEtaSumEt = bookProfile1D("EtaSumEt", 25, 0, 5);
 
       _histEta    = bookHisto1D("Eta", 50, -5, 5);
       _histEtaCh  = bookHisto1D("EtaCh", 50, -5, 5);
-      _tmphistEtaPlus.reset(new Histo1D(25, 0, 5));
-      _tmphistEtaMinus.reset(new Histo1D(25, 0, 5));
-      _tmphistEtaChPlus.reset(new Histo1D(25, 0, 5));
-      _tmphistEtaChMinus.reset(new Histo1D(25, 0, 5));
-
-      _histEtaSumEt    = bookProfile1D("EtaSumEt", 25, 0, 5);
+      _tmphistEtaPlus = Histo1D(25, 0, 5);
+      _tmphistEtaMinus = Histo1D(25, 0, 5);
+      _tmphistEtaChPlus = Histo1D(25, 0, 5);
+      _tmphistEtaChMinus = Histo1D(25, 0, 5);
 
       _histRapidity    = bookHisto1D("Rapidity", 50, -5, 5);
       _histRapidityCh  = bookHisto1D("RapidityCh", 50, -5, 5);
-      _tmphistRapPlus.reset(new Histo1D(25, 0, 5));
-      _tmphistRapMinus.reset(new Histo1D(25, 0, 5));
-      _tmphistRapChPlus.reset(new Histo1D(25, 0, 5));
-      _tmphistRapChMinus.reset(new Histo1D(25, 0, 5));
+      _tmphistRapPlus = Histo1D(25, 0, 5);
+      _tmphistRapMinus = Histo1D(25, 0, 5);
+      _tmphistRapChPlus = Histo1D(25, 0, 5);
+      _tmphistRapChMinus = Histo1D(25, 0, 5);
 
       _histPhi    = bookHisto1D("Phi", 50, 0, TWOPI);
       _histPhiCh  = bookHisto1D("PhiCh", 50, 0, TWOPI);
@@ -83,18 +81,14 @@
         const double eta = p.momentum().eta();
         _histEta->fill(eta, weight);
         _histEtaSumEt->fill(fabs(eta), p.momentum().Et(), weight);
-        if (eta > 0) {
-          _tmphistEtaPlus->fill(fabs(eta), weight);
-        } else {
-          _tmphistEtaMinus->fill(fabs(eta), weight);
-        }
+        if (eta > 0) _tmphistEtaPlus.fill(fabs(eta), weight);
+        else _tmphistEtaMinus.fill(fabs(eta), weight);
+        //
         const double rapidity = p.momentum().rapidity();
         _histRapidity->fill(rapidity, weight);
-        if (rapidity > 0) {
-          _tmphistRapPlus->fill(fabs(rapidity), weight);
-        } else {
-          _tmphistRapMinus->fill(fabs(rapidity), weight);
-        }
+        if (rapidity > 0) _tmphistRapPlus.fill(fabs(rapidity), weight);
+        else _tmphistRapMinus.fill(fabs(rapidity), weight);
+        //
         _histPt->fill(p.momentum().pT()/GeV, weight);
         _histE->fill(p.momentum().E()/GeV, weight);
         _histPhi->fill(p.momentum().phi(), weight);
@@ -107,28 +101,25 @@
         const double eta = p.momentum().eta();
         _histEtaCh->fill(eta, weight);
         if (eta > 0) {
-          _tmphistEtaChPlus->fill(fabs(eta), weight);
+          _tmphistEtaChPlus.fill(fabs(eta), weight);
         } else {
-          _tmphistEtaChMinus->fill(fabs(eta), weight);
+          _tmphistEtaChMinus.fill(fabs(eta), weight);
         }
         const double rapidity = p.momentum().rapidity();
         _histRapidityCh->fill(rapidity, weight);
         if (rapidity > 0) {
-          _tmphistRapChPlus->fill(fabs(rapidity), weight);
+          _tmphistRapChPlus.fill(fabs(rapidity), weight);
         } else {
-          _tmphistRapChMinus->fill(fabs(rapidity), weight);
+          _tmphistRapChMinus.fill(fabs(rapidity), weight);
         }
         _histPtCh->fill(p.momentum().pT()/GeV, weight);
         _histECh->fill(p.momentum().E()/GeV, weight);
         _histPhiCh->fill(p.momentum().phi(), weight);
       }
 
-      // const MissingMomentum& met = applyProjection<MissingMomentum>(event, "ETmiss");
-
     }
 
 
-
     /// Finalize
     void finalize() {
       scale(_histMult, 1/sumOfWeights());
@@ -149,23 +140,10 @@
       scale(_histPhi, 1/sumOfWeights());
       scale(_histPhiCh, 1/sumOfWeights());
 
-      /// @todo YODA need to clean up setting the path.
-      std::string path;
-      path = (*_histEtaPMRatio).path();
-      *_histEtaPMRatio = *_tmphistEtaPlus/ *_tmphistEtaMinus;
-      (*_histEtaPMRatio).setPath(path);
-
-      path = (*_histEtaChPMRatio).path();
-      *_histEtaChPMRatio = *_tmphistEtaChPlus/ *_tmphistEtaChMinus;
-      (*_histEtaChPMRatio).setPath(path);
-
-      path = (*_histRapidityPMRatio).path();
-      *_histRapidityPMRatio = *_tmphistRapPlus/ *_tmphistRapMinus;
-      (*_histRapidityPMRatio).setPath(path);
-
-      path = (*_histRapidityChPMRatio).path();
-      *_histRapidityChPMRatio = *_tmphistRapChPlus/ *_tmphistRapChMinus;
-      (*_histRapidityChPMRatio).setPath(path);
+      divide(_tmphistEtaPlus, _tmphistEtaMinus, _histEtaPMRatio);
+      divide(_tmphistEtaChPlus, _tmphistEtaChMinus, _histEtaChPMRatio);
+      divide(_tmphistRapPlus, _tmphistRapMinus, _histRapidityPMRatio);
+      divide(_tmphistRapChPlus, _tmphistRapChMinus, _histRapidityChPMRatio);
     }
 
     //@}
@@ -173,12 +151,6 @@
 
   private:
 
-    /// Temporary histos used to calculate eta+/eta- ratio plot
-    Histo1DPtr _tmphistEtaPlus, _tmphistEtaMinus;
-    Histo1DPtr _tmphistEtaChPlus, _tmphistEtaChMinus;
-    Histo1DPtr _tmphistRapPlus, _tmphistRapMinus;
-    Histo1DPtr _tmphistRapChPlus, _tmphistRapChMinus;
-
     /// @name Histograms
     //@{
     Histo1DPtr _histMult, _histMultCh;
@@ -194,6 +166,14 @@
     Scatter2DPtr _histRapidityChPMRatio;
     //@}
 
+    /// @name Temporary histos used to calculate eta+/eta- ratio plots
+    //@{
+    Histo1D _tmphistEtaPlus, _tmphistEtaMinus;
+    Histo1D _tmphistEtaChPlus, _tmphistEtaChMinus;
+    Histo1D _tmphistRapPlus, _tmphistRapMinus;
+    Histo1D _tmphistRapChPlus, _tmphistRapChMinus;
+    //@}
+
   };
 
 


More information about the Rivet-svn mailing list