ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/interface/Selector.h
Revision: 1.9
Committed: Thu Dec 4 13:50:15 2008 UTC (16 years, 5 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.8: +5 -2 lines
Log Message:
Have list of output mods.

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.9 // $Id: Selector.h,v 1.8 2008/12/03 17:42:36 loizides Exp $
3 loizides 1.1 //
4 loizides 1.2 // Our selector class for modular processing of a tree (or chain). In addition to the generic
5     // TAMSelector it determines the begin and end of a run and does the necessary bookkeeping.
6 loizides 1.6 // Modules can ask the selector to provide the run information.
7 loizides 1.1 //
8     // Authors: C.Loizides
9     //--------------------------------------------------------------------------------------------------
10    
11 loizides 1.5 #ifndef MITANA_TREEMOD_SELECTOR_H
12     #define MITANA_TREEMOD_SELECTOR_H
13 loizides 1.1
14     #include "MitAna/TAM/interface/TAModule.h"
15     #include "MitAna/TAM/interface/TAMSelector.h"
16 loizides 1.2 #include "MitAna/DataTree/interface/EventHeader.h"
17     #include "MitAna/DataTree/interface/LAHeader.h"
18     #include "MitAna/DataTree/interface/RunInfo.h"
19 loizides 1.1
20     namespace mithep {
21 loizides 1.8 class OutputMod;
22    
23 loizides 1.1 class Selector : public TAMSelector
24     {
25     public:
26     Selector();
27     ~Selector();
28 loizides 1.8
29 loizides 1.7 const THashTable &GetBranchTable() const { return fBranchTable; }
30 loizides 1.3 const EventHeader *GetEventHeader() const { return fEventHeader; }
31 loizides 1.8 const RunInfo *GetRunInfo() const { return fRunInfo; }
32 loizides 1.3 Bool_t ValidRunInfo() const;
33     Bool_t ValidRunNum() const { return fCurRunNum!=UInt_t(-1); }
34 loizides 1.2
35     protected:
36 loizides 1.6 Bool_t BeginRun();
37 loizides 1.3 Bool_t ConsistentRunNum() const;
38 loizides 1.6 Bool_t EndRun();
39 loizides 1.8 const char *GetAllEvtTreeName() const { return fAllEvtTreeName; }
40     const char *GetAllEvtHdrBrn() const { return fAllEvtHdrBrn; }
41     const char *GetEvtHdrName() const { return fEvtHdrName; }
42     const char *GetLATreeName() const { return fLATreeName; }
43     const char *GetLAHdrName() const { return fLAHdrName; }
44     const char *GetRunTreeName() const { return fRunTreeName; }
45     const char *GetRunInfoName() const { return fRunInfoName; }
46 loizides 1.6 Bool_t Notify();
47     void SlaveBegin(TTree* tree);
48 loizides 1.3 void UpdateRunInfo();
49     void UpdateRunInfoTree();
50    
51     Bool_t fDoRunInfo; //=true then get RunInfo (def=1)
52 loizides 1.6 TString fEvtHdrName; //name of event header branch
53     TString fRunTreeName; //name of run info tree
54     TString fRunInfoName; //name of run info branch
55 loizides 1.8 TString fAllEvtHdrBrn; //name of all-event header branch
56 loizides 1.6 TString fLATreeName; //name of look-ahead tree
57     TString fLAHdrName; //name of look-ahead event header branch
58 loizides 1.8 TString fAllEvtTreeName; //name of all-event tree
59 loizides 1.6 TTree *fRunTree; //!run info tree in current file
60     EventHeader *fEventHeader; //!event header for current event
61     RunInfo *fRunInfo; //!run information for current run
62     TTree *fLATree; //!look-ahead tree in current file
63     LAHeader *fLAHeader; //!event header for next event
64     UInt_t fCurRunNum; //!current run number
65 loizides 1.9 TList fOutputMods; //!pointer to output modules
66    
67     private:
68     void SearchOutputMods(const TAModule *mod);
69 loizides 1.8
70     friend class OutputMod;
71 loizides 1.2
72 loizides 1.8 ClassDef(Selector,1)
73 loizides 1.1 };
74 loizides 1.4 }
75 loizides 1.2
76     //--------------------------------------------------------------------------------------------------
77 loizides 1.4 inline Bool_t mithep::Selector::ConsistentRunNum() const
78     {
79     return (ValidRunNum() && fCurRunNum==fEventHeader->RunNum());
80     }
81 loizides 1.2
82     //--------------------------------------------------------------------------------------------------
83 loizides 1.4 inline Bool_t mithep::Selector::ValidRunInfo() const
84     {
85     return (fRunInfo && fCurRunNum==fRunInfo->RunNum());
86 loizides 1.1 }
87     #endif