ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/PhysicsMod/src/HLTExampleMod.cc
Revision: 1.3
Committed: Tue May 12 18:41:42 2009 UTC (15 years, 11 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_009a
Changes since 1.2: +11 -1 lines
Log Message:
Save number of triggered events.

File Contents

# Content
1 // $Id: HLTExampleMod.cc,v 1.2 2009/05/11 08:00:35 loizides Exp $
2
3 #include "MitAna/PhysicsMod/interface/HLTExampleMod.h"
4 #include <TH1D.h>
5
6 using namespace mithep;
7
8 ClassImp(mithep::HLTExampleMod)
9
10 //--------------------------------------------------------------------------------------------------
11 HLTExampleMod::HLTExampleMod(const char *name, const char *title) :
12 BaseMod(name,title),
13 fPtHist(0),
14 fEtaHist(0)
15 {
16 // Constructor.
17 }
18
19 //--------------------------------------------------------------------------------------------------
20 void HLTExampleMod::Process()
21 {
22 // Process entries of the tree. For this module, we just load
23 // the branch and fill the histograms.
24
25 const TriggerObjectCol *objs = GetHLTObjects(fObjsName);
26 if (!objs) // this can only happen if HLTMod::SetAbortIfNotAccepted(kFALSE) was called
27 return;
28
29 IncNEventsProcessed();
30
31 Int_t ents=objs->GetEntries();
32 for(Int_t i=0;i<ents;++i) {
33 const TriggerObject *to = objs->At(i);
34 fPtHist->Fill(to->Pt());
35 fEtaHist->Fill(to->Eta());
36 }
37 }
38
39 //--------------------------------------------------------------------------------------------------
40 void HLTExampleMod::SlaveBegin()
41 {
42 // Run startup code on the computer (slave) doing the actual
43 // analysis. Here, we typically initialize histograms and
44 // other analysis objects and request branches. For this module,
45 // we request a branch of the MitTree.
46
47 fPtHist = new TH1D("hPtHist",";p_{t};#",250,0.,500.);
48 AddOutput(fPtHist);
49 fEtaHist = new TH1D("hEtaHist",";#eta;#",160,-8.,8.);
50 AddOutput(fEtaHist);
51 }
52
53 //--------------------------------------------------------------------------------------------------
54 void HLTExampleMod::SlaveTerminate()
55 {
56 // Save number of accepted events.
57
58 SaveNEventsProcessed();
59 }