ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/interface/OutputMod.h
Revision: 1.2
Committed: Tue Dec 2 09:34:16 2008 UTC (16 years, 5 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.1: +24 -15 lines
Log Message:
2nd version of partially functional module

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.2 // $Id: OutputMod.h,v 1.1 2008/12/01 17:42:22 loizides Exp $
3 loizides 1.1 //
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 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     ~OutputMod() {}
33    
34     void Drop(const char *bname);
35     void Keep(const char *bname);
36 loizides 1.2 void CheckTamBranches(Bool_t b) { fCheckTamBr = b; }
37     void KeepTamBranches(Bool_t b) { fKeepTamBr = b; }
38 loizides 1.1
39     protected:
40     void BeginRun();
41     void EndRun();
42     void Process();
43     Bool_t Notify();
44     void SlaveBegin();
45     void SlaveTerminate();
46    
47 loizides 1.2 TString fTreeName; //tree name
48     TString fPrefix; //
49     TString fPathName; //
50     UInt_t fMaxSize; //
51     UInt_t fCompLevel; //
52     UInt_t fSplitLevel; //
53     UInt_t fBranchSize; //
54     Bool_t fDoReset; //=true then reset pointers
55     Bool_t fCheckTamBr; //=true then check TAM loaded branches
56     Bool_t fKeepTamBr; //=true then keep TAM loaded branches
57     StringVec fCmdList; //list of keep/drop statements
58     TString fHltFwkModName; //
59 loizides 1.1
60     private:
61     void CheckAndAddBranch(const char *bname, const char *cname);
62 loizides 1.2 void CheckAndResolveDep(Bool_t solve=kFALSE);
63 loizides 1.1 Bool_t IsAcceptedBranch(const char *bname);
64 loizides 1.2 UInt_t GetNBranches() const { return fBrNameList.Entries(); }
65 loizides 1.1 void LoadBranches();
66     void RequestBranch(const char *bname);
67     void SetupBranches();
68    
69     TreeWriter *fTreeWriter; //!
70 loizides 1.2 EventHeader *fMyEventHeader; //!
71     RunInfo *fMyRunInfo; //!
72     LAHeader *fMyLaHeader; //!
73 loizides 1.1 std::vector<TRegexp> fCmdReList; //!
74     std::vector<Bool_t> fCmdDeList; //!
75     StringVec fBrNameList; //!
76     StringVec fBrClassList; //!
77     TObject** fBranches; //!
78     const UInt_t fNBranchesMax; //!
79 loizides 1.2 HLTFwkMod *fHltFwkMod; //!
80 loizides 1.1
81     ClassDef(OutputMod,1) // Output module
82     };
83     }
84    
85     //--------------------------------------------------------------------------------------------------
86     inline void mithep::OutputMod::Drop(const char *bname)
87     {
88     // Add branch name to be dropped (can be regular expression)
89    
90     fCmdList.AddCopy(std::string(Form("drop %s", bname)));
91     }
92    
93     //--------------------------------------------------------------------------------------------------
94     inline void mithep::OutputMod::Keep(const char *bname)
95     {
96     // Add branch name to be kept (can be regular expression)
97    
98     fCmdList.AddCopy(std::string(Form("keep %s", bname)));
99     }
100     #endif