1 |
bendavid |
1.12 |
// $Id: PhotonIDMod.cc,v 1.11 2009/12/06 14:59:28 ceballos Exp $
|
2 |
sixie |
1.1 |
|
3 |
|
|
#include "MitPhysics/Mods/interface/PhotonIDMod.h"
|
4 |
loizides |
1.7 |
#include "MitAna/DataTree/interface/PhotonCol.h"
|
5 |
sixie |
1.1 |
#include "MitPhysics/Init/interface/ModNames.h"
|
6 |
|
|
|
7 |
|
|
using namespace mithep;
|
8 |
|
|
|
9 |
|
|
ClassImp(mithep::PhotonIDMod)
|
10 |
|
|
|
11 |
|
|
//--------------------------------------------------------------------------------------------------
|
12 |
|
|
PhotonIDMod::PhotonIDMod(const char *name, const char *title) :
|
13 |
|
|
BaseMod(name,title),
|
14 |
|
|
fPhotonBranchName(Names::gkPhotonBrn),
|
15 |
|
|
fGoodPhotonsName(ModNames::gkGoodPhotonsName),
|
16 |
ceballos |
1.5 |
fPhotonIDType("Custom"),
|
17 |
ceballos |
1.2 |
fPhotonIsoType("CombinedIso"),
|
18 |
sixie |
1.1 |
fPhotonPtMin(15.0),
|
19 |
ceballos |
1.10 |
fHadOverEmMax(0.05),
|
20 |
ceballos |
1.2 |
fApplyPixelSeed(kTRUE),
|
21 |
ceballos |
1.10 |
fPhotonR9Min(0.5),
|
22 |
sixie |
1.1 |
fPhIdType(kIdUndef),
|
23 |
loizides |
1.7 |
fPhIsoType(kIsoUndef),
|
24 |
ceballos |
1.10 |
fFiduciality(kTRUE),
|
25 |
|
|
fEtaWidthEB(0.013),
|
26 |
|
|
fEtaWidthEE(0.031),
|
27 |
ceballos |
1.11 |
fAbsEtaMax(2.5),
|
28 |
loizides |
1.7 |
fPhotons(0)
|
29 |
sixie |
1.1 |
{
|
30 |
|
|
// Constructor.
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
//--------------------------------------------------------------------------------------------------
|
34 |
|
|
void PhotonIDMod::Process()
|
35 |
|
|
{
|
36 |
|
|
// Process entries of the tree.
|
37 |
|
|
|
38 |
loizides |
1.6 |
LoadEventObject(fPhotonBranchName, fPhotons);
|
39 |
sixie |
1.1 |
|
40 |
|
|
PhotonOArr *GoodPhotons = new PhotonOArr;
|
41 |
|
|
GoodPhotons->SetName(fGoodPhotonsName);
|
42 |
|
|
|
43 |
|
|
for (UInt_t i=0; i<fPhotons->GetEntries(); ++i) {
|
44 |
|
|
const Photon *ph = fPhotons->At(i);
|
45 |
|
|
|
46 |
|
|
if (ph->Pt() <= fPhotonPtMin)
|
47 |
|
|
continue;
|
48 |
|
|
|
49 |
ceballos |
1.2 |
if (ph->HadOverEm() >= fHadOverEmMax)
|
50 |
|
|
continue;
|
51 |
|
|
|
52 |
|
|
if (fApplyPixelSeed == kTRUE &&
|
53 |
|
|
ph->HasPixelSeed() == kTRUE)
|
54 |
|
|
continue;
|
55 |
|
|
|
56 |
sixie |
1.1 |
Bool_t idcut = kFALSE;
|
57 |
|
|
switch (fPhIdType) {
|
58 |
|
|
case kTight:
|
59 |
|
|
idcut = ph->IsTightPhoton();
|
60 |
|
|
break;
|
61 |
|
|
case kLoose:
|
62 |
|
|
idcut = ph->IsLoosePhoton();
|
63 |
|
|
break;
|
64 |
|
|
case kLooseEM:
|
65 |
|
|
idcut = ph->IsLooseEM();
|
66 |
|
|
break;
|
67 |
|
|
case kCustomId:
|
68 |
ceballos |
1.5 |
idcut = kTRUE;
|
69 |
sixie |
1.1 |
default:
|
70 |
|
|
break;
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
if (!idcut)
|
74 |
|
|
continue;
|
75 |
|
|
|
76 |
|
|
Bool_t isocut = kFALSE;
|
77 |
|
|
switch (fPhIsoType) {
|
78 |
|
|
case kNoIso:
|
79 |
|
|
isocut = kTRUE;
|
80 |
|
|
break;
|
81 |
ceballos |
1.2 |
case kCombinedIso:
|
82 |
bendavid |
1.12 |
{
|
83 |
|
|
Double_t totalIso = ph->HollowConeTrkIsoDr04()+
|
84 |
|
|
ph->EcalRecHitIsoDr04() +
|
85 |
|
|
ph->HcalTowerSumEtDr04();
|
86 |
|
|
if (totalIso/ph->Pt() < 0.25)
|
87 |
|
|
isocut = kTRUE;
|
88 |
|
|
}
|
89 |
ceballos |
1.2 |
break;
|
90 |
sixie |
1.1 |
case kCustomIso:
|
91 |
|
|
default:
|
92 |
|
|
break;
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
if (!isocut)
|
96 |
|
|
continue;
|
97 |
|
|
|
98 |
ceballos |
1.5 |
if (ph->R9() <= fPhotonR9Min)
|
99 |
|
|
continue;
|
100 |
|
|
|
101 |
ceballos |
1.10 |
if (fFiduciality == kTRUE &&
|
102 |
|
|
ph->IsEB() == kFALSE && ph->IsEE() == kFALSE)
|
103 |
|
|
continue;
|
104 |
|
|
|
105 |
|
|
if ((ph->IsEB() == kTRUE && ph->SCluster()->EtaWidth() >= fEtaWidthEB) ||
|
106 |
|
|
(ph->IsEE() == kTRUE && ph->SCluster()->EtaWidth() >= fEtaWidthEE))
|
107 |
|
|
continue;
|
108 |
|
|
|
109 |
ceballos |
1.11 |
if (ph->AbsEta() >= fAbsEtaMax)
|
110 |
|
|
continue;
|
111 |
|
|
|
112 |
sixie |
1.1 |
// add good electron
|
113 |
|
|
GoodPhotons->Add(fPhotons->At(i));
|
114 |
|
|
}
|
115 |
|
|
|
116 |
loizides |
1.4 |
// sort according to pt
|
117 |
|
|
GoodPhotons->Sort();
|
118 |
|
|
|
119 |
sixie |
1.1 |
// add to event for other modules to use
|
120 |
|
|
AddObjThisEvt(GoodPhotons);
|
121 |
|
|
}
|
122 |
|
|
|
123 |
|
|
//--------------------------------------------------------------------------------------------------
|
124 |
|
|
void PhotonIDMod::SlaveBegin()
|
125 |
|
|
{
|
126 |
|
|
// Run startup code on the computer (slave) doing the actual analysis. Here,
|
127 |
loizides |
1.3 |
// we just request the photon collection branch.
|
128 |
sixie |
1.1 |
|
129 |
loizides |
1.6 |
ReqEventObject(fPhotonBranchName, fPhotons, kTRUE);
|
130 |
sixie |
1.1 |
|
131 |
|
|
if (fPhotonIDType.CompareTo("Tight") == 0)
|
132 |
|
|
fPhIdType = kTight;
|
133 |
|
|
else if (fPhotonIDType.CompareTo("Loose") == 0)
|
134 |
|
|
fPhIdType = kLoose;
|
135 |
|
|
else if (fPhotonIDType.CompareTo("LooseEM") == 0)
|
136 |
|
|
fPhIdType = kLooseEM;
|
137 |
|
|
else if (fPhotonIDType.CompareTo("Custom") == 0) {
|
138 |
|
|
fPhIdType = kCustomId;
|
139 |
|
|
} else {
|
140 |
|
|
SendError(kAbortAnalysis, "SlaveBegin",
|
141 |
ceballos |
1.2 |
"The specified photon identification %s is not defined.",
|
142 |
sixie |
1.1 |
fPhotonIDType.Data());
|
143 |
|
|
return;
|
144 |
|
|
}
|
145 |
|
|
|
146 |
|
|
if (fPhotonIsoType.CompareTo("NoIso") == 0 )
|
147 |
|
|
fPhIsoType = kNoIso;
|
148 |
ceballos |
1.2 |
else if (fPhotonIsoType.CompareTo("CombinedIso") == 0 )
|
149 |
|
|
fPhIsoType = kCombinedIso;
|
150 |
sixie |
1.1 |
else if (fPhotonIsoType.CompareTo("Custom") == 0 ) {
|
151 |
|
|
fPhIsoType = kCustomIso;
|
152 |
|
|
SendError(kWarning, "SlaveBegin",
|
153 |
ceballos |
1.2 |
"Custom photon isolation is not yet implemented.");
|
154 |
sixie |
1.1 |
} else {
|
155 |
|
|
SendError(kAbortAnalysis, "SlaveBegin",
|
156 |
ceballos |
1.2 |
"The specified photon isolation %s is not defined.",
|
157 |
sixie |
1.1 |
fPhotonIsoType.Data());
|
158 |
|
|
return;
|
159 |
|
|
}
|
160 |
|
|
}
|