[Rivet-svn] r1800 - in trunk: . data/anainfo include/Rivet include/Rivet/Projections src src/Analyses/MC src/Projections src/Tools

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Sep 1 23:38:48 BST 2009


Author: buckley
Date: Tue Sep  1 23:38:48 2009
New Revision: 1800

Log:
Adding untested W analysis, W finder (leptonic only) and updates to the generic MC Z analysis, ClusteredPhotons etc.

Added:
   trunk/data/anainfo/MC_LHC_WANALYSIS.info   (contents, props changed)
      - copied, changed from r1799, trunk/data/anainfo/MC_LHC_ZANALYSIS.info
   trunk/include/Rivet/Projections/WFinder.hh
   trunk/src/Analyses/MC/MC_LHC_WANALYSIS.cc
   trunk/src/Projections/WFinder.cc
Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/data/anainfo/MC_LHC_ZANALYSIS.info
   trunk/data/anainfo/Makefile.am
   trunk/include/Rivet/Makefile.am
   trunk/include/Rivet/Projections/ClusteredPhotons.hh
   trunk/src/Analyses/MC/MC_LHC_ZANALYSIS.cc
   trunk/src/Analyses/MC/Makefile.am
   trunk/src/Makefile.am
   trunk/src/Projections/ClusteredPhotons.cc
   trunk/src/Projections/Makefile.am
   trunk/src/Tools/   (props changed)
   trunk/src/Tools/Makefile.am

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	Tue Sep  1 12:21:37 2009	(r1799)
+++ trunk/ChangeLog	Tue Sep  1 23:38:48 2009	(r1800)
@@ -1,3 +1,12 @@
+2009-09-01  Andy Buckley  <andy at insectnation.org>
+
+	* Adding WFinder and WAnalysis, based on Z proj and analysis, with
+	some tidying of the Z code.
+
+	* ClusteredPhotons now uses an IdentifiedFS to pick the photons to
+	be looped over, and only clusters photons around *charged* signal
+	particles.
+
 2009-08-31  Andy Buckley  <andy at insectnation.org>
 
 	* Splitting analyses by directory, to make it easier to disable

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	Tue Sep  1 12:21:37 2009	(r1799)
+++ trunk/configure.ac	Tue Sep  1 23:38:48 2009	(r1800)
@@ -234,7 +234,7 @@
 AC_EMPTY_SUBST
 AC_CONFIG_FILES(include/Makefile include/Rivet/Makefile)
 AC_CONFIG_FILES(src/Makefile)
-AC_CONFIG_FILES(src/Tools/Makefile src/Tools/YAML/Makefile)
+AC_CONFIG_FILES(src/Tools/Makefile src/Tools/yaml-cpp/Makefile)
 AC_CONFIG_FILES(src/Projections/Makefile)
 AC_CONFIG_FILES(src/Analyses/Makefile)
 AC_CONFIG_FILES(src/Analyses/Example/Makefile)

Copied and modified: trunk/data/anainfo/MC_LHC_WANALYSIS.info (from r1799, trunk/data/anainfo/MC_LHC_ZANALYSIS.info)
==============================================================================
--- trunk/data/anainfo/MC_LHC_ZANALYSIS.info	Tue Sep  1 12:21:37 2009	(r1799, copy source)
+++ trunk/data/anainfo/MC_LHC_WANALYSIS.info	Tue Sep  1 23:38:48 2009	(r1800)
@@ -1,18 +1,16 @@
-Name: MC_LHC_ZANALYSIS
-SpiresID: none
-Summary: "Finding Zs at the LHC, and analysis of the residual jets."
-Description: "Analysis of jets and Z bosons at the LHC. Output gives
+Name: MC_LHC_WANALYSIS
+SpiresID: None
+Summary: "Finding leptonic Ws at the LHC, and analysis of the residual jets."
+Description: "Analysis of jets and W+- bosons at the LHC. Output gives
              charged multiplicity, transverse momentum, mean 
-             transverse momentum, Z counts, transverse momentum of
-             Zs, pseudorapidity distributions of Zs, azimuthal angle
-             distributions of Zs, Z mass, jet counts and jet transverse
+             transverse momentum, W counts, transverse momentum of
+             Ws, pseudorapidity distributions of Ws, azimuthal angle
+             distributions of Ws, W mass, jet counts and jet transverse
              momenta."
