1 |
|
#include "ElectronFakeRateMod.h" |
2 |
+ |
#include "SelectionFuncs.h" |
3 |
|
|
4 |
|
|
5 |
|
//needed because of externs |
8 |
|
const mithep::Vertex * vtx, |
9 |
|
const mithep::Array<mithep::PFCandidate> * pfCandidates, |
10 |
|
const Double_t dRMax); |
10 |
– |
|
11 |
– |
unsigned makePFnoPUArray(const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
12 |
– |
vector<bool> &pfNoPileUpFlag, |
13 |
– |
const mithep::Array<mithep::Vertex> * vtxArr ); |
11 |
|
|
12 |
|
Bool_t passElectronDenominatorCuts(const mithep::Electron *ele, const mithep::Vertex * vtx, Int_t DenominatorType); |
13 |
|
|
131 |
|
|
132 |
|
fillTriggerBits( GetHLTTable(), fTrigMask, fTriggerBits ); |
133 |
|
|
134 |
+ |
PFnoPUflag.clear(); |
135 |
|
makePFnoPUArray(fPFCandidates, PFnoPUflag, fPrimVerts ); |
136 |
|
|
137 |
|
vector<const Muon*> goodMuons; |
138 |
|
vector<const Electron*> goodElectrons; |
139 |
|
|
140 |
|
for(Int_t i=0; i<fMuons->GetEntries(); i++) { |
141 |
< |
const Muon *mu = fMuons->At(i); |
142 |
< |
ControlFlags ctrl; |
145 |
< |
ctrl.era = 2012; |
146 |
< |
if( muon2012CutBasedIDTight(ctrl,mu,fPrimVerts->At(0),fPFCandidates,fPileupEnergyDensity,mithep::MuonTools::kMuEAData2012) ) |
141 |
> |
const Muon *mu = fMuons->At(i); |
142 |
> |
if( muonPOG2012CutBasedIDTight(mu,fPrimVerts->At(0),fPFCandidates,fPileupEnergyDensity) ) |
143 |
|
goodMuons.push_back(mu); |
144 |
|
} |
145 |
|
for(Int_t i=0; i<fElectrons->GetEntries(); i++) { |
151 |
|
else |
152 |
|
fails_some_denominator = kTRUE; |
153 |
|
} |
158 |
– |
ControlFlags ctrl; |
159 |
– |
ctrl.era = 2012; |
154 |
|
|
155 |
< |
if(!fails_some_denominator && electron2012CutBasedIDMedium(ctrl,ele, fPrimVerts->At(0), fPFCandidates, fConversions, fPileupEnergyDensity,mithep::ElectronTools::kEleEAData2012)) |
155 |
> |
// if(!fails_some_denominator && electronPOG2012CutBasedIDMedium(ele, fPrimVerts->At(0), fPFCandidates, fConversions, fPileupEnergyDensity->At(0)->RhoLowEta(), mithep::ElectronTools::kEleEAData2011)) |
156 |
> |
assert(0); // doesn't compile |
157 |
|
goodElectrons.push_back(ele); |
158 |
|
} |
159 |
|
|
311 |
|
} |
312 |
|
|
313 |
|
|
319 |
– |
|
320 |
– |
unsigned makePFnoPUArray(const mithep::Array<mithep::PFCandidate> * fPFCandidates, |
321 |
– |
vector<bool> &pfNoPileUpflag, |
322 |
– |
const mithep::Array<mithep::Vertex> * vtxArr ) |
323 |
– |
{ |
324 |
– |
for(UInt_t i = 0; i < fPFCandidates->GetEntries(); i++) { |
325 |
– |
const mithep::PFCandidate *pf = fPFCandidates->At(i); |
326 |
– |
assert(pf); |
327 |
– |
|
328 |
– |
if(pf->PFType() == mithep::PFCandidate::eHadron) { |
329 |
– |
if(pf->HasTrackerTrk() && |
330 |
– |
vtxArr->At(0)->HasTrack(pf->TrackerTrk()) && |
331 |
– |
vtxArr->At(0)->TrackWeight(pf->TrackerTrk()) > 0) { |
332 |
– |
|
333 |
– |
pfNoPileUpflag.push_back(1); |
334 |
– |
|
335 |
– |
} else { |
336 |
– |
|
337 |
– |
Bool_t vertexFound = kFALSE; |
338 |
– |
const mithep::Vertex *closestVtx = 0; |
339 |
– |
Double_t dzmin = 10000; |
340 |
– |
|
341 |
– |
// loop over vertices |
342 |
– |
for(UInt_t j = 0; j < vtxArr->GetEntries(); j++) { |
343 |
– |
const mithep::Vertex *vtx = vtxArr->At(j); |
344 |
– |
assert(vtx); |
345 |
– |
|
346 |
– |
if(pf->HasTrackerTrk() && |
347 |
– |
vtx->HasTrack(pf->TrackerTrk()) && |
348 |
– |
vtx->TrackWeight(pf->TrackerTrk()) > 0) { |
349 |
– |
vertexFound = kTRUE; |
350 |
– |
closestVtx = vtx; |
351 |
– |
break; |
352 |
– |
} |
353 |
– |
Double_t dz = fabs(pf->SourceVertex().Z() - vtx->Z()); |
354 |
– |
if(dz < dzmin) { |
355 |
– |
closestVtx = vtx; |
356 |
– |
dzmin = dz; |
357 |
– |
} |
358 |
– |
} |
359 |
– |
|
360 |
– |
// if(fCheckClosestZVertex) { |
361 |
– |
if(1) { |
362 |
– |
// Fallback: if track is not associated with any vertex, |
363 |
– |
// associate it with the vertex closest in z |
364 |
– |
if(vertexFound || closestVtx != vtxArr->At(0)) { |
365 |
– |
// pfPileUp->Add(pf); |
366 |
– |
pfNoPileUpflag.push_back(0); |
367 |
– |
} else { |
368 |
– |
pfNoPileUpflag.push_back(1); |
369 |
– |
} |
370 |
– |
} else { |
371 |
– |
if(vertexFound && closestVtx != vtxArr->At(0)) { |
372 |
– |
// pfPileUp->Add(pf); |
373 |
– |
pfNoPileUpflag.push_back(0); |
374 |
– |
} else { |
375 |
– |
// PFCandidate * pfNoPileUp->AddNew(); // Ridiculous but that's how it is |
376 |
– |
pfNoPileUpflag.push_back(1); |
377 |
– |
} |
378 |
– |
} |
379 |
– |
} //hadron & trk stuff |
380 |
– |
} else { // hadron |
381 |
– |
// PFCandidate * ptr = pfNoPileUp->AddNew(); |
382 |
– |
pfNoPileUpflag.push_back(1); |
383 |
– |
} |
384 |
– |
} // Loop over PF candidates |
385 |
– |
|
386 |
– |
return pfNoPileUpflag.size(); |
387 |
– |
} |
388 |
– |
|
314 |
|
std::bitset<1024> mithep::ElectronFakeRateMod::GetHLTMatchBits(const Double_t pt, const Double_t eta, const Double_t phi) |
315 |
|
{ |
316 |
|
std::bitset<1024> object_bitset; |