ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/PhysicsMod/src/HLTExampleMod.cc
Revision: 1.1
Committed: Tue Nov 25 14:30:54 2008 UTC (16 years, 5 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_009, Mit_008, Mit_008pre2, Mit_008pre1, Mit_006b, Mit_006a
Log Message:
Added examples here.

File Contents

# User Rev Content
1 loizides 1.1 // $Id: HLTExampleMod.cc,v 1.1 2008/09/28 02:41:21 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    
27    
28     if (!objs) // this can only happen if HLTMod::SetAbortIfNotAccepted(kFALSE) was called
29     return;
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     }