2 #include "Math/VectorUtil.h"
7 namespace HWWFunctions {
9 bool sortByPFJetPt (
const std::pair <LorentzVector, Int_t> &pfjet1,
const std::pair<LorentzVector, Int_t> &pfjet2)
11 return pfjet1.first.pt() > pfjet2.first.pt();
17 vector <float> mva_variable;
21 edm::LogError(
"InvalidInput") <<
"variable not found. Check input. Exiting.";
26 if(hww.
pfjets_p4().size() == mva_variable.size() ) {
28 goodmvas = mva_variable;
33 vector <bool> isgoodindex;
34 vector <std::pair <LorentzVector, Int_t> > cjets;
40 for(
size_t cjeti = 0; cjeti < hww.
pfjets_p4().size(); cjeti++) {
42 pair <LorentzVector, Int_t> cjetpair = make_pair( corrjet, (Int_t)cjeti );
43 cjets.push_back(cjetpair);
47 for(
size_t cjeti = 0; cjeti < hww.
pfjets_p4().size(); cjeti++) {
49 pair <LorentzVector, Int_t> cjetpair = make_pair( corrjet, (Int_t)cjeti );
50 cjets.push_back(cjetpair);
56 for(
size_t ucjeti = 0; ucjeti < hww.
pfjets_p4().size(); ucjeti++) {
57 for(
size_t cjeti = 0; cjeti < hww.
pfjets_p4().size(); cjeti++) {
62 if( fabs( hww.
pfjets_p4().at(ucjeti).eta() - (hww.
pfjets_p4().at(cjets.at(cjeti).second)).eta()) > 0.01 )
continue;
65 if( fabs( hww.
pfjets_p4().at(ucjeti).eta() - (hww.
pfjets_p4().at(cjets.at(cjeti).second)).eta()) > 0.01 )
continue;
70 deta = hww.
pfjets_p4().at(ucjeti).eta() - (hww.
pfjets_p4().at(cjets.at(cjeti).second)).eta();
71 dphi = acos(
cos(hww.
pfjets_p4().at(ucjeti).phi() - (hww.
pfjets_p4().at(cjets.at(cjeti).second)).phi()));
72 dr =
sqrt(deta*deta + dphi*dphi);
74 deta = hww.
pfjets_p4().at(ucjeti).eta() - (hww.
pfjets_p4().at(cjets.at(cjeti).second)).eta();
75 dphi = acos(
cos(hww.
pfjets_p4().at(ucjeti).phi() - (hww.
pfjets_p4().at(cjets.at(cjeti).second)).phi()));
76 dr =
sqrt(deta*deta + dphi*dphi);
80 isgoodindex.push_back(
false);
82 isgoodindex.push_back(
true);
87 if( isgoodindex.size() >= mva_variable.size() ){
88 for(
size_t mvai = 0; mvai < mva_variable.size(); mvai++ ){
89 if( isgoodindex.at(mvai) ) goodmvas.push_back(mva_variable.at(mvai));
96 if( goodmvas.size() == hww.
pfjets_p4().size() ){
103 goodmvas = mva_variable;
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
std::vector< float > & pfjets_mvavalue()
bool getGoodMVAs(HWW &, std::vector< float > &goodmvas, std::string variable)
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< float > > LorentzVector
bool sortByPFJetPt(const std::pair< LorentzVector, Int_t > &pfjet1, const std::pair< LorentzVector, Int_t > &pfjet2)
std::vector< LorentzVector > & pfjets_p4()
std::vector< float > & pfjets_area()