ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonIDMod.cc
Revision: 1.5
Committed: Wed Apr 15 17:53:14 2009 UTC (16 years ago) by ceballos
Content type: text/plain
Branch: MAIN
Changes since 1.4: +9 -6 lines
Log Message:
better photon id

File Contents

# User Rev Content
1 ceballos 1.5 // $Id: PhotonIDMod.cc,v 1.4 2008/12/10 11:44:33 loizides Exp $
2 sixie 1.1
3     #include "MitPhysics/Mods/interface/PhotonIDMod.h"
4     #include "MitPhysics/Init/interface/ModNames.h"
5    
6     using namespace mithep;
7    
8     ClassImp(mithep::PhotonIDMod)
9    
10     //--------------------------------------------------------------------------------------------------
11     PhotonIDMod::PhotonIDMod(const char *name, const char *title) :
12     BaseMod(name,title),
13     fPhotonBranchName(Names::gkPhotonBrn),
14     fGoodPhotonsName(ModNames::gkGoodPhotonsName),
15 ceballos 1.5 fPhotonIDType("Custom"),
16 ceballos 1.2 fPhotonIsoType("CombinedIso"),
17 sixie 1.1 fPhotonPtMin(15.0),
18 ceballos 1.5 fHadOverEmMax(0.03),
19 ceballos 1.2 fApplyPixelSeed(kTRUE),
20 ceballos 1.5 fPhotonR9Min(0.8),
21 sixie 1.1 fPhotons(0),
22     fPhIdType(kIdUndef),
23     fPhIsoType(kIsoUndef)
24     {
25     // Constructor.
26     }
27    
28     //--------------------------------------------------------------------------------------------------
29     void PhotonIDMod::Process()
30     {
31     // Process entries of the tree.
32    
33     LoadBranch(fPhotonBranchName);
34    
35     PhotonOArr *GoodPhotons = new PhotonOArr;
36     GoodPhotons->SetName(fGoodPhotonsName);
37    
38     for (UInt_t i=0; i<fPhotons->GetEntries(); ++i) {
39     const Photon *ph = fPhotons->At(i);
40    
41     if (ph->Pt() <= fPhotonPtMin)
42     continue;
43    
44 ceballos 1.2 if (ph->HadOverEm() >= fHadOverEmMax)
45     continue;
46    
47     if (fApplyPixelSeed == kTRUE &&
48     ph->HasPixelSeed() == kTRUE)
49     continue;
50    
51 sixie 1.1 Bool_t idcut = kFALSE;
52     switch (fPhIdType) {
53     case kTight:
54     idcut = ph->IsTightPhoton();
55     break;
56     case kLoose:
57     idcut = ph->IsLoosePhoton();
58     break;
59     case kLooseEM:
60     idcut = ph->IsLooseEM();
61     break;
62     case kCustomId:
63 ceballos 1.5 idcut = kTRUE;
64 sixie 1.1 default:
65     break;
66     }
67    
68     if (!idcut)
69     continue;
70    
71     Bool_t isocut = kFALSE;
72     switch (fPhIsoType) {
73     case kNoIso:
74     isocut = kTRUE;
75     break;
76 ceballos 1.2 case kCombinedIso:
77     isocut = ph->HollowConeTrkIso() +
78 ceballos 1.5 ph->HcalRecHitIso() < 5.0;
79 ceballos 1.2 break;
80 sixie 1.1 case kCustomIso:
81     default:
82     break;
83     }
84    
85     if (!isocut)
86     continue;
87    
88 ceballos 1.5 if (ph->R9() <= fPhotonR9Min)
89     continue;
90    
91 sixie 1.1 // add good electron
92     GoodPhotons->Add(fPhotons->At(i));
93     }
94    
95 loizides 1.4 // sort according to pt
96     GoodPhotons->Sort();
97    
98 sixie 1.1 // add to event for other modules to use
99     AddObjThisEvt(GoodPhotons);
100     }
101    
102     //--------------------------------------------------------------------------------------------------
103     void PhotonIDMod::SlaveBegin()
104     {
105     // Run startup code on the computer (slave) doing the actual analysis. Here,
106 loizides 1.3 // we just request the photon collection branch.
107 sixie 1.1
108     ReqBranch(fPhotonBranchName, fPhotons);
109    
110     if (fPhotonIDType.CompareTo("Tight") == 0)
111     fPhIdType = kTight;
112     else if (fPhotonIDType.CompareTo("Loose") == 0)
113     fPhIdType = kLoose;
114     else if (fPhotonIDType.CompareTo("LooseEM") == 0)
115     fPhIdType = kLooseEM;
116     else if (fPhotonIDType.CompareTo("Custom") == 0) {
117     fPhIdType = kCustomId;
118     } else {
119     SendError(kAbortAnalysis, "SlaveBegin",
120 ceballos 1.2 "The specified photon identification %s is not defined.",
121 sixie 1.1 fPhotonIDType.Data());
122     return;
123     }
124    
125     if (fPhotonIsoType.CompareTo("NoIso") == 0 )
126     fPhIsoType = kNoIso;
127 ceballos 1.2 else if (fPhotonIsoType.CompareTo("CombinedIso") == 0 )
128     fPhIsoType = kCombinedIso;
129 sixie 1.1 else if (fPhotonIsoType.CompareTo("Custom") == 0 ) {
130     fPhIsoType = kCustomIso;
131     SendError(kWarning, "SlaveBegin",
132 ceballos 1.2 "Custom photon isolation is not yet implemented.");
133 sixie 1.1 } else {
134     SendError(kAbortAnalysis, "SlaveBegin",
135 ceballos 1.2 "The specified photon isolation %s is not defined.",
136 sixie 1.1 fPhotonIsoType.Data());
137     return;
138     }
139     }