rivet is hosted by Hepforge, IPPP Durham
ZFinder.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Projections/ZFinder.hh"
00003 #include "Rivet/Projections/InvMassFinalState.hh"
00004 #include "Rivet/Projections/VetoedFinalState.hh"
00005 
00006 namespace Rivet {
00007 
00008 
00009   ZFinder::ZFinder(const FinalState& inputfs,
00010            const Cut & fsCut,
00011                    PdgId pid,
00012                    double minmass, double maxmass,
00013                    double dRmax,
00014                    ClusterPhotons clusterPhotons,
00015                    PhotonTracking trackPhotons,
00016                    double masstarget)
00017   {
00018     setName("ZFinder");
00019 
00020     _minmass = minmass;
00021     _maxmass = maxmass;
00022     _masstarget = masstarget;
00023     _pid = pid;
00024     _trackPhotons = trackPhotons;
00025 
00026     IdentifiedFinalState bareleptons(inputfs);
00027     bareleptons.acceptIdPair(pid);
00028     const bool doClustering = (clusterPhotons != NOCLUSTER);
00029     const bool useDecayPhotons = (clusterPhotons == CLUSTERALL);
00030     DressedLeptons leptons(inputfs, bareleptons, dRmax, fsCut, doClustering, useDecayPhotons);
00031     addProjection(leptons, "DressedLeptons");
00032 
00033     VetoedFinalState remainingFS;
00034     remainingFS.addVetoOnThisFinalState(*this);
00035     addProjection(remainingFS, "RFS");
00036   }
00037 
00038 
00039   /////////////////////////////////////////////////////
00040 
00041 
00042   const VetoedFinalState& ZFinder::remainingFinalState() const {
00043     return getProjection<VetoedFinalState>("RFS");
00044   }
00045 
00046 
00047   int ZFinder::compare(const Projection& p) const {
00048     PCmp LCcmp = mkNamedPCmp(p, "DressedLeptons");
00049     if (LCcmp != EQUIVALENT) return LCcmp;
00050 
00051     const ZFinder& other = dynamic_cast<const ZFinder&>(p);
00052     return (cmp(_minmass, other._minmass) || cmp(_maxmass, other._maxmass) ||
00053             cmp(_pid, other._pid) || cmp(_trackPhotons, other._trackPhotons));
00054   }
00055 
00056 
00057   void ZFinder::project(const Event& e) {
00058     clear();
00059 
00060     const DressedLeptons& leptons = applyProjection<DressedLeptons>(e, "DressedLeptons");
00061 
00062     InvMassFinalState imfs(std::make_pair(_pid, -_pid), _minmass, _maxmass, _masstarget);
00063     Particles tmp;
00064     tmp.insert(tmp.end(), leptons.dressedLeptons().begin(), leptons.dressedLeptons().end());
00065     imfs.calc(tmp);
00066 
00067     if (imfs.particlePairs().size() < 1) return;
00068     ParticlePair Zconstituents(imfs.particlePairs()[0]);
00069     Particle l1(Zconstituents.first), l2(Zconstituents.second);
00070     if (threeCharge(l1) > 0.0) {
00071       _constituents += l1, l2;
00072     } else {
00073       _constituents += l2, l1;
00074     }
00075     FourMomentum pZ = l1.momentum() + l2.momentum();
00076     assert(threeCharge(l1) + threeCharge(l2) == 0);
00077 
00078     stringstream msg;
00079     msg << "Z " << pZ << " reconstructed from: \n"
00080         << "   " << l1.momentum() << " " << l1.pid() << "\n"
00081         << " + " << l2.momentum() << " " << l2.pid();
00082     MSG_DEBUG(msg.str());
00083     _bosons.push_back(Particle(PID::ZBOSON, pZ));
00084 
00085     // Keep the DressedLeptons found by the ZFinder
00086     foreach (DressedLepton l, leptons.dressedLeptons()) {
00087       _allLeptons.push_back(l);
00088     }
00089 
00090     // Find the DressedLeptons which survived the IMFS cut such that we can
00091     // extract their original particles
00092     foreach (const Particle& p, _constituents) {
00093       foreach (const DressedLepton& l, leptons.dressedLeptons()) {
00094         if (p.pid() == l.pid() && p.momentum() == l.momentum()) {
00095           _theParticles.push_back(l.constituentLepton());
00096           if (_trackPhotons) {
00097             _theParticles.insert(_theParticles.end(), l.constituentPhotons().begin(), l.constituentPhotons().end());
00098           }
00099         }
00100       }
00101     }
00102   }
00103 
00104 
00105 }