rivet is hosted by Hepforge, IPPP Durham
ClusteredPhotons.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Projections/ClusteredPhotons.hh"
00003 
00004 namespace Rivet {
00005 
00006 
00007   int ClusteredPhotons::compare(const Projection& p) const {
00008     const PCmp fscmp = mkNamedPCmp(p, "Photons");
00009     if (fscmp != EQUIVALENT) return fscmp;
00010 
00011     const PCmp sigcmp = mkNamedPCmp(p, "Signal");
00012     if (sigcmp != EQUIVALENT) return sigcmp;
00013 
00014     const ClusteredPhotons& other = dynamic_cast<const ClusteredPhotons&>(p);
00015     int rcmp = cmp(_dRmax, other._dRmax);
00016     return rcmp;
00017   }
00018 
00019 
00020   void ClusteredPhotons::project(const Event& e) {
00021     _theParticles.clear();
00022     if (!_dRmax > 0.0) return;
00023 
00024     const FinalState& photons = applyProjection<FinalState>(e, "Photons");
00025     const FinalState& signal = applyProjection<FinalState>(e, "Signal");
00026 
00027     foreach (const Particle& p, photons.particles()) {
00028       bool clustered = false;
00029       foreach (const Particle& l, signal.particles()) {
00030         // Only cluster photons around *charged* signal particles
00031         if (PID::threeCharge(l.pdgId()) == 0) continue;
00032         // Geometrically match momentum vectors
00033         const FourMomentum p_l = l.momentum();
00034         const FourMomentum p_P = p.momentum();
00035         if (deltaR(p_l.pseudorapidity(), p_l.azimuthalAngle(),
00036                    p_P.pseudorapidity(), p_P.azimuthalAngle()) < _dRmax) {
00037           clustered = true;
00038         }
00039       }
00040       if (clustered) _theParticles.push_back(p);
00041     }
00042     MSG_DEBUG(name() << " found " << _theParticles.size() << " matching photons.");
00043   }
00044 
00045 }