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            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, doClustering, fsCut, 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.clusteredLeptons().begin(), leptons.clusteredLeptons().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 (PID::threeCharge(l1)>0.0) {
00072       _constituents += l1, l2;
00073     }
00074     else {
00075       _constituents += l2, l1;
00076     }
00077     FourMomentum pZ = l1.momentum() + l2.momentum();
00078     assert(PID::threeCharge(l1.pdgId()) + PID::threeCharge(l2.pdgId()) == 0);
00079 
00080     stringstream msg;
00081     msg << "Z reconstructed from: \n"
00082         << "   " << l1.momentum() << " " << l1.pdgId() << "\n"
00083         << " + " << l2.momentum() << " " << l2.pdgId();
00084     MSG_DEBUG(msg.str());
00085     _bosons.push_back(Particle(PID::ZBOSON, pZ));
00086 
00087     // Find the DressedLeptons which survived the IMFS cut such that we can
00088     // extract their original particles
00089     foreach (const Particle& p, _constituents) {
00090       foreach (const ClusteredLepton& l, leptons.clusteredLeptons()) {
00091         if (p.pdgId()==l.pdgId() && p.momentum()==l.momentum()) {
00092           _theParticles.push_back(l.constituentLepton());
00093           if (_trackPhotons) {
00094             _theParticles.insert(_theParticles.end(),
00095                                  l.constituentPhotons().begin(), l.constituentPhotons().end());
00096           }
00097         }
00098       }
00099     }
00100   }
00101 
00102 
00103 }