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

Comparing UserCode/MitHzz4l/LeptonSelection/src/MuonSelection.cc (file contents):
Revision 1.12 by khahn, Sat May 5 13:09:05 2012 UTC vs.
Revision 1.22 by anlevin, Mon May 28 12:37:10 2012 UTC

# Line 13 | Line 13
13   mithep::MuonIDMVA * muIDMVA;
14   mithep::MuonTools muTools;
15  
16 + extern vector<bool> PFnoPUflag;
17   extern Float_t computePFMuonIso(const mithep::Muon *mu,
18 <                        const mithep::Vertex & vtx,
18 >                        const mithep::Vertex * vtx,
19                          const mithep::Array<mithep::PFCandidate> * pfCandidates,
20                          const Double_t dRMax);
21  
22   //--------------------------------------------------------------------------------------------------
23   SelectionStatus muonDummyVeto(ControlFlags &ctrl,
24                                const mithep::Muon *muon,
25 <                              const mithep::Vertex &vtx)
25 >                              const mithep::Vertex * vtx)
26   //--------------------------------------------------------------------------------------------------
27   {
28    SelectionStatus status;
# Line 32 | Line 33 | SelectionStatus muonDummyVeto(ControlFla
33   //--------------------------------------------------------------------------------------------------
34   SelectionStatus muonCutBasedVeto(ControlFlags &ctrl,
35                                   const mithep::Muon *muon,
36 <                                 const mithep::Vertex &vtx)
36 >                                 const mithep::Vertex *vtx)
37   //--------------------------------------------------------------------------------------------------
38   {
39    //
# Line 64 | Line 65 | SelectionStatus noPreSelection( ControlF
65   //--------------------------------------------------------------------------------------------------
66   SelectionStatus muonPreSelection( ControlFlags &ctrl,  
67                                    const mithep::Muon * mu,
68 <                                  const mithep::Vertex & vtx,
68 >                                  const mithep::Vertex * vtx,
69                                    const mithep::Array<mithep::PFCandidate> * pfCandidates )
70   //--------------------------------------------------------------------------------------------------
71   {
72    bool ret = true;
73 +
74 +  ret &= ( fabs(mu->Ip3dPVSignificance()) < 100 );
75 +  ret &= ( mu->Pt() >= 5 );
76 +  ret &= ( fabs(mu->Eta()) <= 2.4 );
77 +  ret &= ( mu->IsTrackerMuon() || mu->IsGlobalMuon() );
78 + //   if( mu->IsTrackerMuon() && mu->HasTrackerTrk() && !mu->IsGlobalMuon() )  
79 + //     ret &=  ( mu->Quality().QualityMask().Mask() & mithep::MuonQuality::AllArbitrated);
80 +  ret &= (  mu->IsoR03SumPt()/mu->Pt() < 0.7 );
81 +
82 +  SelectionStatus status;
83 +  if( ret ) status.setStatus(SelectionStatus::PRESELECTION);
84 +  if(ctrl.debug) cout << "muon presel returning status : " << status.getStatus() << endl;  
85 +  return status;
86 + }
87 +
88 +
89 +
90 + //--------------------------------------------------------------------------------------------------
91 + SelectionStatus muonReferencePreSelection( ControlFlags &ctrl,  
92 +                                           const mithep::Muon * mu,
93 +                                           const mithep::Vertex * vtx,
94 +                                           const mithep::Array<mithep::PFCandidate> * pfCandidates )
95 + //--------------------------------------------------------------------------------------------------
96 + {
97 +  bool ret = true;
98 +
99    if(ctrl.debug) cout << "inside muonpresel ... " << endl;
100 <  //  bool ret = isMuFO(mu,vtx,pfCandidates);
74 <  if(ctrl.debug) cout << "iS fo? ... " << ret << endl;  
75 <  ret &= ( fabs(mu->Ip3dPVSignificance()) < 4 );
100 >  ret &= ( fabs(mu->Ip3dPVSignificance()) < 100 );
101    if(ctrl.debug) cout << "and pass IP (" << mu->Ip3dPVSignificance() << ") ? ... " << ret << endl;  
102 <  ret &= ( mu->Pt() > 5 );
102 >  ret &= ( mu->Pt() >= 5 );
103    if(ctrl.debug) cout << "and >5 GeV (" << mu->Pt() << ") ? ... " << ret << endl;  
104    ret &= ( fabs(mu->Eta()) <= 2.4 );
105    if(ctrl.debug) cout << "and < 2.4 eta (" << mu->Eta() << ")? ... " << ret << endl;  
106    ret &= ( mu->IsTrackerMuon() || mu->IsGlobalMuon() );
107 <  if(ctrl.debug) cout << "is Tracker or Global? ... " << ret << endl;  
108 <  if( mu->IsTrackerMuon() && mu->HasTrackerTrk() && !mu->IsGlobalMuon() )  
109 <    ret &=  ( mu->Quality().QualityMask().Mask() & mithep::MuonQuality::AllArbitrated);
110 <  if(ctrl.debug) cout << "if isTrackerMuon, arbitrated ? ... " << ret << endl;  
111 <  ret &= ( mu->BestTrk()->DzCorrected(vtx) < 0.1);  
112 <  if( ctrl.debug ) cout << "elepresel : ret after dZcorr : " << ret <<  endl;
107 >  if(ctrl.debug) cout << "is Tracker or Global? ... " << ret << endl;
108 >        ret &= (mu->HasTrackerTrk() && mu->TrackerTrk()->D0Corrected(*vtx) < 0.5 && mu->TrackerTrk()->DzCorrected(*vtx) < 1.0);
109 >  if(ctrl.debug) cout << "d0 and dz? ... " << ret << endl;  
110 >          
111 >  //  if( mu->IsTrackerMuon() && mu->HasTrackerTrk() && !mu->IsGlobalMuon() )  
112 >  //    ret &=  ( mu->Quality().QualityMask().Mask() & mithep::MuonQuality::AllArbitrated);
113 >  //  if(ctrl.debug) cout << "if isTrackerMuon, arbitrated ? ... " << ret << endl;  
114 >  //  ret &= ( mu->BestTrk()->DzCorrected(vtx) < 0.1);  
115 >  //  if( ctrl.debug ) cout << "elepresel : ret after dZcorr : " << ret <<  endl;
116  
117  
118    SelectionStatus status;
# Line 99 | Line 127 | SelectionStatus muonPreSelection( Contro
127   //--------------------------------------------------------------------------------------------------
128   SelectionStatus muonIDMVASelection(ControlFlags &ctrl,
129                                   const mithep::Muon *mu,
130 <                                 const mithep::Vertex & vtx   )
130 >                                 const mithep::Vertex * vtx   )
131   //--------------------------------------------------------------------------------------------------
132   {
133    double global_rchi2 = (mu->IsGlobalMuon()) ? mu->GlobalTrk()->RChi2() : 0.;
134  
135 +  //
136 +  // WARNING !!! KH hacked out to sync
137 +  //
138 +  /*
139    double mvaval = muIDMVA->MVAValue_ID(mu->Pt(),
140                                      mu->Eta(),
141                                      mu->IsGlobalMuon(),
# Line 122 | Line 154 | SelectionStatus muonIDMVASelection(Contr
154                                      mu->HadS9Energy(),
155                                      mu->EmS9Energy(),
156                                      (Bool_t)(ctrl.debug) );
157 <
157 >  */
158 >  double mvaval = 0.0;
159  
160    SelectionStatus status;
161    bool pass = false;
# Line 168 | Line 201 | void initMuonIDMVA()
201   //--------------------------------------------------------------------------------------------------
202   SelectionStatus muonIDPFSelection(ControlFlags &ctrl,
203                                    const mithep::Muon *mu,
204 <                                  const mithep::Vertex & vtx,
204 >                                  const mithep::Vertex * vtx,
205                                    const mithep::Array<mithep::PFCandidate> * pfCandidates )
206   //--------------------------------------------------------------------------------------------------
207   {
# Line 177 | Line 210 | SelectionStatus muonIDPFSelection(Contro
210  
211    // check that it matches to a PF muon
212    for( int i=0; i<pfCandidates->GetEntries(); i++ ) {
213 +    // tmp
214 +    if( !(PFnoPUflag[i]) ) continue; // my PF no PU hack
215 +
216      const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*pfCandidates)[i]);
217 <    if( pf->HasTrackerTrk() ) {
218 <      if( (pf->TrackerTrk() == mu->TrackerTrk()) && abs(pf->PFType()) == mithep::PFCandidate::eMuon ) {
219 <        pass = true;
184 <        break;
185 <      }
217 >    if( (pf->TrackerTrk() == mu->TrackerTrk()) && abs(pf->PFType()) == mithep::PFCandidate::eMuon ) {
218 >      pass = true;
219 >      break;
220      }
221    }
222 + //      
223 + //      if(mu->IsPFMuon()) pass = true;
224 + //      else pass = false;
225  
226 +  //
227 +  // NB : ipsig here for reference synch ...
228 +  //
229 + #ifdef SYNC
230 +  if( pass && fabs(mu->Ip3dPVSignificance()) < 4 ) {
231 +    status.orStatus(SelectionStatus::LOOSEID);
232 +    status.orStatus(SelectionStatus::TIGHTID);
233 +  }
234 + #else
235    if( pass ) {
236      status.orStatus(SelectionStatus::LOOSEID);
237      status.orStatus(SelectionStatus::TIGHTID);
238    }
239 + #endif
240  
241    return status;
242   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines