LeptonClusters.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Projections/LeptonClusters.hh" 00003 #include "Rivet/Tools/Logging.hh" 00004 #include "Rivet/Tools/ParticleIdUtils.hh" 00005 #include "Rivet/Cmp.hh" 00006 00007 namespace Rivet { 00008 00009 00010 LeptonClusters::LeptonClusters(const FinalState& photons, const FinalState& signal, 00011 double dRmax, bool cluster, 00012 const std::vector<std::pair<double, double> >& etaRanges, 00013 double pTmin) : 00014 FinalState(etaRanges, pTmin), 00015 _dRmax(dRmax), _cluster(cluster) 00016 { 00017 setName("LeptonClusters"); 00018 00019 IdentifiedFinalState photonfs(photons); 00020 photonfs.acceptId(PHOTON); 00021 addProjection(photonfs, "Photons"); 00022 addProjection(signal, "Signal"); 00023 } 00024 00025 00026 int LeptonClusters::compare(const Projection& p) const { 00027 // Compare the two as final states (for pT and eta cuts) 00028 const LeptonClusters& other = dynamic_cast<const LeptonClusters&>(p); 00029 int fscmp = FinalState::compare(other); 00030 if (fscmp != EQUIVALENT) return fscmp; 00031 00032 const PCmp phcmp = mkNamedPCmp(p, "Photons"); 00033 if (phcmp != EQUIVALENT) return phcmp; 00034 00035 const PCmp sigcmp = mkNamedPCmp(p, "Signal"); 00036 if (sigcmp != EQUIVALENT) return sigcmp; 00037 00038 return (cmp(_dRmax, other._dRmax) || cmp(_cluster, other._cluster)); 00039 } 00040 00041 00042 void LeptonClusters::project(const Event& e) { 00043 _theParticles.clear(); 00044 _clusteredLeptons.clear(); 00045 00046 const FinalState& signal = applyProjection<FinalState>(e, "Signal"); 00047 ParticleVector bareleptons = signal.particles(); 00048 if (bareleptons.empty()) return; 00049 00050 vector<ClusteredLepton> allClusteredLeptons; 00051 for (size_t i = 0; i < bareleptons.size(); ++i) { 00052 allClusteredLeptons.push_back(ClusteredLepton(bareleptons[i])); 00053 } 00054 00055 const FinalState& photons = applyProjection<FinalState>(e, "Photons"); 00056 foreach (const Particle& photon, photons.particles()) { 00057 const FourMomentum p_P = photon.momentum(); 00058 double dRmin=_dRmax; 00059 int idx = -1; 00060 for (size_t i = 0; i < bareleptons.size(); ++i) { 00061 FourMomentum p_l = bareleptons[i].momentum(); 00062 // Only cluster photons around *charged* signal particles 00063 if (PID::threeCharge(bareleptons[i].pdgId()) == 0) continue; 00064 // Geometrically match momentum vectors 00065 double dR=deltaR(p_l, p_P); 00066 if (dR < dRmin) { 00067 dRmin=dR; 00068 idx = i; 00069 } 00070 } 00071 if (idx > -1) { 00072 if (_cluster) allClusteredLeptons[idx].addPhoton(photon, _cluster); 00073 } 00074 } 00075 00076 foreach (const ClusteredLepton& lepton, allClusteredLeptons) { 00077 if (accept(lepton)) { 00078 _clusteredLeptons.push_back(lepton); 00079 _theParticles.push_back(lepton.constituentLepton()); 00080 _theParticles.insert(_theParticles.end(), 00081 lepton.constituentPhotons().begin(), 00082 lepton.constituentPhotons().end()); 00083 } 00084 } 00085 } 00086 } Generated on Fri Dec 21 2012 15:03:41 for The Rivet MC analysis system by ![]() |