ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/src/JetCleaningMod.cc
Revision: 1.3
Committed: Mon Oct 6 15:48:01 2008 UTC (16 years, 7 months ago) by ceballos
Content type: text/plain
Branch: MAIN
Changes since 1.2: +2 -2 lines
Log Message:
looser deltaR definition

File Contents

# User Rev Content
1 ceballos 1.3 // $Id: JetCleaningMod.cc,v 1.2 2008/10/02 14:22:46 sixie Exp $
2 sixie 1.1
3     #include "MitAna/TreeMod/interface/JetCleaningMod.h"
4     #include "MitAna/DataTree/interface/Names.h"
5     #include "MitAna/DataCont/interface/ObjArray.h"
6     #include "MitAna/Utils/interface/IsolationTools.h"
7     #include "MitCommon/MathTools/interface/MathUtils.h"
8    
9     using namespace mithep;
10    
11     ClassImp(mithep::JetCleaningMod)
12    
13     //--------------------------------------------------------------------------------------------------
14     JetCleaningMod::JetCleaningMod(const char *name, const char *title) :
15     BaseMod(name,title),
16     fPrintDebug(false),
17     fCleanElectronsName(Names::gkCleanElectronsName),
18     fGoodJetsName(Names::gkGoodJetsName),
19     fCleanJetsName(Names::gkCleanJetsName),
20     fElectrons(0),
21     fJets(0)
22     {
23     // Constructor.
24     }
25    
26     //--------------------------------------------------------------------------------------------------
27     void JetCleaningMod::Begin()
28     {
29     // Run startup code on the client machine. For this module, we dont do
30     // anything here.
31     }
32    
33     //--------------------------------------------------------------------------------------------------
34     void JetCleaningMod::Process()
35     {
36     // Process entries of the tree. For this module, we just load the branches and
37     //output debug info or not
38    
39     fNEventsProcessed++;
40    
41     if (fNEventsProcessed % 1000 == 0 || fPrintDebug) {
42     time_t systime;
43     systime = time(NULL);
44    
45     cerr << endl << "JetCleaningMod : Process Event " << fNEventsProcessed << " Time: " << ctime(&systime) << endl;
46     }
47    
48     //Get Clean Electrons
49     ObjArray<Electron> *CleanElectrons = dynamic_cast<ObjArray<Electron>* >
50     (FindObjThisEvt(fCleanElectronsName.Data()));
51     //Get Good Jets
52     ObjArray<Jet> *GoodJets = dynamic_cast<ObjArray<Jet>* >
53     (FindObjThisEvt(fGoodJetsName.Data()));
54     ObjArray<Jet> *CleanJets = new ObjArray<Jet>;
55    
56     //remove any jet that overlaps in eta phi with an isolated electron
57     for (UInt_t i=0; i<GoodJets->GetEntries(); ++i) {
58     Jet *jet = GoodJets->At(i);
59     bool isElectronOverlap = false;
60    
61     //Check for overlap with an electron
62     for (UInt_t j=0; j<CleanElectrons->GetEntries(); j++) {
63     double deltaR = MathUtils::DeltaR(CleanElectrons->At(j)->Mom(),jet->Mom());
64 ceballos 1.3 if (deltaR < 0.1) {
65 sixie 1.1 isElectronOverlap = true;
66     break;
67     }
68     }
69     //Save Clean Jets
70     if (!isElectronOverlap) {
71     CleanJets->Add(jet);
72     }
73     }
74    
75     //Final Summary Debug Output
76     if ( fPrintDebug ) {
77     cerr << "Event Dump: " << fNEventsProcessed << endl;
78     cerr << "GoodJets : " <<
79     cerr << "Clean Jets" << endl;
80     for (UInt_t i = 0; i < CleanJets->GetEntries(); i++) {
81     cerr << i << " " << CleanJets->At(i)->Pt() << " "
82     << CleanJets->At(i)->Eta() << " " << CleanJets->At(i)->Phi() << endl;
83     }
84     }
85    
86     //Save Objects for Other Modules to use
87     AddObjThisEvt(CleanJets, fCleanJetsName.Data());
88     }
89    
90    
91     //--------------------------------------------------------------------------------------------------
92     void JetCleaningMod::SlaveBegin()
93     {
94     // Run startup code on the computer (slave) doing the actual analysis. Here,
95     // we typically initialize histograms and other analysis objects and request
96     // branches. For this module, we request a branch of the MitTree.
97    
98     }
99    
100     //--------------------------------------------------------------------------------------------------
101     void JetCleaningMod::SlaveTerminate()
102     {
103     // Run finishing code on the computer (slave) that did the analysis. For this
104     // module, we dont do anything here.
105    
106     }
107    
108     //--------------------------------------------------------------------------------------------------
109     void JetCleaningMod::Terminate()
110     {
111     // Run finishing code on the client computer. For this module, we dont do
112     // anything here.
113     }