3 #include "Math/VectorUtil.h" 10 jetsToken_ (consumes<
std::vector<
pat::
Jet> >(cfg.getParameter<
edm::InputTag>(
"jets" ))),
11 lepsToken_ (consumes<
edm::
View<
reco::RecoCandidate> >(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> > >();
25 produces<int>(
"NumberOfConsideredJets");
35 std::unique_ptr<std::vector<std::vector<int> > > pOut(
new std::vector<std::vector<int> >);
36 std::unique_ptr<int> pJetsConsidered(
new int);
38 std::vector<int>
match;
39 for(
unsigned int i = 0;
i < 4; ++
i)
40 match.push_back( -1 );
51 if(leps->empty() || jets->size() < 4){
52 pOut->push_back( match );
54 *pJetsConsidered = jets->size();
55 evt.
put(
std::move(pJetsConsidered),
"NumberOfConsideredJets");
62 evt.
put(
std::move(pJetsConsidered),
"NumberOfConsideredJets");
64 std::vector<bool> isBJet;
65 std::vector<bool> isLJet;
84 for(
unsigned int jdx=(idx+1); jdx<
maxNJets; ++jdx){
85 if(
useBTagging_ && (!isLJet[jdx] || (cntBJets<=2 && isBJet[jdx]) || (cntBJets==3 && isBJet[idx] && isBJet[jdx])))
continue;
86 double dist =
distance((*jets)[idx].
p4(), (*jets)[jdx].
p4());
87 if( minDist<0. || dist<minDist ){
97 wHad = (*jets)[lightQ].p4() + (*jets)[lightQBar].p4();
109 if( (
int)idx!=lightQ && (
int)idx!=lightQBar ) {
110 double dist =
distance((*jets)[idx].
p4(), wHad);
111 if( minDist<0. || dist<minDist ){
128 if( (
int)idx!=lightQ && (
int)idx!=lightQBar && (
int)idx!=hadB ){
129 double dist =
distance((*jets)[idx].
p4(), (*leps)[0].
p4());
130 if( minDist<0. || dist<minDist ){
142 pOut->push_back( match );
152 return fabs(v1.theta() - v2.theta());
edm::EDGetTokenT< edm::View< reco::RecoCandidate > > lepsToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double maxBDiscLightJets_
bool isValid(const int &idx, const edm::Handle< std::vector< pat::Jet > > &jets)
def setup(process, global_tag, zero_tesla=False)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
virtual void produce(edm::Event &evt, const edm::EventSetup &setup)
TtSemiLepJetCombGeom(const edm::ParameterSet &)
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
maxNJets
maximum number of jets taken into account per event for each hypothesis (this parameter is used in th...
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.