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

Comparing UserCode/MitHzz4l/LeptonSelection/src/IsolationSelection.cc (file contents):
Revision 1.22 by anlevin, Tue May 22 22:31:17 2012 UTC vs.
Revision 1.33 by anlevin, Wed Oct 17 01:31:22 2012 UTC

# Line 468 | Line 468 | SelectionStatus muonIsoMVASelection(Cont
468    double rho = 0;
469    if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho())))
470      rho = fPUEnergyDensity->At(0)->Rho();
471 +
472   //   if (!(isnan(fPUEnergyDensity->At(0)->RhoLowEta()) || isinf(fPUEnergyDensity->At(0)->RhoLowEta())))
473   //     rho = fPUEnergyDensity->At(0)->RhoLowEta();
474    
# Line 961 | Line 962 | double  muonPFIso04(ControlFlags &ctrl,
962                      const mithep::Array<mithep::PFCandidate> * fPFCandidates,
963                      const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity,
964                      mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion,
965 <                    vector<const mithep::Muon*> muonsToVeto,
965 <                    vector<const mithep::Electron*> electronsToVeto)
965 >                    vector<const mithep::PFCandidate*> photonsToVeto)
966   //--------------------------------------------------------------------------------------------------
967   {
968  
969    extern double gChargedIso;  
970    extern double  gGammaIso;      
971    extern double  gNeutralIso;
972  
973  if( ctrl.debug ) {
974    cout << "muonIsoMVASelection :: muons to veto " << endl;
975    for( int i=0; i<muonsToVeto.size(); i++ ) {
976      const mithep::Muon * vmu = muonsToVeto[i];
977      cout << "\tpt: " << vmu->Pt()
978           << "\teta: " << vmu->Eta()
979           << "\tphi: " << vmu->Phi()
980           << endl;
981    }
982    cout << "muonIsoMVASelection :: electrson to veto " << endl;
983    for( int i=0; i<electronsToVeto.size(); i++ ) {
984      const mithep::Electron * vel = electronsToVeto[i];
985      cout << "\tpt: " << vel->Pt()
986           << "\teta: " << vel->Eta()
987           << "\tphi: " << vel->Phi()
988           << endl;
989    }
990  }
972  
973    //
974    // final iso
# Line 1004 | Line 985 | double  muonPFIso04(ControlFlags &ctrl,
985      if( !(PFnoPUflag[k]) ) continue; // my PF no PU hack
986      const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*fPFCandidates)[k]);
987  
988 +    //
989 +    // veto FSR recovered photons
990 +    //
991 +    bool vetoPhoton = false;
992 +    for( int p=0; p<photonsToVeto.size(); p++ ) {
993 +      if( pf == photonsToVeto[p] ) {
994 +        vetoPhoton = true;
995 +        break;
996 +      }
997 +    } if( vetoPhoton ) continue;
998 +    //
999 +    //
1000 +    //
1001 +
1002      Double_t deta = (mu->Eta() - pf->Eta());
1003      Double_t dphi = mithep::MathUtils::DeltaPhi(Double_t(mu->Phi()),Double_t(pf->Phi()));
1004      Double_t dr = mithep::MathUtils::DeltaR(mu->Phi(),mu->Eta(), pf->Phi(), pf->Eta());
# Line 1012 | Line 1007 | double  muonPFIso04(ControlFlags &ctrl,
1007      if (pf->HasTrackerTrk() && (pf->TrackerTrk() == mu->TrackerTrk()) ) continue;
1008  
1009      //
1015    // Lepton Footprint Removal
1016    //
1017    Bool_t IsLeptonFootprint = kFALSE;
1018    if (dr < 1.0) {
1019
1020      //
1021      // Check for electrons
1022      //
1023      for (Int_t q=0; q < electronsToVeto.size(); ++q) {
1024        const mithep::Electron *tmpele = electronsToVeto[q];
1025        // 4l electron
1026        if( pf->HasTrackerTrk() ) {
1027          if( pf->TrackerTrk() == tmpele->TrackerTrk() )
1028            IsLeptonFootprint = kTRUE;
1029        }
1030        if( pf->HasGsfTrk() ) {
1031          if( pf->GsfTrk() == tmpele->GsfTrk() )
1032            IsLeptonFootprint = kTRUE;
1033        }
1034        // PF charged
1035        if (pf->Charge() != 0 && fabs(tmpele->SCluster()->Eta()) > 1.479
1036            && mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()) < 0.015)
1037          IsLeptonFootprint = kTRUE;
1038        // PF gamma
1039        if (abs(pf->PFType()) == PFCandidate::eGamma && fabs(tmpele->SCluster()->Eta()) > 1.479
1040            && mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()) < 0.08)
1041          IsLeptonFootprint = kTRUE;
1042      } // loop over electrons
1043
1044      /* KH - comment for sync      
1045      //
1046      // Check for muons
1047      //
1048      for (Int_t q=0; q < muonsToVeto.size(); ++q) {
1049        const mithep::Muon *tmpmu = muonsToVeto[q];
1050        // 4l muon
1051        if( pf->HasTrackerTrk() ) {
1052          if( pf->TrackerTrk() == tmpmu->TrackerTrk() )
1053            IsLeptonFootprint = kTRUE;
1054        }
1055        // PF charged
1056        if (pf->Charge() != 0 && mithep::MathUtils::DeltaR(tmpmu->Phi(),tmpmu->Eta(), pf->Phi(), pf->Eta()) < 0.01)
1057          IsLeptonFootprint = kTRUE;
1058      } // loop over muons
1059      */
1060
1061    if (IsLeptonFootprint)
1062      continue;
1063
1064    //
1010      // Charged Iso
1011      //
1012      if (pf->Charge() != 0 && (pf->HasTrackerTrk()||pf->HasGsfTrk()) ) {
1013  
1014        //if( dr < 0.01 ) continue; // only for muon iso mva?
1015        if (abs(pf->PFType()) == PFCandidate::eElectron || abs(pf->PFType()) == PFCandidate::eMuon) continue;
1071
1072
1073 //       if( pf->HasTrackerTrk() ) {
1074 //      if (abs(pf->TrackerTrk()->DzCorrected(vtx)) > 0.2) continue;
1075 //      if( ctrl.debug ) cout << "charged:: " << pf->PFType() << " " << pf->Pt() << " "
1076 //                            << abs(pf->TrackerTrk()->DzCorrected(vtx)) << " "
1077 //                            << dr << endl;
1078 //       }
1079 //       if( pf->HasGsfTrk() ) {
1080 //      if (abs(pf->GsfTrk()->DzCorrected(vtx)) > 0.2) continue;
1081 //      if( ctrl.debug ) cout << "charged:: " << pf->PFType() << " " << pf->Pt() << " "
1082 //                            << abs(pf->GsfTrk()->DzCorrected(vtx)) << " "
1083 //                            << dr << endl;
1084 //       }
1085
1086
1016        fChargedIso += pf->Pt();
1017      }
1018 <
1018 >    
1019      //
1020      // Gamma Iso
1021      //
1022      else if (abs(pf->PFType()) == PFCandidate::eGamma) {
1023        // KH, add to sync
1024 <      if( pf->Pt() > 0.5 )
1024 >      if( pf->Pt() > 0.5 && dr > 0.01)
1025        fGammaIso += pf->Pt();
1026      }
1027 <
1027 >    
1028      //
1029      // Other Neutrals
1030      //
1031      else {
1032 <      // KH, add to sync
1033 <      if( pf->Pt() > 0.5 )
1032 >    
1033 >      if( pf->Pt() > 0.5  && dr > 0.01)
1034          fNeutralHadronIso += pf->Pt();
1035      }
1107    
1108    }
1109    
1036    }
1037  
1038    double rho=0;
1039 <  if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho())))
1040 <    rho = fPUEnergyDensity->At(0)->Rho();
1041 <
1042 <  // WARNING!!!!  
1043 <  // hardcode for sync ...
1044 <  EffectiveAreaVersion = muT.kMuEAData2011;
1045 <  // WARNING!!!!  
1046 <
1047 <
1039 >  if( (EffectiveAreaVersion == mithep::MuonTools::kMuEAFall11MC) ||
1040 >      (EffectiveAreaVersion == mithep::MuonTools::kMuEAData2011) ) {
1041 >    if (!(isnan(fPUEnergyDensity->At(0)->RhoKt6PFJetsForIso25()) ||
1042 >          isinf(fPUEnergyDensity->At(0)->RhoKt6PFJetsForIso25())))
1043 >      rho = fPUEnergyDensity->At(0)->RhoKt6PFJetsForIso25();
1044 >    //rho = fPUEnergyDensity->At(0)->Rho();
1045 >    // !!!!!!!!!!!!! TMP HACK FOR SYNC !!!!!!!!!!!!!!!!!!!!!
1046 >    EffectiveAreaVersion  = mithep::MuonTools::kMuEAData2011;
1047 >    // !!!!!!!!!!!!! TMP HACK FOR SYNC !!!!!!!!!!!!!!!!!!!!!
1048 >  } else {
1049 >    if (!(isnan(fPUEnergyDensity->At(0)->RhoKt6PFJetsCentralNeutral()) ||
1050 >          isinf(fPUEnergyDensity->At(0)->RhoKt6PFJetsCentralNeutral())))
1051 >      rho = fPUEnergyDensity->At(0)->RhoKt6PFJetsCentralNeutral();
1052 >    // !!!!!!!!!!!!! TMP HACK FOR SYNC !!!!!!!!!!!!!!!!!!!!!
1053 >    EffectiveAreaVersion  = mithep::MuonTools::kMuEAData2012;
1054 >    // !!!!!!!!!!!!! TMP HACK FOR SYNC !!!!!!!!!!!!!!!!!!!!!
1055 >  }
1056 >  if(ctrl.debug) cout << "rho: " << rho << endl;
1057 >
1058 >  TLorentzVector  tmpvec;
1059 >  tmpvec.SetPtEtaPhiM(mu->Pt(),mu->Eta(),mu->Phi(),mu->Mass());
1060 >  for( int p=0; p<photonsToVeto.size(); p++ ) {
1061 >    const mithep::PFCandidate * pf  = photonsToVeto[p];
1062 >    TLorentzVector pfvec;
1063 >    pfvec.SetPtEtaPhiM(pf->Pt(),pf->Eta(),pf->Phi(),0.);
1064 >    tmpvec += pfvec;
1065 >  }
1066  
1067    double pfIso = fChargedIso + fmax(0.0,(fGammaIso + fNeutralHadronIso
1068                                          -rho*muT.MuonEffectiveArea(muT.kMuGammaAndNeutralHadronIso04,
1069 <                                                                   mu->Eta(),EffectiveAreaVersion)));
1069 >                                                                   //tmpvec.Eta(),EffectiveAreaVersion)));
1070 >                                                                   mu->Eta(),EffectiveAreaVersion)));
1071    gChargedIso = fChargedIso;
1072    gGammaIso   = fGammaIso;
1073    gNeutralIso = fNeutralHadronIso;
1074    
1075 +  if( ctrl.debug ) {
1076 +    cout << "PFiso: " << pfIso
1077 +         << "\tfChargedIso: " << fChargedIso
1078 +         << "\tfGammaIso: " << fGammaIso
1079 +         << "\tfNeutralHadronIso: " << fNeutralHadronIso
1080 +         << endl;
1081 +  }
1082 +
1083    return pfIso;
1084   }
1085  
# Line 1317 | Line 1270 | SelectionStatus muonReferenceIsoSelectio
1270                                            const mithep::Array<mithep::PFCandidate> * fPFCandidates,
1271                                            const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity,
1272                                            mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion,
1273 <                                          vector<const mithep::Muon*> muonsToVeto,
1321 <                                          vector<const mithep::Electron*> electronsToVeto)
1273 >                                          vector<const mithep::PFCandidate*> photonsToVeto)
1274   //--------------------------------------------------------------------------------------------------
1275   {
1276    
1277    SelectionStatus status;
1278  
1279    double pfIso = muonPFIso04( ctrl, mu, vtx, fPFCandidates, fPUEnergyDensity,
1280 <                              EffectiveAreaVersion, muonsToVeto ,electronsToVeto );
1280 >                              EffectiveAreaVersion, photonsToVeto);
1281    //  cout << "--------------> setting muon isoPF04 to" << pfIso << endl;
1282    status.isoPF04 = pfIso;
1283    status.chisoPF04 = gChargedIso;
# Line 1334 | Line 1286 | SelectionStatus muonReferenceIsoSelectio
1286  
1287    bool pass = false;
1288    if( (pfIso/mu->Pt()) < MUON_REFERENCE_PFISO_CUT ) pass = true;
1289 <  
1289 >
1290    if( pass ) {
1291      status.orStatus(SelectionStatus::LOOSEISO);
1292      status.orStatus(SelectionStatus::TIGHTISO);
1293    }
1294 <  if(ctrl.debug) cout << "returning status : " << hex << status.getStatus() << dec << endl;
1294 >  if(ctrl.debug) {
1295 >    cout << "mu relpfIso: " << pfIso/mu->Pt() << endl;
1296 >    cout << "returning status : " << hex << status.getStatus() << dec << endl;
1297 >  }
1298    return status;
1299    
1300   }
# Line 2244 | Line 2199 | void initElectronIsoMVA() {
2199  
2200  
2201   //--------------------------------------------------------------------------------------------------
2247 // hacked version
2202   float electronPFIso04(ControlFlags &ctrl,
2203                        const mithep::Electron * ele,
2204                        const mithep::Vertex * vtx,
2205                        const mithep::Array<mithep::PFCandidate> * fPFCandidates,
2206                        const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity,
2207                        mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion,
2208 <                      vector<const mithep::Muon*> muonsToVeto,
2255 <                      vector<const mithep::Electron*> electronsToVeto)
2208 >                      vector<const mithep::PFCandidate*> photonsToVeto)        
2209   //--------------------------------------------------------------------------------------------------
2210   {
2211  
2259  if( ctrl.debug ) {
2260    cout << "electronIsoMVASelection :: muons to veto " << endl;
2261    for( int i=0; i<muonsToVeto.size(); i++ ) {
2262      const mithep::Muon * vmu = muonsToVeto[i];
2263      cout << "\tpt: " << vmu->Pt()
2264           << "\teta: " << vmu->Eta()
2265           << "\tphi: " << vmu->Phi()
2266           << endl;
2267    }
2268    cout << "electronIsoMVASelection :: electrons to veto " << endl;
2269    for( int i=0; i<electronsToVeto.size(); i++ ) {
2270      const mithep::Electron * vel = electronsToVeto[i];
2271      cout << "\tpt: " << vel->Pt()
2272           << "\teta: " << vel->Eta()
2273           << "\tphi: " << vel->Phi()
2274           << "\ttrk: " << vel->TrackerTrk()
2275           << endl;
2276    }
2277  }
2278
2279
2212    //
2213    // final iso
2214    //
# Line 2290 | Line 2222 | float electronPFIso04(ControlFlags &ctrl
2222    //
2223    for(int k=0; k<fPFCandidates->GetEntries(); ++k) {
2224  
2293
2225      const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*fPFCandidates)[k]);
2226 +
2227 +    //
2228 +    // veto FSR recovered photons
2229 +    //
2230 +    bool vetoPhoton = false;
2231 +    for( int p=0; p<photonsToVeto.size(); p++ ) {
2232 +      if( pf == photonsToVeto[p] ) {
2233 +        vetoPhoton = true;
2234 +        break;
2235 +      }
2236 +    } if( vetoPhoton ) continue;
2237 +
2238      Double_t deta = (ele->Eta() - pf->Eta());
2239      Double_t dphi = mithep::MathUtils::DeltaPhi(Double_t(ele->Phi()),Double_t(pf->Phi()));
2240      Double_t dr = mithep::MathUtils::DeltaR(ele->Phi(),ele->Eta(), pf->Phi(), pf->Eta());
# Line 2325 | Line 2268 | float electronPFIso04(ControlFlags &ctrl
2268      Bool_t IsLeptonFootprint = kFALSE;
2269      if (dr < 1.0) {
2270  
2328      //
2329      // Check for electrons
2330      //
2331      for (Int_t q=0; q < electronsToVeto.size(); ++q) {
2332        const mithep::Electron *tmpele = electronsToVeto[q];
2333        /*
2334        // 4l electron
2335        if( pf->HasTrackerTrk()  ) {
2336          if( pf->TrackerTrk() == tmpele->TrackerTrk() ) {
2337            if( ctrl.debug) cout << "\tcharged tktrk, matches 4L ele ..." << endl;
2338            IsLeptonFootprint = kTRUE;
2339          }
2340        }
2341        if( pf->HasGsfTrk()  ) {
2342          if( pf->GsfTrk() == tmpele->GsfTrk() ) {
2343            if( ctrl.debug) cout << "\tcharged gsftrk, matches 4L ele ..." << endl;
2344            IsLeptonFootprint = kTRUE;
2345          }
2346        }
2347        */
2348        // PF charged
2349        if (pf->Charge() != 0 && fabs(tmpele->SCluster()->Eta()) > 1.479
2350            && mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()) < 0.015) {
2351          if( ctrl.debug) cout << "\tcharged trk, dR matches 4L ele ..." << endl;
2352          IsLeptonFootprint = kTRUE;
2353        }
2354        // PF gamma
2355        if (abs(pf->PFType()) == PFCandidate::eGamma && fabs(tmpele->SCluster()->Eta()) > 1.479
2356            && mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()) < 0.08) {
2357          if( ctrl.debug) cout << "\tPF gamma, matches 4L ele ..." << endl;
2358          IsLeptonFootprint = kTRUE;
2359        }
2360      } // loop over electrons
2361
2362      /* KH - comment for sync            
2363      //
2364      // Check for muons
2365      //
2366      for (Int_t q=0; q < muonsToVeto.size(); ++q) {
2367        const mithep::Muon *tmpmu = muonsToVeto[q];
2368        // 4l muon
2369        if( pf->HasTrackerTrk() ) {
2370          if (pf->TrackerTrk() == tmpmu->TrackerTrk() ){
2371            if( ctrl.debug) cout << "\tmatches 4L mu ..." << endl;
2372            IsLeptonFootprint = kTRUE;
2373          }
2374        }
2375        // PF charged
2376        if (pf->Charge() != 0 && mithep::MathUtils::DeltaR(tmpmu->Phi(),tmpmu->Eta(), pf->Phi(), pf->Eta()) < 0.01) {
2377          if( ctrl.debug) cout << "\tcharged trk, dR matches 4L mu ..." << endl;
2378          IsLeptonFootprint = kTRUE;
2379        }
2380      } // loop over muons
2381      */
2382
2383    if (IsLeptonFootprint)
2384      continue;
2271  
2272      //
2273      // Charged Iso
2274      //
2275      if (pf->Charge() != 0 && (pf->HasTrackerTrk()||pf->HasGsfTrk()) ) {
2276  
2391 //       if( pf->HasTrackerTrk() )
2392 //      if (abs(pf->TrackerTrk()->DzCorrected(vtx)) > 0.2) continue;
2393 //       if( pf->HasGsfTrk() )
2394 //      if (abs(pf->GsfTrk()->DzCorrected(vtx)) > 0.2) continue;
2395
2277        // Veto any PFmuon, or PFEle
2278        if (abs(pf->PFType()) == PFCandidate::eElectron || abs(pf->PFType()) == PFCandidate::eMuon) {
2279 <         cout << "\t skipping, pf is and ele or mu .." <<endl;
2279 >        if( ctrl.debug ) cout << "\t skipping, pf is and ele or mu .." <<endl;
2280          continue;
2281        }
2282  
# Line 2417 | Line 2298 | float electronPFIso04(ControlFlags &ctrl
2298        if (fabs(ele->SCluster()->Eta()) > 1.479) {
2299          if (mithep::MathUtils::DeltaR(ele->Phi(),ele->Eta(), pf->Phi(), pf->Eta()) < 0.08) continue;
2300        }
2301 +
2302 +      assert(ele->HasSuperCluster());
2303 +      if(ele->GsfTrk()->NExpectedHitsInner()>0 && pf->MvaGamma() > 0.99 && pf->HasSCluster() && ele->SCluster() == pf->SCluster())      continue;
2304 +
2305 +
2306        if( ctrl.debug) cout << "gamma:: " << pf->Pt() << " "
2307                             << dr << endl;
2308        // KH, add to sync
# Line 2441 | Line 2327 | float electronPFIso04(ControlFlags &ctrl
2327  
2328  
2329    double rho=0;
2330 <  if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho())))
2331 <    rho = fPUEnergyDensity->At(0)->Rho();
2332 <
2333 <  // WARNING!!!!  
2334 <  // hardcode for sync ...
2335 <  EffectiveAreaVersion = eleT.kEleEAData2011;
2336 <  // WARNING!!!!  
2337 <
2330 >  if( (EffectiveAreaVersion == mithep::ElectronTools::kEleEAFall11MC) ||
2331 >      (EffectiveAreaVersion == mithep::ElectronTools::kEleEAData2011) ) {
2332 >    if (!(isnan(fPUEnergyDensity->At(0)->RhoKt6PFJetsForIso25()) ||
2333 >          isinf(fPUEnergyDensity->At(0)->RhoKt6PFJetsForIso25())))
2334 >      rho = fPUEnergyDensity->At(0)->RhoKt6PFJetsForIso25();
2335 >    // !!!!!!!!!!!!! TMP HACK FOR SYNC !!!!!!!!!!!!!!!!!!!!!
2336 >    EffectiveAreaVersion  = mithep::ElectronTools::kEleEAData2011;
2337 >    // !!!!!!!!!!!!! TMP HACK FOR SYNC !!!!!!!!!!!!!!!!!!!!!
2338 >  } else {
2339 >    if (!(isnan(fPUEnergyDensity->At(0)->RhoKt6PFJets()) ||
2340 >          isinf(fPUEnergyDensity->At(0)->RhoKt6PFJets())))
2341 >      rho = fPUEnergyDensity->At(0)->RhoKt6PFJets();
2342 >    // !!!!!!!!!!!!! TMP HACK FOR SYNC !!!!!!!!!!!!!!!!!!!!!
2343 >    EffectiveAreaVersion  = mithep::ElectronTools::kEleEAData2012;
2344 >    // !!!!!!!!!!!!! TMP HACK FOR SYNC !!!!!!!!!!!!!!!!!!!!!
2345 >  }
2346 >  if(ctrl.debug) cout << "rho: " << rho << endl;
2347  
2348    double pfIso = fChargedIso + fmax(0.0,(fGammaIso + fNeutralHadronIso
2349                                          -rho*eleT.ElectronEffectiveArea(eleT.kEleGammaAndNeutralHadronIso04,
# Line 2458 | Line 2353 | float electronPFIso04(ControlFlags &ctrl
2353    gChargedIso = fChargedIso;
2354    gGammaIso = fGammaIso;
2355    gNeutralIso = fNeutralHadronIso;  
2356 +
2357 +  if( ctrl.debug ) {
2358 +    cout << "PFiso: " << pfIso
2359 +         << "\tfChargedIso: " << fChargedIso
2360 +         << "\tfGammaIso: " << fGammaIso
2361 +         << "\tfNeutralHadronIso: " << fNeutralHadronIso
2362 +         << endl;
2363 +  }
2364 +
2365    return pfIso;
2366   }
2367  
# Line 2615 | Line 2519 | float electronPFIso04(ControlFlags &ctrl
2519  
2520        // Veto any PFmuon, or PFEle
2521        if (abs(pf->PFType()) == PFCandidate::eElectron || abs(pf->PFType()) == PFCandidate::eMuon) {
2522 <         cout << "\t skipping, pf is and ele or mu .." <<endl;
2522 >        if( ctrl.debug ) cout << "\t skipping, pf is and ele or mu .." <<endl;
2523          continue;
2524        }
2525  
# Line 2688 | Line 2592 | SelectionStatus electronReferenceIsoSele
2592                                                const mithep::Array<mithep::PFCandidate> * fPFCandidates,
2593                                                const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity,
2594                                                mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion,
2595 <                                              vector<const mithep::Muon*> muonsToVeto,
2692 <                                              vector<const mithep::Electron*> electronsToVeto)
2595 >                                              vector<const mithep::PFCandidate*> photonsToVeto)
2596   //--------------------------------------------------------------------------------------------------
2597   {
2598  
2599    SelectionStatus status;
2600  
2601    double pfIso = electronPFIso04( ctrl, ele, vtx, fPFCandidates, fPUEnergyDensity,
2602 <                                  EffectiveAreaVersion, muonsToVeto ,electronsToVeto );
2602 >                                  EffectiveAreaVersion, photonsToVeto);
2603    //  cout << "--------------> setting electron isoPF04 to " << pfIso << endl;
2604    status.isoPF04 = pfIso;
2605    status.chisoPF04 = gChargedIso;
# Line 2710 | Line 2613 | SelectionStatus electronReferenceIsoSele
2613      status.orStatus(SelectionStatus::LOOSEISO);
2614      status.orStatus(SelectionStatus::TIGHTISO);
2615    }
2616 <  if(ctrl.debug) cout << "returning status : " << hex << status.getStatus() << dec << endl;
2616 >  if(ctrl.debug) {
2617 >    cout << "el relpfIso: " << pfIso/ele->Pt() << endl;
2618 >    cout << "returning status : " << hex << status.getStatus() << dec << endl;
2619 >  }
2620    return status;
2621  
2622   }
# Line 2748 | Line 2654 | SelectionStatus electronReferenceIsoSele
2654    return status;
2655  
2656   }
2657 +
2658 +
2659 +
2660 + //--------------------------------------------------------------------------------------------------
2661 + double  dbetaCorrectedIsoDr03(ControlFlags & ctrl,
2662 +                              const mithep::PFCandidate * photon,
2663 +                              const mithep::Muon * lepton,
2664 +                              const mithep::Array<mithep::PFCandidate> * fPFCandidates)
2665 + //--------------------------------------------------------------------------------------------------
2666 + {
2667 +
2668 +  //
2669 +  // final iso
2670 +  //
2671 +  Double_t fChargedIso  = 0.0;
2672 +  Double_t fGammaIso  = 0.0;
2673 +  Double_t fNeutralHadronIso  = 0.0;
2674 +  Double_t fpfPU  = 0.0;
2675 +
2676 +  //
2677 +  // Loop over PF Candidates
2678 +  //
2679 +  for(int k=0; k<fPFCandidates->GetEntries(); ++k) {
2680 +
2681 +    const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*fPFCandidates)[k]);
2682 +    
2683 +    Double_t deta = (photon->Eta() - pf->Eta());
2684 +    Double_t dphi = mithep::MathUtils::DeltaPhi(Double_t(photon->Phi()),Double_t(pf->Phi()));
2685 +    Double_t dr = mithep::MathUtils::DeltaR(photon->Phi(),photon->Eta(), pf->Phi(), pf->Eta());
2686 +    if (dr > 0.3) continue;
2687 +
2688 +    if( !(PFnoPUflag[k]) && pf->Charge() != 0 ) {
2689 +      if( pf->Pt() >= 0.2 && dr > 0.01 )
2690 +        fpfPU += pf->Pt();
2691 +      continue;
2692 +    }
2693 +    
2694 +    //
2695 +    // skip this photon
2696 +    //
2697 +    if( abs(pf->PFType()) == mithep::PFCandidate::eGamma &&
2698 +        pf->Et() == photon->Et() ) continue;
2699 +    
2700 +      
2701 +    //
2702 +    // Charged Iso
2703 +    //
2704 +    if (pf->Charge() != 0 ) {
2705 +      if( dr > 0.01 && pf->Pt() >= 0.2 &&
2706 +          !(pf->TrackerTrk() == lepton->TrackerTrk()) )
2707 +        fChargedIso += pf->Pt();
2708 +    }
2709 +    
2710 +    //
2711 +    // Gamma Iso
2712 +    //
2713 +    else if (abs(pf->PFType()) == mithep::PFCandidate::eGamma) {
2714 +      if( pf->Pt() > 0.5 && dr > 0.01)
2715 +        fGammaIso += pf->Pt();
2716 +    }
2717 +    
2718 +    //
2719 +    // Other Neutrals
2720 +    //
2721 +    else {
2722 +      if( pf->Pt() > 0.5 && dr > 0.01)
2723 +        fNeutralHadronIso += pf->Pt();
2724 +    }
2725 +    
2726 +  }
2727 +  
2728 +  if( ctrl.debug ) {
2729 +    cout << "photon dbetaIso :: " << endl;
2730 +    cout << "\tfChargedIso: " << fChargedIso
2731 +         << "\tfGammaIso: " << fGammaIso
2732 +         << "\tfNeutralHadronIso: " << fNeutralHadronIso
2733 +         << "\tfpfPU: " << fpfPU
2734 +         << endl;
2735 +  }
2736 +  double pfIso = fChargedIso + fGammaIso + fNeutralHadronIso - 0.5*fpfPU;
2737 +  return pfIso/photon->Pt();
2738 + }
2739 +
2740 +
2741 + //--------------------------------------------------------------------------------------------------
2742 + double  dbetaCorrectedIsoDr03(ControlFlags & ctrl,
2743 +                              const mithep::PFCandidate * photon,
2744 +                              const mithep::Electron * lepton,
2745 +                              const mithep::Array<mithep::PFCandidate> * fPFCandidates)
2746 + //--------------------------------------------------------------------------------------------------
2747 + {
2748 +
2749 +  //
2750 +  // final iso
2751 +  //
2752 +  Double_t fChargedIso  = 0.0;
2753 +  Double_t fGammaIso  = 0.0;
2754 +  Double_t fNeutralHadronIso  = 0.0;
2755 +  Double_t fpfPU  = 0.0;
2756 +
2757 +  //
2758 +  // Loop over PF Candidates
2759 +  //
2760 +  for(int k=0; k<fPFCandidates->GetEntries(); ++k) {
2761 +
2762 +    const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*fPFCandidates)[k]);
2763 +    
2764 +    Double_t deta = (photon->Eta() - pf->Eta());
2765 +    Double_t dphi = mithep::MathUtils::DeltaPhi(Double_t(photon->Phi()),Double_t(pf->Phi()));
2766 +    Double_t dr = mithep::MathUtils::DeltaR(photon->Phi(),photon->Eta(), pf->Phi(), pf->Eta());
2767 +    if (dr > 0.3) continue;
2768 +
2769 +    if( !(PFnoPUflag[k]) && pf->Charge() != 0 ) {
2770 +      if( pf->Pt() >= 0.2 && dr > 0.01 )
2771 +        fpfPU += pf->Pt();
2772 +      continue;
2773 +    }
2774 +    
2775 +    //
2776 +    // skip this photon
2777 +    //
2778 +    if( abs(pf->PFType()) == mithep::PFCandidate::eGamma &&
2779 +        pf->Et() == photon->Et() ) continue;
2780 +    
2781 +      
2782 +    //
2783 +    // Charged Iso
2784 +    //
2785 +    if (pf->Charge() != 0 ) {
2786 +      if( dr > 0.01 && pf->Pt() >= 0.2 &&
2787 +          !(pf->TrackerTrk() == lepton->TrackerTrk()) )
2788 +        fChargedIso += pf->Pt();
2789 +    }
2790 +    
2791 +    //
2792 +    // Gamma Iso
2793 +    //
2794 +    else if (abs(pf->PFType()) == mithep::PFCandidate::eGamma) {
2795 +      if( pf->Pt() > 0.5 && dr > 0.01)
2796 +        fGammaIso += pf->Pt();
2797 +    }
2798 +    
2799 +    //
2800 +    // Other Neutrals
2801 +    //
2802 +    else {
2803 +      if( pf->Pt() > 0.5 && dr > 0.01)
2804 +        fNeutralHadronIso += pf->Pt();
2805 +    }
2806 +    
2807 +  }
2808 +  
2809 +  if( ctrl.debug ) {
2810 +    cout << "photon dbetaIso :: " << endl;
2811 +    cout << "\tfChargedIso: " << fChargedIso
2812 +         << "\tfGammaIso: " << fGammaIso
2813 +         << "\tfNeutralHadronIso: " << fNeutralHadronIso
2814 +         << "\tfpfPU: " << fpfPU
2815 +         << endl;
2816 +  }
2817 +  double pfIso = fChargedIso + fGammaIso + fNeutralHadronIso - 0.5*fpfPU;
2818 +  return pfIso/photon->Pt();
2819 + }
2820 +
2821 +
2822 +
2823 +
2824 +
2825 + //--------------------------------------------------------------------------------------------------
2826 + double  nonCorrectedIsoDr03(ControlFlags & ctrl,
2827 +                            const mithep::PFCandidate * photon,
2828 +                            const mithep::Muon * lepton,
2829 +                            const mithep::Array<mithep::PFCandidate> * fPFCandidates)
2830 + //--------------------------------------------------------------------------------------------------
2831 + {
2832 +
2833 +  //
2834 +  // final iso
2835 +  //
2836 +  Double_t fChargedIso  = 0.0;
2837 +  Double_t fGammaIso  = 0.0;
2838 +  Double_t fNeutralHadronIso  = 0.0;
2839 +  Double_t fpfPU  = 0.0;
2840 +
2841 +  //
2842 +  // Loop over PF Candidates
2843 +  //
2844 +  for(int k=0; k<fPFCandidates->GetEntries(); ++k) {
2845 +
2846 +    const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*fPFCandidates)[k]);
2847 +
2848 +    Double_t deta = (photon->Eta() - pf->Eta());
2849 +    Double_t dphi = mithep::MathUtils::DeltaPhi(Double_t(photon->Phi()),Double_t(pf->Phi()));
2850 +    Double_t dr = mithep::MathUtils::DeltaR(photon->Phi(),photon->Eta(), pf->Phi(), pf->Eta());
2851 +    if (dr > 0.3) continue;
2852 +
2853 +    if( !(PFnoPUflag[k]) && pf->Charge() != 0 ) {
2854 +      if( pf->Pt() >= 0.2 && dr > 0.01 )
2855 +        fpfPU += pf->Pt();
2856 +      continue;
2857 +    }
2858 +    
2859 +    //
2860 +    // skip this photon
2861 +    //
2862 +    if( abs(pf->PFType()) == mithep::PFCandidate::eGamma &&
2863 +        pf->Et() == photon->Et() ) continue;
2864 +    
2865 +      
2866 +    //
2867 +    // Charged Iso
2868 +    //
2869 +    if (pf->Charge() != 0 ) {
2870 +      if( dr > 0.01 && pf->Pt() >= 0.2 &&
2871 +          !(pf->TrackerTrk() == lepton->TrackerTrk()) )
2872 +        fChargedIso += pf->Pt();
2873 +    }
2874 +    
2875 +    //
2876 +    // Gamma Iso
2877 +    //
2878 +    else if (abs(pf->PFType()) == mithep::PFCandidate::eGamma) {
2879 +      if( pf->Pt() > 0.5 && dr > 0.01)
2880 +        fGammaIso += pf->Pt();
2881 +    }
2882 +    
2883 +    //
2884 +    // Other Neutrals
2885 +    //
2886 +    else {
2887 +      if( pf->Pt() > 0.5 && dr > 0.01)
2888 +        fNeutralHadronIso += pf->Pt();
2889 +    }
2890 +    
2891 +  }
2892 +  
2893 +  if( ctrl.debug ) {
2894 +    cout << "photon dbetaIso :: " << endl;
2895 +    cout << "\tfChargedIso: " << fChargedIso
2896 +         << "\tfGammaIso: " << fGammaIso
2897 +         << "\tfNeutralHadronIso: " << fNeutralHadronIso
2898 +         << "\tfpfPU: " << fpfPU
2899 +         << endl;
2900 +  }  
2901 +
2902 +  double pfIso = fChargedIso + fGammaIso + fNeutralHadronIso + fpfPU;
2903 +  return pfIso/photon->Pt();
2904 + }
2905 +
2906 +
2907 +
2908 + //--------------------------------------------------------------------------------------------------
2909 + double  nonCorrectedIsoDr03(ControlFlags & ctrl,
2910 +                            const mithep::PFCandidate * photon,
2911 +                            const mithep::Electron * lepton,
2912 +                            const mithep::Array<mithep::PFCandidate> * fPFCandidates)
2913 + //--------------------------------------------------------------------------------------------------
2914 + {
2915 +
2916 +  //
2917 +  // final iso
2918 +  //
2919 +  Double_t fChargedIso  = 0.0;
2920 +  Double_t fGammaIso  = 0.0;
2921 +  Double_t fNeutralHadronIso  = 0.0;
2922 +  Double_t fpfPU  = 0.0;
2923 +
2924 +  //
2925 +  // Loop over PF Candidates
2926 +  //
2927 +  for(int k=0; k<fPFCandidates->GetEntries(); ++k) {
2928 +
2929 +    const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*fPFCandidates)[k]);
2930 +
2931 +    Double_t deta = (photon->Eta() - pf->Eta());
2932 +    Double_t dphi = mithep::MathUtils::DeltaPhi(Double_t(photon->Phi()),Double_t(pf->Phi()));
2933 +    Double_t dr = mithep::MathUtils::DeltaR(photon->Phi(),photon->Eta(), pf->Phi(), pf->Eta());
2934 +    if (dr > 0.3) continue;
2935 +
2936 +    if( !(PFnoPUflag[k]) && pf->Charge() != 0 ) {
2937 +      if( pf->Pt() >= 0.2 && dr > 0.01 )
2938 +        fpfPU += pf->Pt();
2939 +      continue;
2940 +    }
2941 +    
2942 +    //
2943 +    // skip this photon
2944 +    //
2945 +    if( abs(pf->PFType()) == mithep::PFCandidate::eGamma &&
2946 +        pf->Et() == photon->Et() ) continue;
2947 +    
2948 +      
2949 +    //
2950 +    // Charged Iso
2951 +    //
2952 +    if (pf->Charge() != 0 ) {
2953 +      if( dr > 0.01 && pf->Pt() >= 0.2 &&
2954 +          !(pf->TrackerTrk() == lepton->TrackerTrk()) )
2955 +        fChargedIso += pf->Pt();
2956 +    }
2957 +    
2958 +    //
2959 +    // Gamma Iso
2960 +    //
2961 +    else if (abs(pf->PFType()) == mithep::PFCandidate::eGamma) {
2962 +      if( pf->Pt() > 0.5 && dr > 0.01)
2963 +        fGammaIso += pf->Pt();
2964 +    }
2965 +    
2966 +    //
2967 +    // Other Neutrals
2968 +    //
2969 +    else {
2970 +      if( pf->Pt() > 0.5 && dr > 0.01)
2971 +        fNeutralHadronIso += pf->Pt();
2972 +    }
2973 +    
2974 +  }
2975 +  
2976 +  if( ctrl.debug ) {
2977 +    cout << "photon dbetaIso :: " << endl;
2978 +    cout << "\tfChargedIso: " << fChargedIso
2979 +         << "\tfGammaIso: " << fGammaIso
2980 +         << "\tfNeutralHadronIso: " << fNeutralHadronIso
2981 +         << "\tfpfPU: " << fpfPU
2982 +         << endl;
2983 +  }
2984 +  double pfIso = fChargedIso + fGammaIso + fNeutralHadronIso + fpfPU;
2985 +  return pfIso/photon->Pt();
2986 + }
2987 +
2988 +
2989 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines