23 |
|
fBeamSpotName(Names::gkBeamSpotBrn), |
24 |
|
fTrackName(Names::gkTrackBrn), |
25 |
|
fPFCandidatesName(Names::gkPFCandidatesBrn), |
26 |
< |
fMuonIDType("WWMuIdV3"), |
26 |
> |
fPFNoPileUpName("PFNoPileUp"), |
27 |
> |
fPFPileUpName("PFPileUp"), |
28 |
> |
fMuonIDType("NoId"), |
29 |
|
fMuonIsoType("PFIso"), |
30 |
< |
fMuonClassType("Global"), |
30 |
> |
fMuonClassType("GlobalorTracker"), |
31 |
|
fTrackIsolationCut(3.0), |
32 |
|
fCaloIsolationCut(3.0), |
33 |
|
fCombIsolationCut(0.15), |
34 |
|
fCombRelativeIsolationCut(0.15), |
35 |
|
fPFIsolationCut(-999.0), |
36 |
< |
fMuonPtMin(10), |
36 |
> |
fMuonPtMin(10.), |
37 |
|
fApplyD0Cut(kTRUE), |
38 |
|
fApplyDZCut(kTRUE), |
39 |
|
fD0Cut(0.020), |
49 |
|
fTracks(0), |
50 |
|
fPFCandidates(0), |
51 |
|
fPFNoPileUpCands(0), |
52 |
+ |
fPFPileUpCands(0), |
53 |
|
fIntRadius(0.0), |
54 |
|
fNonIsolatedMuons(0), |
55 |
|
fNonIsolatedElectrons(0), |
57 |
|
fPileupEnergyDensity(0), |
58 |
|
fMuonTools(0), |
59 |
|
fMuonIDMVA(0), |
60 |
+ |
fPVName(Names::gkPVBeamSpotBrn), |
61 |
|
fTheRhoType(RhoUtilities::DEFAULT) |
62 |
|
{ |
63 |
|
// Constructor. |
68 |
|
{ |
69 |
|
// Process entries of the tree. |
70 |
|
|
71 |
+ |
if(fCleanMuonsName.CompareTo("HggLeptonTagMuons") == 0 ){ |
72 |
+ |
LoadEventObject(fPVName,fVertices); |
73 |
+ |
} |
74 |
+ |
else{ |
75 |
+ |
fVertices = GetObjThisEvt<VertexOArr>(fVertexName); |
76 |
+ |
} |
77 |
+ |
|
78 |
|
if(fMuIsoType != kPFIsoNoL) { |
79 |
|
LoadEventObject(fMuonBranchName, fMuons); |
80 |
|
} |
93 |
|
) { |
94 |
|
LoadEventObject(fPileupEnergyDensityName, fPileupEnergyDensity); |
95 |
|
} |
96 |
< |
if(fMuIsoType == kPFRadialIso || fMuIsoType == kIsoDeltaR){ |
97 |
< |
// Name is hardcoded, can be changed if someone feels to do it |
98 |
< |
fPFNoPileUpCands = GetObjThisEvt<PFCandidateCol>("PFNoPileUp"); |
96 |
> |
if(fMuIsoType == kPFRadialIso || fMuIsoType == kIsoDeltaR || fMuIsoType == kPFIsoBetaPUCorrected){ |
97 |
> |
// Name is hardcoded, can be changed if someone feels to do it *** did it--Heng |
98 |
> |
fPFNoPileUpCands = GetObjThisEvt<PFCandidateCol>(fPFNoPileUpName); |
99 |
> |
fPFPileUpCands = GetObjThisEvt<PFCandidateCol>(fPFPileUpName); |
100 |
|
} |
101 |
|
|
102 |
|
MuonOArr *CleanMuons = new MuonOArr; |
103 |
|
CleanMuons->SetName(fCleanMuonsName); |
104 |
|
|
93 |
– |
fVertices = GetObjThisEvt<VertexOArr>(fVertexName); |
94 |
– |
|
105 |
|
for (UInt_t i=0; i<fMuons->GetEntries() && fVertices->GetEntries() > 0 ; ++i) { |
106 |
|
const Muon *mu = fMuons->At(i); |
107 |
|
|
127 |
|
eta = TMath::Abs(mu->Eta()); |
128 |
|
} |
129 |
|
break; |
130 |
+ |
case kGlobalorTracker: |
131 |
+ |
pass = mu->HasGlobalTrk() || mu->IsTrackerMuon(); |
132 |
+ |
if (pass && mu->TrackerTrk()) { |
133 |
+ |
pt = mu->TrackerTrk()->Pt(); |
134 |
+ |
eta = TMath::Abs(mu->TrackerTrk()->Eta()); |
135 |
+ |
} |
136 |
+ |
else{ |
137 |
+ |
pt = mu->Pt(); |
138 |
+ |
eta = TMath::Abs(mu->Eta()); |
139 |
+ |
} |
140 |
|
case kGlobalTracker: |
141 |
|
pass = (mu->HasGlobalTrk() && mu->GlobalTrk()->Chi2()/mu->GlobalTrk()->Ndof() < 10 && |
142 |
|
(mu->NSegments() > 1 || mu->NMatches() > 1) && mu->NValidHits() > 0) || |
198 |
|
if (!pass) |
199 |
|
continue; |
200 |
|
|
201 |
< |
if (pt <= fMuonPtMin) |
182 |
< |
continue; |
201 |
> |
if (pt <= fMuonPtMin) continue; |
202 |
|
|
203 |
< |
if (eta >= fEtaCut) |
185 |
< |
continue; |
203 |
> |
if (eta >= fEtaCut) continue; |
204 |
|
|
205 |
|
Double_t RChi2 = 0.0; |
206 |
|
if (mu->HasGlobalTrk()) { |
210 |
|
RChi2 = mu->BestTrk()->Chi2()/mu->BestTrk()->Ndof(); |
211 |
|
} |
212 |
|
Bool_t idpass = kFALSE; |
213 |
+ |
|
214 |
+ |
|
215 |
+ |
|
216 |
|
switch (fMuIDType) { |
217 |
+ |
|
218 |
|
case kWMuId: |
219 |
|
idpass = mu->BestTrk() != 0 && |
220 |
|
mu->BestTrk()->NHits() > 10 && |
245 |
|
mu->BestTrk()->NPixelHits() > 0 && |
246 |
|
RChi2 < 10.0; |
247 |
|
break; |
248 |
+ |
case kmuonPOG2012CutBasedIDTight: |
249 |
+ |
idpass = mu->IsGlobalMuon() && |
250 |
+ |
mu->IsPFMuon() && |
251 |
+ |
mu->GlobalTrk()->RChi2() < 10 && |
252 |
+ |
mu->NValidHits() != 0 && |
253 |
+ |
mu->NMatches() > 1 && |
254 |
+ |
mu->BestTrk()->NPixelHits() != 0 && |
255 |
+ |
mu->NTrkLayersHit() > 5; |
256 |
+ |
break; |
257 |
|
// 2012 WW analysis for 42x (there is no PFMuon link) |
258 |
|
case kWWMuIdV1: |
259 |
|
idpass = mu->BestTrk() != 0 && |
302 |
|
} |
303 |
|
break; |
304 |
|
case kNoId: |
305 |
+ |
{ |
306 |
|
idpass = kTRUE; |
307 |
+ |
} |
308 |
|
break; |
309 |
|
default: |
310 |
|
break; |
353 |
|
break; |
354 |
|
case kTrackCaloSliding: |
355 |
|
{ |
356 |
< |
Double_t totalIso = mu->IsoR03SumPt() + mu->IsoR03EmEt() + mu->IsoR03HadEt() - Rho * TMath::Pi() * 0.3 * 0.3 ; |
356 |
> |
Double_t totalIso = mu->IsoR03SumPt() + TMath::Max(mu->IsoR03EmEt() + mu->IsoR03HadEt() - Rho * TMath::Pi() * 0.3 * 0.3, 0.0); |
357 |
|
// trick to change the signal region cut |
358 |
|
double theIsoCut = fCombIsolationCut; |
359 |
|
if(theIsoCut < 0.20){ |
380 |
|
case kCombinedRelativeConeAreaCorrected: |
381 |
|
{ |
382 |
|
//const PileupEnergyDensity *rho = fPileupEnergyDensity->At(0); // Fabian: made Rho customable |
383 |
< |
Double_t totalIso = mu->IsoR03SumPt() + mu->IsoR03EmEt() + mu->IsoR03HadEt() - Rho * TMath::Pi() * 0.3 * 0.3 ; |
383 |
> |
Double_t totalIso = mu->IsoR03SumPt() + TMath::Max(mu->IsoR03EmEt() + mu->IsoR03HadEt() - Rho * TMath::Pi() * 0.3 * 0.3, 0.0); |
384 |
|
double theIsoCut = fCombRelativeIsolationCut; |
385 |
|
if (totalIso < (mu->Pt()*theIsoCut)) isocut = kTRUE; |
386 |
|
} |
437 |
|
Double_t totalIso = IsolationTools::PFRadialMuonIsolation(mu, fPFNoPileUpCands, 1.0, 0.3); |
438 |
|
if (totalIso < (mu->Pt()*pfIsoCutValue) ) |
439 |
|
isocut = kTRUE; |
440 |
+ |
} |
441 |
+ |
break; |
442 |
+ |
case kPFIsoBetaPUCorrected: |
443 |
+ |
{ |
444 |
+ |
Double_t pfIsoCutValue = 9999; |
445 |
+ |
if(fPFIsolationCut > 0){ |
446 |
+ |
pfIsoCutValue = fPFIsolationCut; |
447 |
+ |
} else { |
448 |
+ |
if (mu->Pt() > 20) { |
449 |
+ |
pfIsoCutValue = 0.2; |
450 |
+ |
} else { |
451 |
+ |
pfIsoCutValue = 0.2; |
452 |
+ |
} |
453 |
|
} |
454 |
+ |
Double_t totalIso = IsolationTools::BetaMwithPUCorrection(fPFNoPileUpCands, fPFPileUpCands, mu, 0.4); |
455 |
+ |
|
456 |
+ |
if (totalIso < (mu->Pt()*pfIsoCutValue) ) |
457 |
+ |
isocut = kTRUE; |
458 |
+ |
} |
459 |
|
break; |
460 |
|
case kPFIsoEffectiveAreaCorrected: |
461 |
|
{ |
465 |
|
} else { |
466 |
|
pfIsoCutValue = fPFIsolationCut; //leave it like this for now |
467 |
|
} |
468 |
< |
Double_t EffectiveAreaCorrectedPFIso = IsolationTools::PFMuonIsolation(mu, fPFCandidates, fVertices->At(0), 0.1, 1.0, 0.3, 0.0, fIntRadius) |
469 |
< |
- Rho * MuonTools::MuonEffectiveArea(MuonTools::kMuNeutralIso03, mu->Eta()); |
468 |
> |
Double_t EffectiveAreaCorrectedPFIso = IsolationTools::PFMuonIsolation(mu, fPFCandidates, fVertices->At(0), 0.1, 1.0, 0.3, 0.0, fIntRadius) |
469 |
> |
- Rho * MuonTools::MuonEffectiveArea(MuonTools::kMuNeutralIso03, mu->Eta()); |
470 |
|
//- fPileupEnergyDensity->At(0)->Rho() * MuonTools::MuonEffectiveArea(MuonTools::kMuNeutralIso03, mu->Eta()); // Fabian: made Rho-type customable |
471 |
|
isocut = EffectiveAreaCorrectedPFIso < (mu->Pt() * pfIsoCutValue); |
472 |
|
break; |
571 |
|
// Run startup code on the computer (slave) doing the actual analysis. Here, |
572 |
|
// we just request the muon collection branch. |
573 |
|
|
574 |
+ |
if(fCleanMuonsName.CompareTo("HggLeptonTagMuons") == 0 ){ |
575 |
+ |
ReqEventObject(fPVName,fVertices,true); |
576 |
+ |
} |
577 |
+ |
|
578 |
|
// In this case we cannot have a branch |
579 |
|
if (fMuonIsoType.CompareTo("PFIsoNoL") != 0) { |
580 |
|
ReqEventObject(fMuonBranchName, fMuons, kTRUE); |
589 |
|
|| fMuonIsoType.CompareTo("MVA_BDTG_IDIso") == 0 |
590 |
|
|| fMuonIsoType.CompareTo("IsoRingsV0_BDTG_Iso") == 0 |
591 |
|
|| fMuonIsoType.CompareTo("IsoDeltaR") == 0 |
592 |
< |
) { |
592 |
> |
) { |
593 |
|
ReqEventObject(fPileupEnergyDensityName, fPileupEnergyDensity, kTRUE); |
594 |
|
} |
595 |
|
|
600 |
|
fMuIDType = kZMuId; |
601 |
|
else if (fMuonIDType.CompareTo("Tight") == 0) |
602 |
|
fMuIDType = kTight; |
603 |
+ |
else if (fMuonIDType.CompareTo("muonPOG2012CutBasedIDTight") == 0) |
604 |
+ |
fMuIDType = kmuonPOG2012CutBasedIDTight; |
605 |
|
else if (fMuonIDType.CompareTo("Loose") == 0) |
606 |
|
fMuIDType = kLoose; |
607 |
|
else if (fMuonIDType.CompareTo("WWMuIdV1") == 0) |
643 |
|
fMuIsoType = kPFIso; |
644 |
|
else if (fMuonIsoType.CompareTo("PFRadialIso") == 0) |
645 |
|
fMuIsoType = kPFRadialIso; |
646 |
+ |
else if (fMuonIsoType.CompareTo("PFIsoBetaPUCorrected") == 0) |
647 |
+ |
fMuIsoType = kPFIsoBetaPUCorrected; |
648 |
|
else if (fMuonIsoType.CompareTo("PFIsoEffectiveAreaCorrected") == 0) |
649 |
|
fMuIsoType = kPFIsoEffectiveAreaCorrected; |
650 |
|
else if (fMuonIsoType.CompareTo("PFIsoNoL") == 0) |
667 |
|
fMuonIsoType.Data()); |
668 |
|
return; |
669 |
|
} |
670 |
< |
|
670 |
> |
|
671 |
|
if (fMuonClassType.CompareTo("All") == 0) |
672 |
|
fMuClassType = kAll; |
673 |
|
else if (fMuonClassType.CompareTo("Global") == 0) |
684 |
|
fMuClassType = kTrackerBased; |
685 |
|
else if (fMuonClassType.CompareTo("GlobalOnly") == 0) |
686 |
|
fMuClassType = kGlobalOnly; |
687 |
+ |
else if (fMuonClassType.CompareTo("GlobalorTracker") == 0) |
688 |
+ |
fMuClassType = kGlobalorTracker; |
689 |
|
else { |
690 |
|
SendError(kAbortAnalysis, "SlaveBegin", |
691 |
|
"The specified muon class %s is not defined.", |