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 |
|
{ |
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, |
468 |
|
double rho = 0; |
469 |
|
if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
470 |
|
rho = fPUEnergyDensity->At(0)->Rho(); |
471 |
+ |
|
472 |
|
// if (!(isnan(fPUEnergyDensity->At(0)->RhoLowEta()) || isinf(fPUEnergyDensity->At(0)->RhoLowEta()))) |
473 |
|
// rho = fPUEnergyDensity->At(0)->RhoLowEta(); |
474 |
|
|
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, |
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, |
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) |
1115 |
|
} |
1116 |
|
|
1117 |
|
double rho=0; |
1118 |
< |
if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
1119 |
< |
rho = fPUEnergyDensity->At(0)->Rho(); |
1120 |
< |
|
1121 |
< |
// WARNING!!!! |
1122 |
< |
// hardcode for sync ... |
1123 |
< |
EffectiveAreaVersion = muT.kMuEAData2011; |
1124 |
< |
// WARNING!!!! |
1125 |
< |
|
1126 |
< |
|
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, |
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, |
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, |
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 |
|
|
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 |
|
|
2257 |
|
|
2258 |
|
|
2259 |
|
//-------------------------------------------------------------------------------------------------- |
2247 |
– |
// hacked version |
2260 |
|
float electronPFIso04(ControlFlags &ctrl, |
2261 |
|
const mithep::Electron * ele, |
2262 |
< |
const mithep::Vertex & vtx, |
2262 |
> |
const mithep::Vertex * vtx, |
2263 |
|
const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
2264 |
|
const mithep::Array<mithep::PileupEnergyDensity> * fPUEnergyDensity, |
2265 |
|
mithep::ElectronTools::EElectronEffectiveAreaTarget EffectiveAreaVersion, |
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++ ) { |
2287 |
|
<< endl; |
2288 |
|
} |
2289 |
|
} |
2290 |
< |
|
2290 |
> |
*/ |
2291 |
|
|
2292 |
|
// |
2293 |
|
// final iso |
2313 |
|
|
2314 |
|
if(ctrl.debug) { |
2315 |
|
cout << "pf :: type: " << pf->PFType() << "\tpt: " << pf->Pt() << "\tdR: " << dr; |
2316 |
< |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(vtx) |
2316 |
> |
if( pf->HasTrackerTrk() ) cout << "\tdZ: " << pf->TrackerTrk()->DzCorrected(*vtx) |
2317 |
|
<< "\ttrk: " << pf->HasTrackerTrk() |
2318 |
|
<< "\tgsf: " << pf->HasGsfTrk(); |
2319 |
|
|
2407 |
|
|
2408 |
|
// Veto any PFmuon, or PFEle |
2409 |
|
if (abs(pf->PFType()) == PFCandidate::eElectron || abs(pf->PFType()) == PFCandidate::eMuon) { |
2410 |
< |
cout << "\t skipping, pf is and ele or mu .." <<endl; |
2410 |
> |
if( ctrl.debug ) cout << "\t skipping, pf is and ele or mu .." <<endl; |
2411 |
|
continue; |
2412 |
|
} |
2413 |
|
|
2453 |
|
|
2454 |
|
|
2455 |
|
double rho=0; |
2456 |
< |
if (!(isnan(fPUEnergyDensity->At(0)->Rho()) || isinf(fPUEnergyDensity->At(0)->Rho()))) |
2457 |
< |
rho = fPUEnergyDensity->At(0)->Rho(); |
2458 |
< |
|
2459 |
< |
// WARNING!!!! |
2460 |
< |
// hardcode for sync ... |
2461 |
< |
EffectiveAreaVersion = eleT.kEleEAData2011; |
2462 |
< |
// WARNING!!!! |
2463 |
< |
|
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, |
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 |
|
|
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, |