ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/PhysicsMod/src/SimpleExampleMod.cc
Revision: 1.5
Committed: Mon Jun 15 15:00:16 2009 UTC (15 years, 10 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_009c, Mit_009b
Changes since 1.4: +3 -2 lines
Log Message:
Added proper fwd defs plus split up complilation of MitAna/DataTree LinkDefs.

File Contents

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