ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/JetCleaningMod.cc
(Generate patch)

Comparing UserCode/MitPhysics/Mods/src/JetCleaningMod.cc (file contents):
Revision 1.5 by sixie, Sat Nov 29 18:45:43 2008 UTC vs.
Revision 1.14 by sixie, Mon Nov 2 12:15:00 2009 UTC

# Line 1 | Line 1
1   // $Id$
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  
# Line 12 | Line 17 | ClassImp(mithep::JetCleaningMod)
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 <  fMinDeltaRToPhoton(0.3)
26 >  fMinDeltaRToMuon(0.3),
27 >  fMinDeltaRToPhoton(0.3),
28 >  fMinDeltaRToTau(0.3),
29 >  fApplyTauRemoval(kFALSE)
30   {
31    // Constructor.
32   }
# Line 27 | Line 37 | void JetCleaningMod::Process()
37    // Process entries of the tree.
38  
39    // get input collections
40 <  ElectronOArr *CleanElectrons = GetObjThisEvt<ElectronOArr>(fCleanElectronsName);
41 <  PhotonOArr *CleanPhotons = GetObjThisEvt<PhotonOArr>(fCleanPhotonsName);
42 <  JetOArr *GoodJets = GetObjThisEvt<JetOArr>(fGoodJetsName);
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.    
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 <    Bool_t isElectronOverlap =  false;
63 <    Bool_t isPhotonOverlap =  false;
44 <
45 <    //Check for overlap with an electron
62 >    // check for overlap with an Electron
63 >    Bool_t isElectronOverlap = kFALSE;
64      if (CleanElectrons) {
65 <      for (UInt_t j=0; j<CleanElectrons->Entries(); j++) {
66 <        Double_t deltaR = MathUtils::DeltaR(CleanElectrons->At(j)->Mom(),jet->Mom());  
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;                
# Line 53 | Line 74 | void JetCleaningMod::Process()
74        }
75      }
76  
77 <    //Check for overlap with a photon
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 <      for (UInt_t j=0; j<CleanPhotons->Entries(); j++) {
97 >      UInt_t n = CleanPhotons->GetEntries();
98 >      for (UInt_t j=0; j<n; ++j) {
99          Double_t deltaR = MathUtils::DeltaR(CleanPhotons->At(j)->Mom(),jet->Mom());  
100          if (deltaR < fMinDeltaRToPhoton) {
101            isPhotonOverlap = kTRUE;
# Line 64 | Line 104 | void JetCleaningMod::Process()
104        }
105      }
106  
107 <    if (isElectronOverlap || isPhotonOverlap)
68 <      continue;
107 >    if (isPhotonOverlap) continue;
108  
109 <    CleanJets->Add(jet);    
109 >    // check for overlap with a tau
110 >    Bool_t isTauOverlap = kFALSE;
111 >    if (fApplyTauRemoval && CleanTaus) {
112 >      UInt_t n = CleanTaus->GetEntries();
113 >      for (UInt_t j=0; j<n; ++j) {
114 >        Double_t deltaR = MathUtils::DeltaR(CleanTaus->At(j)->Mom(),jet->Mom());  
115 >        if (deltaR < fMinDeltaRToTau) {
116 >          isTauOverlap = kTRUE;
117 >          break;                
118 >        }      
119 >      }
120 >    }
121 >
122 >    if (isTauOverlap) continue;
123 >
124 >    CleanJets->Add(jet);
125    }
126  
127 +  // sort according to pt
128 +  CleanJets->Sort();
129 +
130    // add to event for other modules to use
131    AddObjThisEvt(CleanJets);
132   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines