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