22 if(input==
"sumet")
return "particleFlow_SumET";
23 if(input==
"npv")
return "nPV";
24 if(input==
"pfu")
return "particleFlow_U";
25 if(input==
"pfuphi")
return "particleFlow_UPhi";
26 if(input==
"tksumet")
return "track_SumET";
27 if(input==
"tku")
return "track_U";
28 if(input==
"tkuphi")
return "track_UPhi";
29 if(input==
"nopusumet")
return "noPileUp_SumET";
30 if(input==
"nopuu")
return "noPileUp_U";
31 if(input==
"nopuuphi")
return "noPileUp_UPhi";
32 if(input==
"pusumet")
return "pileUp_SumET";
33 if(input==
"pumet")
return "pileUp_MET";
34 if(input==
"pumetphi")
return "pileUp_METPhi";
35 if(input==
"pucsumet")
return "pileUpCorrected_SumET";
36 if(input==
"pucu")
return "pileUpCorrected_U";
37 if(input==
"pucuphi")
return "pileUpCorrected_UPhi";
38 if(input==
"jetpt1")
return "jet1_pT";
39 if(input==
"jeteta1")
return "jet1_eta";
40 if(input==
"jetphi1")
return "jet1_Phi";
41 if(input==
"jetpt2")
return "jet2_pT";
42 if(input==
"jeteta2")
return "jet2_eta";
43 if(input==
"jetphi2")
return "jet2_Phi";
44 if(input==
"nalljet")
return "nJets";
45 if(input==
"njet")
return "numJetsPtGt30";
46 if(input==
"uphi_mva")
return "PhiCor_UPhi";
47 if(input==
"uphix_mva")
return "PhiCor_UPhi";
48 if(input==
"ux_mva")
return "RecoilCor_U";
55 <<
" Failed to find File = " << inputFileName <<
" !!\n";
58 std::vector<std::string> *lVec = (std::vector<std::string>*)inputFile->Get(
"varlist");
62 <<
" Failed to load mva file : " << inputFileName.
fullPath().data() <<
" is not a proper file !!\n";
65 std::vector<std::string> variableNames;
66 for(
unsigned int i=0;
i< lVec->size();++
i)
75 else throw cms::Exception(
"PFMETAlgorithmMVA::loadMVA") <<
"MVA MET weight file tree names do not match specified inputs" << std::endl;
81 <<
" Failed to load MVA = " << mvaName.data() <<
" from file = " << inputFileName.
fullPath().data() <<
" !!\n";
147 const std::vector<reco::PUSubMETCandInfo>&
jets,
148 const std::vector<reco::PUSubMETCandInfo>&
pfCandidates,
149 const std::vector<reco::Vertex::Point>&
vertices)
173 var_[
"particleFlow_U"] = pfRecoil_data.
met;
174 var_[
"particleFlow_SumET"] = pfRecoil_data.
sumet;
175 var_[
"particleFlow_UPhi"] = pfRecoil_data.
phi;
177 var_[
"track_SumET"] = chHSRecoil_data.
sumet/
var_[
"particleFlow_SumET"];
178 var_[
"track_U"] = chHSRecoil_data.
met;
179 var_[
"track_UPhi"] = chHSRecoil_data.
phi;
181 var_[
"noPileUp_SumET"] = hsRecoil_data.
sumet/
var_[
"particleFlow_SumET"];
182 var_[
"noPileUp_U"] = hsRecoil_data.
met;
183 var_[
"noPileUp_UPhi"] = hsRecoil_data.
phi;
185 var_[
"pileUp_SumET"] = puRecoil_data.
sumet/
var_[
"particleFlow_SumET"];
186 var_[
"pileUp_MET"] = puRecoil_data.
met;
187 var_[
"pileUp_METPhi"] = puRecoil_data.
phi;
189 var_[
"pileUpCorrected_SumET"] = hsMinusNeutralPUMEt_data.
sumet/
var_[
"particleFlow_SumET"];
190 var_[
"pileUpCorrected_U"] = hsMinusNeutralPUMEt_data.
met;
191 var_[
"pileUpCorrected_UPhi"] = hsMinusNeutralPUMEt_data.
phi;
193 var_[
"jet1_pT"] = jet1P4.pt();
194 var_[
"jet1_eta"] = jet1P4.eta();
195 var_[
"jet1_Phi"] = jet1P4.phi();
196 var_[
"jet2_pT"] = jet2P4.pt();
197 var_[
"jet2_eta"] = jet2P4.eta();
198 var_[
"jet2_Phi"] = jet2P4.phi();
201 var_[
"nJets"] = jets_cleaned.size();
202 var_[
"nPV"] = vertices.size();
208 std::unique_ptr<float[]> floatVector(
new float[variableNames.size()]);
210 for(
auto variableName: variableNames)
212 floatVector[i++] =
var_[variableName];
226 var_[
"RecoilCor_UPhi"] =
var_[
"PhiCor_UPhi"];
235 if(var_[
"track_U"]/sumLeptonPt < 0.1 || var_[
"noPileUp_U"]/sumLeptonPt < 0.1 ) {
246 double U =
var_[
"RecoilCor_U"];
247 double Phi =
var_[
"PhiCor_UPhi"];
248 if ( U < 0. ) Phi +=
Pi;
253 double metPt =
sqrt(metPx*metPx + metPy*metPy);
254 mvaMEt_.SetCoordinates(metPx, metPy, 0., metPt);
274 stream <<
"<PFMETAlgorithmMVA::print>:" << std::endl;
275 for(
auto entry:
var_)
276 stream << entry.first <<
" = " << entry.second << std::endl;
279 <<
" phi = " << atan2(sumLeptonPy_,
sumLeptonPx_) <<
" "
280 <<
"(Px = " <<
sumLeptonPx_ <<
", Py = " << sumLeptonPy_ <<
")" ;
double GetResponse(const float *vector) const
T getParameter(std::string const &) const
const std::vector< reco::PUSubMETCandInfo > & getCleanedJets() const
double getLeptonsChSumMEX() const
double getLeptonsChSumMEY() const
unsigned numJetsAboveThreshold(const std::vector< reco::PUSubMETCandInfo > &, double)
Sin< T >::type sin(const T &t)
reco::Candidate::LorentzVector subleadJetP4(const std::vector< reco::PUSubMETCandInfo > &)
static std::string const input
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
double getLeptonsSumMEX() const
Cos< T >::type cos(const T &t)
Structure containing data common to all types of MET.
void computeAllSums(const std::vector< reco::PUSubMETCandInfo > &jets, const std::vector< reco::PUSubMETCandInfo > &leptons, const std::vector< reco::PUSubMETCandInfo > &pfCandidates)
reco::Candidate::LorentzVector leadJetP4(const std::vector< reco::PUSubMETCandInfo > &)
double getLeptonsSumMEY() const
LocationCode location() const
Where was the file found?
CommonMETData computeRecoil(int metType)
T const * product() const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::string fullPath() const