NtupleReader/NtupleReader/MyTextFileReader.h

00001 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00002 // 10.12.2006, AUTHOR: STEFFEN KAISER
00003 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00004 
00005 #ifndef MyTextFileReaderH
00006 #define MyTextFileReaderH
00007 
00008 //::::::::::::::::::::::::::::
00009 //:: CLASS MyTextFileReader ::
00010 //::::::::::::::::::::::::::::
00011 
00021 
00022 //::::::::::::::::::
00023 //:: HEADER FILES ::
00024 //::::::::::::::::::
00025 
00026 // STL //
00027 
00028 #include <iostream> 
00029 #include <fstream> 
00030 
00031 #include <string>
00032 #include <vector>
00033 #include <map>
00034 
00035 // // ROOT //
00036 #include "TString.h"
00037 // #include "TTree.h"
00038 // #include "TArrayF.h"
00039 // #include "TArrayI.h"
00040 
00041 
00042 class MyTextFileReader {
00043 
00044 public:
00045     // Constructors //
00046     MyTextFileReader(void) {
00047         init("");
00048     }
00050         
00051     MyTextFileReader(TString textfilename) {
00052         init(textfilename);
00053     }
00056   
00057     ~MyTextFileReader(void) {
00058         destruct();
00059     }
00061 
00062     // Methods //
00063         
00064     TString get_textfilename(void);           
00066         
00067     TString get_string(TString key_string);     
00069 
00070     Bool_t get_bool(TString key_string);     
00072     
00073     int get_int(TString key_string);     
00074                    //read string after key: 'key_string = ' from textfile 
00075 
00076     template <class MyType> MyType 
00077     retrieve_from_file(TString key_string, TString filename = "");
00080 
00081     void fill_cutvalue_map(TString cutstring, TString filename = "");
00085 
00086     Double_t get_cutvalue(TString variable);
00089 
00090 private:
00091     // private variables and methods //
00092 
00093     TString  m_textfilename;
00094 
00095 
00096     // define map to store the cutvalues
00097     typedef std::map<TString, Double_t> maptype;
00098     typedef maptype::value_type  ValuePair;
00099 
00100     maptype m_cutvalue_map;
00101 
00102     void init(TString textfilename);
00103          // initialization method (variables as defined
00104          // in the constructor of this class)
00105     void destruct(void);
00106          // destruction method
00107 
00108 };
00109 
00110 #endif

Generated on Tue Oct 21 11:50:45 2008 for NtupleAnalysis by  doxygen 1.5.1