00001 // -*- C++ -*- 00002 // 00003 // AnalysisFactory.h is a part of ThePEG - Toolkit for HEP Event Generation 00004 // Copyright (C) 1999-2007 Leif Lonnblad 00005 // 00006 // ThePEG is licenced under version 2 of the GPL, see COPYING for details. 00007 // Please respect the MCnet academic guidelines, see GUIDELINES for details. 00008 // 00009 #ifndef LWH_AnalysisFactory_H 00010 #define LWH_AnalysisFactory_H 00011 // 00012 // This is the declaration of the AnalysisFactory class. 00013 // 00014 00015 #include "AIAnalysisFactory.h" 00016 #include "TreeFactory.h" 00017 #include "HistogramFactory.h" 00018 #include "DataPointSetFactory.h" 00019 #include <set> 00020 00035 namespace LWH { 00036 00037 using namespace AIDA; 00038 00044 class AnalysisFactory: public IAnalysisFactory { 00045 00046 public: 00048 virtual ~AnalysisFactory() { 00049 clear(); 00050 } 00051 00056 ITreeFactory * createTreeFactory() { 00057 return new TreeFactory; 00058 } 00059 00066 IHistogramFactory * createHistogramFactory(ITree & tree) { 00067 Tree & tr = dynamic_cast<Tree &>(tree); 00068 HistogramFactory * hf = new HistogramFactory(tr); 00069 histfacs.insert(hf); 00070 return hf; 00071 } 00072 00078 IDataPointSetFactory * createDataPointSetFactory(ITree & tree) { 00079 Tree & tr = dynamic_cast<Tree &>(tree); 00080 DataPointSetFactory * df = new DataPointSetFactory(tr); 00081 datafacs.insert(df); 00082 return df; 00083 } 00084 00089 ITupleFactory * createTupleFactory(ITree &) { 00090 return 0; 00091 } 00092 00097 IFunctionFactory * createFunctionFactory(ITree &) { 00098 return 0; 00099 } 00100 00105 IPlotterFactory * createPlotterFactory(int = 0, char * * = 0, 00106 const std::string & = "", 00107 const std::string & = "") { 00108 return 0; 00109 } 00110 00115 IFitFactory * createFitFactory() { 00116 return 0; 00117 } 00118 00119 private: 00120 00122 void clear() { 00123 for ( std::set<HistogramFactory *>::iterator it = histfacs.begin(); 00124 it != histfacs.end(); ++it ) delete *it; 00125 for ( std::set<DataPointSetFactory *>::iterator it = datafacs.begin(); 00126 it != datafacs.end(); ++it ) delete *it; 00127 for ( std::set<TreeFactory *>::iterator it = treefacs.begin(); 00128 it != treefacs.end(); ++it ) delete *it; 00129 histfacs.clear(); 00130 datafacs.clear(); 00131 treefacs.clear(); 00132 } 00133 00135 std::set<HistogramFactory *> histfacs; 00136 00138 std::set<DataPointSetFactory *> datafacs; 00139 00141 std::set<TreeFactory *> treefacs; 00142 00143 }; 00144 00145 } 00146 00147 #endif /* LWH_AnalysisFactory_H */