[Rivet-svn] rivet: Fix several cases of references being taken to temporarie...

Rivet Mercurial rivet at projects.hepforge.org
Wed Nov 15 22:00:02 GMT 2017


details:   https://rivet.hepforge.org/hg/rivet/rev/2dc3369dc5bd
branches:  
changeset: 6138:2dc3369dc5bd
user:      Andy Buckley <andy at insectnation.org>
date:      Wed Nov 15 21:50:43 2017 +0000
description:
Fix several cases of references being taken to temporaries returned by Z/WFinder

diffs (truncated from 189 to 50 lines):

--- a/analyses/pluginATLAS/ATLAS_2010_S8919674.cc	Tue Nov 14 17:41:43 2017 +0000
+++ b/analyses/pluginATLAS/ATLAS_2010_S8919674.cc	Wed Nov 15 21:50:43 2017 +0000
@@ -65,11 +65,11 @@
 
       const WFinder& We = apply<WFinder>(event, "W_e");
       if (We.bosons().size() == 1) {
-        const FourMomentum& p_miss = We.constituentNeutrinos()[0].momentum();
-        const FourMomentum& p_lept = We.constituentLeptons()[0].momentum();
+        const FourMomentum p_miss = We.constituentNeutrinos()[0];
+        const FourMomentum p_lept = We.constituentLeptons()[0];
         if (p_miss.Et() > 25*GeV && We.mT() > 40*GeV) {
           Jets js;
-          foreach (const Jet& j, jets) {
+          for (const Jet& j : jets) {
             if (j.abseta() < 2.8 && deltaR(p_lept, j.momentum()) > 0.5)
               js.push_back(j);
           }
@@ -90,11 +90,11 @@
 
       const WFinder& Wm = apply<WFinder>(event, "W_mu");
       if (Wm.bosons().size() == 1) {
-        const FourMomentum& p_miss = Wm.constituentNeutrinos()[0].momentum();
-        const FourMomentum& p_lept = Wm.constituentLeptons()[0].momentum();
+        const FourMomentum p_miss = Wm.constituentNeutrinos()[0];
+        const FourMomentum p_lept = Wm.constituentLeptons()[0];
         if (p_miss.Et() > 25*GeV && Wm.mT() > 40*GeV) {
           Jets js;
-          foreach (const Jet& j, jets) {
+          for (const Jet& j : jets) {
             if (j.abseta() < 2.8 && deltaR(p_lept, j.momentum()) > 0.5)
               js.push_back(j);
           }
--- a/analyses/pluginATLAS/ATLAS_2011_I925932.cc	Tue Nov 14 17:41:43 2017 +0000
+++ b/analyses/pluginATLAS/ATLAS_2011_I925932.cc	Wed Nov 15 21:50:43 2017 +0000
@@ -55,7 +55,7 @@
       // "Dressed" electron
       if (!wfinder_dressed_el.empty()) {
         /// @todo Is this safe? Using MET would be better
-	    const FourMomentum& nu = wfinder_dressed_el.constituentNeutrinos()[0];
+	    const FourMomentum nu = wfinder_dressed_el.constituentNeutrinos()[0];
 	    if (wfinder_dressed_el.mT() > 40*GeV && nu.pT() > 25*GeV) {
           _hist_wpt_dressed_el->fill(wfinder_dressed_el.bosons()[0].pT()/GeV, weight);
 	    }
@@ -64,7 +64,7 @@
       // "Bare" electron
       if (!wfinder_bare_el.empty()) {
         /// @todo Is this safe? Using MET would be better
-	    const FourMomentum& nu = wfinder_bare_el.constituentNeutrinos()[0].momentum();
+	    const FourMomentum nu = wfinder_bare_el.constituentNeutrinos()[0];
 	    if (wfinder_bare_el.mT() > 40*GeV && nu.pT() > 25*GeV) {


More information about the Rivet-svn mailing list