-RunInfo: "Generic QCD events, with CKIN(3)=20 at any energy"
+RunInfo: "W production events with CKIN(3)=20 at any energy"
 Status: UNVALIDATED
-Experiment: none
-Collider: none
-Year: none
+Experiment: None
+Collider: None
+Year: None
 Authors:
- - Christophe Vaillant <c.l.j.j.vaillant at durham.ac.uk>
-References:
- - "none"
\ No newline at end of file
+ - Andy Buckley <andy.buckley at cern.ch>

Modified: trunk/data/anainfo/MC_LHC_ZANALYSIS.info
==============================================================================
--- trunk/data/anainfo/MC_LHC_ZANALYSIS.info	Tue Sep  1 12:21:37 2009	(r1799)
+++ trunk/data/anainfo/MC_LHC_ZANALYSIS.info	Tue Sep  1 23:38:48 2009	(r1800)
@@ -7,12 +7,10 @@
              Zs, pseudorapidity distributions of Zs, azimuthal angle
              distributions of Zs, Z mass, jet counts and jet transverse
              momenta."
-RunInfo: "Generic QCD events, with CKIN(3)=20 at any energy"
+RunInfo: "Z production events, with CKIN(3)=20 at any energy"
 Status: UNVALIDATED
 Experiment: none
 Collider: none
 Year: none
 Authors:
  - Christophe Vaillant <c.l.j.j.vaillant at durham.ac.uk>
-References:
- - "none"
\ No newline at end of file

Modified: trunk/data/anainfo/Makefile.am
==============================================================================
--- trunk/data/anainfo/Makefile.am	Tue Sep  1 12:21:37 2009	(r1799)
+++ trunk/data/anainfo/Makefile.am	Tue Sep  1 23:38:48 2009	(r1800)
@@ -57,6 +57,7 @@
   JADE_OPAL_2000_S4300807_91GEV.info \
   MC_LHC_LEADINGJETS.info \
   MC_LHC_DIJET.info \
+  MC_LHC_WANALYSIS.info \
   MC_LHC_ZANALYSIS.info \
   MC_TVT1960_PHOTONJETS.info \
   MC_TVT1960_ZJETS.info \

Modified: trunk/include/Rivet/Makefile.am
==============================================================================
--- trunk/include/Rivet/Makefile.am	Tue Sep  1 12:21:37 2009	(r1799)
+++ trunk/include/Rivet/Makefile.am	Tue Sep  1 23:38:48 2009	(r1800)
@@ -70,6 +70,7 @@
   Projections/UnstableFinalState.hh \
   Projections/VetoedFinalState.hh \
   Projections/VisibleFinalState.hh \
+  Projections/WFinder.hh \
   Projections/ZFinder.hh 
 
 

Modified: trunk/include/Rivet/Projections/ClusteredPhotons.hh
==============================================================================
--- trunk/include/Rivet/Projections/ClusteredPhotons.hh	Tue Sep  1 12:21:37 2009	(r1799)
+++ trunk/include/Rivet/Projections/ClusteredPhotons.hh	Tue Sep  1 23:38:48 2009	(r1800)
@@ -8,6 +8,7 @@
 #include "Rivet/Event.hh"
 #include "Rivet/Projection.hh"
 #include "Rivet/Projections/FinalState.hh"
