1 |
ceballos |
1.3 |
// $Id: MuonIDMod.cc,v 1.2 2008/10/25 19:25: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 |
|
|
|
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 |
ceballos |
1.3 |
fMuonPtMin(10),
|
25 |
loizides |
1.1 |
fNEventsProcessed(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 |
ceballos |
1.3 |
bool allCuts = false;
|
66 |
|
|
|
67 |
|
|
if(MuonClass == 0) allCuts = true;
|
68 |
|
|
|
69 |
|
|
if(mu->IsoR03SumPt() >= fTrackIsolationCut) allCuts = false;
|
70 |
|
|
|
71 |
loizides |
1.1 |
if(mu->IsoR03EmEt() +
|
72 |
ceballos |
1.3 |
mu->IsoR03HadEt() >= fCaloIsolationCut) allCuts = false;
|
73 |
|
|
|
74 |
|
|
if(mu->Pt() <= fMuonPtMin) allCuts = false;
|
75 |
|
|
|
76 |
|
|
if(allCuts) {
|
77 |
loizides |
1.1 |
CleanMuons->Add(mu);
|
78 |
ceballos |
1.2 |
}
|
79 |
loizides |
1.1 |
}
|
80 |
|
|
|
81 |
|
|
//Final Summary Debug Output
|
82 |
|
|
if ( fPrintDebug ) {
|
83 |
|
|
cerr << "Event Dump: " << fNEventsProcessed << endl;
|
84 |
|
|
cerr << "Muons" << endl;
|
85 |
|
|
for (UInt_t i = 0; i < CleanMuons->GetEntries(); i++) {
|
86 |
|
|
cerr << i << " " << CleanMuons->At(i)->Pt() << " " << CleanMuons->At(i)->Eta()
|
87 |
|
|
<< " " << CleanMuons->At(i)->Phi() << endl;
|
88 |
|
|
}
|
89 |
|
|
}
|
90 |
|
|
|
91 |
|
|
//Save Objects for Other Modules to use
|
92 |
|
|
AddObjThisEvt(CleanMuons, fCleanMuonsName.Data());
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
//--------------------------------------------------------------------------------------------------
|
97 |
|
|
void MuonIDMod::SlaveBegin()
|
98 |
|
|
{
|
99 |
|
|
// Run startup code on the computer (slave) doing the actual analysis. Here,
|
100 |
|
|
// we typically initialize histograms and other analysis objects and request
|
101 |
|
|
// branches. For this module, we request a branch of the MitTree.
|
102 |
|
|
|
103 |
|
|
ReqBranch(fMuonName, fMuons);
|
104 |
|
|
}
|
105 |
|
|
|
106 |
|
|
//--------------------------------------------------------------------------------------------------
|
107 |
|
|
void MuonIDMod::SlaveTerminate()
|
108 |
|
|
{
|
109 |
|
|
// Run finishing code on the computer (slave) that did the analysis. For this
|
110 |
|
|
// module, we dont do anything here.
|
111 |
|
|
|
112 |
|
|
}
|
113 |
|
|
|
114 |
|
|
//--------------------------------------------------------------------------------------------------
|
115 |
|
|
void MuonIDMod::Terminate()
|
116 |
|
|
{
|
117 |
|
|
// Run finishing code on the client computer. For this module, we dont do
|
118 |
|
|
// anything here.
|
119 |
|
|
}
|