ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/JetCleaningMod.cc
Revision: 1.11
Committed: Wed Apr 8 10:12:22 2009 UTC (16 years, 1 month ago) by ceballos
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_009
Changes since 1.10: +23 -2 lines
Log Message:
adding tau collection to jet cleaning, off by default

File Contents

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