1 |
ceballos |
1.7 |
// $Id: ElectronIDMod.cc,v 1.6 2008/11/28 09:13:50 loizides Exp $
|
2 |
loizides |
1.1 |
|
3 |
|
|
#include "MitPhysics/Mods/interface/ElectronIDMod.h"
|
4 |
loizides |
1.5 |
#include "MitPhysics/Init/interface/ModNames.h"
|
5 |
loizides |
1.1 |
|
6 |
|
|
using namespace mithep;
|
7 |
|
|
|
8 |
|
|
ClassImp(mithep::ElectronIDMod)
|
9 |
|
|
|
10 |
|
|
//--------------------------------------------------------------------------------------------------
|
11 |
loizides |
1.5 |
ElectronIDMod::ElectronIDMod(const char *name, const char *title) :
|
12 |
loizides |
1.1 |
BaseMod(name,title),
|
13 |
loizides |
1.5 |
fElectronBranchName(Names::gkElectronBrn),
|
14 |
|
|
fGoodElectronsName(ModNames::gkGoodElectronsName),
|
15 |
loizides |
1.1 |
fElectronIDType("Tight"),
|
16 |
ceballos |
1.4 |
fElectronIsoType("TrackCaloSliding"),
|
17 |
loizides |
1.1 |
fElectronPtMin(10),
|
18 |
|
|
fIDLikelihoodCut(0.9),
|
19 |
|
|
fTrackIsolationCut(5.0),
|
20 |
|
|
fCaloIsolationCut(5.0),
|
21 |
loizides |
1.5 |
fEcalJuraIsoCut(5.0),
|
22 |
|
|
fHcalIsolationCut(5.0),
|
23 |
|
|
fElectrons(0),
|
24 |
|
|
fElIdType(kIdUndef),
|
25 |
|
|
fElIsoType(kIsoUndef)
|
26 |
loizides |
1.1 |
{
|
27 |
|
|
// Constructor.
|
28 |
|
|
}
|
29 |
|
|
|
30 |
|
|
//--------------------------------------------------------------------------------------------------
|
31 |
|
|
void ElectronIDMod::Process()
|
32 |
|
|
{
|
33 |
|
|
// Process entries of the tree.
|
34 |
|
|
|
35 |
loizides |
1.5 |
LoadBranch(fElectronBranchName);
|
36 |
loizides |
1.1 |
|
37 |
loizides |
1.6 |
ElectronOArr *GoodElectrons = new ElectronOArr;
|
38 |
|
|
GoodElectrons->SetName(fGoodElectronsName);
|
39 |
loizides |
1.1 |
|
40 |
loizides |
1.5 |
for (UInt_t i=0; i<fElectrons->GetEntries(); ++i) {
|
41 |
|
|
const Electron *e = fElectrons->At(i);
|
42 |
loizides |
1.1 |
|
43 |
loizides |
1.5 |
if (e->Pt() <= fElectronPtMin)
|
44 |
|
|
continue;
|
45 |
loizides |
1.1 |
|
46 |
loizides |
1.5 |
Bool_t idcut = kFALSE;
|
47 |
|
|
switch (fElIdType) {
|
48 |
|
|
case kTight:
|
49 |
|
|
idcut = e->PassTightID();
|
50 |
|
|
break;
|
51 |
|
|
case kLoose:
|
52 |
|
|
idcut = e->PassLooseID();
|
53 |
|
|
break;
|
54 |
|
|
case kLikelihood:
|
55 |
|
|
idcut = (e->IDLikelihood() > fIDLikelihoodCut);
|
56 |
|
|
break;
|
57 |
|
|
case kCustomId:
|
58 |
|
|
default:
|
59 |
|
|
break;
|
60 |
loizides |
1.1 |
}
|
61 |
|
|
|
62 |
loizides |
1.5 |
if (!idcut)
|
63 |
|
|
continue;
|
64 |
|
|
|
65 |
|
|
Bool_t isocut = kFALSE;
|
66 |
|
|
switch (fElIsoType) {
|
67 |
|
|
case kTrackCalo:
|
68 |
|
|
isocut = (e->TrackIsolation() < fTrackIsolationCut) &&
|
69 |
|
|
(e->CaloIsolation() < fCaloIsolationCut);
|
70 |
|
|
break;
|
71 |
|
|
case kTrackJura:
|
72 |
|
|
isocut = (e->TrackIsolation() < fTrackIsolationCut) &&
|
73 |
|
|
(e->EcalJurassicIsolation() < fEcalJuraIsoCut) &&
|
74 |
|
|
(e->HcalIsolation() < fHcalIsolationCut);
|
75 |
|
|
break;
|
76 |
|
|
case kTrackJuraSliding:
|
77 |
|
|
{
|
78 |
|
|
Double_t totalIso = e->TrackIsolation() + e->EcalJurassicIsolation() - 1.5;
|
79 |
ceballos |
1.7 |
if ((totalIso < (e->Pt()-10.0)*6.0/15.0 && e->Pt() <= 25) ||
|
80 |
|
|
(totalIso < 6.0 && e->Pt() > 25) ||
|
81 |
|
|
totalIso <= 0)
|
82 |
loizides |
1.5 |
isocut = kTRUE;
|
83 |
|
|
}
|
84 |
|
|
break;
|
85 |
|
|
case kNoIso:
|
86 |
|
|
isocut = kTRUE;
|
87 |
|
|
break;
|
88 |
|
|
case kCustomIso:
|
89 |
|
|
default:
|
90 |
|
|
break;
|
91 |
loizides |
1.1 |
}
|
92 |
|
|
|
93 |
loizides |
1.5 |
if (!isocut)
|
94 |
|
|
continue;
|
95 |
|
|
|
96 |
|
|
// add good electron
|
97 |
|
|
GoodElectrons->Add(fElectrons->At(i));
|
98 |
|
|
}
|
99 |
loizides |
1.1 |
|
100 |
loizides |
1.5 |
// add to event for other modules to use
|
101 |
loizides |
1.6 |
AddObjThisEvt(GoodElectrons);
|
102 |
loizides |
1.1 |
}
|
103 |
|
|
|
104 |
|
|
//--------------------------------------------------------------------------------------------------
|
105 |
|
|
void ElectronIDMod::SlaveBegin()
|
106 |
|
|
{
|
107 |
|
|
// Run startup code on the computer (slave) doing the actual analysis. Here,
|
108 |
loizides |
1.5 |
// we just request the electron collection branch.
|
109 |
loizides |
1.1 |
|
110 |
loizides |
1.5 |
ReqBranch(fElectronBranchName, fElectrons);
|
111 |
loizides |
1.1 |
|
112 |
loizides |
1.5 |
if (fElectronIDType.CompareTo("Tight") == 0)
|
113 |
|
|
fElIdType = kTight;
|
114 |
|
|
else if (fElectronIDType.CompareTo("Loose") == 0)
|
115 |
|
|
fElIdType = kLoose;
|
116 |
|
|
else if (fElectronIDType.CompareTo("Likelihood") == 0)
|
117 |
|
|
fElIdType = kLikelihood;
|
118 |
|
|
else if (fElectronIDType.CompareTo("Custom") == 0) {
|
119 |
|
|
fElIdType = kCustomId;
|
120 |
|
|
SendError(kWarning, "SlaveBegin",
|
121 |
|
|
"Custom electron identification is not yet implemented.");
|
122 |
|
|
} else {
|
123 |
|
|
SendError(kAbortAnalysis, "SlaveBegin",
|
124 |
|
|
"The specified electron identification %s is not defined.",
|
125 |
|
|
fElectronIDType.Data());
|
126 |
|
|
return;
|
127 |
|
|
}
|
128 |
|
|
|
129 |
|
|
if (fElectronIsoType.CompareTo("TrackCalo") == 0 )
|
130 |
|
|
fElIsoType = kTrackCalo;
|
131 |
|
|
else if (fElectronIsoType.CompareTo("TrackJura") == 0)
|
132 |
|
|
fElIsoType = kTrackJura;
|
133 |
|
|
else if(fElectronIsoType.CompareTo("TrackJuraSliding") == 0)
|
134 |
|
|
fElIsoType = kTrackJuraSliding;
|
135 |
|
|
else if (fElectronIsoType.CompareTo("NoIso") == 0 )
|
136 |
|
|
fElIsoType = kNoIso;
|
137 |
|
|
else if (fElectronIsoType.CompareTo("Custom") == 0 ) {
|
138 |
|
|
fElIsoType = kCustomIso;
|
139 |
|
|
SendError(kWarning, "SlaveBegin",
|
140 |
|
|
"Custom electron isolation is not yet implemented.");
|
141 |
|
|
} else {
|
142 |
|
|
SendError(kAbortAnalysis, "SlaveBegin",
|
143 |
|
|
"The specified electron isolation %s is not defined.",
|
144 |
|
|
fElectronIsoType.Data());
|
145 |
|
|
return;
|
146 |
|
|
}
|
147 |
loizides |
1.1 |
}
|