1 |
bendavid |
1.6 |
// $Id: FullExampleMod.cc,v 1.5 2009/07/10 14:17:08 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 |
bendavid |
1.6 |
fMuonsFromBranch(kTRUE),
|
23 |
|
|
fElectronsFromBranch(kTRUE),
|
24 |
loizides |
1.1 |
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 |
bendavid |
1.6 |
LoadEventObject(fMCPartName,fParticles);
|
54 |
loizides |
1.1 |
for (UInt_t i=0; i<fParticles->GetEntries(); ++i) {
|
55 |
loizides |
1.2 |
const MCParticle *p = fParticles->At(i);
|
56 |
loizides |
1.1 |
fMCPtHist->Fill(p->Pt());
|
57 |
|
|
fMCEtaHist->Fill(p->Eta());
|
58 |
|
|
}
|
59 |
|
|
|
60 |
bendavid |
1.6 |
LoadEventObject(fTrackName,fTracks);
|
61 |
loizides |
1.1 |
for (UInt_t i=0; i<fTracks->GetEntries(); ++i) {
|
62 |
loizides |
1.2 |
const Track *p = fTracks->At(i);
|
63 |
loizides |
1.1 |
fTrackPtHist->Fill(p->Pt());
|
64 |
loizides |
1.2 |
fTrackEtaHist->Fill(p->Eta());
|
65 |
loizides |
1.1 |
}
|
66 |
|
|
|
67 |
bendavid |
1.6 |
LoadEventObject(fMuonName,fMuons);
|
68 |
loizides |
1.1 |
for (UInt_t i=0; i<fMuons->GetEntries(); ++i) {
|
69 |
loizides |
1.2 |
const Muon *p = fMuons->At(i);
|
70 |
loizides |
1.1 |
fMuonPtHist->Fill(p->Pt());
|
71 |
|
|
fMuonEtaHist->Fill(p->Eta());
|
72 |
|
|
}
|
73 |
|
|
|
74 |
bendavid |
1.6 |
LoadEventObject(fElectronName,fElectrons);
|
75 |
loizides |
1.1 |
for (UInt_t i=0; i<fElectrons->GetEntries(); ++i) {
|
76 |
loizides |
1.2 |
const Electron *p = fElectrons->At(i);
|
77 |
loizides |
1.1 |
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 |
bendavid |
1.6 |
ReqEventObject(fMCPartName, fParticles, kTRUE);
|
90 |
|
|
ReqEventObject(fTrackName, fTracks, kTRUE);
|
91 |
|
|
ReqEventObject(fMuonName, fMuons, fMuonsFromBranch);
|
92 |
|
|
ReqEventObject(fElectronName, fElectrons, fElectronsFromBranch);
|
93 |
loizides |
1.1 |
|
94 |
loizides |
1.5 |
AddTH1(fMCPtHist,"hMCPtHist",";p_{t} [GeV];#",100,0.,250.);
|
95 |
loizides |
1.3 |
AddTH1(fMCEtaHist,"hMCEtaHist",";#eta;#",160,-8.,8.);
|
96 |
loizides |
1.5 |
AddTH1(fTrackPtHist,"hTrackPtHist",";p_{t} [GeV];#",100,0.,250.);
|
97 |
loizides |
1.3 |
AddTH1(fTrackEtaHist,"hTrackEtaHist",";#eta;#",160,-8.,8.);
|
98 |
loizides |
1.5 |
AddTH1(fMuonPtHist,"hMuonPtHist",";p_{t} [GeV];#",100,0.,250.);
|
99 |
loizides |
1.3 |
AddTH1(fMuonEtaHist,"hMuonEtaHist",";#eta;#",160,-8.,8.);
|
100 |
loizides |
1.5 |
AddTH1(fElectronPtHist,"hElectronPtHist",";p_{t} [GeV];#",100,0.,250.);
|
101 |
loizides |
1.3 |
AddTH1(fElectronEtaHist,"hElectronEtaHist",";#eta;#",160,-8.,8.);
|
102 |
loizides |
1.1 |
}
|
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 |
|
|
}
|