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