ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonIDMod.cc
Revision: 1.14
Committed: Fri May 21 05:59:55 2010 UTC (14 years, 11 months ago) by ceballos
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_014c, Mit_014b, Mit_014a, Mit_014, Mit_014pre3
Changes since 1.13: +4 -4 lines
Log Message:
small update on the requirements

File Contents

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