[Rivet-svn] r3575 - in trunk/src: Analyses Projections

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon Feb 20 17:48:14 GMT 2012


Author: buckley
Date: Mon Feb 20 17:48:13 2012
New Revision: 3575

Log:
src/Analyses/ATLAS_2011_I925932.cc: Using new overflow-aware normalize() in place of counters and scale(..., 1/count)

Modified:
   trunk/src/Analyses/ATLAS_2011_I925932.cc
   trunk/src/Projections/InitialQuarks.cc

Modified: trunk/src/Analyses/ATLAS_2011_I925932.cc
==============================================================================
--- trunk/src/Analyses/ATLAS_2011_I925932.cc	Mon Feb 20 15:42:18 2012	(r3574)
+++ trunk/src/Analyses/ATLAS_2011_I925932.cc	Mon Feb 20 17:48:13 2012	(r3575)
@@ -9,6 +9,13 @@
 namespace Rivet {
 
 
+  namespace {
+    inline double calcMT(const FourMomentum& a, const FourMomentum& b) {
+      return sqrt(2.0 * a.pT() * b.pT() * (1.0 - cos(a.phi() - b.phi())) );
+    }
+  }
+
+
   class ATLAS_2011_I925932 : public Analysis {
   public:
 
@@ -31,12 +38,6 @@
       WFinder wfinder_bare_mu(fs, -2.4, 2.4, 20.0*GeV, MUON, 0.0*GeV, 1000.0*GeV, 25.0*GeV, 0.0,true,false);
       addProjection(wfinder_bare_mu, "WFinder_bare_mu");
 
-      // Counters
-      _sumW_e_dressed = 0;
-      _sumW_e_bare = 0;
-      _sumW_mu_dressed = 0;
-      _sumW_mu_bare = 0;
-
       // Book histograms
       _hist_wpt_dressed_el  = bookHistogram1D(1, 1, 1);
       _hist_wpt_bare_el     = bookHistogram1D(1, 1, 2);
@@ -45,11 +46,6 @@
     }
 
 
-    inline double calcMT(const FourMomentum& a, const FourMomentum& b) {
-      return sqrt(2.0 * a.pT() * b.pT() * (1.0 - cos(a.phi() - b.phi())) );
-    }
-
-
     /// Do the analysis
     void analyze(const Event& event) {
 
@@ -69,7 +65,6 @@
 	    const FourMomentum el = wfinder_dressed_el.constituentLeptons()[0].momentum();
 	    const FourMomentum nu = wfinder_dressed_el.constituentNeutrinos()[0].momentum();
 	    if (calcMT(el, nu) > 40.0*GeV && nu.pT() > 25.0*GeV) {
-          _sumW_e_dressed += event.weight();
           _hist_wpt_dressed_el->fill(wfinder_dressed_el.bosons()[0].momentum().pT()/GeV, event.weight());
 	    }
       }
@@ -79,7 +74,6 @@
 	    const FourMomentum el = wfinder_bare_el.constituentLeptons()[0].momentum();
 	    const FourMomentum nu = wfinder_bare_el.constituentNeutrinos()[0].momentum();
 	    if (calcMT(el, nu) > 40.0*GeV && nu.pT() > 25.0*GeV) {
-          _sumW_e_bare += event.weight();
           _hist_wpt_bare_el->fill(wfinder_bare_el.bosons()[0].momentum().pT()/GeV, event.weight());
 	    }
       }
@@ -89,7 +83,6 @@
 	    const FourMomentum mu = wfinder_dressed_mu.constituentLeptons()[0].momentum();
 	    const FourMomentum nu = wfinder_dressed_mu.constituentNeutrinos()[0].momentum();
 	    if (calcMT(mu, nu) > 40.0*GeV && nu.pT() > 25.0*GeV) {
-          _sumW_mu_dressed += event.weight();
           _hist_wpt_dressed_mu->fill(wfinder_dressed_mu.bosons()[0].momentum().pT()/GeV, event.weight());
 	    }
       }
@@ -99,7 +92,6 @@
 	    const FourMomentum mu = wfinder_bare_mu.constituentLeptons()[0].momentum();
 	    const FourMomentum nu = wfinder_bare_mu.constituentNeutrinos()[0].momentum();
 	    if (calcMT(mu, nu) > 40.0*GeV && nu.pT() > 25.0*GeV) {
-          _sumW_mu_bare += event.weight();
           _hist_wpt_bare_mu->fill(wfinder_bare_mu.bosons()[0].momentum().pT()/GeV, event.weight());
 	    }
       }
@@ -109,10 +101,10 @@
 
     // Normalize histos
     void finalize() {
-      scale(_hist_wpt_dressed_el, 1/_sumW_e_dressed);
-      scale(_hist_wpt_bare_el, 1/_sumW_e_bare);
-      scale(_hist_wpt_dressed_mu, 1/_sumW_mu_dressed);
-      scale(_hist_wpt_bare_mu, 1/_sumW_mu_bare);
+      normalize(_hist_wpt_dressed_el);
+      normalize(_hist_wpt_bare_el);
+      normalize(_hist_wpt_dressed_mu);
+      normalize(_hist_wpt_bare_mu);
     }
 
     //@}
@@ -120,8 +112,6 @@
 
   private:
 
-	double _sumW_e_dressed, _sumW_e_bare, _sumW_mu_dressed, _sumW_mu_bare;
-
 	AIDA::IHistogram1D* _hist_wpt_dressed_el;
 	AIDA::IHistogram1D* _hist_wpt_bare_el;
 	AIDA::IHistogram1D* _hist_wpt_dressed_mu;

Modified: trunk/src/Projections/InitialQuarks.cc
==============================================================================
--- trunk/src/Projections/InitialQuarks.cc	Mon Feb 20 15:42:18 2012	(r3574)
+++ trunk/src/Projections/InitialQuarks.cc	Mon Feb 20 17:48:13 2012	(r3575)
@@ -22,7 +22,7 @@
       const GenVertex* pv = p->production_vertex();
       const GenVertex* dv = p->end_vertex();
       const PdgId pid = abs(p->pdg_id());
-      bool passed = (inRange(pid, 1, 5));
+      bool passed = inRange((long)pid, 1, 5);
       if (passed) {
         if (pv != 0) {
           foreach (const GenParticle* pp, particles_in(pv)) {


More information about the Rivet-svn mailing list