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/ClusteredPhotons.hh"
00005 #include "Rivet/Projections/VetoedFinalState.hh"
00006 #include "Rivet/Tools/ParticleIdUtils.hh"
00007 #include "Rivet/Tools/Logging.hh"
00008 #include "Rivet/Cmp.hh"
00009 
00010 namespace Rivet {
00011 
00012 
00013   ZFinder::ZFinder(const FinalState& fs,
00014                    PdgId pid,
00015                    double m2_min, double m2_max,
00016                    double dRmax) {
00017     _init(fs, pid, m2_min, m2_max, dRmax);
00018   }
00019 
00020 
00021   ZFinder::ZFinder(double etaMin, double etaMax,
00022                    double pTmin,
00023                    PdgId pid,
00024                    double m2_min, double m2_max,
00025                    double dRmax) {
00026     vector<pair<double, double> > etaRanges;
00027     etaRanges += std::make_pair(etaMin, etaMax);
00028     _init(etaRanges, pTmin, pid, m2_min, m2_max, dRmax);
00029   }
00030 
00031 
00032   ZFinder::ZFinder(const std::vector<std::pair<double, double> >& etaRanges,
00033                    double pTmin,
00034                    PdgId pid,
00035                    double m2_min, const double m2_max,
00036                    double dRmax) {
00037     _init(etaRanges, pTmin, pid, m2_min, m2_max, dRmax);
00038   }
00039 
00040 
00041   void ZFinder::_init(const std::vector<std::pair<double, double> >& etaRanges,
00042                       double pTmin,  PdgId pid,
00043                       double m2_min, double m2_max,
00044                       double dRmax) {
00045     FinalState fs(etaRanges, pTmin);
00046     _init(fs, pid, m2_min, m2_max, dRmax);
00047   }
00048 
00049 
00050   void ZFinder::_init(const FinalState& fs,
00051                       PdgId pid,
00052                       double m2_min, double m2_max,
00053                       double dRmax)
00054   {
00055     setName("ZFinder");
00056 
00057     addProjection(fs, "FS");
00058 
00059     InvMassFinalState imfs(fs, std::make_pair(pid, -pid), m2_min, m2_max);
00060     addProjection(imfs, "IMFS");
00061  
00062     ClusteredPhotons cphotons(FinalState(), imfs, dRmax);
00063     addProjection(cphotons, "CPhotons");
00064 
00065     VetoedFinalState remainingFS;
00066     remainingFS.addVetoOnThisFinalState(imfs);
00067     remainingFS.addVetoOnThisFinalState(cphotons);
00068     addProjection(remainingFS, "RFS");
00069   }
00070 
00071 
00072   /////////////////////////////////////////////////////
00073 
00074 
00075   const FinalState& ZFinder::remainingFinalState() const
00076   {
00077     return getProjection<FinalState>("RFS");
00078   }
00079 
00080 
00081   const FinalState& ZFinder::constituentsFinalState() const
00082   {
00083     return getProjection<FinalState>("IMFS");
00084   }
00085 
00086   int ZFinder::compare(const Projection& p) const {
00087     PCmp cmp = mkNamedPCmp(p, "IMFS");
00088     if (cmp != EQUIVALENT) return cmp;
00089 
00090     cmp = mkNamedPCmp(p, "CPhotons");
00091     if (cmp != EQUIVALENT) return cmp;
00092 
00093     return EQUIVALENT;
00094   }
00095 
00096 
00097   void ZFinder::project(const Event& e) {
00098     _theParticles.clear();
00099 
00100     const FinalState& imfs=applyProjection<FinalState>(e, "IMFS");
00101     if (imfs.particles().size() != 2) return;
00102     FourMomentum pZ = imfs.particles()[0].momentum() + imfs.particles()[1].momentum();
00103     const int z3charge = PID::threeCharge(imfs.particles()[0].pdgId()) + PID::threeCharge(imfs.particles()[1].pdgId());
00104     assert(z3charge == 0);
00105 
00106     stringstream msg;
00107     msg << "Z reconstructed from: " << endl
00108         << "   " << imfs.particles()[0].momentum() << " " << imfs.particles()[0].pdgId() << endl
00109         << " + " << imfs.particles()[1].momentum() << " " << imfs.particles()[1].pdgId() << endl;
00110 
00111     // Add in clustered photons
00112     const FinalState& photons = applyProjection<FinalState>(e, "CPhotons");
00113     foreach (const Particle& photon, photons.particles()) {
00114       msg << " + " << photon.momentum() << " " << photon.pdgId() << endl;
00115       pZ += photon.momentum();
00116     }
00117     msg << " = " << pZ;
00118     getLog() << Log::DEBUG << msg.str() << endl;
00119 
00120     Particle Z;
00121     Z.setMomentum(pZ);
00122     _theParticles.push_back(Z);
00123     getLog() << Log::DEBUG << name() << " found " << _theParticles.size()
00124              << " particles." << endl;
00125   }
00126 
00127 
00128 }