ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/interface/OutputMod.h
Revision: 1.13
Committed: Wed Mar 28 12:15:38 2012 UTC (13 years, 1 month ago) by paus
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, HEAD
Changes since 1.12: +8 -3 lines
Log Message:
Enable skimming.

File Contents

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