Luiza  v03-01
RootTreeWriter.h
1 // -*- mode: c++; mode: auto-fill; mode: flyspell-prog; -*-
2 
3 #ifndef RootTreeWriter_h
4 #define RootTreeWriter_h 1
5 
6 #include "RootProcessor.h"
7 
8 // root includes
9 
10 #include "TFile.h"
11 #include "TTree.h"
12 
13 #include <fstream>
14 
15 using namespace gloria;
16 
17 namespace luiza {
18 
19 
21 
71  class RootTreeWriter : public RootProcessor {
72 
73  public:
74 
75  virtual RootTreeWriter* newProcessor();
76 
77 
79 
83  virtual void init() ;
84 
87  virtual void startAnalysis( GloriaDataContainer* data ) ;
88 
89 
92  virtual void processData( GloriaDataContainer* data ) ;
93 
94 
95  virtual void check( GloriaDataContainer* data ) ;
96 
97 
100  virtual void concludeAnalysis( GloriaDataContainer* data ) ;
101 
102 
105  virtual void end() ;
106 
107 
108  protected:
109 
111  void InitializeRootTree(string treeName, GloriaFitsTable *source);
112 
114  void FillRootTree(GloriaFitsTable *source);
115 
117  void WriteRootTree();
118 
121 
124 
126  bool _oneFile;
127 
130 
133 
135  std::vector< std::string > _selectedColumns;
136 
138  std::vector< std::string > _intHeaderRecords;
139 
141  std::vector< std::string > _floatHeaderRecords;
142 
144  static TApplication* rootApl;
145 
147  TTree* _outputTree;
148 
151 
153  TFile* _outputFile;
154 
156  int _nLoops ;
157 
159  int _nTables ;
160 
162  int _nWritten ;
163 
165  int _iRow;
166 
168  long *_intBranch;
169 
171  double *_floatBranch;
172 
174  bool _inLoop;
175 
176  void printEndMessage() const ;
177  } ;
178 
179  } // end namespace luiza
180 #endif
string _tableCollectionName
Name of the table collection which should be stored.
Definition: RootTreeWriter.h:120
double * _floatBranch
Pointer to table of long values.
Definition: RootTreeWriter.h:171
namespace for data storing and exchange formats
Definition: GloriaAstrometry.h:15
bool _oneFile
Flag for output to single file.
Definition: RootTreeWriter.h:126
long * _intBranch
Pointer to table of long values.
Definition: RootTreeWriter.h:168
bool _memoryResident
Flag for keeping output tree in memory.
Definition: RootTreeWriter.h:129
TFile * _outputFile
Output file pointer.
Definition: RootTreeWriter.h:153
std::vector< std::string > _floatHeaderRecords
Header records to be stored as doubles.
Definition: RootTreeWriter.h:141
int _nWritten
Counter for tables successfully written to file.
Definition: RootTreeWriter.h:162
Class for storing all data processed in Luiza.
Definition: GloriaDataContainer.h:82
TTree * _outputTree
Temporary table to prepare text output.
Definition: RootTreeWriter.h:147
string _outputFileName
Output file name.
Definition: RootTreeWriter.h:150
int _nTables
Table counter, used to number file name.
Definition: RootTreeWriter.h:159
std::vector< std::string > _intHeaderRecords
Header records to be stored as long integers.
Definition: RootTreeWriter.h:138
std::vector< std::string > _selectedColumns
Table columns to be stored.
Definition: RootTreeWriter.h:135
bool _addCounter
Flag for output to single file.
Definition: RootTreeWriter.h:132
static TApplication * rootApl
Main root application instance.
Definition: RootTreeWriter.h:144
string _rootFileName
Output file name root.
Definition: RootTreeWriter.h:123
Class for reading and processing fits tables in Luiza.
Definition: GloriaFitsTable.h:109
int _iRow
Row counter.
Definition: RootTreeWriter.h:165
Processor for writing numerical tables to root tree structure.
Definition: RootTreeWriter.h:71
Namespace for Luiza framework.
Definition: CCCollection.h:6
bool _inLoop
Flag to recognize event loop.
Definition: RootTreeWriter.h:174
int _nLoops
Loop counter.
Definition: RootTreeWriter.h:156
Base class for processors accessing input data.
Definition: RootProcessor.h:23