1 |
ceballos |
1.4 |
// $Id: ElectronIDMod.cc,v 1.3 2008/11/11 21:22:54 ceballos Exp $
|
2 |
loizides |
1.1 |
|
3 |
|
|
#include "MitPhysics/Mods/interface/ElectronIDMod.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::ElectronIDMod)
|
12 |
|
|
|
13 |
|
|
//--------------------------------------------------------------------------------------------------
|
14 |
|
|
ElectronIDMod::ElectronIDMod(const char *name, const char *title) :
|
15 |
|
|
BaseMod(name,title),
|
16 |
|
|
fPrintDebug(false),
|
17 |
|
|
fElectronName(Names::gkElectronBrn),
|
18 |
|
|
fGoodElectronsName(Names::gkGoodElectronsName),
|
19 |
|
|
fElectronIDType("Tight"),
|
20 |
ceballos |
1.4 |
fElectronIsoType("TrackCaloSliding"),
|
21 |
loizides |
1.1 |
fElectrons(0),
|
22 |
|
|
fElectronPtMin(10),
|
23 |
|
|
fIDLikelihoodCut(0.9),
|
24 |
|
|
fTrackIsolationCut(5.0),
|
25 |
|
|
fCaloIsolationCut(5.0),
|
26 |
|
|
fEcalJurassicIsolationCut(5.0),
|
27 |
|
|
fHcalJurassicIsolationCut(5.0),
|
28 |
|
|
fNEventsProcessed(0)
|
29 |
|
|
{
|
30 |
|
|
// Constructor.
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
//--------------------------------------------------------------------------------------------------
|
34 |
|
|
void ElectronIDMod::Begin()
|
35 |
|
|
{
|
36 |
|
|
// Run startup code on the client machine. For this module, we dont do
|
37 |
|
|
// anything here.
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
//--------------------------------------------------------------------------------------------------
|
41 |
|
|
void ElectronIDMod::Process()
|
42 |
|
|
{
|
43 |
|
|
// Process entries of the tree.
|
44 |
|
|
|
45 |
|
|
fNEventsProcessed++;
|
46 |
|
|
|
47 |
ceballos |
1.3 |
if (fNEventsProcessed % 1000000 == 0 || fPrintDebug) {
|
48 |
loizides |
1.1 |
time_t systime;
|
49 |
|
|
systime = time(NULL);
|
50 |
|
|
|
51 |
|
|
cerr << endl << "ElectronIDMod : Process Event " << fNEventsProcessed << " Time: " << ctime(&systime) << endl;
|
52 |
|
|
}
|
53 |
|
|
|
54 |
|
|
//Get Electrons
|
55 |
|
|
LoadBranch(fElectronName);
|
56 |
|
|
|
57 |
|
|
ObjArray<Electron> *GoodElectrons = new ObjArray<Electron>;
|
58 |
|
|
for (UInt_t i=0; i<fElectrons->GetEntries(); ++i) {
|
59 |
|
|
Electron *e = fElectrons->At(i);
|
60 |
|
|
|
61 |
|
|
bool allCuts = false;
|
62 |
|
|
|
63 |
|
|
//Decide which ID scheme to use
|
64 |
|
|
if(fElectronIDType.CompareTo("Tight") == 0)
|
65 |
|
|
allCuts = e->PassTightID();
|
66 |
|
|
else if (fElectronIDType.CompareTo("Loose") == 0)
|
67 |
|
|
allCuts = e->PassLooseID();
|
68 |
|
|
else if (fElectronIDType.CompareTo("IDLikelihood") == 0)
|
69 |
|
|
allCuts = (e->IDLikelihood() > fIDLikelihoodCut);
|
70 |
|
|
else if (fElectronIDType.CompareTo("CustomMitCuts") == 0)
|
71 |
|
|
allCuts = false; //we don't have these yet. will have to wait for Phil and Pieter
|
72 |
|
|
else {
|
73 |
|
|
cerr << "The specified electron ID type : " << fElectronIDType.Data()
|
74 |
|
|
<< " is invalid. Please specify a correct ID type. " << endl;
|
75 |
|
|
allCuts = false;
|
76 |
|
|
}
|
77 |
|
|
|
78 |
|
|
//isolation Cuts
|
79 |
|
|
bool passTrackIsolation = (e->TrackIsolation() < fTrackIsolationCut);
|
80 |
|
|
bool passCaloIsolation = (e->CaloIsolation() < fCaloIsolationCut);
|
81 |
|
|
bool passEcalJurassicIsolation = (e->EcalJurassicIsolation() < fEcalJurassicIsolationCut);
|
82 |
|
|
bool passHcalJurassicIsolation = (e->HcalJurassicIsolation() < fHcalJurassicIsolationCut);
|
83 |
|
|
//Decide which Isolation cut to use
|
84 |
ceballos |
1.4 |
if (fElectronIsoType.CompareTo("TrackCalo") == 0 ){
|
85 |
loizides |
1.1 |
allCuts = (allCuts && passTrackIsolation && passCaloIsolation);
|
86 |
ceballos |
1.4 |
|
87 |
|
|
} else if(fElectronIsoType.CompareTo( "TrackJurassic" ) == 0) {
|
88 |
loizides |
1.1 |
allCuts = (allCuts && passTrackIsolation &&
|
89 |
|
|
passEcalJurassicIsolation && passHcalJurassicIsolation);
|
90 |
ceballos |
1.4 |
|
91 |
|
|
} else if(fElectronIsoType.CompareTo( "TrackCaloSliding" ) == 0) {
|
92 |
|
|
double totalIso = e->TrackIsolation() + e->EcalJurassicIsolation() - 1.5;
|
93 |
|
|
bool theIso = false;
|
94 |
|
|
if((totalIso < (e->Pt()-10.0)*6.0/15.0) ||
|
95 |
|
|
(totalIso < 6.0 && e->Pt() > 25)) theIso = true;
|
96 |
|
|
allCuts = (allCuts && theIso);
|
97 |
|
|
|
98 |
|
|
} else if(fElectronIsoType.CompareTo("NoIso") == 0 ) {
|
99 |
loizides |
1.1 |
//Do Nothing here
|
100 |
ceballos |
1.4 |
|
101 |
loizides |
1.1 |
} else {
|
102 |
|
|
cerr << "The specified electron Isolation type : " << fElectronIDType.Data()
|
103 |
|
|
<< "is invalid. Please specify a correct isolation type. " << endl;
|
104 |
|
|
allCuts = false;
|
105 |
|
|
}
|
106 |
|
|
|
107 |
|
|
//Pt Cut
|
108 |
ceballos |
1.2 |
if(e->Pt() <= fElectronPtMin) allCuts = false;
|
109 |
loizides |
1.1 |
|
110 |
|
|
//These are Good Electrons
|
111 |
|
|
if ( allCuts ) {
|
112 |
|
|
GoodElectrons->Add(fElectrons->At(i));
|
113 |
|
|
}
|
114 |
|
|
}
|
115 |
|
|
|
116 |
|
|
//Final Summary Debug Output
|
117 |
|
|
if ( fPrintDebug ) {
|
118 |
|
|
cerr << "Event Dump: " << fNEventsProcessed << endl;
|
119 |
|
|
|
120 |
|
|
//print out event content to text
|
121 |
|
|
cerr << "Electrons" << endl;
|
122 |
|
|
for (UInt_t i = 0; i < GoodElectrons->GetEntries(); i++) {
|
123 |
|
|
cerr << i << " " << GoodElectrons->At(i)->Pt() << " " << GoodElectrons->At(i)->Eta()
|
124 |
|
|
<< " " << GoodElectrons->At(i)->Phi() << " "
|
125 |
|
|
<< GoodElectrons->At(i)->ESuperClusterOverP() << endl;
|
126 |
|
|
}
|
127 |
|
|
}
|
128 |
|
|
|
129 |
|
|
//Save Objects for Other Modules to use
|
130 |
|
|
AddObjThisEvt(GoodElectrons, fGoodElectronsName.Data());
|
131 |
|
|
}
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
//--------------------------------------------------------------------------------------------------
|
135 |
|
|
void ElectronIDMod::SlaveBegin()
|
136 |
|
|
{
|
137 |
|
|
// Run startup code on the computer (slave) doing the actual analysis. Here,
|
138 |
|
|
// we typically initialize histograms and other analysis objects and request
|
139 |
|
|
// branches. For this module, we request a branch of the MitTree.
|
140 |
|
|
|
141 |
|
|
ReqBranch(fElectronName, fElectrons);
|
142 |
|
|
}
|
143 |
|
|
|
144 |
|
|
//--------------------------------------------------------------------------------------------------
|
145 |
|
|
void ElectronIDMod::SlaveTerminate()
|
146 |
|
|
{
|
147 |
|
|
// Run finishing code on the computer (slave) that did the analysis. For this
|
148 |
|
|
// module, we dont do anything here.
|
149 |
|
|
|
150 |
|
|
}
|
151 |
|
|
|
152 |
|
|
//--------------------------------------------------------------------------------------------------
|
153 |
|
|
void ElectronIDMod::Terminate()
|
154 |
|
|
{
|
155 |
|
|
// Run finishing code on the client computer. For this module, we dont do
|
156 |
|
|
// anything here.
|
157 |
|
|
}
|