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.16 by khahn, Wed May 9 20:03:49 2012 UTC vs.
Revision 1.24 by anlevin, Sat Jun 2 11:59:13 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 + bool trackToPFMuonSelection( const mithep::Track *track, const mithep::MuonCol * muoncol )
23 + {
24 +        bool pass = false;
25 +  for(UInt_t i=0; i<muoncol->GetEntries(); ++i) {
26 +    const mithep::Muon *mu = muoncol->At(i);
27 +                if(mu->TrackerTrk() == track && (mu->IsGlobalMuon() || mu->IsTrackerMuon()) && mu->IsPFMuon())
28 +                        pass = true;
29 +        }              
30 +                
31 +        return pass;            
32 +                
33 + }
34 +
35   //--------------------------------------------------------------------------------------------------
36   SelectionStatus muonDummyVeto(ControlFlags &ctrl,
37                                const mithep::Muon *muon,
38 <                              const mithep::Vertex &vtx)
38 >                              const mithep::Vertex * vtx)
39   //--------------------------------------------------------------------------------------------------
40   {
41    SelectionStatus status;
# Line 32 | Line 46 | SelectionStatus muonDummyVeto(ControlFla
46   //--------------------------------------------------------------------------------------------------
47   SelectionStatus muonCutBasedVeto(ControlFlags &ctrl,
48                                   const mithep::Muon *muon,
49 <                                 const mithep::Vertex &vtx)
49 >                                 const mithep::Vertex *vtx)
50   //--------------------------------------------------------------------------------------------------
51   {
52    //
# Line 64 | Line 78 | SelectionStatus noPreSelection( ControlF
78   //--------------------------------------------------------------------------------------------------
79   SelectionStatus muonPreSelection( ControlFlags &ctrl,  
80                                    const mithep::Muon * mu,
81 <                                  const mithep::Vertex & vtx,
81 >                                  const mithep::Vertex * vtx,
82                                    const mithep::Array<mithep::PFCandidate> * pfCandidates )
83   //--------------------------------------------------------------------------------------------------
84   {
85    bool ret = true;
86 <  if(ctrl.debug) cout << "inside muonpresel ... " << endl;
87 <  //  bool ret = isMuFO(mu,vtx,pfCandidates);
74 <  if(ctrl.debug) cout << "iS fo? ... " << ret << endl;  
75 <  ret &= ( fabs(mu->Ip3dPVSignificance()) < 4 );
76 <  if(ctrl.debug) cout << "and pass IP (" << mu->Ip3dPVSignificance() << ") ? ... " << ret << endl;  
86 >
87 >  ret &= ( fabs(mu->Ip3dPVSignificance()) < 100 );
88    ret &= ( mu->Pt() >= 5 );
78  if(ctrl.debug) cout << "and >5 GeV (" << mu->Pt() << ") ? ... " << ret << endl;  
89    ret &= ( fabs(mu->Eta()) <= 2.4 );
80  if(ctrl.debug) cout << "and < 2.4 eta (" << mu->Eta() << ")? ... " << ret << endl;  
90    ret &= ( mu->IsTrackerMuon() || mu->IsGlobalMuon() );
91 <  if(ctrl.debug) cout << "is Tracker or Global? ... " << ret << endl;  
92 <  if( mu->IsTrackerMuon() && mu->HasTrackerTrk() && !mu->IsGlobalMuon() )  
93 <    ret &=  ( mu->Quality().QualityMask().Mask() & mithep::MuonQuality::AllArbitrated);
85 <  if(ctrl.debug) cout << "if isTrackerMuon, arbitrated ? ... " << ret << endl;  
86 <  ret &= ( fabs(mu->BestTrk()->DzCorrected(vtx)) < 0.1 );  
87 <  if( ctrl.debug ) cout << "elepresel : ret after dZcorr : " << ret <<  endl;
88 <
91 > //   if( mu->IsTrackerMuon() && mu->HasTrackerTrk() && !mu->IsGlobalMuon() )  
92 > //     ret &=  ( mu->Quality().QualityMask().Mask() & mithep::MuonQuality::AllArbitrated);
93 >  ret &= (  mu->IsoR03SumPt()/mu->Pt() < 0.7 );
94  
95    SelectionStatus status;
96    if( ret ) status.setStatus(SelectionStatus::PRESELECTION);
# Line 98 | Line 103 | SelectionStatus muonPreSelection( Contro
103   //--------------------------------------------------------------------------------------------------
104   SelectionStatus muonReferencePreSelection( ControlFlags &ctrl,  
105                                             const mithep::Muon * mu,
106 <                                           const mithep::Vertex & vtx,
106 >                                           const mithep::Vertex * vtx,
107                                             const mithep::Array<mithep::PFCandidate> * pfCandidates )
108   //--------------------------------------------------------------------------------------------------
109   {
110    bool ret = true;
111 +
112    if(ctrl.debug) cout << "inside muonpresel ... " << endl;
113    ret &= ( fabs(mu->Ip3dPVSignificance()) < 100 );
114    if(ctrl.debug) cout << "and pass IP (" << mu->Ip3dPVSignificance() << ") ? ... " << ret << endl;  
# Line 111 | Line 117 | SelectionStatus muonReferencePreSelectio
117    ret &= ( fabs(mu->Eta()) <= 2.4 );
118    if(ctrl.debug) cout << "and < 2.4 eta (" << mu->Eta() << ")? ... " << ret << endl;  
119    ret &= ( mu->IsTrackerMuon() || mu->IsGlobalMuon() );
120 <  if(ctrl.debug) cout << "is Tracker or Global? ... " << ret << endl;  
120 >  if(ctrl.debug) cout << "is Tracker or Global? ... " << ret << endl;
121 >        ret &= (mu->HasTrackerTrk() &&
122 >                mu->TrackerTrk()->D0Corrected(*vtx) < 0.5
123 >                && mu->TrackerTrk()->DzCorrected(*vtx) < 1.0);
124 >  if(ctrl.debug) cout << "d0 and dz? ... " << ret << endl;  
125 >          
126    //  if( mu->IsTrackerMuon() && mu->HasTrackerTrk() && !mu->IsGlobalMuon() )  
127    //    ret &=  ( mu->Quality().QualityMask().Mask() & mithep::MuonQuality::AllArbitrated);
128    //  if(ctrl.debug) cout << "if isTrackerMuon, arbitrated ? ... " << ret << endl;  
# Line 131 | Line 142 | SelectionStatus muonReferencePreSelectio
142   //--------------------------------------------------------------------------------------------------
143   SelectionStatus muonIDMVASelection(ControlFlags &ctrl,
144                                   const mithep::Muon *mu,
145 <                                 const mithep::Vertex & vtx   )
145 >                                 const mithep::Vertex * vtx   )
146   //--------------------------------------------------------------------------------------------------
147   {
148    double global_rchi2 = (mu->IsGlobalMuon()) ? mu->GlobalTrk()->RChi2() : 0.;
# Line 205 | Line 216 | void initMuonIDMVA()
216   //--------------------------------------------------------------------------------------------------
217   SelectionStatus muonIDPFSelection(ControlFlags &ctrl,
218                                    const mithep::Muon *mu,
219 <                                  const mithep::Vertex & vtx,
219 >                                  const mithep::Vertex * vtx,
220                                    const mithep::Array<mithep::PFCandidate> * pfCandidates )
221   //--------------------------------------------------------------------------------------------------
222   {
# Line 214 | Line 225 | SelectionStatus muonIDPFSelection(Contro
225  
226    // check that it matches to a PF muon
227    for( int i=0; i<pfCandidates->GetEntries(); i++ ) {
228 +    // tmp
229 +    if( !(PFnoPUflag[i]) ) continue; // my PF no PU hack
230 +
231      const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*pfCandidates)[i]);
232 <    if( pf->HasTrackerTrk() ) {
233 <      if( (pf->TrackerTrk() == mu->TrackerTrk()) && abs(pf->PFType()) == mithep::PFCandidate::eMuon ) {
234 <        pass = true;
221 <        break;
222 <      }
232 >    if( (pf->TrackerTrk() == mu->TrackerTrk()) && abs(pf->PFType()) == mithep::PFCandidate::eMuon ) {
233 >      pass = true;
234 >      break;
235      }
236    }
237 + //      
238 + //      if(mu->IsPFMuon()) pass = true;
239 + //      else pass = false;
240  
241    //
242    // NB : ipsig here for reference synch ...
243    //
244 + #ifdef SYNC
245    if( pass && fabs(mu->Ip3dPVSignificance()) < 4 ) {
246      status.orStatus(SelectionStatus::LOOSEID);
247      status.orStatus(SelectionStatus::TIGHTID);
248    }
249 + #else
250 +  if( pass ) {
251 +    status.orStatus(SelectionStatus::LOOSEID);
252 +    status.orStatus(SelectionStatus::TIGHTID);
253 +  }
254 + #endif
255  
256    return status;
257   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines