CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions
MuonMETAlgo Class Reference

#include <MuonMETAlgo.h>

Public Member Functions

void GetMuDepDeltas (const reco::Muon *inputMuon, TrackDetMatchInfo &info, bool useTrackAssociatorPositions, bool useRecHits, bool useHO, double towerEtThreshold, double &deltax, double &deltay, double Bfield)
 
reco::CaloMET makeMET (const reco::CaloMET &fMet, double fSumEt, const std::vector< CorrMETData > &fCorrections, const reco::MET::LorentzVector &)
 
reco::MET makeMET (const reco::MET &, double fSumEt, const std::vector< CorrMETData > &fCorrections, const reco::MET::LorentzVector &fP4)
 
 MuonMETAlgo ()
 
template<class T >
void MuonMETAlgo_run (const edm::View< reco::Muon > &inputMuons, const edm::ValueMap< reco::MuonMETCorrectionData > &vm_muCorrData, const edm::View< T > &v_uncorMET, std::vector< T > *v_corMET)
 
virtual void run (const edm::View< reco::Muon > &inputMuons, const edm::ValueMap< reco::MuonMETCorrectionData > &vm_muCorrData, const edm::View< reco::MET > &uncorMET, reco::METCollection *corMET)
 
virtual void run (const edm::View< reco::Muon > &inputMuons, const edm::ValueMap< reco::MuonMETCorrectionData > &vm_muCorrData, const edm::View< reco::CaloMET > &uncorMET, reco::CaloMETCollection *corMET)
 
virtual ~MuonMETAlgo ()
 

Static Public Member Functions

static void correctMETforMuon (double &deltax, double &deltay, double bfield, int muonCharge, const math::XYZTLorentzVector &muonP4, const math::XYZPoint &muonVertex, MuonMETInfo &)
 

Detailed Description

Correct MET for muons in the events.

Version
1st Version August 30, 2007

Definition at line 32 of file MuonMETAlgo.h.

Constructor & Destructor Documentation

MuonMETAlgo::MuonMETAlgo ( )

Definition at line 435 of file MuonMETAlgo.cc.

435 {}
MuonMETAlgo::~MuonMETAlgo ( )
virtual

Definition at line 439 of file MuonMETAlgo.cc.

439 {}

Member Function Documentation

void MuonMETAlgo::correctMETforMuon ( double &  deltax,
double &  deltay,
double  bfield,
int  muonCharge,
const math::XYZTLorentzVector muonP4,
const math::XYZPoint muonVertex,
MuonMETInfo muonMETInfo 
)
static

Definition at line 196 of file MuonMETAlgo.cc.

References funct::abs(), funct::cos(), alignCSCRings::e, MuonMETInfo::ecalE, MuonMETInfo::ecalPos, MuonMETInfo::hcalE, MuonMETInfo::hcalPos, MuonMETInfo::hoE, MuonMETInfo::hoPos, create_public_lumi_plots::log, Pi, funct::pow(), funct::sin(), mathSSE::sqrt(), groupFilesInBlocks::temp, MuonMETInfo::useAverage, MuonMETInfo::useHO, and MuonMETInfo::useTkAssociatorPositions.

