00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef _GDS_XSILHISTOGRAM_HH
00040 #define _GDS_XSILHISTOGRAM_HH
00041
00042 #include <string>
00043 #include <iosfwd>
00044 #include "xml/Xsil.hh"
00045 #include "Histogram1.hh"
00046 #include "Histogram2.hh"
00047
00048 namespace xml {
00049
00070 class xsilHistogram {
00071 protected:
00073 int fLevel;
00075 const Histogram1* fH1;
00077 const Histogram2* fH2;
00078 public:
00080 xsilHistogram (int level = 1)
00081 : fLevel(level), fH1 (0), fH2 (0) {
00082 }
00084 xsilHistogram (const Histogram1* h1, int level = 1)
00085 : fLevel(level), fH1 (h1), fH2 (0) {
00086 }
00088 xsilHistogram (const Histogram1& h1, int level = 1)
00089 : fLevel(level), fH1 (&h1), fH2 (0) {
00090 }
00092 xsilHistogram (const Histogram2* h2, int level = 1)
00093 : fLevel(level), fH1 (0), fH2 (h2) {
00094 }
00096 xsilHistogram (const Histogram2& h2, int level = 1)
00097 : fLevel(level), fH1 (0), fH2 (&h2) {
00098 }
00100 std::ostream& write (std::ostream &os) const;
00101 };
00102
00103
00111 inline std::ostream& operator<< (std::ostream &os,
00112 const xsilHistogram &h) {
00113 return h.write(os); }
00114
00136
00143 class xsilHandlerHistogram : public xsilHandler {
00144 protected:
00146 std::vector<Histogram1>* fDat1;
00148 std::vector<Histogram2>* fDat2;
00149
00151 std::string fTitle;
00153 std::string fLabel[4];
00155 int fSubtype;
00157 unsigned long fSec;
00159 unsigned long fNsec;
00161 int fNBin[3];
00163 int fNData;
00165 double fSumWeight;
00167 double fSumWeightSqr;
00169 double fSumWeightDim[3];
00171 double fSumWeightDimSqr[3];
00173 double fSumWeightXY;
00175 double fLowEdge[3];
00177 double fSpacing[3];
00179 double* fBins[3];
00181 int fBinsLen[3];
00183 double* fErrors;
00185 int fErrorsDim[3];
00187 double* fData;
00189 int fDataDim[3];
00190
00191 public:
00193 explicit xsilHandlerHistogram (std::vector<Histogram1>* objs1,
00194 std::vector<Histogram2>* objs2,
00195 const attrlist *attr=0, bool ignore=false);
00197 virtual ~xsilHandlerHistogram();
00199 virtual bool HandleParameter (const std::string& name,
00200 const attrlist& attr,
00201 const bool& p, int N = 1) {
00202 return false; }
00204 virtual bool HandleParameter(const std::string& name,
00205 const attrlist& attr,
00206 const char& p, int N = 1) {
00207 return false; }
00209 virtual bool HandleParameter(const std::string& name,
00210 const attrlist& attr,
00211 const short& p, int N = 1) {
00212 return false; }
00214 virtual bool HandleParameter(const std::string& name,
00215 const attrlist& attr,
00216 const int& p, int N=1);
00217 #ifndef __CINT__
00219 virtual bool HandleParameter(const std::string& name,
00220 const attrlist& attr,
00221 const long long& p, int N=1) {
00222 return false; }
00223 #endif //__CINT__
00225 virtual bool HandleParameter(const std::string& name,
00226 const attrlist& attr,
00227 const float& p, int N=1) {
00228 return false; }
00230 virtual bool HandleParameter(const std::string& name,
00231 const attrlist& attr,
00232 const double& p, int N=1);
00234 virtual bool HandleParameter(const std::string& name,
00235 const attrlist& attr,
00236 const std::complex<float>& p, int N = 1) {
00237 return false; }
00239 virtual bool HandleParameter(const std::string& name,
00240 const attrlist& attr,
00241 const std::complex<double>& p, int N = 1) {
00242 return false; }
00244 virtual bool HandleParameter(const std::string& name,
00245 const attrlist& attr,
00246 const std::string& p);
00248 virtual bool HandleTime (const std::string& name,
00249 const attrlist& attr,
00250 unsigned long sec, unsigned long nsec);
00252 virtual bool HandleData (const std::string& name, float* x,
00253 int dim1, int dim2=0, int dim3=0, int dim4=0) {
00254 return false; }
00256 virtual bool HandleData (const std::string& name,
00257 std::complex<float>* x,
00258 int dim1, int dim2=0, int dim3=0, int dim4=0) {
00259 return false; }
00261 virtual bool HandleData (const std::string& name, double* x,
00262 int dim1, int dim2=0, int dim3=0, int dim4=0);
00264 virtual bool HandleData (const std::string& name,
00265 std::complex<double>* x,
00266 int dim1, int dim2=0, int dim3=0, int dim4=0) {
00267 return false; }
00268 };
00269
00277 class xsilHandlerQueryHistogram : public xsilHandlerQuery {
00278 protected:
00280 std::vector<Histogram1>* fDat1;
00282 std::vector<Histogram2>* fDat2;
00283
00284 public:
00286 explicit xsilHandlerQueryHistogram (std::vector<Histogram1>& h1)
00287 : fDat1 (&h1), fDat2 (0) {
00288 }
00290 explicit xsilHandlerQueryHistogram (std::vector<Histogram2>& h2)
00291 : fDat1 (0), fDat2 (&h2) {
00292 }
00294 explicit xsilHandlerQueryHistogram (std::vector<Histogram1>& h1,
00295 std::vector<Histogram2>& h2)
00296 : fDat1 (&h1), fDat2 (&h2) {
00297 }
00299 virtual xsilHandler* GetHandler (const attrlist& attr);
00300 };
00302
00303 }
00304
00305 #endif // _GDS_XSILHISTOGRAM_HH