ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonIDMod.cc
Revision: 1.10
Committed: Mon Aug 24 14:46:26 2009 UTC (15 years, 8 months ago) by ceballos
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012, Mit_011a
Changes since 1.9: +15 -6 lines
Log Message:
improved id

File Contents

# User Rev Content
1 ceballos 1.10 // $Id: PhotonIDMod.cc,v 1.9 2009/08/21 15:51:53 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 loizides 1.7 fPhotons(0)
28 sixie 1.1 {
29     // Constructor.
30     }
31    
32     //--------------------------------------------------------------------------------------------------
33     void PhotonIDMod::Process()
34     {
35     // Process entries of the tree.
36    
37 loizides 1.6 LoadEventObject(fPhotonBranchName, fPhotons);
38 sixie 1.1
39     PhotonOArr *GoodPhotons = new PhotonOArr;
40     GoodPhotons->SetName(fGoodPhotonsName);
41    
42     for (UInt_t i=0; i<fPhotons->GetEntries(); ++i) {
43     const Photon *ph = fPhotons->At(i);
44    
45     if (ph->Pt() <= fPhotonPtMin)
46     continue;
47    
48 ceballos 1.2 if (ph->HadOverEm() >= fHadOverEmMax)
49     continue;
50    
51     if (fApplyPixelSeed == kTRUE &&
52     ph->HasPixelSeed() == kTRUE)
53     continue;
54    
55 sixie 1.1 Bool_t idcut = kFALSE;
56     switch (fPhIdType) {
57     case kTight:
58     idcut = ph->IsTightPhoton();
59     break;
60     case kLoose:
61     idcut = ph->IsLoosePhoton();
62     break;
63     case kLooseEM:
64     idcut = ph->IsLooseEM();
65     break;
66     case kCustomId:
67 ceballos 1.5 idcut = kTRUE;
68 sixie 1.1 default:
69     break;
70     }
71    
72     if (!idcut)
73     continue;
74    
75     Bool_t isocut = kFALSE;
76     switch (fPhIsoType) {
77     case kNoIso:
78     isocut = kTRUE;
79     break;
80 ceballos 1.2 case kCombinedIso:
81 ceballos 1.9 Double_t totalIso = ph->HollowConeTrkIsoDr04()+
82     ph->EcalRecHitIsoDr04() +
83     ph->HcalTowerSumEtDr04();
84 ceballos 1.10 if (totalIso/ph->Pt() < 0.25)
85 ceballos 1.9 isocut = kTRUE;
86 ceballos 1.2 break;
87 sixie 1.1 case kCustomIso:
88     default:
89     break;
90     }
91    
92     if (!isocut)
93     continue;
94    
95 ceballos 1.5 if (ph->R9() <= fPhotonR9Min)
96     continue;
97    
98 ceballos 1.10 if (fFiduciality == kTRUE &&
99     ph->IsEB() == kFALSE && ph->IsEE() == kFALSE)
100     continue;
101    
102     if ((ph->IsEB() == kTRUE && ph->SCluster()->EtaWidth() >= fEtaWidthEB) ||
103     (ph->IsEE() == kTRUE && ph->SCluster()->EtaWidth() >= fEtaWidthEE))
104     continue;
105    
106 sixie 1.1 // add good electron
107     GoodPhotons->Add(fPhotons->At(i));
108     }
109    
110 loizides 1.4 // sort according to pt
111     GoodPhotons->Sort();
112    
113 sixie 1.1 // add to event for other modules to use
114     AddObjThisEvt(GoodPhotons);
115     }
116    
117     //--------------------------------------------------------------------------------------------------
118     void PhotonIDMod::SlaveBegin()
119     {
120     // Run startup code on the computer (slave) doing the actual analysis. Here,
121 loizides 1.3 // we just request the photon collection branch.
122 sixie 1.1
123 loizides 1.6 ReqEventObject(fPhotonBranchName, fPhotons, kTRUE);
124 sixie 1.1
125     if (fPhotonIDType.CompareTo("Tight") == 0)
126     fPhIdType = kTight;
127     else if (fPhotonIDType.CompareTo("Loose") == 0)
128     fPhIdType = kLoose;
129     else if (fPhotonIDType.CompareTo("LooseEM") == 0)
130     fPhIdType = kLooseEM;
131     else if (fPhotonIDType.CompareTo("Custom") == 0) {
132     fPhIdType = kCustomId;
133     } else {
134     SendError(kAbortAnalysis, "SlaveBegin",
135 ceballos 1.2 "The specified photon identification %s is not defined.",
136 sixie 1.1 fPhotonIDType.Data());
137     return;
138     }
139    
140     if (fPhotonIsoType.CompareTo("NoIso") == 0 )
141     fPhIsoType = kNoIso;
142 ceballos 1.2 else if (fPhotonIsoType.CompareTo("CombinedIso") == 0 )
143     fPhIsoType = kCombinedIso;
144 sixie 1.1 else if (fPhotonIsoType.CompareTo("Custom") == 0 ) {
145     fPhIsoType = kCustomIso;
146     SendError(kWarning, "SlaveBegin",
147 ceballos 1.2 "Custom photon isolation is not yet implemented.");
148 sixie 1.1 } else {
149     SendError(kAbortAnalysis, "SlaveBegin",
150 ceballos 1.2 "The specified photon isolation %s is not defined.",
151 sixie 1.1 fPhotonIsoType.Data());
152     return;
153     }
154     }