ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/JetCleaningMod.cc
Revision: 1.9
Committed: Thu Mar 12 16:00:46 2009 UTC (16 years, 1 month ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_008, Mit_008pre2
Changes since 1.8: +2 -2 lines
Log Message:
Updated JetID and cleaning modules to reflect changes to Jets

File Contents

# User Rev Content
1 bendavid 1.9 // $Id: JetCleaningMod.cc,v 1.8 2008/12/10 21:18:50 loizides 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 sixie 1.5 fCleanPhotonsName(ModNames::gkCleanPhotonsName),
16 loizides 1.3 fGoodJetsName(ModNames::gkGoodJetsName),
17 sixie 1.5 fCleanJetsName(ModNames::gkCleanJetsName),
18     fMinDeltaRToElectron(0.3),
19     fMinDeltaRToPhoton(0.3)
20 loizides 1.1 {
21     // Constructor.
22     }
23    
24     //--------------------------------------------------------------------------------------------------
25 loizides 1.4 void JetCleaningMod::Process()
26 loizides 1.1 {
27 loizides 1.4 // Process entries of the tree.
28 loizides 1.1
29 loizides 1.4 // get input collections
30 bendavid 1.9 const JetCol *GoodJets = GetObjThisEvt<JetCol>(fGoodJetsName);
31 loizides 1.8 const ElectronCol *CleanElectrons = 0;
32     if (!fCleanElectronsName.IsNull())
33     CleanElectrons = GetObjThisEvt<ElectronCol>(fCleanElectronsName);
34     const PhotonCol *CleanPhotons = 0;
35     if (!fCleanPhotonsName.IsNull())
36     CleanPhotons = GetObjThisEvt<PhotonCol>(fCleanPhotonsName);
37 loizides 1.1
38 loizides 1.4 // create output collection
39     JetOArr *CleanJets = new JetOArr;
40     CleanJets->SetName(fCleanJetsName);
41 loizides 1.1
42 loizides 1.8 // remove any jet that overlaps in eta, phi with an isolated electron.
43 loizides 1.1 for (UInt_t i=0; i<GoodJets->GetEntries(); ++i) {
44 loizides 1.4 const Jet *jet = GoodJets->At(i);
45    
46 loizides 1.8 // check for overlap with an electron
47 ceballos 1.6 Bool_t isElectronOverlap = kFALSE;
48 sixie 1.5 if (CleanElectrons) {
49 loizides 1.8 UInt_t n = CleanElectrons->GetEntries();
50     for (UInt_t j=0; j<n; ++j) {
51 sixie 1.5 Double_t deltaR = MathUtils::DeltaR(CleanElectrons->At(j)->Mom(),jet->Mom());
52     if (deltaR < fMinDeltaRToElectron) {
53     isElectronOverlap = kTRUE;
54     break;
55     }
56     }
57     }
58    
59 ceballos 1.6 if (isElectronOverlap) continue;
60    
61 loizides 1.8 // check for overlap with a photon
62     Bool_t isPhotonOverlap = kFALSE;
63 sixie 1.5 if (CleanPhotons) {
64 loizides 1.8 UInt_t n = CleanPhotons->GetEntries();
65     for (UInt_t j=0; j<n; ++j) {
66 sixie 1.5 Double_t deltaR = MathUtils::DeltaR(CleanPhotons->At(j)->Mom(),jet->Mom());
67     if (deltaR < fMinDeltaRToPhoton) {
68     isPhotonOverlap = kTRUE;
69     break;
70     }
71     }
72 loizides 1.1 }
73    
74 ceballos 1.6 if (isPhotonOverlap) continue;
75 loizides 1.1
76 loizides 1.4 CleanJets->Add(jet);
77     }
78 loizides 1.1
79 loizides 1.7 // sort according to pt
80     CleanJets->Sort();
81    
82 loizides 1.4 // add to event for other modules to use
83     AddObjThisEvt(CleanJets);
84 loizides 1.1 }