ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/Selection/src/MuonSelection.cc
(Generate patch)

Comparing UserCode/MitHzz4l/Selection/src/MuonSelection.cc (file contents):
Revision 1.5 by khahn, Wed Oct 19 15:15:37 2011 UTC vs.
Revision 1.6 by khahn, Mon Nov 7 06:52:39 2011 UTC

# Line 1 | Line 1
1   #include <math.h>
2 + #include <iostream>
3   #include "HiggsAnaDefs.hh"
4   #include "MuonSelection.h"
5  
6 + bool isMuFO( const mithep::TMuon * mu ) {
7 +  bool isgood=true;
8 +  float reliso = mu->pfIso03/mu->pt;
9 +
10 +  if( mu->pt < 5  )         isgood=false;                          
11 +  if ( fabs(mu->dz) > 0.2 ) isgood=false;   // needed to remove cosmics in HF sample
12 +
13 +  //
14 +
15 +  // HF seems to not want tkquality, SS does
16 +  if( mu->pt>20 ) {
17 +    if ( !((mu->typeBits & kGlobal) && mu->nSeg>0  ) ) isgood=false; //&& mu->nValidHits>0
18 +  } else {
19 +    if ( !((mu->typeBits & kGlobal) && mu->nSeg>0 ) //&& //&& mu->nValidHits>0
20 +         && !( (mu->typeBits & kTracker) &&  (mu->qualityBits & kTMOneStationLoose)
21 +               )
22 +         )   isgood=false;
23 +  }
24 +
25 +
26 +  //
27 +  // for HF MC to agree w/ data, cannot put any Tk quality bits
28 +  // but to get to 5% closure in the SS test, we need at least Tk oneStationLoose
29 +
30 +  /*
31 + && ( (mu->qualityBits & kTMOneStationLoose) ||
32 +                                               (mu->qualityBits & kTMLastStationOptimizedBarrelLowPtLoose) ||
33 +                                               (mu->qualityBits & kTMLastStationOptimizedLowPtLoose)
34 +                                               )
35 +  */
36 +
37 +
38 +  // comment for more stats for mu fake shape
39 +  if( mu->pt < 20 ) {
40 +    if( reliso > 3 ) isgood=false;    
41 +  } else {
42 +    if( reliso > 5 ) isgood=false;    
43 +  }
44 +
45 +  return isgood;
46 + };
47 +
48 +
49   unsigned passSoftMuonSelection( const mithep::TMuon * mu ) {
50  
51    int level=0;
# Line 82 | Line 126 | unsigned passMuonSelection( const mithep
126    int level=0;
127    unsigned failmask=0x0;
128  
129 +  // 0x1
130    if(mu->pt < 5) {
131      failmask |= (1<<level);
132    }
133  
134 +  // 0x2
135    level++;
136    if(fabs(mu->eta) > 2.4) {
137      failmask |= (1<<level);
138    }
139  
140 +  // 0x4
141    level++;
142 <  if(mu->nTkHits          < 11) {
142 >  if(mu->ptErr/mu->pt > 0.1)   {
143      failmask |= (1<<level);
144    }
145  
146 +  // 0x8
147    level++;
148 <  if(mu->nPixHits         < 1) {
148 >  if( fabs(mu->dz) > 0.1 )   {
149      failmask |= (1<<level);
150    }
151  
152 +
153 +  Bool_t isGlobal  = (mu->typeBits & kGlobal) && (mu->muNchi2 < 10) && (mu->nMatch > 1) && (mu->nValidHits > 0);
154 +  Bool_t isTracker = (mu->typeBits & kTracker) && (mu->qualityBits & kTMLastStationTight);
155 +
156 +  // 0x10
157    level++;
158 <  if(mu->ptErr/mu->pt > 0.1)   {
158 >  if(!isGlobal && !isTracker) {
159      failmask |= (1<<level);
160    }
161  
162 +  // 0x20
163    level++;
164 <  if( fabs(mu->dz) > 0.1 )   {
164 >  if( mu->nTkHits < 11 ) {
165      failmask |= (1<<level);
166    }
167  
114
115  Bool_t isGlobal  = (mu->typeBits & kGlobal) && (mu->muNchi2 < 10) && (mu->nMatch > 1) && (mu->nValidHits > 0);
116  Bool_t isTracker = (mu->typeBits & kTracker) && (mu->qualityBits & kTMLastStationTight);
117  
168    level++;
169 <  if(!isGlobal && !isTracker) {
169 >  if(mu->nPixHits         < 1) {
170      failmask |= (1<<level);
171    }
172  
173 +
174    level++;
175    if(fabs(mu->d0)>0.02)   {
176      failmask |= (1<<level);
177    }
178 +
179    /*
180    if(mu->pt>20) {
181      if(fabs(mu->d0)>0.02)   {
# Line 138 | Line 190 | unsigned passMuonSelection( const mithep
190    return failmask;
191  
192   };
193 +
194 +
195 + unsigned passKSMuonSelection( const mithep::TMuon * mu ) {
196 +
197 +  unsigned failmask = passMuonSelection( mu );
198 +  float reliso = mu->pfIso03/mu->pt;
199 +  bool isEB = (fabs(mu->eta) < 1.479 ? 1 : 0 );  
200 +  bool failiso = false;
201 +  if( isEB && mu->pt > 20 && reliso > PFISO_MU_LOOSE_EB_HIGHPT ) {  
202 +    failiso = true;
203 +  }
204 +  if( isEB && mu->pt < 20 && reliso > PFISO_MU_LOOSE_EB_LOWPT ) {
205 +    failiso = true;
206 +  }
207 +  if( !(isEB) && mu->pt > 20 && reliso > PFISO_MU_LOOSE_EE_HIGHPT ) {
208 +    failiso = true;
209 +  }
210 +  if( !(isEB) && mu->pt < 20 && reliso > PFISO_MU_LOOSE_EE_LOWPT ) {
211 +    failiso = true;
212 +  }
213 +
214 +  if( failiso ) failmask |= 1;
215 +  return failmask;
216 +
217 + };

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines