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.27 by khahn, Mon May 28 16:34:44 2012 UTC vs.
Revision 1.30 by khahn, Tue Jun 5 19:35:47 2012 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines