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

# User Rev Content
1 loizides 1.4 // $Id: PhotonIDMod.cc,v 1.3 2008/12/03 10:19:13 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     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 loizides 1.4 // sort according to pt
91     GoodPhotons->Sort();
92    
93 sixie 1.1 // 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 loizides 1.3 // we just request the photon collection branch.
102 sixie 1.1
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 ceballos 1.2 "Custom photon identification is not yet implemented.");
115 sixie 1.1 } else {
116     SendError(kAbortAnalysis, "SlaveBegin",
117 ceballos 1.2 "The specified photon identification %s is not defined.",
118 sixie 1.1 fPhotonIDType.Data());
119     return;
120     }
121    
122     if (fPhotonIsoType.CompareTo("NoIso") == 0 )
123     fPhIsoType = kNoIso;
124 ceballos 1.2 else if (fPhotonIsoType.CompareTo("CombinedIso") == 0 )
125     fPhIsoType = kCombinedIso;
126 sixie 1.1 else if (fPhotonIsoType.CompareTo("Custom") == 0 ) {
127     fPhIsoType = kCustomIso;
128     SendError(kWarning, "SlaveBegin",
129 ceballos 1.2 "Custom photon isolation is not yet implemented.");
130 sixie 1.1 } else {
131     SendError(kAbortAnalysis, "SlaveBegin",
132 ceballos 1.2 "The specified photon isolation %s is not defined.",
133 sixie 1.1 fPhotonIsoType.Data());
134     return;
135     }
136     }