1 |
loizides |
1.4 |
// $Id: JetIDMod.cc,v 1.3 2008/11/21 11:05:39 sixie Exp $
|
2 |
loizides |
1.1 |
|
3 |
|
|
#include "MitPhysics/Mods/interface/JetIDMod.h"
|
4 |
|
|
#include "MitCommon/MathTools/interface/MathUtils.h"
|
5 |
loizides |
1.4 |
#include "MitPhysics/Init/interface/ModNames.h"
|
6 |
loizides |
1.1 |
|
7 |
|
|
using namespace mithep;
|
8 |
|
|
|
9 |
|
|
ClassImp(mithep::JetIDMod)
|
10 |
|
|
|
11 |
|
|
//--------------------------------------------------------------------------------------------------
|
12 |
|
|
JetIDMod::JetIDMod(const char *name, const char *title) :
|
13 |
|
|
BaseMod(name,title),
|
14 |
|
|
fPrintDebug(false),
|
15 |
|
|
fJetName(Names::gkCaloJetBrn),
|
16 |
loizides |
1.4 |
fGoodJetsName(ModNames::gkGoodJetsName),
|
17 |
loizides |
1.1 |
fJetIDType("HWWJets"),
|
18 |
|
|
fJets(0),
|
19 |
sixie |
1.3 |
fNEventsProcessed(0),
|
20 |
|
|
fUseJetCorrection(false),
|
21 |
|
|
fJetEtCut(15.0)
|
22 |
loizides |
1.1 |
{
|
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 |
ceballos |
1.2 |
if (fNEventsProcessed % 1000000 == 0 || fPrintDebug) {
|
41 |
loizides |
1.1 |
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 |
|
|
bool passCut[nCuts] = {false, false, false};
|
56 |
|
|
|
57 |
sixie |
1.3 |
if(fUseJetCorrection == false) {
|
58 |
|
|
if(jet->Et() > fJetEtCut) passCut[0] = true;
|
59 |
|
|
if(fabs(jet->Eta()) < 5.0) passCut[1] = true;
|
60 |
|
|
if(jet->Alpha() > 0.2 ||
|
61 |
|
|
jet->Et() > 20.)
|
62 |
|
|
passCut[2] = true;
|
63 |
|
|
} else {
|
64 |
|
|
if(jet->Et()*
|
65 |
|
|
jet->L2RelativeCorrectionScale()*
|
66 |
|
|
jet->L3AbsoluteCorrectionScale() > fJetEtCut) passCut[0] = true;
|
67 |
|
|
if(fabs(jet->Eta()) < 5.0) passCut[1] = true;
|
68 |
|
|
passCut[2] = true;
|
69 |
|
|
}
|
70 |
loizides |
1.1 |
|
71 |
|
|
// Final decision
|
72 |
|
|
bool passAllCuts = true;
|
73 |
|
|
for(int i=0; i<nCuts; i++) {
|
74 |
|
|
passAllCuts = passAllCuts && passCut[i];
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
//Save Good Jets
|
78 |
|
|
if (passAllCuts)
|
79 |
|
|
GoodJets->Add(jet);
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
//Final Summary Debug Output
|
83 |
|
|
if ( fPrintDebug ) {
|
84 |
|
|
cerr << "Event Dump: " << fNEventsProcessed << endl;
|
85 |
|
|
cerr << "Central Jets" << endl;
|
86 |
|
|
for (UInt_t i = 0; i < GoodJets->GetEntries(); i++) {
|
87 |
|
|
cerr << i << " " << GoodJets->At(i)->Pt() << " "
|
88 |
|
|
<< GoodJets->At(i)->Eta() << " " << GoodJets->At(i)->Phi() << endl;
|
89 |
|
|
}
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
//Save Objects for Other Modules to use
|
93 |
|
|
AddObjThisEvt(GoodJets, fGoodJetsName.Data());
|
94 |
|
|
}
|
95 |
|
|
|
96 |
|
|
//--------------------------------------------------------------------------------------------------
|
97 |
|
|
void JetIDMod::SlaveBegin()
|
98 |
|
|
{
|
99 |
|
|
// Run startup code on the computer (slave) doing the actual analysis. Here,
|
100 |
|
|
// we typically initialize histograms and other analysis objects and request
|
101 |
|
|
// branches. For this module, we request a branch of the MitTree.
|
102 |
|
|
|
103 |
|
|
ReqBranch(fJetName, fJets);
|
104 |
|
|
}
|
105 |
|
|
|
106 |
|
|
//--------------------------------------------------------------------------------------------------
|
107 |
|
|
void JetIDMod::SlaveTerminate()
|
108 |
|
|
{
|
109 |
|
|
// Run finishing code on the computer (slave) that did the analysis. For this
|
110 |
|
|
// module, we dont do anything here.
|
111 |
|
|
|
112 |
|
|
}
|
113 |
|
|
|
114 |
|
|
//--------------------------------------------------------------------------------------------------
|
115 |
|
|
void JetIDMod::Terminate()
|
116 |
|
|
{
|
117 |
|
|
// Run finishing code on the client computer. For this module, we dont do
|
118 |
|
|
// anything here.
|
119 |
|
|
}
|