ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/src/BaseMod.cc
Revision: 1.10
Committed: Tue Nov 24 14:27:33 2009 UTC (15 years, 5 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.9: +23 -1 lines
Log Message:
Added L1Mod

File Contents

# Content
1 // $Id: BaseMod.cc,v 1.9 2009/07/13 10:39:20 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 const TriggerTable *BaseMod::GetL1AlgoTable() const
50 {
51 // Get pointer to L1 algorithm trigger table obtained by module with given name.
52
53 if (!HasHLTInfo())
54 return 0;
55
56 return (dynamic_cast<const TriggerTable *>(FindPublicObj(fHltFwkMod->L1ATabNamePub())));
57 }
58
59 //--------------------------------------------------------------------------------------------------
60 const TriggerTable *BaseMod::GetL1TechTable() const
61 {
62 // Get pointer to L1 technical trigger table obtained by module with given name.
63
64 if (!HasHLTInfo())
65 return 0;
66
67 return (dynamic_cast<const TriggerTable *>(FindPublicObj(fHltFwkMod->L1TTabNamePub())));
68 }
69
70 //--------------------------------------------------------------------------------------------------
71 Bool_t BaseMod::HasHLTInfo() const
72 {
73 // Check if HLT framework module is in list of modules.
74
75 if (fHltFwkMod)
76 return kTRUE;
77
78 if (!GetSelector() || !GetSelector()->GetTopModule())
79 return kFALSE;
80
81 const TList *tasks = GetSelector()->GetTopModule()->GetSubModules();
82 if (!tasks)
83 return kFALSE;
84
85 fHltFwkMod = dynamic_cast<const HLTFwkMod*>(tasks->FindObject(fHltFwkModName));
86 if (fHltFwkMod)
87 return kTRUE;
88 return kFALSE;
89 }
90
91 //--------------------------------------------------------------------------------------------------
92 void BaseMod::SaveNEventsProcessed(const char *name)
93 {
94 // Save the number of processed events in a one-bin histogram.
95
96 TH1D *hDEvents = new TH1D(name,"Total number of processed events",1,-0.5,0.5);
97 hDEvents->Fill(0.0,fNEventsProc);
98 hDEvents->SetEntries(fNEventsProc);
99 AddOutput(hDEvents);
100 }