ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/MuonIDMod.cc
Revision: 1.1
Committed: Wed Oct 15 06:05:00 2008 UTC (16 years, 6 months ago) by loizides
Content type: text/plain
Branch: MAIN
Log Message:
Added MitPhysics.

File Contents

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