198  {
199 
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();
206 
207  double ecalPhi, ecalTheta;
208  double hcalPhi, hcalTheta;
209  double hoPhi, hoTheta;
210 
211 
212  //should always be false for FWLite
213  //unless you want to supply co-ordinates at
214  //the calorimeter sub-detectors yourself
215  if(muonMETInfo.useTkAssociatorPositions) {
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();
222  } else {
223 
224  /*
225  use the analytical solution for the
226  intersection of a helix with a cylinder
227  to find the positions of the muon
228  at the various calo surfaces
229  */
230 
231  //radii of subdetectors in meters
232  double rEcal = 1.290;
233  double rHcal = 1.9;
234  double rHo = 3.82;
235  if(abs(mu_eta) > 0.3) rHo = 4.07;
236  //distance from the center of detector to face of Ecal
237  double zFaceEcal = 3.209;
238  if(mu_eta < 0 ) zFaceEcal = -1*zFaceEcal;
239  //distance from the center of detector to face of Hcal
240  double zFaceHcal = 3.88;
241  if(mu_eta < 0 ) zFaceHcal = -1*zFaceHcal;
242 
243  //now we have to get Phi
244  //bending radius of the muon (units are meters)
245  double bendr = mu_pt*1000/(300*bfield);
246 
247  double tb_ecal = TMath::ACos(1-rEcal*rEcal/(2*bendr*bendr)); //helix time interval parameter
248  double tb_hcal = TMath::ACos(1-rHcal*rHcal/(2*bendr*bendr)); //helix time interval parameter
249  double tb_ho = TMath::ACos(1-rHo*rHo/(2*bendr*bendr)); //helix time interval parameter
250  double xEcal,yEcal,zEcal;
251  double xHcal,yHcal,zHcal;
252  double xHo, yHo,zHo;
253  //Ecal
254  //in the barrel and if not a looper
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;
259  } else { //endcap
260  if(mu_pz > 0) {
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);
265  } else {
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);
270  }
271  }
272 
273  //Hcal
274  if(fabs(mu_pz*bendr*tb_hcal/mu_pt+mu_vz) < fabs(zFaceHcal) && rEcal < 2*bendr) { //in the barrel
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;
278  } else { //endcap
279  if(mu_pz > 0) {
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);
284  } else {
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);
289  }
290  }
291 
292  //Ho - just the barrel
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;
296 
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);
303 
304  //2d radius in x-y plane
305  double r2dEcal = sqrt(pow(xEcal,2)+pow(yEcal,2));
306  double r2dHcal = sqrt(pow(xHcal,2)+pow(yHcal,2));
307  double r2dHo = sqrt(pow(xHo,2) +pow(yHo,2));
308 
309  /*
310  the above prescription is for right handed helicies only
311  Positively charged muons trace a left handed helix
312  so we correct for that
313  */
314  if(muonCharge > 0) {
315 
316  //Ecal
317  double dphi = mu_phi - ecalPhi;
318  if(fabs(dphi) > TMath::Pi())
319  dphi = 2*TMath::Pi() - fabs(dphi);
320  ecalPhi = mu_phi - fabs(dphi);
321  if(fabs(ecalPhi) > TMath::Pi()) {
322  double temp = 2*TMath::Pi() - fabs(ecalPhi);
323  ecalPhi = -1*temp*ecalPhi/fabs(ecalPhi);
324  }
325  xEcal = r2dEcal*TMath::Cos(ecalPhi);
326  yEcal = r2dEcal*TMath::Sin(ecalPhi);
327 
328  //Hcal
329  dphi = mu_phi - hcalPhi;
330  if(fabs(dphi) > TMath::Pi())
331  dphi = 2*TMath::Pi() - fabs(dphi);
332  hcalPhi = mu_phi - fabs(dphi);
333  if(fabs(hcalPhi) > TMath::Pi()) {
334  double temp = 2*TMath::Pi() - fabs(hcalPhi);
335  hcalPhi = -1*temp*hcalPhi/fabs(hcalPhi);
336  }
337  xHcal = r2dHcal*TMath::Cos(hcalPhi);
338  yHcal = r2dHcal*TMath::Sin(hcalPhi);
339 
340 
341  //Ho
342  dphi = mu_phi - hoPhi;
343  if(fabs(dphi) > TMath::Pi())
344  dphi = 2*TMath::Pi() - fabs(dphi);
345  hoPhi = mu_phi - fabs(dphi);
346  if(fabs(hoPhi) > TMath::Pi()) {
347  double temp = 2*TMath::Pi() - fabs(hoPhi);
348  hoPhi = -1*temp*hoPhi/fabs(hoPhi);
349  }
350  xHo = r2dHo*TMath::Cos(hoPhi);
351  yHo = r2dHo*TMath::Sin(hoPhi);
352 
353  }
354  }
355 
356  //for isolated muons
357  if(!muonMETInfo.useAverage) {
358 
359  double mu_Ex = muonMETInfo.ecalE*sin(ecalTheta)*cos(ecalPhi)
360  + muonMETInfo.hcalE*sin(hcalTheta)*cos(hcalPhi)
361  + muonMETInfo.hoE*sin(hoTheta)*cos(hoPhi);
362  double mu_Ey = muonMETInfo.ecalE*sin(ecalTheta)*sin(ecalPhi)
363  + muonMETInfo.hcalE*sin(hcalTheta)*sin(hcalPhi)
364  + muonMETInfo.hoE*sin(hoTheta)*sin(hoPhi);
365 
366  deltax += mu_Ex;
367  deltay += mu_Ey;
368 
369  } else { //non-isolated muons - derive the correction
370 
371  //dE/dx in matter for iron:
372  //-(11.4 + 0.96*fabs(log(p0*2.8)) + 0.033*p0*(1.0 - pow(p0, -0.33)) )*1e-3
373  //from http://cmslxr.fnal.gov/lxr/source/TrackPropagation/SteppingHelixPropagator/src/SteppingHelixPropagator.ccyes,
374  //line ~1100
375  //normalisation is at 50 GeV
376  double dEdx_normalization = -(11.4 + 0.96*fabs(log(50*2.8)) + 0.033*50*(1.0 - pow(50, -0.33)) )*1e-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)) )*1e-3;
378 
379  double temp = 0.0;
380 
381  if(muonMETInfo.useHO) {
382  //for the Towers, with HO
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);
391  } else {
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);
398  }
399 
400  double dep = temp*dEdx_normalization/dEdx_numerator;
401  if(dep < 0.5) dep = 0;
402  //use the average phi of the 3 subdetectors
403  if(fabs(mu_eta) < 1.3) {
404  deltax += dep*cos((ecalPhi+hcalPhi+hoPhi)/3);
405  deltay += dep*sin((ecalPhi+hcalPhi+hoPhi)/3);
406  } else {
407  deltax += dep*cos( (ecalPhi+hcalPhi)/2);
408  deltay += dep*cos( (ecalPhi+hcalPhi)/2);
409  }
410  }
411 
412 
413 }
const double Pi
math::XYZPoint hcalPos
Definition: MuonMETInfo.h:12
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float hcalE
Definition: MuonMETInfo.h:9
T sqrt(T t)
Definition: SSEVec.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
math::XYZPoint hoPos
Definition: MuonMETInfo.h:13
bool useTkAssociatorPositions
Definition: MuonMETInfo.h:16
float ecalE
Definition: MuonMETInfo.h:8
bool useAverage
Definition: MuonMETInfo.h:14
math::XYZPoint ecalPos
Definition: MuonMETInfo.h:11
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void MuonMETAlgo::GetMuDepDeltas ( const reco::Muon inputMuon,
TrackDetMatchInfo info,
bool  useTrackAssociatorPositions,
bool  useRecHits,
bool  useHO,
double  towerEtThreshold,
double &  deltax,
double &  deltay,
double  Bfield 
)

