[Rivet-svn] r3519 - in trunk: include/Rivet/Projections src/Projections

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Wed Dec 7 20:42:18 GMT 2011


Author: fsiegert
Date: Wed Dec  7 20:42:17 2011
New Revision: 3519

Log:
Make the inputfs argument in W/ZFinder safe to use even if it is derived from FinalState.

Modified:
   trunk/include/Rivet/Projections/WFinder.hh
   trunk/include/Rivet/Projections/ZFinder.hh
   trunk/src/Projections/WFinder.cc
   trunk/src/Projections/ZFinder.cc

Modified: trunk/include/Rivet/Projections/WFinder.hh
==============================================================================
--- trunk/include/Rivet/Projections/WFinder.hh	Wed Dec  7 20:37:07 2011	(r3518)
+++ trunk/include/Rivet/Projections/WFinder.hh	Wed Dec  7 20:42:17 2011	(r3519)
@@ -24,6 +24,8 @@
     //@{
 
     /// Constructor taking single eta/pT bounds
+    /// @param inputfs Input final state
+    /// @param etaMin,etaMax,pTmin charged lepton cuts
     /// @param pid type of the charged lepton
     /// @param minmass,maxmass (transverse) mass window
     /// @param missingET minimal amount of missing ET (neutrinos) required
@@ -34,18 +36,20 @@
     /// @param trackPhotons whether such photons should be added to _theParticles
     ///  (cf. _trackPhotons)
     /// @param useTransverseMass whether mass window should be applied using mT
-    WFinder(double etaMin, double etaMax,
+    WFinder(const FinalState& inputfs,
+            double etaMin, double etaMax,
             double pTmin,
             PdgId pid,
             double minmass, double maxmass,
             double missingET,
             double dRmax, bool clusterPhotons=true, bool trackPhotons=false,
             double masstarget=80.4,
-            bool useTransverseMass=false,
-            FinalState inputfs=FinalState());
+            bool useTransverseMass=false);
 
 
     /// Constructor taking multiple eta/pT bounds
+    /// @param inputfs Input final state
+    /// @param etaRanges,pTmin charged lepton cuts
     /// @param pid type of the charged lepton
     /// @param minmass,maxmass (transverse) mass window
     /// @param missingET minimal amount of missing ET (neutrinos) required
@@ -56,17 +60,27 @@
     /// @param trackPhotons whether such photons should be added to _theParticles
     ///  (cf. _trackPhotons)
     /// @param useTransverseMass whether mass window should be applied using mT
