6 jetsToken_ (consumes<
std::vector<
pat::
Jet> >(cfg.getParameter<
edm::InputTag>(
"jets" ))),
7 lepsToken_ (consumes<
edm::
View<
reco::RecoCandidate> >(cfg.getParameter<
edm::InputTag>(
"leps" ))),
8 maxNJets_ (cfg.getParameter<
int> (
"maxNJets" )),
9 wMass_ (cfg.getParameter<double> (
"wMass" )),
10 useBTagging_ (cfg.getParameter<
bool> (
"useBTagging" )),
11 bTagAlgorithm_ (cfg.getParameter<
std::
string> (
"bTagAlgorithm" )),
12 minBDiscBJets_ (cfg.getParameter<double> (
"minBDiscBJets" )),
13 maxBDiscLightJets_(cfg.getParameter<double> (
"maxBDiscLightJets"))
17 <<
"Parameter maxNJets can not be set to " <<
maxNJets_ <<
". \n" 18 <<
"It has to be larger than 4 or can be set to -1 to take all jets.";
20 produces<std::vector<std::vector<int> > >();
21 produces<int>(
"NumberOfConsideredJets");
31 std::unique_ptr<std::vector<std::vector<int> > > pOut(
new std::vector<std::vector<int> >);
32 std::unique_ptr<int> pJetsConsidered(
new int);
34 std::vector<int>
match;
35 for(
unsigned int i = 0;
i < 4; ++
i)
36 match.push_back( -1 );
48 if(leps->empty() || jets->size() < 4){
49 pOut->push_back( match );
51 *pJetsConsidered = jets->size();
52 evt.
put(
std::move(pJetsConsidered),
"NumberOfConsideredJets");
59 evt.
put(
std::move(pJetsConsidered),
"NumberOfConsideredJets");
61 std::vector<bool> isBJet;
62 std::vector<bool> isLJet;
77 std::vector<int> closestToWMassIndices;
78 closestToWMassIndices.push_back(-1);
79 closestToWMassIndices.push_back(-1);
82 for(
unsigned jdx=(idx+1); jdx<
maxNJets; ++jdx){
83 if(
useBTagging_ && (!isLJet[jdx] || (cntBJets<=2 && isBJet[jdx]) || (cntBJets==3 && isBJet[idx] && isBJet[jdx])))
continue;
87 if( wDist<0. || wDist>fabs(sum.mass()-
wMass_) ){
88 wDist=fabs(sum.mass()-
wMass_);
89 closestToWMassIndices.clear();
90 closestToWMassIndices.push_back(idx);
91 closestToWMassIndices.push_back(jdx);
102 if(
isValid(closestToWMassIndices[0], jets) &&
isValid(closestToWMassIndices[1], jets)) {
106 if( (
int)idx!=closestToWMassIndices[0] && (
int)idx!=closestToWMassIndices[1] ){
108 (*jets)[closestToWMassIndices[0]].p4()+
109 (*jets)[closestToWMassIndices[1]].p4()+
111 if( maxPt<0. || maxPt<sum.pt() ){
129 if( (
int)idx!=closestToWMassIndices[0] && (
int)idx!=closestToWMassIndices[1] && (
int)idx!=hadB) {
131 (*jets)[
idx].p4()+(*leps)[ 0 ].p4();
132 if( maxPt<0. || maxPt<sum.pt() ){
144 pOut->push_back( match );
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool isValid(const int &idx, const edm::Handle< std::vector< pat::Jet > > &jets)
TtSemiLepJetCombWMassMaxSumPt(const edm::ParameterSet &)
void produce(edm::Event &evt, const edm::EventSetup &setup) override
edm::EDGetTokenT< edm::View< reco::RecoCandidate > > lepsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
~TtSemiLepJetCombWMassMaxSumPt() override
std::string bTagAlgorithm_
def setup(process, global_tag, zero_tesla=False)
maxNJets
maximum number of jets taken into account per event for each hypothesis (this parameter is used in th...
double maxBDiscLightJets_
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
math::XYZTLorentzVector LorentzVector
Lorentz vector.