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