00001
00002
00003 #include "Rivet/Tools/Logging.hh"
00004 #include "Rivet/Projections/KtJets.hh"
00005 #include "Rivet/Cmp.hh"
00006
00007
00008 namespace Rivet {
00009
00010 int KtJets::compare(const Projection& p) const {
00011 const KtJets& other = dynamic_cast<const KtJets&>(p);
00012 return \
00013 pcmp(*_fsproj, *other._fsproj) ||
00014 cmp(_type, other._type) ||
00015 cmp(_angle, other._angle) ||
00016 cmp(_recom, other._recom) ||
00017 cmp(_rparameter, other._rparameter);
00018 }
00019
00020
00021 void KtJets::project(const Event& e) {
00022
00023 const FinalState& fs = e.applyProjection(*_fsproj);
00024
00025
00026 vector<KtJet::KtLorentzVector> vecs;
00027 for (ParticleVector::const_iterator p = fs.particles().begin(); p != fs.particles().end(); ++p) {
00028 HepMC::FourVector fv = p->getMomentum();
00029
00030 KtJet::KtLorentzVector ktlv(fv.px(), fv.py(), fv.pz(), fv.e());
00031 vecs.push_back(ktlv);
00032 }
00033 if (_pktev) delete _pktev;
00034 _pktev = new KtJet::KtEvent(vecs, _type, _angle, _recom, _rparameter);
00035 }
00036
00037
00038 vector<double> KtJets::getYSubJet(const KtJet::KtLorentzVector& jet) const {
00039 map<int,vector<double> >::iterator iter = _yscales.find(jet.getID());
00040
00041 if (iter == _yscales.end()) {
00042 KtJet::KtEvent subj = KtJet::KtEvent(jet, _angle, _recom);
00043 vector<double> yMergeVals;
00044 for (int i=1; i<5; ++i) {
00045 if (subj.getNConstituents()>i){
00046 yMergeVals.push_back(subj.getYMerge(i));
00047 }
00048 }
00049 _yscales.insert(make_pair( jet.getID(), yMergeVals ));
00050 return yMergeVals;
00051 } else {
00052
00053 return iter->second;
00054 }
00055
00056 }
00057
00058
00059 }