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