ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/MuonIDMod.cc
Revision: 1.2
Committed: Sat Oct 25 19:25:09 2008 UTC (16 years, 6 months ago) by ceballos
Content type: text/plain
Branch: MAIN
Changes since 1.1: +5 -7 lines
Log Message:
using iso and calo cut variables for real

File Contents

# User Rev Content
1 ceballos 1.2 // $Id: MuonIDMod.cc,v 1.1 2008/10/15 06:05:00 loizides Exp $
2 loizides 1.1
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 ceballos 1.2 fTrackIsolationCut(3.0),
23     fCaloIsolationCut(3.0),
24 loizides 1.1 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 ceballos 1.2 double cutValue[nCuts] = {0.2, fTrackIsolationCut, fCaloIsolationCut, 1.5 };
67 loizides 1.1 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 ceballos 1.2 }
88 loizides 1.1 }
89    
90     //Final Summary Debug Output
91     if ( fPrintDebug ) {
92     cerr << "Event Dump: " << fNEventsProcessed << endl;
93     cerr << "Muons" << endl;
94     for (UInt_t i = 0; i < CleanMuons->GetEntries(); i++) {
95     cerr << i << " " << CleanMuons->At(i)->Pt() << " " << CleanMuons->At(i)->Eta()
96     << " " << CleanMuons->At(i)->Phi() << endl;
97     }
98     }
99    
100     //Save Objects for Other Modules to use
101     AddObjThisEvt(CleanMuons, fCleanMuonsName.Data());
102     }
103    
104    
105     //--------------------------------------------------------------------------------------------------
106     void MuonIDMod::SlaveBegin()
107     {
108     // Run startup code on the computer (slave) doing the actual analysis. Here,
109     // we typically initialize histograms and other analysis objects and request
110     // branches. For this module, we request a branch of the MitTree.
111    
112     ReqBranch(fMuonName, fMuons);
113     }
114    
115     //--------------------------------------------------------------------------------------------------
116     void MuonIDMod::SlaveTerminate()
117     {
118     // Run finishing code on the computer (slave) that did the analysis. For this
119     // module, we dont do anything here.
120    
121     }
122    
123     //--------------------------------------------------------------------------------------------------
124     void MuonIDMod::Terminate()
125     {
126     // Run finishing code on the client computer. For this module, we dont do
127     // anything here.
128     }