ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/FakeMods/src/GenFakeableObjsMod.cc
Revision: 1.16
Committed: Sun Oct 23 01:53:18 2011 UTC (13 years, 6 months ago) by paus
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_029c, Mit_029b, Mit_029a, Mit_028a, Mit_028, Mit_027, Mit_027a, Mit_025e, Mit_025d, HEAD
Changes since 1.15: +3 -2 lines
Log Message:
Removing lots of Warnings.

File Contents

# Content
1 // $Id: GenFakeableObjsMod.cc,v 1.15 2011/02/17 13:44:54 bendavid Exp $
2
3 #include "MitPhysics/FakeMods/interface/GenFakeableObjsMod.h"
4 #include "MitCommon/MathTools/interface/MathUtils.h"
5 #include "MitAna/DataUtil/interface/Debug.h"
6 #include "MitAna/DataTree/interface/ElectronCol.h"
7 #include "MitAna/DataTree/interface/MuonCol.h"
8 #include "MitAna/DataTree/interface/SuperClusterCol.h"
9 #include "MitAna/DataTree/interface/TrackCol.h"
10 #include "MitAna/DataTree/interface/JetCol.h"
11 #include "MitAna/DataTree/interface/VertexCol.h"
12 #include "MitAna/DataTree/interface/DecayParticleCol.h"
13 #include "MitAna/DataTree/interface/StableData.h"
14 #include "MitPhysics/Init/interface/ModNames.h"
15 #include "MitPhysics/Utils/interface/IsolationTools.h"
16 #include "MitPhysics/Mods/interface/ElectronIDMod.h"
17
18 using namespace mithep;
19
20 ClassImp(mithep::GenFakeableObjsMod)
21
22 //--------------------------------------------------------------------------------------------------
23 GenFakeableObjsMod::GenFakeableObjsMod(const char *name, const char *title) :
24 BaseMod(name,title),
25
26 fApplyConvFilter(kTRUE),
27 fNWrongHitsMax(1),
28 fApplyD0Cut(kTRUE),
29 fChargeFilter(kTRUE),
30 fD0Cut(0.02),
31 fCombIsolationCut(0.5),
32 fTrackIsolationCut(-1.0),
33 fEcalIsolationCut(-1.0),
34 fHcalIsolationCut(-1.0),
35 fVetoTriggerJet(kFALSE),
36 fVetoGenLeptons(kTRUE),
37 fVetoCleanLeptons(kFALSE),
38 fElectronFOType("Iso"),
39 fMuonFOType("IsoTrack"),
40 fTriggerName("NotSpecified"),
41 fTriggerObjectsName("NotSpecified"),
42 fElectronBranchName(Names::gkElectronBrn),
43 fMuonBranchName(Names::gkMuonBrn),
44 fTrackBranchName(Names::gkTrackBrn),
45 fGsfTrackBranchName(Names::gkGsfTrackBrn),
46 fBarrelSuperClusterBranchName(Names::gkBarrelSuperClusterBrn),
47 fEndcapSuperClusterBranchName(Names::gkEndcapSuperClusterBrn),
48 fVertexName(ModNames::gkGoodVertexesName),
49 fConversionBranchName(Names::gkMvfConversionBrn),
50 fGoodJetsName(ModNames::gkGoodJetsName),
51 fCleanElectronsName(ModNames::gkCleanElectronsName),
52 fCleanMuonsName(ModNames::gkCleanMuonsName),
53 fMCLeptonsName(ModNames::gkMCLeptonsName),
54 fMCTausName(ModNames::gkMCTausName),
55 fElFakeableObjsName(ModNames::gkElFakeableObjsName),
56 fMuFakeableObjsName(ModNames::gkMuFakeableObjsName),
57 fElFOType(kElFOUndef),
58 fMuFOType(kMuFOUndef),
59 fBarrelSuperClusters(0),
60 fEndcapSuperClusters(0),
61 fTracks(0),
62 fGsfTracks(0),
63 fVertices(0),
64 fConversions(0)
65 {
66 // Constructor.
67 }
68
69 //--------------------------------------------------------------------------------------------------
70 void GenFakeableObjsMod::SlaveBegin()
71 {
72 // Run startup code on the computer (slave) doing the actual analysis. Here,
73 // we typically initialize histograms and other analysis objects and request
74 // branches. For this module, we request a branch of the MitTree.
75
76 //------------------------------------------------------------------------------------------------
77 // Request the branches (no significant time safed by not doing this)
78 //------------------------------------------------------------------------------------------------
79 ReqBranch(fElectronBranchName, fElectrons);
80 ReqBranch(fMuonBranchName, fMuons);
81 ReqBranch(fTrackBranchName, fTracks);
82 ReqBranch(fGsfTrackBranchName, fGsfTracks);
83 ReqBranch(fBarrelSuperClusterBranchName, fBarrelSuperClusters);
84 ReqBranch(fEndcapSuperClusterBranchName, fEndcapSuperClusters);
85 ReqBranch(fConversionBranchName, fConversions);
86
87 if (fElectronFOType.CompareTo("Iso") == 0)
88 fElFOType = kElFOIso;
89 else if (fElectronFOType.CompareTo("LooseIdLooseIso") == 0)
90 fElFOType = kElFOLooseIdLooseIso;
91 else {
92 SendError(kAbortAnalysis, "SlaveBegin",
93 "The specified electron fakeable object %s is not defined.",
94 fElectronFOType.Data());
95 return;
96 }
97
98 if (fMuonFOType.CompareTo("IsoTrack") == 0)
99 fMuFOType = kMuFOIsoTrack;
100 else if (fMuonFOType.CompareTo("Global") == 0)
101 fMuFOType = kMuFOGlobal;
102 else if (fMuonFOType.CompareTo("TrackerMuon") == 0)
103 fMuFOType = kMuFOTrackerMuon;
104 else {
105 SendError(kAbortAnalysis, "SlaveBegin",
106 "The specified muon fakeable object %s is not defined.",
107 fMuonFOType.Data());
108 return;
109 }
110
111 electronID = new ElectronIDMod();
112 electronID->SetApplyConversionFilterType1(kFALSE);
113 electronID->SetApplyConversionFilterType1(fApplyConvFilter);
114 electronID->SetNWrongHitsMax(fNWrongHitsMax);
115 electronID->SetApplyD0Cut(fApplyD0Cut);
116 electronID->SetChargeFilter(fChargeFilter);
117 electronID->SetD0Cut(fD0Cut);
118
119 }
120
121 //--------------------------------------------------------------------------------------------------
122 void GenFakeableObjsMod::Process()
123 {
124 // Process entries of the tree.
125 LoadBranch(fElectronBranchName);
126 LoadBranch(fMuonBranchName);
127 LoadBranch(fTrackBranchName);
128 LoadBranch(fGsfTrackBranchName);
129 LoadBranch(fBarrelSuperClusterBranchName);
130 LoadBranch(fEndcapSuperClusterBranchName);
131 LoadBranch(fConversionBranchName);
132
133 fVertices = GetObjThisEvt<VertexOArr>(fVertexName);
134
135 //Load Trigger Objects
136 const TriggerObjectCol *triggerObjects = GetHLTObjects(fTriggerObjectsName);
137 if (!triggerObjects && fVetoTriggerJet) {
138 cout << "Error: Could not load Trigger Object Collection with name "
139 << fTriggerObjectsName << endl;
140 }
141
142 // get input clean object collections
143 mithep::ParticleOArr *CleanLeptons = dynamic_cast<mithep::ParticleOArr*>
144 (FindObjThisEvt(ModNames::gkMergedLeptonsName));
145 const ElectronCol *CleanElectrons = 0;
146 if (!fCleanElectronsName.IsNull())
147 CleanElectrons = GetObjThisEvt<ElectronCol>(fCleanElectronsName);
148 const MuonCol *CleanMuons = 0;
149 if (!fCleanMuonsName.IsNull())
150 CleanMuons = GetObjThisEvt<MuonCol>(fCleanMuonsName);
151 const JetCol *GoodJets = 0;
152 if (!fGoodJetsName.IsNull())
153 GoodJets = GetObjThisEvt<JetCol>(fGoodJetsName);
154
155 //get input MC collections
156 const MCParticleCol *GenLeptons = 0;
157 if (!fMCLeptonsName.IsNull())
158 GenLeptons = GetObjThisEvt<MCParticleCol>(fMCLeptonsName);
159 const MCParticleCol *GenTaus = 0;
160 if (!fMCTausName.IsNull())
161 GenTaus = GetObjThisEvt<MCParticleCol>(fMCTausName);
162 ObjArray<MCParticle> *GenLeptonsAndTaus = new ObjArray<MCParticle>;
163 for (UInt_t i=0; i<GenLeptons->GetEntries(); i++)
164 GenLeptonsAndTaus->Add(GenLeptons->At(i));
165 for (UInt_t i=0; i<GenTaus->GetEntries(); i++)
166 GenLeptonsAndTaus->Add(GenTaus->At(i));
167
168 //Combine Barrel and Endcap superclusters into the same ObjArray
169 ObjArray <SuperCluster> *SuperClusters = new ObjArray <SuperCluster>;
170 for (UInt_t i=0; i<fBarrelSuperClusters->GetEntries(); i++) {
171 SuperClusters->Add(fBarrelSuperClusters->At(i));
172 }
173 for (UInt_t i=0; i<fEndcapSuperClusters->GetEntries(); i++) {
174 SuperClusters->Add(fEndcapSuperClusters->At(i));
175 }
176
177 //collections for duplicate removed electrons
178 ObjArray<Electron> *DuplicateRemovedElectrons = new ObjArray<Electron>;
179 std::vector<const Electron*> tmpDuplicateRemovedElectrons;
180
181 // create final output collection
182 ElectronArr *ElFakeableObjs = new ElectronArr;
183 MuonArr *MuFakeableObjs = new MuonArr;
184
185
186 //***********************************************************************************************
187 //First do duplicate electron removal
188 //***********************************************************************************************
189 for (UInt_t i=0; i<fElectrons->GetEntries(); ++i) {
190
191
192 const Electron *e = fElectrons->At(i);
193 Bool_t isElectronOverlap = kFALSE;
194
195 for (UInt_t j=0; j<tmpDuplicateRemovedElectrons.size(); ++j) {
196 // why does someone calculate it if it is not used?
197 //Double_t deltaR = MathUtils::DeltaR(tmpDuplicateRemovedElectrons[j]->Mom(), e->Mom());
198 if (e->SCluster() == tmpDuplicateRemovedElectrons[j]->SCluster() ||
199 e->GsfTrk() == tmpDuplicateRemovedElectrons[j]->GsfTrk()) {
200 isElectronOverlap = kTRUE;
201 }
202
203
204 if (isElectronOverlap) {
205 if (TMath::Abs(tmpDuplicateRemovedElectrons[j]->ESuperClusterOverP() - 1) >
206 TMath::Abs(e->ESuperClusterOverP() - 1)) {
207 tmpDuplicateRemovedElectrons[j] = e;
208 }
209 break;
210 }
211 }
212
213 if (!isElectronOverlap) {
214 tmpDuplicateRemovedElectrons.push_back(e);
215 }
216 }
217 for (UInt_t i=0; i<tmpDuplicateRemovedElectrons.size(); ++i) {
218 DuplicateRemovedElectrons->Add(tmpDuplicateRemovedElectrons[i]);
219 }
220
221 //***********************************************************************************************
222 //Fakeable Objects for Electron Fakes
223 //Reco electron with full isolation
224 //***********************************************************************************************
225 if (fElFOType == kElFOIso) {
226
227 for (UInt_t i=0; i<DuplicateRemovedElectrons->GetEntries(); i++) {
228 const Electron *denominator = DuplicateRemovedElectrons->At(i);
229
230 //Veto denominators matching to real electrons
231 Bool_t IsGenLepton = false;
232 for (UInt_t l=0; l<GenLeptonsAndTaus->GetEntries(); l++) {
233 if (MathUtils::DeltaR(denominator->Phi(), denominator->Eta(),
234 GenLeptonsAndTaus->At(l)->Phi(),
235 GenLeptonsAndTaus->At(l)->Eta()) < 0.1) {
236 IsGenLepton = true;
237 }
238 }
239
240 //Veto denominators matching to clean leptons
241 Bool_t IsCleanLepton = false;
242 for (UInt_t l=0; l<CleanLeptons->GetEntries(); l++) {
243 if (MathUtils::DeltaR(denominator->Phi(), denominator->Eta(),
244 CleanLeptons->At(l)->Phi(),
245 CleanLeptons->At(l)->Eta()) < 0.1) {
246 IsCleanLepton = true;
247 }
248 }
249
250 //Veto on Trigger jet
251 Bool_t IsTriggerJet = false;
252 if (fVetoTriggerJet) {
253 for (UInt_t l=0; l<triggerObjects->GetEntries(); l++) {
254 Double_t deltaR = MathUtils::DeltaR(denominator->Phi(),
255 denominator->Eta(),
256 triggerObjects->At(l)->Phi(),
257 triggerObjects->At(l)->Eta());
258 if (triggerObjects->At(l)->TrigName() == fTriggerName.Data()
259 && triggerObjects->At(l)->Type() == TriggerObject::TriggerJet
260 && deltaR < 0.3
261 ) {
262 IsTriggerJet = true;
263 break;
264 }
265 }
266 }
267
268 const Electron *tmpEle = denominator;
269 //****************************************************************************************
270 // Isolation Cut
271 //****************************************************************************************
272 Double_t combIso =
273 denominator->TrackIsolationDr03() + TMath::Max(denominator->EcalRecHitIsoDr03() - 1.0, 0.0) + denominator->HcalTowerSumEtDr03();
274 if (fabs(denominator->Eta()) > 1.5) {
275 combIso = denominator->TrackIsolationDr03() + denominator->EcalRecHitIsoDr03() + denominator->HcalTowerSumEtDr03();
276 }
277
278 Bool_t passIsolationCut = (combIso / denominator->Pt() < 0.1) ;
279
280 //****************************************************************************************
281 // conversion filter
282 //****************************************************************************************
283 Bool_t passConversionFilter = (TMath::Abs(denominator->ConvPartnerDCotTheta()) >= 0.02 ||
284 TMath::Abs(denominator->ConvPartnerDist()) >= 0.02);
285
286 //****************************************************************************************
287 // D0 Cut
288 //****************************************************************************************
289 Bool_t passD0Cut = ElectronTools::PassD0Cut(tmpEle,fVertices, kTRUE);
290
291 //****************************************************************************************
292 // Make denominator object cuts
293 //****************************************************************************************
294 if( denominator->Pt() > 10.0
295 && passIsolationCut
296 && (passConversionFilter || !fApplyConvFilter)
297 && (passD0Cut || !fApplyD0Cut)
298 && !(fVetoCleanLeptons && IsCleanLepton)
299 && !(fVetoGenLeptons && IsGenLepton)
300 && !(fVetoTriggerJet && IsTriggerJet)
301 ) {
302 Electron *tmpElectron = ElFakeableObjs->AddNew();
303 tmpElectron->SetPtEtaPhi(denominator->Pt(), denominator->Eta(),denominator->Phi());
304 tmpElectron->SetGsfTrk(denominator->GsfTrk());
305 tmpElectron->SetSuperCluster(denominator->SCluster());
306 }
307 }
308 } else if (fElFOType == kElFOLooseIdLooseIso) {
309 for (UInt_t i=0; i<DuplicateRemovedElectrons->GetEntries(); i++) {
310 const Electron *denominator = DuplicateRemovedElectrons->At(i);
311
312 //Veto denominators matching to real electrons
313 Bool_t IsGenLepton = false;
314 for (UInt_t l=0; l<GenLeptonsAndTaus->GetEntries(); l++) {
315 if (MathUtils::DeltaR(denominator->Phi(), denominator->Eta(),
316 GenLeptonsAndTaus->At(l)->Phi(),
317 GenLeptonsAndTaus->At(l)->Eta()) < 0.1) {
318 IsGenLepton = true;
319 }
320 }
321
322 //Veto denominators matching to clean leptons
323 Bool_t IsCleanLepton = false;
324 for (UInt_t l=0; l<CleanLeptons->GetEntries(); l++) {
325 if (MathUtils::DeltaR(denominator->Phi(), denominator->Eta(),
326 CleanLeptons->At(l)->Phi(),
327 CleanLeptons->At(l)->Eta()) < 0.1) {
328 IsCleanLepton = true;
329 }
330 }
331
332 //Veto on Trigger jet
333 Bool_t IsTriggerJet = false;
334 if (fVetoTriggerJet) {
335 for (UInt_t l=0; l<triggerObjects->GetEntries(); l++) {
336 Double_t deltaR = MathUtils::DeltaR(denominator->Phi(),
337 denominator->Eta(),
338 triggerObjects->At(l)->Phi(),
339 triggerObjects->At(l)->Eta());
340 if (triggerObjects->At(l)->TrigName() == fTriggerName.Data()
341 && triggerObjects->At(l)->Type() == TriggerObject::TriggerJet
342 && deltaR < 0.3
343 ) {
344 IsTriggerJet = true;
345 break;
346 }
347 }
348 }
349
350 const Electron *tmpEle = denominator;
351 //****************************************************************************************
352 // Id Cuts
353 //****************************************************************************************
354 Bool_t passIdCut = ElectronTools::PassCustomID(denominator, ElectronTools::kVBTFWorkingPoint90Id);
355
356
357 //****************************************************************************************
358 // Isolation Cut
359 //****************************************************************************************
360 Double_t combIso =
361 denominator->TrackIsolationDr03() + TMath::Max(denominator->EcalRecHitIsoDr03() - 1.0, 0.0) + denominator->HcalTowerSumEtDr03();
362 if (fabs(denominator->Eta()) > 1.5) {
363 combIso = denominator->TrackIsolationDr03() + denominator->EcalRecHitIsoDr03() + denominator->HcalTowerSumEtDr03();
364 }
365 Bool_t passIsolationCut = (combIso / denominator->Pt() < 0.3) ;
366
367 //****************************************************************************************
368 // conversion filter
369 //****************************************************************************************
370 Bool_t passConversionFilter = (TMath::Abs(denominator->ConvPartnerDCotTheta()) >= 0.02 ||
371 TMath::Abs(denominator->ConvPartnerDist()) >= 0.02);
372
373 //****************************************************************************************
374 // D0 Cut
375 //****************************************************************************************
376 Bool_t passD0Cut = ElectronTools::PassD0Cut(tmpEle,fVertices, kTRUE);
377
378 //****************************************************************************************
379 // Make denominator object cuts
380 //****************************************************************************************
381 if( denominator->Pt() > 10.0
382 && passIdCut
383 && passIsolationCut
384 && (passConversionFilter || !fApplyConvFilter)
385 && (passD0Cut || !fApplyD0Cut)
386 && denominator->PassLooseID()
387 && !(fVetoCleanLeptons && IsCleanLepton)
388 && !(fVetoGenLeptons && IsGenLepton)
389 && !(fVetoTriggerJet && IsTriggerJet)
390 ) {
391 Electron *tmpElectron = ElFakeableObjs->AddNew();
392 tmpElectron->SetPtEtaPhi(denominator->Pt(), denominator->Eta(),denominator->Phi());
393 tmpElectron->SetGsfTrk(denominator->GsfTrk());
394 tmpElectron->SetSuperCluster(denominator->SCluster());
395 }
396 }
397 }
398
399 //***********************************************************************************************
400 //Fakeable Objects for Muon Fakes
401 //***********************************************************************************************
402 if (fMuFOType == kMuFOIsoTrack) {
403 for (UInt_t i=0; i<fTracks->GetEntries(); i++) {
404 const Track *track = fTracks->At(i);
405 Double_t trackIsolation = IsolationTools::TrackIsolation(track, 0.4, 0.015, 1.0,
406 0.2, fTracks);
407 //Determine if muon fakeable object matches a gen lepton
408 Bool_t IsGenLepton = false;
409 for (UInt_t l=0; l<GenLeptonsAndTaus->GetEntries(); l++) {
410 if (MathUtils::DeltaR(track->Phi(), track->Eta(),
411 GenLeptonsAndTaus->At(l)->Phi(),
412 GenLeptonsAndTaus->At(l)->Eta()) < 0.3) {
413 IsGenLepton = true;
414 }
415 }
416
417 //Veto denominators matching to clean leptons
418 Bool_t IsCleanLepton = false;
419 for (UInt_t l=0; l<CleanLeptons->GetEntries(); l++) {
420 if (MathUtils::DeltaR(track->Phi(), track->Eta(),
421 CleanLeptons->At(l)->Phi(),
422 CleanLeptons->At(l)->Eta()) < 0.1) {
423 IsCleanLepton = true;
424 }
425 }
426
427 //Veto on Trigger jet
428 Bool_t IsTriggerJet = false;
429 if (fVetoTriggerJet) {
430 for (UInt_t l=0; l<triggerObjects->GetEntries(); l++) {
431 Double_t deltaR = MathUtils::DeltaR(track->Phi(), track->Eta(),
432 triggerObjects->At(l)->Phi(),
433 triggerObjects->At(l)->Eta());
434 if (triggerObjects->At(l)->TrigName() == fTriggerName.Data()
435 && triggerObjects->At(l)->Type() == TriggerObject::TriggerJet
436 && deltaR < 0.3
437 ) {
438 IsTriggerJet = true;
439 break;
440 }
441 }
442 }
443
444 //****************************************************************************************
445 // D0 Cut
446 //****************************************************************************************
447 double d0Min = 99999;
448 for(UInt_t i0 = 0; i0 < fVertices->GetEntries(); i0++) {
449 double pD0 = track->D0Corrected(*fVertices->At(i0));
450 if(TMath::Abs(pD0) < TMath::Abs(d0Min)) d0Min = TMath::Abs(pD0);
451 }
452
453
454 //define denominator cuts
455 if (track->Pt() > 10.0 && trackIsolation < 10.0
456 && d0Min < 0.025
457 && !(fVetoGenLeptons && IsGenLepton)
458 && !(fVetoCleanLeptons && IsCleanLepton)
459 && !(fVetoTriggerJet && IsTriggerJet)
460 ) {
461 //add to fakeable objects
462 Muon* tmpMuon = MuFakeableObjs->AddNew();
463 tmpMuon->SetTrackerTrk(track);
464 }
465 }
466 } else if (fMuFOType == kMuFOGlobal) {
467 for (UInt_t i=0; i<fMuons->GetEntries(); i++) {
468 const Muon *denominator = fMuons->At(i);
469 Double_t totalIsolation = denominator->IsoR03SumPt() + denominator->IsoR03EmEt() +
470 denominator->IsoR03HadEt();
471
472 //Determine if muon fakeable object matches a gen lepton
473 Bool_t IsGenLepton = false;
474 for (UInt_t l=0; l<GenLeptonsAndTaus->GetEntries(); l++) {
475 if (MathUtils::DeltaR(denominator->Phi(), denominator->Eta(),
476 GenLeptonsAndTaus->At(l)->Phi(),
477 GenLeptonsAndTaus->At(l)->Eta()) < 0.3) {
478 IsGenLepton = true;
479 }
480 }
481
482 //Veto denominators matching to clean leptons
483 Bool_t IsCleanLepton = false;
484 for (UInt_t l=0; l<CleanLeptons->GetEntries(); l++) {
485 if (MathUtils::DeltaR(denominator->Phi(), denominator->Eta(),
486 CleanLeptons->At(l)->Phi(),
487 CleanLeptons->At(l)->Eta()) < 0.1) {
488 IsCleanLepton = true;
489 }
490 }
491
492 //Veto on Trigger jet
493 Bool_t IsTriggerJet = false;
494 if (fVetoTriggerJet) {
495 for (UInt_t l=0; l<triggerObjects->GetEntries(); l++) {
496 Double_t deltaR = MathUtils::DeltaR(denominator->Phi(),
497 denominator->Eta(),
498 triggerObjects->At(l)->Phi(),
499 triggerObjects->At(l)->Eta());
500 if (triggerObjects->At(l)->TrigName() == fTriggerName.Data()
501 && triggerObjects->At(l)->Type() == TriggerObject::TriggerJet
502 && deltaR < 0.3
503 ) {
504 IsTriggerJet = true;
505 break;
506 }
507 }
508 }
509
510 //****************************************************************************************
511 // D0 Cut
512 //****************************************************************************************
513 double d0Min = 99999;
514 for(UInt_t i0 = 0; i0 < fVertices->GetEntries(); i0++) {
515 double pD0 = denominator->Trk()->D0Corrected(*fVertices->At(i0));
516 if(TMath::Abs(pD0) < TMath::Abs(d0Min)) d0Min = TMath::Abs(pD0);
517 }
518
519 if (denominator->Pt() > 10.0 && totalIsolation < 10.0 && denominator->HasGlobalTrk()
520 && d0Min < 0.025
521 && !(fVetoGenLeptons && IsGenLepton)
522 && !(fVetoCleanLeptons && IsCleanLepton)
523 && !(fVetoTriggerJet && IsTriggerJet)
524 ) {
525 Muon* tmpMuon = MuFakeableObjs->AddNew();
526 tmpMuon->SetGlobalTrk(denominator->GlobalTrk());
527 tmpMuon->SetTrackerTrk(denominator->TrackerTrk());
528 }
529 }
530 } else if (fMuFOType == kMuFOTrackerMuon) {
531 for (UInt_t i=0; i<fMuons->GetEntries(); i++) {
532 const Muon *denominator = fMuons->At(i);
533 Double_t totalIsolation =
534 denominator->IsoR03SumPt() +
535 denominator->IsoR03EmEt() +
536 denominator->IsoR03HadEt();
537
538 //Determine if muon fakeable object matches a gen lepton
539 Bool_t IsGenLepton = false;
540 for (UInt_t l=0; l<GenLeptonsAndTaus->GetEntries(); l++) {
541 if (MathUtils::DeltaR(denominator->Phi(), denominator->Eta(),
542 GenLeptonsAndTaus->At(l)->Phi(),
543 GenLeptonsAndTaus->At(l)->Eta()) < 0.3) {
544 IsGenLepton = true;
545 }
546 }
547
548 //Veto denominators matching to clean leptons
549 Bool_t IsCleanLepton = false;
550 for (UInt_t l=0; l<CleanLeptons->GetEntries(); l++) {
551 if (MathUtils::DeltaR(denominator->Phi(), denominator->Eta(),
552 CleanLeptons->At(l)->Phi(),
553 CleanLeptons->At(l)->Eta()) < 0.1) {
554 IsCleanLepton = true;
555 }
556 }
557
558 //Veto on Trigger jet
559 Bool_t IsTriggerJet = false;
560 if (fVetoTriggerJet) {
561 for (UInt_t l=0; l<triggerObjects->GetEntries(); l++) {
562 Double_t deltaR = MathUtils::DeltaR(denominator->Phi(),
563 denominator->Eta(),
564 triggerObjects->At(l)->Phi(),
565 triggerObjects->At(l)->Eta());
566 if (triggerObjects->At(l)->TrigName() == fTriggerName.Data()
567 && triggerObjects->At(l)->Type() == TriggerObject::TriggerJet
568 && deltaR < 0.3
569 ) {
570 IsTriggerJet = true;
571 break;
572 }
573 }
574 }
575
576 //****************************************************************************************
577 // D0 Cut
578 //****************************************************************************************
579 double d0Min = 99999;
580 for(UInt_t i0 = 0; i0 < fVertices->GetEntries(); i0++) {
581 double pD0 = denominator->Trk()->D0Corrected(*fVertices->At(i0));
582 if(TMath::Abs(pD0) < TMath::Abs(d0Min)) d0Min = TMath::Abs(pD0);
583 }
584
585 if (denominator->Pt() > 10.0 && totalIsolation < 10.0 && denominator->HasTrackerTrk()
586 && d0Min < 0.025
587 && !(fVetoGenLeptons && IsGenLepton)
588 && !(fVetoCleanLeptons && IsCleanLepton)
589 && !(fVetoTriggerJet && IsTriggerJet)
590 ) {
591 Muon* tmpMuon = MuFakeableObjs->AddNew();
592 tmpMuon->SetTrackerTrk(denominator->TrackerTrk());
593 }
594 }
595 }
596
597 //***********************************************************************************************
598 //Export the fakeable object collections for other modules to use
599 //***********************************************************************************************
600 ElFakeableObjs->SetName(fElFakeableObjsName);
601 AddObjThisEvt(ElFakeableObjs);
602 MuFakeableObjs->SetName(fMuFakeableObjsName);
603 AddObjThisEvt(MuFakeableObjs);
604
605 delete GenLeptonsAndTaus;
606 delete SuperClusters;
607 delete DuplicateRemovedElectrons;
608 }