rivet is hosted by Hepforge, IPPP Durham
WFinder.hh
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef RIVET_WFinder_HH
00003 #define RIVET_WFinder_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/ChargedFinalState.hh"
00011 #include "Rivet/Projections/DressedLeptons.hh"
00012 
00013 namespace Rivet {
00014 
00015 
00016   /// @brief Convenience finder of leptonically decaying Ws
00017   ///
00018   /// Chain together different projections as convenience for finding W's
00019   /// from two leptons in the final state, including photon clustering.
00020   class WFinder : public FinalState {
00021   public:
00022 
00023     enum ClusterPhotons { NOCLUSTER=0, CLUSTERNODECAY=1, CLUSTERALL };
00024     enum PhotonTracking { NOTRACK=0, TRACK=1 };
00025     enum MassWindow { MASS=0, TRANSMASS=1 };
00026 
00027     /// @name Constructors
00028     //@{
00029 
00030     /// Constructor taking single eta/pT bounds
00031     ///
00032     /// @param etaMin,etaMax,pTmin charged lepton cuts
00033     /// @param pid type of the charged lepton
00034     /// @param minmass,maxmass (transverse) mass window
00035     /// @param missingET minimal amount of missing ET (neutrinos) required
00036     /// @param dRmax maximum dR of photons around charged lepton to take into account
00037     ///  for W reconstruction (only relevant if one of the following are true)
00038     /// @param clusterPhotons whether such photons are supposed to be
00039     ///  clustered to the lepton object and thus W mom
00040     /// @param trackPhotons whether such photons should be added to _theParticles
00041     /// @param masstype whether mass window should be applied using m or mT
00042     WFinder(double etaMin, double etaMax,
00043             double pTmin,
00044             PdgId pid,
00045             double minmass, double maxmass,
00046             double missingET,
00047             double dRmax=0.1, ClusterPhotons clusterPhotons=CLUSTERNODECAY, PhotonTracking trackPhotons=NOTRACK,
00048             MassWindow masstype=MASS, double masstarget=80.4*GeV) {
00049       vector<pair<double, double> > etaRanges;
00050       etaRanges += std::make_pair(etaMin, etaMax);
00051       _init(FinalState(), etaRanges, pTmin, pid, minmass, maxmass, missingET,
00052             dRmax, clusterPhotons, trackPhotons, masstype, masstarget);
00053     }
00054 
00055     /// Constructor taking single eta/pT bounds and an input FS
00056     ///
00057     /// @param inputfs Input final state
00058     /// @param etaMin,etaMax,pTmin charged lepton cuts
00059     /// @param pid type of the charged lepton
00060     /// @param minmass,maxmass (transverse) mass window
00061     /// @param missingET minimal amount of missing ET (neutrinos) required
00062     /// @param dRmax maximum dR of photons around charged lepton to take into account
00063     ///  for W reconstruction (only relevant if one of the following are true)
00064     /// @param clusterPhotons whether such photons are supposed to be
00065     ///  clustered to the lepton object and thus W mom
00066     /// @param trackPhotons whether such photons should be added to _theParticles
00067     /// @param masstype whether mass window should be applied using m or mT
00068     WFinder(const FinalState& inputfs,
00069             double etaMin, double etaMax,
00070             double pTmin,
00071             PdgId pid,
00072             double minmass, double maxmass,
00073             double missingET,
00074             double dRmax=0.1, ClusterPhotons clusterPhotons=CLUSTERNODECAY, PhotonTracking trackPhotons=NOTRACK,
00075             MassWindow masstype=MASS, double masstarget=80.4*GeV) {
00076       vector<pair<double, double> > etaRanges;
00077       etaRanges += std::make_pair(etaMin, etaMax);
00078       _init(inputfs, etaRanges, pTmin, pid, minmass, maxmass, missingET,
00079             dRmax, clusterPhotons, trackPhotons, masstype, masstarget);
00080     }
00081 
00082 
00083     /// Constructor taking multiple eta/pT bounds
00084     ///
00085     /// @param etaRanges,pTmin charged lepton cuts
00086     /// @param pid type of the charged lepton
00087     /// @param minmass,maxmass (transverse) mass window
00088     /// @param missingET minimal amount of missing ET (neutrinos) required
00089     /// @param dRmax maximum dR of photons around charged lepton to take into account
00090     ///  for W reconstruction (only relevant if one of the following are true)
00091     /// @param clusterPhotons whether such photons are supposed to be
00092     ///  clustered to the lepton object and thus W mom
00093     /// @param trackPhotons whether such photons should be added to _theParticles
00094     /// @param masstype whether mass window should be applied using mT
00095     WFinder(const vector<pair<double, double> >& etaRanges,
00096             double pTmin,
00097             PdgId pid,
00098             double minmass, double maxmass,
00099             double missingET,
00100             double dRmax=0.1, ClusterPhotons clusterPhotons=CLUSTERNODECAY, PhotonTracking trackPhotons=NOTRACK,
00101             MassWindow masstype=MASS, double masstarget=80.4*GeV) {
00102       _init(FinalState(), etaRanges, pTmin, pid, minmass, maxmass, missingET,
00103             dRmax, clusterPhotons, trackPhotons, masstype, masstarget);
00104     }
00105 
00106 
00107     /// Constructor taking multiple eta/pT bounds and an input FS
00108     ///
00109     /// @param inputfs Input final state
00110     /// @param etaRanges,pTmin charged lepton cuts
00111     /// @param pid type of the charged lepton
00112     /// @param minmass,maxmass (transverse) mass window
00113     /// @param missingET minimal amount of missing ET (neutrinos) required
00114     /// @param dRmax maximum dR of photons around charged lepton to take into account
00115     ///  for W reconstruction (only relevant if one of the following are true)
00116     /// @param clusterPhotons whether such photons are supposed to be
00117     ///  clustered to the lepton object and thus W mom
00118     /// @param trackPhotons whether such photons should be added to _theParticles
00119     /// @param masstype whether mass window should be applied using mT
00120     WFinder(const FinalState& inputfs,
00121             const vector<pair<double, double> >& etaRanges,
00122             double pTmin,
00123             PdgId pid,
00124             double minmass, double maxmass,
00125             double missingET,
00126             double dRmax=0.1, ClusterPhotons clusterPhotons=CLUSTERNODECAY, PhotonTracking trackPhotons=NOTRACK,
00127             MassWindow masstype=MASS, double masstarget=80.4*GeV) {
00128       _init(inputfs, etaRanges, pTmin, pid, minmass, maxmass, missingET,
00129             dRmax, clusterPhotons, trackPhotons, masstype, masstarget);
00130     }
00131 
00132     /// Clone on the heap.
00133     virtual const Projection* clone() const {
00134       return new WFinder(*this);
00135     }
00136 
00137     //@}
00138 
00139 
00140     /// Access to the found bosons
00141     ///
00142     /// @note Currently either 0 or 1 boson can be found.
00143     const Particles& bosons() const { return _bosons; }
00144 
00145     /// Access to the found boson (assuming it exists)
00146     const Particle& boson() const { return _bosons[0]; }
00147 
00148 
00149     /// Access to the W constituent clustered leptons
00150     ///
00151     /// @note Either size 0 if no boson was found or 1 if one boson was found
00152     const Particles& constituentLeptons() const { return _constituentLeptons; }
00153 
00154     /// Access to the W constituent clustered lepton (assuming it exists)
00155     const Particle& constituentLepton() const { return _constituentLeptons[0]; }
00156 
00157 
00158     /// Access to the W constituent neutrinos
00159     ///
00160     /// @note Either size 0 if no boson was found or 1 if one boson was found
00161     const Particles& constituentNeutrinos() const { return _constituentNeutrinos; }
00162 
00163     /// Access to the W constituent neutrinos
00164     const Particle& constituentNeutrino() const { return _constituentNeutrinos[0]; }
00165 
00166 
00167     /// Access to the particles other than the W leptons and clustered photons
00168     ///
00169     /// Useful for e.g. input to a jet finder
00170     const FinalState& remainingFinalState() const;
00171 
00172     /// @brief Calculate the transverse mass of the W, from the charged lepton and neutrino
00173     ///
00174     /// Defined as sqrt(2 pT_l pT_nu (1.0 - cos(dphi_lnu))). Return -1 if no boson found.
00175     double mT() const {
00176       if (bosons().empty()) return -1;
00177       const FourMomentum& l = constituentLeptons()[0].momentum();
00178       const FourMomentum& nu = constituentNeutrinos()[0].momentum();
00179       return sqrt( 2 * l.pT() * nu.pT() * (1 - cos(deltaPhi(l, nu))) );
00180     }
00181 
00182 
00183   protected:
00184 
00185     /// Apply the projection on the supplied event.
00186     void project(const Event& e);
00187 
00188     /// Compare projections.
00189     int compare(const Projection& p) const;
00190 
00191 
00192   public:
00193 
00194     /// Clear the projection
00195     void clear() {
00196       _theParticles.clear();
00197       _bosons.clear();
00198       _constituentLeptons.clear();
00199       _constituentNeutrinos.clear();
00200     }
00201 
00202 
00203   private:
00204 
00205     /// Common implementation of constructor operation, taking FS params.
00206     void _init(const FinalState& inputfs,
00207                const vector<pair<double, double> >& etaRanges,
00208                double pTmin,  PdgId pid,
00209                double minmass, double maxmass,
00210                double missingET,
00211                double dRmax, ClusterPhotons clusterPhotons=CLUSTERNODECAY, PhotonTracking trackPhotons=NOTRACK,
00212                MassWindow masstype=MASS, double masstarget=80.4*GeV);
00213 
00214 
00215   private:
00216 
00217     /// Transverse mass cuts
00218     double _minmass, _maxmass, _masstarget;
00219     bool _useTransverseMass;
00220 
00221     /// Missing ET cut
00222     double _etMiss;
00223 
00224     /// Switch for tracking of photons (whether to add them to _theParticles)
00225     /// This is relevant when the ZFinder::_theParticles are to be excluded
00226     /// from e.g. the input to a jet finder, to specify whether the clustered
00227     /// photons are to be excluded as well.
00228     /// (Yes, some experiments make a difference between clusterPhotons and
00229     /// trackPhotons!)
00230     PhotonTracking _trackPhotons;
00231 
00232     /// Lepton flavour
00233     PdgId _pid;
00234 
00235     /// Neutrino flavour
00236     PdgId _nu_pid;
00237 
00238     /// list of found bosons (currently either 0 or 1)
00239     Particles _bosons;
00240 
00241     /// Constituent leptons (currently either 0 or 1)
00242     Particles _constituentLeptons;
00243 
00244     /// Constituent neutrinos (currently either 0 or 1)
00245     Particles _constituentNeutrinos;
00246 
00247   };
00248 
00249 
00250 }
00251 
00252 
00253 #endif