-    WFinder(const std::vector<std::pair<double, double> >& etaRanges,
+    WFinder(const FinalState& inputfs,
+            const std::vector<std::pair<double, double> >& etaRanges,
             double pTmin,
             PdgId pid,
             double minmass, const double maxmass,
             double missingET,
             double dRmax, bool clusterPhotons=true, bool trackPhotons=false,
             double masstarget=80.4,
-            bool useTransverseMass=false,
-            FinalState inputfs=FinalState());
+            bool useTransverseMass=false);
 
 
+    /// @deprecated Constructors without inputfs -- only for backwards compatibility
+    WFinder(double, double, double, PdgId, double, double, double, double,
+            bool clusterPhotons=true, bool trackPhotons=false,
+            double masstarget=80.4, bool useTransverseMass=false);
+    /// @deprecated Constructors without inputfs -- only for backwards compatibility
+    WFinder(const std::vector<std::pair<double, double> >&, double,
+            PdgId, double, double, double, double,
+            bool clusterPhotons=true, bool trackPhotons=false,
+            double masstarget=80.4, bool useTransverseMass=false);
+
     /// Clone on the heap.
     virtual const Projection* clone() const {
       return new WFinder(*this);
@@ -113,14 +127,14 @@
   private:
 
     /// Common implementation of constructor operation, taking FS params.
-    void _init(const std::vector<std::pair<double, double> >& etaRanges,
+    void _init(const FinalState& inputfs,
+               const std::vector<std::pair<double, double> >& etaRanges,
                double pTmin,  PdgId pid,
                double minmass, double maxmass,
                double missingET,
                double dRmax, bool clusterPhotons, bool trackPhotons,
                double masstarget,
-               bool useTransverseMass,
-               FinalState inputfs);
+               bool useTransverseMass);
 
 
   private:

Modified: trunk/include/Rivet/Projections/ZFinder.hh
==============================================================================
--- trunk/include/Rivet/Projections/ZFinder.hh	Wed Dec  7 20:37:07 2011	(r3518)
+++ trunk/include/Rivet/Projections/ZFinder.hh	Wed Dec  7 20:42:17 2011	(r3519)
@@ -25,6 +25,8 @@
     //@{
 
     /// Constructor taking single eta/pT bounds
+    /// @param inputfs Input final state
+    /// @param etaMin,etaMax,pTmin lepton cuts
     /// @param pid type of the leptons
     /// @param minmass,maxmass mass window
     /// @param dRmax maximum dR of photons around leptons to take into account
@@ -33,16 +35,18 @@
     ///  clustered to the lepton objects and thus Z mom
     /// @param trackPhotons whether such photons should be added to _theParticles
     ///  (cf. _trackPhotons)
-    ZFinder(double etaMin, double etaMax,
+    ZFinder(const FinalState& inputfs,
+            double etaMin, double etaMax,
             double pTmin,
             PdgId pid,
             double minmass, double maxmass,
             double dRmax, bool clusterPhotons, bool trackPhotons,
-            double masstarget=91.2*GeV,
-            FinalState inputfs=FinalState());
+            double masstarget=91.2*GeV);
 
 
     /// Constructor taking multiple eta/pT bounds
+    /// @param inputfs Input final state
+    /// @param etaRanges,pTmin lepton cuts
     /// @param pid type of the leptons
     /// @param minmass,maxmass mass window
     /// @param dRmax maximum dR of photons around leptons to take into account
@@ -51,13 +55,21 @@
     ///  clustered to the lepton objects and thus Z mom
     /// @param trackPhotons whether such photons should be added to _theParticles
     ///  (cf. _trackPhotons)
-    ZFinder(const std::vector<std::pair<double, double> >& etaRanges,
+    ZFinder(const FinalState& inputfs,
+            const std::vector<std::pair<double, double> >& etaRanges,
             double pTmin,
             PdgId pid,
             double minmass, const double maxmass,
             double dRmax, bool clusterPhotons, bool trackPhotons,
-            double masstarget=91.2*GeV,
-            FinalState inputfs=FinalState());
+            double masstarget=91.2*GeV);
+
+
+    /// @deprecated Constructors without inputfs -- only for backwards compatibility
+    ZFinder(double, double, double, PdgId, double, double, double,
+            bool, bool, double masstarget=91.2*GeV);
+    /// @deprecated Constructors without inputfs -- only for backwards compatibility
+    ZFinder(const std::vector<std::pair<double, double> >&, double, PdgId,
+            double, double, double, bool, bool, double masstarget=91.2*GeV);
 
 
     /// Clone on the heap.
@@ -101,12 +113,12 @@
 
   private:
     /// Common implementation of constructor operation, taking FS params.
-    void _init(const std::vector<std::pair<double, double> >& etaRanges,
+    void _init(const FinalState& inputfs,
+               const std::vector<std::pair<double, double> >& etaRanges,
                double pTmin,  PdgId pid,
                double minmass, double maxmass,
                double dRmax, bool clusterPhotons, bool trackPhotons,
-               double masstarget,
-               FinalState inputfs);
+               double masstarget);
 
     /// Mass cuts to apply to clustered leptons (cf. InvMassFinalState)
     double _minmass, _maxmass, _masstarget;

Modified: trunk/src/Projections/WFinder.cc
==============================================================================
--- trunk/src/Projections/WFinder.cc	Wed Dec  7 20:37:07 2011	(r3518)
+++ trunk/src/Projections/WFinder.cc	Wed Dec  7 20:42:17 2011	(r3519)
@@ -12,6 +12,36 @@
 namespace Rivet {
 
 
+  WFinder::WFinder(const FinalState& inputfs,
+                   double etaMin, double etaMax,
+                   double pTmin,
+                   PdgId pid,
+                   double minmass, double maxmass,
+                   double missingET,
+                   double dRmax, bool clusterPhotons, bool trackPhotons,
+                   double masstarget,
+                   bool useTransverseMass) {
+    vector<pair<double, double> > etaRanges;
+    etaRanges += std::make_pair(etaMin, etaMax);
+    _init(inputfs, etaRanges, pTmin, pid, minmass, maxmass, missingET,
+          dRmax, clusterPhotons, trackPhotons, masstarget, useTransverseMass);
+  }
+
+
+  WFinder::WFinder(const FinalState& inputfs,
+                   const std::vector<std::pair<double, double> >& etaRanges,
+                   double pTmin,
+                   PdgId pid,
+                   double minmass, double maxmass,
+                   double missingET,
+                   double dRmax, bool clusterPhotons, bool trackPhotons,
+                   double masstarget,
+                   bool useTransverseMass) {
+    _init(inputfs, etaRanges, pTmin, pid, minmass, maxmass, missingET,
+          dRmax, clusterPhotons, trackPhotons, masstarget, useTransverseMass);
+  }
+
+
   WFinder::WFinder(double etaMin, double etaMax,
                    double pTmin,
                    PdgId pid,
@@ -19,12 +49,12 @@
                    double missingET,
                    double dRmax, bool clusterPhotons, bool trackPhotons,
                    double masstarget,
-                   bool useTransverseMass,
-                   FinalState inputfs) {
+                   bool useTransverseMass) {
     vector<pair<double, double> > etaRanges;
     etaRanges += std::make_pair(etaMin, etaMax);
-    _init(etaRanges, pTmin, pid, minmass, maxmass, missingET,
-          dRmax, clusterPhotons, trackPhotons, masstarget, useTransverseMass, inputfs);
+    FinalState inputfs;
+    _init(inputfs, etaRanges, pTmin, pid, minmass, maxmass, missingET,
+          dRmax, clusterPhotons, trackPhotons, masstarget, useTransverseMass);
   }
 
 
@@ -35,22 +65,22 @@
                    double missingET,
                    double dRmax, bool clusterPhotons, bool trackPhotons,
                    double masstarget,
-                   bool useTransverseMass,
-                   FinalState inputfs) {
-    _init(etaRanges, pTmin, pid, minmass, maxmass, missingET,
-          dRmax, clusterPhotons, trackPhotons, masstarget, useTransverseMass, inputfs);
+                   bool useTransverseMass) {
+    FinalState inputfs;
+    _init(inputfs, etaRanges, pTmin, pid, minmass, maxmass, missingET,
+          dRmax, clusterPhotons, trackPhotons, masstarget, useTransverseMass);
   }
 
 
-  void WFinder::_init(const std::vector<std::pair<double, double> >& etaRanges,
+  void WFinder::_init(const FinalState& inputfs,
+                      const std::vector<std::pair<double, double> >& etaRanges,
                       double pTmin,
                       PdgId pid,
                       double minmass, double maxmass,
                       double missingET,
                       double dRmax, bool clusterPhotons, bool trackPhotons,
                       double masstarget,
-                      bool useTransverseMass,
-                      FinalState inputfs)
+                      bool useTransverseMass)
   {
     setName("WFinder");
 

Modified: trunk/src/Projections/ZFinder.cc
==============================================================================
--- trunk/src/Projections/ZFinder.cc	Wed Dec  7 20:37:07 2011	(r3518)
+++ trunk/src/Projections/ZFinder.cc	Wed Dec  7 20:42:17 2011	(r3519)
@@ -10,36 +10,58 @@
 namespace Rivet {
 
 
-  ZFinder::ZFinder(double etaMin, double etaMax,
+  ZFinder::ZFinder(const FinalState& inputfs,
+                   double etaMin, double etaMax,
                    double pTmin,
                    PdgId pid,
                    double minmass, double maxmass,
                    double dRmax, bool clusterPhotons, bool trackPhotons,
-                   double masstarget,
-                   FinalState inputfs) {
+                   double masstarget) {
     vector<pair<double, double> > etaRanges;
     etaRanges += std::make_pair(etaMin, etaMax);
-    _init(etaRanges, pTmin, pid, minmass, maxmass, dRmax, clusterPhotons, trackPhotons, masstarget, inputfs);
+    _init(inputfs, etaRanges, pTmin, pid, minmass, maxmass, dRmax, clusterPhotons, trackPhotons, masstarget);
   }
 
 
-  ZFinder::ZFinder(const std::vector<std::pair<double, double> >& etaRanges,
+  ZFinder::ZFinder(const FinalState& inputfs,
+                   const std::vector<std::pair<double, double> >& etaRanges,
                    double pTmin,
                    PdgId pid,
                    double minmass, const double maxmass,
                    double dRmax, bool clusterPhotons, bool trackPhotons,
-                   double masstarget,
-                   FinalState inputfs) {
-    _init(etaRanges, pTmin, pid, minmass, maxmass, dRmax, clusterPhotons, trackPhotons, masstarget, inputfs);
+                   double masstarget) {
+    _init(inputfs, etaRanges, pTmin, pid, minmass, maxmass, dRmax, clusterPhotons, trackPhotons, masstarget);
+  }
+
+
+  ZFinder::ZFinder(double etaMin, double etaMax,
+                   double pTmin,
+                   PdgId pid,
+                   double minmass, double maxmass,
+                   double dRmax, bool clusterPhotons, bool trackPhotons,
+                   double masstarget) {
+    vector<pair<double, double> > etaRanges;
+    etaRanges += std::make_pair(etaMin, etaMax);
+    FinalState inputfs;
+    _init(inputfs, etaRanges, pTmin, pid, minmass, maxmass, dRmax, clusterPhotons, trackPhotons, masstarget);
   }
 
 
-  void ZFinder::_init(const std::vector<std::pair<double, double> >& etaRanges,
+  ZFinder::ZFinder(const std::vector<std::pair<double, double> >& etaRanges,
+                   double pTmin,
+                   PdgId pid,
+                   double minmass, const double maxmass,
+                   double dRmax, bool clusterPhotons, bool trackPhotons,
+                   double masstarget) {
+    FinalState inputfs;
+    _init(inputfs, etaRanges, pTmin, pid, minmass, maxmass, dRmax, clusterPhotons, trackPhotons, masstarget);
+  }
+  void ZFinder::_init(const FinalState& inputfs,
+                      const std::vector<std::pair<double, double> >& etaRanges,
                       double pTmin,  PdgId pid,
                       double minmass, double maxmass,
                       double dRmax, bool clusterPhotons, bool trackPhotons,
-                      double masstarget,
-                      FinalState inputfs)
+                      double masstarget)
   {
     setName("ZFinder");
 


More information about the Rivet-svn mailing list