32 const std::vector<CorrMETData>& fCorrections,
41 const std::vector<CorrMETData>& fCorrections,
43 return MET (fSumEt, fCorrections, fP4, fMet.
vertex ());
51 std::vector<T>* v_corMET) {
52 T uncorMETObj = v_uncorMET.front();
54 double uncorMETX = uncorMETObj.px();
55 double uncorMETY = uncorMETObj.py();
57 double corMETX = uncorMETX;
58 double corMETY = uncorMETY;
64 double sumMuDepEx = 0.;
65 double sumMuDepEy = 0.;
66 double sumMuDepEt = 0.;
68 unsigned int nMuons = inputMuons.
size();
69 for(
unsigned int iMu = 0; iMu<nMuons; iMu++) {
72 int flag = muCorrData.
type();
73 float deltax = muCorrData.
corrX();
74 float deltay = muCorrData.
corrY();
88 sumMuDepEt +=
sqrt(deltax*deltax + deltay*deltay);
89 corMETX = corMETX - mup4.px() + deltax;
90 corMETY = corMETY - mup4.py() + deltay;
93 delta.
mex = sumMuDepEx - sumMuPx;
94 delta.
mey = sumMuDepEy - sumMuPy;
95 delta.
sumet = sumMuPt - sumMuDepEt;
97 std::vector<CorrMETData> corrections = uncorMETObj.mEtCorr();
98 corrections.push_back(delta);
100 T result = makeMET(uncorMETObj, uncorMETObj.sumEt() + delta.
sumet, corrections, correctedMET4vector);
101 v_corMET->push_back(result);
106 bool useTrackAssociatorPositions,
109 double towerEtThreshold,
110 double& deltax,
double& deltay,
114 bool useAverage =
false;
121 if(sumPt > 3 || sumEtEcal + sumEtHcal > 5) useAverage =
true;
128 muMETInfo.
useHO = useHO;
139 if(useTrackAssociatorPositions) {
156 for(vector<const CaloTower*>::const_iterator it = towers.begin();
157 it != towers.end(); it++) {
158 if((*it)->et() < towerEtThreshold)
continue;
159 muMETInfo.
ecalE += (*it)->emEnergy();
160 muMETInfo.
hcalE += (*it)->hadEnergy();
162 muMETInfo.
hoE +=(*it)->outerEnergy();
189 correctMETforMuon(deltax, deltay, Bfield, inputMuon->
charge(),
190 mup4, inputMuon->
vertex(),
200 double mu_p = muonP4.P();
201 double mu_pt = muonP4.Pt();
202 double mu_phi = muonP4.Phi();
203 double mu_eta = muonP4.Eta();
204 double mu_vz = muonVertex.z()/100.;
205 double mu_pz = muonP4.Pz();
207 double ecalPhi, ecalTheta;
208 double hcalPhi, hcalTheta;
209 double hoPhi, hoTheta;
216 ecalPhi = muonMETInfo.
ecalPos.Phi();
217 ecalTheta = muonMETInfo.
ecalPos.Theta();
218 hcalPhi = muonMETInfo.
hcalPos.Phi();
219 hcalTheta = muonMETInfo.
hcalPos.Theta();
220 hoPhi = muonMETInfo.
hoPos.Phi();
221 hoTheta = muonMETInfo.
hoPos.Theta();
232 double rEcal = 1.290;
235 if(
abs(mu_eta) > 0.3) rHo = 4.07;
237 double zFaceEcal = 3.209;
238 if(mu_eta < 0 ) zFaceEcal = -1*zFaceEcal;
240 double zFaceHcal = 3.88;
241 if(mu_eta < 0 ) zFaceHcal = -1*zFaceHcal;
245 double bendr = mu_pt*1000/(300*bfield);
247 double tb_ecal = TMath::ACos(1-rEcal*rEcal/(2*bendr*bendr));
248 double tb_hcal = TMath::ACos(1-rHcal*rHcal/(2*bendr*bendr));
249 double tb_ho = TMath::ACos(1-rHo*rHo/(2*bendr*bendr));
250 double xEcal,yEcal,zEcal;
251 double xHcal,yHcal,zHcal;
255 if(fabs(mu_pz*bendr*tb_ecal/mu_pt+mu_vz) < fabs(zFaceEcal) && rEcal < 2*bendr) {
256 xEcal = bendr*(TMath::Sin(tb_ecal+mu_phi)-TMath::Sin(mu_phi));
257 yEcal = bendr*(-TMath::Cos(tb_ecal+mu_phi)+TMath::Cos(mu_phi));
258 zEcal = bendr*tb_ecal*mu_pz/mu_pt + mu_vz;
261 double te_ecal = (fabs(zFaceEcal) - mu_vz)*mu_pt/(bendr*mu_pz);
262 xEcal = bendr*(TMath::Sin(te_ecal+mu_phi) - TMath::Sin(mu_phi));
263 yEcal = bendr*(-TMath::Cos(te_ecal+mu_phi) + TMath::Cos(mu_phi));
264 zEcal = fabs(zFaceEcal);
266 double te_ecal = -(fabs(zFaceEcal) + mu_vz)*mu_pt/(bendr*mu_pz);
267 xEcal = bendr*(TMath::Sin(te_ecal+mu_phi) - TMath::Sin(mu_phi));
268 yEcal = bendr*(-TMath::Cos(te_ecal+mu_phi) + TMath::Cos(mu_phi));
269 zEcal = -fabs(zFaceEcal);
274 if(fabs(mu_pz*bendr*tb_hcal/mu_pt+mu_vz) < fabs(zFaceHcal) && rEcal < 2*bendr) {
275 xHcal = bendr*(TMath::Sin(tb_hcal+mu_phi)-TMath::Sin(mu_phi));
276 yHcal = bendr*(-TMath::Cos(tb_hcal+mu_phi)+TMath::Cos(mu_phi));
277 zHcal = bendr*tb_hcal*mu_pz/mu_pt + mu_vz;
280 double te_hcal = (fabs(zFaceHcal) - mu_vz)*mu_pt/(bendr*mu_pz);
281 xHcal = bendr*(TMath::Sin(te_hcal+mu_phi) - TMath::Sin(mu_phi));
282 yHcal = bendr*(-TMath::Cos(te_hcal+mu_phi) + TMath::Cos(mu_phi));
283 zHcal = fabs(zFaceHcal);
285 double te_hcal = -(fabs(zFaceHcal) + mu_vz)*mu_pt/(bendr*mu_pz);
286 xHcal = bendr*(TMath::Sin(te_hcal+mu_phi) - TMath::Sin(mu_phi));
287 yHcal = bendr*(-TMath::Cos(te_hcal+mu_phi) + TMath::Cos(mu_phi));
288 zHcal = -fabs(zFaceHcal);
293 xHo = bendr*(TMath::Sin(tb_ho+mu_phi)-TMath::Sin(mu_phi));
294 yHo = bendr*(-TMath::Cos(tb_ho+mu_phi)+TMath::Cos(mu_phi));
295 zHo = bendr*tb_ho*mu_pz/mu_pt + mu_vz;
297 ecalTheta = TMath::ACos(zEcal/
sqrt(
pow(xEcal,2) +
pow(yEcal,2)+
pow(zEcal,2)));
298 ecalPhi = atan2(yEcal,xEcal);
299 hcalTheta = TMath::ACos(zHcal/
sqrt(
pow(xHcal,2) +
pow(yHcal,2)+
pow(zHcal,2)));
300 hcalPhi = atan2(yHcal,xHcal);
301 hoTheta = TMath::ACos(zHo/
sqrt(
pow(xHo,2) +
pow(yHo,2)+
pow(zHo,2)));
302 hoPhi = atan2(yHo,xHo);
305 double r2dEcal =
sqrt(
pow(xEcal,2)+
pow(yEcal,2));
306 double r2dHcal =
sqrt(
pow(xHcal,2)+
pow(yHcal,2));
317 double dphi = mu_phi - ecalPhi;
320 ecalPhi = mu_phi - fabs(dphi);
323 ecalPhi = -1*temp*ecalPhi/fabs(ecalPhi);
325 xEcal = r2dEcal*TMath::Cos(ecalPhi);
326 yEcal = r2dEcal*TMath::Sin(ecalPhi);
329 dphi = mu_phi - hcalPhi;
332 hcalPhi = mu_phi - fabs(dphi);
335 hcalPhi = -1*temp*hcalPhi/fabs(hcalPhi);
337 xHcal = r2dHcal*TMath::Cos(hcalPhi);
338 yHcal = r2dHcal*TMath::Sin(hcalPhi);
342 dphi = mu_phi - hoPhi;
345 hoPhi = mu_phi - fabs(dphi);
348 hoPhi = -1*temp*hoPhi/fabs(hoPhi);
350 xHo = r2dHo*TMath::Cos(hoPhi);
351 yHo = r2dHo*TMath::Sin(hoPhi);
359 double mu_Ex = muonMETInfo.
ecalE*
sin(ecalTheta)*
cos(ecalPhi)
361 + muonMETInfo.
hoE*
sin(hoTheta)*
cos(hoPhi);
362 double mu_Ey = muonMETInfo.
ecalE*
sin(ecalTheta)*
sin(ecalPhi)
364 + muonMETInfo.
hoE*
sin(hoTheta)*
sin(hoPhi);
376 double dEdx_normalization = -(11.4 + 0.96*fabs(
log(50*2.8)) + 0.033*50*(1.0 -
pow(50, -0.33)) )*1
e-3;
377 double dEdx_numerator = -(11.4 + 0.96*fabs(
log(mu_p*2.8)) + 0.033*mu_p*(1.0 -
pow(mu_p, -0.33)) )*1
e-3;
381 if(muonMETInfo.
useHO) {
383 if(fabs(mu_eta) < 0.2)
384 temp = 2.75*(1-0.00003*mu_p);
385 if(fabs(mu_eta) > 0.2 && fabs(mu_eta) < 1.0)
386 temp = (2.38+0.0144*fabs(mu_eta))*(1-0.0003*mu_p);
387 if(fabs(mu_eta) > 1.0 && fabs(mu_eta) < 1.3)
388 temp = 7.413-5.12*fabs(mu_eta);
389 if(fabs(mu_eta) > 1.3)
390 temp = 2.084-0.743*fabs(mu_eta);
392 if(fabs(mu_eta) < 1.0)
393 temp = 2.33*(1-0.0004*mu_p);
394 if(fabs(mu_eta) > 1.0 && fabs(mu_eta) < 1.3)
395 temp = (7.413-5.12*fabs(mu_eta))*(1-0.0003*mu_p);
396 if(fabs(mu_eta) > 1.3)
397 temp = 2.084-0.743*fabs(mu_eta);
400 double dep = temp*dEdx_normalization/dEdx_numerator;
401 if(dep < 0.5) dep = 0;
403 if(fabs(mu_eta) < 1.3) {
404 deltax += dep*
cos((ecalPhi+hcalPhi+hoPhi)/3);
405 deltay += dep*
sin((ecalPhi+hcalPhi+hoPhi)/3);
407 deltax += dep*
cos( (ecalPhi+hcalPhi)/2);
408 deltay += dep*
cos( (ecalPhi+hcalPhi)/2);
420 MuonMETAlgo_run(inputMuons, vm_muCorrData, uncorMET, corMET);
429 MuonMETAlgo_run(inputMuons, vm_muCorrData, uncorMET, corMET);
math::XYZPoint trkGlobPosAtHO
float sumPt
sum-pt of tracks
std::vector< const CaloTower * > crossedTowers
virtual const LorentzVector & p4() const GCC11_FINAL
four-momentum Lorentz vector
virtual TrackRef innerTrack() const
virtual const Point & vertex() const
vertex position (overwritten by PF...)
bool isTrackerMuon() const
Sin< T >::type sin(const T &t)
math::XYZTLorentzVector LorentzVector
bool isGlobalMuon() const
float emS9
energy deposited in 3x3 ECAL crystal shape around central crystal
RefToBase< value_type > refAt(size_type i) const
math::XYZPoint trkGlobPosAtHcal
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
SpecificCaloMETData getSpecific() const
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
float hoS9
energy deposited in 3x3 HO tower shape around central tower
bool useTkAssociatorPositions
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
MuonEnergy calEnergy() const
get energy deposition information
virtual int charge() const GCC11_FINAL
electric charge
XYZPointD XYZPoint
point in space with cartesian internal representation
math::XYZPoint trkGlobPosAtEcal
Track position at different parts of the calorimeter.
bool isIsolationValid() const
Power< A, B >::type pow(const A &a, const B &b)
float hadS9
energy deposited in 3x3 HCAL tower shape around central tower
const MuonIsolation & isolationR03() const
math::PtEtaPhiELorentzVectorF LorentzVector
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector