25 |
|
|
26 |
|
//-------------------------------------------------------------------------------------------------- |
27 |
|
Float_t computePFMuonIso(const mithep::Muon *muon, |
28 |
< |
const mithep::Vertex & vtx, |
28 |
> |
const mithep::Vertex * vtx, |
29 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
30 |
|
const Double_t dRMax) |
31 |
|
//-------------------------------------------------------------------------------------------------- |
34 |
|
const Double_t neuPtMin = 1.0; |
35 |
|
const Double_t dzMax = 0.1; |
36 |
|
|
37 |
< |
Double_t zLepton = (muon->BestTrk()) ? muon->BestTrk()->DzCorrected(vtx) : 0.0; |
37 |
> |
Double_t zLepton = (muon->BestTrk()) ? muon->BestTrk()->DzCorrected(*vtx) : 0.0; |
38 |
|
|
39 |
|
Float_t iso=0; |
40 |
|
for(UInt_t ipf=0; ipf<fPFCandidates->GetEntries(); ipf++) { |
46 |
|
if(pfcand->TrackerTrk() && muon->TrackerTrk() && (pfcand->TrackerTrk()==muon->TrackerTrk())) continue; |
47 |
|
|
48 |
|
// dz cut |
49 |
< |
Double_t dz = (pfcand->BestTrk()) ? fabs(pfcand->BestTrk()->DzCorrected(vtx) - zLepton) : 0; |
49 |
> |
Double_t dz = (pfcand->BestTrk()) ? fabs(pfcand->BestTrk()->DzCorrected(*vtx) - zLepton) : 0; |
50 |
|
if(dz >= dzMax) continue; |
51 |
|
|
52 |
|
// check iso cone |
60 |
|
|
61 |
|
//-------------------------------------------------------------------------------------------------- |
62 |
|
Float_t computePFEleIso(const mithep::Electron *electron, |
63 |
< |
const mithep::Vertex & fVertex, |
63 |
> |
const mithep::Vertex * fVertex, |
64 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
65 |
|
const Double_t dRMax) |
66 |
|
//-------------------------------------------------------------------------------------------------- |
69 |
|
const Double_t neuPtMin = 1.0; |
70 |
|
const Double_t dzMax = 0.1; |
71 |
|
|
72 |
< |
Double_t zLepton = (electron->BestTrk()) ? electron->BestTrk()->DzCorrected(fVertex) : 0.0; |
72 |
> |
Double_t zLepton = (electron->BestTrk()) ? electron->BestTrk()->DzCorrected(*fVertex) : 0.0; |
73 |
|
|
74 |
|
Float_t iso=0; |
75 |
|
for(UInt_t ipf=0; ipf<fPFCandidates->GetEntries(); ipf++) { |
78 |
|
if(!pfcand->HasTrk() && (pfcand->Pt()<=neuPtMin)) continue; // pT cut on neutral particles |
79 |
|
|
80 |
|
// dz cut |
81 |
< |
Double_t dz = (pfcand->BestTrk()) ? fabs(pfcand->BestTrk()->DzCorrected(fVertex) - zLepton) : 0; |
81 |
> |
Double_t dz = (pfcand->BestTrk()) ? fabs(pfcand->BestTrk()->DzCorrected(*fVertex) - zLepton) : 0; |
82 |
|
if(dz >= dzMax) continue; |
83 |
|
|
84 |
|
// remove THE electron |
182 |
|
//-------------------------------------------------------------------------------------------------- |
183 |
|
SelectionStatus muonIsoSelection(ControlFlags &ctrl, |
184 |
|
const mithep::Muon * mu, |
185 |
< |
const mithep::Vertex & vtx, |
185 |
> |
const mithep::Vertex * vtx, |
186 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidateCol ) |
187 |
|
//-------------------------------------------------------------------------------------------------- |
188 |
|
{ |
212 |
|
//-------------------------------------------------------------------------------------------------- |
213 |
|
SelectionStatus electronIsoSelection(ControlFlags &ctrl, |
214 |
|
const mithep::Electron * ele, |
215 |
< |
const mithep::Vertex &fVertex, |
215 |
> |
const mithep::Vertex *fVertex, |
216 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates) |
217 |
|
//-------------------------------------------------------------------------------------------------- |
218 |
|
{ |
227 |
|
if( ele->IsEB() && ele->Pt() < 20 && reliso > PFISO_ELE_LOOSE_EB_LOWPT ) { |
228 |
|
failiso = true; |
229 |
|
} |
230 |
– |
if(ctrl.debug) cout << "before iso check ..." << endl; |
230 |
|
if( !(ele->IsEB()) && ele->Pt() > 20 && reliso > PFISO_ELE_LOOSE_EE_HIGHPT ) { |
232 |
– |
if(ctrl.debug) cout << "\tit fails ..." << endl; |
231 |
|
failiso = true; |
232 |
|
} |
233 |
|
if( !(ele->IsEB()) && ele->Pt() < 20 && reliso > PFISO_ELE_LOOSE_EE_LOWPT ) { |
250 |
|
return true; |
251 |
|
} |
252 |
|
|
253 |
+ |
|
254 |
|
//-------------------------------------------------------------------------------------------------- |
255 |
|
SelectionStatus muonIsoMVASelection(ControlFlags &ctrl, |
256 |
|
const mithep::Muon * mu, |
257 |
< |
const mithep::Vertex & vtx, |
257 |
> |
const mithep::Vertex * vtx, |
258 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
259 |
|
const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
260 |
|
mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion, |
338 |
|
//Loop over PF Candidates |
339 |
|
// |
340 |
|
for(int k=0; k<fPFCandidates->GetEntries(); ++k) { |
341 |
+ |
|
342 |
+ |
if( !(PFnoPUflag[k]) ) continue; // my PF no PU hack |
343 |
+ |
|
344 |
|
const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*fPFCandidates)[k]); |
345 |
|
|
346 |
|
Double_t deta = (mu->Eta() - pf->Eta()); |
347 |
|
Double_t dphi = mithep::MathUtils::DeltaPhi(Double_t(mu->Phi()),Double_t(pf->Phi())); |
348 |
|
Double_t dr = mithep::MathUtils::DeltaR(mu->Phi(),mu->Eta(), pf->Phi(), pf->Eta()); |
349 |
< |
if (dr > 0.5) continue; |
348 |
< |
if (dr < 0.01) continue; |
349 |
> |
if (dr > 1.0) continue; |
350 |
|
|
351 |
|
if (pf->HasTrackerTrk() && (pf->TrackerTrk() == mu->TrackerTrk()) ) continue; |
352 |
|
|
380 |
|
IsLeptonFootprint = kTRUE; |
381 |
|
} // loop over electrons |
382 |
|
|
383 |
< |
/* |
383 |
> |
/* KH - commented for sync |
384 |
|
// |
385 |
|
// Check for muons |
386 |
|
// |
414 |
|
// << abs(pf->TrackerTrk()->DzCorrected(vtx)) << " " |
415 |
|
// << dr << endl; |
416 |
|
// } |
417 |
< |
|
417 |
> |
// if( pf->HasGsfTrk() ) { |
418 |
> |
// if (abs(pf->GsfTrk()->DzCorrected(vtx)) > 0.2) continue; |
419 |
> |
// if( ctrl.debug ) cout << "charged:: " << pf->PFType() << " " << pf->Pt() << " " |
420 |
> |
// << abs(pf->GsfTrk()->DzCorrected(vtx)) << " " |
421 |
> |
// << dr << endl; |
422 |
> |
// } |
423 |
|
|
424 |
|
// Footprint Veto |
425 |
|
if (dr < 0.1) tmpChargedIso_DR0p0To0p1 += pf->Pt(); |
466 |
|
|
467 |
|
|
468 |
|
double rho = 0; |
469 |
< |
// if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
470 |
< |
// rho = fPUEnergyDensity->At(0)->Rho(); |
471 |
< |
if (!(isnan(fPUEnergyDensity->At(0)->RhoLowEta()) || isinf(fPUEnergyDensity->At(0)->RhoLowEta()))) |
472 |
< |
rho = fPUEnergyDensity->At(0)->RhoLowEta(); |
469 |
> |
if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
470 |
> |
rho = fPUEnergyDensity->At(0)->Rho(); |
471 |
> |
// if (!(isnan(fPUEnergyDensity->At(0)->RhoLowEta()) || isinf(fPUEnergyDensity->At(0)->RhoLowEta()))) |
472 |
> |
// rho = fPUEnergyDensity->At(0)->RhoLowEta(); |
473 |
|
|
474 |
|
// WARNING!!!! |
475 |
|
// hardcode for sync ... |
553 |
|
|
554 |
|
pass = false; |
555 |
|
if( mu->IsGlobalMuon() && mu->IsTrackerMuon() |
556 |
< |
&& fabs(mu->Eta()) <= 1.5 && mu->Pt() <= 10 && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN0) pass = true; |
556 |
> |
&& fabs(mu->Eta()) <= 1.5 && mu->Pt() <= 10 && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN0) pass = true; |
557 |
|
else if( mu->IsGlobalMuon() && mu->IsTrackerMuon() |
558 |
< |
&& fabs(mu->Eta()) <= 1.5 && mu->Pt() > 10 && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN1) pass = true; |
558 |
> |
&& fabs(mu->Eta()) <= 1.5 && mu->Pt() > 10 && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN1) pass = true; |
559 |
|
else if( mu->IsGlobalMuon() && mu->IsTrackerMuon() |
560 |
< |
&& fabs(mu->Eta()) > 1.5 && mu->Pt() <= 10 && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN2) pass = true; |
560 |
> |
&& fabs(mu->Eta()) > 1.5 && mu->Pt() <= 10 && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN2) pass = true; |
561 |
|
else if( mu->IsGlobalMuon() && mu->IsTrackerMuon() |
562 |
< |
&& fabs(mu->Eta()) > 1.5 && mu->Pt() > 10 && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN3) pass = true; |
563 |
< |
else if( !(mu->IsGlobalMuon()) && mu->IsTrackerMuon() && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN4) pass = true; |
564 |
< |
else if( mu->IsGlobalMuon() && !(mu->IsTrackerMuon()) && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN5) pass = true; |
562 |
> |
&& fabs(mu->Eta()) > 1.5 && mu->Pt() > 10 && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN3) pass = true; |
563 |
> |
else if( !(mu->IsGlobalMuon()) && mu->IsTrackerMuon() && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN4) pass = true; |
564 |
> |
else if( mu->IsGlobalMuon() && !(mu->IsTrackerMuon()) && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN5) pass = true; |
565 |
|
if( pass ) status.orStatus(SelectionStatus::LOOSEISO); |
566 |
|
|
567 |
+ |
/* |
568 |
|
pass = false; |
569 |
|
if( mu->IsGlobalMuon() && mu->IsTrackerMuon() |
570 |
|
&& fabs(mu->Eta()) <= 1.5 && mu->Pt() <= 10 && mvaval >= MUON_ISOMVA_TIGHT_FORPFID_CUT_BIN0) pass = true; |
577 |
|
else if( !(mu->IsGlobalMuon()) && mu->IsTrackerMuon() && mvaval >= MUON_ISOMVA_TIGHT_FORPFID_CUT_BIN4) pass = true; |
578 |
|
else if( mu->IsGlobalMuon() && !(mu->IsTrackerMuon()) && mvaval >= MUON_ISOMVA_TIGHT_FORPFID_CUT_BIN5) pass = true; |
579 |
|
if( pass ) status.orStatus(SelectionStatus::TIGHTISO); |
580 |
+ |
*/ |
581 |
|
|
582 |
|
// pass &= (fChargedIso_DR0p0To0p1 + fChargedIso_DR0p1To0p2 + fChargedIso_DR0p2To0p3 < 0.7); |
583 |
|
|
584 |
< |
if(ctrl.debug) cout << "returning status : " << hex << status.getStatus() << dec << endl; |
584 |
> |
status.isoMVA = mvaval; |
585 |
> |
|
586 |
> |
if(ctrl.debug) { |
587 |
> |
cout << "returning status : " << hex << status.getStatus() << dec << endl; |
588 |
> |
cout << "MVAVAL : " << status.isoMVA << endl; |
589 |
> |
} |
590 |
|
return status; |
591 |
|
|
592 |
|
} |
595 |
|
//-------------------------------------------------------------------------------------------------- |
596 |
|
SelectionStatus muonIsoMVASelection(ControlFlags &ctrl, |
597 |
|
const mithep::Muon * mu, |
598 |
< |
const mithep::Vertex & vtx, |
598 |
> |
const mithep::Vertex * vtx, |
599 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
600 |
|
float rho, |
601 |
|
//const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
952 |
|
} |
953 |
|
|
954 |
|
|
955 |
+ |
|
956 |
+ |
|
957 |
|
//-------------------------------------------------------------------------------------------------- |
958 |
|
double muonPFIso04(ControlFlags &ctrl, |
959 |
|
const mithep::Muon * mu, |
960 |
< |
const mithep::Vertex & vtx, |
960 |
> |
const mithep::Vertex * vtx, |
961 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
962 |
|
const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
963 |
|
mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion, |
965 |
|
vector<const mithep::Electron*> electronsToVeto) |
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; |
1000 |
|
//Loop over PF Candidates |
1001 |
|
// |
1002 |
|
for(int k=0; k<fPFCandidates->GetEntries(); ++k) { |
1003 |
+ |
|
1004 |
+ |
if( !(PFnoPUflag[k]) ) continue; // my PF no PU hack |
1005 |
|
const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*fPFCandidates)[k]); |
1006 |
|
|
1007 |
|
Double_t deta = (mu->Eta() - pf->Eta()); |
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) |
1036 |
> |
&& mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()) < 0.015) { |
1037 |
> |
if( ctrl.debug) cout << "\tcharged trk, dR (" |
1038 |
> |
<< mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()) |
1039 |
> |
<< " matches 4L ele ..." << endl; |
1040 |
|
IsLeptonFootprint = kTRUE; |
1041 |
+ |
} |
1042 |
|
// PF gamma |
1043 |
|
if (abs(pf->PFType()) == PFCandidate::eGamma && fabs(tmpele->SCluster()->Eta()) > 1.479 |
1044 |
|
&& mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()) < 0.08) |
1045 |
|
IsLeptonFootprint = kTRUE; |
1046 |
|
} // loop over electrons |
1047 |
|
|
1048 |
< |
// KH, comment to sync |
1024 |
< |
/* |
1048 |
> |
/* KH - comment for sync |
1049 |
|
// |
1050 |
|
// Check for muons |
1051 |
|
// |
1068 |
|
// |
1069 |
|
// Charged Iso |
1070 |
|
// |
1071 |
< |
if (pf->Charge() != 0 ) { |
1071 |
> |
if (pf->Charge() != 0 && (pf->HasTrackerTrk()||pf->HasGsfTrk()) ) { |
1072 |
|
|
1073 |
|
//if( dr < 0.01 ) continue; // only for muon iso mva? |
1074 |
|
if (abs(pf->PFType()) == PFCandidate::eElectron || abs(pf->PFType()) == PFCandidate::eMuon) continue; |
1075 |
|
|
1076 |
< |
if( pf->HasTrackerTrk() ) { |
1077 |
< |
if (abs(pf->TrackerTrk()->DzCorrected(vtx)) > 0.2) continue; |
1078 |
< |
if( ctrl.debug ) cout << "charged:: " << pf->PFType() << " " << pf->Pt() << " " |
1079 |
< |
<< abs(pf->TrackerTrk()->DzCorrected(vtx)) << " " |
1080 |
< |
<< dr << endl; |
1081 |
< |
} |
1082 |
< |
if( pf->HasGsfTrk() ) { |
1083 |
< |
if (abs(pf->GsfTrk()->DzCorrected(vtx)) > 0.2) continue; |
1084 |
< |
if( ctrl.debug ) cout << "charged:: " << pf->PFType() << " " << pf->Pt() << " " |
1085 |
< |
<< abs(pf->GsfTrk()->DzCorrected(vtx)) << " " |
1086 |
< |
<< dr << endl; |
1087 |
< |
} |
1076 |
> |
|
1077 |
> |
// if( pf->HasTrackerTrk() ) { |
1078 |
> |
// if (abs(pf->TrackerTrk()->DzCorrected(vtx)) > 0.2) continue; |
1079 |
> |
// if( ctrl.debug ) cout << "charged:: " << pf->PFType() << " " << pf->Pt() << " " |
1080 |
> |
// << abs(pf->TrackerTrk()->DzCorrected(vtx)) << " " |
1081 |
> |
// << dr << endl; |
1082 |
> |
// } |
1083 |
> |
// if( pf->HasGsfTrk() ) { |
1084 |
> |
// if (abs(pf->GsfTrk()->DzCorrected(vtx)) > 0.2) continue; |
1085 |
> |
// if( ctrl.debug ) cout << "charged:: " << pf->PFType() << " " << pf->Pt() << " " |
1086 |
> |
// << abs(pf->GsfTrk()->DzCorrected(vtx)) << " " |
1087 |
> |
// << dr << endl; |
1088 |
> |
// } |
1089 |
|
|
1090 |
|
|
1091 |
|
fChargedIso += pf->Pt(); |
1112 |
|
} |
1113 |
|
|
1114 |
|
} |
1115 |
< |
|
1116 |
< |
double rho = 0; |
1117 |
< |
// if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
1118 |
< |
// rho = fPUEnergyDensity->At(0)->Rho(); |
1094 |
< |
if (!(isnan(fPUEnergyDensity->At(0)->RhoLowEta()) || isinf(fPUEnergyDensity->At(0)->RhoLowEta()))) |
1095 |
< |
rho = fPUEnergyDensity->At(0)->RhoLowEta(); |
1115 |
> |
|
1116 |
> |
double rho=0; |
1117 |
> |
if (!(isnan(fPUEnergyDensity->At(0)->RhoKt6PFJetsCentralNeutral()) || isinf(fPUEnergyDensity->At(0)->RhoKt6PFJetsCentralNeutral()))) |
1118 |
> |
rho = fPUEnergyDensity->At(0)->RhoKt6PFJetsCentralNeutral(); |
1119 |
|
|
1120 |
|
// WARNING!!!! |
1121 |
|
// hardcode for sync ... |
1122 |
< |
EffectiveAreaVersion = muT.kMuEAData2011; |
1122 |
> |
EffectiveAreaVersion = muT.kMuEAData2012; |
1123 |
|
// WARNING!!!! |
1124 |
|
|
1125 |
|
|
1126 |
+ |
|
1127 |
|
double pfIso = fChargedIso + fmax(0.0,(fGammaIso + fNeutralHadronIso |
1128 |
|
-rho*muT.MuonEffectiveArea(muT.kMuGammaAndNeutralHadronIso04, |
1129 |
|
mu->Eta(),EffectiveAreaVersion))); |
1106 |
– |
|
1130 |
|
gChargedIso = fChargedIso; |
1131 |
< |
gGammaIso = fGammaIso; |
1132 |
< |
gNeutralIso = fNeutralHadronIso; |
1131 |
> |
gGammaIso = fGammaIso; |
1132 |
> |
gNeutralIso = fNeutralHadronIso; |
1133 |
> |
|
1134 |
|
return pfIso; |
1135 |
|
} |
1136 |
|
|
1137 |
|
|
1138 |
+ |
|
1139 |
+ |
|
1140 |
|
//-------------------------------------------------------------------------------------------------- |
1141 |
|
// hacked version |
1142 |
|
double muonPFIso04(ControlFlags &ctrl, |
1143 |
|
const mithep::Muon * mu, |
1144 |
< |
const mithep::Vertex & vtx, |
1144 |
> |
const mithep::Vertex * vtx, |
1145 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
1146 |
|
float rho, |
1147 |
|
mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion, |
1317 |
|
//-------------------------------------------------------------------------------------------------- |
1318 |
|
SelectionStatus muonReferenceIsoSelection(ControlFlags &ctrl, |
1319 |
|
const mithep::Muon * mu, |
1320 |
< |
const mithep::Vertex & vtx, |
1320 |
> |
const mithep::Vertex * vtx, |
1321 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
1322 |
|
const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
1323 |
|
mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion, |
1353 |
|
// hacked version |
1354 |
|
SelectionStatus muonReferenceIsoSelection(ControlFlags &ctrl, |
1355 |
|
const mithep::Muon * mu, |
1356 |
< |
const mithep::Vertex & vtx, |
1356 |
> |
const mithep::Vertex * vtx, |
1357 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
1358 |
|
float rho, |
1359 |
|
mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion, |
1386 |
|
|
1387 |
|
|
1388 |
|
|
1389 |
+ |
|
1390 |
|
//-------------------------------------------------------------------------------------------------- |
1391 |
|
SelectionStatus electronIsoMVASelection(ControlFlags &ctrl, |
1392 |
|
const mithep::Electron * ele, |
1393 |
< |
const mithep::Vertex & vtx, |
1393 |
> |
const mithep::Vertex * vtx, |
1394 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
1395 |
|
const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
1396 |
|
mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion, |
1429 |
|
Double_t tmpChargedIso_DR0p2To0p3 = 0; |
1430 |
|
Double_t tmpChargedIso_DR0p3To0p4 = 0; |
1431 |
|
Double_t tmpChargedIso_DR0p4To0p5 = 0; |
1405 |
– |
Double_t tmpChargedIso_DR0p5To0p7 = 0; |
1432 |
|
|
1433 |
|
Double_t tmpGammaIso_DR0p0To0p1 = 0; |
1434 |
|
Double_t tmpGammaIso_DR0p1To0p2 = 0; |
1435 |
|
Double_t tmpGammaIso_DR0p2To0p3 = 0; |
1436 |
|
Double_t tmpGammaIso_DR0p3To0p4 = 0; |
1437 |
|
Double_t tmpGammaIso_DR0p4To0p5 = 0; |
1438 |
< |
Double_t tmpGammaIso_DR0p5To0p7 = 0; |
1438 |
> |
|
1439 |
|
|
1440 |
|
Double_t tmpNeutralHadronIso_DR0p0To0p1 = 0; |
1441 |
|
Double_t tmpNeutralHadronIso_DR0p1To0p2 = 0; |
1442 |
|
Double_t tmpNeutralHadronIso_DR0p2To0p3 = 0; |
1443 |
|
Double_t tmpNeutralHadronIso_DR0p3To0p4 = 0; |
1444 |
|
Double_t tmpNeutralHadronIso_DR0p4To0p5 = 0; |
1419 |
– |
Double_t tmpNeutralHadronIso_DR0p5To0p7 = 0; |
1445 |
|
|
1446 |
|
|
1447 |
|
|
1478 |
|
Double_t deta = (ele->Eta() - pf->Eta()); |
1479 |
|
Double_t dphi = mithep::MathUtils::DeltaPhi(Double_t(ele->Phi()),Double_t(pf->Phi())); |
1480 |
|
Double_t dr = mithep::MathUtils::DeltaR(ele->Phi(),ele->Eta(), pf->Phi(), pf->Eta()); |
1481 |
< |
if (dr > 0.5) continue; |
1481 |
> |
if (dr > 1.0) continue; |
1482 |
> |
|
1483 |
|
if(ctrl.debug) { |
1484 |
|
cout << "pf :: type: " << pf->PFType() << "\tpt: " << pf->Pt(); |
1485 |
< |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(vtx); |
1485 |
> |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(*vtx); |
1486 |
|
cout << endl; |
1487 |
|
} |
1488 |
|
|
1497 |
|
Bool_t IsLeptonFootprint = kFALSE; |
1498 |
|
if (dr < 1.0) { |
1499 |
|
|
1500 |
+ |
|
1501 |
|
// |
1502 |
|
// Check for electrons |
1503 |
|
// |
1504 |
+ |
|
1505 |
|
for (Int_t q=0; q < electronsToVeto.size(); ++q) { |
1506 |
|
const mithep::Electron *tmpele = electronsToVeto[q]; |
1507 |
+ |
double tmpdr = mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()); |
1508 |
+ |
|
1509 |
|
// 4l electron |
1510 |
|
if( pf->HasTrackerTrk() ) { |
1511 |
|
if( pf->TrackerTrk() == tmpele->TrackerTrk() ) { |
1520 |
|
} |
1521 |
|
} |
1522 |
|
// PF charged |
1523 |
< |
if (pf->Charge() != 0 && fabs(tmpele->SCluster()->Eta()) >= 1.479 |
1494 |
< |
&& mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()) < 0.015) { |
1523 |
> |
if (pf->Charge() != 0 && fabs(tmpele->SCluster()->Eta()) >= 1.479 && tmpdr < 0.015) { |
1524 |
|
if( ctrl.debug) cout << "\tcharged trk, dR matches 4L ele ..." << endl; |
1525 |
|
IsLeptonFootprint = kTRUE; |
1526 |
|
} |
1527 |
|
// PF gamma |
1528 |
|
if (abs(pf->PFType()) == PFCandidate::eGamma && fabs(tmpele->SCluster()->Eta()) >= 1.479 |
1529 |
< |
&& mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()) < 0.08) { |
1529 |
> |
&& tmpdr < 0.08) { |
1530 |
|
if( ctrl.debug) cout << "\tPF gamma, matches 4L ele ..." << endl; |
1531 |
|
IsLeptonFootprint = kTRUE; |
1532 |
|
} |
1533 |
|
} // loop over electrons |
1534 |
|
|
1535 |
+ |
|
1536 |
|
/* KH - comment for sync |
1537 |
|
// |
1538 |
|
// Check for muons |
1583 |
|
if (dr >= 0.2 && dr < 0.3) tmpChargedIso_DR0p2To0p3 += pf->Pt(); |
1584 |
|
if (dr >= 0.3 && dr < 0.4) tmpChargedIso_DR0p3To0p4 += pf->Pt(); |
1585 |
|
if (dr >= 0.4 && dr < 0.5) tmpChargedIso_DR0p4To0p5 += pf->Pt(); |
1556 |
– |
if (dr >= 0.5 && dr < 0.7) tmpChargedIso_DR0p5To0p7 += pf->Pt(); |
1586 |
|
|
1587 |
|
} |
1588 |
|
|
1591 |
|
// |
1592 |
|
else if (abs(pf->PFType()) == PFCandidate::eGamma) { |
1593 |
|
|
1594 |
< |
if (fabs(ele->SCluster()->Eta()) > 1.479) { |
1566 |
< |
if (mithep::MathUtils::DeltaR(ele->Phi(),ele->Eta(), pf->Phi(), pf->Eta()) < 0.08) continue; |
1567 |
< |
} |
1594 |
> |
if (fabs(ele->SCluster()->Eta()) > 1.479 && dr < 0.08) continue; |
1595 |
|
|
1596 |
|
if( ctrl.debug) cout << "gamma:: " << pf->Pt() << " " |
1597 |
|
<< dr << endl; |
1601 |
|
if (dr >= 0.2 && dr < 0.3) tmpGammaIso_DR0p2To0p3 += pf->Pt(); |
1602 |
|
if (dr >= 0.3 && dr < 0.4) tmpGammaIso_DR0p3To0p4 += pf->Pt(); |
1603 |
|
if (dr >= 0.4 && dr < 0.5) tmpGammaIso_DR0p4To0p5 += pf->Pt(); |
1577 |
– |
if (dr >= 0.5 && dr < 0.7) tmpGammaIso_DR0p5To0p7 += pf->Pt(); |
1578 |
– |
|
1604 |
|
} |
1605 |
|
|
1606 |
|
// |
1614 |
|
if (dr >= 0.2 && dr < 0.3) tmpNeutralHadronIso_DR0p2To0p3 += pf->Pt(); |
1615 |
|
if (dr >= 0.3 && dr < 0.4) tmpNeutralHadronIso_DR0p3To0p4 += pf->Pt(); |
1616 |
|
if (dr >= 0.4 && dr < 0.5) tmpNeutralHadronIso_DR0p4To0p5 += pf->Pt(); |
1592 |
– |
if (dr >= 0.5 && dr < 0.7) tmpNeutralHadronIso_DR0p5To0p7 += pf->Pt(); |
1617 |
|
} |
1618 |
|
|
1619 |
|
} |
1626 |
|
fChargedIso_DR0p3To0p4 = fmin((tmpChargedIso_DR0p3To0p4)/ele->Pt(), 2.5); |
1627 |
|
fChargedIso_DR0p4To0p5 = fmin((tmpChargedIso_DR0p4To0p5)/ele->Pt(), 2.5); |
1628 |
|
|
1629 |
< |
double rho = 0; |
1630 |
< |
// if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
1631 |
< |
// rho = fPUEnergyDensity->At(0)->Rho(); |
1632 |
< |
if (!(isnan(fPUEnergyDensity->At(0)->RhoLowEta()) || isinf(fPUEnergyDensity->At(0)->RhoLowEta()))) |
1633 |
< |
rho = fPUEnergyDensity->At(0)->RhoLowEta(); |
1629 |
> |
if(ctrl.debug) { |
1630 |
> |
cout << "fChargedIso_DR0p0To0p1 : " << fChargedIso_DR0p0To0p1 << endl; |
1631 |
> |
cout << "fChargedIso_DR0p1To0p2 : " << fChargedIso_DR0p1To0p2 << endl; |
1632 |
> |
cout << "fChargedIso_DR0p2To0p3 : " << fChargedIso_DR0p2To0p3 << endl; |
1633 |
> |
cout << "fChargedIso_DR0p3To0p4 : " << fChargedIso_DR0p3To0p4 << endl; |
1634 |
> |
cout << "fChargedIso_DR0p4To0p5 : " << fChargedIso_DR0p4To0p5 << endl; |
1635 |
> |
} |
1636 |
> |
|
1637 |
|
|
1638 |
+ |
double rho = 0; |
1639 |
+ |
if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
1640 |
+ |
rho = fPUEnergyDensity->At(0)->Rho(); |
1641 |
+ |
// if (!(isnan(fPUEnergyDensity->At(0)->RhoLowEta()) || isinf(fPUEnergyDensity->At(0)->RhoLowEta()))) |
1642 |
+ |
// rho = fPUEnergyDensity->At(0)->RhoLowEta(); |
1643 |
+ |
|
1644 |
|
// WARNING!!!! |
1645 |
|
// hardcode for sync ... |
1646 |
< |
// EffectiveAreaVersion = eleT.kEleEAData2011; |
1614 |
< |
EffectiveAreaVersion = eleT.kEleEAFall11MC; |
1646 |
> |
EffectiveAreaVersion = eleT.kEleEAData2011; |
1647 |
|
// WARNING!!!! |
1648 |
|
|
1649 |
|
if( ctrl.debug) { |
1700 |
|
,0.0); |
1701 |
|
|
1702 |
|
|
1703 |
+ |
if( ctrl.debug) { |
1704 |
+ |
cout << "fGammaIso_DR0p0To0p1: " << fGammaIso_DR0p0To0p1 << endl; |
1705 |
+ |
cout << "fGammaIso_DR0p1To0p2: " << fGammaIso_DR0p1To0p2 << endl; |
1706 |
+ |
cout << "fGammaIso_DR0p2To0p3: " << fGammaIso_DR0p2To0p3 << endl; |
1707 |
+ |
cout << "fGammaIso_DR0p3To0p4: " << fGammaIso_DR0p3To0p4 << endl; |
1708 |
+ |
cout << "fGammaIso_DR0p4To0p5: " << fGammaIso_DR0p4To0p5 << endl; |
1709 |
+ |
} |
1710 |
+ |
|
1711 |
|
fNeutralHadronIso_DR0p0To0p1 = fmax(fmin((tmpNeutralHadronIso_DR0p0To0p1 |
1712 |
|
-rho*eleT.ElectronEffectiveArea(eleT.kEleNeutralHadronIsoDR0p0To0p1, |
1713 |
|
ele->SCluster()->Eta(),EffectiveAreaVersion))/ele->Pt() |
1734 |
|
, 2.5) |
1735 |
|
, 0.0); |
1736 |
|
|
1737 |
+ |
if( ctrl.debug) { |
1738 |
+ |
cout << "fNeutralHadronIso_DR0p0To0p1: " << fNeutralHadronIso_DR0p0To0p1 << endl; |
1739 |
+ |
cout << "fNeutralHadronIso_DR0p1To0p2: " << fNeutralHadronIso_DR0p1To0p2 << endl; |
1740 |
+ |
cout << "fNeutralHadronIso_DR0p2To0p3: " << fNeutralHadronIso_DR0p2To0p3 << endl; |
1741 |
+ |
cout << "fNeutralHadronIso_DR0p3To0p4: " << fNeutralHadronIso_DR0p3To0p4 << endl; |
1742 |
+ |
cout << "fNeutralHadronIso_DR0p4To0p5: " << fNeutralHadronIso_DR0p4To0p5 << endl; |
1743 |
+ |
} |
1744 |
+ |
|
1745 |
|
double mvaval = eleIsoMVA->MVAValue_IsoRings( ele->Pt(), |
1746 |
|
ele->SCluster()->Eta(), |
1747 |
|
fChargedIso_DR0p0To0p1, |
1762 |
|
ctrl.debug); |
1763 |
|
|
1764 |
|
SelectionStatus status; |
1765 |
+ |
status.isoMVA = mvaval; |
1766 |
|
bool pass = false; |
1767 |
|
|
1768 |
|
Int_t subdet = 0; |
1769 |
|
if (fabs(ele->SCluster()->Eta()) < 0.8) subdet = 0; |
1770 |
|
else if (fabs(ele->SCluster()->Eta()) < 1.479) subdet = 1; |
1771 |
|
else subdet = 2; |
1772 |
+ |
|
1773 |
|
Int_t ptBin = 0; |
1774 |
< |
if (ele->Pt() > 10.0) ptBin = 1; |
1774 |
> |
if (ele->Pt() >= 10.0) ptBin = 1; |
1775 |
|
|
1776 |
|
Int_t MVABin = -1; |
1777 |
|
if (subdet == 0 && ptBin == 0) MVABin = 0; |
1782 |
|
if (subdet == 2 && ptBin == 1) MVABin = 5; |
1783 |
|
|
1784 |
|
pass = false; |
1785 |
< |
if( MVABin == 0 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_BIN0 ) pass = true; |
1786 |
< |
if( MVABin == 1 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_BIN1 ) pass = true; |
1787 |
< |
if( MVABin == 2 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_BIN2 ) pass = true; |
1788 |
< |
if( MVABin == 3 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_BIN3 ) pass = true; |
1789 |
< |
if( MVABin == 4 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_BIN4 ) pass = true; |
1790 |
< |
if( MVABin == 5 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_BIN5 ) pass = true; |
1785 |
> |
if( MVABin == 0 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN0 ) pass = true; |
1786 |
> |
if( MVABin == 1 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN1 ) pass = true; |
1787 |
> |
if( MVABin == 2 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN2 ) pass = true; |
1788 |
> |
if( MVABin == 3 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN3 ) pass = true; |
1789 |
> |
if( MVABin == 4 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN4 ) pass = true; |
1790 |
> |
if( MVABin == 5 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN5 ) pass = true; |
1791 |
> |
// pass &= (fChargedIso_DR0p0To0p1 + fChargedIso_DR0p1To0p2 + fChargedIso_DR0p2To0p3 < 0.7); |
1792 |
|
if( pass ) status.orStatus(SelectionStatus::LOOSEISO); |
1793 |
|
|
1794 |
|
// pass = false; |
1806 |
|
} |
1807 |
|
|
1808 |
|
|
1758 |
– |
|
1809 |
|
//-------------------------------------------------------------------------------------------------- |
1810 |
|
SelectionStatus electronIsoMVASelection(ControlFlags &ctrl, |
1811 |
|
const mithep::Electron * ele, |
1812 |
< |
const mithep::Vertex & vtx, |
1812 |
> |
const mithep::Vertex * vtx, |
1813 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
1814 |
|
float rho, |
1815 |
|
//const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
1906 |
|
|
1907 |
|
if(ctrl.debug) { |
1908 |
|
cout << "pf :: type: " << pf->PFType() << "\tpt: " << pf->Pt(); |
1909 |
< |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(vtx); |
1909 |
> |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(*vtx); |
1910 |
|
cout << endl; |
1911 |
|
} |
1912 |
|
|
2246 |
|
|
2247 |
|
|
2248 |
|
|
2249 |
+ |
|
2250 |
|
//-------------------------------------------------------------------------------------------------- |
2251 |
|
float electronPFIso04(ControlFlags &ctrl, |
2252 |
< |
const mithep::Electron * ele, |
2253 |
< |
const mithep::Vertex & vtx, |
2254 |
< |
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
2255 |
< |
const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
2256 |
< |
mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion, |
2257 |
< |
vector<const mithep::Muon*> muonsToVeto, |
2258 |
< |
vector<const mithep::Electron*> electronsToVeto) |
2252 |
> |
const mithep::Electron * ele, |
2253 |
> |
const mithep::Vertex * vtx, |
2254 |
> |
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
2255 |
> |
const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
2256 |
> |
mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion, |
2257 |
> |
vector<const mithep::Muon*> muonsToVeto, |
2258 |
> |
vector<const mithep::Electron*> electronsToVeto) |
2259 |
|
//-------------------------------------------------------------------------------------------------- |
2260 |
|
{ |
2261 |
< |
|
2261 |
> |
/* |
2262 |
|
if( ctrl.debug ) { |
2263 |
|
cout << "electronIsoMVASelection :: muons to veto " << endl; |
2264 |
|
for( int i=0; i<muonsToVeto.size(); i++ ) { |
2268 |
|
<< "\tphi: " << vmu->Phi() |
2269 |
|
<< endl; |
2270 |
|
} |
2271 |
< |
cout << "electronIsoMVASelection :: electrson to veto " << endl; |
2271 |
> |
cout << "electronIsoMVASelection :: electrons to veto " << endl; |
2272 |
|
for( int i=0; i<electronsToVeto.size(); i++ ) { |
2273 |
|
const mithep::Electron * vel = electronsToVeto[i]; |
2274 |
|
cout << "\tpt: " << vel->Pt() |
2278 |
|
<< endl; |
2279 |
|
} |
2280 |
|
} |
2281 |
< |
|
2281 |
> |
*/ |
2282 |
|
|
2283 |
|
// |
2284 |
|
// final iso |
2292 |
|
//Loop over PF Candidates |
2293 |
|
// |
2294 |
|
for(int k=0; k<fPFCandidates->GetEntries(); ++k) { |
2295 |
+ |
|
2296 |
+ |
|
2297 |
|
const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*fPFCandidates)[k]); |
2298 |
|
Double_t deta = (ele->Eta() - pf->Eta()); |
2299 |
|
Double_t dphi = mithep::MathUtils::DeltaPhi(Double_t(ele->Phi()),Double_t(pf->Phi())); |
2300 |
|
Double_t dr = mithep::MathUtils::DeltaR(ele->Phi(),ele->Eta(), pf->Phi(), pf->Eta()); |
2301 |
< |
if (dr >= 0.4) continue; |
2301 |
> |
|
2302 |
> |
if (dr > 0.4) continue; |
2303 |
> |
if( !(PFnoPUflag[k]) ) continue; // my PF no PU hack |
2304 |
> |
|
2305 |
|
if(ctrl.debug) { |
2306 |
< |
cout << "pf :: type: " << pf->PFType() << "\tpt: " << pf->Pt(); |
2307 |
< |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(vtx); |
2306 |
> |
cout << "pf :: type: " << pf->PFType() << "\tpt: " << pf->Pt() << "\tdR: " << dr; |
2307 |
> |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(*vtx) |
2308 |
> |
<< "\ttrk: " << pf->HasTrackerTrk() |
2309 |
> |
<< "\tgsf: " << pf->HasGsfTrk(); |
2310 |
> |
|
2311 |
|
cout << endl; |
2312 |
|
} |
2313 |
|
|
2314 |
|
|
2315 |
< |
if ( (pf->HasTrackerTrk() && (pf->TrackerTrk() == ele->TrackerTrk())) || |
2316 |
< |
(pf->HasGsfTrk() && (pf->GsfTrk() == ele->GsfTrk()))) continue; |
2317 |
< |
|
2315 |
> |
// |
2316 |
> |
// sync : I don't think theyre doing this ... |
2317 |
> |
// |
2318 |
> |
// if ( (pf->HasTrackerTrk() && (pf->TrackerTrk() == ele->TrackerTrk())) || |
2319 |
> |
// (pf->HasGsfTrk() && (pf->GsfTrk() == ele->GsfTrk()))) { |
2320 |
> |
// if( ctrl.debug ) cout << "\tskipping, matches to the electron ..." << endl; |
2321 |
> |
// continue; |
2322 |
> |
// } |
2323 |
> |
|
2324 |
|
|
2325 |
|
// |
2326 |
|
// Lepton Footprint Removal |
2333 |
|
// |
2334 |
|
for (Int_t q=0; q < electronsToVeto.size(); ++q) { |
2335 |
|
const mithep::Electron *tmpele = electronsToVeto[q]; |
2336 |
+ |
/* |
2337 |
|
// 4l electron |
2338 |
|
if( pf->HasTrackerTrk() ) { |
2339 |
|
if( pf->TrackerTrk() == tmpele->TrackerTrk() ) { |
2347 |
|
IsLeptonFootprint = kTRUE; |
2348 |
|
} |
2349 |
|
} |
2350 |
+ |
*/ |
2351 |
|
// PF charged |
2352 |
|
if (pf->Charge() != 0 && fabs(tmpele->SCluster()->Eta()) > 1.479 |
2353 |
|
&& mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()) < 0.015) { |
2362 |
|
} |
2363 |
|
} // loop over electrons |
2364 |
|
|
2365 |
< |
|
2365 |
> |
/* KH - comment for sync |
2366 |
|
// |
2367 |
|
// Check for muons |
2368 |
|
// |
2381 |
|
IsLeptonFootprint = kTRUE; |
2382 |
|
} |
2383 |
|
} // loop over muons |
2384 |
< |
|
2384 |
> |
*/ |
2385 |
|
|
2386 |
|
if (IsLeptonFootprint) |
2387 |
|
continue; |
2389 |
|
// |
2390 |
|
// Charged Iso |
2391 |
|
// |
2392 |
< |
if (pf->Charge() != 0 ) { |
2392 |
> |
if (pf->Charge() != 0 && (pf->HasTrackerTrk()||pf->HasGsfTrk()) ) { |
2393 |
|
|
2394 |
< |
if( pf->HasTrackerTrk() ) |
2395 |
< |
if (abs(pf->TrackerTrk()->DzCorrected(vtx)) > 0.2) continue; |
2396 |
< |
if( pf->HasGsfTrk() ) |
2397 |
< |
if (abs(pf->GsfTrk()->DzCorrected(vtx)) > 0.2) continue; |
2394 |
> |
// if( pf->HasTrackerTrk() ) |
2395 |
> |
// if (abs(pf->TrackerTrk()->DzCorrected(vtx)) > 0.2) continue; |
2396 |
> |
// if( pf->HasGsfTrk() ) |
2397 |
> |
// if (abs(pf->GsfTrk()->DzCorrected(vtx)) > 0.2) continue; |
2398 |
|
|
2399 |
|
// Veto any PFmuon, or PFEle |
2400 |
< |
if (abs(pf->PFType()) == PFCandidate::eElectron || abs(pf->PFType()) == PFCandidate::eMuon) continue; |
2400 |
> |
if (abs(pf->PFType()) == PFCandidate::eElectron || abs(pf->PFType()) == PFCandidate::eMuon) { |
2401 |
> |
cout << "\t skipping, pf is and ele or mu .." <<endl; |
2402 |
> |
continue; |
2403 |
> |
} |
2404 |
|
|
2405 |
|
// Footprint Veto |
2406 |
|
if (fabs(ele->SCluster()->Eta()) > 1.479 && dr < 0.015) continue; |
2423 |
|
if( ctrl.debug) cout << "gamma:: " << pf->Pt() << " " |
2424 |
|
<< dr << endl; |
2425 |
|
// KH, add to sync |
2426 |
< |
// if( pf->Pt() > 0.5 ) |
2426 |
> |
// if( pf->Pt() > 0.5 ) |
2427 |
|
fGammaIso += pf->Pt(); |
2428 |
|
} |
2429 |
|
|
2434 |
|
if( ctrl.debug) cout << "neutral:: " << pf->Pt() << " " |
2435 |
|
<< dr << endl; |
2436 |
|
// KH, add to sync |
2437 |
< |
// if( pf->Pt() > 0.5 ) |
2437 |
> |
// if( pf->Pt() > 0.5 ) |
2438 |
|
fNeutralHadronIso += pf->Pt(); |
2439 |
|
} |
2440 |
|
|
2442 |
|
|
2443 |
|
} |
2444 |
|
|
2445 |
< |
double rho = 0; |
2446 |
< |
// if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
2447 |
< |
// rho = fPUEnergyDensity->At(0)->Rho(); |
2448 |
< |
if (!(isnan(fPUEnergyDensity->At(0)->RhoLowEta()) || isinf(fPUEnergyDensity->At(0)->RhoLowEta()))) |
2449 |
< |
rho = fPUEnergyDensity->At(0)->RhoLowEta(); |
2445 |
> |
|
2446 |
> |
double rho=0; |
2447 |
> |
if (!(isnan(fPUEnergyDensity->At(0)->RhoKt6PFJets()) || isinf(fPUEnergyDensity->At(0)->RhoKt6PFJets()))) |
2448 |
> |
rho = fPUEnergyDensity->At(0)->RhoKt6PFJets(); |
2449 |
> |
|
2450 |
> |
|
2451 |
|
|
2452 |
|
// WARNING!!!! |
2453 |
|
// hardcode for sync ... |
2454 |
< |
EffectiveAreaVersion = eleT.kEleEAData2011; |
2454 |
> |
EffectiveAreaVersion = eleT.kEleEAData2012; |
2455 |
|
// WARNING!!!! |
2456 |
|
|
2457 |
+ |
eleT.ElectronEffectiveArea(eleT.kEleGammaAndNeutralHadronIso04,ele->Eta(),EffectiveAreaVersion) << endl; |
2458 |
+ |
|
2459 |
|
|
2460 |
|
double pfIso = fChargedIso + fmax(0.0,(fGammaIso + fNeutralHadronIso |
2461 |
|
-rho*eleT.ElectronEffectiveArea(eleT.kEleGammaAndNeutralHadronIso04, |
2462 |
|
ele->Eta(),EffectiveAreaVersion))); |
2463 |
|
|
2464 |
+ |
|
2465 |
|
gChargedIso = fChargedIso; |
2466 |
|
gGammaIso = fGammaIso; |
2467 |
|
gNeutralIso = fNeutralHadronIso; |
2394 |
– |
|
2468 |
|
return pfIso; |
2469 |
|
} |
2470 |
|
|
2471 |
+ |
|
2472 |
+ |
|
2473 |
|
//-------------------------------------------------------------------------------------------------- |
2474 |
|
// hacked version |
2475 |
|
float electronPFIso04(ControlFlags &ctrl, |
2476 |
|
const mithep::Electron * ele, |
2477 |
< |
const mithep::Vertex & vtx, |
2477 |
> |
const mithep::Vertex * vtx, |
2478 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
2479 |
|
float rho, |
2480 |
|
mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion, |
2528 |
|
|
2529 |
|
if(ctrl.debug) { |
2530 |
|
cout << "pf :: type: " << pf->PFType() << "\tpt: " << pf->Pt() << "\tdR: " << dr; |
2531 |
< |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(vtx) |
2531 |
> |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(*vtx) |
2532 |
|
<< "\ttrk: " << pf->HasTrackerTrk() |
2533 |
|
<< "\tgsf: " << pf->HasGsfTrk(); |
2534 |
|
|
2691 |
|
//-------------------------------------------------------------------------------------------------- |
2692 |
|
SelectionStatus electronReferenceIsoSelection(ControlFlags &ctrl, |
2693 |
|
const mithep::Electron * ele, |
2694 |
< |
const mithep::Vertex & vtx, |
2694 |
> |
const mithep::Vertex * vtx, |
2695 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
2696 |
|
const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
2697 |
|
mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion, |
2727 |
|
// hacked version |
2728 |
|
SelectionStatus electronReferenceIsoSelection(ControlFlags &ctrl, |
2729 |
|
const mithep::Electron * ele, |
2730 |
< |
const mithep::Vertex & vtx, |
2730 |
> |
const mithep::Vertex * vtx, |
2731 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
2732 |
|
float rho, |
2733 |
|
mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion, |