ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/src/JetIDMod.cc
Revision: 1.3
Committed: Tue Oct 14 05:12:49 2008 UTC (16 years, 6 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
State: FILE REMOVED
Error occurred while calculating annotation data.
Log Message:
Moved to MitPhysics/Mods

File Contents

# Content
1 // $Id: JetIDMod.cc,v 1.2 2008/10/09 10:38:44 ceballos Exp $
2
3 #include "MitAna/TreeMod/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 {
23 // Constructor.
24 }
25
26 //--------------------------------------------------------------------------------------------------
27 void JetIDMod::Begin()
28 {
29 // Run startup code on the client machine. For this module, we dont do
30 // anything here.
31 }
32
33 //--------------------------------------------------------------------------------------------------
34 void JetIDMod::Process()
35 {
36 // Process entries of the tree.
37
38 fNEventsProcessed++;
39
40 if (fNEventsProcessed % 1000 == 0 || fPrintDebug) {
41 time_t systime;
42 systime = time(NULL);
43
44 cerr << endl << "JetIDMod : Process Event " << fNEventsProcessed << " Time: " << ctime(&systime) << endl;
45 }
46
47 //Get Jets
48 LoadBranch(fJetName);
49 ObjArray<Jet> *GoodJets = new ObjArray<Jet>;
50
51 for (UInt_t i=0; i<fJets->GetEntries(); ++i) {
52 Jet *jet = fJets->At(i);
53
54 const int nCuts = 3;
55 double cutValue[nCuts] = {15., 5.0, 0.2};
56 bool passCut[nCuts] = {false, false, false};
57
58 if(jet->Et() > cutValue[0]) passCut[0] = true;
59 if(fabs(jet->Eta()) < cutValue[1]) passCut[1] = true;
60 if(jet->Alpha() > cutValue[2] ||
61 jet->Et() > 20.)
62 passCut[2] = true;
63
64 // Final decision
65 bool passAllCuts = true;
66 for(int i=0; i<nCuts; i++) {
67 passAllCuts = passAllCuts && passCut[i];
68 }
69
70 //Save Good Jets
71 if (passAllCuts)
72 GoodJets->Add(jet);
73 }
74
75 //Final Summary Debug Output
76 if ( fPrintDebug ) {
77 cerr << "Event Dump: " << fNEventsProcessed << endl;
78 cerr << "Central Jets" << endl;
79 for (UInt_t i = 0; i < GoodJets->GetEntries(); i++) {
80 cerr << i << " " << GoodJets->At(i)->Pt() << " "
81 << GoodJets->At(i)->Eta() << " " << GoodJets->At(i)->Phi() << endl;
82 }
83 }
84
85 //Save Objects for Other Modules to use
86 AddObjThisEvt(GoodJets, fGoodJetsName.Data());
87 }
88
89 //--------------------------------------------------------------------------------------------------
90 void JetIDMod::SlaveBegin()
91 {
92 // Run startup code on the computer (slave) doing the actual analysis. Here,
93 // we typically initialize histograms and other analysis objects and request
94 // branches. For this module, we request a branch of the MitTree.
95
96 ReqBranch(fJetName, fJets);
97 }
98
99 //--------------------------------------------------------------------------------------------------
100 void JetIDMod::SlaveTerminate()
101 {
102 // Run finishing code on the computer (slave) that did the analysis. For this
103 // module, we dont do anything here.
104
105 }
106
107 //--------------------------------------------------------------------------------------------------
108 void JetIDMod::Terminate()
109 {
110 // Run finishing code on the client computer. For this module, we dont do
111 // anything here.
112 }