ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/interface/Selector.h
Revision: 1.12
Committed: Thu Jun 11 08:59:32 2009 UTC (15 years, 10 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_009a
Changes since 1.11: +16 -12 lines
Log Message:
Provide trash for event loop.

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.12 // $Id: Selector.h,v 1.11 2009/03/12 18:25:10 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.11 #include "MitAna/DataTree/interface/Collections.h"
17 loizides 1.2 #include "MitAna/DataTree/interface/EventHeader.h"
18     #include "MitAna/DataTree/interface/LAHeader.h"
19     #include "MitAna/DataTree/interface/RunInfo.h"
20 loizides 1.1
21     namespace mithep {
22 loizides 1.8 class OutputMod;
23    
24 loizides 1.1 class Selector : public TAMSelector
25     {
26     public:
27     Selector();
28     ~Selector();
29 loizides 1.8
30 loizides 1.12 void AddToTrash(TObject *obj) { fTrash.AddLast(obj); }
31     const char *GetAllEvtTreeName() const { return fAllEvtTreeName; }
32     const char *GetAllEvtHdrBrn() const { return fAllEvtHdrBrn; }
33     const THashTable &GetBranchTable() const { return fBranchTable; }
34     const char *GetEvtHdrName() const { return fEvtHdrName; }
35     const EventHeader *GetEventHeader() const { return fEventHeader; }
36     const char *GetLATreeName() const { return fLATreeName; }
37     const char *GetLAHdrName() const { return fLAHdrName; }
38     const char *GetRunTreeName() const { return fRunTreeName; }
39     const char *GetRunInfoName() const { return fRunInfoName; }
40     const RunInfo *GetRunInfo() const { return fRunInfo; }
41 loizides 1.3 Bool_t ValidRunInfo() const;
42     Bool_t ValidRunNum() const { return fCurRunNum!=UInt_t(-1); }
43 loizides 1.2
44     protected:
45 loizides 1.6 Bool_t BeginRun();
46 loizides 1.3 Bool_t ConsistentRunNum() const;
47 loizides 1.6 Bool_t EndRun();
48     Bool_t Notify();
49 loizides 1.12 Bool_t Process(Long64_t entry);
50 loizides 1.6 void SlaveBegin(TTree* tree);
51 loizides 1.3 void UpdateRunInfo();
52     void UpdateRunInfoTree();
53    
54     Bool_t fDoRunInfo; //=true then get RunInfo (def=1)
55 loizides 1.6 TString fEvtHdrName; //name of event header branch
56     TString fRunTreeName; //name of run info tree
57     TString fRunInfoName; //name of run info branch
58 loizides 1.8 TString fAllEvtHdrBrn; //name of all-event header branch
59 loizides 1.6 TString fLATreeName; //name of look-ahead tree
60     TString fLAHdrName; //name of look-ahead event header branch
61 loizides 1.8 TString fAllEvtTreeName; //name of all-event tree
62 loizides 1.6 TTree *fRunTree; //!run info tree in current file
63     EventHeader *fEventHeader; //!event header for current event
64     RunInfo *fRunInfo; //!run information for current run
65     TTree *fLATree; //!look-ahead tree in current file
66     LAHeader *fLAHeader; //!event header for next event
67     UInt_t fCurRunNum; //!current run number
68 loizides 1.12 TList fOutputMods; //!pointer(s) to output modules
69     TObjArray fTrash; //!pointers to trashed objects
70    
71 loizides 1.9 private:
72     void SearchOutputMods(const TAModule *mod);
73 loizides 1.8
74     friend class OutputMod;
75 loizides 1.2
76 loizides 1.10 ClassDef(Selector, 1) // Customized selector class
77 loizides 1.1 };
78 loizides 1.4 }
79 loizides 1.2
80     //--------------------------------------------------------------------------------------------------
81 loizides 1.4 inline Bool_t mithep::Selector::ConsistentRunNum() const
82     {
83     return (ValidRunNum() && fCurRunNum==fEventHeader->RunNum());
84     }
85 loizides 1.2
86     //--------------------------------------------------------------------------------------------------
87 loizides 1.4 inline Bool_t mithep::Selector::ValidRunInfo() const
88     {
89     return (fRunInfo && fCurRunNum==fRunInfo->RunNum());
90 loizides 1.1 }
91     #endif