ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbbAnalysis/VHbbDataFormats/interface/VHbbCandidateTools.h
Revision: 1.2
Committed: Sun Jul 17 10:17:15 2011 UTC (13 years, 9 months ago) by tboccali
Content type: text/plain
Branch: MAIN
Changes since 1.1: +71 -4 lines
Log Message:
move deltatheta

File Contents

# User Rev Content
1 tboccali 1.1 #ifndef VHBBCANDIDATETOOLS_H
2     #define VHBBCANDIDATETOOLS_H
3    
4     #include "VHbbAnalysis/VHbbDataFormats/interface/VHbbCandidate.h"
5    
6     #include <iostream>
7    
8     class VHbbCandidateTools {
9     public:
10    
11     VHbbCandidateTools(bool verbose = false): verbose_(verbose){}
12    
13     float deltaPhi(float in2, float in1){
14     float dphi = in2-in1;
15     if ( dphi > M_PI ) {
16     dphi -= 2.0*M_PI;
17     } else if ( dphi <= -M_PI ) {
18     dphi += 2.0*M_PI;
19     }
20     return dphi;
21     }
22    
23     VHbbCandidate getHZmumuCandidate(const VHbbCandidate & in, bool & ok){
24     if (verbose_){
25     std::cout <<" getHZmumuCandidate input mu "<<in.V.muons.size()<<" e "<<in.V.electrons.size()<<std::endl;
26     }
27     ok = false;
28     VHbbCandidate temp=in;
29     if (temp.V.muons.size()!=2) return in ;
30     if (temp.V.electrons.size()!=0) return in ;
31     temp.V.fourMomentum = temp.V.muons[0].fourMomentum+temp.V.muons[1].fourMomentum;
32    
33     if (temp.V.muons[0].fourMomentum.Pt()<20 || temp.V.muons[1].fourMomentum.Pt()<20 ) return in;
34    
35     // if (temp.V.Pt()<150 ) return in;
36     // if (temp.H.Pt()<150) return in;
37     // if (temp.H.firstJet().csv< 0.9) return in;
38     // if (temp.H.secondJet().csv<0.5) return in;
39     // if (deltaPhi(temp.V.Phi(),temp.H.Phi())<2.7) return in;
40     // if (temp.V.FourMomentum.Mass()<75 || temp.V.FourMomentum.Mass()>105) return in;
41     // if (temp.additionalJets.size()>0) return in;
42     // if (std::Abs(deltaTheta) ????
43     ok = true;
44     return temp;
45     }
46     VHbbCandidate getHZeeCandidate(const VHbbCandidate & in, bool & ok){
47     if (verbose_){
48     std::cout <<" getHZeeCandidate input mu "<<in.V.muons.size()<<" e "<<in.V.electrons.size()<<std::endl;
49     }
50    
51     ok = false;
52     VHbbCandidate temp=in;
53     if (temp.V.electrons.size()!=2) return in ;
54     if (temp.V.muons.size()!=0) return in ;
55    
56     temp.V.fourMomentum = temp.V.electrons[0].fourMomentum+temp.V.electrons[1].fourMomentum;
57    
58     //
59     // i need to ask VBTF and pt NEEDS ADJUSTING!!!!!
60     //
61     if (temp.V.electrons[0].fourMomentum.Pt()<20 ||temp.V.electrons[1].fourMomentum.Pt()<20 ) return in;
62     if (temp.V.electrons[0].id95r < -100000 ||temp.V.electrons[1].id95r < -100000) return in;
63    
64     // if (temp.V.fourMomentum.Pt()<150 ) return in;
65     // if (temp.H.fourMomentum.Pt()<150) return in;
66     // if (temp.H.firstJet().csv< 0.9) return in;
67     // if (temp.H.secondJet().csv<0.5) return in;
68     // if (deltaPhi(temp.V.fourMomentum.Phi(),temp.H.fourMomentum.Phi())<2.7) return in;
69     // if (temp.V.fourMomentum.M()<75 || temp.V.fourMomentum.M()>105) return in;
70     // if (temp.additionalJets.size()>0) return in;
71     // if (std::Abs(deltaTheta) ????
72     ok = true;
73     return temp;
74     }
75     VHbbCandidate getHZnnCandidate(const VHbbCandidate & in, bool & ok){
76     if (verbose_){
77     std::cout <<" getHZnnCandidate input mu "<<in.V.muons.size()<<" e "<<in.V.electrons.size()<<" met "<<in.V.mets.size()<<std::endl;
78     }
79    
80     ok = false;
81     VHbbCandidate temp=in;
82     if (temp.V.mets.size()!=1) return in;
83     if (temp.V.muons.size()!=0) return in ;
84     if (temp.V.electrons.size()!=0) return in ;
85    
86     temp.V.fourMomentum = temp.V.mets[0].fourMomentum;
87     if (verbose_) {
88     std::cout <<" debug met "<< temp.V.mets[0].metSig << " " << temp.V.mets[0].sumEt<< std::endl;
89     }
90     if (temp.V.mets[0].metSig<5) return in;
91     if (temp.V.mets[0].sumEt<50) return in;
92     // if (temp.H.fourMomentum.Pt()<150)return in;
93     // if (temp.H.firstJet().csv< 0.9) return in;
94     // if (temp.H.secondJet().csv<0.5) return in;
95     // if (deltaPhi(temp.V.fourMomentum.Phi(),temp.H.fourMomentum.Phi())<2.95) return in;
96     // if (temp.V.electrons.size()>0 || temp.V.muons.size()>0 ) return in;
97     // if (temp.additionalJets.size()>0) return in;
98     // if (std::Abs(deltaTheta) ????
99    
100     ok = true;
101     return temp;
102     }
103    
104     VHbbCandidate getHWmunCandidate(const VHbbCandidate & in, bool & ok){
105     ok = false;
106     VHbbCandidate temp=in;
107 tboccali 1.2 // require a muon and no electrons
108 tboccali 1.1 if (temp.V.muons.size()!=1) return in ;
109     if (temp.V.electrons.size()!=0) return in ;
110     //
111 tboccali 1.2 /*pT(W) > 150 GeV (pt(W) computed using lepton px,y and PF MET x and y components)
112     pT(H) > 150 GeV
113     best btag, CSV > 0.90
114     second-best btag, CSV > 0.50
115     Dphi(W,H) > 2.95
116     no additional isolated leptons (pT > 15 GeV)
117    
118     same lepton definition as in the physics objects section
119    
120     No additional ak5PFjets (pT > 30 GeV; |eta| < 2.4)
121     MET>35. for the electron BDT analysis
122     |cos(theta * )| (TBO)
123     color flow pull angle (TBO)
124     We don't cut on the transverse mass (for boosted objects cutting on the transverse mass introduces an inefficiency due to the angle between the MET and the lepton being close to 0.)
125     */
126    
127    
128     ok=true;
129 tboccali 1.1 return in;
130     }
131    
132     VHbbCandidate getHWenCandidate(const VHbbCandidate & in, bool & ok){
133     ok = false;
134     VHbbCandidate temp=in;
135     if (temp.V.electrons.size()!=1) return in ;
136     if (temp.V.muons.size()!=0) return in ;
137     //
138 tboccali 1.2 /*pT(W) > 150 GeV (pt(W) computed using lepton px,y and PF MET x and y components)
139     pT(H) > 150 GeV
140     best btag, CSV > 0.90
141     second-best btag, CSV > 0.50
142     Dphi(W,H) > 2.95
143     no additional isolated leptons (pT > 15 GeV)
144    
145     same lepton definition as in the physics objects section
146    
147     No additional ak5PFjets (pT > 30 GeV; |eta| < 2.4)
148     MET>35. for the electron BDT analysis
149     |cos(theta * )| (TBO)
150     color flow pull angle (TBO)
151     We don't cut on the transverse mass (for boosted objects cutting on the transverse mass introduces an inefficiency due to the angle between the MET and the lepton being close to 0.)
152     */
153    
154     ok=true;
155    
156    
157 tboccali 1.1 return in;
158     }
159    
160     public:
161     bool verbose_;
162 tboccali 1.2
163     public:
164     float getDeltaTheta( const VHbbEvent::SimpleJet & j1, const VHbbEvent::SimpleJet & j2 ) const {
165     double deltaTheta = 1e10;
166     TLorentzVector pi(0,0,0,0);
167     TLorentzVector v_j1 = j1.chargedTracksFourMomentum;
168     TLorentzVector v_j2 = j2.chargedTracksFourMomentum;
169    
170     if( v_j2.Mag() == 0
171     || v_j1.Mag() == 0 )
172     return deltaTheta = 1e10;
173    
174     //use j1 to calculate the pull vector
175     TVector2 t = j1.tVector;
176    
177     if( t.Mod() == 0 )
178     return deltaTheta = 1e10;
179    
180     Double_t dphi = v_j2.Phi()- v_j1.Phi();
181     if ( dphi > M_PI ) {
182     dphi -= 2.0*M_PI;
183     } else if ( dphi <= -M_PI ) {
184     dphi += 2.0*M_PI;
185     }
186     Double_t deltaeta = v_j2.Rapidity() - v_j1.Rapidity();
187     TVector2 BBdir( deltaeta, dphi );
188    
189     deltaTheta = t.DeltaPhi(BBdir);
190    
191     return deltaTheta;
192    
193     }
194    
195 tboccali 1.1
196     };
197    
198    
199    
200     #endif
201    
202    
203    
204    
205    
206