|
[Rivet-svn] r1802 - in trunk: include/Rivet/Math src/Analyses/MC src/Projectionsblackhole at projects.hepforge.org blackhole at projects.hepforge.orgWed Sep 2 09:03:32 BST 2009
Author: buckley Date: Wed Sep 2 09:03:31 2009 New Revision: 1802 Log: Improvements to W and Z finders and analyses: looks good. Modified: trunk/include/Rivet/Math/MathUtils.hh trunk/src/Analyses/MC/MC_LHC_WANALYSIS.cc trunk/src/Analyses/MC/MC_LHC_ZANALYSIS.cc trunk/src/Projections/WFinder.cc trunk/src/Projections/ZFinder.cc Modified: trunk/include/Rivet/Math/MathUtils.hh ============================================================================== --- trunk/include/Rivet/Math/MathUtils.hh Tue Sep 1 23:41:22 2009 (r1801) +++ trunk/include/Rivet/Math/MathUtils.hh Wed Sep 2 09:03:31 2009 (r1802) @@ -29,6 +29,12 @@ } /// Find the sign of a number + inline int sign(int val) { + if (val == 0) return ZERO; + return (val > 0) ? PLUS : MINUS; + } + + /// Find the sign of a number inline int sign(long val) { if (val == 0) return ZERO; return (val > 0) ? PLUS : MINUS; Modified: trunk/src/Analyses/MC/MC_LHC_WANALYSIS.cc ============================================================================== --- trunk/src/Analyses/MC/MC_LHC_WANALYSIS.cc Tue Sep 1 23:41:22 2009 (r1801) +++ trunk/src/Analyses/MC/MC_LHC_WANALYSIS.cc Wed Sep 2 09:03:31 2009 (r1802) @@ -18,6 +18,7 @@ { const ChargedFinalState cfs; addProjection(cfs, "CFS"); + /// @todo Handle muon-decay Ws as well const WFinder wf(-MAXRAPIDITY, MAXRAPIDITY, 0.0*GeV, ELECTRON, 30.0*GeV, 110.0*GeV, 0.2); addProjection(wf, "WF"); FastJets fastjets(wf.remainingFinalState(), FastJets::KT, 0.7); Modified: trunk/src/Analyses/MC/MC_LHC_ZANALYSIS.cc ============================================================================== --- trunk/src/Analyses/MC/MC_LHC_ZANALYSIS.cc Tue Sep 1 23:41:22 2009 (r1801) +++ trunk/src/Analyses/MC/MC_LHC_ZANALYSIS.cc Wed Sep 2 09:03:31 2009 (r1802) @@ -18,6 +18,7 @@ { const ChargedFinalState cfs; addProjection(cfs, "CFS"); + /// @todo Handle muon-decay Zs as well const ZFinder zf(-MAXRAPIDITY, MAXRAPIDITY, 0.0*GeV, ELECTRON, 30.0*GeV, 115.0*GeV, 0.2); addProjection(zf, "ZF"); FastJets fastjets(zf.remainingFinalState(), FastJets::KT, 0.7); Modified: trunk/src/Projections/WFinder.cc ============================================================================== --- trunk/src/Projections/WFinder.cc Tue Sep 1 23:41:22 2009 (r1801) +++ trunk/src/Projections/WFinder.cc Wed Sep 2 09:03:31 2009 (r1802) @@ -3,6 +3,7 @@ #include "Rivet/Projections/InvMassFinalState.hh" #include "Rivet/Projections/ClusteredPhotons.hh" #include "Rivet/Projections/VetoedFinalState.hh" +#include "Rivet/Tools/ParticleIDMethods.hh" #include "Rivet/Tools/Logging.hh" #include "Rivet/Cmp.hh" @@ -105,20 +106,29 @@ const FinalState& imfs = applyProjection<FinalState>(e, "IMFS"); if (imfs.particles().size() != 2) return; + FourMomentum pW = imfs.particles()[0].momentum() + imfs.particles()[1].momentum(); + const int w3charge = PID::threeCharge(imfs.particles()[0].pdgId()) + PID::threeCharge(imfs.particles()[1].pdgId()); + assert(abs(w3charge) == 3); + const int wcharge = sign(w3charge); + /// @todo Provide W charge method + + stringstream msg; + string wsign = (wcharge == 1) ? "+" : "-"; + string wstr = "W" + wsign; + msg << wstr << " reconstructed from: " << endl + << " " << imfs.particles()[0].momentum() << " " << imfs.particles()[0].pdgId() << endl + << " + " << imfs.particles()[1].momentum() << " " << imfs.particles()[1].pdgId() << endl; + // Add in clustered photons const FinalState& photons = applyProjection<FinalState>(e, "CPhotons"); - - getLog() << Log::DEBUG << "Z reconstructed out of: " << endl - << " " << imfs.particles()[0].momentum() << " " << imfs.particles()[0].pdgId() << endl - << " +" << imfs.particles()[1].momentum() << " " << imfs.particles()[1].pdgId() << endl; - - Particle W; - FourMomentum pW = imfs.particles()[0].momentum() + imfs.particles()[1].momentum(); foreach (const Particle& photon, photons.particles()) { - getLog() << Log::DEBUG << " + " << photon.momentum() << " " << photon.pdgId() << endl; + msg << " + " << photon.momentum() << " " << photon.pdgId() << endl; pW += photon.momentum(); } - getLog() << Log::DEBUG << " = " << W.momentum() << endl; + msg << " = " << pW; + getLog() << Log::DEBUG << msg.str() << endl; + + Particle W; W.setMomentum(pW); _theParticles.push_back(W); Modified: trunk/src/Projections/ZFinder.cc ============================================================================== --- trunk/src/Projections/ZFinder.cc Tue Sep 1 23:41:22 2009 (r1801) +++ trunk/src/Projections/ZFinder.cc Wed Sep 2 09:03:31 2009 (r1802) @@ -3,6 +3,7 @@ #include "Rivet/Projections/InvMassFinalState.hh" #include "Rivet/Projections/ClusteredPhotons.hh" #include "Rivet/Projections/VetoedFinalState.hh" +#include "Rivet/Tools/ParticleIDMethods.hh" #include "Rivet/Tools/Logging.hh" #include "Rivet/Cmp.hh" @@ -98,22 +99,26 @@ const FinalState& imfs=applyProjection<FinalState>(e, "IMFS"); if (imfs.particles().size() != 2) return; + FourMomentum pZ = imfs.particles()[0].momentum() + imfs.particles()[1].momentum(); + const int z3charge = PID::threeCharge(imfs.particles()[0].pdgId()) + PID::threeCharge(imfs.particles()[1].pdgId()); + assert(z3charge == 0); - const FinalState& photons=applyProjection<FinalState>(e, "CPhotons"); - - getLog() << Log::DEBUG << "Z reconstructed out of: " << endl - << " " << imfs.particles()[0].momentum() << " " << imfs.particles()[0].pdgId() << endl - << " +" << imfs.particles()[1].momentum() << " " << imfs.particles()[1].pdgId() << endl; + stringstream msg; + msg << "Z reconstructed from: " << endl + << " " << imfs.particles()[0].momentum() << " " << imfs.particles()[0].pdgId() << endl + << " + " << imfs.particles()[1].momentum() << " " << imfs.particles()[1].pdgId() << endl; - Particle Z; - FourMomentum pZ = imfs.particles()[0].momentum() + imfs.particles()[1].momentum(); + // Add in clustered photons + const FinalState& photons = applyProjection<FinalState>(e, "CPhotons"); foreach (const Particle& photon, photons.particles()) { - getLog() << Log::DEBUG << " +" << photon.momentum() << " " << photon.pdgId() << endl; + msg << " + " << photon.momentum() << " " << photon.pdgId() << endl; pZ += photon.momentum(); } - getLog() << Log::DEBUG << " =" << Z.momentum() << endl; - Z.setMomentum(pZ); + msg << " = " << pZ; + getLog() << Log::DEBUG << msg.str() << endl; + Particle Z; + Z.setMomentum(pZ); _theParticles.push_back(Z); getLog() << Log::DEBUG << name() << " found " << _theParticles.size() << " particles." << endl;
More information about the Rivet-svn mailing list |