ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonIDMod.cc
Revision: 1.2
Committed: Wed Dec 3 09:52:56 2008 UTC (16 years, 5 months ago) by ceballos
Content type: text/plain
Branch: MAIN
Changes since 1.1: +21 -6 lines
Log Message:
new Photon Id selection, decent selection by default at this point

File Contents

# User Rev Content
1 ceballos 1.2 // $Id: PhotonIDMod.cc,v 1.1 2008/11/29 18:42:13 sixie 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     fPhotonIDType("Tight"),
16 ceballos 1.2 fPhotonIsoType("CombinedIso"),
17 sixie 1.1 fPhotonPtMin(15.0),
18 ceballos 1.2 fHadOverEmMax(0.05),
19     fApplyPixelSeed(kTRUE),
20 sixie 1.1 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 ceballos 1.2 if (ph->HadOverEm() >= fHadOverEmMax)
44     continue;
45    
46     if (fApplyPixelSeed == kTRUE &&
47     ph->HasPixelSeed() == kTRUE)
48     continue;
49    
50 sixie 1.1 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 ceballos 1.2 case kCombinedIso:
75     isocut = ph->HollowConeTrkIso() +
76     ph->HcalRecHitIso() < 7.0;
77     break;
78 sixie 1.1 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     // add to event for other modules to use
91     AddObjThisEvt(GoodPhotons);
92     }
93    
94     //--------------------------------------------------------------------------------------------------
95     void PhotonIDMod::SlaveBegin()
96     {
97     // Run startup code on the computer (slave) doing the actual analysis. Here,
98     // we just request the electron collection branch.
99    
100     ReqBranch(fPhotonBranchName, fPhotons);
101    
102     if (fPhotonIDType.CompareTo("Tight") == 0)
103     fPhIdType = kTight;
104     else if (fPhotonIDType.CompareTo("Loose") == 0)
105     fPhIdType = kLoose;
106     else if (fPhotonIDType.CompareTo("LooseEM") == 0)
107     fPhIdType = kLooseEM;
108     else if (fPhotonIDType.CompareTo("Custom") == 0) {
109     fPhIdType = kCustomId;
110     SendError(kWarning, "SlaveBegin",
111 ceballos 1.2 "Custom photon identification is not yet implemented.");
112 sixie 1.1 } else {
113     SendError(kAbortAnalysis, "SlaveBegin",
114 ceballos 1.2 "The specified photon identification %s is not defined.",
115 sixie 1.1 fPhotonIDType.Data());
116     return;
117     }
118    
119     if (fPhotonIsoType.CompareTo("NoIso") == 0 )
120     fPhIsoType = kNoIso;
121 ceballos 1.2 else if (fPhotonIsoType.CompareTo("CombinedIso") == 0 )
122     fPhIsoType = kCombinedIso;
123 sixie 1.1 else if (fPhotonIsoType.CompareTo("Custom") == 0 ) {
124     fPhIsoType = kCustomIso;
125     SendError(kWarning, "SlaveBegin",
126 ceballos 1.2 "Custom photon isolation is not yet implemented.");
127 sixie 1.1 } else {
128     SendError(kAbortAnalysis, "SlaveBegin",
129 ceballos 1.2 "The specified photon isolation %s is not defined.",
130 sixie 1.1 fPhotonIsoType.Data());
131     return;
132     }
133     }