[Rivet-svn] rivet: Bugfix in analysis --- weights were omitted when filling ...

Rivet Mercurial rivet at projects.hepforge.org
Thu Nov 24 16:15:02 GMT 2016


details:   https://rivet.hepforge.org/hg/rivet/rev/76e9311ac10c
branches:  release-2-5-x
changeset: 5612:76e9311ac10c
user:      Holger Schulz <holger.schulz at durham.ac.uk>
date:      Thu Nov 24 16:04:06 2016 +0000
description:
Bugfix in analysis --- weights were omitted when filling histos

diffs (truncated from 75 to 50 lines):

--- a/src/Analyses/BABAR_2007_S7266081.cc	Wed Nov 23 11:30:51 2016 +0000
+++ b/src/Analyses/BABAR_2007_S7266081.cc	Thu Nov 24 16:04:06 2016 +0000
@@ -34,12 +34,11 @@
 
 
     void analyze(const Event& e) {
+      double weight = e.weight();
       // Find the taus
       Particles taus;
-      const UnstableFinalState& ufs = apply<UnstableFinalState>(e, "UFS");
-      foreach (const Particle& p, ufs.particles()) {
-        if (p.abspid() != PID::TAU) continue;
-        _weight_total += 1.;
+      foreach(const Particle& p, apply<UnstableFinalState>(e, "UFS").particles(Cuts::pid==PID::TAU)) {
+        _weight_total += weight;
         Particles pip, pim, Kp, Km;
         unsigned int nstable = 0;
         // Get the boost to the rest frame
@@ -55,40 +54,40 @@
         if (nstable != 4) continue;
         // pipipi
         if (pim.size() == 2 && pip.size() == 1) {
-          _weight_pipipi += 1.;
+          _weight_pipipi += weight;
           _hist_pipipi_pipipi->
-            fill((pip[0].momentum()+pim[0].momentum()+pim[1].momentum()).mass(),1.);
+            fill((pip[0].momentum()+pim[0].momentum()+pim[1].momentum()).mass(), weight);
           _hist_pipipi_pipi->
-            fill((pip[0].momentum()+pim[0].momentum()).mass(),1.);
+            fill((pip[0].momentum()+pim[0].momentum()).mass(), weight);
           _hist_pipipi_pipi->
-            fill((pip[0].momentum()+pim[1].momentum()).mass(),1.);
+            fill((pip[0].momentum()+pim[1].momentum()).mass(), weight);
         }
         else if (pim.size() == 1 && pip.size() == 1 && Km.size() == 1) {
-          _weight_Kpipi += 1.;
+          _weight_Kpipi += weight;
           _hist_Kpipi_Kpipi->
-            fill((pim[0].momentum()+pip[0].momentum()+Km[0].momentum()).mass(),1.);
+            fill((pim[0].momentum()+pip[0].momentum()+Km[0].momentum()).mass(), weight);
           _hist_Kpipi_Kpi->
-            fill((pip[0].momentum()+Km[0].momentum()).mass(),1.);
+            fill((pip[0].momentum()+Km[0].momentum()).mass(), weight);
           _hist_Kpipi_pipi->
-            fill((pim[0].momentum()+pip[0].momentum()).mass(),1.);
+            fill((pim[0].momentum()+pip[0].momentum()).mass(), weight);
         }
         else if (Kp.size() == 1 && Km.size() == 1 && pim.size() == 1) {
-          _weight_KpiK += 1.;
+          _weight_KpiK += weight;


More information about the Rivet-svn mailing list