ThePEG  1.8.0
AnalysisFactory.h
1 // -*- C++ -*-
2 //
3 // AnalysisFactory.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2011 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 2 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef LWH_AnalysisFactory_H
10 #define LWH_AnalysisFactory_H
11 //
12 // This is the declaration of the AnalysisFactory class.
13 //
14 
15 #include "AIAnalysisFactory.h"
16 #include "TreeFactory.h"
17 #include "HistogramFactory.h"
18 #include "DataPointSetFactory.h"
19 #include <set>
20 
35 namespace LWH {
36 
37 using namespace AIDA;
38 
44 class AnalysisFactory: public IAnalysisFactory {
45 
46 public:
48  virtual ~AnalysisFactory() {
49  clear();
50  }
51 
56  ITreeFactory * createTreeFactory() {
57  return new TreeFactory;
58  }
59 
66  IHistogramFactory * createHistogramFactory(ITree & tree) {
67  Tree & tr = dynamic_cast<Tree &>(tree);
68  HistogramFactory * hf = new HistogramFactory(tr);
69  histfacs.insert(hf);
70  return hf;
71  }
72 
78  IDataPointSetFactory * createDataPointSetFactory(ITree & tree) {
79  Tree & tr = dynamic_cast<Tree &>(tree);
81  datafacs.insert(df);
82  return df;
83  }
84 
89  ITupleFactory * createTupleFactory(ITree &) {
90  return 0;
91  }
92 
97  IFunctionFactory * createFunctionFactory(ITree &) {
98  return 0;
99  }
100 
105  IPlotterFactory * createPlotterFactory(int = 0, char * * = 0,
106  const std::string & = "",
107  const std::string & = "") {
108  return 0;
109  }
110 
115  IFitFactory * createFitFactory() {
116  return 0;
117  }
118 
119 private:
120 
122  void clear() {
123  for ( std::set<HistogramFactory *>::iterator it = histfacs.begin();
124  it != histfacs.end(); ++it ) delete *it;
125  for ( std::set<DataPointSetFactory *>::iterator it = datafacs.begin();
126  it != datafacs.end(); ++it ) delete *it;
127  for ( std::set<TreeFactory *>::iterator it = treefacs.begin();
128  it != treefacs.end(); ++it ) delete *it;
129  histfacs.clear();
130  datafacs.clear();
131  treefacs.clear();
132  }
133 
135  std::set<HistogramFactory *> histfacs;
136 
138  std::set<DataPointSetFactory *> datafacs;
139 
141  std::set<TreeFactory *> treefacs;
142 
143 };
144 
145 }
146 
147 #endif /* LWH_AnalysisFactory_H */