ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/interface/OutputMod.h
Revision: 1.1
Committed: Mon Dec 1 17:42:22 2008 UTC (16 years, 5 months ago) by loizides
Content type: text/plain
Branch: MAIN
Log Message:
First sort of working version for OutputMod.

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2     // $Id: $
3     //
4     // OutputMod
5     //
6     // This TAM module will write all events to a new output file. This means the full content of the
7     // various trees.
8     //
9     // Authors: C.Paus, C.Loizides
10     //--------------------------------------------------------------------------------------------------
11    
12     #ifndef MITANA_TREEMOD_OUTPUTMOD_H
13     #define MITANA_TREEMOD_OUTPUTMOD_H
14    
15     #include "MitAna/TreeMod/interface/BaseMod.h"
16     #include "MitAna/DataTree/interface/Collections.h"
17     #include <TString.h>
18     #include <TRegexp.h>
19    
20     namespace mithep
21     {
22     class TreeWriter;
23     class EventHeader;
24    
25     class OutputMod : public BaseMod
26     {
27     public:
28     OutputMod(const char *name = "OutputMod", const char *title = "Output module");
29     ~OutputMod() {}
30    
31     void Drop(const char *bname);
32     void Keep(const char *bname);
33     void SetCheckDep(Bool_t b) { fCheckDep = b; }
34    
35     protected:
36     void BeginRun();
37     void EndRun();
38     void Process();
39     Bool_t Notify();
40     void SlaveBegin();
41     void SlaveTerminate();
42    
43     TString fTreeName; //tree name
44     TString fPrefix; //
45     TString fPathName; //
46     UInt_t fMaxSize; //
47     UInt_t fCompLevel; //
48     UInt_t fSplitLevel; //
49     UInt_t fBranchSize; //
50     Bool_t fDoReset; //=true then reset pointers
51     Bool_t fCheckDep; //=true then check auto-loaded branches
52     StringVec fCmdList; //list of keep/drop statements
53    
54     private:
55     void CheckAndAddBranch(const char *bname, const char *cname);
56     Bool_t IsAcceptedBranch(const char *bname);
57     UInt_t GetNBranches() { return fBrNameList.Entries(); }
58     void LoadBranches();
59     void RequestBranch(const char *bname);
60     void ResolveDep(Bool_t solve=kFALSE);
61     void SetupBranches();
62    
63     TreeWriter *fTreeWriter; //!
64     EventHeader *fEventHeader; //!
65     std::vector<TRegexp> fCmdReList; //!
66     std::vector<Bool_t> fCmdDeList; //!
67     StringVec fBrNameList; //!
68     StringVec fBrClassList; //!
69     TObject** fBranches; //!
70     const UInt_t fNBranchesMax; //!
71    
72     ClassDef(OutputMod,1) // Output module
73     };
74     }
75    
76     //--------------------------------------------------------------------------------------------------
77     inline void mithep::OutputMod::Drop(const char *bname)
78     {
79     // Add branch name to be dropped (can be regular expression)
80    
81     fCmdList.AddCopy(std::string(Form("drop %s", bname)));
82     }
83    
84     //--------------------------------------------------------------------------------------------------
85     inline void mithep::OutputMod::Keep(const char *bname)
86     {
87     // Add branch name to be kept (can be regular expression)
88    
89     fCmdList.AddCopy(std::string(Form("keep %s", bname)));
90     }
91     #endif