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