1 |
// $Id: FullExampleMod.cc,v 1.3 2008/07/03 08:22:19 loizides Exp $
|
2 |
|
3 |
#include "MitAna/TreeMod/interface/FullExampleMod.h"
|
4 |
#include <TH1D.h>
|
5 |
#include "MitAna/DataTree/interface/Names.h"
|
6 |
|
7 |
using namespace mithep;
|
8 |
|
9 |
ClassImp(mithep::FullExampleMod)
|
10 |
|
11 |
//--------------------------------------------------------------------------------------------------
|
12 |
FullExampleMod::FullExampleMod(const char *name, const char *title) :
|
13 |
BaseMod(name,title),
|
14 |
fMCPartName(Names::gkMCPartBrn),
|
15 |
fTrackName(Names::gkTrackBrn),
|
16 |
fMuonName(Names::gkMuonBrn),
|
17 |
fElectronName(Names::gkElectronBrn),
|
18 |
fParticles(0),
|
19 |
fTracks(0),
|
20 |
fMuons(0),
|
21 |
fElectrons(0),
|
22 |
fMCPtHist(0),
|
23 |
fMCEtaHist(0),
|
24 |
fTrackPtHist(0),
|
25 |
fTrackEtaHist(0),
|
26 |
fMuonPtHist(0),
|
27 |
fMuonEtaHist(0),
|
28 |
fElectronPtHist(0),
|
29 |
fElectronEtaHist(0)
|
30 |
{
|
31 |
// Constructor.
|
32 |
}
|
33 |
|
34 |
//--------------------------------------------------------------------------------------------------
|
35 |
void FullExampleMod::Begin()
|
36 |
{
|
37 |
// Run startup code on the client machine. For this module, we dont do
|
38 |
// anything here.
|
39 |
}
|
40 |
|
41 |
//--------------------------------------------------------------------------------------------------
|
42 |
void FullExampleMod::Process()
|
43 |
{
|
44 |
// Process entries of the tree. For this module, we just load the branches and
|
45 |
// fill the histograms.
|
46 |
|
47 |
LoadBranch(fMCPartName);
|
48 |
for (UInt_t i=0; i<fParticles->GetEntries(); ++i) {
|
49 |
MCParticle* p = fParticles->At(i);
|
50 |
fMCPtHist->Fill(p->Pt());
|
51 |
fMCEtaHist->Fill(p->Eta());
|
52 |
}
|
53 |
|
54 |
LoadBranch(fTrackName);
|
55 |
for (UInt_t i=0; i<fTracks->GetEntries(); ++i) {
|
56 |
Track* p = fTracks->At(i);
|
57 |
fTrackPtHist->Fill(p->Pt());
|
58 |
}
|
59 |
|
60 |
LoadBranch(fMuonName);
|
61 |
for (UInt_t i=0; i<fMuons->GetEntries(); ++i) {
|
62 |
Muon *p = fMuons->At(i);
|
63 |
fMuonPtHist->Fill(p->Pt());
|
64 |
fMuonEtaHist->Fill(p->Eta());
|
65 |
}
|
66 |
|
67 |
LoadBranch(fElectronName);
|
68 |
for (UInt_t i=0; i<fElectrons->GetEntries(); ++i) {
|
69 |
Electron *p = fElectrons->At(i);
|
70 |
fElectronPtHist->Fill(p->Pt());
|
71 |
fElectronEtaHist->Fill(p->Eta());
|
72 |
}
|
73 |
|
74 |
}
|
75 |
|
76 |
//--------------------------------------------------------------------------------------------------
|
77 |
void FullExampleMod::SlaveBegin()
|
78 |
{
|
79 |
// Run startup code on the computer (slave) doing the actual analysis. Here,
|
80 |
// we typically initialize histograms and other analysis objects and request
|
81 |
// branches. For this module, we request a branch of the MitTree.
|
82 |
|
83 |
ReqBranch(fMCPartName, fParticles);
|
84 |
ReqBranch(fTrackName, fTracks);
|
85 |
ReqBranch(fMuonName, fMuons);
|
86 |
ReqBranch(fElectronName, fElectrons);
|
87 |
|
88 |
fMCPtHist = new TH1D("hMCPtHist",";p_{t};#",100,0.,25.);
|
89 |
AddOutput(fMCPtHist);
|
90 |
fMCEtaHist = new TH1D("hMCEtaHist",";#eta;#",160,-8.,8.);
|
91 |
AddOutput(fMCEtaHist);
|
92 |
fTrackPtHist = new TH1D("hTrackPtHist",";p_{t};#",100,0.,25.);
|
93 |
AddOutput(fTrackPtHist);
|
94 |
fTrackEtaHist = new TH1D("hTrakEtaHist",";#eta;#",160,-8.,8.);
|
95 |
AddOutput(fTrackEtaHist);
|
96 |
fMuonPtHist = new TH1D("hMuonPtHist",";p_{t};#",100,0.,25.);
|
97 |
AddOutput(fMuonPtHist);
|
98 |
fMuonEtaHist = new TH1D("hMuonEtaHist",";#eta;#",160,-8.,8.);
|
99 |
AddOutput(fMuonEtaHist);
|
100 |
fElectronPtHist = new TH1D("hElectronPtHist",";p_{t};#",100,0.,25.);
|
101 |
AddOutput(fElectronPtHist);
|
102 |
fElectronEtaHist = new TH1D("hElectronEtaHist",";#eta;#",160,-8.,8.);
|
103 |
AddOutput(fElectronEtaHist);
|
104 |
}
|
105 |
|
106 |
//--------------------------------------------------------------------------------------------------
|
107 |
void FullExampleMod::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 |
void FullExampleMod::Terminate()
|
115 |
{
|
116 |
// Run finishing code on the client computer. For this module, we dont do
|
117 |
// anything here.
|
118 |
}
|