1 #ifndef TtJetPartonMatch_h
2 #define TtJetPartonMatch_h
88 partons_ (cfg.getParameter<std::vector<std::
string> >(
"partonsToIgnore")),
91 maxNJets_ (cfg.getParameter<int> (
"maxNJets" )),
92 maxNComb_ (cfg.getParameter<int> (
"maxNComb" )),
93 algorithm_ (readAlgorithm(cfg.getParameter<std::
string>(
"algorithm" ))),
94 useDeltaR_ (cfg.getParameter<bool> (
"useDeltaR" )),
95 useMaxDist_(cfg.getParameter<bool> (
"useMaxDist" )),
96 maxDist_ (cfg.getParameter<double> (
"maxDist" )),
97 verbosity_ (cfg.getParameter<int> (
"verbosity" ))
104 produces<std::vector<std::vector<int> > >();
105 produces<std::vector<double> >(
"SumPt");
106 produces<std::vector<double> >(
"SumDR");
107 produces<int>(
"NumberOfConsideredJets");
124 std::unique_ptr<std::vector<std::vector<int> > >
match(
new std::vector<std::vector<int> >);
125 std::unique_ptr<std::vector<double> > sumPt(
new std::vector<double>);
126 std::unique_ptr<std::vector<double> > sumDR(
new std::vector<double>);
127 std::unique_ptr<int> pJetsConsidered(
new int);
140 std::vector<const reco::Candidate*> partons = partons_.vec(*genEvt);
143 std::vector<const reco::Candidate*>
jets;
144 for(
unsigned int ij=0; ij<topJets->size(); ++ij) {
150 if(maxNJets_>=(
int)partons.size()) {
151 if((
int)ij==maxNJets_)
break;
154 if(ij==partons.size())
break;
159 *pJetsConsidered = jets.size();
162 JetPartonMatching jetPartonMatch(partons, jets, algorithm_, useMaxDist_, useDeltaR_, maxDist_);
167 jetPartonMatch.
print();
170 if((
int)ic>=maxNComb_ && maxNComb_>=0)
break;
172 partons_.expand(matches);
173 match->push_back( matches );
180 evt.
put(
std::move(pJetsConsidered),
"NumberOfConsideredJets");
192 <<
"Chosen algorithm is not supported: " << str <<
"\n";
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< TtGenEvent > genEvt_
TtGenEvent collection input.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
unsigned int getNumberOfAvailableCombinations()
Class derived from the TopGenEvent for ttbar events.
JetPartonMatching::algorithms readAlgorithm(const std::string &str)
convert string for algorithm into corresponding enumerator type
std::vector< int > getMatchesForPartons(const unsigned int comb=0)
bool useDeltaR_
switch to choose between deltaR/deltaTheta matching
JetPartonMatching::algorithms algorithm_
choice of algorithm
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
jet collection input
int verbosity_
verbosity level
double getSumDeltaR(const unsigned int comb=0)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
TtJetPartonMatch(const edm::ParameterSet &)
default conructor
genEvt_(cfg.getParameter< edm::InputTag >("genEvent"))
~TtJetPartonMatch()
default destructor
double getSumDeltaPt(const unsigned int comb=0)
virtual void produce(edm::Event &, const edm::EventSetup &)
write jet parton match objects into the event