ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonIDMod.cc
Revision: 1.9
Committed: Fri Aug 21 15:51:53 2009 UTC (15 years, 8 months ago) by ceballos
Content type: text/plain
Branch: MAIN
Changes since 1.8: +9 -4 lines
Log Message:
new photon id for 3x

File Contents

# User Rev Content
1 ceballos 1.9 // $Id: PhotonIDMod.cc,v 1.8 2009/07/21 16:35:12 bendavid 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.9 fPhotonR9Min(0.7),
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 ceballos 1.9 Double_t totalIso = ph->HollowConeTrkIsoDr04()+
79     ph->EcalRecHitIsoDr04() +
80     ph->HcalTowerSumEtDr04();
81     if ((totalIso < (ph->Pt()-0.0)*7.0/25.0 && ph->Pt() <= 25) ||
82     (totalIso < 7.0 && ph->Pt() > 25) ||
83     totalIso <= 0)
84     isocut = kTRUE;
85 ceballos 1.2 break;
86 sixie 1.1 case kCustomIso:
87     default:
88     break;
89     }
90    
91     if (!isocut)
92     continue;
93    
94 ceballos 1.5 if (ph->R9() <= fPhotonR9Min)
95     continue;
96    
97 sixie 1.1 // add good electron
98     GoodPhotons->Add(fPhotons->At(i));
99     }
100    
101 loizides 1.4 // sort according to pt
102     GoodPhotons->Sort();
103    
104 sixie 1.1 // add to event for other modules to use
105     AddObjThisEvt(GoodPhotons);
106     }
107    
108     //--------------------------------------------------------------------------------------------------
109     void PhotonIDMod::SlaveBegin()
110     {
111     // Run startup code on the computer (slave) doing the actual analysis. Here,
112 loizides 1.3 // we just request the photon collection branch.
113 sixie 1.1
114 loizides 1.6 ReqEventObject(fPhotonBranchName, fPhotons, kTRUE);
115 sixie 1.1
116     if (fPhotonIDType.CompareTo("Tight") == 0)
117     fPhIdType = kTight;
118     else if (fPhotonIDType.CompareTo("Loose") == 0)
119     fPhIdType = kLoose;
120     else if (fPhotonIDType.CompareTo("LooseEM") == 0)
121     fPhIdType = kLooseEM;
122     else if (fPhotonIDType.CompareTo("Custom") == 0) {
123     fPhIdType = kCustomId;
124     } else {
125     SendError(kAbortAnalysis, "SlaveBegin",
126 ceballos 1.2 "The specified photon identification %s is not defined.",
127 sixie 1.1 fPhotonIDType.Data());
128     return;
129     }
130    
131     if (fPhotonIsoType.CompareTo("NoIso") == 0 )
132     fPhIsoType = kNoIso;
133 ceballos 1.2 else if (fPhotonIsoType.CompareTo("CombinedIso") == 0 )
134     fPhIsoType = kCombinedIso;
135 sixie 1.1 else if (fPhotonIsoType.CompareTo("Custom") == 0 ) {
136     fPhIsoType = kCustomIso;
137     SendError(kWarning, "SlaveBegin",
138 ceballos 1.2 "Custom photon isolation is not yet implemented.");
139 sixie 1.1 } else {
140     SendError(kAbortAnalysis, "SlaveBegin",
141 ceballos 1.2 "The specified photon isolation %s is not defined.",
142 sixie 1.1 fPhotonIsoType.Data());
143     return;
144     }
145     }