ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/src/ParticleExampleMod.cc
Revision: 1.7
Committed: Sun Sep 28 02:33:13 2008 UTC (16 years, 7 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 from ParticleExampleMod to SimpleExampleMod

File Contents

# User Rev Content
1 loizides 1.7 // $Id: ParticleExampleMod.cc,v 1.6 2008/07/25 11:34:46 bendavid 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 loizides 1.4 //--------------------------------------------------------------------------------------------------
12 loizides 1.2 ParticleExampleMod::ParticleExampleMod(const char *name, const char *title) :
13     BaseMod(name,title),
14 bendavid 1.6 fPartName(Names::gkMCPartBrn),
15 loizides 1.2 fParticles(0),
16     fPtHist(0),
17     fEtaHist(0)
18 loizides 1.1 {
19     // Constructor.
20     }
21    
22 loizides 1.4 //--------------------------------------------------------------------------------------------------
23 loizides 1.1 void ParticleExampleMod::Begin()
24     {
25     // Run startup code on the client machine. For this module, we dont
26     // do anything here.
27     }
28    
29 loizides 1.4 //--------------------------------------------------------------------------------------------------
30 loizides 1.3 void ParticleExampleMod::BeginRun()
31     {
32     // Run startup code on the client machine. For this module, we dont
33     // do anything here.
34     }
35    
36 loizides 1.4 //--------------------------------------------------------------------------------------------------
37 loizides 1.3 void ParticleExampleMod::EndRun()
38     {
39     // Run startup code on the client machine. For this module, we dont
40     // do anything here.
41     }
42    
43 loizides 1.4 //--------------------------------------------------------------------------------------------------
44 loizides 1.1 void ParticleExampleMod::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 bendavid 1.6 MCParticle* p = fParticles->At(i);
54 loizides 1.1 fPtHist->Fill(p->Pt());
55     fEtaHist->Fill(p->Eta());
56     }
57    
58     }
59    
60 loizides 1.4 //--------------------------------------------------------------------------------------------------
61 loizides 1.1 void ParticleExampleMod::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 loizides 1.4 //--------------------------------------------------------------------------------------------------
77 loizides 1.1 void ParticleExampleMod::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 loizides 1.4 //--------------------------------------------------------------------------------------------------
84 loizides 1.1 void ParticleExampleMod::Terminate()
85     {
86     // Run finishing code on the client computer.
87     // For this module, we dont do anything here.
88     }