ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/JetIDMod.cc
Revision: 1.3
Committed: Fri Nov 21 11:05:39 2008 UTC (16 years, 5 months ago) by sixie
Content type: text/plain
Branch: MAIN
Changes since 1.2: +17 -8 lines
Log Message:
add option to use corrected jet et cut, and add configurable jet et cut parameter

File Contents

# Content
1 // $Id: JetIDMod.cc,v 1.2 2008/11/11 21:22:54 ceballos Exp $
2
3 #include "MitPhysics/Mods/interface/JetIDMod.h"
4 #include "MitAna/DataTree/interface/Names.h"
5 #include "MitAna/DataCont/interface/ObjArray.h"
6 #include "MitCommon/MathTools/interface/MathUtils.h"
7
8
9 using namespace mithep;
10
11 ClassImp(mithep::JetIDMod)
12
13 //--------------------------------------------------------------------------------------------------
14 JetIDMod::JetIDMod(const char *name, const char *title) :
15 BaseMod(name,title),
16 fPrintDebug(false),
17 fJetName(Names::gkCaloJetBrn),
18 fGoodJetsName(Names::gkGoodJetsName),
19 fJetIDType("HWWJets"),
20 fJets(0),
21 fNEventsProcessed(0),
22 fUseJetCorrection(false),
23 fJetEtCut(15.0)
24 {
25 // Constructor.
26 }
27
28 //--------------------------------------------------------------------------------------------------
29 void JetIDMod::Begin()
30 {
31 // Run startup code on the client machine. For this module, we dont do
32 // anything here.
33 }
34
35 //--------------------------------------------------------------------------------------------------
36 void JetIDMod::Process()
37 {
38 // Process entries of the tree.
39
40 fNEventsProcessed++;
41
42 if (fNEventsProcessed % 1000000 == 0 || fPrintDebug) {
43 time_t systime;
44 systime = time(NULL);
45
46 cerr << endl << "JetIDMod : Process Event " << fNEventsProcessed << " Time: " << ctime(&systime) << endl;
47 }
48
49 //Get Jets
50 LoadBranch(fJetName);
51 ObjArray<Jet> *GoodJets = new ObjArray<Jet>;
52
53 for (UInt_t i=0; i<fJets->GetEntries(); ++i) {
54 Jet *jet = fJets->At(i);
55
56 const int nCuts = 3;
57 bool passCut[nCuts] = {false, false, false};
58
59 if(fUseJetCorrection == false) {
60 if(jet->Et() > fJetEtCut) passCut[0] = true;
61 if(fabs(jet->Eta()) < 5.0) passCut[1] = true;
62 if(jet->Alpha() > 0.2 ||
63 jet->Et() > 20.)
64 passCut[2] = true;
65 } else {
66 if(jet->Et()*
67 jet->L2RelativeCorrectionScale()*
68 jet->L3AbsoluteCorrectionScale() > fJetEtCut) passCut[0] = true;
69 if(fabs(jet->Eta()) < 5.0) passCut[1] = true;
70 passCut[2] = true;
71 }
72
73 // Final decision
74 bool passAllCuts = true;
75 for(int i=0; i<nCuts; i++) {
76 passAllCuts = passAllCuts && passCut[i];
77 }
78
79 //Save Good Jets
80 if (passAllCuts)
81 GoodJets->Add(jet);
82 }
83
84 //Final Summary Debug Output
85 if ( fPrintDebug ) {
86 cerr << "Event Dump: " << fNEventsProcessed << endl;
87 cerr << "Central Jets" << endl;
88 for (UInt_t i = 0; i < GoodJets->GetEntries(); i++) {
89 cerr << i << " " << GoodJets->At(i)->Pt() << " "
90 << GoodJets->At(i)->Eta() << " " << GoodJets->At(i)->Phi() << endl;
91 }
92 }
93
94 //Save Objects for Other Modules to use
95 AddObjThisEvt(GoodJets, fGoodJetsName.Data());
96 }
97
98 //--------------------------------------------------------------------------------------------------
99 void JetIDMod::SlaveBegin()
100 {
101 // Run startup code on the computer (slave) doing the actual analysis. Here,
102 // we typically initialize histograms and other analysis objects and request
103 // branches. For this module, we request a branch of the MitTree.
104
105 ReqBranch(fJetName, fJets);
106 }
107
108 //--------------------------------------------------------------------------------------------------
109 void JetIDMod::SlaveTerminate()
110 {
111 // Run finishing code on the computer (slave) that did the analysis. For this
112 // module, we dont do anything here.
113
114 }
115
116 //--------------------------------------------------------------------------------------------------
117 void JetIDMod::Terminate()
118 {
119 // Run finishing code on the client computer. For this module, we dont do
120 // anything here.
121 }