ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/interface/OutputMod.h
Revision: 1.10
Committed: Mon Jun 15 15:00:17 2009 UTC (15 years, 10 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_009c, Mit_009b
Changes since 1.9: +3 -2 lines
Log Message:
Added proper fwd defs plus split up complilation of MitAna/DataTree LinkDefs.

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.10 // $Id: OutputMod.h,v 1.9 2009/03/24 16:12:26 loizides Exp $
3 loizides 1.1 //
4     // OutputMod
5     //
6 loizides 1.3 // This TAM module writes selected events and selected branches to a new output file.
7 loizides 1.1 //
8     // Authors: C.Paus, C.Loizides
9     //--------------------------------------------------------------------------------------------------
10    
11     #ifndef MITANA_TREEMOD_OUTPUTMOD_H
12     #define MITANA_TREEMOD_OUTPUTMOD_H
13    
14     #include "MitAna/TreeMod/interface/BaseMod.h"
15 loizides 1.10 #include "MitAna/DataTree/interface/EventHeaderFwd.h"
16 loizides 1.9 #include <map>
17     #include <string>
18     #include <vector>
19 loizides 1.1 #include <TString.h>
20     #include <TRegexp.h>
21    
22     namespace mithep
23     {
24     class TreeWriter;
25     class EventHeader;
26 loizides 1.2 class RunInfo;
27     class LAHeader;
28     class HLTFwkMod;
29 loizides 1.9 class BranchTable;
30 loizides 1.1
31     class OutputMod : public BaseMod
32     {
33     public:
34     OutputMod(const char *name = "OutputMod", const char *title = "Output module");
35    
36 loizides 1.9 void Drop(const char *bname);
37     void Keep(const char *bname);
38     void CheckTamBranches(Bool_t b) { fCheckTamBr = b; }
39     void KeepTamBranches(Bool_t b) { fKeepTamBr = b; }
40     void SetTreeName(const char *name) { fTreeName = name; }
41     void SetFileName(const char *name) { fPrefix = name; }
42     void SetPathName(const char *name) { fPathName = name; }
43     void SetMaxFileSize(UInt_t m) { fMaxSize = m; }
44     void SetDefCompression(UInt_t l) { fCompLevel = l; }
45     void SetDefSplitLevel(UInt_t l) { fSplitLevel = l; }
46     void SetDefBranchSize(UInt_t s) { fBranchSize = s; }
47 loizides 1.1
48     protected:
49 loizides 1.9 void BeginRun();
50     void EndRun();
51     Bool_t Notify();
52     void Process();
53     void ProcessAll();
54     void SlaveBegin();
55     void SlaveTerminate();
56    
57     TString fTreeName; //tree name
58     TString fPrefix; //file prefix for filename
59     TString fPathName; //path name to be used
60     UInt_t fMaxSize; //maximum file size [MB]
61     UInt_t fCompLevel; //compression levels
62     UInt_t fSplitLevel; //default split levels
63     UInt_t fBranchSize; //default branch sizes [Byte]
64     Bool_t fDoReset; //=true then reset pointers
65     Bool_t fUseBrDep; //=true then resolve branch dependencies
66     Bool_t fCheckTamBr; //=true then check TAM loaded branches
67     Bool_t fKeepTamBr; //=true then keep TAM loaded branches
68     std::vector<std::string> fCmdList; //list of keep/drop statements
69 loizides 1.1
70     private:
71 loizides 1.9 void CheckAndAddBranch(const char *bname, const char *cname);
72     Bool_t CheckAndResolveBranchDep();
73     void CheckAndResolveTAMDep(Bool_t solve=kFALSE);
74     Bool_t IsAcceptedBranch(const char *bname);
75     void FillAllEventHeader(Bool_t isremoved);
76     void FillL1Info();
77     void FillHltInfo();
78     UInt_t GetNBranches() const { return fBrNameList.size(); }
79     void LoadBranches();
80     void RequestBranches();
81     void SetupBranches();
82    
83     TreeWriter *fTreeWriter; //!tree writer holding trees + writing the files
84     EventHeader *fEventHeader; //!my event header (written)
85     EventHeader *fAllEventHeader; //!my all event header (written)
86     RunInfo *fRunInfo; //!my run info
87     LAHeader *fLaHeader; //!my look ahead header
88     BranchTable *fBranchTable; //!my branch table
89     std::vector<TRegexp> fCmdReList; //!branch list from fCmdList
90     std::vector<Bool_t> fCmdDeList; //!keep/drop list from fCmdList
91     std::vector<std::string> fBrNameList; //!branch list to be kept
92     std::vector<std::string> fBrClassList; //!corresponding class list
93     TObject** fBranches; //!branches to be written
94     const UInt_t fNBranchesMax; //!max number of supported top-level branches
95     TTree *fRunTree; //!runinfo tree
96     TTree *fLATree; //!look-ahead tree
97     TTree *fAllTree; //!all-event-header tree
98     const EventHeaderCol *fSkimmedIn; //!skimmed event headers (input)
99     TTree *fL1Tree; //!L1 trigger tree (not owned)
100     TTree *fHltTree; //!HLT trigger tree (not owned)
101     std::vector<std::string> *fHLTTab; //!HLT trigger names
102     std::vector<std::string> *fHLTLab; //!HLT module labels
103     Int_t fRunEntries; //!number of run info entries
104     std::map<UInt_t,Int_t> fRunmap; //!map between run number and entry number
105     Int_t fL1Entries; //!number of l1 info entries
106     Int_t fHltEntries; //!number of hlt info entries
107     Short_t fFileNum; //!file number of current file
108     Long64_t fLastWrittenEvt; //!entry of last written event
109     Long64_t fLastSeenEvt; //!entry of last seen event
110     Long64_t fCounter; //!count number of events
111 loizides 1.10 TList *fAddBrList; //!list of additional branches
112 loizides 1.3
113     friend class Selector;
114 loizides 1.1
115 loizides 1.5 ClassDef(OutputMod, 1) // Output module
116 loizides 1.1 };
117     }
118    
119     //--------------------------------------------------------------------------------------------------
120     inline void mithep::OutputMod::Drop(const char *bname)
121     {
122     // Add branch name to be dropped (can be regular expression)
123    
124 loizides 1.7 fCmdList.push_back(std::string(Form("drop %s", bname)));
125 loizides 1.1 }
126    
127     //--------------------------------------------------------------------------------------------------
128     inline void mithep::OutputMod::Keep(const char *bname)
129     {
130     // Add branch name to be kept (can be regular expression)
131    
132 loizides 1.7 fCmdList.push_back(std::string(Form("keep %s", bname)));
133 loizides 1.1 }
134     #endif