ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonIDMod.cc
Revision: 1.12
Committed: Sun Jan 24 21:00:19 2010 UTC (15 years, 3 months ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1
Changes since 1.11: +8 -6 lines
Log Message:
Fix compiler errors and warnings moving to slc5_ia32_gcc434

File Contents

# Content
1 // $Id: PhotonIDMod.cc,v 1.11 2009/12/06 14:59:28 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 fAbsEtaMax(2.5),
28 fPhotons(0)
29 {
30 // Constructor.
31 }
32
33 //--------------------------------------------------------------------------------------------------
34 void PhotonIDMod::Process()
35 {
36 // Process entries of the tree.
37
38 LoadEventObject(fPhotonBranchName, fPhotons);
39
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 if (ph->HadOverEm() >= fHadOverEmMax)
50 continue;
51
52 if (fApplyPixelSeed == kTRUE &&
53 ph->HasPixelSeed() == kTRUE)
54 continue;
55
56 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 idcut = kTRUE;
69 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 case kCombinedIso:
82 {
83 Double_t totalIso = ph->HollowConeTrkIsoDr04()+
84 ph->EcalRecHitIsoDr04() +
85 ph->HcalTowerSumEtDr04();
86 if (totalIso/ph->Pt() < 0.25)
87 isocut = kTRUE;
88 }
89 break;
90 case kCustomIso:
91 default:
92 break;
93 }
94
95 if (!isocut)
96 continue;
97
98 if (ph->R9() <= fPhotonR9Min)
99 continue;
100
101 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 if (ph->AbsEta() >= fAbsEtaMax)
110 continue;
111
112 // add good electron
113 GoodPhotons->Add(fPhotons->At(i));
114 }
115
116 // sort according to pt
117 GoodPhotons->Sort();
118
119 // 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 // we just request the photon collection branch.
128
129 ReqEventObject(fPhotonBranchName, fPhotons, kTRUE);
130
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 "The specified photon identification %s is not defined.",
142 fPhotonIDType.Data());
143 return;
144 }
145
146 if (fPhotonIsoType.CompareTo("NoIso") == 0 )
147 fPhIsoType = kNoIso;
148 else if (fPhotonIsoType.CompareTo("CombinedIso") == 0 )
149 fPhIsoType = kCombinedIso;
150 else if (fPhotonIsoType.CompareTo("Custom") == 0 ) {
151 fPhIsoType = kCustomIso;
152 SendError(kWarning, "SlaveBegin",
153 "Custom photon isolation is not yet implemented.");
154 } else {
155 SendError(kAbortAnalysis, "SlaveBegin",
156 "The specified photon isolation %s is not defined.",
157 fPhotonIsoType.Data());
158 return;
159 }
160 }