ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/PhysicsMod/src/FullExampleMod.cc
Revision: 1.3
Committed: Tue Dec 9 10:18:33 2008 UTC (16 years, 4 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_009a, Mit_009, Mit_008, Mit_008pre2, Mit_008pre1, Mit_006b, Mit_006a
Changes since 1.2: +9 -17 lines
Log Message:
Tweaks to get modules uptodate.

File Contents

# Content
1 // $Id: FullExampleMod.cc,v 1.2 2008/12/04 13:52:27 loizides Exp $
2
3 #include "MitAna/PhysicsMod/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 const 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 const Track *p = fTracks->At(i);
57 fTrackPtHist->Fill(p->Pt());
58 fTrackEtaHist->Fill(p->Eta());
59 }
60
61 LoadBranch(fMuonName);
62 for (UInt_t i=0; i<fMuons->GetEntries(); ++i) {
63 const Muon *p = fMuons->At(i);
64 fMuonPtHist->Fill(p->Pt());
65 fMuonEtaHist->Fill(p->Eta());
66 }
67
68 LoadBranch(fElectronName);
69 for (UInt_t i=0; i<fElectrons->GetEntries(); ++i) {
70 const Electron *p = fElectrons->At(i);
71 fElectronPtHist->Fill(p->Pt());
72 fElectronEtaHist->Fill(p->Eta());
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 AddTH1(fMCPtHist,"hMCPtHist",";p_{t};#",100,0.,250.);
89 AddTH1(fMCEtaHist,"hMCEtaHist",";#eta;#",160,-8.,8.);
90 AddTH1(fTrackPtHist,"hTrackPtHist",";p_{t};#",100,0.,250.);
91 AddTH1(fTrackEtaHist,"hTrackEtaHist",";#eta;#",160,-8.,8.);
92 AddTH1(fMuonPtHist,"hMuonPtHist",";p_{t};#",100,0.,250.);
93 AddTH1(fMuonEtaHist,"hMuonEtaHist",";#eta;#",160,-8.,8.);
94 AddTH1(fElectronPtHist,"hElectronPtHist",";p_{t};#",100,0.,250.);
95 AddTH1(fElectronEtaHist,"hElectronEtaHist",";#eta;#",160,-8.,8.);
96 }
97
98 //--------------------------------------------------------------------------------------------------
99 void FullExampleMod::SlaveTerminate()
100 {
101 // Run finishing code on the computer (slave) that did the analysis. For this
102 // module, we dont do anything here.
103 }
104
105 //--------------------------------------------------------------------------------------------------
106 void FullExampleMod::Terminate()
107 {
108 // Run finishing code on the client computer. For this module, we dont do
109 // anything here.
110 }