#ifndef __OMPWARPPERS_HH__ #define __OMPWARPPERS_HH__ #include #include #include #include #include #include #include //! OMP Wrapper base class for ROOT histograms /*! This class defines three constructors that use the same sysntax as the ROOT TH histograms. The main point is that the constructors allocate as many lists as OMP can produce threads. This way a non blocking filling of this buffers with the Fill() functions is possible. */ class OMPTH{ public: //! Constructor for TH1 histograms OMPTH(const char* name, const char* title, Int_t nbinsx, Double_t xlow, Double_t xup); //! Constructor for TH2 histograms OMPTH(const char* name, const char* title, Int_t nbinsx, Double_t xlow, Double_t xup, Int_t nbinsy, Double_t ylow, Double_t yup); //! Constructor for TH3 histogrms OMPTH(const char* name, const char* title, Int_t nbinsx, Double_t xlow, Double_t xup, Int_t nbinsy, Double_t ylow, Double_t yup, Int_t nbinsz, Double_t zlow, Double_t zup); //! Fill function for TH1 void Fill(double val); //! Fill function for TH2 void Fill(double val, double val2); //! Fill function for TH3 void Fill(double val, double val2, double val3); //! destructor ~OMPTH(); protected: std::string hname; //!< name of the histogram std::string htitle; //!< histogram title Int_t binsx; //!< number of bins in X direction Double_t xl; //!< lower boundry on X axis Double_t xu; //!< higher boundry on X axis Int_t binsy; //!< number of bins in Y direction Double_t yl; //!< lower boundry on Y axis Double_t yu; //!< higher boundry on Y axis Int_t binsz; //!< number of bins in Z direction Double_t zl; //!< lower boundry on Z axis Double_t zu; //!< higher boundry on Z axis int maxthreads; //!< maximum number of threads std::list *data1; //!< data storage for TH1 std::list *data2; //!< data storage for TH2 std::list *data3; //!< data storage for TH3 }; //! OMP wrapper class for TH1 histograms template class OMPTH1 : public OMPTH { public: //! constructor for TH1 OMPTH1(const char* name, const char* title, Int_t nbinsx, Double_t xlow, Double_t xup): OMPTH(name, title, nbinsx, xlow, xup) {} //! returns histogram of specified type /*! this function allocates a new TH1 histogram and fills it with the values drom the @ref OMPTH::data1 lists. */ T* gethisto(); //! destructor ~OMPTH1(){OMPTH::~OMPTH(this);} }; //! OMP wrapper class for TH2 histograms template class OMPTH2 : public OMPTH { public: //! constructor for TH2 OMPTH2(const char* name, const char* title, Int_t nbinsx, Double_t xlow, Double_t xup, Int_t nbinsy, Double_t ylow, Double_t yup): OMPTH(name, title, nbinsx, xlow, xup, nbinsy, ylow, yup ) {} //! returns histogram of specified type /*! this function allocates a new TH2 histogram and fills it with the values drom the @ref OMPTH::data1 and @ref OMPTH::data2 lists. */ T* gethisto(); //! destructor ~OMPTH2(){OMPTH::~OMPTH(this);} }; //! OMP wrapper class for TH3 histograms template class OMPTH3 : public OMPTH { public: //! constructor for TH3 OMPTH3(const char* name, const char* title, Int_t nbinsx, Double_t xlow, Double_t xup, Int_t nbinsy, Double_t ylow, Double_t yup, Int_t nbinsz, Double_t zlow, Double_t zup): OMPTH(name, title, nbinsx, xlow, xup, nbinsy, ylow, yup, nbinsz, zlow, zup) {} //! returns histogram of specified type /*! this function allocates a new TH3 histogram and fills it with the values drom the @ref OMPTH::data1 ,@ref OMPTH::data2 and @ref OMPTH::data3 lists. */ T* gethisto(); //! destructor ~OMPTH3(){OMPTH::~OMPTH(this);} }; #include"OMPwrappers.icc" #endif