ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/PhysicsMod/src/SimpleExampleMod.cc
Revision: 1.4
Committed: Tue Dec 9 10:18:34 2008 UTC (16 years, 4 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_009a, Mit_009, Mit_008, Mit_008pre2, Mit_008pre1, Mit_006b, Mit_006a
Changes since 1.3: +3 -5 lines
Log Message:
Tweaks to get modules uptodate.

File Contents

# User Rev Content
1 loizides 1.4 // $Id: SimpleExampleMod.cc,v 1.3 2008/12/04 13:52:27 loizides Exp $
2 loizides 1.1
3     #include "MitAna/PhysicsMod/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 loizides 1.3 const MCParticle *p = fParticles->At(i);
54 loizides 1.1 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 loizides 1.4 AddTH1(fPtHist,"hPtHist",";p_{t};#",100,0.,25.);
71     AddTH1(fEtaHist,"hEtaHist",";#eta;#",160,-8.,8.);
72 loizides 1.1 }
73    
74     //--------------------------------------------------------------------------------------------------
75     void SimpleExampleMod::SlaveTerminate()
76     {
77     // Run finishing code on the computer (slave) that did the
78     // analysis. For this module, we dont do anything here.
79     }
80    
81     //--------------------------------------------------------------------------------------------------
82     void SimpleExampleMod::Terminate()
83     {
84     // Run finishing code on the client computer.
85     // For this module, we dont do anything here.
86     }