6 maxNJets_ (cfg.getParameter<int> (
"maxNJets" )),
7 wMass_ (cfg.getParameter<double> (
"wMass" )),
8 useBTagging_ (cfg.getParameter<bool> (
"useBTagging" )),
9 bTagAlgorithm_ (cfg.getParameter<std::string>(
"bTagAlgorithm" )),
10 minBDiscBJets_ (cfg.getParameter<double> (
"minBDiscBJets" )),
11 maxBDiscLightJets_ (cfg.getParameter<double> (
"maxBDiscLightJets" )),
12 neutrinoSolutionType_(cfg.getParameter<int> (
"neutrinoSolutionType"))
16 <<
"Parameter maxNJets can not be set to " <<
maxNJets_ <<
". \n"
17 <<
"It has to be larger than 4 or can be set to -1 to take all jets.";
27 std::vector<int>&
match,
const unsigned int iComb)
29 if(leps->empty() || mets->empty() ||
jets->size()<4){
37 std::vector<bool> isBJet;
38 std::vector<bool> isLJet;
41 for(
int idx=0; idx<maxNJets; ++idx) {
49 for(
int i=0;
i<5; ++
i)
57 std::vector<int> maxPtIndices;
58 maxPtIndices.push_back(-1);
59 maxPtIndices.push_back(-1);
60 maxPtIndices.push_back(-1);
61 for(
int idx=0; idx<maxNJets; ++idx){
62 if(
useBTagging_ && (!isLJet[idx] || (cntBJets<=2 && isBJet[idx])))
continue;
63 for(
int jdx=(idx+1); jdx<maxNJets; ++jdx){
64 if(jdx==idx || (
useBTagging_ && (!isLJet[jdx] || (cntBJets<=2 && isBJet[jdx]) || (cntBJets==3 && isBJet[idx] && isBJet[jdx]))))
continue;
65 for(
int kdx=0; kdx<maxNJets; ++kdx){
66 if(kdx==idx || kdx==jdx || (
useBTagging_ && !isBJet[kdx]))
continue;
71 if( maxPt<0. || maxPt<sum.pt() ){
74 maxPtIndices.push_back(idx);
75 maxPtIndices.push_back(jdx);
76 maxPtIndices.push_back(kdx);
87 std::vector<int> closestToWMassIndices;
88 closestToWMassIndices.push_back(-1);
89 closestToWMassIndices.push_back(-1);
91 for(
unsigned idx=0; idx<maxPtIndices.size(); ++idx){
92 for(
unsigned jdx=0; jdx<maxPtIndices.size(); ++jdx){
93 if( jdx==idx || maxPtIndices[idx]>maxPtIndices[jdx] || (
useBTagging_ && (!isLJet[maxPtIndices[idx]] || !isLJet[maxPtIndices[jdx]] || (cntBJets<=2 && isBJet[maxPtIndices[idx]]) || (cntBJets<=2 && isBJet[maxPtIndices[jdx]]) || (cntBJets==3 && isBJet[maxPtIndices[idx]] && isBJet[maxPtIndices[jdx]]))))
continue;
95 (*jets)[maxPtIndices[idx]].p4()+
96 (*jets)[maxPtIndices[jdx]].p4();
97 if( wDist<0. || wDist>fabs(sum.mass()-
wMass_) ){
98 wDist=fabs(sum.mass()-
wMass_);
99 closestToWMassIndices.clear();
100 closestToWMassIndices.push_back(maxPtIndices[idx]);
101 closestToWMassIndices.push_back(maxPtIndices[jdx]);
114 for(
int idx=0; idx<maxNJets; ++idx){
117 if(
std::find(maxPtIndices.begin(), maxPtIndices.end(), idx) == maxPtIndices.end() ){
119 (*jets)[idx].p4()+(*leps)[ 0 ].p4();
120 if( maxPt<0. || maxPt<sum.pt() ){
140 for(
unsigned idx=0; idx<maxPtIndices.size(); ++idx){
142 if(
std::find( closestToWMassIndices.begin(), closestToWMassIndices.end(), maxPtIndices[idx]) == closestToWMassIndices.end() ){
~TtSemiLepHypMaxSumPtWMass()
bool isValid(const int &idx, const edm::Handle< std::vector< pat::Jet > > &jets)
check if index is in valid range of selected jets
reco::ShallowClonePtrCandidate * lepton_
TtSemiLepHypMaxSumPtWMass(const edm::ParameterSet &)
int neutrinoSolutionType_
reco::ShallowClonePtrCandidate * lightQBar_
virtual void buildHypo(edm::Event &, const edm::Handle< edm::View< reco::RecoCandidate > > &, const edm::Handle< std::vector< pat::MET > > &, const edm::Handle< std::vector< pat::Jet > > &, std::vector< int > &, const unsigned int iComb)
build event hypothesis from the reco objects of a semi-leptonic event
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
reco::ShallowClonePtrCandidate * neutrino_
reco::ShallowClonePtrCandidate * hadronicB_
double maxBDiscLightJets_
void setNeutrino(const edm::Handle< std::vector< pat::MET > > &met, const edm::Handle< edm::View< reco::RecoCandidate > > &leps, const int &idx, const int &type)
set neutrino, using mW = 80.4 to calculate the neutrino pz
std::string bTagAlgorithm_
void setCandidate(const edm::Handle< C > &handle, const int &idx, reco::ShallowClonePtrCandidate *&clone)
use one object in a collection to set a ShallowClonePtrCandidate
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
reco::ShallowClonePtrCandidate * lightQ_
reco::ShallowClonePtrCandidate * leptonicB_
std::string jetCorrectionLevel(const std::string &quarkType)
helper function to construct the proper correction level string for corresponding quarkType ...