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)
edm::EDGetTokenT< edm::View< reco::RecoCandidate > > lepsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::string bTagAlgorithm_
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.