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 |
}
|