ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/src/BaseMod.cc
Revision: 1.9
Committed: Mon Jul 13 10:39:20 2009 UTC (15 years, 9 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_012b, Mit_012a, Mit_012, Mit_011a, Mit_011, Mit_010a, Mit_010
Changes since 1.8: +2 -2 lines
Log Message:
Updated for changes in trigger classes

File Contents

# Content
1 // $Id: BaseMod.cc,v 1.8 2009/06/15 15:00:17 loizides Exp $
2
3 #include "MitAna/TreeMod/interface/HLTFwkMod.h"
4 #include "MitAna/DataTree/interface/TriggerObjectsTable.h"
5 #include <TH1D.h>
6
7 using namespace mithep;
8
9 ClassImp(mithep::BaseMod)
10
11 //--------------------------------------------------------------------------------------------------
12 BaseMod::BaseMod(const char *name, const char *title) :
13 TAModule(name,title),
14 fFillHist(kFALSE),
15 fEvtObjBrNames(0),
16 fHltFwkMod(0),
17 fHltFwkModName("HLTFwkMod"),
18 fNEventsProc(0)
19 {
20 // Constructor.
21
22 fEvtObjBrNames.SetOwner(kTRUE);
23 }
24
25 //--------------------------------------------------------------------------------------------------
26 const TriggerObjectsTable *BaseMod::GetHLTObjectsTable() const
27 {
28 // Get pointer to HLT objects table obtained by module with given name. (Note: normally
29 // you want to stick to the default argument.)
30
31 if (!HasHLTInfo())
32 return 0;
33
34 return (dynamic_cast<const TriggerObjectsTable *>(FindPublicObj(fHltFwkMod->HLTObjsNamePub())));
35 }
36
37 //--------------------------------------------------------------------------------------------------
38 const TriggerTable *BaseMod::GetHLTTable() const
39 {
40 // Get pointer to HLT trigger table obtained by module with given name.
41
42 if (!HasHLTInfo())
43 return 0;
44
45 return (dynamic_cast<const TriggerTable *>(FindPublicObj(fHltFwkMod->HLTTabNamePub())));
46 }
47
48 //--------------------------------------------------------------------------------------------------
49 Bool_t BaseMod::HasHLTInfo() const
50 {
51 // Check if HLT framework module is in list of modules.
52
53 if (fHltFwkMod)
54 return kTRUE;
55
56 if (!GetSelector() || !GetSelector()->GetTopModule())
57 return kFALSE;
58
59 const TList *tasks = GetSelector()->GetTopModule()->GetSubModules();
60 if (!tasks)
61 return kFALSE;
62
63 fHltFwkMod = dynamic_cast<const HLTFwkMod*>(tasks->FindObject(fHltFwkModName));
64 if (fHltFwkMod)
65 return kTRUE;
66 return kFALSE;
67 }
68
69 //--------------------------------------------------------------------------------------------------
70 void BaseMod::SaveNEventsProcessed(const char *name)
71 {
72 // Save the number of processed events in a one-bin histogram.
73
74 TH1D *hDEvents = new TH1D(name,"Total number of processed events",1,-0.5,0.5);
75 hDEvents->Fill(0.0,fNEventsProc);
76 hDEvents->SetEntries(fNEventsProc);
77 AddOutput(hDEvents);
78 }