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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Jun 2 22:23:48 BST 2011


Author: hoeth
Date: Thu Jun  2 22:23:47 2011
New Revision: 3119

Log:
BROKEN: trying to add an on-the-fly constructor for FastJets

Modified:
   trunk/include/Rivet/Projections/FastJets.hh
   trunk/include/Rivet/Projections/JetAlg.hh
   trunk/src/Projections/FastJets.cc

Modified: trunk/include/Rivet/Projections/FastJets.hh
==============================================================================
--- trunk/include/Rivet/Projections/FastJets.hh	Thu Jun  2 21:16:35 2011	(r3118)
+++ trunk/include/Rivet/Projections/FastJets.hh	Thu Jun  2 22:23:47 2011	(r3119)
@@ -66,6 +66,11 @@
     /// Explicitly pass in an externally-constructed plugin
     FastJets(const FinalState& fsp, fastjet::JetDefinition::Plugin& plugin);
 
+    /// Same thing as above, but we want to pass the particles directly to the calc method
+    FastJets(JetAlgName alg, double rparameter, double seed_threshold=1.0);
+    FastJets(fastjet::JetAlgorithm type, fastjet::RecombinationScheme recom, double rparameter);
+    FastJets(fastjet::JetDefinition::Plugin& plugin);
+
     // /// Explicit copy constructor.
     // FastJets(const FastJets& other);
 
@@ -155,6 +160,64 @@
 
     Jets _pseudojetsToJets(const PseudoJets& pjets) const;
 
+    void _init1(JetAlgName alg, double rparameter, double seed_threshold) {
+      setName("FastJets");
+      MSG_DEBUG("R parameter = " << rparameter);
+      MSG_DEBUG("Seed threshold = " << seed_threshold);
+      if (alg == KT) {
+        _jdef = fastjet::JetDefinition(fastjet::kt_algorithm, rparameter, fastjet::E_scheme);
+      } else if (alg == CAM) {
+        _jdef = fastjet::JetDefinition(fastjet::cambridge_algorithm, rparameter, fastjet::E_scheme);
+      } else if (alg == ANTIKT) {
+        _jdef = fastjet::JetDefinition(fastjet::antikt_algorithm, rparameter, fastjet::E_scheme);
+      } else if (alg == DURHAM) {
+        _jdef = fastjet::JetDefinition(fastjet::ee_kt_algorithm, fastjet::E_scheme);
+      } else {
+        // Plugins:
+        if (alg == SISCONE) {
+          const double OVERLAP_THRESHOLD = 0.75;
+          _plugin.reset(new fastjet::SISConePlugin(rparameter, OVERLAP_THRESHOLD));
+        } else if (alg == PXCONE) {
+          string msg = "PxCone currently not supported, since FastJet doesn't install it by default. ";
+          msg += "Please notify the Rivet authors if this behaviour should be changed.";
+          throw Error(msg);
+          //_plugin.reset(new fastjet::PxConePlugin(rparameter));
+        } else if (alg == ATLASCONE) {
+          const double OVERLAP_THRESHOLD = 0.5;
+          _plugin.reset(new fastjet::ATLASConePlugin(rparameter, seed_threshold, OVERLAP_THRESHOLD));
+        } else if (alg == CMSCONE) {
+          _plugin.reset(new fastjet::CMSIterativeConePlugin(rparameter, seed_threshold));
+        } else if (alg == CDFJETCLU) {
+          const double OVERLAP_THRESHOLD = 0.75;
+          _plugin.reset(new fastjet::CDFJetCluPlugin(rparameter, OVERLAP_THRESHOLD, seed_threshold));
+        } else if (alg == CDFMIDPOINT) {
+          const double OVERLAP_THRESHOLD = 0.5;
+          _plugin.reset(new fastjet::CDFMidPointPlugin(rparameter, OVERLAP_THRESHOLD, seed_threshold));
+        } else if (alg == D0ILCONE) {
+          const double min_jet_Et = 6.0;
+          _plugin.reset(new fastjet::D0RunIIConePlugin(rparameter, min_jet_Et));
+        } else if (alg == JADE) {
+          _plugin.reset(new fastjet::JadePlugin());
+        } else if (alg == TRACKJET) {
+          _plugin.reset(new fastjet::TrackJetPlugin(rparameter));
+        }
+        _jdef = fastjet::JetDefinition(_plugin.get());
+      }
+    }
+
+    void _init2(fastjet::JetAlgorithm type,
+                     fastjet::RecombinationScheme recom, double rparameter) {
+      setName("FastJets");
+      _jdef = fastjet::JetDefinition(type, rparameter, recom);
+    }
+
+    void _init3(fastjet::JetDefinition::Plugin& plugin) {
+      setName("FastJets");
+      /// @todo Should we be copying the plugin?
+      _plugin.reset(&plugin);
+      _jdef = fastjet::JetDefinition(_plugin.get());
+    }
+
   protected:
 
     /// Perform the projection on the Event.

