00001
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 const FinalState& ZFinder::clusteredPhotonsFinalState() const
00087 {
00088 return getProjection<FinalState>("CPhotons");
00089 }
00090
00091 int ZFinder::compare(const Projection& p) const {
00092 PCmp cmp = mkNamedPCmp(p, "IMFS");
00093 if (cmp != EQUIVALENT) return cmp;
00094
00095 cmp = mkNamedPCmp(p, "CPhotons");
00096 if (cmp != EQUIVALENT) return cmp;
00097
00098 return EQUIVALENT;
00099 }
00100
00101
00102 void ZFinder::project(const Event& e) {
00103 _theParticles.clear();
00104
00105 const FinalState& imfs=applyProjection<FinalState>(e, "IMFS");
00106 if (imfs.particles().size() != 2) return;
00107 FourMomentum pZ = imfs.particles()[0].momentum() + imfs.particles()[1].momentum();
00108 const int z3charge = PID::threeCharge(imfs.particles()[0].pdgId()) + PID::threeCharge(imfs.particles()[1].pdgId());
00109 assert(z3charge == 0);
00110
00111 stringstream msg;
00112 msg << "Z reconstructed from: " << endl
00113 << " " << imfs.particles()[0].momentum() << " " << imfs.particles()[0].pdgId() << endl
00114 << " + " << imfs.particles()[1].momentum() << " " << imfs.particles()[1].pdgId() << endl;
00115
00116
00117 const FinalState& photons = applyProjection<FinalState>(e, "CPhotons");
00118 foreach (const Particle& photon, photons.particles()) {
00119 msg << " + " << photon.momentum() << " " << photon.pdgId() << endl;
00120 pZ += photon.momentum();
00121 }
00122 msg << " = " << pZ;
00123 getLog() << Log::DEBUG << msg.str() << endl;
00124
00125 Particle Z;
00126 Z.setMomentum(pZ);
00127 _theParticles.push_back(Z);
00128 getLog() << Log::DEBUG << name() << " found " << _theParticles.size()
00129 << " particles." << endl;
00130 }
00131
00132
00133 }