ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/JetCleaningMod.cc
Revision: 1.18
Committed: Sat Apr 30 12:35:09 2011 UTC (14 years ago) by sixie
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_029c, Mit_029b, Mit_029a, Mit_028a, Mit_028, Mit_027, Mit_027a, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_021, Mit_021pre2, HEAD
Changes since 1.17: +3 -3 lines
Log Message:
jet - electron  cleaning should use electron coordinates instead of supercluster coordinates because our default jets are pfjets which are corrected back to the vertex

File Contents

# User Rev Content
1 sixie 1.18 // $Id: JetCleaningMod.cc,v 1.17 2010/06/28 21:07:06 ceballos 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 ceballos 1.17 fApplyPhotonRemoval(kFALSE),
30 ceballos 1.11 fApplyTauRemoval(kFALSE)
31 loizides 1.1 {
32     // Constructor.
33     }
34    
35     //--------------------------------------------------------------------------------------------------
36 loizides 1.4 void JetCleaningMod::Process()
37 loizides 1.1 {
38 loizides 1.4 // Process entries of the tree.
39 loizides 1.1
40 loizides 1.4 // get input collections
41 bendavid 1.9 const JetCol *GoodJets = GetObjThisEvt<JetCol>(fGoodJetsName);
42 loizides 1.8 const ElectronCol *CleanElectrons = 0;
43     if (!fCleanElectronsName.IsNull())
44     CleanElectrons = GetObjThisEvt<ElectronCol>(fCleanElectronsName);
45 ceballos 1.10 const MuonCol *CleanMuons = 0;
46     if (!fCleanMuonsName.IsNull())
47     CleanMuons = GetObjThisEvt<MuonCol>(fCleanMuonsName);
48 loizides 1.8 const PhotonCol *CleanPhotons = 0;
49     if (!fCleanPhotonsName.IsNull())
50 loizides 1.13 CleanPhotons = GetObjThisEvt<PhotonCol>(fCleanPhotonsName);
51 ceballos 1.11 const TauCol *CleanTaus = 0;
52     if (fApplyTauRemoval && !fCleanTausName.IsNull())
53 loizides 1.13 CleanTaus = GetObjThisEvt<TauCol>(fCleanTausName);
54 loizides 1.1
55 loizides 1.4 // create output collection
56     JetOArr *CleanJets = new JetOArr;
57     CleanJets->SetName(fCleanJetsName);
58 loizides 1.1
59 loizides 1.8 // remove any jet that overlaps in eta, phi with an isolated electron.
60 loizides 1.1 for (UInt_t i=0; i<GoodJets->GetEntries(); ++i) {
61 loizides 1.4 const Jet *jet = GoodJets->At(i);
62    
63 ceballos 1.10 // check for overlap with an Electron
64 ceballos 1.6 Bool_t isElectronOverlap = kFALSE;
65 sixie 1.5 if (CleanElectrons) {
66 loizides 1.8 UInt_t n = CleanElectrons->GetEntries();
67     for (UInt_t j=0; j<n; ++j) {
68 sixie 1.18 Double_t deltaR = MathUtils::DeltaR(CleanElectrons->At(j)->Phi(),
69     CleanElectrons->At(j)->Eta(),
70 ceballos 1.16 jet->Phi(), jet->Eta());
71 sixie 1.5 if (deltaR < fMinDeltaRToElectron) {
72     isElectronOverlap = kTRUE;
73     break;
74     }
75     }
76     }
77    
78 ceballos 1.6 if (isElectronOverlap) continue;
79    
80 ceballos 1.10 // 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 loizides 1.8 // check for overlap with a photon
96     Bool_t isPhotonOverlap = kFALSE;
97 ceballos 1.17 if (fApplyPhotonRemoval && CleanPhotons) {
98 loizides 1.8 UInt_t n = CleanPhotons->GetEntries();
99     for (UInt_t j=0; j<n; ++j) {
100 ceballos 1.16 Double_t deltaR = MathUtils::DeltaR(CleanPhotons->At(j)->SCluster()->Phi(),
101     CleanPhotons->At(j)->SCluster()->Eta(),
102     jet->Phi(), jet->Eta());
103 sixie 1.5 if (deltaR < fMinDeltaRToPhoton) {
104     isPhotonOverlap = kTRUE;
105     break;
106     }
107     }
108 loizides 1.1 }
109    
110 ceballos 1.6 if (isPhotonOverlap) continue;
111 loizides 1.1
112 ceballos 1.11 // 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 ceballos 1.12 CleanJets->Add(jet);
128 loizides 1.4 }
129 loizides 1.1
130 loizides 1.7 // sort according to pt
131     CleanJets->Sort();
132    
133 loizides 1.4 // add to event for other modules to use
134     AddObjThisEvt(CleanJets);
135 loizides 1.1 }