ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/src/FullExampleMod.cc
Revision: 1.3
Committed: Thu Jul 3 08:22:19 2008 UTC (16 years, 10 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.2: +7 -7 lines
Log Message:
Coding conventions.

File Contents

# User Rev Content
1 loizides 1.3 // $Id: FullExampleMod.cc,v 1.2 2008/06/12 10:22:29 loizides Exp $
2 loizides 1.1
3     #include "MitAna/TreeMod/interface/FullExampleMod.h"
4     #include <TH1D.h>
5     #include "MitAna/DataTree/interface/Names.h"
6    
7     using namespace mithep;
8    
9     ClassImp(mithep::FullExampleMod)
10    
11 loizides 1.3 //--------------------------------------------------------------------------------------------------
12 loizides 1.2 FullExampleMod::FullExampleMod(const char *name, const char *title) :
13     BaseMod(name,title),
14     fGenPartName(Names::gkGenPartBrn),
15     fTrackName(Names::gkTrackBrn),
16     fMuonName(Names::gkMuonBrn),
17     fElectronName(Names::gkElectronBrn),
18     fParticles(0),
19     fTracks(0),
20     fMuons(0),
21     fElectrons(0),
22     fGenPtHist(0),
23     fGenEtaHist(0),
24     fTrackPtHist(0),
25     fTrackEtaHist(0),
26     fMuonPtHist(0),
27     fMuonEtaHist(0),
28     fElectronPtHist(0),
29     fElectronEtaHist(0)
30 loizides 1.1 {
31     // Constructor.
32     }
33    
34 loizides 1.3 //--------------------------------------------------------------------------------------------------
35 loizides 1.1 void FullExampleMod::Begin()
36     {
37     // Run startup code on the client machine. For this module, we dont do
38     // anything here.
39     }
40    
41 loizides 1.3 //--------------------------------------------------------------------------------------------------
42 loizides 1.1 void FullExampleMod::Process()
43     {
44 loizides 1.2 // Process entries of the tree. For this module, we just load the branches and
45 loizides 1.1 // fill the histograms.
46    
47     LoadBranch(fGenPartName);
48     for (UInt_t i=0; i<fParticles->GetEntries(); ++i) {
49     GenParticle* p = fParticles->At(i);
50     fGenPtHist->Fill(p->Pt());
51     fGenEtaHist->Fill(p->Eta());
52     }
53    
54     LoadBranch(fTrackName);
55     for (UInt_t i=0; i<fTracks->GetEntries(); ++i) {
56     Track* p = fTracks->At(i);
57     fTrackPtHist->Fill(p->Pt());
58     }
59    
60     LoadBranch(fMuonName);
61     for (UInt_t i=0; i<fMuons->GetEntries(); ++i) {
62     Muon *p = fMuons->At(i);
63     fMuonPtHist->Fill(p->Pt());
64     fMuonEtaHist->Fill(p->Eta());
65     }
66    
67     LoadBranch(fElectronName);
68     for (UInt_t i=0; i<fElectrons->GetEntries(); ++i) {
69     Electron *p = fElectrons->At(i);
70     fElectronPtHist->Fill(p->Pt());
71 loizides 1.2 fElectronEtaHist->Fill(p->Eta());
72 loizides 1.1 }
73    
74     }
75    
76 loizides 1.3 //--------------------------------------------------------------------------------------------------
77 loizides 1.1 void FullExampleMod::SlaveBegin()
78     {
79     // Run startup code on the computer (slave) doing the actual analysis. Here,
80     // we typically initialize histograms and other analysis objects and request
81     // branches. For this module, we request a branch of the MitTree.
82    
83     ReqBranch(fGenPartName, fParticles);
84     ReqBranch(fTrackName, fTracks);
85     ReqBranch(fMuonName, fMuons);
86     ReqBranch(fElectronName, fElectrons);
87    
88     fGenPtHist = new TH1D("hGenPtHist",";p_{t};#",100,0.,25.);
89     AddOutput(fGenPtHist);
90     fGenEtaHist = new TH1D("hGenEtaHist",";#eta;#",160,-8.,8.);
91     AddOutput(fGenEtaHist);
92     fTrackPtHist = new TH1D("hTrackPtHist",";p_{t};#",100,0.,25.);
93     AddOutput(fTrackPtHist);
94 loizides 1.2 fTrackEtaHist = new TH1D("hTrakEtaHist",";#eta;#",160,-8.,8.);
95     AddOutput(fTrackEtaHist);
96 loizides 1.1 fMuonPtHist = new TH1D("hMuonPtHist",";p_{t};#",100,0.,25.);
97     AddOutput(fMuonPtHist);
98     fMuonEtaHist = new TH1D("hMuonEtaHist",";#eta;#",160,-8.,8.);
99     AddOutput(fMuonEtaHist);
100     fElectronPtHist = new TH1D("hElectronPtHist",";p_{t};#",100,0.,25.);
101     AddOutput(fElectronPtHist);
102 loizides 1.2 fElectronEtaHist = new TH1D("hElectronEtaHist",";#eta;#",160,-8.,8.);
103     AddOutput(fElectronEtaHist);
104 loizides 1.1 }
105    
106 loizides 1.3 //--------------------------------------------------------------------------------------------------
107 loizides 1.1 void FullExampleMod::SlaveTerminate()
108     {
109     // Run finishing code on the computer (slave) that did the analysis. For this
110     // module, we dont do anything here.
111     }
112    
113 loizides 1.3 //--------------------------------------------------------------------------------------------------
114 loizides 1.1 void FullExampleMod::Terminate()
115     {
116     // Run finishing code on the client computer. For this module, we dont do
117     // anything here.
118     }