ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonIDMod.cc
Revision: 1.7
Committed: Mon Jun 15 15:00:21 2009 UTC (15 years, 10 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_009c, Mit_009b
Changes since 1.6: +4 -3 lines
Log Message:
Added proper fwd defs plus split up complilation of MitAna/DataTree LinkDefs.

File Contents

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