13 |
|
BaseMod(name,title), |
14 |
|
fMuonBranchName(Names::gkMuonBrn), |
15 |
|
fCleanMuonsName(ModNames::gkCleanMuonsName), |
16 |
< |
fVertexName(string("PrimaryVertexesBeamSpot").c_str()), |
16 |
> |
fVertexName("PrimaryVertexesBeamSpot"), |
17 |
|
fMuonIDType("Loose"), |
18 |
|
fMuonIsoType("TrackCaloSliding"), |
19 |
|
fMuonClassType("Global"), |
21 |
|
fCaloIsolationCut(3.0), |
22 |
|
fCombIsolationCut(5.0), |
23 |
|
fMuonPtMin(10), |
24 |
+ |
fApplyD0Cut(kTRUE), |
25 |
+ |
fD0Cut(0.025), |
26 |
+ |
fReverseIsoCut(kFALSE), |
27 |
+ |
fReverseD0Cut(kFALSE), |
28 |
+ |
fMuIDType(kIdUndef), |
29 |
+ |
fMuIsoType(kIsoUndef), |
30 |
+ |
fMuClassType(kClassUndef), |
31 |
|
fMuons(0), |
32 |
< |
fD0Cut(0.025) |
32 |
> |
fVertices(0), |
33 |
> |
fMuonTools(0) |
34 |
|
{ |
35 |
|
// Constructor. |
36 |
|
} |
40 |
|
{ |
41 |
|
// Process entries of the tree. |
42 |
|
|
43 |
< |
LoadBranch(fMuonBranchName); |
44 |
< |
LoadBranch(fVertexName); |
43 |
> |
LoadEventObject(fMuonBranchName, fMuons); |
44 |
> |
LoadEventObject(fVertexName, fVertices); |
45 |
|
|
46 |
|
MuonOArr *CleanMuons = new MuonOArr; |
47 |
|
CleanMuons->SetName(fCleanMuonsName); |
50 |
|
const Muon *mu = fMuons->At(i); |
51 |
|
|
52 |
|
Bool_t pass = kFALSE; |
53 |
< |
Double_t pt = -1; // make sure pt is taken from the correct track! |
53 |
> |
Double_t pt = 0; // make sure pt is taken from the correct track! |
54 |
|
switch (fMuClassType) { |
55 |
|
case kAll: |
56 |
|
pass = kTRUE; |
57 |
< |
pt = mu->Pt(); |
57 |
> |
if (mu->HasTrk()) |
58 |
> |
pt = mu->Pt(); |
59 |
|
break; |
60 |
|
case kGlobal: |
61 |
< |
pass = (mu->GlobalTrk() != 0); |
61 |
> |
pass = mu->HasGlobalTrk(); |
62 |
|
if (pass) |
63 |
|
pt = mu->GlobalTrk()->Pt(); |
64 |
|
break; |
65 |
|
case kSta: |
66 |
< |
pass = (mu->StandaloneTrk() != 0); |
66 |
> |
pass = mu->HasStandaloneTrk(); |
67 |
|
if (pass) |
68 |
|
pt = mu->StandaloneTrk()->Pt(); |
69 |
|
break; |
70 |
|
case kTrackerOnly: |
71 |
< |
pass = (mu->TrackerTrk() != 0); |
71 |
> |
pass = mu->HasTrackerTrk(); |
72 |
|
if (pass) |
73 |
|
pt = mu->TrackerTrk()->Pt(); |
74 |
|
break; |
92 |
|
idpass = fMuonTools->IsGood(mu, MuonTools::kTMOneStationTight) && |
93 |
|
fMuonTools->IsGood(mu, MuonTools::kTM2DCompatibilityTight); |
94 |
|
break; |
95 |
+ |
case kNoId: |
96 |
+ |
idpass = kTRUE; |
97 |
+ |
break; |
98 |
|
default: |
99 |
|
break; |
100 |
|
} |
102 |
|
if (!idpass) |
103 |
|
continue; |
104 |
|
|
105 |
< |
Bool_t isopass = kFALSE; |
105 |
> |
Bool_t isocut = kFALSE; |
106 |
|
switch (fMuIsoType) { |
107 |
|
case kTrackCalo: |
108 |
< |
isopass = (mu->IsoR03SumPt() < fTrackIsolationCut) && |
108 |
> |
isocut = (mu->IsoR03SumPt() < fTrackIsolationCut) && |
109 |
|
(mu->IsoR03EmEt() + mu->IsoR03HadEt() < fCaloIsolationCut); |
110 |
|
break; |
111 |
|
case kTrackCaloCombined: |
112 |
< |
isopass = (1.0 * mu->IsoR03SumPt() + 1.0 * mu->IsoR03EmEt() + |
112 |
> |
isocut = (1.0 * mu->IsoR03SumPt() + 1.0 * mu->IsoR03EmEt() + |
113 |
|
1.0 * mu->IsoR03HadEt() < fCombIsolationCut); |
114 |
|
break; |
115 |
|
case kTrackCaloSliding: |
117 |
|
Double_t totalIso = 1.0 * mu->IsoR03SumPt() + |
118 |
|
1.0 * mu->IsoR03EmEt() + |
119 |
|
1.0 * mu->IsoR03HadEt(); |
120 |
< |
if ((totalIso < (mu->Pt()-10.0)*5.0/15.0 && mu->Pt() <= 25) || |
120 |
> |
if ((totalIso < (pt-10.0)*5.0/15.0 && pt <= 25) || |
121 |
|
(totalIso < 5.0 && mu->Pt() > 25) || |
122 |
|
totalIso <= 0) |
123 |
< |
isopass = kTRUE; |
124 |
< |
} |
123 |
> |
isocut = kTRUE; |
124 |
> |
|
125 |
> |
if (fReverseIsoCut == kTRUE && |
126 |
> |
isocut == kFALSE && totalIso < 10) |
127 |
> |
isocut = kTRUE; |
128 |
> |
else if(fReverseIsoCut == kTRUE) |
129 |
> |
isocut = kFALSE; |
130 |
> |
} |
131 |
|
break; |
132 |
|
case kNoIso: |
133 |
< |
isopass = kTRUE; |
133 |
> |
isocut = kTRUE; |
134 |
|
break; |
135 |
|
case kCustomIso: |
136 |
|
default: |
137 |
|
break; |
138 |
|
} |
139 |
|
|
140 |
< |
if (!isopass) |
140 |
> |
if (isocut == kFALSE) |
141 |
|
continue; |
142 |
|
|
143 |
< |
// d0 cut |
144 |
< |
double d0_real = 99999; |
145 |
< |
for(uint i0 = 0; i0 < fVertices->GetEntries(); i0++) { |
146 |
< |
double pD0 = mu->GlobalTrk()->D0Corrected(*fVertices->At(i0)); |
147 |
< |
if(TMath::Abs(pD0) < TMath::Abs(d0_real)) d0_real = TMath::Abs(pD0); |
143 |
> |
if (fApplyD0Cut) { |
144 |
> |
Bool_t d0cut = kFALSE; |
145 |
> |
const Track *mt = mu->BestTrk(); |
146 |
> |
if (!mt) |
147 |
> |
continue; |
148 |
> |
Double_t d0_real = 1e30; |
149 |
> |
for(UInt_t i0 = 0; i0 < fVertices->GetEntries(); i0++) { |
150 |
> |
Double_t pD0 = mt->D0Corrected(*fVertices->At(i0)); |
151 |
> |
if(TMath::Abs(pD0) < TMath::Abs(d0_real)) |
152 |
> |
d0_real = TMath::Abs(pD0); |
153 |
> |
} |
154 |
> |
if(d0_real < fD0Cut) d0cut = kTRUE; |
155 |
> |
|
156 |
> |
if (fReverseD0Cut == kTRUE && |
157 |
> |
d0cut == kFALSE && d0_real < 0.05) |
158 |
> |
d0cut = kTRUE; |
159 |
> |
else if(fReverseD0Cut == kTRUE) |
160 |
> |
d0cut = kFALSE; |
161 |
> |
|
162 |
> |
if (d0cut == kFALSE) |
163 |
> |
continue; |
164 |
|
} |
131 |
– |
if(d0_real >= fD0Cut) continue; |
165 |
|
|
166 |
|
// add good muon |
167 |
|
CleanMuons->Add(mu); |
180 |
|
// Run startup code on the computer (slave) doing the actual analysis. Here, |
181 |
|
// we just request the muon collection branch. |
182 |
|
|
183 |
< |
ReqBranch(fMuonBranchName, fMuons); |
184 |
< |
ReqBranch(fVertexName, fVertices); |
183 |
> |
ReqEventObject(fMuonBranchName, fMuons, kTRUE); |
184 |
> |
|
185 |
> |
if (fApplyD0Cut) |
186 |
> |
ReqEventObject(fVertexName, fVertices, kTRUE); |
187 |
|
|
188 |
|
fMuonTools = new MuonTools; |
189 |
|
|