ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/PhysicsMod/src/FullExampleMod.cc
Revision: 1.6
Committed: Fri Mar 12 13:51:26 2010 UTC (15 years, 1 month ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, HEAD
Branch point for: Mit_025c_branch
Changes since 1.5: +11 -9 lines
Log Message:
Update full example to be used as physics example also

File Contents

# Content
1 // $Id: FullExampleMod.cc,v 1.5 2009/07/10 14:17:08 loizides Exp $
2
3 #include "MitAna/PhysicsMod/interface/FullExampleMod.h"
4 #include <TH1D.h>
5 #include "MitAna/DataTree/interface/Names.h"
6 #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
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 fMuonsFromBranch(kTRUE),
23 fElectronsFromBranch(kTRUE),
24 fParticles(0),
25 fTracks(0),
26 fMuons(0),
27 fElectrons(0),
28 fMCPtHist(0),
29 fMCEtaHist(0),
30 fTrackPtHist(0),
31 fTrackEtaHist(0),
32 fMuonPtHist(0),
33 fMuonEtaHist(0),
34 fElectronPtHist(0),
35 fElectronEtaHist(0)
36 {
37 // Constructor.
38 }
39
40 //--------------------------------------------------------------------------------------------------
41 void FullExampleMod::Begin()
42 {
43 // Run startup code on the client machine. For this module, we dont do
44 // anything here.
45 }
46
47 //--------------------------------------------------------------------------------------------------
48 void FullExampleMod::Process()
49 {
50 // Process entries of the tree. For this module, we just load the branches and
51 // fill the histograms.
52
53 LoadEventObject(fMCPartName,fParticles);
54 for (UInt_t i=0; i<fParticles->GetEntries(); ++i) {
55 const MCParticle *p = fParticles->At(i);
56 fMCPtHist->Fill(p->Pt());
57 fMCEtaHist->Fill(p->Eta());
58 }
59
60 LoadEventObject(fTrackName,fTracks);
61 for (UInt_t i=0; i<fTracks->GetEntries(); ++i) {
62 const Track *p = fTracks->At(i);
63 fTrackPtHist->Fill(p->Pt());
64 fTrackEtaHist->Fill(p->Eta());
65 }
66
67 LoadEventObject(fMuonName,fMuons);
68 for (UInt_t i=0; i<fMuons->GetEntries(); ++i) {
69 const Muon *p = fMuons->At(i);
70 fMuonPtHist->Fill(p->Pt());
71 fMuonEtaHist->Fill(p->Eta());
72 }
73
74 LoadEventObject(fElectronName,fElectrons);
75 for (UInt_t i=0; i<fElectrons->GetEntries(); ++i) {
76 const Electron *p = fElectrons->At(i);
77 fElectronPtHist->Fill(p->Pt());
78 fElectronEtaHist->Fill(p->Eta());
79 }
80 }
81
82 //--------------------------------------------------------------------------------------------------
83 void FullExampleMod::SlaveBegin()
84 {
85 // Run startup code on the computer (slave) doing the actual analysis. Here,
86 // we typically initialize histograms and other analysis objects and request
87 // branches. For this module, we request a branch of the MitTree.
88
89 ReqEventObject(fMCPartName, fParticles, kTRUE);
90 ReqEventObject(fTrackName, fTracks, kTRUE);
91 ReqEventObject(fMuonName, fMuons, fMuonsFromBranch);
92 ReqEventObject(fElectronName, fElectrons, fElectronsFromBranch);
93
94 AddTH1(fMCPtHist,"hMCPtHist",";p_{t} [GeV];#",100,0.,250.);
95 AddTH1(fMCEtaHist,"hMCEtaHist",";#eta;#",160,-8.,8.);
96 AddTH1(fTrackPtHist,"hTrackPtHist",";p_{t} [GeV];#",100,0.,250.);
97 AddTH1(fTrackEtaHist,"hTrackEtaHist",";#eta;#",160,-8.,8.);
98 AddTH1(fMuonPtHist,"hMuonPtHist",";p_{t} [GeV];#",100,0.,250.);
99 AddTH1(fMuonEtaHist,"hMuonEtaHist",";#eta;#",160,-8.,8.);
100 AddTH1(fElectronPtHist,"hElectronPtHist",";p_{t} [GeV];#",100,0.,250.);
101 AddTH1(fElectronEtaHist,"hElectronEtaHist",";#eta;#",160,-8.,8.);
102 }
103
104 //--------------------------------------------------------------------------------------------------
105 void FullExampleMod::SlaveTerminate()
106 {
107 // Run finishing code on the computer (slave) that did the analysis. For this
108 // module, we dont do anything here.
109 }
110
111 //--------------------------------------------------------------------------------------------------
112 void FullExampleMod::Terminate()
113 {
114 // Run finishing code on the client computer. For this module, we dont do
115 // anything here.
116 }