Revision: | 1.11 |
Committed: | Wed Nov 25 15:13:17 2009 UTC (15 years, 5 months ago) by loizides |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012h, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, HEAD |
Branch point for: | Mit_025c_branch |
Changes since 1.10: | +13 -1 lines |
Log Message: | Added GetTriggerTable |
# | Content |
---|---|
1 | // $Id: BaseMod.cc,v 1.10 2009/11/24 14:27:33 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 | const TriggerTable *BaseMod::GetTriggerTable(ETrigType t) const |
93 | { |
94 | // Return pointer to requested trigger table |
95 | |
96 | if (t==kL1A) |
97 | return GetL1AlgoTable(); |
98 | else if (t==kL1T) |
99 | return GetL1TechTable(); |
100 | return GetHLTTable(); |
101 | } |
102 | |
103 | //-------------------------------------------------------------------------------------------------- |
104 | void BaseMod::SaveNEventsProcessed(const char *name) |
105 | { |
106 | // Save the number of processed events in a one-bin histogram. |
107 | |
108 | TH1D *hDEvents = new TH1D(name,"Total number of processed events",1,-0.5,0.5); |
109 | hDEvents->Fill(0.0,fNEventsProc); |
110 | hDEvents->SetEntries(fNEventsProc); |
111 | AddOutput(hDEvents); |
112 | } |