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/LeptonClusters.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& inputfs, 00014 double etaMin, double etaMax, 00015 double pTmin, 00016 PdgId pid, 00017 double minmass, double maxmass, 00018 double dRmax, bool clusterPhotons, bool trackPhotons, 00019 double masstarget) { 00020 vector<pair<double, double> > etaRanges; 00021 etaRanges += std::make_pair(etaMin, etaMax); 00022 _init(inputfs, etaRanges, pTmin, pid, minmass, maxmass, dRmax, clusterPhotons, trackPhotons, masstarget); 00023 } 00024 00025 00026 ZFinder::ZFinder(const FinalState& inputfs, 00027 const std::vector<std::pair<double, double> >& etaRanges, 00028 double pTmin, 00029 PdgId pid, 00030 double minmass, const double maxmass, 00031 double dRmax, bool clusterPhotons, bool trackPhotons, 00032 double masstarget) { 00033 _init(inputfs, etaRanges, pTmin, pid, minmass, maxmass, dRmax, clusterPhotons, trackPhotons, masstarget); 00034 } 00035 00036 00037 ZFinder::ZFinder(double etaMin, double etaMax, 00038 double pTmin, 00039 PdgId pid, 00040 double minmass, double maxmass, 00041 double dRmax, bool clusterPhotons, bool trackPhotons, 00042 double masstarget) { 00043 vector<pair<double, double> > etaRanges; 00044 etaRanges += std::make_pair(etaMin, etaMax); 00045 FinalState inputfs; 00046 _init(inputfs, etaRanges, pTmin, pid, minmass, maxmass, dRmax, clusterPhotons, trackPhotons, masstarget); 00047 } 00048 00049 00050 ZFinder::ZFinder(const std::vector<std::pair<double, double> >& etaRanges, 00051 double pTmin, 00052 PdgId pid, 00053 double minmass, const double maxmass, 00054 double dRmax, bool clusterPhotons, bool trackPhotons, 00055 double masstarget) { 00056 FinalState inputfs; 00057 _init(inputfs, etaRanges, pTmin, pid, minmass, maxmass, dRmax, clusterPhotons, trackPhotons, masstarget); 00058 } 00059 void ZFinder::_init(const FinalState& inputfs, 00060 const std::vector<std::pair<double, double> >& etaRanges, 00061 double pTmin, PdgId pid, 00062 double minmass, double maxmass, 00063 double dRmax, bool clusterPhotons, bool trackPhotons, 00064 double masstarget) 00065 { 00066 setName("ZFinder"); 00067 00068 _minmass = minmass; 00069 _maxmass = maxmass; 00070 _masstarget = masstarget; 00071 _pid = pid; 00072 _trackPhotons = trackPhotons; 00073 00074 IdentifiedFinalState bareleptons(inputfs); 00075 bareleptons.acceptIdPair(pid); 00076 LeptonClusters leptons(inputfs, bareleptons, dRmax, 00077 clusterPhotons, 00078 etaRanges, pTmin); 00079 addProjection(leptons, "LeptonClusters"); 00080 00081 VetoedFinalState remainingFS; 00082 remainingFS.addVetoOnThisFinalState(*this); 00083 addProjection(remainingFS, "RFS"); 00084 } 00085 00086 00087 ///////////////////////////////////////////////////// 00088 00089 00090 const FinalState& ZFinder::remainingFinalState() const 00091 { 00092 return getProjection<FinalState>("RFS"); 00093 } 00094 00095 00096 int ZFinder::compare(const Projection& p) const { 00097 PCmp LCcmp = mkNamedPCmp(p, "LeptonClusters"); 00098 if (LCcmp != EQUIVALENT) return LCcmp; 00099 00100 const ZFinder& other = dynamic_cast<const ZFinder&>(p); 00101 return (cmp(_minmass, other._minmass) || cmp(_maxmass, other._maxmass) || 00102 cmp(_pid, other._pid) || cmp(_trackPhotons, other._trackPhotons)); 00103 } 00104 00105 00106 void ZFinder::project(const Event& e) { 00107 clear(); 00108 00109 const LeptonClusters& leptons = applyProjection<LeptonClusters>(e, "LeptonClusters"); 00110 00111 InvMassFinalState imfs(std::make_pair(_pid, -_pid), _minmass, _maxmass, _masstarget); 00112 ParticleVector tmp; 00113 tmp.insert(tmp.end(), leptons.clusteredLeptons().begin(), leptons.clusteredLeptons().end()); 00114 imfs.calc(tmp); 00115 00116 if (imfs.particlePairs().size() < 1) return; 00117 ParticlePair Zconstituents(imfs.particlePairs()[0]); 00118 Particle l1(Zconstituents.first), l2(Zconstituents.second); 00119 _constituents += l1, l2; 00120 FourMomentum pZ = l1.momentum() + l2.momentum(); 00121 const int z3charge = PID::threeCharge(l1.pdgId()) + PID::threeCharge(l2.pdgId()); 00122 assert(z3charge == 0); 00123 00124 stringstream msg; 00125 msg << "Z reconstructed from: \n" 00126 << " " << l1.momentum() << " " << l1.pdgId() << "\n" 00127 << " + " << l2.momentum() << " " << l2.pdgId(); 00128 MSG_DEBUG(msg.str()); 00129 _bosons.push_back(Particle(ZBOSON, pZ)); 00130 00131 // Find the LeptonClusters which survived the IMFS cut such that we can 00132 // extract their original particles 00133 foreach (const Particle& p, _constituents) { 00134 foreach (const ClusteredLepton& l, leptons.clusteredLeptons()) { 00135 if (p.pdgId()==l.pdgId() && p.momentum()==l.momentum()) { 00136 _theParticles.push_back(l.constituentLepton()); 00137 if (_trackPhotons) { 00138 _theParticles.insert(_theParticles.end(), 00139 l.constituentPhotons().begin(), 00140 l.constituentPhotons().end()); 00141 } 00142 } 00143 } 00144 } 00145 } 00146 00147 00148 } Generated on Fri Dec 21 2012 15:03:42 for The Rivet MC analysis system by ![]() |