ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/PhysicsMod/src/FullExampleMod.cc
Revision: 1.2
Committed: Thu Dec 4 13:52:27 2008 UTC (16 years, 5 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.1: +14 -14 lines
Log Message:
Updated to use const ptr to col

File Contents

# User Rev Content
1 loizides 1.2 // $Id: FullExampleMod.cc,v 1.1 2008/11/25 14:30:54 loizides Exp $
2 loizides 1.1
3     #include "MitAna/PhysicsMod/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     //--------------------------------------------------------------------------------------------------
12     FullExampleMod::FullExampleMod(const char *name, const char *title) :
13     BaseMod(name,title),
14     fMCPartName(Names::gkMCPartBrn),
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     fMCPtHist(0),
23     fMCEtaHist(0),
24     fTrackPtHist(0),
25     fTrackEtaHist(0),
26     fMuonPtHist(0),
27     fMuonEtaHist(0),
28     fElectronPtHist(0),
29     fElectronEtaHist(0)
30     {
31     // Constructor.
32     }
33    
34     //--------------------------------------------------------------------------------------------------
35     void FullExampleMod::Begin()
36     {
37     // Run startup code on the client machine. For this module, we dont do
38     // anything here.
39     }
40    
41     //--------------------------------------------------------------------------------------------------
42     void FullExampleMod::Process()
43     {
44     // Process entries of the tree. For this module, we just load the branches and
45     // fill the histograms.
46    
47     LoadBranch(fMCPartName);
48     for (UInt_t i=0; i<fParticles->GetEntries(); ++i) {
49 loizides 1.2 const MCParticle *p = fParticles->At(i);
50 loizides 1.1 fMCPtHist->Fill(p->Pt());
51     fMCEtaHist->Fill(p->Eta());
52     }
53    
54     LoadBranch(fTrackName);
55     for (UInt_t i=0; i<fTracks->GetEntries(); ++i) {
56 loizides 1.2 const Track *p = fTracks->At(i);
57 loizides 1.1 fTrackPtHist->Fill(p->Pt());
58 loizides 1.2 fTrackEtaHist->Fill(p->Eta());
59 loizides 1.1 }
60    
61     LoadBranch(fMuonName);
62     for (UInt_t i=0; i<fMuons->GetEntries(); ++i) {
63 loizides 1.2 const Muon *p = fMuons->At(i);
64 loizides 1.1 fMuonPtHist->Fill(p->Pt());
65     fMuonEtaHist->Fill(p->Eta());
66     }
67    
68     LoadBranch(fElectronName);
69     for (UInt_t i=0; i<fElectrons->GetEntries(); ++i) {
70 loizides 1.2 const Electron *p = fElectrons->At(i);
71 loizides 1.1 fElectronPtHist->Fill(p->Pt());
72     fElectronEtaHist->Fill(p->Eta());
73     }
74     }
75    
76     //--------------------------------------------------------------------------------------------------
77     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(fMCPartName, fParticles);
84     ReqBranch(fTrackName, fTracks);
85     ReqBranch(fMuonName, fMuons);
86     ReqBranch(fElectronName, fElectrons);
87    
88 loizides 1.2 fMCPtHist = new TH1D("hMCPtHist",";p_{t};#",100,0.,250.);
89 loizides 1.1 AddOutput(fMCPtHist);
90 loizides 1.2 fMCEtaHist = new TH1D("hMCEtaHist",";#eta;#",160,-8.,8.);
91 loizides 1.1 AddOutput(fMCEtaHist);
92 loizides 1.2 fTrackPtHist = new TH1D("hTrackPtHist",";p_{t};#",100,0.,250.);
93 loizides 1.1 AddOutput(fTrackPtHist);
94 loizides 1.2 fTrackEtaHist = new TH1D("hTrackEtaHist",";#eta;#",160,-8.,8.);
95 loizides 1.1 AddOutput(fTrackEtaHist);
96 loizides 1.2 fMuonPtHist = new TH1D("hMuonPtHist",";p_{t};#",100,0.,250.);
97 loizides 1.1 AddOutput(fMuonPtHist);
98 loizides 1.2 fMuonEtaHist = new TH1D("hMuonEtaHist",";#eta;#",160,-8.,8.);
99 loizides 1.1 AddOutput(fMuonEtaHist);
100 loizides 1.2 fElectronPtHist = new TH1D("hElectronPtHist",";p_{t};#",100,0.,250.);
101 loizides 1.1 AddOutput(fElectronPtHist);
102 loizides 1.2 fElectronEtaHist = new TH1D("hElectronEtaHist",";#eta;#",160,-8.,8.);
103 loizides 1.1 AddOutput(fElectronEtaHist);
104     }
105    
106     //--------------------------------------------------------------------------------------------------
107     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     //--------------------------------------------------------------------------------------------------
114     void FullExampleMod::Terminate()
115     {
116     // Run finishing code on the client computer. For this module, we dont do
117     // anything here.
118     }