Definition at line 104 of file MuonMETAlgo.cc.

References reco::Muon::calEnergy(), reco::LeafCandidate::charge(), TrackDetMatchInfo::crossedTowers, MuonMETInfo::ecalE, MuonMETInfo::ecalPos, reco::MuonIsolation::emEt, reco::MuonEnergy::emS9, reco::Muon::globalTrack(), reco::MuonIsolation::hadEt, reco::MuonEnergy::hadS9, MuonMETInfo::hcalE, MuonMETInfo::hcalPos, MuonMETInfo::hoE, MuonMETInfo::hoPos, reco::MuonEnergy::hoS9, reco::Muon::innerTrack(), reco::Muon::isGlobalMuon(), reco::Muon::isIsolationValid(), reco::Muon::isolationR03(), reco::Muon::isTrackerMuon(), reco::Muon::outerTrack(), reco::MuonIsolation::sumPt, TrackDetMatchInfo::trkGlobPosAtEcal, TrackDetMatchInfo::trkGlobPosAtHcal, TrackDetMatchInfo::trkGlobPosAtHO, MuonMETInfo::useAverage, MuonMETInfo::useHO, MuonMETInfo::useTkAssociatorPositions, and reco::LeafCandidate::vertex().

Referenced by cms::MuonMETValueMapProducer::determine_deltax_deltay().

