ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/src/ParticleExampleMod.cc
Revision: 1.2
Committed: Thu Jun 12 10:22:29 2008 UTC (16 years, 11 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.1: +7 -7 lines
Log Message:
Cleanup

File Contents

# User Rev Content
1 loizides 1.2 // $Id: ParticleExampleMod.cc,v 1.1 2008/06/12 09:24:09 loizides Exp $
2 loizides 1.1
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 loizides 1.2 ParticleExampleMod::ParticleExampleMod(const char *name, const char *title) :
13     BaseMod(name,title),
14     fPartName(Names::gkGenPartBrn),
15     fParticles(0),
16     fPtHist(0),
17     fEtaHist(0)
18 loizides 1.1 {
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     }