Modified: trunk/include/Rivet/Projections/JetAlg.hh
==============================================================================
--- trunk/include/Rivet/Projections/JetAlg.hh	Thu Jun  2 21:16:35 2011	(r3118)
+++ trunk/include/Rivet/Projections/JetAlg.hh	Thu Jun  2 22:23:47 2011	(r3119)
@@ -68,6 +68,8 @@
     /// Constructor
     JetAlg(const FinalState& fs);
 
+    JetAlg() {};
+
     /// Clone on the heap.
     virtual const Projection* clone() const = 0;
 

Modified: trunk/src/Projections/FastJets.cc
==============================================================================
--- trunk/src/Projections/FastJets.cc	Thu Jun  2 21:16:35 2011	(r3118)
+++ trunk/src/Projections/FastJets.cc	Thu Jun  2 22:23:47 2011	(r3119)
@@ -19,57 +19,14 @@
   FastJets::FastJets(const FinalState& fsp, JetAlgName alg, double rparameter, double seed_threshold)
     : JetAlg(fsp), _adef(0)
   {
-    setName("FastJets");
-    MSG_DEBUG("R parameter = " << rparameter);
-    MSG_DEBUG("Seed threshold = " << seed_threshold);
-    if (alg == KT) {
-      _jdef = fastjet::JetDefinition(fastjet::kt_algorithm, rparameter, fastjet::E_scheme);
-    } else if (alg == CAM) {
-      _jdef = fastjet::JetDefinition(fastjet::cambridge_algorithm, rparameter, fastjet::E_scheme);
-    } else if (alg == ANTIKT) {
-      _jdef = fastjet::JetDefinition(fastjet::antikt_algorithm, rparameter, fastjet::E_scheme);
-    } else if (alg == DURHAM) {
-      _jdef = fastjet::JetDefinition(fastjet::ee_kt_algorithm, fastjet::E_scheme);
-    } else {
-      // Plugins:
-      if (alg == SISCONE) {
-        const double OVERLAP_THRESHOLD = 0.75;
-        _plugin.reset(new fastjet::SISConePlugin(rparameter, OVERLAP_THRESHOLD));
-      } else if (alg == PXCONE) {
-        string msg = "PxCone currently not supported, since FastJet doesn't install it by default. ";
-        msg += "Please notify the Rivet authors if this behaviour should be changed.";
-        throw Error(msg);
-        //_plugin.reset(new fastjet::PxConePlugin(rparameter));
-      } else if (alg == ATLASCONE) {
-        const double OVERLAP_THRESHOLD = 0.5;
-        _plugin.reset(new fastjet::ATLASConePlugin(rparameter, seed_threshold, OVERLAP_THRESHOLD));
-      } else if (alg == CMSCONE) {
-        _plugin.reset(new fastjet::CMSIterativeConePlugin(rparameter, seed_threshold));
-      } else if (alg == CDFJETCLU) {
-        const double OVERLAP_THRESHOLD = 0.75;
-        _plugin.reset(new fastjet::CDFJetCluPlugin(rparameter, OVERLAP_THRESHOLD, seed_threshold));
-      } else if (alg == CDFMIDPOINT) {
-        const double OVERLAP_THRESHOLD = 0.5;
-        _plugin.reset(new fastjet::CDFMidPointPlugin(rparameter, OVERLAP_THRESHOLD, seed_threshold));
-      } else if (alg == D0ILCONE) {
-        const double min_jet_Et = 6.0;
-        _plugin.reset(new fastjet::D0RunIIConePlugin(rparameter, min_jet_Et));
-      } else if (alg == JADE) {
-        _plugin.reset(new fastjet::JadePlugin());
-      } else if (alg == TRACKJET) {
-        _plugin.reset(new fastjet::TrackJetPlugin(rparameter));
-      }
-      _jdef = fastjet::JetDefinition(_plugin.get());
-    }
+    _init1(alg, rparameter, seed_threshold);
   }
 
-
   FastJets::FastJets(const FinalState& fsp, fastjet::JetAlgorithm type,
                      fastjet::RecombinationScheme recom, double rparameter)
     : JetAlg(fsp), _adef(0)
   {
-    setName("FastJets");
-    _jdef = fastjet::JetDefinition(type, rparameter, recom);
+    _init2(type, recom, rparameter);
   }
 
 
@@ -77,10 +34,28 @@
                      fastjet::JetDefinition::Plugin& plugin)
     : JetAlg(fsp), _adef(0)
   {
-    setName("FastJets");
-    /// @todo Should we be copying the plugin?
-    _plugin.reset(&plugin);
-    _jdef = fastjet::JetDefinition(_plugin.get());
+    _init3(plugin);
+  }
+
+
+  FastJets::FastJets(JetAlgName alg, double rparameter, double seed_threshold)
+    : _adef(0)
+  {
+    _init1(alg, rparameter, seed_threshold);
+  }
+
+  FastJets::FastJets(fastjet::JetAlgorithm type,
+                     fastjet::RecombinationScheme recom, double rparameter)
+    : _adef(0)
+  {
+    _init2(type, recom, rparameter);
+  }
+
+
+  FastJets::FastJets(fastjet::JetDefinition::Plugin& plugin)
+    : _adef(0)
+  {
+    _init3(plugin);
   }
 
 


More information about the Rivet-svn mailing list