ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/PhysicsMod/src/FullExampleMod.cc
Revision: 1.4
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.3: +5 -1 lines
Log Message:
Added proper fwd defs plus split up complilation of MitAna/DataTree LinkDefs.

File Contents

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