ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/MuonIDMod.cc
Revision: 1.4
Committed: Tue Nov 11 21:22:54 2008 UTC (16 years, 5 months ago) by ceballos
Content type: text/plain
Branch: MAIN
Changes since 1.3: +40 -5 lines
Log Message:
adding some plots, fixing details

File Contents

# User Rev Content
1 ceballos 1.4 // $Id: MuonIDMod.cc,v 1.3 2008/11/05 14:06:09 ceballos 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 ceballos 1.4 #include "MitPhysics/Utils/interface/MuonTools.h"
9 loizides 1.1
10     using namespace mithep;
11    
12     ClassImp(mithep::MuonIDMod)
13    
14     //--------------------------------------------------------------------------------------------------
15     MuonIDMod::MuonIDMod(const char *name, const char *title) :
16     BaseMod(name,title),
17     fPrintDebug(false),
18     fMuonName(Names::gkMuonBrn),
19     fCleanMuonsName(Names::gkCleanMuonsName),
20     fMuonIDType("Tight"),
21     fMuonIsoType("TrackCalo"),
22     fMuons(0),
23 ceballos 1.2 fTrackIsolationCut(3.0),
24     fCaloIsolationCut(3.0),
25 ceballos 1.4 fCombIsolationCut(-1.0),
26     fTMOneStationLooseCut(false),
27     fTMOneStationTightCut (false),
28     fTM2DCompatibilityLooseCut(false),
29     fTM2DCompatibilityTightCut(false),
30 ceballos 1.3 fMuonPtMin(10),
31 loizides 1.1 fNEventsProcessed(0)
32     {
33     // Constructor.
34     }
35    
36     //--------------------------------------------------------------------------------------------------
37     void MuonIDMod::Begin()
38     {
39     // Run startup code on the client machine. For this module, we dont do
40     // anything here.
41     }
42    
43     //--------------------------------------------------------------------------------------------------
44     void MuonIDMod::Process()
45     {
46     // Process entries of the tree.
47    
48     fNEventsProcessed++;
49    
50 ceballos 1.4 if (fNEventsProcessed % 1000000 == 0 || fPrintDebug) {
51 loizides 1.1 time_t systime;
52     systime = time(NULL);
53    
54     cerr << endl << "MuonIDMod : Process Event " << fNEventsProcessed << " Time: " << ctime(&systime) << endl;
55     }
56    
57 ceballos 1.4 MuonTools myMuonTools;
58    
59 loizides 1.1 //Get Muons
60     LoadBranch(fMuonName);
61     ObjArray<Muon> *CleanMuons = new ObjArray<Muon>;
62     for (UInt_t i=0; i<fMuons->GetEntries(); ++i) {
63     Muon *mu = fMuons->At(i);
64    
65     Double_t MuonClass = -1;
66     if (mu->GlobalTrk())
67     MuonClass = 0;
68     else if (mu->StandaloneTrk())
69     MuonClass = 1;
70     else if (mu->TrackerTrk())
71     MuonClass = 2;
72    
73 ceballos 1.3 bool allCuts = false;
74    
75 ceballos 1.4 // We always want global muons
76 ceballos 1.3 if(MuonClass == 0) allCuts = true;
77    
78 ceballos 1.4 // Isolation requirements
79     if(fCombIsolationCut < 0.0){
80     if(mu->IsoR03SumPt() >= fTrackIsolationCut) allCuts = false;
81     if(mu->IsoR03EmEt() +
82     mu->IsoR03HadEt() >= fCaloIsolationCut) allCuts = false;
83     }
84     else {
85     if(1.0 * mu->IsoR03SumPt() +
86     1.0 * mu->IsoR03EmEt() +
87     1.0 * mu->IsoR03HadEt() >= fCombIsolationCut) allCuts = false;
88    
89     }
90 ceballos 1.3
91 ceballos 1.4 // Muon chambers and calo compatibility requirements
92     if(fTMOneStationLooseCut == true &&
93     myMuonTools.isGood(mu, MuonTools::TMOneStationLoose) == false)
94     allCuts = false;
95    
96     if(fTMOneStationTightCut == true &&
97     myMuonTools.isGood(mu, MuonTools::TMOneStationTight) == false)
98     allCuts = false;
99    
100     if(fTM2DCompatibilityLooseCut == true &&
101     myMuonTools.isGood(mu, MuonTools::TM2DCompatibilityLoose) == false)
102     allCuts = false;
103    
104     if(fTM2DCompatibilityTightCut == true &&
105     myMuonTools.isGood(mu, MuonTools::TM2DCompatibilityTight) == false)
106     allCuts = false;
107 ceballos 1.3
108 ceballos 1.4 // Min Pt requirement
109 ceballos 1.3 if(mu->Pt() <= fMuonPtMin) allCuts = false;
110    
111     if(allCuts) {
112 loizides 1.1 CleanMuons->Add(mu);
113 ceballos 1.2 }
114 loizides 1.1 }
115    
116     //Final Summary Debug Output
117     if ( fPrintDebug ) {
118     cerr << "Event Dump: " << fNEventsProcessed << endl;
119     cerr << "Muons" << endl;
120     for (UInt_t i = 0; i < CleanMuons->GetEntries(); i++) {
121     cerr << i << " " << CleanMuons->At(i)->Pt() << " " << CleanMuons->At(i)->Eta()
122     << " " << CleanMuons->At(i)->Phi() << endl;
123     }
124     }
125    
126     //Save Objects for Other Modules to use
127     AddObjThisEvt(CleanMuons, fCleanMuonsName.Data());
128     }
129    
130    
131     //--------------------------------------------------------------------------------------------------
132     void MuonIDMod::SlaveBegin()
133     {
134     // Run startup code on the computer (slave) doing the actual analysis. Here,
135     // we typically initialize histograms and other analysis objects and request
136     // branches. For this module, we request a branch of the MitTree.
137    
138     ReqBranch(fMuonName, fMuons);
139     }
140    
141     //--------------------------------------------------------------------------------------------------
142     void MuonIDMod::SlaveTerminate()
143     {
144     // Run finishing code on the computer (slave) that did the analysis. For this
145     // module, we dont do anything here.
146    
147     }
148    
149     //--------------------------------------------------------------------------------------------------
150     void MuonIDMod::Terminate()
151     {
152     // Run finishing code on the client computer. For this module, we dont do
153     // anything here.
154     }