16 |
|
mithep::ElectronIDMVA * eleIsoMVA; |
17 |
|
mithep::ElectronTools eleT; |
18 |
|
|
19 |
+ |
// global hack to sync |
20 |
+ |
double gChargedIso; |
21 |
+ |
double gGammaIso; |
22 |
+ |
double gNeutralIso; |
23 |
+ |
|
24 |
+ |
|
25 |
|
//-------------------------------------------------------------------------------------------------- |
26 |
|
Float_t computePFMuonIso(const mithep::Muon *muon, |
27 |
|
const mithep::Vertex & vtx, |
377 |
|
IsLeptonFootprint = kTRUE; |
378 |
|
} // loop over electrons |
379 |
|
|
380 |
+ |
/* KH - commented for sync |
381 |
|
// |
382 |
|
// Check for muons |
383 |
|
// |
392 |
|
if (pf->Charge() != 0 && mithep::MathUtils::DeltaR(tmpmu->Phi(),tmpmu->Eta(), pf->Phi(), pf->Eta()) < 0.01) |
393 |
|
IsLeptonFootprint = kTRUE; |
394 |
|
} // loop over muons |
395 |
< |
|
395 |
> |
*/ |
396 |
|
|
397 |
|
if (IsLeptonFootprint) |
398 |
|
continue; |
669 |
|
&& mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()) < 0.08) |
670 |
|
IsLeptonFootprint = kTRUE; |
671 |
|
} // loop over electrons |
672 |
< |
|
672 |
> |
|
673 |
> |
// KH, comment to sync |
674 |
> |
/* |
675 |
|
// |
676 |
|
// Check for muons |
677 |
|
// |
686 |
|
if (pf->Charge() != 0 && mithep::MathUtils::DeltaR(tmpmu->Phi(),tmpmu->Eta(), pf->Phi(), pf->Eta()) < 0.01) |
687 |
|
IsLeptonFootprint = kTRUE; |
688 |
|
} // loop over muons |
689 |
+ |
*/ |
690 |
+ |
|
691 |
+ |
if (IsLeptonFootprint) |
692 |
+ |
continue; |
693 |
+ |
|
694 |
+ |
// |
695 |
+ |
// Charged Iso |
696 |
+ |
// |
697 |
+ |
if (pf->Charge() != 0 ) { |
698 |
+ |
|
699 |
+ |
//if( dr < 0.01 ) continue; // only for muon iso mva? |
700 |
+ |
if (abs(pf->PFType()) == PFCandidate::eElectron || abs(pf->PFType()) == PFCandidate::eMuon) continue; |
701 |
+ |
|
702 |
+ |
if( pf->HasTrackerTrk() ) { |
703 |
+ |
if (abs(pf->TrackerTrk()->DzCorrected(vtx)) > 0.2) continue; |
704 |
+ |
if( ctrl.debug ) cout << "charged:: " << pf->PFType() << " " << pf->Pt() << " " |
705 |
+ |
<< abs(pf->TrackerTrk()->DzCorrected(vtx)) << " " |
706 |
+ |
<< dr << endl; |
707 |
+ |
} |
708 |
+ |
if( pf->HasGsfTrk() ) { |
709 |
+ |
if (abs(pf->GsfTrk()->DzCorrected(vtx)) > 0.2) continue; |
710 |
+ |
if( ctrl.debug ) cout << "charged:: " << pf->PFType() << " " << pf->Pt() << " " |
711 |
+ |
<< abs(pf->GsfTrk()->DzCorrected(vtx)) << " " |
712 |
+ |
<< dr << endl; |
713 |
+ |
} |
714 |
|
|
715 |
|
|
716 |
+ |
fChargedIso += pf->Pt(); |
717 |
+ |
} |
718 |
+ |
|
719 |
+ |
// |
720 |
+ |
// Gamma Iso |
721 |
+ |
// |
722 |
+ |
else if (abs(pf->PFType()) == PFCandidate::eGamma) { |
723 |
+ |
// KH, add to sync |
724 |
+ |
if( pf->Pt() > 0.5 ) |
725 |
+ |
fGammaIso += pf->Pt(); |
726 |
+ |
} |
727 |
+ |
|
728 |
+ |
// |
729 |
+ |
// Other Neutrals |
730 |
+ |
// |
731 |
+ |
else { |
732 |
+ |
// KH, add to sync |
733 |
+ |
if( pf->Pt() > 0.5 ) |
734 |
+ |
fNeutralHadronIso += pf->Pt(); |
735 |
+ |
} |
736 |
+ |
|
737 |
+ |
} |
738 |
+ |
|
739 |
+ |
} |
740 |
+ |
|
741 |
+ |
double rho = 0; |
742 |
+ |
// if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
743 |
+ |
// rho = fPUEnergyDensity->At(0)->Rho(); |
744 |
+ |
if (!(isnan(fPUEnergyDensity->At(0)->RhoLowEta()) || isinf(fPUEnergyDensity->At(0)->RhoLowEta()))) |
745 |
+ |
rho = fPUEnergyDensity->At(0)->RhoLowEta(); |
746 |
+ |
|
747 |
+ |
// WARNING!!!! |
748 |
+ |
// hardcode for sync ... |
749 |
+ |
EffectiveAreaVersion = muT.kMuEAData2011; |
750 |
+ |
// WARNING!!!! |
751 |
+ |
|
752 |
+ |
|
753 |
+ |
double pfIso = fChargedIso + max(0.0,(fGammaIso + fNeutralHadronIso |
754 |
+ |
-rho*muT.MuonEffectiveArea(muT.kMuGammaAndNeutralHadronIso04, |
755 |
+ |
mu->Eta(),EffectiveAreaVersion))); |
756 |
+ |
|
757 |
+ |
gChargedIso = fChargedIso; |
758 |
+ |
gGammaIso = fGammaIso; |
759 |
+ |
gNeutralIso = fNeutralHadronIso; |
760 |
+ |
return pfIso; |
761 |
+ |
} |
762 |
+ |
|
763 |
+ |
|
764 |
+ |
//-------------------------------------------------------------------------------------------------- |
765 |
+ |
// hacked version |
766 |
+ |
double muonPFIso04(ControlFlags &ctrl, |
767 |
+ |
const mithep::Muon * mu, |
768 |
+ |
const mithep::Vertex & vtx, |
769 |
+ |
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
770 |
+ |
float rho, |
771 |
+ |
mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion, |
772 |
+ |
vector<const mithep::Muon*> muonsToVeto, |
773 |
+ |
vector<const mithep::Electron*> electronsToVeto) |
774 |
+ |
//-------------------------------------------------------------------------------------------------- |
775 |
+ |
{ |
776 |
+ |
|
777 |
+ |
extern double gChargedIso; |
778 |
+ |
extern double gGammaIso; |
779 |
+ |
extern double gNeutralIso; |
780 |
+ |
|
781 |
+ |
if( ctrl.debug ) { |
782 |
+ |
cout << "muonIsoMVASelection :: muons to veto " << endl; |
783 |
+ |
for( int i=0; i<muonsToVeto.size(); i++ ) { |
784 |
+ |
const mithep::Muon * vmu = muonsToVeto[i]; |
785 |
+ |
cout << "\tpt: " << vmu->Pt() |
786 |
+ |
<< "\teta: " << vmu->Eta() |
787 |
+ |
<< "\tphi: " << vmu->Phi() |
788 |
+ |
<< endl; |
789 |
+ |
} |
790 |
+ |
cout << "muonIsoMVASelection :: electrson to veto " << endl; |
791 |
+ |
for( int i=0; i<electronsToVeto.size(); i++ ) { |
792 |
+ |
const mithep::Electron * vel = electronsToVeto[i]; |
793 |
+ |
cout << "\tpt: " << vel->Pt() |
794 |
+ |
<< "\teta: " << vel->Eta() |
795 |
+ |
<< "\tphi: " << vel->Phi() |
796 |
+ |
<< endl; |
797 |
+ |
} |
798 |
+ |
} |
799 |
+ |
|
800 |
+ |
// |
801 |
+ |
// final iso |
802 |
+ |
// |
803 |
+ |
Double_t fChargedIso = 0.0; |
804 |
+ |
Double_t fGammaIso = 0.0; |
805 |
+ |
Double_t fNeutralHadronIso = 0.0; |
806 |
+ |
|
807 |
+ |
// |
808 |
+ |
//Loop over PF Candidates |
809 |
+ |
// |
810 |
+ |
for(int k=0; k<fPFCandidates->GetEntries(); ++k) { |
811 |
+ |
const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*fPFCandidates)[k]); |
812 |
+ |
|
813 |
+ |
Double_t deta = (mu->Eta() - pf->Eta()); |
814 |
+ |
Double_t dphi = mithep::MathUtils::DeltaPhi(Double_t(mu->Phi()),Double_t(pf->Phi())); |
815 |
+ |
Double_t dr = mithep::MathUtils::DeltaR(mu->Phi(),mu->Eta(), pf->Phi(), pf->Eta()); |
816 |
+ |
if (dr > 0.4) continue; |
817 |
+ |
|
818 |
+ |
if (pf->HasTrackerTrk() && (pf->TrackerTrk() == mu->TrackerTrk()) ) continue; |
819 |
+ |
|
820 |
+ |
// |
821 |
+ |
// Lepton Footprint Removal |
822 |
+ |
// |
823 |
+ |
Bool_t IsLeptonFootprint = kFALSE; |
824 |
+ |
if (dr < 1.0) { |
825 |
+ |
|
826 |
+ |
// |
827 |
+ |
// Check for electrons |
828 |
+ |
// |
829 |
+ |
for (Int_t q=0; q < electronsToVeto.size(); ++q) { |
830 |
+ |
const mithep::Electron *tmpele = electronsToVeto[q]; |
831 |
+ |
// 4l electron |
832 |
+ |
if( pf->HasTrackerTrk() ) { |
833 |
+ |
if( pf->TrackerTrk() == tmpele->TrackerTrk() ) |
834 |
+ |
IsLeptonFootprint = kTRUE; |
835 |
+ |
} |
836 |
+ |
if( pf->HasGsfTrk() ) { |
837 |
+ |
if( pf->GsfTrk() == tmpele->GsfTrk() ) |
838 |
+ |
IsLeptonFootprint = kTRUE; |
839 |
+ |
} |
840 |
+ |
// PF charged |
841 |
+ |
if (pf->Charge() != 0 && fabs(tmpele->SCluster()->Eta()) > 1.479 |
842 |
+ |
&& mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()) < 0.015) |
843 |
+ |
IsLeptonFootprint = kTRUE; |
844 |
+ |
// PF gamma |
845 |
+ |
if (abs(pf->PFType()) == PFCandidate::eGamma && fabs(tmpele->SCluster()->Eta()) > 1.479 |
846 |
+ |
&& mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()) < 0.08) |
847 |
+ |
IsLeptonFootprint = kTRUE; |
848 |
+ |
} // loop over electrons |
849 |
+ |
|
850 |
+ |
/* KH - comment for sync |
851 |
+ |
// |
852 |
+ |
// Check for muons |
853 |
+ |
// |
854 |
+ |
for (Int_t q=0; q < muonsToVeto.size(); ++q) { |
855 |
+ |
const mithep::Muon *tmpmu = muonsToVeto[q]; |
856 |
+ |
// 4l muon |
857 |
+ |
if( pf->HasTrackerTrk() ) { |
858 |
+ |
if( pf->TrackerTrk() == tmpmu->TrackerTrk() ) |
859 |
+ |
IsLeptonFootprint = kTRUE; |
860 |
+ |
} |
861 |
+ |
// PF charged |
862 |
+ |
if (pf->Charge() != 0 && mithep::MathUtils::DeltaR(tmpmu->Phi(),tmpmu->Eta(), pf->Phi(), pf->Eta()) < 0.01) |
863 |
+ |
IsLeptonFootprint = kTRUE; |
864 |
+ |
} // loop over muons |
865 |
+ |
*/ |
866 |
+ |
|
867 |
|
if (IsLeptonFootprint) |
868 |
|
continue; |
869 |
|
|
870 |
|
// |
871 |
< |
// Charged Iso Rings |
871 |
> |
// Charged Iso |
872 |
|
// |
873 |
|
if (pf->Charge() != 0 && (pf->HasTrackerTrk()||pf->HasGsfTrk()) ) { |
874 |
|
|
900 |
|
} |
901 |
|
|
902 |
|
// |
903 |
< |
// Other Neutral Iso Rings |
903 |
> |
// Other Neutrals |
904 |
|
// |
905 |
|
else { |
906 |
< |
fNeutralHadronIso += pf->Pt(); |
906 |
> |
// KH, add to sync |
907 |
> |
if( pf->Pt() > 0.5 ) |
908 |
> |
fNeutralHadronIso += pf->Pt(); |
909 |
|
} |
910 |
|
|
911 |
|
} |
912 |
|
|
913 |
|
} |
914 |
|
|
915 |
< |
double rho = 0; |
916 |
< |
if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
917 |
< |
rho = fPUEnergyDensity->At(0)->Rho(); |
915 |
> |
// double rho = 0; |
916 |
> |
// if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
917 |
> |
// rho = fPUEnergyDensity->At(0)->Rho(); |
918 |
|
|
919 |
|
// WARNING!!!! |
920 |
|
// hardcode for sync ... |
925 |
|
double pfIso = fChargedIso + max(0.0,(fGammaIso + fNeutralHadronIso |
926 |
|
-rho*muT.MuonEffectiveArea(muT.kMuGammaAndNeutralHadronIso04, |
927 |
|
mu->Eta(),EffectiveAreaVersion))); |
928 |
+ |
gChargedIso = fChargedIso; |
929 |
+ |
gGammaIso = fGammaIso; |
930 |
+ |
gNeutralIso = fNeutralHadronIso; |
931 |
|
|
932 |
|
return pfIso; |
933 |
|
} |
934 |
|
|
935 |
+ |
|
936 |
|
//-------------------------------------------------------------------------------------------------- |
937 |
|
SelectionStatus muonReferenceIsoSelection(ControlFlags &ctrl, |
938 |
|
const mithep::Muon * mu, |
946 |
|
{ |
947 |
|
|
948 |
|
SelectionStatus status; |
949 |
< |
|
949 |
> |
|
950 |
|
double pfIso = muonPFIso04( ctrl, mu, vtx, fPFCandidates, fPUEnergyDensity, |
951 |
|
EffectiveAreaVersion, muonsToVeto ,electronsToVeto ); |
952 |
+ |
cout << "--------------> setting muon isoPF04 to" << pfIso << endl; |
953 |
+ |
status.isoPF04 = pfIso; |
954 |
+ |
status.chisoPF04 = gChargedIso; |
955 |
+ |
status.gaisoPF04 = gGammaIso; |
956 |
+ |
status.neisoPF04 = gNeutralIso; |
957 |
+ |
|
958 |
+ |
bool pass = false; |
959 |
+ |
if( (pfIso/mu->Pt()) < MUON_REFERENCE_PFISO_CUT ) pass = true; |
960 |
+ |
|
961 |
+ |
if( pass ) { |
962 |
+ |
status.orStatus(SelectionStatus::LOOSEISO); |
963 |
+ |
status.orStatus(SelectionStatus::TIGHTISO); |
964 |
+ |
} |
965 |
+ |
if(ctrl.debug) cout << "returning status : " << hex << status.getStatus() << dec << endl; |
966 |
+ |
return status; |
967 |
+ |
|
968 |
+ |
} |
969 |
+ |
|
970 |
+ |
|
971 |
+ |
//-------------------------------------------------------------------------------------------------- |
972 |
+ |
// hacked version |
973 |
+ |
SelectionStatus muonReferenceIsoSelection(ControlFlags &ctrl, |
974 |
+ |
const mithep::Muon * mu, |
975 |
+ |
const mithep::Vertex & vtx, |
976 |
+ |
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
977 |
+ |
float rho, |
978 |
+ |
mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion, |
979 |
+ |
vector<const mithep::Muon*> muonsToVeto, |
980 |
+ |
vector<const mithep::Electron*> electronsToVeto) |
981 |
+ |
//-------------------------------------------------------------------------------------------------- |
982 |
+ |
{ |
983 |
+ |
|
984 |
+ |
SelectionStatus status; |
985 |
+ |
|
986 |
+ |
double pfIso = muonPFIso04( ctrl, mu, vtx, fPFCandidates, rho, |
987 |
+ |
EffectiveAreaVersion, muonsToVeto ,electronsToVeto ); |
988 |
|
bool pass = false; |
989 |
|
if( (pfIso/mu->Pt()) < MUON_REFERENCE_PFISO_CUT ) pass = true; |
990 |
|
|
1138 |
|
IsLeptonFootprint = kTRUE; |
1139 |
|
} |
1140 |
|
} // loop over electrons |
1141 |
< |
|
1141 |
> |
|
1142 |
> |
/* KH - comment for sync |
1143 |
|
// |
1144 |
|
// Check for muons |
1145 |
|
// |
1158 |
|
IsLeptonFootprint = kTRUE; |
1159 |
|
} |
1160 |
|
} // loop over muons |
1161 |
< |
|
1161 |
> |
*/ |
1162 |
|
|
1163 |
|
if (IsLeptonFootprint) |
1164 |
|
continue; |
1496 |
|
IsLeptonFootprint = kTRUE; |
1497 |
|
} |
1498 |
|
} // loop over electrons |
1499 |
< |
|
1499 |
> |
|
1500 |
> |
|
1501 |
|
// |
1502 |
|
// Check for muons |
1503 |
|
// |
1522 |
|
continue; |
1523 |
|
|
1524 |
|
// |
1525 |
< |
// Charged Iso Rings |
1525 |
> |
// Charged Iso |
1526 |
|
// |
1527 |
< |
if (pf->Charge() != 0 && (pf->HasTrackerTrk()||pf->HasGsfTrk()) ) { |
1527 |
> |
if (pf->Charge() != 0 ) { |
1528 |
|
|
1529 |
|
if( pf->HasTrackerTrk() ) |
1530 |
|
if (abs(pf->TrackerTrk()->DzCorrected(vtx)) > 0.2) continue; |
1563 |
|
else { |
1564 |
|
if( ctrl.debug) cout << "neutral:: " << pf->Pt() << " " |
1565 |
|
<< dr << endl; |
1566 |
< |
fNeutralHadronIso += pf->Pt(); |
1566 |
> |
fNeutralHadronIso += pf->Pt(); |
1567 |
|
} |
1568 |
|
|
1569 |
|
} |
1571 |
|
} |
1572 |
|
|
1573 |
|
double rho = 0; |
1574 |
< |
if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
1575 |
< |
rho = fPUEnergyDensity->At(0)->Rho(); |
1574 |
> |
// if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
1575 |
> |
// rho = fPUEnergyDensity->At(0)->Rho(); |
1576 |
> |
if (!(isnan(fPUEnergyDensity->At(0)->RhoLowEta()) || isinf(fPUEnergyDensity->At(0)->RhoLowEta()))) |
1577 |
> |
rho = fPUEnergyDensity->At(0)->RhoLowEta(); |
1578 |
> |
|
1579 |
> |
// WARNING!!!! |
1580 |
> |
// hardcode for sync ... |
1581 |
> |
EffectiveAreaVersion = eleT.kEleEAData2011; |
1582 |
> |
// WARNING!!!! |
1583 |
> |
|
1584 |
> |
|
1585 |
> |
double pfIso = fChargedIso + |
1586 |
> |
max(0.0,fGammaIso -rho*eleT.ElectronEffectiveArea(eleT.kEleGammaIso04, |
1587 |
> |
ele->Eta(),EffectiveAreaVersion)) + |
1588 |
> |
max(0.0,fNeutralHadronIso -rho*eleT.ElectronEffectiveArea(eleT.kEleNeutralHadronIso04, |
1589 |
> |
ele->Eta(),EffectiveAreaVersion)) ; |
1590 |
> |
|
1591 |
> |
gChargedIso = fChargedIso; |
1592 |
> |
gGammaIso = fGammaIso; |
1593 |
> |
gNeutralIso = fNeutralHadronIso; |
1594 |
> |
|
1595 |
> |
return pfIso; |
1596 |
> |
} |
1597 |
> |
|
1598 |
> |
//-------------------------------------------------------------------------------------------------- |
1599 |
> |
// hacked version |
1600 |
> |
float electronPFIso04(ControlFlags &ctrl, |
1601 |
> |
const mithep::Electron * ele, |
1602 |
> |
const mithep::Vertex & vtx, |
1603 |
> |
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
1604 |
> |
float rho, |
1605 |
> |
mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion, |
1606 |
> |
vector<const mithep::Muon*> muonsToVeto, |
1607 |
> |
vector<const mithep::Electron*> electronsToVeto) |
1608 |
> |
//-------------------------------------------------------------------------------------------------- |
1609 |
> |
{ |
1610 |
> |
|
1611 |
> |
if( ctrl.debug ) { |
1612 |
> |
cout << "electronIsoMVASelection :: muons to veto " << endl; |
1613 |
> |
for( int i=0; i<muonsToVeto.size(); i++ ) { |
1614 |
> |
const mithep::Muon * vmu = muonsToVeto[i]; |
1615 |
> |
cout << "\tpt: " << vmu->Pt() |
1616 |
> |
<< "\teta: " << vmu->Eta() |
1617 |
> |
<< "\tphi: " << vmu->Phi() |
1618 |
> |
<< endl; |
1619 |
> |
} |
1620 |
> |
cout << "electronIsoMVASelection :: electrson to veto " << endl; |
1621 |
> |
for( int i=0; i<electronsToVeto.size(); i++ ) { |
1622 |
> |
const mithep::Electron * vel = electronsToVeto[i]; |
1623 |
> |
cout << "\tpt: " << vel->Pt() |
1624 |
> |
<< "\teta: " << vel->Eta() |
1625 |
> |
<< "\tphi: " << vel->Phi() |
1626 |
> |
<< "\ttrk: " << vel->TrackerTrk() |
1627 |
> |
<< endl; |
1628 |
> |
} |
1629 |
> |
} |
1630 |
> |
|
1631 |
> |
|
1632 |
> |
// |
1633 |
> |
// final iso |
1634 |
> |
// |
1635 |
> |
Double_t fChargedIso = 0.0; |
1636 |
> |
Double_t fGammaIso = 0.0; |
1637 |
> |
Double_t fNeutralHadronIso = 0.0; |
1638 |
> |
|
1639 |
> |
|
1640 |
> |
// |
1641 |
> |
//Loop over PF Candidates |
1642 |
> |
// |
1643 |
> |
for(int k=0; k<fPFCandidates->GetEntries(); ++k) { |
1644 |
> |
const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*fPFCandidates)[k]); |
1645 |
> |
Double_t deta = (ele->Eta() - pf->Eta()); |
1646 |
> |
Double_t dphi = mithep::MathUtils::DeltaPhi(Double_t(ele->Phi()),Double_t(pf->Phi())); |
1647 |
> |
Double_t dr = mithep::MathUtils::DeltaR(ele->Phi(),ele->Eta(), pf->Phi(), pf->Eta()); |
1648 |
> |
if (dr >= 0.4) continue; |
1649 |
> |
if(ctrl.debug) { |
1650 |
> |
cout << "pf :: type: " << pf->PFType() << "\tpt: " << pf->Pt(); |
1651 |
> |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(vtx); |
1652 |
> |
cout << endl; |
1653 |
> |
} |
1654 |
> |
|
1655 |
> |
|
1656 |
> |
if ( (pf->HasTrackerTrk() && (pf->TrackerTrk() == ele->TrackerTrk())) || |
1657 |
> |
(pf->HasGsfTrk() && (pf->GsfTrk() == ele->GsfTrk()))) continue; |
1658 |
> |
|
1659 |
> |
|
1660 |
> |
// |
1661 |
> |
// Lepton Footprint Removal |
1662 |
> |
// |
1663 |
> |
Bool_t IsLeptonFootprint = kFALSE; |
1664 |
> |
if (dr < 1.0) { |
1665 |
> |
|
1666 |
> |
// |
1667 |
> |
// Check for electrons |
1668 |
> |
// |
1669 |
> |
for (Int_t q=0; q < electronsToVeto.size(); ++q) { |
1670 |
> |
const mithep::Electron *tmpele = electronsToVeto[q]; |
1671 |
> |
// 4l electron |
1672 |
> |
if( pf->HasTrackerTrk() ) { |
1673 |
> |
if( pf->TrackerTrk() == tmpele->TrackerTrk() ) { |
1674 |
> |
if( ctrl.debug) cout << "\tcharged tktrk, matches 4L ele ..." << endl; |
1675 |
> |
IsLeptonFootprint = kTRUE; |
1676 |
> |
} |
1677 |
> |
} |
1678 |
> |
if( pf->HasGsfTrk() ) { |
1679 |
> |
if( pf->GsfTrk() == tmpele->GsfTrk() ) { |
1680 |
> |
if( ctrl.debug) cout << "\tcharged gsftrk, matches 4L ele ..." << endl; |
1681 |
> |
IsLeptonFootprint = kTRUE; |
1682 |
> |
} |
1683 |
> |
} |
1684 |
> |
// PF charged |
1685 |
> |
if (pf->Charge() != 0 && fabs(tmpele->SCluster()->Eta()) > 1.479 |
1686 |
> |
&& mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()) < 0.015) { |
1687 |
> |
if( ctrl.debug) cout << "\tcharged trk, dR matches 4L ele ..." << endl; |
1688 |
> |
IsLeptonFootprint = kTRUE; |
1689 |
> |
} |
1690 |
> |
// PF gamma |
1691 |
> |
if (abs(pf->PFType()) == PFCandidate::eGamma && fabs(tmpele->SCluster()->Eta()) > 1.479 |
1692 |
> |
&& mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()) < 0.08) { |
1693 |
> |
if( ctrl.debug) cout << "\tPF gamma, matches 4L ele ..." << endl; |
1694 |
> |
IsLeptonFootprint = kTRUE; |
1695 |
> |
} |
1696 |
> |
} // loop over electrons |
1697 |
> |
|
1698 |
> |
/* KH - comment for sync |
1699 |
> |
// |
1700 |
> |
// Check for muons |
1701 |
> |
// |
1702 |
> |
for (Int_t q=0; q < muonsToVeto.size(); ++q) { |
1703 |
> |
const mithep::Muon *tmpmu = muonsToVeto[q]; |
1704 |
> |
// 4l muon |
1705 |
> |
if( pf->HasTrackerTrk() ) { |
1706 |
> |
if (pf->TrackerTrk() == tmpmu->TrackerTrk() ){ |
1707 |
> |
if( ctrl.debug) cout << "\tmatches 4L mu ..." << endl; |
1708 |
> |
IsLeptonFootprint = kTRUE; |
1709 |
> |
} |
1710 |
> |
} |
1711 |
> |
// PF charged |
1712 |
> |
if (pf->Charge() != 0 && mithep::MathUtils::DeltaR(tmpmu->Phi(),tmpmu->Eta(), pf->Phi(), pf->Eta()) < 0.01) { |
1713 |
> |
if( ctrl.debug) cout << "\tcharged trk, dR matches 4L mu ..." << endl; |
1714 |
> |
IsLeptonFootprint = kTRUE; |
1715 |
> |
} |
1716 |
> |
} // loop over muons |
1717 |
> |
*/ |
1718 |
> |
|
1719 |
> |
if (IsLeptonFootprint) |
1720 |
> |
continue; |
1721 |
> |
|
1722 |
> |
// |
1723 |
> |
// Charged Iso |
1724 |
> |
// |
1725 |
> |
if (pf->Charge() != 0 && (pf->HasTrackerTrk()||pf->HasGsfTrk()) ) { |
1726 |
> |
|
1727 |
> |
if( pf->HasTrackerTrk() ) |
1728 |
> |
if (abs(pf->TrackerTrk()->DzCorrected(vtx)) > 0.2) continue; |
1729 |
> |
if( pf->HasGsfTrk() ) |
1730 |
> |
if (abs(pf->GsfTrk()->DzCorrected(vtx)) > 0.2) continue; |
1731 |
> |
|
1732 |
> |
// Veto any PFmuon, or PFEle |
1733 |
> |
if (abs(pf->PFType()) == PFCandidate::eElectron || abs(pf->PFType()) == PFCandidate::eMuon) continue; |
1734 |
> |
|
1735 |
> |
// Footprint Veto |
1736 |
> |
if (fabs(ele->SCluster()->Eta()) > 1.479 && dr < 0.015) continue; |
1737 |
> |
|
1738 |
> |
if( ctrl.debug) cout << "charged:: pt: " << pf->Pt() |
1739 |
> |
<< "\ttype: " << pf->PFType() |
1740 |
> |
<< "\ttrk: " << pf->TrackerTrk() << endl; |
1741 |
> |
|
1742 |
> |
fChargedIso += pf->Pt(); |
1743 |
> |
} |
1744 |
> |
|
1745 |
> |
// |
1746 |
> |
// Gamma Iso |
1747 |
> |
// |
1748 |
> |
else if (abs(pf->PFType()) == PFCandidate::eGamma) { |
1749 |
> |
|
1750 |
> |
if (fabs(ele->SCluster()->Eta()) > 1.479) { |
1751 |
> |
if (mithep::MathUtils::DeltaR(ele->Phi(),ele->Eta(), pf->Phi(), pf->Eta()) < 0.08) continue; |
1752 |
> |
} |
1753 |
> |
if( ctrl.debug) cout << "gamma:: " << pf->Pt() << " " |
1754 |
> |
<< dr << endl; |
1755 |
> |
fGammaIso += pf->Pt(); |
1756 |
> |
} |
1757 |
> |
|
1758 |
> |
// |
1759 |
> |
// Neutral Iso |
1760 |
> |
// |
1761 |
> |
else { |
1762 |
> |
if( ctrl.debug) cout << "neutral:: " << pf->Pt() << " " |
1763 |
> |
<< dr << endl; |
1764 |
> |
// KH, add to sync |
1765 |
> |
if( pf->Pt() > 0.5 ) |
1766 |
> |
fNeutralHadronIso += pf->Pt(); |
1767 |
> |
} |
1768 |
> |
|
1769 |
> |
} |
1770 |
> |
|
1771 |
> |
} |
1772 |
> |
|
1773 |
> |
// double rho = 0; |
1774 |
> |
// if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
1775 |
> |
// rho = fPUEnergyDensity->At(0)->Rho(); |
1776 |
|
|
1777 |
|
// WARNING!!!! |
1778 |
|
// hardcode for sync ... |
1788 |
|
return pfIso; |
1789 |
|
} |
1790 |
|
|
1791 |
+ |
|
1792 |
|
//-------------------------------------------------------------------------------------------------- |
1793 |
|
SelectionStatus electronReferenceIsoSelection(ControlFlags &ctrl, |
1794 |
|
const mithep::Electron * ele, |
1805 |
|
|
1806 |
|
double pfIso = electronPFIso04( ctrl, ele, vtx, fPFCandidates, fPUEnergyDensity, |
1807 |
|
EffectiveAreaVersion, muonsToVeto ,electronsToVeto ); |
1808 |
+ |
cout << "--------------> setting electron isoPF04 to " << pfIso << endl; |
1809 |
+ |
status.isoPF04 = pfIso; |
1810 |
+ |
status.chisoPF04 = gChargedIso; |
1811 |
+ |
status.gaisoPF04 = gGammaIso; |
1812 |
+ |
status.neisoPF04 = gNeutralIso; |
1813 |
+ |
|
1814 |
+ |
bool pass = false; |
1815 |
+ |
if( (pfIso/ele->Pt()) < ELECTRON_REFERENCE_PFISO_CUT ) pass = true; |
1816 |
+ |
|
1817 |
+ |
if( pass ) { |
1818 |
+ |
status.orStatus(SelectionStatus::LOOSEISO); |
1819 |
+ |
status.orStatus(SelectionStatus::TIGHTISO); |
1820 |
+ |
} |
1821 |
+ |
if(ctrl.debug) cout << "returning status : " << hex << status.getStatus() << dec << endl; |
1822 |
+ |
return status; |
1823 |
+ |
|
1824 |
+ |
} |
1825 |
+ |
|
1826 |
+ |
|
1827 |
+ |
//-------------------------------------------------------------------------------------------------- |
1828 |
+ |
// hacked version |
1829 |
+ |
SelectionStatus electronReferenceIsoSelection(ControlFlags &ctrl, |
1830 |
+ |
const mithep::Electron * ele, |
1831 |
+ |
const mithep::Vertex & vtx, |
1832 |
+ |
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
1833 |
+ |
float rho, |
1834 |
+ |
mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion, |
1835 |
+ |
vector<const mithep::Muon*> muonsToVeto, |
1836 |
+ |
vector<const mithep::Electron*> electronsToVeto) |
1837 |
+ |
//-------------------------------------------------------------------------------------------------- |
1838 |
+ |
{ |
1839 |
+ |
|
1840 |
+ |
SelectionStatus status; |
1841 |
+ |
|
1842 |
+ |
double pfIso = electronPFIso04( ctrl, ele, vtx, fPFCandidates, rho, |
1843 |
+ |
EffectiveAreaVersion, muonsToVeto ,electronsToVeto ); |
1844 |
|
bool pass = false; |
1845 |
|
if( (pfIso/ele->Pt()) < ELECTRON_REFERENCE_PFISO_CUT ) pass = true; |
1846 |
|
|