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

# User Rev Content
1 ceballos 1.14 // $Id: PhotonIDMod.cc,v 1.13 2010/05/14 12:11:17 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 ceballos 1.2 fPhotonIsoType("CombinedIso"),
18 sixie 1.1 fPhotonPtMin(15.0),
19 ceballos 1.10 fHadOverEmMax(0.05),
20 sixie 1.13 fApplySpikeRemoval(kTRUE),
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     fEtaWidthEB(0.013),
27     fEtaWidthEE(0.031),
28 ceballos 1.11 fAbsEtaMax(2.5),
29 loizides 1.7 fPhotons(0)
30 sixie 1.1 {
31     // Constructor.
32     }
33    
34     //--------------------------------------------------------------------------------------------------
35     void PhotonIDMod::Process()
36     {
37     // Process entries of the tree.
38    
39 loizides 1.6 LoadEventObject(fPhotonBranchName, fPhotons);
40 sixie 1.1
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 sixie 1.13
50    
51 sixie 1.1
52 sixie 1.13 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 ceballos 1.2 if (ph->HadOverEm() >= fHadOverEmMax)
70     continue;
71 ceballos 1.14
72 ceballos 1.2 if (fApplyPixelSeed == kTRUE &&
73     ph->HasPixelSeed() == kTRUE)
74     continue;
75 ceballos 1.14
76 sixie 1.1 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 ceballos 1.5 idcut = kTRUE;
89 sixie 1.1 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 ceballos 1.2 case kCombinedIso:
102 bendavid 1.12 {
103     Double_t totalIso = ph->HollowConeTrkIsoDr04()+
104     ph->EcalRecHitIsoDr04() +
105     ph->HcalTowerSumEtDr04();
106     if (totalIso/ph->Pt() < 0.25)
107     isocut = kTRUE;
108     }
109 ceballos 1.2 break;
110 sixie 1.1 case kCustomIso:
111     default:
112     break;
113     }
114    
115     if (!isocut)
116     continue;
117    
118 ceballos 1.5 if (ph->R9() <= fPhotonR9Min)
119     continue;
120    
121 ceballos 1.10 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 ceballos 1.11 if (ph->AbsEta() >= fAbsEtaMax)
130     continue;
131 ceballos 1.14
132 sixie 1.1 // add good electron
133     GoodPhotons->Add(fPhotons->At(i));
134     }
135    
136 loizides 1.4 // sort according to pt
137     GoodPhotons->Sort();
138    
139 sixie 1.1 // 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 loizides 1.3 // we just request the photon collection branch.
148 sixie 1.1
149 loizides 1.6 ReqEventObject(fPhotonBranchName, fPhotons, kTRUE);
150 sixie 1.1
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 ceballos 1.2 "The specified photon identification %s is not defined.",
162 sixie 1.1 fPhotonIDType.Data());
163     return;
164     }
165    
166     if (fPhotonIsoType.CompareTo("NoIso") == 0 )
167     fPhIsoType = kNoIso;
168 ceballos 1.2 else if (fPhotonIsoType.CompareTo("CombinedIso") == 0 )
169     fPhIsoType = kCombinedIso;
170 sixie 1.1 else if (fPhotonIsoType.CompareTo("Custom") == 0 ) {
171     fPhIsoType = kCustomIso;
172     SendError(kWarning, "SlaveBegin",
173 ceballos 1.2 "Custom photon isolation is not yet implemented.");
174 sixie 1.1 } else {
175     SendError(kAbortAnalysis, "SlaveBegin",
176 ceballos 1.2 "The specified photon isolation %s is not defined.",
177 sixie 1.1 fPhotonIsoType.Data());
178     return;
179     }
180     }