1 |
|
// $Id$ |
2 |
|
|
3 |
|
#include "MitPhysics/Mods/interface/JetCleaningMod.h" |
4 |
+ |
#include "MitAna/DataTree/interface/JetCol.h" |
5 |
+ |
#include "MitAna/DataTree/interface/PhotonCol.h" |
6 |
+ |
#include "MitAna/DataTree/interface/MuonCol.h" |
7 |
+ |
#include "MitAna/DataTree/interface/ElectronCol.h" |
8 |
+ |
#include "MitAna/DataTree/interface/TauCol.h" |
9 |
|
#include "MitCommon/MathTools/interface/MathUtils.h" |
10 |
|
#include "MitPhysics/Init/interface/ModNames.h" |
11 |
|
|
17 |
|
JetCleaningMod::JetCleaningMod(const char *name, const char *title) : |
18 |
|
BaseMod(name,title), |
19 |
|
fCleanElectronsName(ModNames::gkCleanElectronsName), |
20 |
+ |
fCleanMuonsName(ModNames::gkCleanMuonsName), |
21 |
|
fCleanPhotonsName(ModNames::gkCleanPhotonsName), |
22 |
+ |
fCleanTausName(ModNames::gkCleanTausName), |
23 |
|
fGoodJetsName(ModNames::gkGoodJetsName), |
24 |
|
fCleanJetsName(ModNames::gkCleanJetsName), |
25 |
|
fMinDeltaRToElectron(0.3), |
26 |
< |
fMinDeltaRToPhoton(0.3) |
26 |
> |
fMinDeltaRToMuon(0.3), |
27 |
> |
fMinDeltaRToPhoton(0.3), |
28 |
> |
fMinDeltaRToTau(0.3), |
29 |
> |
fApplyTauRemoval(kFALSE) |
30 |
|
{ |
31 |
|
// Constructor. |
32 |
|
} |
37 |
|
// Process entries of the tree. |
38 |
|
|
39 |
|
// get input collections |
40 |
< |
ElectronOArr *CleanElectrons = GetObjThisEvt<ElectronOArr>(fCleanElectronsName); |
41 |
< |
PhotonOArr *CleanPhotons = GetObjThisEvt<PhotonOArr>(fCleanPhotonsName); |
42 |
< |
JetOArr *GoodJets = GetObjThisEvt<JetOArr>(fGoodJetsName); |
40 |
> |
const JetCol *GoodJets = GetObjThisEvt<JetCol>(fGoodJetsName); |
41 |
> |
const ElectronCol *CleanElectrons = 0; |
42 |
> |
if (!fCleanElectronsName.IsNull()) |
43 |
> |
CleanElectrons = GetObjThisEvt<ElectronCol>(fCleanElectronsName); |
44 |
> |
const MuonCol *CleanMuons = 0; |
45 |
> |
if (!fCleanMuonsName.IsNull()) |
46 |
> |
CleanMuons = GetObjThisEvt<MuonCol>(fCleanMuonsName); |
47 |
> |
const PhotonCol *CleanPhotons = 0; |
48 |
> |
if (!fCleanPhotonsName.IsNull()) |
49 |
> |
CleanPhotons = GetObjThisEvt<PhotonCol>(fCleanPhotonsName); |
50 |
> |
const TauCol *CleanTaus = 0; |
51 |
> |
if (fApplyTauRemoval && !fCleanTausName.IsNull()) |
52 |
> |
CleanTaus = GetObjThisEvt<TauCol>(fCleanTausName); |
53 |
|
|
54 |
|
// create output collection |
55 |
|
JetOArr *CleanJets = new JetOArr; |
56 |
|
CleanJets->SetName(fCleanJetsName); |
57 |
|
|
58 |
< |
// Remove any jet that overlaps in eta, phi with an isolated electron. |
58 |
> |
// remove any jet that overlaps in eta, phi with an isolated electron. |
59 |
|
for (UInt_t i=0; i<GoodJets->GetEntries(); ++i) { |
60 |
|
const Jet *jet = GoodJets->At(i); |
61 |
|
|
62 |
+ |
// check for overlap with an Electron |
63 |
|
Bool_t isElectronOverlap = kFALSE; |
43 |
– |
Bool_t isPhotonOverlap = kFALSE; |
44 |
– |
|
45 |
– |
//Check for overlap with an electron |
64 |
|
if (CleanElectrons) { |
65 |
< |
for (UInt_t j=0; j<CleanElectrons->Entries(); j++) { |
65 |
> |
UInt_t n = CleanElectrons->GetEntries(); |
66 |
> |
for (UInt_t j=0; j<n; ++j) { |
67 |
|
Double_t deltaR = MathUtils::DeltaR(CleanElectrons->At(j)->Mom(),jet->Mom()); |
68 |
|
if (deltaR < fMinDeltaRToElectron) { |
69 |
|
isElectronOverlap = kTRUE; |
74 |
|
|
75 |
|
if (isElectronOverlap) continue; |
76 |
|
|
77 |
< |
//Check for overlap with a photon |
77 |
> |
// check for overlap with an Muon |
78 |
> |
Bool_t isMuonOverlap = kFALSE; |
79 |
> |
if (CleanMuons) { |
80 |
> |
UInt_t n = CleanMuons->GetEntries(); |
81 |
> |
for (UInt_t j=0; j<n; ++j) { |
82 |
> |
Double_t deltaR = MathUtils::DeltaR(CleanMuons->At(j)->Mom(),jet->Mom()); |
83 |
> |
if (deltaR < fMinDeltaRToMuon) { |
84 |
> |
isMuonOverlap = kTRUE; |
85 |
> |
break; |
86 |
> |
} |
87 |
> |
} |
88 |
> |
} |
89 |
> |
|
90 |
> |
if (isMuonOverlap) continue; |
91 |
> |
|
92 |
> |
// check for overlap with a photon |
93 |
> |
Bool_t isPhotonOverlap = kFALSE; |
94 |
|
if (CleanPhotons) { |
95 |
< |
for (UInt_t j=0; j<CleanPhotons->Entries(); j++) { |
95 |
> |
UInt_t n = CleanPhotons->GetEntries(); |
96 |
> |
for (UInt_t j=0; j<n; ++j) { |
97 |
|
Double_t deltaR = MathUtils::DeltaR(CleanPhotons->At(j)->Mom(),jet->Mom()); |
98 |
|
if (deltaR < fMinDeltaRToPhoton) { |
99 |
|
isPhotonOverlap = kTRUE; |
104 |
|
|
105 |
|
if (isPhotonOverlap) continue; |
106 |
|
|
107 |
< |
CleanJets->Add(jet); |
107 |
> |
// check for overlap with a tau |
108 |
> |
Bool_t isTauOverlap = kFALSE; |
109 |
> |
if (fApplyTauRemoval && CleanTaus) { |
110 |
> |
UInt_t n = CleanTaus->GetEntries(); |
111 |
> |
for (UInt_t j=0; j<n; ++j) { |
112 |
> |
Double_t deltaR = MathUtils::DeltaR(CleanTaus->At(j)->Mom(),jet->Mom()); |
113 |
> |
if (deltaR < fMinDeltaRToTau) { |
114 |
> |
isTauOverlap = kTRUE; |
115 |
> |
break; |
116 |
> |
} |
117 |
> |
} |
118 |
> |
} |
119 |
> |
|
120 |
> |
if (isTauOverlap) continue; |
121 |
> |
|
122 |
> |
CleanJets->Add(jet); |
123 |
|
} |
124 |
|
|
125 |
+ |
// sort according to pt |
126 |
+ |
CleanJets->Sort(); |
127 |
+ |
|
128 |
|
// add to event for other modules to use |
129 |
|
AddObjThisEvt(CleanJets); |
130 |
|
} |