#include <JetMatchingMLM.h>
Public Member Functions | |
JetMatchingMLM (const edm::ParameterSet ¶ms) | |
~JetMatchingMLM () | |
Private Types | |
enum | MatchMode { kExclusive = 0, kInclusive } |
Private Member Functions | |
std::set< std::string > | capabilities () const |
double | match (const HepMC::GenEvent *partonLevel, const HepMC::GenEvent *finalState, bool showeredFinalState) |
Private Attributes | |
std::auto_ptr< JetClustering > | jetClustering |
std::auto_ptr< JetInput > | jetInput |
MatchMode | matchMode |
double | matchPtFraction |
const double | maxDeltaR |
double | maxEta |
const double | minJetPt |
std::auto_ptr< JetInput > | partonInput |
bool | useEt |
Definition at line 19 of file JetMatchingMLM.h.
enum lhef::JetMatchingMLM::MatchMode [private] |
Definition at line 31 of file JetMatchingMLM.h.
{ kExclusive = 0, kInclusive };
lhef::JetMatchingMLM::JetMatchingMLM | ( | const edm::ParameterSet & | params | ) |
Definition at line 67 of file JetMatchingMLM.cc.
References Exception, edm::ParameterSet::exists(), and edm::ParameterSet::getParameter().
{ partonInput->setPartonicFinalState(false); partonInput->setHardProcessOnly(false); if (params.exists("matchPtFraction")) matchPtFraction = params.getParameter<double>("matchPtFraction"); jetClustering.reset( new JetClustering(params, minJetPt * matchPtFraction)); std::string matchMode = params.getParameter<std::string>("matchMode"); if (matchMode == "inclusive") this->matchMode = kInclusive; else if (matchMode == "exclusive") this->matchMode = kExclusive; else throw cms::Exception("Configuration") << "Invalid matching mode '" << matchMode << "' specified." << std::endl; }
lhef::JetMatchingMLM::~JetMatchingMLM | ( | ) |
Definition at line 98 of file JetMatchingMLM.cc.
{ }
std::set< std::string > lhef::JetMatchingMLM::capabilities | ( | ) | const [private, virtual] |
Reimplemented from lhef::JetMatching.
Definition at line 102 of file JetMatchingMLM.cc.
References lhef::JetMatching::capabilities(), and query::result.
{ std::set<std::string> result = JetMatching::capabilities(); result.insert("matchSummary"); return result; }
double lhef::JetMatchingMLM::match | ( | const HepMC::GenEvent * | partonLevel, |
const HepMC::GenEvent * | finalState, | ||
bool | showeredFinalState | ||
) | [private, virtual] |
Implements lhef::JetMatching.
Definition at line 112 of file JetMatchingMLM.cc.
References abs, trackerHits::c, lhef::cc::convert(), gather_cfg::cout, eta(), i, analyzePatCleaning_cfg::jets, MultipleCompare::Match(), maxEta, lhef::JetClustering::Jet::pt(), and python::multivaluedict::sort().
{ JetInput::ParticleVector partons = (*partonInput)(partonLevel); std::sort(partons.begin(), partons.end(), ParticlePtGreater()); JetInput::ParticleVector jetInput = showeredFinalState ? (*partonInput)(finalState) : (*this->jetInput)(finalState); std::sort(jetInput.begin(), jetInput.end(), ParticlePtGreater()); std::vector<JetClustering::Jet> jets = (*jetClustering)(jetInput); #ifdef DEBUG std::cout << "===== Partons:" << std::endl; for(JetClustering::ParticleVector::const_iterator c = partons.begin(); c != partons.end(); c++) std::cout << "\tpid = " << (*c)->pdg_id() << ", pt = " << (*c)->momentum().perp() << ", eta = " << (*c)->momentum().eta() << ", phi = " << (*c)->momentum().phi() << std::endl; std::cout << "===== JetInput:" << std::endl; for(JetClustering::ParticleVector::const_iterator c = jetInput.begin(); c != jetInput.end(); c++) std::cout << "\tpid = " << (*c)->pdg_id() << ", pt = " << (*c)->momentum().perp() << ", eta = " << (*c)->momentum().eta() << ", phi = " << (*c)->momentum().phi() << std::endl; std::cout << "----- " << jets.size() << " jets:" << std::endl; for(std::vector<JetClustering::Jet>::const_iterator iter = jets.begin(); iter != jets.end(); ++iter) { std::cout << "* pt = " << iter->pt() << ", eta = " << iter->eta() << ", phi = " << iter->phi() << std::endl; for(JetClustering::ParticleVector::const_iterator c = iter->constituents().begin(); c != iter->constituents().end(); c++) std::cout << "\tpid = " << (*c)->pdg_id() << ", pt = " << (*c)->momentum().perp() << ", eta = " << (*c)->momentum().eta() << ", phi = " << (*c)->momentum().phi() << std::endl; } using boost::bind; std::cout << partons.size() << " partons and " << std::count_if(jets.begin(), jets.end(), bind(std::greater<double>(), bind(&JetClustering::Jet::pt, _1), minJetPt)) << " jets." << std::endl; #endif Matching<double> matching(partons, jets, DeltaRSeparation<JetInput::ParticleVector::value_type, JetClustering::Jet, double>()); typedef Matching<double>::Match Match; std::vector<Match> matches = matching.match( std::less<double>(), std::bind2nd(std::less<double>(), maxDeltaR)); #ifdef DEBUG for(std::vector<Match>::const_iterator iter = matches.begin(); iter != matches.end(); ++iter) std::cout << "\tParton " << iter->index1 << " matches jet " << iter->index2 << " with a Delta_R of " << matching.delta(*iter) << std::endl; #endif unsigned int unmatchedPartons = 0; unsigned int unmatchedJets = 0; matchSummary.clear(); for(std::vector<Match>::const_iterator iter = matches.begin(); iter != matches.end(); ++iter) { if ((useEt ? jets[iter->index2].et() : jets[iter->index2].pt()) < minJetPt || std::abs(jets[iter->index2].eta()) > maxEta) unmatchedPartons++; matchSummary.push_back( JetPartonMatch(partons[iter->index1]->momentum(), convert(jets[iter->index2]), matching.delta(*iter), partons[iter->index1]->pdg_id())); } for(Matching<double>::index_type i = 0; i < partons.size(); i++) { if (!matching.isMatched1st(i)) { unmatchedPartons++; matchSummary.push_back( JetPartonMatch(partons[i]->momentum(), partons[i]->pdg_id())); } } for(Matching<double>::index_type i = 0; i < jets.size(); i++) { if (!matching.isMatched2nd(i)) { if ((useEt ? jets[i].et() : jets[i].pt()) >= minJetPt && std::abs(jets[i].eta()) <= maxEta) unmatchedJets++; matchSummary.push_back( JetPartonMatch(convert(jets[i]))); } } switch(matchMode) { case kExclusive: if (!unmatchedJets && !unmatchedPartons) return 1.0; break; case kInclusive: if (!unmatchedPartons) return 1.0; } return 0.0; }
std::auto_ptr<JetClustering> lhef::JetMatchingMLM::jetClustering [private] |
Definition at line 45 of file JetMatchingMLM.h.
std::auto_ptr<JetInput> lhef::JetMatchingMLM::jetInput [private] |
Definition at line 44 of file JetMatchingMLM.h.
MatchMode lhef::JetMatchingMLM::matchMode [private] |
Definition at line 41 of file JetMatchingMLM.h.
double lhef::JetMatchingMLM::matchPtFraction [private] |
Definition at line 39 of file JetMatchingMLM.h.
const double lhef::JetMatchingMLM::maxDeltaR [private] |
Definition at line 36 of file JetMatchingMLM.h.
double lhef::JetMatchingMLM::maxEta [private] |
Definition at line 38 of file JetMatchingMLM.h.
const double lhef::JetMatchingMLM::minJetPt [private] |
Definition at line 37 of file JetMatchingMLM.h.
std::auto_ptr<JetInput> lhef::JetMatchingMLM::partonInput [private] |
Definition at line 43 of file JetMatchingMLM.h.
bool lhef::JetMatchingMLM::useEt [private] |
Definition at line 40 of file JetMatchingMLM.h.