#include <TtJetPartonMatch.h>
Public Member Functions | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
write jet parton match objects into the event | |
TtJetPartonMatch (const edm::ParameterSet &) | |
default conructor | |
~TtJetPartonMatch () | |
default destructor | |
Private Member Functions | |
JetPartonMatching::algorithms | readAlgorithm (const std::string &str) |
convert string for algorithm into corresponding enumerator type | |
Private Attributes | |
JetPartonMatching::algorithms | algorithm_ |
choice of algorithm | |
edm::InputTag | jets_ |
jet collection input | |
double | maxDist_ |
int | maxNComb_ |
int | maxNJets_ |
C | partons_ |
partons | |
bool | useDeltaR_ |
switch to choose between deltaR/deltaTheta matching | |
bool | useMaxDist_ |
int | verbosity_ |
verbosity level |
Definition at line 44 of file TtJetPartonMatch.h.
TtJetPartonMatch< C >::TtJetPartonMatch | ( | const edm::ParameterSet & | cfg | ) | [explicit] |
default conructor
Definition at line 85 of file TtJetPartonMatch.h.
: partons_ (cfg.getParameter<std::vector<std::string> >("partonsToIgnore")), jets_ (cfg.getParameter<edm::InputTag> ("jets" )), maxNJets_ (cfg.getParameter<int> ("maxNJets" )), maxNComb_ (cfg.getParameter<int> ("maxNComb" )), algorithm_ (readAlgorithm(cfg.getParameter<std::string>("algorithm" ))), useDeltaR_ (cfg.getParameter<bool> ("useDeltaR" )), useMaxDist_(cfg.getParameter<bool> ("useMaxDist" )), maxDist_ (cfg.getParameter<double> ("maxDist" )), verbosity_ (cfg.getParameter<int> ("verbosity" )) { // produces a vector of jet/lepton indices in the order of // * TtSemiLepEvtPartons // * TtFullHadEvtPartons // * TtFullLepEvtPartons // and vectors of the corresponding quality parameters produces< std::vector<std::vector<int> > >(); produces< std::vector<double> >("SumPt"); produces< std::vector<double> >("SumDR"); }
TtJetPartonMatch< C >::~TtJetPartonMatch | ( | ) |
void TtJetPartonMatch< C >::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | setup | ||
) | [virtual] |
write jet parton match objects into the event
Implements edm::EDProducer.
Definition at line 113 of file TtJetPartonMatch.h.
References TtGenEvtProducer_cfi::genEvt, edm::Event::getByLabel(), JetPartonMatching::getMatchesForPartons(), JetPartonMatching::getNumberOfAvailableCombinations(), JetPartonMatching::getSumDeltaPt(), JetPartonMatching::getSumDeltaR(), analyzePatCleaning_cfg::jets, match(), JetPartonMatching::print(), and edm::Event::put().
{ edm::Handle<TtGenEvent> genEvt; evt.getByLabel("genEvt", genEvt); edm::Handle<edm::View<reco::Jet> > topJets; evt.getByLabel(jets_, topJets); // fill vector of partons in the order of // * TtFullLepEvtPartons // * TtSemiLepEvtPartons // * TtFullHadEvtPartons std::vector<const reco::Candidate*> partons = partons_.vec(*genEvt); // prepare vector of jets std::vector<const reco::Candidate*> jets; for(unsigned int ij=0; ij<topJets->size(); ++ij) { // take all jets if maxNJets_ == -1; otherwise use // maxNJets_ if maxNJets_ is big enough or use same // number of jets as partons if maxNJets_ < number // of partons if(maxNJets_!=-1) { if(maxNJets_>=(int)partons.size()) { if((int)ij==maxNJets_) break; } else { if(ij==partons.size()) break; } } jets.push_back( (const reco::Candidate*) &(*topJets)[ij] ); } // do the matching with specified parameters JetPartonMatching jetPartonMatch(partons, jets, algorithm_, useMaxDist_, useDeltaR_, maxDist_); // print some info for each event // if corresponding verbosity level set if(verbosity_>0) jetPartonMatch.print(); // write // * parton match // * sumPt // * sumDR // to the event std::auto_ptr< std::vector<std::vector<int> > > match(new std::vector<std::vector<int> >); std::auto_ptr< std::vector<double> > sumPt(new std::vector<double>); std::auto_ptr< std::vector<double> > sumDR(new std::vector<double>); for(unsigned int ic=0; ic<jetPartonMatch.getNumberOfAvailableCombinations(); ++ic) { if((int)ic>=maxNComb_ && maxNComb_>=0) break; std::vector<int> matches = jetPartonMatch.getMatchesForPartons(ic); partons_.expand(matches); // insert dummy indices for partons that were chosen to be ignored match->push_back( matches ); sumPt->push_back( jetPartonMatch.getSumDeltaPt(ic) ); sumDR->push_back( jetPartonMatch.getSumDeltaR (ic) ); } evt.put(match); evt.put(sumPt, "SumPt"); evt.put(sumDR, "SumDR"); }
JetPartonMatching::algorithms TtJetPartonMatch< C >::readAlgorithm | ( | const std::string & | str | ) | [private] |
convert string for algorithm into corresponding enumerator type
Definition at line 177 of file TtJetPartonMatch.h.
References Exception, JetPartonMatching::minSumDist, JetPartonMatching::ptOrderedMinDist, JetPartonMatching::totalMinDist, and JetPartonMatching::unambiguousOnly.
{ if (str == "totalMinDist" ) return JetPartonMatching::totalMinDist; else if(str == "minSumDist" ) return JetPartonMatching::minSumDist; else if(str == "ptOrderedMinDist") return JetPartonMatching::ptOrderedMinDist; else if(str == "unambiguousOnly" ) return JetPartonMatching::unambiguousOnly; else throw cms::Exception("Configuration") << "Chosen algorithm is not supported: " << str << "\n"; }
JetPartonMatching::algorithms TtJetPartonMatch< C >::algorithm_ [private] |
choice of algorithm
Definition at line 71 of file TtJetPartonMatch.h.
edm::InputTag TtJetPartonMatch< C >::jets_ [private] |
jet collection input
Definition at line 63 of file TtJetPartonMatch.h.
double TtJetPartonMatch< C >::maxDist_ [private] |
threshold for outliers in the case that useMaxDist_ =true
Definition at line 79 of file TtJetPartonMatch.h.
int TtJetPartonMatch< C >::maxNComb_ [private] |
maximal number of combinations for which the matching should be stored
Definition at line 69 of file TtJetPartonMatch.h.
int TtJetPartonMatch< C >::maxNJets_ [private] |
maximal number of jets to be considered for the matching
Definition at line 66 of file TtJetPartonMatch.h.
C TtJetPartonMatch< C >::partons_ [private] |
partons
Definition at line 61 of file TtJetPartonMatch.h.
bool TtJetPartonMatch< C >::useDeltaR_ [private] |
switch to choose between deltaR/deltaTheta matching
Definition at line 73 of file TtJetPartonMatch.h.
bool TtJetPartonMatch< C >::useMaxDist_ [private] |
switch to choose whether an outlier rejection should be applied or not
Definition at line 76 of file TtJetPartonMatch.h.
int TtJetPartonMatch< C >::verbosity_ [private] |
verbosity level
Definition at line 81 of file TtJetPartonMatch.h.