ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UNL/macros/MyHbbAnalyzer.C
(Generate patch)

Comparing UserCode/UNL/macros/MyHbbAnalyzer.C (file contents):
Revision 1.1 by malbouis, Tue Aug 9 18:30:39 2011 UTC vs.
Revision 1.2 by malbouis, Wed Aug 10 18:04:26 2011 UTC

# Line 149 | Line 149 | bool MyHbbAnalyzer::preSelect(){
149    bool passedPreSel = true;
150    if (nMuons < 2) passedPreSel = false;
151    if (nJets < 2) passedPreSel = false;
152  // b-jets pT cut:
153  int bjets = 0;
154  for (int j = 0; j != nJets; j++){
155    if (bDisc_CSV[j] > 0) bjets++;
156  }// loop jets
157  //if (bjets < 2) passedPreSel = false;
158
152    return passedPreSel;
160
153   }// preSelect
154  
155   bool MyHbbAnalyzer::Select_pTjj(){
156    bool passedSel_pTjj = true;
157 <  if (fabs(jetEta[0]) < 2.5 && fabs(jetEta[1]) < 2.5){
158 <    TLorentzVector firstJet_p4 = TLorentzVector(jetPx[0], jetPy[0], jetPz[0], jetP[0]);
159 <    TLorentzVector secondJet_p4 = TLorentzVector(jetPx[1], jetPy[1], jetPz[1], jetP[1]);
160 <    TLorentzVector jj = firstJet_p4 + secondJet_p4;
161 <    if (jj.Pt() <= 100) passedSel_pTjj = false;
162 <  }// eta cuts
157 >  // get jet indices that maximize the CSV discriminant
158 >  int firstJetIdx, secondJetIdx;
159 >  jetIndices(firstJetIdx, secondJetIdx);
160 >  // reject event with less than 2 CSV tags
161 >  if (firstJetIdx == -1 || secondJetIdx == -1) return false;
162 >  // get the dijet system
163 >  TLorentzVector firstJet_p4 = TLorentzVector(jetPx[firstJetIdx], jetPy[firstJetIdx], jetPz[firstJetIdx], jetP[firstJetIdx]);
164 >  TLorentzVector secondJet_p4 = TLorentzVector(jetPx[secondJetIdx], jetPy[secondJetIdx], jetPz[secondJetIdx], jetP[secondJetIdx]);
165 >  TLorentzVector jj = firstJet_p4 + secondJet_p4;
166 >  if (jj.Pt() <= 100) passedSel_pTjj = false;
167    return passedSel_pTjj;
168   }// pT_jj cut
169  
170   bool MyHbbAnalyzer::Select_pTZ(){
171    bool passed_pTZ = true;
176  //if (nMuons < 2) return false;
172    TLorentzVector firstMu_p4 = TLorentzVector(muonPx[0], muonPy[0], muonPz[0], muonP[0]);
173    TLorentzVector secondMu_p4 = TLorentzVector(muonPx[1], muonPy[1], muonPz[1], muonP[1]);
174    TLorentzVector Z = firstMu_p4 + secondMu_p4;
# Line 182 | Line 177 | bool MyHbbAnalyzer::Select_pTZ(){
177   }// pT_Z cut
178  
179   bool MyHbbAnalyzer::Select_CSV1(){
180 <  // leading CSV tagged jet should satisfy the tight Operating Point (CSVT > 0.898)
180 >  // max CSV tagged jet should satisfy the tight Operating Point (CSVT > 0.898)
181    bool passedCSV1 = true;
182 +  int firstJetIdx, secondJetIdx;
183 +  jetIndices(firstJetIdx, secondJetIdx);
184    double bDiscMax;
185 <  bDiscMax = bDisc_CSV[0] > bDisc_CSV[1] ? bDisc_CSV[0]:bDisc_CSV[1];
185 >  bDiscMax = bDisc_CSV[firstJetIdx] > bDisc_CSV[secondJetIdx] ? bDisc_CSV[firstJetIdx]:bDisc_CSV[secondJetIdx];
186    if (bDiscMax <= 0.898) passedCSV1 = false;
187    return passedCSV1;
188   }// CSV1
189  
190   bool MyHbbAnalyzer::Select_CSV2(){
191 <  // second leading CSV tagged jet should satisfy CSV > 0.5
191 >  // min CSV tagged jet should satisfy CSV > 0.5
192    bool passedCSV2 = true;
193 +  int firstJetIdx, secondJetIdx;
194 +  jetIndices(firstJetIdx, secondJetIdx);
195    double bDiscMin;
196 <  bDiscMin = bDisc_CSV[0] < bDisc_CSV[1] ? bDisc_CSV[0]:bDisc_CSV[1];
196 >  bDiscMin = bDisc_CSV[firstJetIdx] < bDisc_CSV[secondJetIdx] ? bDisc_CSV[firstJetIdx]:bDisc_CSV[secondJetIdx];
197    if (bDiscMin <= 0.5) passedCSV2 = false;
198    return passedCSV2;
199   }// CSV2
# Line 204 | Line 203 | bool MyHbbAnalyzer::Select_DPhi(){
203    TLorentzVector firstMu_p4 = TLorentzVector(muonPx[0], muonPy[0], muonPz[0], muonP[0]);
204    TLorentzVector secondMu_p4 = TLorentzVector(muonPx[1], muonPy[1], muonPz[1], muonP[1]);
205    TLorentzVector Z = firstMu_p4 + secondMu_p4;
206 <  TLorentzVector firstJet_p4 = TLorentzVector(jetPx[0], jetPy[0], jetPz[0], jetP[0]);
207 <  TLorentzVector secondJet_p4 = TLorentzVector(jetPx[1], jetPy[1], jetPz[1], jetP[1]);
206 >  int firstJetIdx, secondJetIdx;
207 >  jetIndices(firstJetIdx, secondJetIdx);
208 >  TLorentzVector firstJet_p4 = TLorentzVector(jetPx[firstJetIdx], jetPy[firstJetIdx], jetPz[firstJetIdx], jetP[firstJetIdx]);
209 >  TLorentzVector secondJet_p4 = TLorentzVector(jetPx[secondJetIdx], jetPy[secondJetIdx], jetPz[secondJetIdx], jetP[secondJetIdx]);
210    TLorentzVector jj = firstJet_p4 + secondJet_p4;
211 <  if (Z.DeltaPhi(jj) <= 2.90) passedDPhi = false;
211 >  if (fabs(Z.DeltaPhi(jj)) <= 2.90) passedDPhi = false;
212    return passedDPhi;
213   }// DPhi
214  
# Line 219 | Line 220 | bool MyHbbAnalyzer::Select_Naj(){
220  
221   bool  MyHbbAnalyzer::Select_Mjj(){
222    bool passedMjj = true;
223 <  TLorentzVector firstJet_p4 = TLorentzVector(jetPx[0], jetPy[0], jetPz[0], jetP[0]);
224 <  TLorentzVector secondJet_p4 = TLorentzVector(jetPx[1], jetPy[1], jetPz[1], jetP[1]);
223 >  int firstJetIdx, secondJetIdx;
224 >  jetIndices(firstJetIdx, secondJetIdx);
225 >  TLorentzVector firstJet_p4 = TLorentzVector(jetPx[firstJetIdx], jetPy[firstJetIdx], jetPz[firstJetIdx], jetP[firstJetIdx]);
226 >  TLorentzVector secondJet_p4 = TLorentzVector(jetPx[secondJetIdx], jetPy[secondJetIdx], jetPz[secondJetIdx], jetP[secondJetIdx]);
227    TLorentzVector jj = firstJet_p4 + secondJet_p4;
228    if (jj.M() < 95 || jj.M() > 125) passedMjj = false;
229    return passedMjj;
230   }
231 + void MyHbbAnalyzer::jetIndices(int &index1, int &index2){
232 +  int fJetIdx = -1, sJetIdx = -1;
233 +  double highestBdiscSum = 0;
234 +  for (int i = 0; i != nJets; ++i){
235 +    if (bDisc_CSV[i] < 0) continue;
236 +    for (int j = i+1; j != nJets; ++j){
237 +      if (bDisc_CSV[j] < 0) continue;
238 +      if (bDisc_CSV[i] + bDisc_CSV[j] > highestBdiscSum){
239 +        highestBdiscSum = bDisc_CSV[i] + bDisc_CSV[j];
240 +        fJetIdx = i;
241 +        sJetIdx = j;
242 +      }// if greater sum
243 +    }// second loop
244 +  }// 1st loop
245 +  swap(fJetIdx, index1);
246 +  swap(sJetIdx, index2);
247 + }// jetIndices
248  
249   void MyHbbAnalyzer::basicMuonDistributions(string cut){
250    // var definition

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines