rivet is hosted by Hepforge, IPPP Durham
ZFinder.hh
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef RIVET_ZFinder_HH
00003 #define RIVET_ZFinder_HH
00004 
00005 #include "Rivet/Tools/Logging.hh"
00006 #include "Rivet/Config/RivetCommon.hh"
00007 #include "Rivet/Particle.hh"
00008 #include "Rivet/Event.hh"
00009 #include "Rivet/Projection.hh"
00010 #include "Rivet/Projections/FinalState.hh"
00011 #include "Rivet/Projections/DressedLeptons.hh"
00012 
00013 namespace Rivet {
00014 
00015 
00016   /// @brief Convenience finder of leptonically decaying Zs
00017   ///
00018   /// Chain together different projections as convenience for finding Z's
00019   /// from two leptons in the final state, including photon clustering.
00020   class ZFinder : public FinalState {
00021   public:
00022 
00023     enum ClusterPhotons { NOCLUSTER=0, CLUSTERNODECAY=1, CLUSTERALL };
00024     enum PhotonTracking { NOTRACK=0, TRACK=1 };
00025 
00026     /// @name Constructors
00027     //@{
00028 
00029     /// Constructor taking single eta/pT bounds
00030     ///
00031     /// @param etaMin,etaMax,pTmin lepton cuts
00032     /// @param pid type of the leptons
00033     /// @param minmass,maxmass mass window
00034     /// @param dRmax maximum dR of photons around leptons to take into account
00035     ///  for Z reconstruction (only relevant if one of the following are true)
00036     /// @param clusterPhotons whether such photons are supposed to be
00037     ///  clustered to the lepton objects and thus Z mom
00038     /// @param trackPhotons whether such photons should be added to _theParticles
00039     ///  (cf. _trackPhotons)
00040     ZFinder(double etaMin, double etaMax,
00041             double pTmin,
00042             PdgId pid,
00043             double minmass, double maxmass,
00044             double dRmax=0.1, ClusterPhotons clusterPhotons=CLUSTERNODECAY, PhotonTracking trackPhotons=NOTRACK,
00045             double masstarget=91.2*GeV) {
00046       vector<pair<double, double> > etaRanges;
00047       etaRanges += std::make_pair(etaMin, etaMax);
00048       _init(FinalState(), etaRanges, pTmin, pid, minmass, maxmass, dRmax, clusterPhotons, trackPhotons, masstarget);
00049     }
00050 
00051     /// Constructor taking single eta/pT bounds and an input FS
00052     ///
00053     /// @param inputfs Input final state
00054     /// @param etaMin,etaMax,pTmin lepton cuts
00055     /// @param pid type of the leptons
00056     /// @param minmass,maxmass mass window
00057     /// @param dRmax maximum dR of photons around leptons to take into account
00058     ///  for Z reconstruction (only relevant if one of the following are true)
00059     /// @param clusterPhotons whether such photons are supposed to be
00060     ///  clustered to the lepton objects and thus Z mom
00061     /// @param trackPhotons whether such photons should be added to _theParticles
00062     ///  (cf. _trackPhotons)
00063     ZFinder(const FinalState& inputfs,
00064             double etaMin, double etaMax,
00065             double pTmin,
00066             PdgId pid,
00067             double minmass, double maxmass,
00068             double dRmax=0.1, ClusterPhotons clusterPhotons=CLUSTERNODECAY, PhotonTracking trackPhotons=NOTRACK,
00069             double masstarget=91.2*GeV) {
00070       vector<pair<double, double> > etaRanges;
00071       etaRanges += std::make_pair(etaMin, etaMax);
00072       _init(inputfs, etaRanges, pTmin, pid, minmass, maxmass, dRmax, clusterPhotons, trackPhotons, masstarget);
00073     }
00074 
00075 
00076     /// Constructor taking multiple eta/pT bounds
00077     ///
00078     /// @param etaRanges,pTmin lepton cuts
00079     /// @param pid type of the leptons
00080     /// @param minmass,maxmass mass window
00081     /// @param dRmax maximum dR of photons around leptons to take into account
00082     ///  for Z reconstruction (only relevant if one of the following are true)
00083     /// @param clusterPhotons whether such photons are supposed to be
00084     ///  clustered to the lepton objects and thus Z mom
00085     /// @param trackPhotons whether such photons should be added to _theParticles
00086     ///  (cf. _trackPhotons)
00087     ZFinder(const vector<pair<double, double> >& etaRanges,
00088             double pTmin,
00089             PdgId pid,
00090             double minmass, const double maxmass,
00091             double dRmax=0.1, ClusterPhotons clusterPhotons=CLUSTERNODECAY, PhotonTracking trackPhotons=NOTRACK,
00092             double masstarget=91.2*GeV) {
00093       _init(FinalState(), etaRanges, pTmin, pid, minmass, maxmass, dRmax, clusterPhotons, trackPhotons, masstarget);
00094     }
00095 
00096 
00097     /// Constructor taking multiple eta/pT bounds and an input FS
00098     ///
00099     /// @param inputfs Input final state
00100     /// @param etaRanges,pTmin lepton cuts
00101     /// @param pid type of the leptons
00102     /// @param minmass,maxmass mass window
00103     /// @param dRmax maximum dR of photons around leptons to take into account
00104     ///  for Z reconstruction (only relevant if one of the following are true)
00105     /// @param clusterPhotons whether such photons are supposed to be
00106     ///  clustered to the lepton objects and thus Z mom
00107     /// @param trackPhotons whether such photons should be added to _theParticles
00108     ///  (cf. _trackPhotons)
00109     ZFinder(const FinalState& inputfs,
00110             const vector<pair<double, double> >& etaRanges,
00111             double pTmin,
00112             PdgId pid,
00113             double minmass, const double maxmass,
00114             double dRmax=0.1, ClusterPhotons clusterPhotons=CLUSTERNODECAY, PhotonTracking trackPhotons=NOTRACK,
00115             double masstarget=91.2*GeV) {
00116       _init(inputfs, etaRanges, pTmin, pid, minmass, maxmass, dRmax, clusterPhotons, trackPhotons, masstarget);
00117     }
00118 
00119 
00120     /// Clone on the heap.
00121     virtual const Projection* clone() const {
00122       return new ZFinder(*this);
00123     }
00124 
00125     //@}
00126 
00127 
00128     /// Access to the found bosons
00129     ///
00130     /// @note Currently either 0 or 1 boson can be found.
00131     const Particles& bosons() const { return _bosons; }
00132 
00133     /// Access to the found boson (assuming it exists).
00134     const Particle boson() const { return _bosons[0]; }
00135 
00136     /// Access to the Z constituent clustered leptons
00137     ///
00138     /// For example, to make more fine-grained cuts on the clustered leptons.
00139     /// The positive charge constituent is first in the list (if not empty), and
00140     /// the negative one second.
00141     const Particles& constituents() const { return _constituents; }
00142 
00143     /// Access to the Z constituent clustered leptons, sorted by a comparison functor
00144     ///
00145     /// Unlike the no-arg version, this returns by value (i.e. is less efficient)
00146     template <typename CMP>
00147     Particles constituents(const CMP& cmp) const {
00148       Particles rtn = constituents();
00149       std::sort(rtn.begin(), rtn.end(), cmp);
00150       return rtn;
00151     }
00152 
00153     /// Access to the particles other than the Z leptons and clustered photons
00154     ///
00155     /// Useful for e.g. input to a jet finder
00156     const FinalState& remainingFinalState() const;
00157 
00158 
00159   protected:
00160 
00161     /// Apply the projection on the supplied event.
00162     void project(const Event& e);
00163 
00164     /// Compare projections.
00165     int compare(const Projection& p) const;
00166 
00167 
00168   public:
00169 
00170     /// Clear the projection
00171     void clear() {
00172       _theParticles.clear();
00173       _bosons.clear();
00174       _constituents.clear();
00175     }
00176 
00177 
00178   private:
00179     /// Common implementation of constructor operation, taking FS params.
00180     void _init(const FinalState& inputfs,
00181                const vector<pair<double, double> >& etaRanges,
00182                double pTmin,  PdgId pid,
00183                double minmass, double maxmass,
00184                double dRmax, ClusterPhotons clusterPhotons=CLUSTERNODECAY, PhotonTracking trackPhotons=NOTRACK,
00185                double masstarget=91.2*GeV);
00186 
00187     /// Mass cuts to apply to clustered leptons (cf. InvMassFinalState)
00188     double _minmass, _maxmass, _masstarget;
00189 
00190     /// Switch for tracking of photons (whether to add them to _theParticles)
00191     /// This is relevant when the ZFinder::_theParticles are to be excluded
00192     /// from e.g. the input to a jet finder, to specify whether the clustered
00193     /// photons are to be excluded as well.
00194     /// (Yes, some experiments make a difference between clusterPhotons and
00195     /// trackPhotons!)
00196     PhotonTracking _trackPhotons;
00197 
00198     /// Lepton flavour
00199     PdgId _pid;
00200 
00201     /// list of found bosons (currently either 0 or 1)
00202     Particles _bosons;
00203 
00204     /// Clustered leptons
00205     vector<Particle> _constituents;
00206 
00207   };
00208 
00209 
00210 }
00211 
00212 
00213 
00214 #endif