ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/JetCleaningMod.cc
Revision: 1.15
Committed: Mon Nov 2 12:28:08 2009 UTC (15 years, 6 months ago) by sixie
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012
Changes since 1.14: +4 -2 lines
Log Message:
Use supercluster to do jet cleaning for photons as well to be consistent with electrons.

File Contents

# Content
1 // $Id: JetCleaningMod.cc,v 1.14 2009/11/02 12:15:00 sixie 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 fApplyTauRemoval(kFALSE)
30 {
31 // Constructor.
32 }
33
34 //--------------------------------------------------------------------------------------------------
35 void JetCleaningMod::Process()
36 {
37 // Process entries of the tree.
38
39 // get input collections
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.
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;
64 if (CleanElectrons) {
65 UInt_t n = CleanElectrons->GetEntries();
66 for (UInt_t j=0; j<n; ++j) {
67 Double_t deltaR = MathUtils::DeltaR(CleanElectrons->At(j)->SCluster()->Eta(),
68 CleanElectrons->At(j)->SCluster()->Phi(),
69 jet->Eta(), jet->Phi());
70 if (deltaR < fMinDeltaRToElectron) {
71 isElectronOverlap = kTRUE;
72 break;
73 }
74 }
75 }
76
77 if (isElectronOverlap) continue;
78
79 // 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 // check for overlap with a photon
95 Bool_t isPhotonOverlap = kFALSE;
96 if (CleanPhotons) {
97 UInt_t n = CleanPhotons->GetEntries();
98 for (UInt_t j=0; j<n; ++j) {
99 Double_t deltaR = MathUtils::DeltaR(CleanPhotons->At(j)->SCluster()->Eta(),
100 CleanPhotons->At(j)->SCluster()->Phi(),
101 jet->Eta(), jet->Phi());
102 if (deltaR < fMinDeltaRToPhoton) {
103 isPhotonOverlap = kTRUE;
104 break;
105 }
106 }
107 }
108
109 if (isPhotonOverlap) continue;
110
111 // 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 CleanJets->Add(jet);
127 }
128
129 // sort according to pt
130 CleanJets->Sort();
131
132 // add to event for other modules to use
133 AddObjThisEvt(CleanJets);
134 }