ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/Selection/src/MuonSelection.cc
Revision: 1.7
Committed: Mon Feb 13 09:41:50 2012 UTC (13 years, 3 months ago) by khahn
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +0 -0 lines
State: FILE REMOVED
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 khahn 1.1 #include <math.h>
2 khahn 1.6 #include <iostream>
3 dkralph 1.2 #include "HiggsAnaDefs.hh"
4 khahn 1.1 #include "MuonSelection.h"
5    
6 khahn 1.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 khahn 1.3 unsigned passSoftMuonSelection( const mithep::TMuon * mu ) {
50 khahn 1.1
51 khahn 1.3 int level=0;
52     unsigned failmask=0x0;
53    
54     if(mu->nTkHits < 11 )
55     failmask |= (1<<level);
56     level++;
57    
58     if(fabs(mu->d0) > 0.2)
59     failmask |= (1<<level);
60     level++;
61    
62     if(fabs(mu->dz) > 0.1)
63     failmask |= (1<<level);
64     level++;
65    
66     if(!(mu->typeBits & kTracker))
67     failmask |= (1<<level);
68     level++;
69    
70     if(!(mu->qualityBits & kTMLastStationAngTight))
71     failmask |= (1<<level);
72     level++;
73    
74     Double_t iso = (mu->trkIso03 + mu->emIso03 + mu->hadIso03)/mu->pt;
75     if(mu->pt>20 && iso<0.1)
76     failmask |= (1<<level);
77     }
78    
79    
80 khahn 1.1 unsigned passMuonSelectionZZ( const mithep::TMuon * mu ) {
81     int level=0;
82     unsigned failmask=0x0;
83    
84     if(mu->pt < 5) {
85     failmask |= (1<<level);
86     }
87    
88     level++;
89     if(fabs(mu->eta) > 2.4) {
90     failmask |= (1<<level);
91     }
92    
93     level++;
94     if(!(mu->typeBits & kGlobal)) {
95     failmask |= (1<<level);
96     }
97    
98     level++;
99     if(mu->nTkHits < 10) {
100     failmask |= (1<<level);
101     }
102    
103    
104     level++;
105     if( (mu->trkIso03/mu->pt) > 0.7 ) {
106     failmask |= (1<<level);
107     }
108    
109     // if(muon->nPixHits < 1) return false;
110     // if(muon->muNchi2 > 10) return false;
111     // if(muon->nMatch < 2) return false;
112     // if(muon->nValidHits < 1) return false;
113     // if(muon->pterr/muon->pt > 0.1) return false;
114     // if(fabs(muon->dz) > 0.1) return false;
115    
116    
117     return failmask;
118    
119     };
120 khahn 1.4
121    
122     //
123     // Kevin's WW selection
124     //
125     unsigned passMuonSelection( const mithep::TMuon * mu ) {
126     int level=0;
127     unsigned failmask=0x0;
128    
129 khahn 1.6 // 0x1
130 khahn 1.4 if(mu->pt < 5) {
131     failmask |= (1<<level);
132     }
133    
134 khahn 1.6 // 0x2
135 khahn 1.4 level++;
136     if(fabs(mu->eta) > 2.4) {
137     failmask |= (1<<level);
138     }
139    
140 khahn 1.6 // 0x4
141 khahn 1.4 level++;
142 khahn 1.6 if(mu->ptErr/mu->pt > 0.1) {
143 khahn 1.4 failmask |= (1<<level);
144     }
145    
146 khahn 1.6 // 0x8
147 khahn 1.4 level++;
148 khahn 1.6 if( fabs(mu->dz) > 0.1 ) {
149 khahn 1.4 failmask |= (1<<level);
150     }
151    
152 khahn 1.6
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 khahn 1.4 level++;
158 khahn 1.6 if(!isGlobal && !isTracker) {
159 khahn 1.4 failmask |= (1<<level);
160     }
161    
162 khahn 1.6 // 0x20
163 khahn 1.4 level++;
164 khahn 1.6 if( mu->nTkHits < 11 ) {
165 khahn 1.4 failmask |= (1<<level);
166     }
167    
168     level++;
169 khahn 1.6 if(mu->nPixHits < 1) {
170 khahn 1.4 failmask |= (1<<level);
171     }
172    
173 khahn 1.6
174 khahn 1.4 level++;
175     if(fabs(mu->d0)>0.02) {
176     failmask |= (1<<level);
177     }
178 khahn 1.6
179 khahn 1.4 /*
180     if(mu->pt>20) {
181     if(fabs(mu->d0)>0.02) {
182     failmask |= (1<<level);
183     }
184     } else {
185     if(fabs(mu->d0)>0.01) {
186     failmask |= (1<<level);
187     }
188     }
189     */
190     return failmask;
191    
192     };
193 khahn 1.6
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     };