ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonIDMod.cc
Revision: 1.4
Committed: Wed Dec 10 11:44:33 2008 UTC (16 years, 4 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_009, Mit_008, Mit_008pre2, Mit_008pre1, Mit_006b, Mit_006a
Changes since 1.3: +4 -1 lines
Log Message:
Added sort.

File Contents

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