3 #include "Math/VectorUtil.h"
10 jets_ (cfg.getParameter<edm::InputTag>(
"jets" )),
11 leps_ (cfg.getParameter<edm::InputTag>(
"leps" )),
12 maxNJets_ (cfg.getParameter<int> (
"maxNJets" )),
13 useDeltaR_ (cfg.getParameter<bool> (
"useDeltaR" )),
14 useBTagging_ (cfg.getParameter<bool> (
"useBTagging" )),
15 bTagAlgorithm_ (cfg.getParameter<std::string> (
"bTagAlgorithm" )),
16 minBDiscBJets_ (cfg.getParameter<double> (
"minBDiscBJets" )),
17 maxBDiscLightJets_(cfg.getParameter<double> (
"maxBDiscLightJets"))
21 <<
"Parameter maxNJets can not be set to " <<
maxNJets_ <<
". \n"
22 <<
"It has to be larger than 4 or can be set to -1 to take all jets.";
24 produces< std::vector<std::vector<int> > >();
34 std::auto_ptr< std::vector<std::vector<int> > >pOut (
new std::vector<std::vector<int> >);
36 std::vector<int>
match;
37 for(
unsigned int i = 0;
i < 4; ++
i)
38 match.push_back( -1 );
49 if(leps->empty() || jets->size() < 4){
50 pOut->push_back( match );
58 std::vector<bool> isBJet;
59 std::vector<bool> isLJet;
62 for(
unsigned int idx=0; idx<maxNJets; ++idx) {
76 for(
unsigned int idx=0; idx<maxNJets; ++idx){
77 if(
useBTagging_ && (!isLJet[idx] || (cntBJets<=2 && isBJet[idx])))
continue;
78 for(
unsigned int jdx=(idx+1); jdx<maxNJets; ++jdx){
79 if(
useBTagging_ && (!isLJet[jdx] || (cntBJets<=2 && isBJet[jdx]) || (cntBJets==3 && isBJet[idx] && isBJet[jdx])))
continue;
80 double dist =
distance((*jets)[idx].
p4(), (*jets)[jdx].
p4());
81 if( minDist<0. || dist<minDist ){
91 wHad = (*jets)[lightQ].p4() + (*jets)[lightQBar].p4();
100 for(
unsigned int idx=0; idx<maxNJets; ++idx){
103 if( (
int)idx!=lightQ && (
int)idx!=lightQBar ) {
104 double dist =
distance((*jets)[idx].
p4(), wHad);
105 if( minDist<0. || dist<minDist ){
119 for(
unsigned int idx=0; idx<maxNJets; ++idx){
122 if( (
int)idx!=lightQ && (
int)idx!=lightQBar && (
int)idx!=hadB ){
123 double dist =
distance((*jets)[idx].
p4(), (*leps)[0].
p4());
124 if( minDist<0. || dist<minDist ){
136 pOut->push_back( match );
145 if(
useDeltaR_)
return ROOT::Math::VectorUtil::DeltaR(v1, v2);
146 return fabs(v1.theta() - v2.theta());
double maxBDiscLightJets_
bool isValid(const int &idx, const edm::Handle< std::vector< pat::Jet > > &jets)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
virtual void produce(edm::Event &evt, const edm::EventSetup &setup)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
TtSemiLepJetCombGeom(const edm::ParameterSet &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double distance(const math::XYZTLorentzVector &, const math::XYZTLorentzVector &)
std::string bTagAlgorithm_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
math::XYZTLorentzVector LorentzVector
Lorentz vector.