111  {
112 
113 
114  bool useAverage = false;
115  //decide whether or not we want to correct on average based
116  //on isolation information from the muon
117  double sumPt = inputMuon->isIsolationValid()? inputMuon->isolationR03().sumPt : 0.0;
118  double sumEtEcal = inputMuon->isIsolationValid() ? inputMuon->isolationR03().emEt : 0.0;
119  double sumEtHcal = inputMuon->isIsolationValid() ? inputMuon->isolationR03().hadEt : 0.0;
120 
121  if(sumPt > 3 || sumEtEcal + sumEtHcal > 5) useAverage = true;
122 
123  //get the energy using TrackAssociator if
124  //the muon turns out to be isolated
125  MuonMETInfo muMETInfo;
126  muMETInfo.useAverage = useAverage;
127  muMETInfo.useTkAssociatorPositions = useTrackAssociatorPositions;
128  muMETInfo.useHO = useHO;
129 
130 
131  TrackRef mu_track;
132  if(inputMuon->isGlobalMuon()) {
133  mu_track = inputMuon->globalTrack();
134  } else if(inputMuon->isTrackerMuon()) {
135  mu_track = inputMuon->innerTrack();
136  } else
137  mu_track = inputMuon->outerTrack();
138 
139  if(useTrackAssociatorPositions) {
140  muMETInfo.ecalPos = info.trkGlobPosAtEcal;
141  muMETInfo.hcalPos = info.trkGlobPosAtHcal;
142  muMETInfo.hoPos = info.trkGlobPosAtHO;
143  }
144 
145  if(!useAverage) {
146 
147  if(useRecHits) {
148  muMETInfo.ecalE = inputMuon->calEnergy().emS9;
149  muMETInfo.hcalE = inputMuon->calEnergy().hadS9;
150  if(useHO) //muMETInfo.hoE is 0 by default
151  muMETInfo.hoE = inputMuon->calEnergy().hoS9;
152  } else {// use Towers (this is the default)
153  //only include towers whose Et > 0.5 since
154  //by default the MET only includes towers with Et > 0.5
155  std::vector<const CaloTower*> towers = info.crossedTowers;
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();
161  if(useHO)
162  muMETInfo.hoE +=(*it)->outerEnergy();
163  }
164  }//use Towers
165  }
166 
167 
168 
169  //This needs to be fixed!!!!!
170  //The tracker has better resolution for pt < 200 GeV
172  if(inputMuon->isGlobalMuon()) {
173  if(inputMuon->globalTrack()->pt() < 200) {
174  mup4 = LorentzVector(inputMuon->innerTrack()->px(), inputMuon->innerTrack()->py(),
175  inputMuon->innerTrack()->pz(), inputMuon->innerTrack()->p());
176  } else {
177  mup4 = LorentzVector(inputMuon->globalTrack()->px(), inputMuon->globalTrack()->py(),
178  inputMuon->globalTrack()->pz(), inputMuon->globalTrack()->p());
179  }
180  } else if(inputMuon->isTrackerMuon()) {
181  mup4 = LorentzVector(inputMuon->innerTrack()->px(), inputMuon->innerTrack()->py(),
182  inputMuon->innerTrack()->pz(), inputMuon->innerTrack()->p());
183  } else
184  mup4 = LorentzVector(inputMuon->outerTrack()->px(), inputMuon->outerTrack()->py(),
185  inputMuon->outerTrack()->pz(), inputMuon->outerTrack()->p());
186 
187 
188  //call function that does the work
189  correctMETforMuon(deltax, deltay, Bfield, inputMuon->charge(),
190  mup4, inputMuon->vertex(),
191  muMETInfo);
192 }
float hadEt
hcal sum-Et
Definition: MuonIsolation.h:9
math::XYZPoint trkGlobPosAtHO
math::XYZPoint hcalPos
Definition: MuonMETInfo.h:12
float sumPt
sum-pt of tracks
Definition: MuonIsolation.h:7
std::vector< const CaloTower * > crossedTowers
virtual TrackRef innerTrack() const
Definition: Muon.h:48
virtual const Point & vertex() const
vertex position (overwritten by PF...)
bool isTrackerMuon() const
Definition: Muon.h:219
bool isGlobalMuon() const
Definition: Muon.h:218
float emS9
energy deposited in 3x3 ECAL crystal shape around central crystal
Definition: MuonEnergy.h:18
float hcalE
Definition: MuonMETInfo.h:9
math::XYZPoint trkGlobPosAtHcal
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
float emEt
ecal sum-Et
Definition: MuonIsolation.h:8
float hoS9
energy deposited in 3x3 HO tower shape around central tower
Definition: MuonEnergy.h:34
math::XYZPoint hoPos
Definition: MuonMETInfo.h:13
bool useTkAssociatorPositions
Definition: MuonMETInfo.h:16
float ecalE
Definition: MuonMETInfo.h:8
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
Definition: Muon.h:51
MuonEnergy calEnergy() const
get energy deposition information
Definition: Muon.h:111
bool useAverage
Definition: MuonMETInfo.h:14
virtual int charge() const GCC11_FINAL
electric charge
static void correctMETforMuon(double &deltax, double &deltay, double bfield, int muonCharge, const math::XYZTLorentzVector &muonP4, const math::XYZPoint &muonVertex, MuonMETInfo &)
Definition: MuonMETAlgo.cc:196
math::XYZPoint ecalPos
Definition: MuonMETInfo.h:11
math::XYZPoint trkGlobPosAtEcal
Track position at different parts of the calorimeter.
bool isIsolationValid() const
Definition: Muon.h:170
float hadS9
energy deposited in 3x3 HCAL tower shape around central tower
Definition: MuonEnergy.h:28
const MuonIsolation & isolationR03() const
Definition: Muon.h:158
math::PtEtaPhiELorentzVectorF LorentzVector
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
Definition: Muon.h:54
reco::CaloMET MuonMETAlgo::makeMET ( const reco::CaloMET fMet,
double  fSumEt,
const std::vector< CorrMETData > &  fCorrections,
const reco::MET::LorentzVector  
)
reco::MET MuonMETAlgo::makeMET ( const reco::MET ,
double  fSumEt,
const std::vector< CorrMETData > &  fCorrections,
const reco::MET::LorentzVector fP4 
)
template<class T >
void MuonMETAlgo::MuonMETAlgo_run ( const edm::View< reco::Muon > &  inputMuons,
const edm::ValueMap< reco::MuonMETCorrectionData > &  vm_muCorrData,
const edm::View< T > &  v_uncorMET,
std::vector< T > *  v_corMET 
)

