KtJets.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 #include "Rivet/Tools/Logging.hh"
00004 #include "Rivet/Projections/KtJets.hh"
00005 #include "Rivet/Cmp.hh"
00006 
00007 namespace Rivet {
00008 
00009 
00010   int KtJets::compare(const Projection& p) const {
00011     const KtJets& other = dynamic_cast<const KtJets&>(p);
00012     return \
00013       mkNamedPCmp(other "FS") ||
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     // Project into final state
00023     const FinalState& fs = applyProjection<FinalState>(e, "FS");
00024 
00025     // Store 4 vector data about each particle into vecs
00026     vector<KtJet::KtLorentzVector> vecs;
00027     for (ParticleVector::const_iterator p = fs.particles().begin(); p != fs.particles().end(); ++p) {
00028       HepMC::FourVector fv = p->momentum();
00029       // Store the FourVector in the KtLorentzVector form
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     if (iter == _yscales.end()) {
00041       KtJet::KtEvent subj = KtJet::KtEvent(jet, _angle, _recom);
00042       vector<double> yMergeVals;
00043       for (int i=1; i<5; ++i) {
00044         if (subj.getNConstituents() > i){
00045           yMergeVals.push_back(subj.getYMerge(i));
00046         }
00047       }
00048       _yscales.insert(make_pair( jet.getID(), yMergeVals ));
00049       return yMergeVals;
00050     } else {
00051       // This was cached.
00052       return iter->second;
00053     }
00054 
00055   }
00056 
00057 
00058 }