ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonIDMod.cc
Revision: 1.11
Committed: Sun Dec 6 14:59:28 2009 UTC (15 years, 5 months ago) by ceballos
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_012i, Mit_012g, Mit_012f, Mit_012e
Changes since 1.10: +5 -1 lines
Log Message:
small updates

File Contents

# User Rev Content
1 ceballos 1.11 // $Id: PhotonIDMod.cc,v 1.10 2009/08/24 14:46:26 ceballos 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 ceballos 1.2 fApplyPixelSeed(kTRUE),
21 ceballos 1.10 fPhotonR9Min(0.5),
22 sixie 1.1 fPhIdType(kIdUndef),
23 loizides 1.7 fPhIsoType(kIsoUndef),
24 ceballos 1.10 fFiduciality(kTRUE),
25     fEtaWidthEB(0.013),
26     fEtaWidthEE(0.031),
27 ceballos 1.11 fAbsEtaMax(2.5),
28 loizides 1.7 fPhotons(0)
29 sixie 1.1 {
30     // Constructor.
31     }
32    
33     //--------------------------------------------------------------------------------------------------
34     void PhotonIDMod::Process()
35     {
36     // Process entries of the tree.
37    
38 loizides 1.6 LoadEventObject(fPhotonBranchName, fPhotons);
39 sixie 1.1
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 ceballos 1.2 if (ph->HadOverEm() >= fHadOverEmMax)
50     continue;
51    
52     if (fApplyPixelSeed == kTRUE &&
53     ph->HasPixelSeed() == kTRUE)
54     continue;
55    
56 sixie 1.1 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 ceballos 1.5 idcut = kTRUE;
69 sixie 1.1 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 ceballos 1.2 case kCombinedIso:
82 ceballos 1.9 Double_t totalIso = ph->HollowConeTrkIsoDr04()+
83     ph->EcalRecHitIsoDr04() +
84     ph->HcalTowerSumEtDr04();
85 ceballos 1.10 if (totalIso/ph->Pt() < 0.25)
86 ceballos 1.9 isocut = kTRUE;
87 ceballos 1.2 break;
88 sixie 1.1 case kCustomIso:
89     default:
90     break;
91     }
92    
93     if (!isocut)
94     continue;
95    
96 ceballos 1.5 if (ph->R9() <= fPhotonR9Min)
97     continue;
98    
99 ceballos 1.10 if (fFiduciality == kTRUE &&
100     ph->IsEB() == kFALSE && ph->IsEE() == kFALSE)
101     continue;
102    
103     if ((ph->IsEB() == kTRUE && ph->SCluster()->EtaWidth() >= fEtaWidthEB) ||
104     (ph->IsEE() == kTRUE && ph->SCluster()->EtaWidth() >= fEtaWidthEE))
105     continue;
106    
107 ceballos 1.11 if (ph->AbsEta() >= fAbsEtaMax)
108     continue;
109    
110 sixie 1.1 // add good electron
111     GoodPhotons->Add(fPhotons->At(i));
112     }
113    
114 loizides 1.4 // sort according to pt
115     GoodPhotons->Sort();
116    
117 sixie 1.1 // add to event for other modules to use
118     AddObjThisEvt(GoodPhotons);
119     }
120    
121     //--------------------------------------------------------------------------------------------------
122     void PhotonIDMod::SlaveBegin()
123     {
124     // Run startup code on the computer (slave) doing the actual analysis. Here,
125 loizides 1.3 // we just request the photon collection branch.
126 sixie 1.1
127 loizides 1.6 ReqEventObject(fPhotonBranchName, fPhotons, kTRUE);
128 sixie 1.1
129     if (fPhotonIDType.CompareTo("Tight") == 0)
130     fPhIdType = kTight;
131     else if (fPhotonIDType.CompareTo("Loose") == 0)
132     fPhIdType = kLoose;
133     else if (fPhotonIDType.CompareTo("LooseEM") == 0)
134     fPhIdType = kLooseEM;
135     else if (fPhotonIDType.CompareTo("Custom") == 0) {
136     fPhIdType = kCustomId;
137     } else {
138     SendError(kAbortAnalysis, "SlaveBegin",
139 ceballos 1.2 "The specified photon identification %s is not defined.",
140 sixie 1.1 fPhotonIDType.Data());
141     return;
142     }
143    
144     if (fPhotonIsoType.CompareTo("NoIso") == 0 )
145     fPhIsoType = kNoIso;
146 ceballos 1.2 else if (fPhotonIsoType.CompareTo("CombinedIso") == 0 )
147     fPhIsoType = kCombinedIso;
148 sixie 1.1 else if (fPhotonIsoType.CompareTo("Custom") == 0 ) {
149     fPhIsoType = kCustomIso;
150     SendError(kWarning, "SlaveBegin",
151 ceballos 1.2 "Custom photon isolation is not yet implemented.");
152 sixie 1.1 } else {
153     SendError(kAbortAnalysis, "SlaveBegin",
154 ceballos 1.2 "The specified photon isolation %s is not defined.",
155 sixie 1.1 fPhotonIsoType.Data());
156     return;
157     }
158     }