Definition at line 48 of file MuonMETAlgo.cc.

References reco::MuonMETCorrectionData::corrX(), reco::MuonMETCorrectionData::corrY(), delta, CorrMETData::mex, CorrMETData::mey, RPCpg::mu, reco::LeafCandidate::p4(), edm::View< T >::refAt(), query::result, edm::View< T >::size(), mathSSE::sqrt(), CorrMETData::sumet, and reco::MuonMETCorrectionData::type().

51  {
52  T uncorMETObj = v_uncorMET.front();
53 
54  double uncorMETX = uncorMETObj.px();
55  double uncorMETY = uncorMETObj.py();
56 
57  double corMETX = uncorMETX;
58  double corMETY = uncorMETY;
59 
61  double sumMuPx = 0.;
62  double sumMuPy = 0.;
63  double sumMuPt = 0.;
64  double sumMuDepEx = 0.;
65  double sumMuDepEy = 0.;
66  double sumMuDepEt = 0.;
67 
68  unsigned int nMuons = inputMuons.size();
69  for(unsigned int iMu = 0; iMu<nMuons; iMu++) {
70  const reco::Muon *mu = &inputMuons[iMu]; //new
71  reco::MuonMETCorrectionData muCorrData = (vm_muCorrData)[inputMuons.refAt(iMu)];
72  int flag = muCorrData.type();
73  float deltax = muCorrData.corrX();
74  float deltay = muCorrData.corrY();
75 
76  LorentzVector mup4;
77  if (flag == 0) //this muon is not used to correct the MET
78  continue;
79 
80  //if we're here, then the muon should be used to correct the MET using the default fit
81  mup4 = mu->p4();
82 
83  sumMuPx += mup4.px();
84  sumMuPy += mup4.py();
85  sumMuPt += mup4.pt();
86  sumMuDepEx += deltax;
87  sumMuDepEy += deltay;
88  sumMuDepEt += sqrt(deltax*deltax + deltay*deltay);
89  corMETX = corMETX - mup4.px() + deltax;
90  corMETY = corMETY - mup4.py() + deltay;
91 
92  }
93  delta.mex = sumMuDepEx - sumMuPx;
94  delta.mey = sumMuDepEy - sumMuPy;
95  delta.sumet = sumMuPt - sumMuDepEt;
96  MET::LorentzVector correctedMET4vector(corMETX, corMETY, 0., sqrt(corMETX*corMETX + corMETY*corMETY));
97  std::vector<CorrMETData> corrections = uncorMETObj.mEtCorr();
98  corrections.push_back(delta);
99 
100  T result = makeMET(uncorMETObj, uncorMETObj.sumEt() + delta.sumet, corrections, correctedMET4vector);
101  v_corMET->push_back(result);
102 }
dbl * delta
Definition: mlp_gen.cc:36
virtual const LorentzVector & p4() const GCC11_FINAL
four-momentum Lorentz vector
math::XYZTLorentzVector LorentzVector
RefToBase< value_type > refAt(size_type i) const
T sqrt(T t)
Definition: SSEVec.h:48
tuple result
Definition: query.py:137
const int mu
Definition: Constants.h:22
double sumet
Definition: CorrMETData.h:20
size_type size() const
a MET correction term
Definition: CorrMETData.h:14
double mey
Definition: CorrMETData.h:18
double mex
Definition: CorrMETData.h:17
long double T
reco::CaloMET makeMET(const reco::CaloMET &fMet, double fSumEt, const std::vector< CorrMETData > &fCorrections, const reco::MET::LorentzVector &)
math::PtEtaPhiELorentzVectorF LorentzVector
virtual void MuonMETAlgo::run ( const edm::View< reco::Muon > &  inputMuons,
const edm::ValueMap< reco::MuonMETCorrectionData > &  vm_muCorrData,
const edm::View< reco::MET > &  uncorMET,
reco::METCollection corMET 
)
virtual

Referenced by cms::MuonMET::produce().

virtual void MuonMETAlgo::run ( const edm::View< reco::Muon > &  inputMuons,
const edm::ValueMap< reco::MuonMETCorrectionData > &  vm_muCorrData,
const edm::View< reco::CaloMET > &  uncorMET,
reco::CaloMETCollection corMET 
)
virtual