13 |
|
BaseMod(name,title), |
14 |
|
fMuonBranchName(Names::gkMuonBrn), |
15 |
|
fCleanMuonsName(ModNames::gkCleanMuonsName), |
16 |
+ |
fVertexName("PrimaryVertexesBeamSpot"), |
17 |
|
fMuonIDType("Loose"), |
18 |
|
fMuonIsoType("TrackCaloSliding"), |
19 |
|
fMuonClassType("Global"), |
21 |
|
fCaloIsolationCut(3.0), |
22 |
|
fCombIsolationCut(5.0), |
23 |
|
fMuonPtMin(10), |
24 |
< |
fMuons(0) |
24 |
> |
fApplyD0Cut(kTRUE), |
25 |
> |
fD0Cut(0.025), |
26 |
> |
fReverseIsoCut(kFALSE), |
27 |
> |
fMuIDType(kIdUndef), |
28 |
> |
fMuIsoType(kIsoUndef), |
29 |
> |
fMuClassType(kClassUndef), |
30 |
> |
fMuons(0), |
31 |
> |
fVertices(0), |
32 |
> |
fMuonTools(0) |
33 |
|
{ |
34 |
|
// Constructor. |
35 |
|
} |
39 |
|
{ |
40 |
|
// Process entries of the tree. |
41 |
|
|
42 |
< |
LoadBranch(fMuonBranchName); |
42 |
> |
LoadEventObject(fMuonBranchName, fMuons); |
43 |
> |
LoadEventObject(fVertexName, fVertices); |
44 |
|
|
45 |
|
MuonOArr *CleanMuons = new MuonOArr; |
46 |
|
CleanMuons->SetName(fCleanMuonsName); |
49 |
|
const Muon *mu = fMuons->At(i); |
50 |
|
|
51 |
|
Bool_t pass = kFALSE; |
52 |
< |
Double_t pt = -1; // make sure pt is taken from the correct track! |
52 |
> |
Double_t pt = 0; // make sure pt is taken from the correct track! |
53 |
|
switch (fMuClassType) { |
54 |
|
case kAll: |
55 |
|
pass = kTRUE; |
56 |
< |
pt = mu->Pt(); |
56 |
> |
if (mu->HasTrk()) |
57 |
> |
pt = mu->Pt(); |
58 |
|
break; |
59 |
|
case kGlobal: |
60 |
< |
pass = (mu->GlobalTrk() != 0); |
60 |
> |
pass = mu->HasGlobalTrk(); |
61 |
|
if (pass) |
62 |
|
pt = mu->GlobalTrk()->Pt(); |
63 |
|
break; |
64 |
|
case kSta: |
65 |
< |
pass = (mu->StandaloneTrk() != 0); |
65 |
> |
pass = mu->HasStandaloneTrk(); |
66 |
|
if (pass) |
67 |
|
pt = mu->StandaloneTrk()->Pt(); |
68 |
|
break; |
69 |
|
case kTrackerOnly: |
70 |
< |
pass = (mu->TrackerTrk() != 0); |
70 |
> |
pass = mu->HasTrackerTrk(); |
71 |
|
if (pass) |
72 |
|
pt = mu->TrackerTrk()->Pt(); |
73 |
|
break; |
91 |
|
idpass = fMuonTools->IsGood(mu, MuonTools::kTMOneStationTight) && |
92 |
|
fMuonTools->IsGood(mu, MuonTools::kTM2DCompatibilityTight); |
93 |
|
break; |
94 |
+ |
case kNoId: |
95 |
+ |
idpass = kTRUE; |
96 |
+ |
break; |
97 |
|
default: |
98 |
|
break; |
99 |
|
} |
116 |
|
Double_t totalIso = 1.0 * mu->IsoR03SumPt() + |
117 |
|
1.0 * mu->IsoR03EmEt() + |
118 |
|
1.0 * mu->IsoR03HadEt(); |
119 |
< |
if ((totalIso < (mu->Pt()-10.0)*5.0/15.0 && mu->Pt() <= 25) || |
119 |
> |
if ((totalIso < (pt-10.0)*5.0/15.0 && pt <= 25) || |
120 |
|
(totalIso < 5.0 && mu->Pt() > 25) || |
121 |
|
totalIso <= 0) |
122 |
|
isopass = kTRUE; |
130 |
|
break; |
131 |
|
} |
132 |
|
|
133 |
< |
if (!isopass) |
133 |
> |
if ((isopass == kFALSE && fReverseIsoCut == kFALSE) || |
134 |
> |
(isopass == kTRUE && fReverseIsoCut == kTRUE)) |
135 |
|
continue; |
136 |
|
|
137 |
+ |
if (fApplyD0Cut) { |
138 |
+ |
const Track *mt = mu->BestTrk(); |
139 |
+ |
if (!mt) |
140 |
+ |
continue; |
141 |
+ |
Double_t d0_real = 1e30; |
142 |
+ |
for(UInt_t i0 = 0; i0 < fVertices->GetEntries(); i0++) { |
143 |
+ |
Double_t pD0 = mt->D0Corrected(*fVertices->At(i0)); |
144 |
+ |
if(TMath::Abs(pD0) < TMath::Abs(d0_real)) |
145 |
+ |
d0_real = TMath::Abs(pD0); |
146 |
+ |
} |
147 |
+ |
if(d0_real >= fD0Cut) |
148 |
+ |
continue; |
149 |
+ |
} |
150 |
+ |
|
151 |
|
// add good muon |
152 |
|
CleanMuons->Add(mu); |
153 |
|
} |
165 |
|
// Run startup code on the computer (slave) doing the actual analysis. Here, |
166 |
|
// we just request the muon collection branch. |
167 |
|
|
168 |
< |
ReqBranch(fMuonBranchName, fMuons); |
168 |
> |
ReqEventObject(fMuonBranchName, fMuons, kTRUE); |
169 |
> |
|
170 |
> |
if (fApplyD0Cut) |
171 |
> |
ReqEventObject(fVertexName, fVertices, kTRUE); |
172 |
|
|
173 |
|
fMuonTools = new MuonTools; |
174 |
|
|