ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/src/SimpleExampleMod.cc
Revision: 1.1
Committed: Sun Sep 28 02:33:13 2008 UTC (16 years, 7 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_006, Mit_005, Mit_004
Log Message:
Renamed from ParticleExampleMod to SimpleExampleMod

File Contents

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