32 const std::vector<CorrMETData>& fCorrections,
39 const std::vector<CorrMETData>& fCorrections,
41 return MET (fSumEt, fCorrections, fP4, fMet.
vertex ());
50 void Type1METAlgo_run(
const std::vector<T>& uncorMET,
54 double jetPTthreshold,
55 double jetEMfracLimit,
66 std::cerr <<
"Type1METAlgo_run-> undefined output MET collection. Stop. " << std::endl;
70 const T* u = &(uncorMET.front());
75 double UDeltaPx = 0.0;
76 double UDeltaPy = 0.0;
77 double DeltaSumET = 0.0;
78 double USumET = u->sumEt();
82 for( CaloJetCollection::const_iterator
jet = uncorJet.begin();
jet != uncorJet.end(); ++
jet) {
85 if(
jet->pt()*corrector.
correction (*
jet,jetRef,iEvent,iSetup) > jetPTthreshold &&
jet->emEnergyFraction() < jetEMfracLimit ) {
96 double corr2 = corrector2.
correction (*
jet,jetRef,iEvent,iSetup) - 1.;
97 DeltaPx +=
jet->px() * corr - (
jet->px() * corr2);
98 DeltaPy +=
jet->py() * corr - (
jet->py() * corr2);
99 DeltaSumET +=
jet->et() * corr - (
jet->et() * corr2);
101 UDeltaPx +=
jet->px() ;
102 UDeltaPy +=
jet->py() ;
105 if(
jet->pt() *corrector.
correction (*
jet,jetRef,iEvent,iSetup)> jetPTthreshold &&
jet->emEnergyFraction() > jetEMfracLimit ) {
106 UDeltaPx +=
jet->px() ;
107 UDeltaPy +=
jet->py() ;
112 unsigned int nMuons = inputMuons.
size();
113 for(
unsigned int iMu = 0; iMu<nMuons; iMu++) {
123 UDeltaPx += mup4.px();
124 UDeltaPy += mup4.py();
133 delta.
mex = - DeltaPx;
134 delta.
mey = - DeltaPy;
135 delta.
sumet = DeltaSumET;
141 UDeltaP =
sqrt(UDeltaPx*UDeltaPx+UDeltaPy*UDeltaPy);
142 double Uscale = UscaleA+UscaleB*
exp(UscaleC*UDeltaP);
145 delta.
mex += (Uscale-1.)*UDeltaPx;
146 delta.
mey += (Uscale-1.)*UDeltaPy;
147 delta.
sumet += (Uscale-1.)*USumET;
150 double corrMetPx = u->px()+delta.
mex;
151 double corrMetPy = u->py()+delta.
mey;
155 sqrt (corrMetPx*corrMetPx + corrMetPy*corrMetPy)
158 std::vector<CorrMETData> corrections = u->mEtCorr();
159 corrections.push_back( delta );
161 T result = makeMet (*u, u->sumEt()+delta.
sumet, corrections,correctedMET4vector);
162 corMET->push_back(result);
176 double jetPTthreshold,
177 double jetEMfracLimit,
185 std::cerr <<
"Type1METAlgo_run-> undefined output MET collection. Stop. " << std::endl;
192 double DeltaPx = 0.0;
193 double DeltaPy = 0.0;
194 double DeltaSumET = 0.0;
196 double UDeltaP = 0.0;
197 double UDeltaPx = 0.0;
198 double UDeltaPy = 0.0;
203 for( PFJetCollection::const_iterator
jet = uncorJet.begin();
jet != uncorJet.end(); ++
jet) {
206 if(
jet->pt()*corrector.
correction (*
jet,jetRef,iEvent,iSetup) > jetPTthreshold &&
jet->photonEnergyFraction() < jetEMfracLimit ) {
213 DeltaSumET +=
jet->et() *
corr;
218 double corr2 = corrector2.
correction (*
jet,jetRef,iEvent,iSetup) - 1.;
219 DeltaPx +=
jet->px() * corr - (
jet->px() * corr2);
220 DeltaPy +=
jet->py() * corr - (
jet->py() * corr2);
221 DeltaSumET +=
jet->et() * corr - (
jet->et() * corr2);
225 if (
jet->pt() * corrector.
correction (*
jet,jetRef,iEvent,iSetup) < jetPTthreshold &&
jet->photonEnergyFraction() < jetEMfracLimit) {
226 UDeltaPx -=
jet->px();
227 UDeltaPy -=
jet->py();
234 for (PFCandidateCollection::const_iterator cand =
235 uncorUnclustered.begin(); cand != uncorUnclustered.end(); ++cand) {
237 UDeltaPx -= cand->px();
238 UDeltaPy -= cand->py();
239 USumET += cand->et();
246 delta.
mex = - DeltaPx;
247 delta.
mey = - DeltaPy;
248 delta.
sumet = DeltaSumET;
252 UDeltaP =
sqrt(UDeltaPx*UDeltaPx+UDeltaPy*UDeltaPy);
254 double Uscale = UscaleA+UscaleB*
exp(UscaleC*UDeltaP);
260 delta.
mex += (Uscale-1.)*UDeltaPx;
261 delta.
mey += (Uscale-1.)*UDeltaPy;
262 delta.
sumet += (Uscale-1.)*USumET;
265 double corrMetPx = u->
px()+delta.
mex;
266 double corrMetPy = u->
py()+delta.
mey;
270 sqrt (corrMetPx*corrMetPx + corrMetPy*corrMetPy)
273 std::vector<CorrMETData> corrections = u->
mEtCorr();
274 corrections.push_back( delta );
278 corMET->push_back(specificPFMET);
295 double jetPTthreshold,
296 double jetEMfracLimit,
306 return Type1METAlgo_run(uncorMET, corrector, corrector2, uncorJet, jetPTthreshold, jetEMfracLimit, UscaleA, UscaleB, UscaleC, useTypeII, hasMuonsCorr,inputMuons, vm_muCorrData, corMET, iEvent, iSetup, subtractL1Fast);
314 double jetPTthreshold,
315 double jetEMfracLimit,
322 return Type1METAlgo_run(uncorMET, corrector, corrector2, uncorJet, uncorUnclustered, jetPTthreshold, jetEMfracLimit, UscaleA, UscaleB, UscaleC, useTypeII, corMET, iEvent, iSetup, subtractL1Fast);
SpecificPFMETData getSpecific() const
virtual const Point & vertex() const
vertex position
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
math::XYZTLorentzVector LorentzVector
RefToBase< value_type > refAt(size_type i) const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
SpecificCaloMETData getSpecific() const
std::vector< CorrMETData > mEtCorr() const
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
virtual double px() const
x coordinate of momentum vector
std::vector< PFJet > PFJetCollection
collection of PFJet objects
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
virtual double py() const
y coordinate of momentum vector
math::PtEtaPhiELorentzVectorF LorentzVector
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects