1 |
sixie |
1.15 |
// $Id: JetCleaningMod.cc,v 1.14 2009/11/02 12:15:00 sixie Exp $
|
2 |
loizides |
1.1 |
|
3 |
|
|
#include "MitPhysics/Mods/interface/JetCleaningMod.h"
|
4 |
loizides |
1.13 |
#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 |
loizides |
1.1 |
#include "MitCommon/MathTools/interface/MathUtils.h"
|
10 |
loizides |
1.3 |
#include "MitPhysics/Init/interface/ModNames.h"
|
11 |
loizides |
1.1 |
|
12 |
|
|
using namespace mithep;
|
13 |
|
|
|
14 |
|
|
ClassImp(mithep::JetCleaningMod)
|
15 |
|
|
|
16 |
|
|
//--------------------------------------------------------------------------------------------------
|
17 |
loizides |
1.4 |
JetCleaningMod::JetCleaningMod(const char *name, const char *title) :
|
18 |
loizides |
1.1 |
BaseMod(name,title),
|
19 |
loizides |
1.3 |
fCleanElectronsName(ModNames::gkCleanElectronsName),
|
20 |
ceballos |
1.10 |
fCleanMuonsName(ModNames::gkCleanMuonsName),
|
21 |
sixie |
1.5 |
fCleanPhotonsName(ModNames::gkCleanPhotonsName),
|
22 |
ceballos |
1.11 |
fCleanTausName(ModNames::gkCleanTausName),
|
23 |
loizides |
1.3 |
fGoodJetsName(ModNames::gkGoodJetsName),
|
24 |
sixie |
1.5 |
fCleanJetsName(ModNames::gkCleanJetsName),
|
25 |
|
|
fMinDeltaRToElectron(0.3),
|
26 |
ceballos |
1.10 |
fMinDeltaRToMuon(0.3),
|
27 |
ceballos |
1.11 |
fMinDeltaRToPhoton(0.3),
|
28 |
|
|
fMinDeltaRToTau(0.3),
|
29 |
|
|
fApplyTauRemoval(kFALSE)
|
30 |
loizides |
1.1 |
{
|
31 |
|
|
// Constructor.
|
32 |
|
|
}
|
33 |
|
|
|
34 |
|
|
//--------------------------------------------------------------------------------------------------
|
35 |
loizides |
1.4 |
void JetCleaningMod::Process()
|
36 |
loizides |
1.1 |
{
|
37 |
loizides |
1.4 |
// Process entries of the tree.
|
38 |
loizides |
1.1 |
|
39 |
loizides |
1.4 |
// get input collections
|
40 |
bendavid |
1.9 |
const JetCol *GoodJets = GetObjThisEvt<JetCol>(fGoodJetsName);
|
41 |
loizides |
1.8 |
const ElectronCol *CleanElectrons = 0;
|
42 |
|
|
if (!fCleanElectronsName.IsNull())
|
43 |
|
|
CleanElectrons = GetObjThisEvt<ElectronCol>(fCleanElectronsName);
|
44 |
ceballos |
1.10 |
const MuonCol *CleanMuons = 0;
|
45 |
|
|
if (!fCleanMuonsName.IsNull())
|
46 |
|
|
CleanMuons = GetObjThisEvt<MuonCol>(fCleanMuonsName);
|
47 |
loizides |
1.8 |
const PhotonCol *CleanPhotons = 0;
|
48 |
|
|
if (!fCleanPhotonsName.IsNull())
|
49 |
loizides |
1.13 |
CleanPhotons = GetObjThisEvt<PhotonCol>(fCleanPhotonsName);
|
50 |
ceballos |
1.11 |
const TauCol *CleanTaus = 0;
|
51 |
|
|
if (fApplyTauRemoval && !fCleanTausName.IsNull())
|
52 |
loizides |
1.13 |
CleanTaus = GetObjThisEvt<TauCol>(fCleanTausName);
|
53 |
loizides |
1.1 |
|
54 |
loizides |
1.4 |
// create output collection
|
55 |
|
|
JetOArr *CleanJets = new JetOArr;
|
56 |
|
|
CleanJets->SetName(fCleanJetsName);
|
57 |
loizides |
1.1 |
|
58 |
loizides |
1.8 |
// remove any jet that overlaps in eta, phi with an isolated electron.
|
59 |
loizides |
1.1 |
for (UInt_t i=0; i<GoodJets->GetEntries(); ++i) {
|
60 |
loizides |
1.4 |
const Jet *jet = GoodJets->At(i);
|
61 |
|
|
|
62 |
ceballos |
1.10 |
// check for overlap with an Electron
|
63 |
ceballos |
1.6 |
Bool_t isElectronOverlap = kFALSE;
|
64 |
sixie |
1.5 |
if (CleanElectrons) {
|
65 |
loizides |
1.8 |
UInt_t n = CleanElectrons->GetEntries();
|
66 |
|
|
for (UInt_t j=0; j<n; ++j) {
|
67 |
sixie |
1.14 |
Double_t deltaR = MathUtils::DeltaR(CleanElectrons->At(j)->SCluster()->Eta(),
|
68 |
|
|
CleanElectrons->At(j)->SCluster()->Phi(),
|
69 |
|
|
jet->Eta(), jet->Phi());
|
70 |
sixie |
1.5 |
if (deltaR < fMinDeltaRToElectron) {
|
71 |
|
|
isElectronOverlap = kTRUE;
|
72 |
|
|
break;
|
73 |
|
|
}
|
74 |
|
|
}
|
75 |
|
|
}
|
76 |
|
|
|
77 |
ceballos |
1.6 |
if (isElectronOverlap) continue;
|
78 |
|
|
|
79 |
ceballos |
1.10 |
// check for overlap with an Muon
|
80 |
|
|
Bool_t isMuonOverlap = kFALSE;
|
81 |
|
|
if (CleanMuons) {
|
82 |
|
|
UInt_t n = CleanMuons->GetEntries();
|
83 |
|
|
for (UInt_t j=0; j<n; ++j) {
|
84 |
|
|
Double_t deltaR = MathUtils::DeltaR(CleanMuons->At(j)->Mom(),jet->Mom());
|
85 |
|
|
if (deltaR < fMinDeltaRToMuon) {
|
86 |
|
|
isMuonOverlap = kTRUE;
|
87 |
|
|
break;
|
88 |
|
|
}
|
89 |
|
|
}
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
if (isMuonOverlap) continue;
|
93 |
|
|
|
94 |
loizides |
1.8 |
// check for overlap with a photon
|
95 |
|
|
Bool_t isPhotonOverlap = kFALSE;
|
96 |
sixie |
1.5 |
if (CleanPhotons) {
|
97 |
loizides |
1.8 |
UInt_t n = CleanPhotons->GetEntries();
|
98 |
|
|
for (UInt_t j=0; j<n; ++j) {
|
99 |
sixie |
1.15 |
Double_t deltaR = MathUtils::DeltaR(CleanPhotons->At(j)->SCluster()->Eta(),
|
100 |
|
|
CleanPhotons->At(j)->SCluster()->Phi(),
|
101 |
|
|
jet->Eta(), jet->Phi());
|
102 |
sixie |
1.5 |
if (deltaR < fMinDeltaRToPhoton) {
|
103 |
|
|
isPhotonOverlap = kTRUE;
|
104 |
|
|
break;
|
105 |
|
|
}
|
106 |
|
|
}
|
107 |
loizides |
1.1 |
}
|
108 |
|
|
|
109 |
ceballos |
1.6 |
if (isPhotonOverlap) continue;
|
110 |
loizides |
1.1 |
|
111 |
ceballos |
1.11 |
// check for overlap with a tau
|
112 |
|
|
Bool_t isTauOverlap = kFALSE;
|
113 |
|
|
if (fApplyTauRemoval && CleanTaus) {
|
114 |
|
|
UInt_t n = CleanTaus->GetEntries();
|
115 |
|
|
for (UInt_t j=0; j<n; ++j) {
|
116 |
|
|
Double_t deltaR = MathUtils::DeltaR(CleanTaus->At(j)->Mom(),jet->Mom());
|
117 |
|
|
if (deltaR < fMinDeltaRToTau) {
|
118 |
|
|
isTauOverlap = kTRUE;
|
119 |
|
|
break;
|
120 |
|
|
}
|
121 |
|
|
}
|
122 |
|
|
}
|
123 |
|
|
|
124 |
|
|
if (isTauOverlap) continue;
|
125 |
|
|
|
126 |
ceballos |
1.12 |
CleanJets->Add(jet);
|
127 |
loizides |
1.4 |
}
|
128 |
loizides |
1.1 |
|
129 |
loizides |
1.7 |
// sort according to pt
|
130 |
|
|
CleanJets->Sort();
|
131 |
|
|
|
132 |
loizides |
1.4 |
// add to event for other modules to use
|
133 |
|
|
AddObjThisEvt(CleanJets);
|
134 |
loizides |
1.1 |
}
|