ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonIDMod.cc
Revision: 1.16
Committed: Tue Feb 1 17:02:22 2011 UTC (14 years, 3 months ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_020a, Mit_020, Mit_020pre1
Changes since 1.15: +14 -11 lines
Log Message:
synchronize default photon cuts with baseline hgg analysis

File Contents

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