00001
00002
00003
00004
00005
00006
00007 #ifndef AIDAHISTOMANAGER_H
00008 #define AIDAHISTOMANAGER_H
00009
00010
00011
00012 #include <strstream>
00013 #include <iostream>
00014 #include <string>
00015 #include <map>
00016 #include "Interfaces/IHistoManager.h"
00017
00018
00019
00020
00021 #ifdef AIDA_STD
00022 # undef AIDA_STD
00023 #endif
00024 #ifdef AIDA_NOT_USE_STD
00025 # define AIDA_STD
00026 #else
00027 # define AIDA_STD std
00028 #endif
00029
00030 namespace Anaphe {
00031
00032
00033
00034 class IAnnotation;
00035 class IHistogram1D;
00036 class IHistogram2D;
00037 class IHistogram3D;
00038 class IProfileHistogram;
00039 class IHistoFactory;
00040
00041 namespace AIDA_HBook {
00042
00043
00044
00045 typedef AIDA_STD::map<AIDA_STD::string,IHistogram1D*>::iterator map1DIt;
00046 typedef AIDA_STD::map<AIDA_STD::string,IHistogram1D*>::const_iterator map1DCIt;
00047 typedef AIDA_STD::map<AIDA_STD::string,IHistogram2D*>::iterator map2DIt;
00048 typedef AIDA_STD::map<AIDA_STD::string,IHistogram2D*>::const_iterator map2DCIt;
00049 typedef AIDA_STD::map<AIDA_STD::string,IProfileHistogram*>::iterator mapProfIt;
00050 typedef AIDA_STD::map<AIDA_STD::string,IProfileHistogram*>::const_iterator mapProfCIt;
00051
00052
00053
00054 class AIDAHistoManager : virtual public IHistoManager
00055 {
00056 public:
00057
00058 AIDAHistoManager(IHistoFactory* f = 0);
00059 virtual ~AIDAHistoManager(void);
00060
00061
00062 bool unregister(IHistogram*);
00063 bool register1D(IHistogram1D*);
00064 bool register2D(IHistogram2D*);
00065 bool register3D(IHistogram3D*);
00066 bool registerProf(IProfileHistogram*);
00067 IHistogram1D* retrieveHisto1D(const char* label);
00068 IHistogram2D* retrieveHisto2D(const char* label);
00069 IHistogram3D* retrieveHisto3D(const char* label);
00070 IProfileHistogram* retrieveProf(const char* label);
00071 void deleteHisto(const char* label);
00072 void list(AIDA_STD::ostream& os);
00073 void disableOverwrite(void);
00074 void enableOverwrite(void);
00075 void disableWarnOverwrite(void);
00076 void enableWarnOverwrite(void);
00077 void setFactory(IHistoFactory*);
00078 IHistogram1D* create1D(const char* label, const char* title="",
00079 int nBinsx = 10, double xmin = 0.0, double xmax = 10.0,
00080 const char* options = 0);
00081 IHistogram2D* create2D(const char* label, const char* title = "",
00082 int nBinsx = 10, double xmin = 0.0, double xmax = 10.0,
00083 int nBinsy = 10, double ymin = 0.0, double ymax = 10.0,
00084 const char* options = 0);
00085 IHistogram3D* create3D(const char* label, const char* title="",
00086 int nBinsx = 10, double xmin = 0.0, double xmax = 10.0,
00087 int nBinsy = 10, double ymin = 0.0, double ymax = 10.0,
00088 int nBinsz = 10, double zmin = 0.0, double zmax = 10.0,
00089 const char *options = 0);
00090 virtual IProfileHistogram*
00091 createProfile(const char* label, const char* title,
00092 int nBinsx = 10, double xmin = 0.0, double xmax = 10.0,
00093 const char* options = 0);
00094 IHistogram1D* createDynamic1D(const char* label, const char* title = "",
00095 const int nBinsx = 100);
00096 virtual IHistogram1D* create1DVar(const char* label, const char* title,
00097 AIDA_STD::vector<float> binEdge,
00098 const char* options = 0);
00099 virtual IHistogram2D* create2DVar(const char* label, const char* title,
00100 AIDA_STD::vector<float> binEdgeX,
00101 AIDA_STD::vector<float> binEdgeY,
00102 const char* options = 0);
00103 IHistogram1D* load1D(const char* label);
00104 IHistogram2D* load2D(const char* label);
00105 IHistogram3D* load3D(const char* label);
00106 IProfileHistogram* loadProf(const char* label);
00107 void scratchHisto(const char* label);
00108 void store(const char* label);
00109 void selectStore(const char* name, const char* topDir = 0);
00110 void mkdir(const char* name);
00111 void rmdir(const char* name);
00112 void cd(const char* name);
00113 void ls(void) const;
00114 void pwd(void) const;
00115
00116 private:
00117 void notDoneMessage(const AIDA_STD::string& featureName) const;
00118 void notInHBOOKMessage(const AIDA_STD::string& featureName) const;
00119 void registerErrorMessage(void) const;
00120 void histoNotFoundMessage(const AIDA_STD::string& label) const;
00121 void noOverwriteMessage(const AIDA_STD::string& label) const;
00122 void deletionSuccessfulMessage(const AIDA_STD::string& label) const;
00123 void crisisMessage(const AIDA_STD::string& featureName) const;
00124 void cleanUp(void);
00125 bool checkAndDeleteHisto(const AIDA_STD::string& label);
00126 bool in1DList(const AIDA_STD::string& label) const;
00127 bool in2DList(const AIDA_STD::string& label) const;
00128 bool inProfList(const AIDA_STD::string& label) const;
00129 void formPrint(AIDA_STD::ostream&, const AIDA_STD::string& label,
00130 const AIDA_STD::string& title) const;
00131 bool removeWithWarnings(const AIDA_STD::string& label,
00132 IHistogram* histo);
00133
00134 private:
00135 AIDA_STD::map<AIDA_STD::string,IHistogram1D*> histo1DList;
00136 AIDA_STD::map<AIDA_STD::string,IHistogram2D*> histo2DList;
00137 AIDA_STD::map<AIDA_STD::string,IProfileHistogram*> histoProfList;
00138 IHistoFactory* hFact;
00139 bool ownsFactory;
00140 bool overwriteHisto;
00141 bool warnOverwrite;
00142
00143 };
00144
00145 }
00146 }
00147
00148 #endif
00149