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