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

# User Rev Content
1 loizides 1.10 // $Id: BaseMod.cc,v 1.9 2009/07/13 10:39:20 loizides Exp $
2 loizides 1.1
3 loizides 1.2 #include "MitAna/TreeMod/interface/HLTFwkMod.h"
4 loizides 1.9 #include "MitAna/DataTree/interface/TriggerObjectsTable.h"
5 loizides 1.3 #include <TH1D.h>
6 loizides 1.1
7     using namespace mithep;
8    
9     ClassImp(mithep::BaseMod)
10 loizides 1.2
11     //--------------------------------------------------------------------------------------------------
12 loizides 1.5 BaseMod::BaseMod(const char *name, const char *title) :
13 loizides 1.6 TAModule(name,title),
14     fFillHist(kFALSE),
15 loizides 1.7 fEvtObjBrNames(0),
16 loizides 1.5 fHltFwkMod(0),
17     fHltFwkModName("HLTFwkMod"),
18 loizides 1.6 fNEventsProc(0)
19 loizides 1.5 {
20     // Constructor.
21 loizides 1.7
22     fEvtObjBrNames.SetOwner(kTRUE);
23 loizides 1.5 }
24    
25     //--------------------------------------------------------------------------------------------------
26     const TriggerObjectsTable *BaseMod::GetHLTObjectsTable() const
27 loizides 1.2 {
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 loizides 1.5 return (dynamic_cast<const TriggerObjectsTable *>(FindPublicObj(fHltFwkMod->HLTObjsNamePub())));
35 loizides 1.2 }
36    
37     //--------------------------------------------------------------------------------------------------
38 loizides 1.5 const TriggerTable *BaseMod::GetHLTTable() const
39 loizides 1.2 {
40 loizides 1.5 // Get pointer to HLT trigger table obtained by module with given name.
41 loizides 1.2
42 loizides 1.5 if (!HasHLTInfo())
43 loizides 1.2 return 0;
44    
45 loizides 1.5 return (dynamic_cast<const TriggerTable *>(FindPublicObj(fHltFwkMod->HLTTabNamePub())));
46 loizides 1.2 }
47    
48     //--------------------------------------------------------------------------------------------------
49 loizides 1.10 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 loizides 1.5 Bool_t BaseMod::HasHLTInfo() const
72 loizides 1.2 {
73 loizides 1.5 // Check if HLT framework module is in list of modules.
74    
75     if (fHltFwkMod)
76     return kTRUE;
77 loizides 1.2
78     if (!GetSelector() || !GetSelector()->GetTopModule())
79     return kFALSE;
80    
81     const TList *tasks = GetSelector()->GetTopModule()->GetSubModules();
82     if (!tasks)
83     return kFALSE;
84    
85 loizides 1.5 fHltFwkMod = dynamic_cast<const HLTFwkMod*>(tasks->FindObject(fHltFwkModName));
86     if (fHltFwkMod)
87 loizides 1.2 return kTRUE;
88     return kFALSE;
89     }
90 loizides 1.3
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 loizides 1.6 hDEvents->Fill(0.0,fNEventsProc);
98     hDEvents->SetEntries(fNEventsProc);
99 loizides 1.3 AddOutput(hDEvents);
100     }