ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/src/MuonIDMod.cc
Revision: 1.4
Committed: Tue Oct 14 05:12:49 2008 UTC (16 years, 6 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
State: FILE REMOVED
Log Message:
Moved to MitPhysics/Mods

File Contents

# Content
1 // $Id: MuonIDMod.cc,v 1.3 2008/10/09 10:38:38 ceballos Exp $
2
3 #include "MitAna/TreeMod/interface/MuonIDMod.h"
4 #include "MitAna/DataTree/interface/Names.h"
5 #include "MitAna/DataCont/interface/ObjArray.h"
6 #include "MitAna/Utils/interface/IsolationTools.h"
7 #include "MitCommon/MathTools/interface/MathUtils.h"
8 #include "MitAna/Utils/interface/IsolationTools.h"
9
10
11 using namespace mithep;
12
13 ClassImp(mithep::MuonIDMod)
14
15 //--------------------------------------------------------------------------------------------------
16 MuonIDMod::MuonIDMod(const char *name, const char *title) :
17 BaseMod(name,title),
18 fPrintDebug(false),
19 fMuonName(Names::gkMuonBrn),
20 fCleanMuonsName(Names::gkCleanMuonsName),
21 fMuonIDType("Tight"),
22 fMuonIsoType("TrackCalo"),
23 fMuons(0),
24 fTrackIsolationCut(5.0),
25 fCaloIsolationCut(5.0),
26 fNEventsProcessed(0)
27 {
28 // Constructor.
29 }
30
31 //--------------------------------------------------------------------------------------------------
32 void MuonIDMod::Begin()
33 {
34 // Run startup code on the client machine. For this module, we dont do
35 // anything here.
36 }
37
38 //--------------------------------------------------------------------------------------------------
39 void MuonIDMod::Process()
40 {
41 // Process entries of the tree.
42
43 fNEventsProcessed++;
44
45 if (fNEventsProcessed % 1000 == 0 || fPrintDebug) {
46 time_t systime;
47 systime = time(NULL);
48
49 cerr << endl << "MuonIDMod : Process Event " << fNEventsProcessed << " Time: " << ctime(&systime) << endl;
50 }
51
52 //Get Muons
53 LoadBranch(fMuonName);
54 ObjArray<Muon> *CleanMuons = new ObjArray<Muon>;
55 for (UInt_t i=0; i<fMuons->GetEntries(); ++i) {
56 Muon *mu = fMuons->At(i);
57
58 Double_t MuonClass = -1;
59 if (mu->GlobalTrk())
60 MuonClass = 0;
61 else if (mu->StandaloneTrk())
62 MuonClass = 1;
63 else if (mu->TrackerTrk())
64 MuonClass = 2;
65
66 //These cuts are from the 1.6.X analysis. I'm waiting for Phil to finalize his Muon ID class
67 const int nCuts = 4;
68 double cutValue[nCuts] = {0.1, 3.0, 3.0, 1.5 };
69 bool passCut[nCuts] = {false, false, false, false};
70 double muonD0 = fabs(mu->BestTrk()->D0());
71 if(muonD0 < cutValue[0] && MuonClass == 0 )
72 passCut[0] = true;
73 if(mu->IsoR03SumPt() < cutValue[1]) passCut[1] = true;
74 if(mu->IsoR03EmEt() +
75 mu->IsoR03HadEt() < cutValue[2]) passCut[2] = true;
76 if(mu->Pt() > 10)
77 passCut[3] = true;
78
79 // Final decision
80 bool allCuts = true;
81 for(int c=0; c<nCuts; c++) {
82 allCuts = allCuts & passCut[c];
83 }
84
85 if ( allCuts
86 && abs(mu->Eta()) < 2.5
87 ) {
88 CleanMuons->Add(mu);
89 }
90
91
92 }
93
94 //Final Summary Debug Output
95 if ( fPrintDebug ) {
96 cerr << "Event Dump: " << fNEventsProcessed << endl;
97 cerr << "Muons" << endl;
98 for (UInt_t i = 0; i < CleanMuons->GetEntries(); i++) {
99 cerr << i << " " << CleanMuons->At(i)->Pt() << " " << CleanMuons->At(i)->Eta()
100 << " " << CleanMuons->At(i)->Phi() << endl;
101 }
102 }
103
104 //Save Objects for Other Modules to use
105 AddObjThisEvt(CleanMuons, fCleanMuonsName.Data());
106 }
107
108
109 //--------------------------------------------------------------------------------------------------
110 void MuonIDMod::SlaveBegin()
111 {
112 // Run startup code on the computer (slave) doing the actual analysis. Here,
113 // we typically initialize histograms and other analysis objects and request
114 // branches. For this module, we request a branch of the MitTree.
115
116 ReqBranch(fMuonName, fMuons);
117 }
118
119 //--------------------------------------------------------------------------------------------------
120 void MuonIDMod::SlaveTerminate()
121 {
122 // Run finishing code on the computer (slave) that did the analysis. For this
123 // module, we dont do anything here.
124
125 }
126
127 //--------------------------------------------------------------------------------------------------
128 void MuonIDMod::Terminate()
129 {
130 // Run finishing code on the client computer. For this module, we dont do
131 // anything here.
132 }