1 |
|
// $Id$ |
2 |
|
|
3 |
|
#include "MitPhysics/Mods/interface/JetCleaningMod.h" |
4 |
– |
#include "MitPhysics/Utils/interface/IsolationTools.h" |
4 |
|
#include "MitCommon/MathTools/interface/MathUtils.h" |
5 |
|
#include "MitPhysics/Init/interface/ModNames.h" |
6 |
|
|
9 |
|
ClassImp(mithep::JetCleaningMod) |
10 |
|
|
11 |
|
//-------------------------------------------------------------------------------------------------- |
12 |
< |
JetCleaningMod::JetCleaningMod(const char *name, const char *title) : |
12 |
> |
JetCleaningMod::JetCleaningMod(const char *name, const char *title) : |
13 |
|
BaseMod(name,title), |
15 |
– |
fPrintDebug(false), |
14 |
|
fCleanElectronsName(ModNames::gkCleanElectronsName), |
15 |
|
fGoodJetsName(ModNames::gkGoodJetsName), |
16 |
< |
fCleanJetsName(ModNames::gkCleanJetsName), |
19 |
< |
fElectrons(0), |
20 |
< |
fJets(0), |
21 |
< |
fNEventsProcessed(0) |
16 |
> |
fCleanJetsName(ModNames::gkCleanJetsName) |
17 |
|
{ |
18 |
|
// Constructor. |
19 |
|
} |
20 |
|
|
21 |
|
//-------------------------------------------------------------------------------------------------- |
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 |
– |
//-------------------------------------------------------------------------------------------------- |
22 |
|
void JetCleaningMod::Process() |
23 |
|
{ |
24 |
< |
// Process entries of the tree. For this module, we just load the branches and |
25 |
< |
//output debug info or not |
24 |
> |
// Process entries of the tree. |
25 |
> |
|
26 |
> |
// get input collections |
27 |
> |
ElectronOArr *CleanElectrons = GetObjThisEvt<ElectronOArr>(fCleanElectronsName); |
28 |
> |
JetOArr *GoodJets = GetObjThisEvt<JetOArr>(fGoodJetsName); |
29 |
|
|
30 |
< |
fNEventsProcessed++; |
31 |
< |
|
32 |
< |
if (fNEventsProcessed % 1000000 == 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>; |
30 |
> |
// create output collection |
31 |
> |
JetOArr *CleanJets = new JetOArr; |
32 |
> |
CleanJets->SetName(fCleanJetsName); |
33 |
|
|
34 |
< |
//remove any jet that overlaps in eta phi with an isolated electron |
34 |
> |
// Remove any jet that overlaps in eta, phi with an isolated electron. |
35 |
|
for (UInt_t i=0; i<GoodJets->GetEntries(); ++i) { |
36 |
< |
Jet *jet = GoodJets->At(i); |
37 |
< |
bool isElectronOverlap = false; |
36 |
> |
const Jet *jet = GoodJets->At(i); |
37 |
> |
|
38 |
> |
Bool_t isElectronOverlap = false; |
39 |
|
|
40 |
|
//Check for overlap with an electron |
41 |
< |
for (UInt_t j=0; j<CleanElectrons->GetEntries(); j++) { |
42 |
< |
double deltaR = MathUtils::DeltaR(CleanElectrons->At(j)->Mom(),jet->Mom()); |
41 |
> |
for (UInt_t j=0; j<CleanElectrons->Entries(); j++) { |
42 |
> |
Double_t deltaR = MathUtils::DeltaR(CleanElectrons->At(j)->Mom(),jet->Mom()); |
43 |
|
if (deltaR < 0.3) { |
44 |
< |
isElectronOverlap = true; |
44 |
> |
isElectronOverlap = kTRUE; |
45 |
|
break; |
46 |
|
} |
47 |
|
} |
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 |
– |
} |
48 |
|
|
49 |
+ |
if (isElectronOverlap) |
50 |
+ |
continue; |
51 |
|
|
52 |
< |
//-------------------------------------------------------------------------------------------------- |
53 |
< |
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 |
< |
} |
52 |
> |
CleanJets->Add(jet); |
53 |
> |
} |
54 |
|
|
55 |
< |
//-------------------------------------------------------------------------------------------------- |
56 |
< |
void JetCleaningMod::Terminate() |
110 |
< |
{ |
111 |
< |
// Run finishing code on the client computer. For this module, we dont do |
112 |
< |
// anything here. |
55 |
> |
// add to event for other modules to use |
56 |
> |
AddObjThisEvt(CleanJets); |
57 |
|
} |