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