ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbbAnalysis/VHbbDataFormats/interface/TopMassReco.h
Revision: 1.2
Committed: Thu Sep 8 10:36:18 2011 UTC (13 years, 7 months ago) by arizzi
Content type: text/plain
Branch: MAIN
CVS Tags: EDMV42_Step2_V8, EDMV42_Step2_V7, EDMV42_Step2_V6, EDMV42_Step2_V5a, EDMV42_Step2_V5, tauCandV42, hbbsubstructDev_11, hbbsubstructDev_10, hbbsubstructDev_9, hbbsubstructDev_8, hbbsubstructDev_7, hbbsubstructDev_6, hbbsubstructDev_5, hbbsubstructDev_4, hbbsubstructDev_3, hbbsubstructDev_2, hbbsubstructDev_1, hbbsubstructDev, V21TauCand_0, EDMV42_Step2_V4a, EDMV42_Step2_V4, EDMV42_Step2_V3, EDMV42_Step2_V2, EDMV42_Step2_V1, EdmV42, EdmV41alpha1, EdmV40alpha1, EdmV40alpha, V21emuCand, EdmV33Jun12v2_consistent, Step2ForV33_v2, Step2ForV33_v1, EdmV33Jun12v2, EdmV33Jun12v1, EdmV33Jun12v0, Step2ForV32_v2, Step2ForV32_v1, Step2ForV32_v0, Step2ForV31_v0, EdmV32May24v0, EdmV31May21v1, EdmV31May17v0, May14thStep2, EdmV30Apr10, EdmV21Apr10v2, EdmV22May9, EdmV21Apr06, EdmV21Apr10, EdmV21Apr04, EdmV21Apr03, EdmV21Apr2, EdmV21Mar30, EdmV20Mar12, AR_Nov10Ntuple, AR_step2_Oct25, AR_step2_oct19, EdmV11Oct2011, AR_Step2_Oct13, AR_Oct9Ntuple, AR_Oct7_step2ntuple, AR_Oct5Ntuple, EdmV10Oct2011, EdmV9Sept2011, Sept19th2011_2, Sept19th2011, Sept19th, VHNtupleV9_AR1, VHSept15_AR1, Sept14th2011_2, Sept14th2011_AR1, Sept14th2011, Sept13th2011, AR_Sep8_LightNtuple, HEAD
Branch point for: V42TauCandidate, hbbsubstructDevPostHCP, V21TauCand, V21emuCandidate
Changes since 1.1: +13 -38 lines
Log Message:
cleanup

File Contents

# Content
1 #ifndef TOPMASSRECO_H
2 #define TOPMASSRECO_H
3
4 #include <cmath>
5 #include <vector>
6
7 #include "VHbbAnalysis/VHbbDataFormats/interface/VHbbCandidate.h"
8
9 struct TopHypo {
10 TLorentzVector p4;
11 TLorentzVector p4W;
12 };
13
14 namespace TopMassReco {
15
16 TopHypo topMass(const TLorentzVector & lepton, const TLorentzVector & bJet,const TLorentzVector & met){
17 TopHypo top;
18 const double mW2 = 6464.16; //80.4**2;
19 double pzNu=0;
20
21 //Did not recalculate any formulas, but seems to check the neutrino solutions to get met z component
22
23 const double a = mW2 - lepton.M2() + 2.0*lepton.Px()*met.Px()+2.0*lepton.Py()*met.Py();
24 const double A = 4.0*(lepton.E()*lepton.E() - lepton.Pz()*lepton.Pz());
25 const double B = -4.0*a*lepton.Pz();
26 const double C = 4.0*lepton.E()*lepton.E()*(met.Px()*met.Px()+met.Py()*met.Py()) - a*a;
27 const double tmpRoot = B*B - 4.0*A*C;
28 if (tmpRoot<0) pzNu = - B/(2*A);
29 else{
30 const double tmpSol1 = (-B + TMath::Sqrt(tmpRoot))/(2.0*A);
31 const double tmpSol2 = (-B - TMath::Sqrt(tmpRoot))/(2.0*A);
32 if (fabs(tmpSol2-lepton.Pz()) < fabs(tmpSol1-lepton.Pz())){
33 pzNu = tmpSol2;
34 }
35 else pzNu = tmpSol1;
36 }
37 const double nuE = TMath::Sqrt(met.Px()*met.Px()+met.Py()*met.Py()+pzNu*pzNu);
38
39 //new met vector
40 TLorentzVector metHyp = TLorentzVector(met.Px(),met.Py(),pzNu,nuE);
41
42 //W = lepton+met
43 top.p4W = (lepton+metHyp);
44 //Top = lepton+jet+met
45 top.p4 = (lepton+bJet+metHyp);
46
47 return top;
48 }
49
50 }
51
52 #endif