ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/src/ParticleExample.cc
Revision: 1.7
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.6: +1 -1 lines
State: FILE REMOVED
Log Message:
Renamed to reflect class name.

File Contents

# Content
1 // $Id: ParticleExample.cc,v 1.6 2008/06/09 00:06:36 bendavid Exp $
2
3 #include "MitAna/TreeMod/interface/ParticleExampleMod.h"
4 #include <TH1D.h>
5 #include "MitAna/DataTree/interface/Names.h"
6
7 using namespace mithep;
8
9 ClassImp(mithep::ParticleExampleMod)
10
11 //__________________________________________________________________________________________________
12 ParticleExampleMod::ParticleExampleMod(const char *name, const char *title)
13 : TAModule(name,title),
14 fParticles(0),
15 fPartName(Names::gkGenPartBrn),
16 fPtHist(0),
17 fEtaHist(0)
18 {
19 // Constructor.
20 }
21
22 //__________________________________________________________________________________________________
23 void ParticleExampleMod::Begin()
24 {
25 // Run startup code on the client machine. For this module, we dont
26 // do anything here.
27 }
28
29 //__________________________________________________________________________________________________
30 void ParticleExampleMod::Process()
31 {
32 // Process entries of the tree. For this module, we just load
33 // the branch and fill the histograms.
34
35 LoadBranch(GetPartName());
36
37 Int_t ents=fParticles->GetEntries();
38 for(Int_t i=0;i<ents;++i) {
39 GenParticle* p = fParticles->At(i);
40 fPtHist->Fill(p->Pt());
41 fEtaHist->Fill(p->Eta());
42 }
43
44 }
45
46 //__________________________________________________________________________________________________
47 void ParticleExampleMod::SlaveBegin()
48 {
49 // Run startup code on the computer (slave) doing the actual
50 // analysis. Here, we typically initialize histograms and
51 // other analysis objects and request branches. For this module,
52 // we request a branch of the MitTree.
53
54 ReqBranch(GetPartName(), fParticles);
55
56 fPtHist = new TH1D("hPtHist",";p_{t};#",100,0.,25.);
57 AddOutput(fPtHist);
58 fEtaHist = new TH1D("hEtaHist",";#eta;#",160,-8.,8.);
59 AddOutput(fEtaHist);
60 }
61
62 //__________________________________________________________________________________________________
63 void ParticleExampleMod::SlaveTerminate()
64 {
65 // Run finishing code on the computer (slave) that did the
66 // analysis. For this module, we dont do anything here.
67 }
68
69 //__________________________________________________________________________________________________
70 void ParticleExampleMod::Terminate()
71 {
72 // Run finishing code on the client computer.
73 // For this module, we dont do anything here.
74 }