+#include "Rivet/Projections/IdentifiedFinalState.hh"
 
 namespace Rivet {
 
@@ -22,14 +23,17 @@
     //@{
     /// Constructor with the two final states, and the maximum separation in dR
     /// for clustered photons
-    ClusteredPhotons(const FinalState& fs, const FinalState& signal,
-                     double dRmax) : _dRmax(dRmax)
+    ClusteredPhotons(const FinalState& fs, const FinalState& signal, double dRmax) 
+      : _dRmax(dRmax)
     {
       setName("ClusteredPhotons");
-      addProjection(fs, "FS");
+      IdentifiedFinalState photonfs(fs);
+      photonfs.acceptId(PHOTON);
+      addProjection(photonfs, "Photons");
       addProjection(signal, "Signal");
     }
 
+
     /// Clone on the heap.
     virtual const Projection* clone() const {
       return new ClusteredPhotons(*this);

Added: trunk/include/Rivet/Projections/WFinder.hh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/include/Rivet/Projections/WFinder.hh	Tue Sep  1 23:38:48 2009	(r1800)
@@ -0,0 +1,98 @@
+// -*- C++ -*-
+#ifndef RIVET_WFinder_HH
+#define RIVET_WFinder_HH
+
+#include "Rivet/Tools/Logging.hh"
+#include "Rivet/Rivet.hh"
+#include "Rivet/Particle.hh"
+#include "Rivet/Event.hh"
+#include "Rivet/Projection.hh"
+#include "Rivet/Projections/FinalState.hh"
+
+namespace Rivet {
+
+
+  /// Chain together different projections as convenience for finding Z's
+  /// from two leptons in the final state
+  class WFinder : public FinalState {
+
+  public:
+    
+    /// @name Constructors
+    //@{
+
+    /// Constructor taking a FinalState and type of the charged lepton, mass window,
+    /// and maximum dR of photons around the charged lepton to take into account for W
+    /// reconstruction.
+    WFinder(const FinalState& fs,
+            PdgId pid,
+            double m2_min, double m2_max,
+            double dRmax);
+
+
+    /// Constructor taking single eta/pT bounds and type of the charged lepton, mass
+    /// window, and maximum dR of photons around the charged lepton to take into account
+    /// for W reconstruction.
+    WFinder(double etaMin, double etaMax,
+            double pTmin,
+            PdgId pid,
+            double m2_min, double m2_max,
+            double dRmax);
+
+
+    /// Constructor taking multiple eta/pT bounds and type of the charged lepton, mass
+    /// window, and maximum dR of photons around the charged lepton to take into account
+    /// for W reconstruction.
+    WFinder(const std::vector<std::pair<double, double> >& etaRanges,
+            double pTmin,
+            PdgId pid,
+            double m2_min, const double m2_max,
+            double dRmax);
+
+
+    /// Clone on the heap.
+    virtual const Projection* clone() const {
+      return new WFinder(*this);
+    }
+    //@}
+
+
+    /// Access to the remaining particles, after the Z and clustered photons
+    /// have been removed from the full final state 
+    /// (e.g. for running a jet finder on it)
+    const FinalState& remainingFinalState() const;
+
+    /// Access to the Z constituent leptons final state 
+    /// (e.g. for more fine-grained cuts on the leptons)
+    const FinalState& constituentsFinalState() const;
+
+  protected:
+    
+    /// Apply the projection on the supplied event.
+    void project(const Event& e);
+    
+    /// Compare projections.
+    int compare(const Projection& p) const;
+
+
+  private:
+
+    /// Common implementation of constructor operation, taking FS params.
+    void _init(const std::vector<std::pair<double, double> >& etaRanges,
+               double pTmin,  PdgId pid,
+               double m2_min, double m2_max,
+               double dRmax);
+
+    /// Common implementation of constructor operation, taking FS.
+    void _init(const FinalState& fs,
+               PdgId pid,
+               double m2_min, double m2_max,
+               double dRmax);
+
+  };
+
+  
+}
+
+
+#endif

Added: trunk/src/Analyses/MC/MC_LHC_WANALYSIS.cc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/src/Analyses/MC/MC_LHC_WANALYSIS.cc	Tue Sep  1 23:38:48 2009	(r1800)
@@ -0,0 +1,129 @@
+// -*- C++ -*-
+#include "Rivet/Analysis.hh"
+#include "Rivet/RivetAIDA.hh"
+#include "Rivet/Projections/ChargedFinalState.hh"
+#include "Rivet/Projections/TotalVisibleMomentum.hh"
+#include "Rivet/Projections/WFinder.hh"
+#include "Rivet/Projections/FastJets.hh"
+
+namespace Rivet {
+
+
+  class MC_LHC_WANALYSIS : public Analysis {
+  public:
+  
+    /// Default constructor
+    MC_LHC_WANALYSIS()
+      : Analysis("MC_LHC_WANALYSIS") 
+    {
+      const ChargedFinalState cfs;
+      addProjection(cfs, "CFS");
+      const WFinder wf(-MAXRAPIDITY, MAXRAPIDITY, 0.0*GeV, ELECTRON, 30.0*GeV, 110.0*GeV, 0.2);
+      addProjection(wf, "WF");
+      FastJets fastjets(wf.remainingFinalState(), FastJets::KT, 0.7);
+      addProjection(fastjets, "Jets");
+    }
+    
+
+    /// @name Analysis methods
+    /// @todo change "Weights" to differential cross sections once histos normalised to cross-section.
+    //@{
+
+    void init() { 
+      _hist_chargemulti = bookHistogram1D("d01-x01-y01", 30, 0.5, 250.5);
+      _hist_chargept = bookHistogram1D("d02-x01-y01", 32, 0., 25.);
+      _hist_chargemeanpt = bookHistogram1D("d03-x01-y01", 25, 0., 10.);
+      _hist_chargermspt = bookHistogram1D("d04-x01-y01", 32, 0., 10.);
+      _hist_wcount = bookHistogram1D("d05-x01-y01", 30, 0., 15.);
+      _hist_wpt = bookHistogram1D("d06-x01-y01", 32, 0., 25.);
+      _hist_wlogpt = bookHistogram1D("d07-x01-y01", 32, 0., 6.);
+      _hist_weta = bookHistogram1D("d08-x01-y01", 32, -6., 6.);
+      _hist_wphi = bookHistogram1D("d09-x01-y01", 32, 0., 6.4);
+      _hist_wmass = bookHistogram1D("d10-x01-y01", 40, 60., 100.);
+      _hist_wlogmass = bookHistogram1D("d11-x01-y01", 32, 0., 10.);
+      _hist_jetcount = bookHistogram1D("d12-x01-y01", 32, 0, 100);
+      _hist_jetpt = bookHistogram1D("d13-x01-y01", 32, 20., 100.);
+      _hist_jetlogpt = bookHistogram1D("d14-x01-y01", 32, 0., 20.);
+    }
+    
+    
+    void analyze(const Event& event) {
+      const double weight = event.weight();
+      const FinalState& cfs = applyProjection<FinalState>(event, "CFS");
+      const WFinder& wf = applyProjection<WFinder>(event, "WF");
+      const FastJets& fastjets = applyProjection<FastJets>(event, "Jets");
+      const Jets jets = fastjets.jetsByPt();
+    
+      // Charged particles part
+      _hist_chargemulti->fill(cfs.particles().size(), weight);
+      double meanpt(0), rmspt(0);
+      foreach (const Particle& p, cfs.particles()) {
+        const double pT = p.momentum().pT();
+        _hist_chargept->fill(pT/GeV, weight);
+        meanpt += pT;
+        rmspt += pT*pT;
+      }
+      meanpt = meanpt / cfs.particles().size();
+      _hist_chargemeanpt->fill(meanpt/GeV, weight);
+      rmspt = sqrt(rmspt / cfs.particles().size());
+      _hist_chargermspt->fill(rmspt/GeV, weight);
+      
+      // W part
+      _hist_wcount->fill(wf.particles().size(), weight);
+      foreach (const Particle& wp, wf.particles()) {
+        const double pT = wp.momentum().pT();
+        _hist_wpt->fill(pT/GeV, weight);
+        _hist_wlogpt->fill(log(pT/GeV), weight);
+        _hist_weta->fill(wp.momentum().pseudorapidity(), weight);
+        _hist_wphi->fill(wp.momentum().azimuthalAngle(), weight);
+        const double m = wp.momentum().mass();
+        _hist_wmass->fill(m/GeV, weight);
+        _hist_wlogmass->fill(log(m/GeV), weight);	
+      }
+      
+      // Jet part
+      _hist_jetcount->fill(fastjets.size(), weight);
+      foreach(const Jet& j, fastjets.jetsByPt()) {
+        const double pT = j.momentum().pT();
+        _hist_jetpt->fill(pT/GeV, weight);
+        _hist_jetlogpt->fill(log(pT/GeV), weight);
+      }
+    }
+    
+    
+    void finalize() {
+      ///@todo Obtain cross-sections from generator and normalise histos to them.
+    }
+    
+    //@}
+    
+  private:
+
+    /// @name Histograms
+    //@{
+    AIDA::IHistogram1D* _hist_chargemulti;
+    AIDA::IHistogram1D* _hist_chargept;
+    AIDA::IHistogram1D* _hist_chargemeanpt;
+    AIDA::IHistogram1D* _hist_chargermspt;
+    AIDA::IHistogram1D* _hist_wcount;
+    AIDA::IHistogram1D* _hist_wpt;
+    AIDA::IHistogram1D* _hist_wlogpt;
+    //AIDA::IHistogram1D* _hist_zpthigh;
+    //AIDA::IHistogram1D* _hist_zlogpthigh;
+    AIDA::IHistogram1D* _hist_weta;
+    AIDA::IHistogram1D* _hist_wphi;
+    AIDA::IHistogram1D* _hist_wmass;
+    AIDA::IHistogram1D* _hist_wlogmass;
+    AIDA::IHistogram1D* _hist_jetcount;
+    AIDA::IHistogram1D* _hist_jetpt;
+    AIDA::IHistogram1D* _hist_jetlogpt;
+    //@}
+
+  };
+
+
+
+  // This global object acts as a hook for the plugin system
+  AnalysisBuilder<MC_LHC_WANALYSIS> plugin_MC_LHC_WANALYSIS;
+
+}

Modified: trunk/src/Analyses/MC/MC_LHC_ZANALYSIS.cc
==============================================================================
--- trunk/src/Analyses/MC/MC_LHC_ZANALYSIS.cc	Tue Sep  1 12:21:37 2009	(r1799)
+++ trunk/src/Analyses/MC/MC_LHC_ZANALYSIS.cc	Tue Sep  1 23:38:48 2009	(r1800)
@@ -12,9 +12,10 @@
   class MC_LHC_ZANALYSIS : public Analysis {
   public:
   
-  /// Default constructor
+    /// Default constructor
     MC_LHC_ZANALYSIS()
-      : Analysis("MC_LHC_ZANALYSIS") {
+      : Analysis("MC_LHC_ZANALYSIS") 
+    {
       const ChargedFinalState cfs;
       addProjection(cfs, "CFS");
       const ZFinder zf(-MAXRAPIDITY, MAXRAPIDITY, 0.0*GeV, ELECTRON, 30.0*GeV, 115.0*GeV, 0.2);
@@ -30,7 +31,7 @@
 
     void init() { 
       _hist_chargemulti = bookHistogram1D("d01-x01-y01", 30, 0.5, 250.5);
-      _hist_chargept = bookHistogram1D("d02-x01-y01",  32, 0., 25.);
+      _hist_chargept = bookHistogram1D("d02-x01-y01", 32, 0., 25.);
       _hist_chargemeanpt = bookHistogram1D("d03-x01-y01", 25, 0., 10.);
       _hist_chargermspt = bookHistogram1D("d04-x01-y01", 32, 0., 10.);
       _hist_zcount = bookHistogram1D("d05-x01-y01", 30, 0., 15.);
@@ -39,50 +40,53 @@
       _hist_zeta = bookHistogram1D("d08-x01-y01", 32, -6., 6.);
       _hist_zphi = bookHistogram1D("d09-x01-y01", 32, 0., 6.4);
       _hist_zmass = bookHistogram1D("d10-x01-y01", 40, 60., 100.);
-      _hist_zlogmass = bookHistogram1D("d11-x01-y01",32, 0., 10.);
+      _hist_zlogmass = bookHistogram1D("d11-x01-y01", 32, 0., 10.);
       _hist_jetcount = bookHistogram1D("d12-x01-y01", 32, 0, 100);
-      _hist_jetpt = bookHistogram1D("d13-x01-y01",32, 20., 100.);
+      _hist_jetpt = bookHistogram1D("d13-x01-y01", 32, 20., 100.);
       _hist_jetlogpt = bookHistogram1D("d14-x01-y01", 32, 0., 20.);
     }
     
     
     void analyze(const Event& event) {
+      const double weight = event.weight();
       const FinalState& cfs = applyProjection<FinalState>(event, "CFS");
-      const ZFinder zf = applyProjection<ZFinder>(event, "ZF");
-      const FastJets fastjets = applyProjection<FastJets>(event, "Jets");
+      const ZFinder& zf = applyProjection<ZFinder>(event, "ZF");
+      const FastJets& fastjets = applyProjection<FastJets>(event, "Jets");
       const Jets jets = fastjets.jetsByPt();
-      const double weight = event.weight();
-      double meanpt(0), rmspt(0);
     
       // Charged particles part    
       _hist_chargemulti->fill(cfs.particles().size(), weight);
-      foreach(Particle p, cfs.particles()) {
-        _hist_chargept->fill(p.momentum().pT(), weight);
-        meanpt = meanpt + p.momentum().pT();
-        rmspt = rmspt + p.momentum().pT()*p.momentum().pT();
+      double meanpt(0), rmspt(0);
+      foreach (const Particle& p, cfs.particles()) {
+        const double pT = p.momentum().pT();
+        _hist_chargept->fill(pT/GeV, weight);
+        meanpt += pT;
+        rmspt += pT*pT;
       }
-      
-      meanpt = meanpt/ cfs.particles().size();
-      _hist_chargemeanpt->fill(meanpt, weight);
+      meanpt = meanpt / cfs.particles().size();
+      _hist_chargemeanpt->fill(meanpt/GeV, weight);
       rmspt = sqrt(rmspt / cfs.particles().size());
-      _hist_chargermspt->fill(rmspt, weight);
+      _hist_chargermspt->fill(rmspt/GeV, weight);
       
       // Z part
       _hist_zcount->fill(zf.particles().size(), weight);
-      foreach (Particle zp, zf.particles()) {
-        _hist_zpt->fill(zp.momentum().pT(), weight);
-        _hist_zlogpt->fill(log(zp.momentum().pT()), weight);
+      foreach (const Particle& zp, zf.particles()) {
+        const double pT = zp.momentum().pT();
+        _hist_zpt->fill(pT/GeV, weight);
+        _hist_zlogpt->fill(log(pT/GeV), weight);
         _hist_zeta->fill(zp.momentum().pseudorapidity(), weight);
         _hist_zphi->fill(zp.momentum().azimuthalAngle(), weight);
-        _hist_zmass->fill(zp.momentum().mass(), weight);
-        _hist_zlogmass->fill(log(zp.momentum().mass()), weight);	
+        const double m = zp.momentum().mass();
+        _hist_zmass->fill(m/GeV, weight);
+        _hist_zlogmass->fill(log(m/GeV), weight);	
       }
       
       // Jet part
       _hist_jetcount->fill(fastjets.size(), weight);
-      foreach(Jet j, fastjets.jetsByPt()) {
-        _hist_jetpt->fill(j.momentum().pT(), weight);
-        _hist_jetlogpt->fill(log(j.momentum().pT()), weight);
+      foreach(const Jet& j, fastjets.jetsByPt()) {
+        const double pT = j.momentum().pT();
+        _hist_jetpt->fill(pT/GeV, weight);
+        _hist_jetlogpt->fill(log(pT/GeV), weight);
       }
     }
     
@@ -93,6 +97,7 @@
     
     //@}
     
+
   private:
 
     /// @name Histograms

Modified: trunk/src/Analyses/MC/Makefile.am
==============================================================================
--- trunk/src/Analyses/MC/Makefile.am	Tue Sep  1 12:21:37 2009	(r1799)
+++ trunk/src/Analyses/MC/Makefile.am	Tue Sep  1 23:38:48 2009	(r1800)
@@ -6,6 +6,7 @@
     MC_TVT1960_ZJETS.cc \
     MC_LHC_LEADINGJETS.cc \
     MC_LHC_DIJET.cc \
+    MC_LHC_WANALYSIS.cc \
     MC_LHC_ZANALYSIS.cc
 
 ## Flags for building all plugins

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	Tue Sep  1 12:21:37 2009	(r1799)
+++ trunk/src/Makefile.am	Tue Sep  1 23:38:48 2009	(r1800)
@@ -12,7 +12,7 @@
   Analysis.cc AnalysisLoader.cc AnalysisInfo.cc \
   AnalysisHandler.cc ProjectionHandler.cc HistoHandler.cc 
 
-libRivet_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/Tools/YAML $(CPPFLAGS)
+libRivet_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/Tools/yaml-cpp $(CPPFLAGS)
 
 libRivet_la_LDFLAGS = -L$(prefix)/lib \
   -L$(GSLLIBPATH) -L$(GSLCBLASLIBPATH) -export-dynamic $(VERSIONINFOFLAGS)

Modified: trunk/src/Projections/ClusteredPhotons.cc
==============================================================================
--- trunk/src/Projections/ClusteredPhotons.cc	Tue Sep  1 12:21:37 2009	(r1799)
+++ trunk/src/Projections/ClusteredPhotons.cc	Tue Sep  1 23:38:48 2009	(r1800)
@@ -1,12 +1,14 @@
 // -*- C++ -*-
 #include "Rivet/Projections/ClusteredPhotons.hh"
 #include "Rivet/Tools/Logging.hh"
+#include "Rivet/Tools/ParticleIDMethods.hh"
 #include "Rivet/Cmp.hh"
 
 namespace Rivet {
 
+
   int ClusteredPhotons::compare(const Projection& p) const {
-    const PCmp fscmp = mkNamedPCmp(p, "FS");
+    const PCmp fscmp = mkNamedPCmp(p, "Photons");
     if (fscmp != PCmp::EQUIVALENT) return fscmp;
 
     const PCmp sigcmp = mkNamedPCmp(p, "Signal");
@@ -20,27 +22,28 @@
 
   void ClusteredPhotons::project(const Event& e) {
     _theParticles.clear();
-    if (!_dRmax>0.0) return;
+    if (!_dRmax > 0.0) return;
 
-    const FinalState& fs = applyProjection<FinalState>(e, "FS");
+    const FinalState& photons = applyProjection<FinalState>(e, "Photons");
     const FinalState& signal = applyProjection<FinalState>(e, "Signal");
 
-    foreach (const Particle& p, fs.particles()) {
+    foreach (const Particle& p, photons.particles()) {
       bool clustered = false;
-      if (p.pdgId() == PHOTON) {
-        foreach (const Particle& l, signal.particles()) {
-          FourMomentum p_l=l.momentum();
-          FourMomentum p_P=p.momentum();
-          if (deltaR(p_l.pseudorapidity(), p_l.azimuthalAngle(),
-                     p_P.pseudorapidity(), p_P.azimuthalAngle()) < _dRmax) {
-            clustered = true;
-          }
+      foreach (const Particle& l, signal.particles()) {
+        // Only cluster photons around *charged* signal particles
+        if (PID::threeCharge(l.pdgId()) == 0) continue;
+        // Geometrically match momentum vectors
+        const FourMomentum p_l = l.momentum();
+        const FourMomentum p_P = p.momentum();
+        if (deltaR(p_l.pseudorapidity(), p_l.azimuthalAngle(),
+                   p_P.pseudorapidity(), p_P.azimuthalAngle()) < _dRmax) {
+          clustered = true;
         }
-        if (clustered) _theParticles.push_back(p);
       }
+      if (clustered) _theParticles.push_back(p);
     }
-    getLog() << Log::DEBUG << name() <<" found " << _theParticles.size()
-             <<" particles." << endl;
+    getLog() << Log::DEBUG << name() << " found " << _theParticles.size()
+             << " matching photons." << endl;
   }
 
 }

Modified: trunk/src/Projections/Makefile.am
==============================================================================
--- trunk/src/Projections/Makefile.am	Tue Sep  1 12:21:37 2009	(r1799)
+++ trunk/src/Projections/Makefile.am	Tue Sep  1 23:38:48 2009	(r1800)
@@ -30,4 +30,5 @@
   UnstableFinalState.cc \
   VetoedFinalState.cc \
   VisibleFinalState.cc \
+  WFinder.cc \
   ZFinder.cc

Added: trunk/src/Projections/WFinder.cc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/src/Projections/WFinder.cc	Tue Sep  1 23:38:48 2009	(r1800)
@@ -0,0 +1,130 @@
+// -*- C++ -*-
+#include "Rivet/Projections/WFinder.hh"
+#include "Rivet/Projections/InvMassFinalState.hh"
+#include "Rivet/Projections/ClusteredPhotons.hh"
+#include "Rivet/Projections/VetoedFinalState.hh"
+#include "Rivet/Tools/Logging.hh"
+#include "Rivet/Cmp.hh"
+
+namespace Rivet {
+
+
+  WFinder::WFinder(const FinalState& fs,
+                   PdgId pid,
+                   double m2_min, double m2_max,
+                   double dRmax) {
+    _init(fs, pid, m2_min, m2_max, dRmax);
+  }
+
+
+  WFinder::WFinder(double etaMin, double etaMax,
+                   double pTmin,
+                   PdgId pid,
+                   double m2_min, double m2_max,
+                   double dRmax) {
+    vector<pair<double, double> > etaRanges;
+    etaRanges += std::make_pair(etaMin, etaMax);
+    _init(etaRanges, pTmin, pid, m2_min, m2_max, dRmax);
+  }
+
+
+  WFinder::WFinder(const std::vector<std::pair<double, double> >& etaRanges,
+                   double pTmin,
+                   PdgId pid,
+                   double m2_min, const double m2_max,
+                   double dRmax) {
+    _init(etaRanges, pTmin, pid, m2_min, m2_max, dRmax);
+  }
+
+
+  void WFinder::_init(const std::vector<std::pair<double, double> >& etaRanges,
+                      double pTmin,  PdgId pid,
+                      double m2_min, double m2_max,
+                      double dRmax) {
+    FinalState fs(etaRanges, pTmin);
+    _init(fs, pid, m2_min, m2_max, dRmax);
+  }
+
+
+  void WFinder::_init(const FinalState& fs,
+                      PdgId pid,
+                      double m2_min, double m2_max,
+                      double dRmax)
+  {
+    setName("WFinder");
+
+    addProjection(fs, "FS");
+
+    assert(abs(pid) == ELECTRON || abs(pid) == MUON || abs(pid) == TAU);
+    PdgId nu_pid = -(abs(pid) + 1);
+    assert(abs(nu_pid) == NU_E || abs(nu_pid) == NU_MU || abs(nu_pid) == NU_TAU);
+    std::vector<std::pair<long, long> > l_nu_ids;
+    l_nu_ids += std::make_pair(abs(pid), -abs(nu_pid));
+    l_nu_ids += std::make_pair(-abs(pid), abs(nu_pid));
+    InvMassFinalState imfs(fs, l_nu_ids, m2_min, m2_max);
+    addProjection(imfs, "IMFS");
+    
+    ClusteredPhotons cphotons(FinalState(), imfs, dRmax);
+    addProjection(cphotons, "CPhotons");
+
+    VetoedFinalState remainingFS;
+    remainingFS.addVetoOnThisFinalState(imfs);
+    remainingFS.addVetoOnThisFinalState(cphotons);
+    addProjection(remainingFS, "RFS");
+  }
+
+
+  /////////////////////////////////////////////////////
+
+
+  const FinalState& WFinder::remainingFinalState() const
+  {
+    return getProjection<FinalState>("RFS");
+  }
+
+
+  const FinalState& WFinder::constituentsFinalState() const
+  {
+    return getProjection<FinalState>("IMFS");
+  }
+
+
+  int WFinder::compare(const Projection& p) const {
+    PCmp cmp = mkNamedPCmp(p, "IMFS");
+    if (cmp != PCmp::EQUIVALENT) return cmp;
+
+    cmp = mkNamedPCmp(p, "CPhotons");
+    if (cmp != PCmp::EQUIVALENT) return cmp;
+
+    return PCmp::EQUIVALENT;
+  } 
+  
+
+  void WFinder::project(const Event& e) {
+    _theParticles.clear();
+
+    const FinalState& imfs = applyProjection<FinalState>(e, "IMFS");
+    if (imfs.particles().size() != 2) return;
+
+    const FinalState& photons = applyProjection<FinalState>(e, "CPhotons");
+    
+    getLog() << Log::DEBUG << "Z reconstructed out of: " << endl
+        << "  " << imfs.particles()[0].momentum() << " " << imfs.particles()[0].pdgId() << endl
+        << " +" << imfs.particles()[1].momentum() << " " << imfs.particles()[1].pdgId() << endl;
+
+    Particle W;
+    FourMomentum pW = imfs.particles()[0].momentum() + imfs.particles()[1].momentum();
+    foreach (const Particle& photon, photons.particles()) {
+      getLog() << Log::DEBUG << " + " << photon.momentum() << " " << photon.pdgId() << endl;
+      pW += photon.momentum();
+    }
+    getLog() << Log::DEBUG << " = " << W.momentum() << endl;
+    W.setMomentum(pW);
+
+    _theParticles.push_back(W);
+    getLog() << Log::DEBUG << name() << " found " << _theParticles.size()
+             << " W candidates." << endl;
+  }
+ 
+ 
+}

Modified: trunk/src/Tools/Makefile.am
==============================================================================
--- trunk/src/Tools/Makefile.am	Tue Sep  1 12:21:37 2009	(r1799)
+++ trunk/src/Tools/Makefile.am	Tue Sep  1 23:38:48 2009	(r1800)
@@ -1,4 +1,4 @@
-SUBDIRS = YAML
+SUBDIRS = yaml-cpp
 
 noinst_LTLIBRARIES = libRivetTools.la
 
@@ -23,5 +23,5 @@
   -DDEFAULTDATADIR=\"$(datadir)\" \
   -DDEFAULTLIBDIR=\"$(libdir)\"
 
-libRivetTools_la_LDFLAGS = $(AM_LDFLAGS) -L$(top_builddir)/src/Tools/YAML
+libRivetTools_la_LDFLAGS = $(AM_LDFLAGS) -L$(builddir)/yaml-cpp
 libRivetTools_la_LIBADD = -lyaml-cpp


More information about the Rivet-svn mailing list