8 namespace noPileUpMEtUtilities
16 metData.
phi = atan2(metData.
mey, metData.
mex);
23 const std::vector<reco::Candidate::LorentzVector>&
leptons,
24 double dRoverlap,
bool invert)
27 for ( reco::MVAMEtJetInfoCollection::const_iterator
jet = jets.begin();
28 jet != jets.end(); ++
jet ) {
29 bool isOverlap =
false;
30 for ( std::vector<reco::Candidate::LorentzVector>::const_iterator lepton = leptons.begin();
31 lepton != leptons.end(); ++lepton ) {
37 if ( (!isOverlap && !invert) || (isOverlap && invert) ) retVal.push_back(*
jet);
43 double minJetPt,
double maxJetPt,
int type)
46 for ( reco::MVAMEtJetInfoCollection::const_iterator
jet = jets.begin();
47 jet != jets.end(); ++
jet ) {
49 if ( jetPt > minJetPt &&
62 double retVal_sumAbsPx = 0.;
63 double retVal_sumAbsPy = 0.;
64 for ( reco::MVAMEtJetInfoCollection::const_iterator
jet = jets.begin();
65 jet != jets.end(); ++
jet ) {
73 if ( sumAbsPx ) (*sumAbsPx) = retVal_sumAbsPx;
74 if ( sumAbsPy ) (*sumAbsPy) = retVal_sumAbsPy;
84 double retVal_sumAbsPx = 0.;
85 double retVal_sumAbsPy = 0.;
86 for ( reco::MVAMEtJetInfoCollection::const_iterator
jet = jets.begin();
87 jet != jets.end(); ++
jet ) {
95 if ( sumAbsPx ) (*sumAbsPx) = retVal_sumAbsPx;
96 if ( sumAbsPy ) (*sumAbsPy) = retVal_sumAbsPy;
103 if ( idx < jets.size() ) {
105 std::sort(jets_sorted.begin(), jets_sorted.end());
106 retVal = jets_sorted[
idx];
125 const std::vector<reco::Candidate::LorentzVector>&
leptons,
126 double dRoverlap,
bool invert)
131 for ( reco::MVAMEtPFCandInfoCollection::const_iterator pfCandidate = pfCandidates.begin();
132 pfCandidate != pfCandidates.end(); ++pfCandidate ) {
133 bool isOverlap =
false;
134 for ( std::vector<reco::Candidate::LorentzVector>::const_iterator lepton = leptons.begin();
135 lepton != leptons.end(); ++lepton ) {
136 if (
deltaR2(pfCandidate->p4_, *lepton) < dRoverlap*dRoverlap ) {
141 if ( (!isOverlap && !invert) || (isOverlap && invert) ) retVal.push_back(*pfCandidate);
147 double minCharge,
double maxCharge,
int type,
int isWithinJet)
153 for ( reco::MVAMEtPFCandInfoCollection::const_iterator pfCandidate = pfCandidates.begin();
154 pfCandidate != pfCandidates.end(); ++pfCandidate ) {
155 int charge =
abs(pfCandidate->charge_);
156 if ( charge > minCharge &&
157 charge < maxCharge &&
159 (isWithinJet == -1 || (isWithinJet == 1 && pfCandidate->isWithinJet_) || (isWithinJet == 0 && !pfCandidate->isWithinJet_)) )
160 retVal.push_back(*pfCandidate);
171 double retVal_sumAbsPx = 0.;
172 double retVal_sumAbsPy = 0.;
173 for ( reco::MVAMEtPFCandInfoCollection::const_iterator pfCandidate = pfCandidates.begin();
174 pfCandidate != pfCandidates.end(); ++pfCandidate ) {
175 retVal.
mex += pfCandidate->p4_.px();
176 retVal.
mey += pfCandidate->p4_.py();
177 retVal.
sumet += pfCandidate->p4_.pt();
178 retVal_sumAbsPx +=
std::abs(pfCandidate->p4_.px());
179 retVal_sumAbsPy +=
std::abs(pfCandidate->p4_.py());
182 if ( sumAbsPx ) (*sumAbsPx) = retVal_sumAbsPx;
183 if ( sumAbsPy ) (*sumAbsPy) = retVal_sumAbsPy;
198 double trackSumAbsPx = 0.;
199 double trackSumAbsPy = 0.;
202 retVal.
mex = -trackSum.
mex;
203 retVal.
mey = -trackSum.
mey;
206 if ( sumAbsPx ) (*sumAbsPx) = trackSumAbsPx;
207 if ( sumAbsPy ) (*sumAbsPy) = trackSumAbsPy;
235 double trackSumAbsPx = 0.;
236 double trackSumAbsPy = 0.;
239 double jetSumNoPUabsPx_neutral = 0.;
240 double jetSumNoPUabsPy_neutral = 0.;
243 retVal.
mex = trackSumNoPU.
mex + jetSumNoPU_neutral.
mex;
244 retVal.
mey = trackSumNoPU.
mey + jetSumNoPU_neutral.
mey;
247 if ( sumAbsPx ) (*sumAbsPx) = trackSumAbsPx + jetSumNoPUabsPx_neutral;
248 if ( sumAbsPy ) (*sumAbsPy) = trackSumAbsPy + jetSumNoPUabsPy_neutral;
255 double trackSumPUabsPx = 0.;
256 double trackSumPUabsPy = 0.;
259 double jetSumPUabsPx_neutral = 0.;
260 double jetSumPUabsPy_neutral = 0.;
263 retVal.
mex = trackSumPU.
mex + jetSumPU_neutral.
mex;
264 retVal.
mey = trackSumPU.
mey + jetSumPU_neutral.
mey;
267 if ( sumAbsPx ) (*sumAbsPx) = trackSumPUabsPx + jetSumPUabsPx_neutral;
268 if ( sumAbsPy ) (*sumAbsPy) = trackSumPUabsPy + jetSumPUabsPy_neutral;
CommonMETData computeJetSum(const reco::MVAMEtJetInfoCollection &, double *sumAbsPx=0, double *sumAbsPy=0)
reco::MVAMEtPFCandInfoCollection cleanPFCandidates(const reco::MVAMEtPFCandInfoCollection &, const std::vector< reco::Candidate::LorentzVector > &, double, bool)
reco::MVAMEtPFCandInfoCollection selectPFCandidates(const reco::MVAMEtPFCandInfoCollection &, double, double, int, int)
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
CommonMETData computeTrackRecoil(const reco::MVAMEtPFCandInfoCollection &, double *sumAbsPx=0, double *sumAbsPy=0)
CommonMETData computeHadRecoilNoPU(const reco::MVAMEtJetInfoCollection &, const reco::MVAMEtPFCandInfoCollection &, double *sumAbsPx=0, double *sumAbsPy=0)
void finalizeMEtData(CommonMETData &)
std::vector< reco::MVAMEtJetInfo > MVAMEtJetInfoCollection
reco::Candidate::LorentzVector p4_
CommonMETData computeHadRecoilPU(const reco::MVAMEtJetInfoCollection &, const reco::MVAMEtPFCandInfoCollection &, double *sumAbsPx=0, double *sumAbsPy=0)
CommonMETData computeTrackRecoilPU(const reco::MVAMEtPFCandInfoCollection &, double *sumAbsPx=0, double *sumAbsPy=0)
Abs< T >::type abs(const T &t)
double deltaR2(const T1 &t1, const T2 &t2)
Structure containing data common to all types of MET.
CommonMETData computeJetSum_neutral(const reco::MVAMEtJetInfoCollection &, double *sumAbsPx=0, double *sumAbsPy=0)
reco::MVAMEtJetInfo subleadJet(const reco::MVAMEtJetInfoCollection &)
tuple chargedPFCandidates
std::vector< reco::MVAMEtPFCandInfo > MVAMEtPFCandInfoCollection
CommonMETData computeTrackRecoilNoPU(const reco::MVAMEtPFCandInfoCollection &, double *sumAbsPx=0, double *sumAbsPy=0)
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
reco::MVAMEtJetInfoCollection selectJets(const reco::MVAMEtJetInfoCollection &, double, double, int)
reco::MVAMEtJetInfo leadJet(const reco::MVAMEtJetInfoCollection &)
reco::MVAMEtJetInfoCollection cleanJets(const reco::MVAMEtJetInfoCollection &, const std::vector< reco::Candidate::LorentzVector > &, double, bool)
CommonMETData computePFCandidateSum(const reco::MVAMEtPFCandInfoCollection &, double *sumAbsPx=0, double *sumAbsPy=0)
CommonMETData computeNeutralRecoil_unclustered(const reco::MVAMEtPFCandInfoCollection &, double *sumAbsPx=0, double *sumAbsPy=0)
reco::MVAMEtJetInfo jet(const reco::MVAMEtJetInfoCollection &, unsigned)