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 |
> |
|
472 |
> |
// if (!(isnan(fPUEnergyDensity->At(0)->RhoLowEta()) || isinf(fPUEnergyDensity->At(0)->RhoLowEta()))) |
473 |
> |
// rho = fPUEnergyDensity->At(0)->RhoLowEta(); |
474 |
|
|
475 |
|
// WARNING!!!! |
476 |
|
// hardcode for sync ... |
554 |
|
|
555 |
|
pass = false; |
556 |
|
if( mu->IsGlobalMuon() && mu->IsTrackerMuon() |
557 |
< |
&& fabs(mu->Eta()) <= 1.5 && mu->Pt() <= 10 && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN0) pass = true; |
557 |
> |
&& fabs(mu->Eta()) <= 1.5 && mu->Pt() <= 10 && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN0) pass = true; |
558 |
|
else if( mu->IsGlobalMuon() && mu->IsTrackerMuon() |
559 |
< |
&& fabs(mu->Eta()) <= 1.5 && mu->Pt() > 10 && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN1) pass = true; |
559 |
> |
&& fabs(mu->Eta()) <= 1.5 && mu->Pt() > 10 && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN1) pass = true; |
560 |
|
else if( mu->IsGlobalMuon() && mu->IsTrackerMuon() |
561 |
< |
&& fabs(mu->Eta()) > 1.5 && mu->Pt() <= 10 && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN2) pass = true; |
561 |
> |
&& fabs(mu->Eta()) > 1.5 && mu->Pt() <= 10 && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN2) pass = true; |
562 |
|
else if( mu->IsGlobalMuon() && mu->IsTrackerMuon() |
563 |
< |
&& fabs(mu->Eta()) > 1.5 && mu->Pt() > 10 && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN3) pass = true; |
564 |
< |
else if( !(mu->IsGlobalMuon()) && mu->IsTrackerMuon() && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN4) pass = true; |
565 |
< |
else if( mu->IsGlobalMuon() && !(mu->IsTrackerMuon()) && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_BIN5) pass = true; |
563 |
> |
&& fabs(mu->Eta()) > 1.5 && mu->Pt() > 10 && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN3) pass = true; |
564 |
> |
else if( !(mu->IsGlobalMuon()) && mu->IsTrackerMuon() && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN4) pass = true; |
565 |
> |
else if( mu->IsGlobalMuon() && !(mu->IsTrackerMuon()) && mvaval >= MUON_ISOMVA_LOOSE_FORPFID_CUT_OPT_BIN5) pass = true; |
566 |
|
if( pass ) status.orStatus(SelectionStatus::LOOSEISO); |
567 |
|
|
568 |
+ |
/* |
569 |
|
pass = false; |
570 |
|
if( mu->IsGlobalMuon() && mu->IsTrackerMuon() |
571 |
|
&& fabs(mu->Eta()) <= 1.5 && mu->Pt() <= 10 && mvaval >= MUON_ISOMVA_TIGHT_FORPFID_CUT_BIN0) pass = true; |
578 |
|
else if( !(mu->IsGlobalMuon()) && mu->IsTrackerMuon() && mvaval >= MUON_ISOMVA_TIGHT_FORPFID_CUT_BIN4) pass = true; |
579 |
|
else if( mu->IsGlobalMuon() && !(mu->IsTrackerMuon()) && mvaval >= MUON_ISOMVA_TIGHT_FORPFID_CUT_BIN5) pass = true; |
580 |
|
if( pass ) status.orStatus(SelectionStatus::TIGHTISO); |
581 |
+ |
*/ |
582 |
|
|
583 |
|
// pass &= (fChargedIso_DR0p0To0p1 + fChargedIso_DR0p1To0p2 + fChargedIso_DR0p2To0p3 < 0.7); |
584 |
|
|
585 |
< |
if(ctrl.debug) cout << "returning status : " << hex << status.getStatus() << dec << endl; |
585 |
> |
status.isoMVA = mvaval; |
586 |
> |
|
587 |
> |
if(ctrl.debug) { |
588 |
> |
cout << "returning status : " << hex << status.getStatus() << dec << endl; |
589 |
> |
cout << "MVAVAL : " << status.isoMVA << endl; |
590 |
> |
} |
591 |
|
return status; |
592 |
|
|
593 |
|
} |
596 |
|
//-------------------------------------------------------------------------------------------------- |
597 |
|
SelectionStatus muonIsoMVASelection(ControlFlags &ctrl, |
598 |
|
const mithep::Muon * mu, |
599 |
< |
const mithep::Vertex & vtx, |
599 |
> |
const mithep::Vertex * vtx, |
600 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
601 |
|
float rho, |
602 |
|
//const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
953 |
|
} |
954 |
|
|
955 |
|
|
956 |
+ |
|
957 |
+ |
|
958 |
|
//-------------------------------------------------------------------------------------------------- |
959 |
|
double muonPFIso04(ControlFlags &ctrl, |
960 |
|
const mithep::Muon * mu, |
961 |
< |
const mithep::Vertex & vtx, |
961 |
> |
const mithep::Vertex * vtx, |
962 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
963 |
|
const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
964 |
|
mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion, |
966 |
|
vector<const mithep::Electron*> electronsToVeto) |
967 |
|
//-------------------------------------------------------------------------------------------------- |
968 |
|
{ |
969 |
+ |
|
970 |
+ |
extern double gChargedIso; |
971 |
+ |
extern double gGammaIso; |
972 |
+ |
extern double gNeutralIso; |
973 |
|
|
974 |
|
if( ctrl.debug ) { |
975 |
|
cout << "muonIsoMVASelection :: muons to veto " << endl; |
1001 |
|
//Loop over PF Candidates |
1002 |
|
// |
1003 |
|
for(int k=0; k<fPFCandidates->GetEntries(); ++k) { |
1004 |
+ |
|
1005 |
+ |
if( !(PFnoPUflag[k]) ) continue; // my PF no PU hack |
1006 |
|
const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*fPFCandidates)[k]); |
1007 |
|
|
1008 |
|
Double_t deta = (mu->Eta() - pf->Eta()); |
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) |
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 to sync |
1024 |
< |
/* |
1049 |
> |
/* KH - comment for sync |
1050 |
|
// |
1051 |
|
// Check for muons |
1052 |
|
// |
1069 |
|
// |
1070 |
|
// Charged Iso |
1071 |
|
// |
1072 |
< |
if (pf->Charge() != 0 ) { |
1072 |
> |
if (pf->Charge() != 0 && (pf->HasTrackerTrk()||pf->HasGsfTrk()) ) { |
1073 |
|
|
1074 |
|
//if( dr < 0.01 ) continue; // only for muon iso mva? |
1075 |
|
if (abs(pf->PFType()) == PFCandidate::eElectron || abs(pf->PFType()) == PFCandidate::eMuon) continue; |
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 |
< |
} |
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 |
|
|
1092 |
|
fChargedIso += pf->Pt(); |
1113 |
|
} |
1114 |
|
|
1115 |
|
} |
1090 |
– |
|
1091 |
– |
double rho = 0; |
1092 |
– |
// if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
1093 |
– |
// rho = fPUEnergyDensity->At(0)->Rho(); |
1094 |
– |
if (!(isnan(fPUEnergyDensity->At(0)->RhoLowEta()) || isinf(fPUEnergyDensity->At(0)->RhoLowEta()))) |
1095 |
– |
rho = fPUEnergyDensity->At(0)->RhoLowEta(); |
1096 |
– |
|
1097 |
– |
// WARNING!!!! |
1098 |
– |
// hardcode for sync ... |
1099 |
– |
EffectiveAreaVersion = muT.kMuEAData2011; |
1100 |
– |
// WARNING!!!! |
1116 |
|
|
1117 |
+ |
double rho=0; |
1118 |
+ |
if( (EffectiveAreaVersion == mithep::MuonTools::kMuEAFall11MC) || |
1119 |
+ |
(EffectiveAreaVersion == mithep::MuonTools::kMuEAData2011) ) { |
1120 |
+ |
if (!(isnan(fPUEnergyDensity->At(0)->RhoKt6PFJetsForIso25()) || |
1121 |
+ |
isinf(fPUEnergyDensity->At(0)->RhoKt6PFJetsForIso25()))) |
1122 |
+ |
rho = fPUEnergyDensity->At(0)->RhoKt6PFJetsForIso25(); |
1123 |
+ |
// !!!!!!!!!!!!! TMP HACK FOR SYNC !!!!!!!!!!!!!!!!!!!!! |
1124 |
+ |
EffectiveAreaVersion = mithep::MuonTools::kMuEAData2011; |
1125 |
+ |
// !!!!!!!!!!!!! TMP HACK FOR SYNC !!!!!!!!!!!!!!!!!!!!! |
1126 |
+ |
} else { |
1127 |
+ |
if (!(isnan(fPUEnergyDensity->At(0)->RhoKt6PFJetsCentralNeutral()) || |
1128 |
+ |
isinf(fPUEnergyDensity->At(0)->RhoKt6PFJetsCentralNeutral()))) |
1129 |
+ |
rho = fPUEnergyDensity->At(0)->RhoKt6PFJetsCentralNeutral(); |
1130 |
+ |
// !!!!!!!!!!!!! TMP HACK FOR SYNC !!!!!!!!!!!!!!!!!!!!! |
1131 |
+ |
EffectiveAreaVersion = mithep::MuonTools::kMuEAData2011; |
1132 |
+ |
// !!!!!!!!!!!!! TMP HACK FOR SYNC !!!!!!!!!!!!!!!!!!!!! |
1133 |
+ |
} |
1134 |
+ |
if(ctrl.debug) cout << "rho: " << rho << endl; |
1135 |
|
|
1136 |
|
double pfIso = fChargedIso + fmax(0.0,(fGammaIso + fNeutralHadronIso |
1137 |
|
-rho*muT.MuonEffectiveArea(muT.kMuGammaAndNeutralHadronIso04, |
1138 |
|
mu->Eta(),EffectiveAreaVersion))); |
1106 |
– |
|
1139 |
|
gChargedIso = fChargedIso; |
1140 |
< |
gGammaIso = fGammaIso; |
1141 |
< |
gNeutralIso = fNeutralHadronIso; |
1140 |
> |
gGammaIso = fGammaIso; |
1141 |
> |
gNeutralIso = fNeutralHadronIso; |
1142 |
> |
|
1143 |
|
return pfIso; |
1144 |
|
} |
1145 |
|
|
1146 |
|
|
1147 |
+ |
|
1148 |
+ |
|
1149 |
|
//-------------------------------------------------------------------------------------------------- |
1150 |
|
// hacked version |
1151 |
|
double muonPFIso04(ControlFlags &ctrl, |
1152 |
|
const mithep::Muon * mu, |
1153 |
< |
const mithep::Vertex & vtx, |
1153 |
> |
const mithep::Vertex * vtx, |
1154 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
1155 |
|
float rho, |
1156 |
|
mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion, |
1326 |
|
//-------------------------------------------------------------------------------------------------- |
1327 |
|
SelectionStatus muonReferenceIsoSelection(ControlFlags &ctrl, |
1328 |
|
const mithep::Muon * mu, |
1329 |
< |
const mithep::Vertex & vtx, |
1329 |
> |
const mithep::Vertex * vtx, |
1330 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
1331 |
|
const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
1332 |
|
mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion, |
1362 |
|
// hacked version |
1363 |
|
SelectionStatus muonReferenceIsoSelection(ControlFlags &ctrl, |
1364 |
|
const mithep::Muon * mu, |
1365 |
< |
const mithep::Vertex & vtx, |
1365 |
> |
const mithep::Vertex * vtx, |
1366 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
1367 |
|
float rho, |
1368 |
|
mithep::MuonTools::EMuonEffectiveAreaTarget EffectiveAreaVersion, |
1395 |
|
|
1396 |
|
|
1397 |
|
|
1398 |
+ |
|
1399 |
|
//-------------------------------------------------------------------------------------------------- |
1400 |
|
SelectionStatus electronIsoMVASelection(ControlFlags &ctrl, |
1401 |
|
const mithep::Electron * ele, |
1402 |
< |
const mithep::Vertex & vtx, |
1402 |
> |
const mithep::Vertex * vtx, |
1403 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
1404 |
|
const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
1405 |
|
mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion, |
1438 |
|
Double_t tmpChargedIso_DR0p2To0p3 = 0; |
1439 |
|
Double_t tmpChargedIso_DR0p3To0p4 = 0; |
1440 |
|
Double_t tmpChargedIso_DR0p4To0p5 = 0; |
1405 |
– |
Double_t tmpChargedIso_DR0p5To0p7 = 0; |
1441 |
|
|
1442 |
|
Double_t tmpGammaIso_DR0p0To0p1 = 0; |
1443 |
|
Double_t tmpGammaIso_DR0p1To0p2 = 0; |
1444 |
|
Double_t tmpGammaIso_DR0p2To0p3 = 0; |
1445 |
|
Double_t tmpGammaIso_DR0p3To0p4 = 0; |
1446 |
|
Double_t tmpGammaIso_DR0p4To0p5 = 0; |
1447 |
< |
Double_t tmpGammaIso_DR0p5To0p7 = 0; |
1447 |
> |
|
1448 |
|
|
1449 |
|
Double_t tmpNeutralHadronIso_DR0p0To0p1 = 0; |
1450 |
|
Double_t tmpNeutralHadronIso_DR0p1To0p2 = 0; |
1451 |
|
Double_t tmpNeutralHadronIso_DR0p2To0p3 = 0; |
1452 |
|
Double_t tmpNeutralHadronIso_DR0p3To0p4 = 0; |
1453 |
|
Double_t tmpNeutralHadronIso_DR0p4To0p5 = 0; |
1419 |
– |
Double_t tmpNeutralHadronIso_DR0p5To0p7 = 0; |
1454 |
|
|
1455 |
|
|
1456 |
|
|
1487 |
|
Double_t deta = (ele->Eta() - pf->Eta()); |
1488 |
|
Double_t dphi = mithep::MathUtils::DeltaPhi(Double_t(ele->Phi()),Double_t(pf->Phi())); |
1489 |
|
Double_t dr = mithep::MathUtils::DeltaR(ele->Phi(),ele->Eta(), pf->Phi(), pf->Eta()); |
1490 |
< |
if (dr > 0.5) continue; |
1490 |
> |
if (dr > 1.0) continue; |
1491 |
> |
|
1492 |
|
if(ctrl.debug) { |
1493 |
|
cout << "pf :: type: " << pf->PFType() << "\tpt: " << pf->Pt(); |
1494 |
< |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(vtx); |
1494 |
> |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(*vtx); |
1495 |
|
cout << endl; |
1496 |
|
} |
1497 |
|
|
1506 |
|
Bool_t IsLeptonFootprint = kFALSE; |
1507 |
|
if (dr < 1.0) { |
1508 |
|
|
1509 |
+ |
|
1510 |
|
// |
1511 |
|
// Check for electrons |
1512 |
|
// |
1513 |
+ |
|
1514 |
|
for (Int_t q=0; q < electronsToVeto.size(); ++q) { |
1515 |
|
const mithep::Electron *tmpele = electronsToVeto[q]; |
1516 |
+ |
double tmpdr = mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()); |
1517 |
+ |
|
1518 |
|
// 4l electron |
1519 |
|
if( pf->HasTrackerTrk() ) { |
1520 |
|
if( pf->TrackerTrk() == tmpele->TrackerTrk() ) { |
1529 |
|
} |
1530 |
|
} |
1531 |
|
// PF charged |
1532 |
< |
if (pf->Charge() != 0 && fabs(tmpele->SCluster()->Eta()) >= 1.479 |
1494 |
< |
&& mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()) < 0.015) { |
1532 |
> |
if (pf->Charge() != 0 && fabs(tmpele->SCluster()->Eta()) >= 1.479 && tmpdr < 0.015) { |
1533 |
|
if( ctrl.debug) cout << "\tcharged trk, dR matches 4L ele ..." << endl; |
1534 |
|
IsLeptonFootprint = kTRUE; |
1535 |
|
} |
1536 |
|
// PF gamma |
1537 |
|
if (abs(pf->PFType()) == PFCandidate::eGamma && fabs(tmpele->SCluster()->Eta()) >= 1.479 |
1538 |
< |
&& mithep::MathUtils::DeltaR(tmpele->Phi(),tmpele->Eta(), pf->Phi(), pf->Eta()) < 0.08) { |
1538 |
> |
&& tmpdr < 0.08) { |
1539 |
|
if( ctrl.debug) cout << "\tPF gamma, matches 4L ele ..." << endl; |
1540 |
|
IsLeptonFootprint = kTRUE; |
1541 |
|
} |
1542 |
|
} // loop over electrons |
1543 |
|
|
1544 |
+ |
|
1545 |
|
/* KH - comment for sync |
1546 |
|
// |
1547 |
|
// Check for muons |
1592 |
|
if (dr >= 0.2 && dr < 0.3) tmpChargedIso_DR0p2To0p3 += pf->Pt(); |
1593 |
|
if (dr >= 0.3 && dr < 0.4) tmpChargedIso_DR0p3To0p4 += pf->Pt(); |
1594 |
|
if (dr >= 0.4 && dr < 0.5) tmpChargedIso_DR0p4To0p5 += pf->Pt(); |
1556 |
– |
if (dr >= 0.5 && dr < 0.7) tmpChargedIso_DR0p5To0p7 += pf->Pt(); |
1595 |
|
|
1596 |
|
} |
1597 |
|
|
1600 |
|
// |
1601 |
|
else if (abs(pf->PFType()) == PFCandidate::eGamma) { |
1602 |
|
|
1603 |
< |
if (fabs(ele->SCluster()->Eta()) > 1.479) { |
1566 |
< |
if (mithep::MathUtils::DeltaR(ele->Phi(),ele->Eta(), pf->Phi(), pf->Eta()) < 0.08) continue; |
1567 |
< |
} |
1603 |
> |
if (fabs(ele->SCluster()->Eta()) > 1.479 && dr < 0.08) continue; |
1604 |
|
|
1605 |
|
if( ctrl.debug) cout << "gamma:: " << pf->Pt() << " " |
1606 |
|
<< dr << endl; |
1610 |
|
if (dr >= 0.2 && dr < 0.3) tmpGammaIso_DR0p2To0p3 += pf->Pt(); |
1611 |
|
if (dr >= 0.3 && dr < 0.4) tmpGammaIso_DR0p3To0p4 += pf->Pt(); |
1612 |
|
if (dr >= 0.4 && dr < 0.5) tmpGammaIso_DR0p4To0p5 += pf->Pt(); |
1577 |
– |
if (dr >= 0.5 && dr < 0.7) tmpGammaIso_DR0p5To0p7 += pf->Pt(); |
1578 |
– |
|
1613 |
|
} |
1614 |
|
|
1615 |
|
// |
1623 |
|
if (dr >= 0.2 && dr < 0.3) tmpNeutralHadronIso_DR0p2To0p3 += pf->Pt(); |
1624 |
|
if (dr >= 0.3 && dr < 0.4) tmpNeutralHadronIso_DR0p3To0p4 += pf->Pt(); |
1625 |
|
if (dr >= 0.4 && dr < 0.5) tmpNeutralHadronIso_DR0p4To0p5 += pf->Pt(); |
1592 |
– |
if (dr >= 0.5 && dr < 0.7) tmpNeutralHadronIso_DR0p5To0p7 += pf->Pt(); |
1626 |
|
} |
1627 |
|
|
1628 |
|
} |
1635 |
|
fChargedIso_DR0p3To0p4 = fmin((tmpChargedIso_DR0p3To0p4)/ele->Pt(), 2.5); |
1636 |
|
fChargedIso_DR0p4To0p5 = fmin((tmpChargedIso_DR0p4To0p5)/ele->Pt(), 2.5); |
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(); |
1638 |
> |
if(ctrl.debug) { |
1639 |
> |
cout << "fChargedIso_DR0p0To0p1 : " << fChargedIso_DR0p0To0p1 << endl; |
1640 |
> |
cout << "fChargedIso_DR0p1To0p2 : " << fChargedIso_DR0p1To0p2 << endl; |
1641 |
> |
cout << "fChargedIso_DR0p2To0p3 : " << fChargedIso_DR0p2To0p3 << endl; |
1642 |
> |
cout << "fChargedIso_DR0p3To0p4 : " << fChargedIso_DR0p3To0p4 << endl; |
1643 |
> |
cout << "fChargedIso_DR0p4To0p5 : " << fChargedIso_DR0p4To0p5 << endl; |
1644 |
> |
} |
1645 |
|
|
1646 |
+ |
|
1647 |
+ |
double rho = 0; |
1648 |
+ |
if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
1649 |
+ |
rho = fPUEnergyDensity->At(0)->Rho(); |
1650 |
+ |
// if (!(isnan(fPUEnergyDensity->At(0)->RhoLowEta()) || isinf(fPUEnergyDensity->At(0)->RhoLowEta()))) |
1651 |
+ |
// rho = fPUEnergyDensity->At(0)->RhoLowEta(); |
1652 |
+ |
|
1653 |
|
// WARNING!!!! |
1654 |
|
// hardcode for sync ... |
1655 |
< |
// EffectiveAreaVersion = eleT.kEleEAData2011; |
1614 |
< |
EffectiveAreaVersion = eleT.kEleEAFall11MC; |
1655 |
> |
EffectiveAreaVersion = eleT.kEleEAData2011; |
1656 |
|
// WARNING!!!! |
1657 |
|
|
1658 |
|
if( ctrl.debug) { |
1709 |
|
,0.0); |
1710 |
|
|
1711 |
|
|
1712 |
+ |
if( ctrl.debug) { |
1713 |
+ |
cout << "fGammaIso_DR0p0To0p1: " << fGammaIso_DR0p0To0p1 << endl; |
1714 |
+ |
cout << "fGammaIso_DR0p1To0p2: " << fGammaIso_DR0p1To0p2 << endl; |
1715 |
+ |
cout << "fGammaIso_DR0p2To0p3: " << fGammaIso_DR0p2To0p3 << endl; |
1716 |
+ |
cout << "fGammaIso_DR0p3To0p4: " << fGammaIso_DR0p3To0p4 << endl; |
1717 |
+ |
cout << "fGammaIso_DR0p4To0p5: " << fGammaIso_DR0p4To0p5 << endl; |
1718 |
+ |
} |
1719 |
+ |
|
1720 |
|
fNeutralHadronIso_DR0p0To0p1 = fmax(fmin((tmpNeutralHadronIso_DR0p0To0p1 |
1721 |
|
-rho*eleT.ElectronEffectiveArea(eleT.kEleNeutralHadronIsoDR0p0To0p1, |
1722 |
|
ele->SCluster()->Eta(),EffectiveAreaVersion))/ele->Pt() |
1743 |
|
, 2.5) |
1744 |
|
, 0.0); |
1745 |
|
|
1746 |
+ |
if( ctrl.debug) { |
1747 |
+ |
cout << "fNeutralHadronIso_DR0p0To0p1: " << fNeutralHadronIso_DR0p0To0p1 << endl; |
1748 |
+ |
cout << "fNeutralHadronIso_DR0p1To0p2: " << fNeutralHadronIso_DR0p1To0p2 << endl; |
1749 |
+ |
cout << "fNeutralHadronIso_DR0p2To0p3: " << fNeutralHadronIso_DR0p2To0p3 << endl; |
1750 |
+ |
cout << "fNeutralHadronIso_DR0p3To0p4: " << fNeutralHadronIso_DR0p3To0p4 << endl; |
1751 |
+ |
cout << "fNeutralHadronIso_DR0p4To0p5: " << fNeutralHadronIso_DR0p4To0p5 << endl; |
1752 |
+ |
} |
1753 |
+ |
|
1754 |
|
double mvaval = eleIsoMVA->MVAValue_IsoRings( ele->Pt(), |
1755 |
|
ele->SCluster()->Eta(), |
1756 |
|
fChargedIso_DR0p0To0p1, |
1771 |
|
ctrl.debug); |
1772 |
|
|
1773 |
|
SelectionStatus status; |
1774 |
+ |
status.isoMVA = mvaval; |
1775 |
|
bool pass = false; |
1776 |
|
|
1777 |
|
Int_t subdet = 0; |
1778 |
|
if (fabs(ele->SCluster()->Eta()) < 0.8) subdet = 0; |
1779 |
|
else if (fabs(ele->SCluster()->Eta()) < 1.479) subdet = 1; |
1780 |
|
else subdet = 2; |
1781 |
+ |
|
1782 |
|
Int_t ptBin = 0; |
1783 |
< |
if (ele->Pt() > 10.0) ptBin = 1; |
1783 |
> |
if (ele->Pt() >= 10.0) ptBin = 1; |
1784 |
|
|
1785 |
|
Int_t MVABin = -1; |
1786 |
|
if (subdet == 0 && ptBin == 0) MVABin = 0; |
1791 |
|
if (subdet == 2 && ptBin == 1) MVABin = 5; |
1792 |
|
|
1793 |
|
pass = false; |
1794 |
< |
if( MVABin == 0 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_BIN0 ) pass = true; |
1795 |
< |
if( MVABin == 1 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_BIN1 ) pass = true; |
1796 |
< |
if( MVABin == 2 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_BIN2 ) pass = true; |
1797 |
< |
if( MVABin == 3 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_BIN3 ) pass = true; |
1798 |
< |
if( MVABin == 4 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_BIN4 ) pass = true; |
1799 |
< |
if( MVABin == 5 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_BIN5 ) pass = true; |
1794 |
> |
if( MVABin == 0 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN0 ) pass = true; |
1795 |
> |
if( MVABin == 1 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN1 ) pass = true; |
1796 |
> |
if( MVABin == 2 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN2 ) pass = true; |
1797 |
> |
if( MVABin == 3 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN3 ) pass = true; |
1798 |
> |
if( MVABin == 4 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN4 ) pass = true; |
1799 |
> |
if( MVABin == 5 && mvaval > ELECTRON_LOOSE_ISOMVA_CUT_OPT_BIN5 ) pass = true; |
1800 |
> |
// pass &= (fChargedIso_DR0p0To0p1 + fChargedIso_DR0p1To0p2 + fChargedIso_DR0p2To0p3 < 0.7); |
1801 |
|
if( pass ) status.orStatus(SelectionStatus::LOOSEISO); |
1802 |
|
|
1803 |
|
// pass = false; |
1815 |
|
} |
1816 |
|
|
1817 |
|
|
1758 |
– |
|
1818 |
|
//-------------------------------------------------------------------------------------------------- |
1819 |
|
SelectionStatus electronIsoMVASelection(ControlFlags &ctrl, |
1820 |
|
const mithep::Electron * ele, |
1821 |
< |
const mithep::Vertex & vtx, |
1821 |
> |
const mithep::Vertex * vtx, |
1822 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
1823 |
|
float rho, |
1824 |
|
//const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
1915 |
|
|
1916 |
|
if(ctrl.debug) { |
1917 |
|
cout << "pf :: type: " << pf->PFType() << "\tpt: " << pf->Pt(); |
1918 |
< |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(vtx); |
1918 |
> |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(*vtx); |
1919 |
|
cout << endl; |
1920 |
|
} |
1921 |
|
|
2255 |
|
|
2256 |
|
|
2257 |
|
|
2258 |
+ |
|
2259 |
|
//-------------------------------------------------------------------------------------------------- |
2260 |
|
float electronPFIso04(ControlFlags &ctrl, |
2261 |
< |
const mithep::Electron * ele, |
2262 |
< |
const mithep::Vertex & vtx, |
2263 |
< |
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
2264 |
< |
const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
2265 |
< |
mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion, |
2266 |
< |
vector<const mithep::Muon*> muonsToVeto, |
2267 |
< |
vector<const mithep::Electron*> electronsToVeto) |
2261 |
> |
const mithep::Electron * ele, |
2262 |
> |
const mithep::Vertex * vtx, |
2263 |
> |
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
2264 |
> |
const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
2265 |
> |
mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion, |
2266 |
> |
vector<const mithep::Muon*> muonsToVeto, |
2267 |
> |
vector<const mithep::Electron*> electronsToVeto) |
2268 |
|
//-------------------------------------------------------------------------------------------------- |
2269 |
|
{ |
2270 |
< |
|
2270 |
> |
/* |
2271 |
|
if( ctrl.debug ) { |
2272 |
|
cout << "electronIsoMVASelection :: muons to veto " << endl; |
2273 |
|
for( int i=0; i<muonsToVeto.size(); i++ ) { |
2277 |
|
<< "\tphi: " << vmu->Phi() |
2278 |
|
<< endl; |
2279 |
|
} |
2280 |
< |
cout << "electronIsoMVASelection :: electrson to veto " << endl; |
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() |
2287 |
|
<< endl; |
2288 |
|
} |
2289 |
|
} |
2290 |
< |
|
2290 |
> |
*/ |
2291 |
|
|
2292 |
|
// |
2293 |
|
// final iso |
2301 |
|
//Loop over PF Candidates |
2302 |
|
// |
2303 |
|
for(int k=0; k<fPFCandidates->GetEntries(); ++k) { |
2304 |
+ |
|
2305 |
+ |
|
2306 |
|
const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*fPFCandidates)[k]); |
2307 |
|
Double_t deta = (ele->Eta() - pf->Eta()); |
2308 |
|
Double_t dphi = mithep::MathUtils::DeltaPhi(Double_t(ele->Phi()),Double_t(pf->Phi())); |
2309 |
|
Double_t dr = mithep::MathUtils::DeltaR(ele->Phi(),ele->Eta(), pf->Phi(), pf->Eta()); |
2310 |
< |
if (dr >= 0.4) continue; |
2310 |
> |
|
2311 |
> |
if (dr > 0.4) continue; |
2312 |
> |
if( !(PFnoPUflag[k]) ) continue; // my PF no PU hack |
2313 |
> |
|
2314 |
|
if(ctrl.debug) { |
2315 |
< |
cout << "pf :: type: " << pf->PFType() << "\tpt: " << pf->Pt(); |
2316 |
< |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(vtx); |
2315 |
> |
cout << "pf :: type: " << pf->PFType() << "\tpt: " << pf->Pt() << "\tdR: " << dr; |
2316 |
> |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(*vtx) |
2317 |
> |
<< "\ttrk: " << pf->HasTrackerTrk() |
2318 |
> |
<< "\tgsf: " << pf->HasGsfTrk(); |
2319 |
> |
|
2320 |
|
cout << endl; |
2321 |
|
} |
2322 |
|
|
2323 |
|
|
2324 |
< |
if ( (pf->HasTrackerTrk() && (pf->TrackerTrk() == ele->TrackerTrk())) || |
2325 |
< |
(pf->HasGsfTrk() && (pf->GsfTrk() == ele->GsfTrk()))) continue; |
2326 |
< |
|
2324 |
> |
// |
2325 |
> |
// sync : I don't think theyre doing this ... |
2326 |
> |
// |
2327 |
> |
// if ( (pf->HasTrackerTrk() && (pf->TrackerTrk() == ele->TrackerTrk())) || |
2328 |
> |
// (pf->HasGsfTrk() && (pf->GsfTrk() == ele->GsfTrk()))) { |
2329 |
> |
// if( ctrl.debug ) cout << "\tskipping, matches to the electron ..." << endl; |
2330 |
> |
// continue; |
2331 |
> |
// } |
2332 |
> |
|
2333 |
|
|
2334 |
|
// |
2335 |
|
// Lepton Footprint Removal |
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() ) { |
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) { |
2371 |
|
} |
2372 |
|
} // loop over electrons |
2373 |
|
|
2374 |
< |
|
2374 |
> |
/* KH - comment for sync |
2375 |
|
// |
2376 |
|
// Check for muons |
2377 |
|
// |
2390 |
|
IsLeptonFootprint = kTRUE; |
2391 |
|
} |
2392 |
|
} // loop over muons |
2393 |
< |
|
2393 |
> |
*/ |
2394 |
|
|
2395 |
|
if (IsLeptonFootprint) |
2396 |
|
continue; |
2398 |
|
// |
2399 |
|
// Charged Iso |
2400 |
|
// |
2401 |
< |
if (pf->Charge() != 0 ) { |
2401 |
> |
if (pf->Charge() != 0 && (pf->HasTrackerTrk()||pf->HasGsfTrk()) ) { |
2402 |
|
|
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; |
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 |
|
|
2408 |
|
// Veto any PFmuon, or PFEle |
2409 |
< |
if (abs(pf->PFType()) == PFCandidate::eElectron || abs(pf->PFType()) == PFCandidate::eMuon) continue; |
2409 |
> |
if (abs(pf->PFType()) == PFCandidate::eElectron || abs(pf->PFType()) == PFCandidate::eMuon) { |
2410 |
> |
if( ctrl.debug ) cout << "\t skipping, pf is and ele or mu .." <<endl; |
2411 |
> |
continue; |
2412 |
> |
} |
2413 |
|
|
2414 |
|
// Footprint Veto |
2415 |
|
if (fabs(ele->SCluster()->Eta()) > 1.479 && dr < 0.015) continue; |
2432 |
|
if( ctrl.debug) cout << "gamma:: " << pf->Pt() << " " |
2433 |
|
<< dr << endl; |
2434 |
|
// KH, add to sync |
2435 |
< |
// if( pf->Pt() > 0.5 ) |
2435 |
> |
// if( pf->Pt() > 0.5 ) |
2436 |
|
fGammaIso += pf->Pt(); |
2437 |
|
} |
2438 |
|
|
2443 |
|
if( ctrl.debug) cout << "neutral:: " << pf->Pt() << " " |
2444 |
|
<< dr << endl; |
2445 |
|
// KH, add to sync |
2446 |
< |
if( pf->Pt() > 0.5 ) |
2446 |
> |
// if( pf->Pt() > 0.5 ) |
2447 |
|
fNeutralHadronIso += pf->Pt(); |
2448 |
|
} |
2449 |
|
|
2451 |
|
|
2452 |
|
} |
2453 |
|
|
2375 |
– |
double rho = 0; |
2376 |
– |
// if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
2377 |
– |
// rho = fPUEnergyDensity->At(0)->Rho(); |
2378 |
– |
if (!(isnan(fPUEnergyDensity->At(0)->RhoLowEta()) || isinf(fPUEnergyDensity->At(0)->RhoLowEta()))) |
2379 |
– |
rho = fPUEnergyDensity->At(0)->RhoLowEta(); |
2380 |
– |
|
2381 |
– |
// WARNING!!!! |
2382 |
– |
// hardcode for sync ... |
2383 |
– |
EffectiveAreaVersion = eleT.kEleEAData2011; |
2384 |
– |
// WARNING!!!! |
2454 |
|
|
2455 |
+ |
double rho=0; |
2456 |
+ |
if( (EffectiveAreaVersion == mithep::ElectronTools::kEleEAFall11MC) || |
2457 |
+ |
(EffectiveAreaVersion == mithep::ElectronTools::kEleEAData2011) ) { |
2458 |
+ |
if (!(isnan(fPUEnergyDensity->At(0)->RhoKt6PFJetsForIso25()) || |
2459 |
+ |
isinf(fPUEnergyDensity->At(0)->RhoKt6PFJetsForIso25()))) |
2460 |
+ |
rho = fPUEnergyDensity->At(0)->RhoKt6PFJetsForIso25(); |
2461 |
+ |
// !!!!!!!!!!!!! TMP HACK FOR SYNC !!!!!!!!!!!!!!!!!!!!! |
2462 |
+ |
EffectiveAreaVersion = mithep::ElectronTools::kEleEAData2011; |
2463 |
+ |
// !!!!!!!!!!!!! TMP HACK FOR SYNC !!!!!!!!!!!!!!!!!!!!! |
2464 |
+ |
} else { |
2465 |
+ |
if (!(isnan(fPUEnergyDensity->At(0)->RhoKt6PFJets()) || |
2466 |
+ |
isinf(fPUEnergyDensity->At(0)->RhoKt6PFJets()))) |
2467 |
+ |
rho = fPUEnergyDensity->At(0)->RhoKt6PFJets(); |
2468 |
+ |
// !!!!!!!!!!!!! TMP HACK FOR SYNC !!!!!!!!!!!!!!!!!!!!! |
2469 |
+ |
EffectiveAreaVersion = mithep::ElectronTools::kEleEAData2011; |
2470 |
+ |
// !!!!!!!!!!!!! TMP HACK FOR SYNC !!!!!!!!!!!!!!!!!!!!! |
2471 |
+ |
} |
2472 |
+ |
if(ctrl.debug) cout << "rho: " << rho << endl; |
2473 |
|
|
2474 |
|
double pfIso = fChargedIso + fmax(0.0,(fGammaIso + fNeutralHadronIso |
2475 |
|
-rho*eleT.ElectronEffectiveArea(eleT.kEleGammaAndNeutralHadronIso04, |
2476 |
|
ele->Eta(),EffectiveAreaVersion))); |
2477 |
|
|
2478 |
+ |
|
2479 |
|
gChargedIso = fChargedIso; |
2480 |
|
gGammaIso = fGammaIso; |
2481 |
|
gNeutralIso = fNeutralHadronIso; |
2394 |
– |
|
2482 |
|
return pfIso; |
2483 |
|
} |
2484 |
|
|
2485 |
+ |
|
2486 |
+ |
|
2487 |
|
//-------------------------------------------------------------------------------------------------- |
2488 |
|
// hacked version |
2489 |
|
float electronPFIso04(ControlFlags &ctrl, |
2490 |
|
const mithep::Electron * ele, |
2491 |
< |
const mithep::Vertex & vtx, |
2491 |
> |
const mithep::Vertex * vtx, |
2492 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
2493 |
|
float rho, |
2494 |
|
mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion, |
2542 |
|
|
2543 |
|
if(ctrl.debug) { |
2544 |
|
cout << "pf :: type: " << pf->PFType() << "\tpt: " << pf->Pt() << "\tdR: " << dr; |
2545 |
< |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(vtx) |
2545 |
> |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(*vtx) |
2546 |
|
<< "\ttrk: " << pf->HasTrackerTrk() |
2547 |
|
<< "\tgsf: " << pf->HasGsfTrk(); |
2548 |
|
|
2636 |
|
|
2637 |
|
// Veto any PFmuon, or PFEle |
2638 |
|
if (abs(pf->PFType()) == PFCandidate::eElectron || abs(pf->PFType()) == PFCandidate::eMuon) { |
2639 |
< |
cout << "\t skipping, pf is and ele or mu .." <<endl; |
2639 |
> |
if( ctrl.debug ) cout << "\t skipping, pf is and ele or mu .." <<endl; |
2640 |
|
continue; |
2641 |
|
} |
2642 |
|
|
2672 |
|
if( ctrl.debug) cout << "neutral:: " << pf->Pt() << " " |
2673 |
|
<< dr << endl; |
2674 |
|
// KH, add to sync |
2675 |
< |
if( pf->Pt() > 0.5 ) |
2675 |
> |
// if( pf->Pt() > 0.5 ) |
2676 |
|
fNeutralHadronIso += pf->Pt(); |
2677 |
|
} |
2678 |
|
|
2705 |
|
//-------------------------------------------------------------------------------------------------- |
2706 |
|
SelectionStatus electronReferenceIsoSelection(ControlFlags &ctrl, |
2707 |
|
const mithep::Electron * ele, |
2708 |
< |
const mithep::Vertex & vtx, |
2708 |
> |
const mithep::Vertex * vtx, |
2709 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
2710 |
|
const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
2711 |
|
mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion, |
2741 |
|
// hacked version |
2742 |
|
SelectionStatus electronReferenceIsoSelection(ControlFlags &ctrl, |
2743 |
|
const mithep::Electron * ele, |
2744 |
< |
const mithep::Vertex & vtx, |
2744 |
> |
const mithep::Vertex * vtx, |
2745 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
2746 |
|
float rho, |
2747 |
|
mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion, |