ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonIDMod.cc
Revision: 1.1
Committed: Sat Nov 29 18:42:13 2008 UTC (16 years, 5 months ago) by sixie
Content type: text/plain
Branch: MAIN
Log Message:
Add Photon ID module

File Contents

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