00001
00002
00014 #ifndef FitsController_H
00015 #define FitsController_H
00016
00017 #include "pattern/libhippo.h"
00018
00019 #include <map>
00020 #include <string>
00021 #include <vector>
00022
00023 namespace hippodraw {
00024
00025 class DataSource;
00026 class FitsFile;
00027 class PlotterBase;
00028 class TupleCut;
00029
00030
00039 class MDL_HIPPOPLOT_API FitsController
00040 {
00041
00042 private:
00043
00046 std::map < std::string, FitsFile * > m_file_map;
00047
00050 mutable std::string m_version;
00051
00054 static FitsController * s_instance;
00055
00058 std::vector < std::string > m_ntuple_names;
00059
00064 std::size_t calcColumnWidth ( const DataSource * source,
00065 unsigned int column ) const;
00066
00069 void closeFile ( const std::string & name );
00070
00071 public:
00072
00075 static FitsController * instance ();
00076
00079 virtual ~FitsController();
00080
00083 const std::string & version () const;
00084
00089 FitsFile * openFile ( const std::string & file );
00090
00094 const std::vector < std::string > &
00095 getNTupleNames ( const std::string & file_name );
00096
00102 DataSource * createNTuple ( const std::string & filename,
00103 const std::string & name );
00104
00113 DataSource * createNTuple ( const std::string & filename,
00114 const std::string & name,
00115 int index );
00116
00121 void checkForImage ( PlotterBase * plotter,
00122 const DataSource & source );
00123
00124
00129 void writeNTupleToFile ( const DataSource * ntuple,
00130 const std::string & filename );
00131
00136 void writeNTupleToFile ( const std::string & name,
00137 const std::string & filename );
00138
00143 void writeImageToFile ( unsigned int x, unsigned int y,
00144 const std::vector <double> & data,
00145 const std::string & filename );
00146
00156 int writeNTupleToFile ( const DataSource * source,
00157 const std::string & filename,
00158 const std::string & name,
00159 const std::vector < std::string > & column_list,
00160 const std::vector < const TupleCut * > & cut_list );
00161
00162
00163 };
00164
00165 }
00166
00167 #endif // FitsController_H