ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/src/FullExample.cc
Revision: 1.4
Committed: Thu Jun 12 09:24:09 2008 UTC (16 years, 11 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
State: FILE REMOVED
Log Message:
Renamed to reflect class name.

File Contents

# Content
1 // $Id: FullExample.cc,v 1.3 2008/06/11 23:37:20 paus 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 : TAModule(name,title),
14 fParticles(0),
15 fTracks(0),
16 fMuons(0),
17 fElectrons(0),
18 fGenPartName(Names::gkGenPartBrn),
19 fTrackName(Names::gkTrackBrn),
20 fMuonName(Names::gkMuonBrn),
21 fElectronName(Names::gkElectronBrn),
22 fGenPtHist(0),
23 fGenEtaHist(0),
24 fTrackPtHist(0),
25 fMuonPtHist(0),
26 fMuonEtaHist(0),
27 fMuonTrackPtHist(0),
28 fMuonTrackPtErrHist(0),
29 fElectronPtHist(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 branch and
45 // fill the histograms.
46
47 LoadBranch(fGenPartName);
48 for (UInt_t i=0; i<fParticles->GetEntries(); ++i) {
49 GenParticle* p = fParticles->At(i);
50 fGenPtHist->Fill(p->Pt());
51 fGenEtaHist->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 fMuonTrackPtHist->Fill(p->GetTrack()->Pt());
66 fMuonTrackPtErrHist->Fill(p->GetTrack()->PtErr());
67 }
68
69
70 LoadBranch(fElectronName);
71 for (UInt_t i=0; i<fElectrons->GetEntries(); ++i) {
72 Electron *p = fElectrons->At(i);
73 fElectronPtHist->Fill(p->Pt());
74 }
75
76 }
77
78 //__________________________________________________________________________________________________
79 void FullExampleMod::SlaveBegin()
80 {
81 // Run startup code on the computer (slave) doing the actual analysis. Here,
82 // we typically initialize histograms and other analysis objects and request
83 // branches. For this module, we request a branch of the MitTree.
84
85 ReqBranch(fGenPartName, fParticles);
86 ReqBranch(fTrackName, fTracks);
87 ReqBranch(fMuonName, fMuons);
88 ReqBranch(fElectronName, fElectrons);
89
90 fGenPtHist = new TH1D("hGenPtHist",";p_{t};#",100,0.,25.);
91 AddOutput(fGenPtHist);
92 fGenEtaHist = new TH1D("hGenEtaHist",";#eta;#",160,-8.,8.);
93 AddOutput(fGenEtaHist);
94
95 fTrackPtHist = new TH1D("hTrackPtHist",";p_{t};#",100,0.,25.);
96 AddOutput(fTrackPtHist);
97
98 fMuonPtHist = new TH1D("hMuonPtHist",";p_{t};#",100,0.,25.);
99 AddOutput(fMuonPtHist);
100 fMuonEtaHist = new TH1D("hMuonEtaHist",";#eta;#",160,-8.,8.);
101 AddOutput(fMuonEtaHist);
102
103 fMuonTrackPtHist = new TH1D("hMuonTrackPtHist",";p_{t};#",100,0.,25.);
104 AddOutput(fMuonTrackPtHist);
105 fMuonTrackPtErrHist = new TH1D("hMuonTrackPtErrHist",";p_{t};#",100,0.,25.);
106 AddOutput(fMuonTrackPtErrHist);
107
108 fElectronPtHist = new TH1D("hElectronPtHist",";p_{t};#",100,0.,25.);
109 AddOutput(fElectronPtHist);
110 }
111
112 //__________________________________________________________________________________________________
113 void FullExampleMod::SlaveTerminate()
114 {
115 // Run finishing code on the computer (slave) that did the analysis. For this
116 // module, we dont do anything here.
117 }
118
119 //__________________________________________________________________________________________________
120 void FullExampleMod::Terminate()
121 {
122 // Run finishing code on the client computer. For this module, we dont do
123 // anything here.
124 }