ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/src/BaseMod.cc
Revision: 1.3
Committed: Tue Nov 25 15:57:49 2008 UTC (16 years, 5 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.2: +13 -1 lines
Log Message:
Implement event counter plus storing in BaseMod. Used by AnaFwkMod.

File Contents

# User Rev Content
1 loizides 1.3 // $Id: BaseMod.cc,v 1.2 2008/09/28 02:34:14 loizides Exp $
2 loizides 1.1
3     #include "MitAna/TreeMod/interface/BaseMod.h"
4 loizides 1.2 #include "MitAna/TreeMod/interface/HLTFwkMod.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     const TriggerObjectsTable *BaseMod::GetHLTObjectsTable(const char *hltfwk) const
13     {
14     // Get pointer to HLT objects table obtained by module with given name. (Note: normally
15     // you want to stick to the default argument.)
16    
17     if (!HasHLTInfo())
18     return 0;
19    
20     const TList *tasks = GetSelector()->GetTopModule()->GetSubModules();
21     const HLTFwkMod *mod = static_cast<const HLTFwkMod *>(tasks->FindObject(hltfwk));
22     return (dynamic_cast<const TriggerObjectsTable *>(FindPublicObj(mod->HLTObjsNamePub())));
23     }
24    
25     //--------------------------------------------------------------------------------------------------
26     const TriggerTable *BaseMod::GetHLTTable(const char *hltfwk) const
27     {
28     // Get pointer to HLT trigger table obtained by module with given name. (Note: normally
29     // you want to stick to the default argument.)
30    
31     if (!HasHLTInfo(hltfwk))
32     return 0;
33    
34     const TList *tasks = GetSelector()->GetTopModule()->GetSubModules();
35     const HLTFwkMod *mod = static_cast<const HLTFwkMod *>(tasks->FindObject(hltfwk));
36     return (dynamic_cast<const TriggerTable *>(FindPublicObj(mod->HLTTabNamePub())));
37     }
38    
39     //--------------------------------------------------------------------------------------------------
40     Bool_t BaseMod::HasHLTInfo(const char *hltfwk) const
41     {
42     // Check if HLT framework module is in list of modules. (Note: normally
43     // you want to stick to the default argument.)
44    
45     if (!GetSelector() || !GetSelector()->GetTopModule())
46     return kFALSE;
47    
48     const TList *tasks = GetSelector()->GetTopModule()->GetSubModules();
49     if (!tasks)
50     return kFALSE;
51    
52     const HLTFwkMod *mod = dynamic_cast<const HLTFwkMod *>(tasks->FindObject(hltfwk));
53     if (mod)
54     return kTRUE;
55     return kFALSE;
56     }
57 loizides 1.3
58     //--------------------------------------------------------------------------------------------------
59     void BaseMod::SaveNEventsProcessed(const char *name)
60     {
61     // Save the number of processed events in a one-bin histogram.
62    
63     TH1D *hDEvents = new TH1D(name,"Total number of processed events",1,-0.5,0.5);
64     hDEvents->Fill(0.0,fNEventsProcessed);
65     hDEvents->SetEntries(fNEventsProcessed);
66     AddOutput(hDEvents);
67     }