ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/interface/OutputMod.h
Revision: 1.8
Committed: Thu Mar 12 18:24:33 2009 UTC (16 years, 1 month ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_008pre2
Changes since 1.7: +2 -3 lines
Log Message:
Reskimming now properly done

File Contents

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