ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/src/MuonIDMod.cc
Revision: 1.2
Committed: Mon Oct 6 15:52:12 2008 UTC (16 years, 7 months ago) by ceballos
Content type: text/plain
Branch: MAIN
Changes since 1.1: +3 -3 lines
Log Message:
Fixing bug in d0 cut

File Contents

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