diff --git a/CHANGES b/CHANGES
new file mode 100644
--- /dev/null
+++ b/CHANGES
@@ -0,0 +1,39 @@
+0.5.0: 31 Jul 2011
+   * initial preview release
+
+0.5.1: 3 Aug 2011
+   * support for delete 
+
+0.6: 16 Aug 2011
+   * implement Deletable. delete method for every object
+   * refactor HROOT generated file names (Interface.hs, Implementation.hs, FFI.hs) 
+
+0.6.3: 22 Sep 2011 
+   * Implement Existential Types 
+
+0.6.4: 28 Sep 2011 
+   * add many TH2 class methods
+
+0.6.6: 7 Oct 2011 
+   * do not need OverlappingInstances, IncoherentInstances, UndecidableInstances 
+
+
+0.6.7: 18 Oct 2011
+   * implement almost all TH1 class methods
+
+0.6.8: 20 Oct 2011
+   * implement almost all class methods of TH2, TH3, TFormula, TF1 and TGraph
+
+0.6.9: 20 Oct 2011 
+   * implement almost all class methods of TLine, TAttLine, TAttMarker, TAttText and TAttPad
+
+0.7 : 8 Nov 2011
+   * separate all class interfaces and implementation in different modules
+   * overhaul Existential 
+
+0.7.1 : 12 Nov 2011 
+   * support for static methods
+   * add TROOT
+
+0.8 : 17 Jun 2014
+   * separate packages into HROOT-core, HROOT-hist, HROOT-io, HROOT-math, HROOT-graf and HROOT is now an umbrella package
diff --git a/Config.hs b/Config.hs
new file mode 100644
--- /dev/null
+++ b/Config.hs
@@ -0,0 +1,85 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+
+module Config where
+ 
+import Distribution.Simple
+import Distribution.Simple.Setup
+import Distribution.PackageDescription
+import Distribution.Simple.LocalBuildInfo
+
+import System.Exit
+import System.Process
+
+config :: LocalBuildInfo -> IO (Maybe HookedBuildInfo)
+config bInfo = do 
+  (excode, out, err) <- readProcessWithExitCode "root-config" ["--glibs"] ""
+  liboptset' <- case excode of 
+                  ExitSuccess -> do  
+                    return . Just .  mkLibraryOptionSet . words $ out
+                  _ -> do 
+                    putStrLn $ "root-config failure but I am installing HROOT without ROOT. It will not work. This is only for documentation." 
+                    return Nothing              
+  (excode2,out2,err2) <- readProcessWithExitCode "root-config" ["--incdir"] ""
+  incdir' <- case excode2 of 
+               ExitSuccess -> do  
+                 return . Just . head . words $ out2
+               _ -> do 
+                 putStrLn $ "root-config failure but I am installing HROOT without ROOT. It will not work. This is only for documentation." 
+                 return Nothing
+  let Just lib = library . localPkgDescr $ bInfo
+      buildinfo = libBuildInfo lib
+  let (r :: Maybe HookedBuildInfo) = case liboptset' of 
+            Nothing -> Nothing
+            Just liboptset -> 
+              case incdir' of 
+                Nothing -> Nothing 
+                Just incdir -> 
+                  let hbi = emptyBuildInfo { extraLibs = extraLibs buildinfo 
+                                                         ++ libs liboptset
+                                           , extraLibDirs = libdirs liboptset 
+                                           , includeDirs = incdir : includeDirs buildinfo
+                                           }
+                  in Just (Just hbi, []) 
+  return r 
+
+
+data LibraryOptionSet = LibraryOptionSet { 
+  libs :: [String], 
+  libdirs :: [String], 
+  libopts :: [String]
+} deriving Show
+
+data LibraryOption = Lib String 
+                   | Dir String
+                   | Opt String 
+                   deriving Show
+
+mkLibraryOptionSet :: [String] -> LibraryOptionSet
+mkLibraryOptionSet strs = let opts = libraryOptions strs
+                          in  foldr f (LibraryOptionSet [] [] []) opts 
+  where f x (LibraryOptionSet l d o) = case x of
+                                         Lib st -> LibraryOptionSet (st:l) d o 
+                                         Dir st -> LibraryOptionSet l (st:d) o 
+                                         Opt st -> LibraryOptionSet l d (st:o) 
+
+libraryOptions :: [String] -> [LibraryOption] -- LibraryOptionSet 
+libraryOptions = map f 
+  where f x = let r = parseLibraryOptionClassifier x
+              in  case r of 
+                    Left msg -> error (show msg)
+                    Right result -> result
+
+
+parseLibraryOptionClassifier :: String -> Either String LibraryOption 
+parseLibraryOptionClassifier [] = Left "empty option"
+parseLibraryOptionClassifier str@(x:xs) = 
+  case x of
+    '-' -> if null xs 
+             then Left "parse error"
+             else let (y:ys) = xs
+                  in  case y of
+                        'L' -> Right (Dir ys)
+                        'l' -> Right (Lib ys)
+                        _ -> Right (Opt str)
+    _ -> Right (Opt str) 
+
diff --git a/HROOT-hist.cabal b/HROOT-hist.cabal
new file mode 100644
--- /dev/null
+++ b/HROOT-hist.cabal
@@ -0,0 +1,323 @@
+Name:		HROOT-hist
+Version:	0.8
+Synopsis:	Haskell binding to ROOT Hist modules
+Description: 	HROOT is a haskell Foreign Function Interface (FFI) binding to ROOT. ROOT(http://root.cern.ch) is an object-oriented program and library developed by CERN for physics data analysis.
+Homepage:       http://ianwookim.org/HROOT
+License:        LGPL-2.1
+License-file:   LICENSE
+Author:		Ian-Woo Kim
+Maintainer: 	Ian-Woo Kim <ianwookim@gmail.com>
+Category:       Graphics, Statistics, Math, Numerical
+Tested-with:    GHC >= 7.6
+Build-Type: 	Custom
+cabal-version:  >=1.10
+Extra-source-files: 
+                       CHANGES
+                       Config.hs
+                       csrc/HROOTHistTAxis.h
+                       csrc/HROOTHistTF1.h
+                       csrc/HROOTHistTFormula.h
+                       csrc/HROOTHistTGraph.h
+                       csrc/HROOTHistTGraphAsymmErrors.h
+                       csrc/HROOTHistTGraphBentErrors.h
+                       csrc/HROOTHistTGraphErrors.h
+                       csrc/HROOTHistTH1.h
+                       csrc/HROOTHistTH1C.h
+                       csrc/HROOTHistTH1D.h
+                       csrc/HROOTHistTH1F.h
+                       csrc/HROOTHistTH1I.h
+                       csrc/HROOTHistTH1K.h
+                       csrc/HROOTHistTH1S.h
+                       csrc/HROOTHistTH2.h
+                       csrc/HROOTHistTH2C.h
+                       csrc/HROOTHistTH2D.h
+                       csrc/HROOTHistTH2F.h
+                       csrc/HROOTHistTH2I.h
+                       csrc/HROOTHistTH2Poly.h
+                       csrc/HROOTHistTH2S.h
+                       csrc/HROOTHistTH3.h
+                       csrc/HROOTHistTH3C.h
+                       csrc/HROOTHistTH3D.h
+                       csrc/HROOTHistTH3F.h
+                       csrc/HROOTHistTH3I.h
+                       csrc/HROOTHistTH3S.h
+                       csrc/HROOTHistTHStack.h
+                       csrc/HROOTHistTAxis.cpp
+                       csrc/HROOTHistTF1.cpp
+                       csrc/HROOTHistTFormula.cpp
+                       csrc/HROOTHistTGraph.cpp
+                       csrc/HROOTHistTGraphAsymmErrors.cpp
+                       csrc/HROOTHistTGraphBentErrors.cpp
+                       csrc/HROOTHistTGraphErrors.cpp
+                       csrc/HROOTHistTH1.cpp
+                       csrc/HROOTHistTH1C.cpp
+                       csrc/HROOTHistTH1D.cpp
+                       csrc/HROOTHistTH1F.cpp
+                       csrc/HROOTHistTH1I.cpp
+                       csrc/HROOTHistTH1K.cpp
+                       csrc/HROOTHistTH1S.cpp
+                       csrc/HROOTHistTH2.cpp
+                       csrc/HROOTHistTH2C.cpp
+                       csrc/HROOTHistTH2D.cpp
+                       csrc/HROOTHistTH2F.cpp
+                       csrc/HROOTHistTH2I.cpp
+                       csrc/HROOTHistTH2Poly.cpp
+                       csrc/HROOTHistTH2S.cpp
+                       csrc/HROOTHistTH3.cpp
+                       csrc/HROOTHistTH3C.cpp
+                       csrc/HROOTHistTH3D.cpp
+                       csrc/HROOTHistTH3F.cpp
+                       csrc/HROOTHistTH3I.cpp
+                       csrc/HROOTHistTH3S.cpp
+                       csrc/HROOTHistTHStack.cpp
+
+
+
+
+Library
+  default-language: Haskell2010
+  hs-source-dirs: src
+  ghc-options:  -Wall -funbox-strict-fields -fno-warn-unused-do-bind -fno-warn-orphans -fno-warn-unused-imports
+  ghc-prof-options: -caf-all -auto-all
+  Build-Depends:      base>4 && < 5, fficxx-runtime >= 0.0.999 ,HROOT-core
+  Exposed-Modules:
+                       HROOT.Hist
+                       HROOT.Hist.TAxis
+                       HROOT.Hist.TF1
+                       HROOT.Hist.TFormula
+                       HROOT.Hist.TGraph
+                       HROOT.Hist.TGraphAsymmErrors
+                       HROOT.Hist.TGraphBentErrors
+                       HROOT.Hist.TGraphErrors
+                       HROOT.Hist.TH1
+                       HROOT.Hist.TH1C
+                       HROOT.Hist.TH1D
+                       HROOT.Hist.TH1F
+                       HROOT.Hist.TH1I
+                       HROOT.Hist.TH1K
+                       HROOT.Hist.TH1S
+                       HROOT.Hist.TH2
+                       HROOT.Hist.TH2C
+                       HROOT.Hist.TH2D
+                       HROOT.Hist.TH2F
+                       HROOT.Hist.TH2I
+                       HROOT.Hist.TH2Poly
+                       HROOT.Hist.TH2S
+                       HROOT.Hist.TH3
+                       HROOT.Hist.TH3C
+                       HROOT.Hist.TH3D
+                       HROOT.Hist.TH3F
+                       HROOT.Hist.TH3I
+                       HROOT.Hist.TH3S
+                       HROOT.Hist.THStack
+                       HROOT.Hist.TAxis.RawType
+                       HROOT.Hist.TF1.RawType
+                       HROOT.Hist.TFormula.RawType
+                       HROOT.Hist.TGraph.RawType
+                       HROOT.Hist.TGraphAsymmErrors.RawType
+                       HROOT.Hist.TGraphBentErrors.RawType
+                       HROOT.Hist.TGraphErrors.RawType
+                       HROOT.Hist.TH1.RawType
+                       HROOT.Hist.TH1C.RawType
+                       HROOT.Hist.TH1D.RawType
+                       HROOT.Hist.TH1F.RawType
+                       HROOT.Hist.TH1I.RawType
+                       HROOT.Hist.TH1K.RawType
+                       HROOT.Hist.TH1S.RawType
+                       HROOT.Hist.TH2.RawType
+                       HROOT.Hist.TH2C.RawType
+                       HROOT.Hist.TH2D.RawType
+                       HROOT.Hist.TH2F.RawType
+                       HROOT.Hist.TH2I.RawType
+                       HROOT.Hist.TH2Poly.RawType
+                       HROOT.Hist.TH2S.RawType
+                       HROOT.Hist.TH3.RawType
+                       HROOT.Hist.TH3C.RawType
+                       HROOT.Hist.TH3D.RawType
+                       HROOT.Hist.TH3F.RawType
+                       HROOT.Hist.TH3I.RawType
+                       HROOT.Hist.TH3S.RawType
+                       HROOT.Hist.THStack.RawType
+                       HROOT.Hist.TAxis.FFI
+                       HROOT.Hist.TF1.FFI
+                       HROOT.Hist.TFormula.FFI
+                       HROOT.Hist.TGraph.FFI
+                       HROOT.Hist.TGraphAsymmErrors.FFI
+                       HROOT.Hist.TGraphBentErrors.FFI
+                       HROOT.Hist.TGraphErrors.FFI
+                       HROOT.Hist.TH1.FFI
+                       HROOT.Hist.TH1C.FFI
+                       HROOT.Hist.TH1D.FFI
+                       HROOT.Hist.TH1F.FFI
+                       HROOT.Hist.TH1I.FFI
+                       HROOT.Hist.TH1K.FFI
+                       HROOT.Hist.TH1S.FFI
+                       HROOT.Hist.TH2.FFI
+                       HROOT.Hist.TH2C.FFI
+                       HROOT.Hist.TH2D.FFI
+                       HROOT.Hist.TH2F.FFI
+                       HROOT.Hist.TH2I.FFI
+                       HROOT.Hist.TH2Poly.FFI
+                       HROOT.Hist.TH2S.FFI
+                       HROOT.Hist.TH3.FFI
+                       HROOT.Hist.TH3C.FFI
+                       HROOT.Hist.TH3D.FFI
+                       HROOT.Hist.TH3F.FFI
+                       HROOT.Hist.TH3I.FFI
+                       HROOT.Hist.TH3S.FFI
+                       HROOT.Hist.THStack.FFI
+                       HROOT.Hist.TAxis.Interface
+                       HROOT.Hist.TF1.Interface
+                       HROOT.Hist.TFormula.Interface
+                       HROOT.Hist.TGraph.Interface
+                       HROOT.Hist.TGraphAsymmErrors.Interface
+                       HROOT.Hist.TGraphBentErrors.Interface
+                       HROOT.Hist.TGraphErrors.Interface
+                       HROOT.Hist.TH1.Interface
+                       HROOT.Hist.TH1C.Interface
+                       HROOT.Hist.TH1D.Interface
+                       HROOT.Hist.TH1F.Interface
+                       HROOT.Hist.TH1I.Interface
+                       HROOT.Hist.TH1K.Interface
+                       HROOT.Hist.TH1S.Interface
+                       HROOT.Hist.TH2.Interface
+                       HROOT.Hist.TH2C.Interface
+                       HROOT.Hist.TH2D.Interface
+                       HROOT.Hist.TH2F.Interface
+                       HROOT.Hist.TH2I.Interface
+                       HROOT.Hist.TH2Poly.Interface
+                       HROOT.Hist.TH2S.Interface
+                       HROOT.Hist.TH3.Interface
+                       HROOT.Hist.TH3C.Interface
+                       HROOT.Hist.TH3D.Interface
+                       HROOT.Hist.TH3F.Interface
+                       HROOT.Hist.TH3I.Interface
+                       HROOT.Hist.TH3S.Interface
+                       HROOT.Hist.THStack.Interface
+                       HROOT.Hist.TAxis.Cast
+                       HROOT.Hist.TF1.Cast
+                       HROOT.Hist.TFormula.Cast
+                       HROOT.Hist.TGraph.Cast
+                       HROOT.Hist.TGraphAsymmErrors.Cast
+                       HROOT.Hist.TGraphBentErrors.Cast
+                       HROOT.Hist.TGraphErrors.Cast
+                       HROOT.Hist.TH1.Cast
+                       HROOT.Hist.TH1C.Cast
+                       HROOT.Hist.TH1D.Cast
+                       HROOT.Hist.TH1F.Cast
+                       HROOT.Hist.TH1I.Cast
+                       HROOT.Hist.TH1K.Cast
+                       HROOT.Hist.TH1S.Cast
+                       HROOT.Hist.TH2.Cast
+                       HROOT.Hist.TH2C.Cast
+                       HROOT.Hist.TH2D.Cast
+                       HROOT.Hist.TH2F.Cast
+                       HROOT.Hist.TH2I.Cast
+                       HROOT.Hist.TH2Poly.Cast
+                       HROOT.Hist.TH2S.Cast
+                       HROOT.Hist.TH3.Cast
+                       HROOT.Hist.TH3C.Cast
+                       HROOT.Hist.TH3D.Cast
+                       HROOT.Hist.TH3F.Cast
+                       HROOT.Hist.TH3I.Cast
+                       HROOT.Hist.TH3S.Cast
+                       HROOT.Hist.THStack.Cast
+                       HROOT.Hist.TAxis.Implementation
+                       HROOT.Hist.TF1.Implementation
+                       HROOT.Hist.TFormula.Implementation
+                       HROOT.Hist.TGraph.Implementation
+                       HROOT.Hist.TGraphAsymmErrors.Implementation
+                       HROOT.Hist.TGraphBentErrors.Implementation
+                       HROOT.Hist.TGraphErrors.Implementation
+                       HROOT.Hist.TH1.Implementation
+                       HROOT.Hist.TH1C.Implementation
+                       HROOT.Hist.TH1D.Implementation
+                       HROOT.Hist.TH1F.Implementation
+                       HROOT.Hist.TH1I.Implementation
+                       HROOT.Hist.TH1K.Implementation
+                       HROOT.Hist.TH1S.Implementation
+                       HROOT.Hist.TH2.Implementation
+                       HROOT.Hist.TH2C.Implementation
+                       HROOT.Hist.TH2D.Implementation
+                       HROOT.Hist.TH2F.Implementation
+                       HROOT.Hist.TH2I.Implementation
+                       HROOT.Hist.TH2Poly.Implementation
+                       HROOT.Hist.TH2S.Implementation
+                       HROOT.Hist.TH3.Implementation
+                       HROOT.Hist.TH3C.Implementation
+                       HROOT.Hist.TH3D.Implementation
+                       HROOT.Hist.TH3F.Implementation
+                       HROOT.Hist.TH3I.Implementation
+                       HROOT.Hist.TH3S.Implementation
+                       HROOT.Hist.THStack.Implementation
+  
+  Other-Modules:
+
+  extra-lib-dirs: 
+  extra-libraries:    stdc++ 
+  Include-dirs:       csrc  
+  Install-includes:   
+                       HROOT-histType.h
+                       HROOTHistTAxis.h
+                       HROOTHistTF1.h
+                       HROOTHistTFormula.h
+                       HROOTHistTGraph.h
+                       HROOTHistTGraphAsymmErrors.h
+                       HROOTHistTGraphBentErrors.h
+                       HROOTHistTGraphErrors.h
+                       HROOTHistTH1.h
+                       HROOTHistTH1C.h
+                       HROOTHistTH1D.h
+                       HROOTHistTH1F.h
+                       HROOTHistTH1I.h
+                       HROOTHistTH1K.h
+                       HROOTHistTH1S.h
+                       HROOTHistTH2.h
+                       HROOTHistTH2C.h
+                       HROOTHistTH2D.h
+                       HROOTHistTH2F.h
+                       HROOTHistTH2I.h
+                       HROOTHistTH2Poly.h
+                       HROOTHistTH2S.h
+                       HROOTHistTH3.h
+                       HROOTHistTH3C.h
+                       HROOTHistTH3D.h
+                       HROOTHistTH3F.h
+                       HROOTHistTH3I.h
+                       HROOTHistTH3S.h
+                       HROOTHistTHStack.h
+
+  C-sources:          
+                       csrc/HROOTHistTAxis.cpp
+                       csrc/HROOTHistTF1.cpp
+                       csrc/HROOTHistTFormula.cpp
+                       csrc/HROOTHistTGraph.cpp
+                       csrc/HROOTHistTGraphAsymmErrors.cpp
+                       csrc/HROOTHistTGraphBentErrors.cpp
+                       csrc/HROOTHistTGraphErrors.cpp
+                       csrc/HROOTHistTH1.cpp
+                       csrc/HROOTHistTH1C.cpp
+                       csrc/HROOTHistTH1D.cpp
+                       csrc/HROOTHistTH1F.cpp
+                       csrc/HROOTHistTH1I.cpp
+                       csrc/HROOTHistTH1K.cpp
+                       csrc/HROOTHistTH1S.cpp
+                       csrc/HROOTHistTH2.cpp
+                       csrc/HROOTHistTH2C.cpp
+                       csrc/HROOTHistTH2D.cpp
+                       csrc/HROOTHistTH2F.cpp
+                       csrc/HROOTHistTH2I.cpp
+                       csrc/HROOTHistTH2Poly.cpp
+                       csrc/HROOTHistTH2S.cpp
+                       csrc/HROOTHistTH3.cpp
+                       csrc/HROOTHistTH3C.cpp
+                       csrc/HROOTHistTH3D.cpp
+                       csrc/HROOTHistTH3F.cpp
+                       csrc/HROOTHistTH3I.cpp
+                       csrc/HROOTHistTH3S.cpp
+                       csrc/HROOTHistTHStack.cpp
+
+
+   
+
+
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,502 @@
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+                  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                            NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/Setup.lhs b/Setup.lhs
new file mode 100644
--- /dev/null
+++ b/Setup.lhs
@@ -0,0 +1,33 @@
+#! /usr/bin/env runhaskell
+  
+> import Distribution.Simple
+> import Distribution.Simple.Setup
+> import Distribution.PackageDescription
+> import Distribution.Simple.LocalBuildInfo
+>
+> import Config
+>
+> myconfigHook = simpleUserHooks { confHook = hookfunction } 
+>
+> hookfunction x y = do 
+>   binfo <- confHook simpleUserHooks x y 
+>   r_pbi <- config binfo
+>   let pkg_descr = localPkgDescr binfo
+>   
+>   let newbinfo = case r_pbi of 
+>                    Just pbi ->  binfo { localPkgDescr = updatePackageDescription pbi pkg_descr }
+>                    Nothing -> do 
+>                      let r_lib = library pkg_descr 
+>                      case r_lib of
+>                        Just lib ->  
+>                          let binfo2 = libBuildInfo lib
+>                              newlib = lib { libBuildInfo = binfo2 { cSources = [] }}  
+>                          in  binfo { localPkgDescr = pkg_descr { library = Just newlib }}  
+>                        Nothing -> error "some library setting is wrong." 
+> --   putStrLn (show (localPkgDescr newbinfo))
+>   return newbinfo
+>  
+>
+> main = defaultMainWithHooks myconfigHook
+>
+
diff --git a/csrc/HROOT-histType.h b/csrc/HROOT-histType.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOT-histType.h
@@ -0,0 +1,152 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif
+
+#ifndef __HROOT_HIST__
+#define __HROOT_HIST__
+
+// Opaque type definition for TAxis 
+typedef struct TAxis_tag TAxis_t; 
+typedef TAxis_t * TAxis_p; 
+typedef TAxis_t const* const_TAxis_p; 
+
+// Opaque type definition for TF1 
+typedef struct TF1_tag TF1_t; 
+typedef TF1_t * TF1_p; 
+typedef TF1_t const* const_TF1_p; 
+
+// Opaque type definition for TFormula 
+typedef struct TFormula_tag TFormula_t; 
+typedef TFormula_t * TFormula_p; 
+typedef TFormula_t const* const_TFormula_p; 
+
+// Opaque type definition for TGraph 
+typedef struct TGraph_tag TGraph_t; 
+typedef TGraph_t * TGraph_p; 
+typedef TGraph_t const* const_TGraph_p; 
+
+// Opaque type definition for TGraphAsymmErrors 
+typedef struct TGraphAsymmErrors_tag TGraphAsymmErrors_t; 
+typedef TGraphAsymmErrors_t * TGraphAsymmErrors_p; 
+typedef TGraphAsymmErrors_t const* const_TGraphAsymmErrors_p; 
+
+// Opaque type definition for TGraphBentErrors 
+typedef struct TGraphBentErrors_tag TGraphBentErrors_t; 
+typedef TGraphBentErrors_t * TGraphBentErrors_p; 
+typedef TGraphBentErrors_t const* const_TGraphBentErrors_p; 
+
+// Opaque type definition for TGraphErrors 
+typedef struct TGraphErrors_tag TGraphErrors_t; 
+typedef TGraphErrors_t * TGraphErrors_p; 
+typedef TGraphErrors_t const* const_TGraphErrors_p; 
+
+// Opaque type definition for TH1 
+typedef struct TH1_tag TH1_t; 
+typedef TH1_t * TH1_p; 
+typedef TH1_t const* const_TH1_p; 
+
+// Opaque type definition for TH1C 
+typedef struct TH1C_tag TH1C_t; 
+typedef TH1C_t * TH1C_p; 
+typedef TH1C_t const* const_TH1C_p; 
+
+// Opaque type definition for TH1D 
+typedef struct TH1D_tag TH1D_t; 
+typedef TH1D_t * TH1D_p; 
+typedef TH1D_t const* const_TH1D_p; 
+
+// Opaque type definition for TH1F 
+typedef struct TH1F_tag TH1F_t; 
+typedef TH1F_t * TH1F_p; 
+typedef TH1F_t const* const_TH1F_p; 
+
+// Opaque type definition for TH1I 
+typedef struct TH1I_tag TH1I_t; 
+typedef TH1I_t * TH1I_p; 
+typedef TH1I_t const* const_TH1I_p; 
+
+// Opaque type definition for TH1K 
+typedef struct TH1K_tag TH1K_t; 
+typedef TH1K_t * TH1K_p; 
+typedef TH1K_t const* const_TH1K_p; 
+
+// Opaque type definition for TH1S 
+typedef struct TH1S_tag TH1S_t; 
+typedef TH1S_t * TH1S_p; 
+typedef TH1S_t const* const_TH1S_p; 
+
+// Opaque type definition for TH2 
+typedef struct TH2_tag TH2_t; 
+typedef TH2_t * TH2_p; 
+typedef TH2_t const* const_TH2_p; 
+
+// Opaque type definition for TH2C 
+typedef struct TH2C_tag TH2C_t; 
+typedef TH2C_t * TH2C_p; 
+typedef TH2C_t const* const_TH2C_p; 
+
+// Opaque type definition for TH2D 
+typedef struct TH2D_tag TH2D_t; 
+typedef TH2D_t * TH2D_p; 
+typedef TH2D_t const* const_TH2D_p; 
+
+// Opaque type definition for TH2F 
+typedef struct TH2F_tag TH2F_t; 
+typedef TH2F_t * TH2F_p; 
+typedef TH2F_t const* const_TH2F_p; 
+
+// Opaque type definition for TH2I 
+typedef struct TH2I_tag TH2I_t; 
+typedef TH2I_t * TH2I_p; 
+typedef TH2I_t const* const_TH2I_p; 
+
+// Opaque type definition for TH2Poly 
+typedef struct TH2Poly_tag TH2Poly_t; 
+typedef TH2Poly_t * TH2Poly_p; 
+typedef TH2Poly_t const* const_TH2Poly_p; 
+
+// Opaque type definition for TH2S 
+typedef struct TH2S_tag TH2S_t; 
+typedef TH2S_t * TH2S_p; 
+typedef TH2S_t const* const_TH2S_p; 
+
+// Opaque type definition for TH3 
+typedef struct TH3_tag TH3_t; 
+typedef TH3_t * TH3_p; 
+typedef TH3_t const* const_TH3_p; 
+
+// Opaque type definition for TH3C 
+typedef struct TH3C_tag TH3C_t; 
+typedef TH3C_t * TH3C_p; 
+typedef TH3C_t const* const_TH3C_p; 
+
+// Opaque type definition for TH3D 
+typedef struct TH3D_tag TH3D_t; 
+typedef TH3D_t * TH3D_p; 
+typedef TH3D_t const* const_TH3D_p; 
+
+// Opaque type definition for TH3F 
+typedef struct TH3F_tag TH3F_t; 
+typedef TH3F_t * TH3F_p; 
+typedef TH3F_t const* const_TH3F_p; 
+
+// Opaque type definition for TH3I 
+typedef struct TH3I_tag TH3I_t; 
+typedef TH3I_t * TH3I_p; 
+typedef TH3I_t const* const_TH3I_p; 
+
+// Opaque type definition for TH3S 
+typedef struct TH3S_tag TH3S_t; 
+typedef TH3S_t * TH3S_p; 
+typedef TH3S_t const* const_TH3S_p; 
+
+// Opaque type definition for THStack 
+typedef struct THStack_tag THStack_t; 
+typedef THStack_t * THStack_p; 
+typedef THStack_t const* const_THStack_p; 
+
+#endif // __HROOT_HIST__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTAxis.cpp b/csrc/HROOTHistTAxis.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTAxis.cpp
@@ -0,0 +1,49 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTCoreTNamed.h"
+#include "HROOTCoreTAttAxis.h"
+#include "TAxis.h"
+#include "HROOTHistTAxis.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+
+TNAMED_DEF_VIRT(TAxis)
+TATTAXIS_DEF_VIRT(TAxis)
+TOBJECT_DEF_VIRT(TAxis)
+DELETABLE_DEF_VIRT(TAxis)
+
+TAXIS_DEF_VIRT(TAxis)
+
+TAXIS_DEF_NONVIRT(TAxis)
+
+
diff --git a/csrc/HROOTHistTAxis.h b/csrc/HROOTHistTAxis.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTAxis.h
@@ -0,0 +1,100 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TAxis__
+#define __HROOT_HIST__TAxis__
+
+#include "HROOT-histType.h"
+
+#include "HROOTCoreTNamed.h"
+#include "HROOTCoreTAttAxis.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOT-coreType.h"
+
+#undef TAXIS_DECL_VIRT
+#define TAXIS_DECL_VIRT(Type) \
+int Type ## _findBinTAxis ( Type ## _p p, double x ); \
+int Type ## _findFixBinTAxis ( Type ## _p p, double x ); \
+double Type ## _getBinCenterTAxis ( Type ## _p p, int bin ); \
+double Type ## _GetBinCenterLog ( Type ## _p p, int bin ); \
+double Type ## _GetBinUpEdge ( Type ## _p p, int bin ); \
+void Type ## _SetTimeDisplay ( Type ## _p p, int value ); \
+void Type ## _SetTimeFormat ( Type ## _p p, const char* format ); \
+void Type ## _SetTimeOffset ( Type ## _p p, double toffset, const char* option )
+
+#undef TAXIS_DECL_NONVIRT
+#define TAXIS_DECL_NONVIRT(Type) \
+Type ## _p Type ## _newTAxis ( int nbins, double xmin, double xmax ); \
+int Type ## _tAxisGetCenterLabels ( Type ## _p p ); \
+int Type ## _tAxisGetCenterTitle ( Type ## _p p )
+
+#undef TAXIS_DEF_VIRT
+#define TAXIS_DEF_VIRT(Type)\
+int Type ## _findBinTAxis ( Type ## _p p, double x )\
+{\
+return TYPECASTMETHOD(Type,findBinTAxis,TAxis)(p)->FindBin(x);\
+}\
+int Type ## _findFixBinTAxis ( Type ## _p p, double x )\
+{\
+return TYPECASTMETHOD(Type,findFixBinTAxis,TAxis)(p)->FindFixBin(x);\
+}\
+double Type ## _getBinCenterTAxis ( Type ## _p p, int bin )\
+{\
+return TYPECASTMETHOD(Type,getBinCenterTAxis,TAxis)(p)->GetBinCenter(bin);\
+}\
+double Type ## _GetBinCenterLog ( Type ## _p p, int bin )\
+{\
+return TYPECASTMETHOD(Type,GetBinCenterLog,TAxis)(p)->GetBinCenterLog(bin);\
+}\
+double Type ## _GetBinUpEdge ( Type ## _p p, int bin )\
+{\
+return TYPECASTMETHOD(Type,GetBinUpEdge,TAxis)(p)->GetBinUpEdge(bin);\
+}\
+void Type ## _SetTimeDisplay ( Type ## _p p, int value )\
+{\
+TYPECASTMETHOD(Type,SetTimeDisplay,TAxis)(p)->SetTimeDisplay(value);\
+}\
+void Type ## _SetTimeFormat ( Type ## _p p, const char* format )\
+{\
+TYPECASTMETHOD(Type,SetTimeFormat,TAxis)(p)->SetTimeFormat(format);\
+}\
+void Type ## _SetTimeOffset ( Type ## _p p, double toffset, const char* option )\
+{\
+TYPECASTMETHOD(Type,SetTimeOffset,TAxis)(p)->SetTimeOffset(toffset, option);\
+}
+
+#undef TAXIS_DEF_NONVIRT
+#define TAXIS_DEF_NONVIRT(Type)\
+Type ## _p Type ## _newTAxis ( int nbins, double xmin, double xmax )\
+{\
+Type * newp = new Type (nbins, xmin, xmax); \
+return to_nonconst<Type ## _t, Type >(newp);\
+}\
+int Type ## _tAxisGetCenterLabels ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,tAxisGetCenterLabels,TAxis)(p)->GetCenterLabels();\
+}\
+int Type ## _tAxisGetCenterTitle ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,tAxisGetCenterTitle,TAxis)(p)->GetCenterTitle();\
+}
+
+TNAMED_DECL_VIRT(TAxis);
+TATTAXIS_DECL_VIRT(TAxis);
+TOBJECT_DECL_VIRT(TAxis);
+DELETABLE_DECL_VIRT(TAxis);
+
+
+TAXIS_DECL_VIRT(TAxis);
+
+
+TAXIS_DECL_NONVIRT(TAxis);
+
+
+#endif // __HROOT_HIST__TAxis__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTF1.cpp b/csrc/HROOTHistTF1.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTF1.cpp
@@ -0,0 +1,57 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTCoreTObject.h"
+#include "HROOTHistTH1.h"
+#include "HROOTHistTAxis.h"
+#include "HROOTHistTFormula.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "TF1.h"
+#include "HROOTHistTF1.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+
+TFORMULA_DEF_VIRT(TF1)
+TATTLINE_DEF_VIRT(TF1)
+TATTFILL_DEF_VIRT(TF1)
+TATTMARKER_DEF_VIRT(TF1)
+TNAMED_DEF_VIRT(TF1)
+TOBJECT_DEF_VIRT(TF1)
+DELETABLE_DEF_VIRT(TF1)
+
+TF1_DEF_VIRT(TF1)
+
+TF1_DEF_NONVIRT(TF1)
+
+
diff --git a/csrc/HROOTHistTF1.h b/csrc/HROOTHistTF1.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTF1.h
@@ -0,0 +1,371 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TF1__
+#define __HROOT_HIST__TF1__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTFormula.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreTNamed.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOT-coreType.h"
+
+#undef TF1_DECL_VIRT
+#define TF1_DECL_VIRT(Type) \
+double Type ## _Derivative ( Type ## _p p, double x, double * params, double epsilon ); \
+double Type ## _Derivative2 ( Type ## _p p, double x, double * params, double epsilon ); \
+double Type ## _Derivative3 ( Type ## _p p, double x, double * params, double epsilon ); \
+Type ## _p Type ## _drawCopyTF1 ( Type ## _p p, const char* option ); \
+TObject_p Type ## _DrawDerivative ( Type ## _p p, const char* option ); \
+TObject_p Type ## _DrawIntegral ( Type ## _p p, const char* option ); \
+void Type ## _DrawF1 ( Type ## _p p, const char* formula, double xmin, double xmax, const char* option ); \
+void Type ## _FixParameter ( Type ## _p p, int ipar, double value ); \
+double Type ## _getMaximumTF1 ( Type ## _p p, double xmin, double xmax, double epsilon, double maxiter, int logx ); \
+double Type ## _getMinimumTF1 ( Type ## _p p, double xmin, double xmax, double epsilon, double maxiter, int logx ); \
+double Type ## _GetMaximumX ( Type ## _p p, double xmin, double xmax, double epsilon, double maxiter, int logx ); \
+double Type ## _GetMinimumX ( Type ## _p p, double xmin, double xmax, double epsilon, double maxiter, int logx ); \
+int Type ## _GetNDF ( Type ## _p p ); \
+int Type ## _GetNpx ( Type ## _p p ); \
+int Type ## _GetNumberFreeParameters ( Type ## _p p ); \
+int Type ## _GetNumberFitPoints ( Type ## _p p ); \
+double Type ## _GetParError ( Type ## _p p, int ipar ); \
+double Type ## _GetProb ( Type ## _p p ); \
+int Type ## _getQuantilesTF1 ( Type ## _p p, int nprobSum, double * q, double * probSum ); \
+double Type ## _getRandomTF1 ( Type ## _p p, double xmin, double xmax ); \
+double Type ## _GetSave ( Type ## _p p, double * x ); \
+double Type ## _GetX ( Type ## _p p, double y, double xmin, double xmax, double epsilon, int maxiter ); \
+double Type ## _GetXmin ( Type ## _p p ); \
+double Type ## _GetXmax ( Type ## _p p ); \
+double Type ## _GradientPar ( Type ## _p p, int ipar, double * x, double eps ); \
+void Type ## _InitArgs ( Type ## _p p, double * x, double * params ); \
+double Type ## _IntegralTF1 ( Type ## _p p, double a, double b, double * params, double epsilon ); \
+double Type ## _IntegralError ( Type ## _p p, double a, double b, double * params, double * covmat, double epsilon ); \
+double Type ## _IntegralFast ( Type ## _p p, int num, double * x, double * w, double a, double b, double * params, double epsilon ); \
+int Type ## _IsInside ( Type ## _p p, double * x ); \
+void Type ## _ReleaseParameter ( Type ## _p p, int ipar ); \
+void Type ## _SetChisquare ( Type ## _p p, double chi2 ); \
+void Type ## _setMaximumTF1 ( Type ## _p p, double maximum ); \
+void Type ## _setMinimumTF1 ( Type ## _p p, double minimum ); \
+void Type ## _SetNDF ( Type ## _p p, int ndf ); \
+void Type ## _SetNumberFitPoints ( Type ## _p p, int npfits ); \
+void Type ## _SetNpx ( Type ## _p p, int npx ); \
+void Type ## _SetParError ( Type ## _p p, int ipar, double error ); \
+void Type ## _SetParErrors ( Type ## _p p, double * errors ); \
+void Type ## _SetParLimits ( Type ## _p p, int ipar, double parmin, double parmax ); \
+void Type ## _SetParent ( Type ## _p p, TObject_p parent ); \
+void Type ## _setRange1 ( Type ## _p p, double xmin, double xmax ); \
+void Type ## _setRange2 ( Type ## _p p, double xmin, double xmax, double ymin, double ymax ); \
+void Type ## _setRange3 ( Type ## _p p, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax ); \
+void Type ## _SetSavedPoint ( Type ## _p p, int point, double value ); \
+double Type ## _Moment ( Type ## _p p, double n, double a, double b, double * params, double epsilon ); \
+double Type ## _CentralMoment ( Type ## _p p, double n, double a, double b, double * params, double epsilon ); \
+double Type ## _Mean ( Type ## _p p, double a, double b, double * params, double epsilon ); \
+double Type ## _Variance ( Type ## _p p, double a, double b, double * params, double epsilon )
+
+#undef TF1_DECL_NONVIRT
+#define TF1_DECL_NONVIRT(Type) \
+Type ## _p Type ## _newTF1 ( const char* name, const char* formula, double xmin, double xmax ); \
+double Type ## _tF1DerivativeError (  ); \
+double Type ## _tF1GetChisquare ( Type ## _p p ); \
+TH1_p Type ## _tF1GetHistogram ( Type ## _p p ); \
+TObject_p Type ## _tF1GetParent ( Type ## _p p ); \
+TAxis_p Type ## _tF1GetXaxis ( Type ## _p p ); \
+TAxis_p Type ## _tF1GetYaxis ( Type ## _p p ); \
+TAxis_p Type ## _tF1GetZaxis ( Type ## _p p ); \
+void Type ## _tF1InitStandardFunctions (  ); \
+TF1_p Type ## _tF1GetCurrent (  ); \
+void Type ## _tF1AbsValue ( int reject ); \
+void Type ## _tF1RejectPoint ( int reject ); \
+int Type ## _tF1RejectedPoint (  ); \
+void Type ## _tF1SetCurrent ( TF1_p f1 ); \
+void Type ## _tF1CalcGaussLegendreSamplingPoints ( int num, double * x, double * w, double eps )
+
+#undef TF1_DEF_VIRT
+#define TF1_DEF_VIRT(Type)\
+double Type ## _Derivative ( Type ## _p p, double x, double * params, double epsilon )\
+{\
+return TYPECASTMETHOD(Type,Derivative,TF1)(p)->Derivative(x, params, epsilon);\
+}\
+double Type ## _Derivative2 ( Type ## _p p, double x, double * params, double epsilon )\
+{\
+return TYPECASTMETHOD(Type,Derivative2,TF1)(p)->Derivative2(x, params, epsilon);\
+}\
+double Type ## _Derivative3 ( Type ## _p p, double x, double * params, double epsilon )\
+{\
+return TYPECASTMETHOD(Type,Derivative3,TF1)(p)->Derivative3(x, params, epsilon);\
+}\
+Type ## _p Type ## _drawCopyTF1 ( Type ## _p p, const char* option )\
+{\
+return to_nonconst<Type ## _t, Type>((Type *)TYPECASTMETHOD(Type,drawCopyTF1,TF1)(p)->DrawCopy(option)) ;\
+}\
+TObject_p Type ## _DrawDerivative ( Type ## _p p, const char* option )\
+{\
+return to_nonconst<TObject_t,TObject>((TObject*)TYPECASTMETHOD(Type,DrawDerivative,TF1)(p)->DrawDerivative(option));\
+}\
+TObject_p Type ## _DrawIntegral ( Type ## _p p, const char* option )\
+{\
+return to_nonconst<TObject_t,TObject>((TObject*)TYPECASTMETHOD(Type,DrawIntegral,TF1)(p)->DrawIntegral(option));\
+}\
+void Type ## _DrawF1 ( Type ## _p p, const char* formula, double xmin, double xmax, const char* option )\
+{\
+TYPECASTMETHOD(Type,DrawF1,TF1)(p)->DrawF1(formula, xmin, xmax, option);\
+}\
+void Type ## _FixParameter ( Type ## _p p, int ipar, double value )\
+{\
+TYPECASTMETHOD(Type,FixParameter,TF1)(p)->FixParameter(ipar, value);\
+}\
+double Type ## _getMaximumTF1 ( Type ## _p p, double xmin, double xmax, double epsilon, double maxiter, int logx )\
+{\
+return TYPECASTMETHOD(Type,getMaximumTF1,TF1)(p)->GetMaximum(xmin, xmax, epsilon, maxiter, logx);\
+}\
+double Type ## _getMinimumTF1 ( Type ## _p p, double xmin, double xmax, double epsilon, double maxiter, int logx )\
+{\
+return TYPECASTMETHOD(Type,getMinimumTF1,TF1)(p)->GetMinimum(xmin, xmax, epsilon, maxiter, logx);\
+}\
+double Type ## _GetMaximumX ( Type ## _p p, double xmin, double xmax, double epsilon, double maxiter, int logx )\
+{\
+return TYPECASTMETHOD(Type,GetMaximumX,TF1)(p)->GetMaximumX(xmin, xmax, epsilon, maxiter, logx);\
+}\
+double Type ## _GetMinimumX ( Type ## _p p, double xmin, double xmax, double epsilon, double maxiter, int logx )\
+{\
+return TYPECASTMETHOD(Type,GetMinimumX,TF1)(p)->GetMinimumX(xmin, xmax, epsilon, maxiter, logx);\
+}\
+int Type ## _GetNDF ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetNDF,TF1)(p)->GetNDF();\
+}\
+int Type ## _GetNpx ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetNpx,TF1)(p)->GetNpx();\
+}\
+int Type ## _GetNumberFreeParameters ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetNumberFreeParameters,TF1)(p)->GetNumberFreeParameters();\
+}\
+int Type ## _GetNumberFitPoints ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetNumberFitPoints,TF1)(p)->GetNumberFitPoints();\
+}\
+double Type ## _GetParError ( Type ## _p p, int ipar )\
+{\
+return TYPECASTMETHOD(Type,GetParError,TF1)(p)->GetParError(ipar);\
+}\
+double Type ## _GetProb ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetProb,TF1)(p)->GetProb();\
+}\
+int Type ## _getQuantilesTF1 ( Type ## _p p, int nprobSum, double * q, double * probSum )\
+{\
+return TYPECASTMETHOD(Type,getQuantilesTF1,TF1)(p)->GetQuantiles(nprobSum, q, probSum);\
+}\
+double Type ## _getRandomTF1 ( Type ## _p p, double xmin, double xmax )\
+{\
+return TYPECASTMETHOD(Type,getRandomTF1,TF1)(p)->GetRandom(xmin, xmax);\
+}\
+double Type ## _GetSave ( Type ## _p p, double * x )\
+{\
+return TYPECASTMETHOD(Type,GetSave,TF1)(p)->GetSave(x);\
+}\
+double Type ## _GetX ( Type ## _p p, double y, double xmin, double xmax, double epsilon, int maxiter )\
+{\
+return TYPECASTMETHOD(Type,GetX,TF1)(p)->GetX(y, xmin, xmax, epsilon, maxiter);\
+}\
+double Type ## _GetXmin ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetXmin,TF1)(p)->GetXmin();\
+}\
+double Type ## _GetXmax ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetXmax,TF1)(p)->GetXmax();\
+}\
+double Type ## _GradientPar ( Type ## _p p, int ipar, double * x, double eps )\
+{\
+return TYPECASTMETHOD(Type,GradientPar,TF1)(p)->GradientPar(ipar, x, eps);\
+}\
+void Type ## _InitArgs ( Type ## _p p, double * x, double * params )\
+{\
+TYPECASTMETHOD(Type,InitArgs,TF1)(p)->InitArgs(x, params);\
+}\
+double Type ## _IntegralTF1 ( Type ## _p p, double a, double b, double * params, double epsilon )\
+{\
+return TYPECASTMETHOD(Type,IntegralTF1,TF1)(p)->Integral(a, b, params, epsilon);\
+}\
+double Type ## _IntegralError ( Type ## _p p, double a, double b, double * params, double * covmat, double epsilon )\
+{\
+return TYPECASTMETHOD(Type,IntegralError,TF1)(p)->IntegralError(a, b, params, covmat, epsilon);\
+}\
+double Type ## _IntegralFast ( Type ## _p p, int num, double * x, double * w, double a, double b, double * params, double epsilon )\
+{\
+return TYPECASTMETHOD(Type,IntegralFast,TF1)(p)->IntegralFast(num, x, w, a, b, params, epsilon);\
+}\
+int Type ## _IsInside ( Type ## _p p, double * x )\
+{\
+return TYPECASTMETHOD(Type,IsInside,TF1)(p)->IsInside(x);\
+}\
+void Type ## _ReleaseParameter ( Type ## _p p, int ipar )\
+{\
+TYPECASTMETHOD(Type,ReleaseParameter,TF1)(p)->ReleaseParameter(ipar);\
+}\
+void Type ## _SetChisquare ( Type ## _p p, double chi2 )\
+{\
+TYPECASTMETHOD(Type,SetChisquare,TF1)(p)->SetChisquare(chi2);\
+}\
+void Type ## _setMaximumTF1 ( Type ## _p p, double maximum )\
+{\
+TYPECASTMETHOD(Type,setMaximumTF1,TF1)(p)->SetMaximum(maximum);\
+}\
+void Type ## _setMinimumTF1 ( Type ## _p p, double minimum )\
+{\
+TYPECASTMETHOD(Type,setMinimumTF1,TF1)(p)->SetMinimum(minimum);\
+}\
+void Type ## _SetNDF ( Type ## _p p, int ndf )\
+{\
+TYPECASTMETHOD(Type,SetNDF,TF1)(p)->SetNDF(ndf);\
+}\
+void Type ## _SetNumberFitPoints ( Type ## _p p, int npfits )\
+{\
+TYPECASTMETHOD(Type,SetNumberFitPoints,TF1)(p)->SetNumberFitPoints(npfits);\
+}\
+void Type ## _SetNpx ( Type ## _p p, int npx )\
+{\
+TYPECASTMETHOD(Type,SetNpx,TF1)(p)->SetNpx(npx);\
+}\
+void Type ## _SetParError ( Type ## _p p, int ipar, double error )\
+{\
+TYPECASTMETHOD(Type,SetParError,TF1)(p)->SetParError(ipar, error);\
+}\
+void Type ## _SetParErrors ( Type ## _p p, double * errors )\
+{\
+TYPECASTMETHOD(Type,SetParErrors,TF1)(p)->SetParErrors(errors);\
+}\
+void Type ## _SetParLimits ( Type ## _p p, int ipar, double parmin, double parmax )\
+{\
+TYPECASTMETHOD(Type,SetParLimits,TF1)(p)->SetParLimits(ipar, parmin, parmax);\
+}\
+void Type ## _SetParent ( Type ## _p p, TObject_p parent )\
+{\
+TYPECASTMETHOD(Type,SetParent,TF1)(p)->SetParent(to_nonconst<TObject,TObject_t>(parent));\
+}\
+void Type ## _setRange1 ( Type ## _p p, double xmin, double xmax )\
+{\
+TYPECASTMETHOD(Type,setRange1,TF1)(p)->SetRange(xmin, xmax);\
+}\
+void Type ## _setRange2 ( Type ## _p p, double xmin, double xmax, double ymin, double ymax )\
+{\
+TYPECASTMETHOD(Type,setRange2,TF1)(p)->SetRange(xmin, xmax, ymin, ymax);\
+}\
+void Type ## _setRange3 ( Type ## _p p, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax )\
+{\
+TYPECASTMETHOD(Type,setRange3,TF1)(p)->SetRange(xmin, xmax, ymin, ymax, zmin, zmax);\
+}\
+void Type ## _SetSavedPoint ( Type ## _p p, int point, double value )\
+{\
+TYPECASTMETHOD(Type,SetSavedPoint,TF1)(p)->SetSavedPoint(point, value);\
+}\
+double Type ## _Moment ( Type ## _p p, double n, double a, double b, double * params, double epsilon )\
+{\
+return TYPECASTMETHOD(Type,Moment,TF1)(p)->Moment(n, a, b, params, epsilon);\
+}\
+double Type ## _CentralMoment ( Type ## _p p, double n, double a, double b, double * params, double epsilon )\
+{\
+return TYPECASTMETHOD(Type,CentralMoment,TF1)(p)->CentralMoment(n, a, b, params, epsilon);\
+}\
+double Type ## _Mean ( Type ## _p p, double a, double b, double * params, double epsilon )\
+{\
+return TYPECASTMETHOD(Type,Mean,TF1)(p)->Mean(a, b, params, epsilon);\
+}\
+double Type ## _Variance ( Type ## _p p, double a, double b, double * params, double epsilon )\
+{\
+return TYPECASTMETHOD(Type,Variance,TF1)(p)->Variance(a, b, params, epsilon);\
+}
+
+#undef TF1_DEF_NONVIRT
+#define TF1_DEF_NONVIRT(Type)\
+Type ## _p Type ## _newTF1 ( const char* name, const char* formula, double xmin, double xmax )\
+{\
+Type * newp = new Type (name, formula, xmin, xmax); \
+return to_nonconst<Type ## _t, Type >(newp);\
+}\
+double Type ## _tF1DerivativeError (  )\
+{\
+return TF1::DerivativeError();\
+}\
+double Type ## _tF1GetChisquare ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,tF1GetChisquare,TF1)(p)->GetChisquare();\
+}\
+TH1_p Type ## _tF1GetHistogram ( Type ## _p p )\
+{\
+return to_nonconst<TH1_t,TH1>((TH1*)TYPECASTMETHOD(Type,tF1GetHistogram,TF1)(p)->GetHistogram());\
+}\
+TObject_p Type ## _tF1GetParent ( Type ## _p p )\
+{\
+return to_nonconst<TObject_t,TObject>((TObject*)TYPECASTMETHOD(Type,tF1GetParent,TF1)(p)->GetParent());\
+}\
+TAxis_p Type ## _tF1GetXaxis ( Type ## _p p )\
+{\
+return to_nonconst<TAxis_t,TAxis>((TAxis*)TYPECASTMETHOD(Type,tF1GetXaxis,TF1)(p)->GetXaxis());\
+}\
+TAxis_p Type ## _tF1GetYaxis ( Type ## _p p )\
+{\
+return to_nonconst<TAxis_t,TAxis>((TAxis*)TYPECASTMETHOD(Type,tF1GetYaxis,TF1)(p)->GetYaxis());\
+}\
+TAxis_p Type ## _tF1GetZaxis ( Type ## _p p )\
+{\
+return to_nonconst<TAxis_t,TAxis>((TAxis*)TYPECASTMETHOD(Type,tF1GetZaxis,TF1)(p)->GetZaxis());\
+}\
+void Type ## _tF1InitStandardFunctions (  )\
+{\
+TF1::InitStandardFunctions();\
+}\
+TF1_p Type ## _tF1GetCurrent (  )\
+{\
+return to_nonconst<TF1_t,TF1>((TF1*)TF1::GetCurrent());\
+}\
+void Type ## _tF1AbsValue ( int reject )\
+{\
+TF1::AbsValue(reject);\
+}\
+void Type ## _tF1RejectPoint ( int reject )\
+{\
+TF1::RejectPoint(reject);\
+}\
+int Type ## _tF1RejectedPoint (  )\
+{\
+return TF1::RejectedPoint();\
+}\
+void Type ## _tF1SetCurrent ( TF1_p f1 )\
+{\
+TF1::SetCurrent(to_nonconst<TF1,TF1_t>(f1));\
+}\
+void Type ## _tF1CalcGaussLegendreSamplingPoints ( int num, double * x, double * w, double eps )\
+{\
+TF1::CalcGaussLegendreSamplingPoints(num, x, w, eps);\
+}
+
+TFORMULA_DECL_VIRT(TF1);
+TATTLINE_DECL_VIRT(TF1);
+TATTFILL_DECL_VIRT(TF1);
+TATTMARKER_DECL_VIRT(TF1);
+TNAMED_DECL_VIRT(TF1);
+TOBJECT_DECL_VIRT(TF1);
+DELETABLE_DECL_VIRT(TF1);
+
+
+TF1_DECL_VIRT(TF1);
+
+
+TF1_DECL_NONVIRT(TF1);
+
+
+#endif // __HROOT_HIST__TF1__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTFormula.cpp b/csrc/HROOTHistTFormula.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTFormula.cpp
@@ -0,0 +1,47 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTCoreTNamed.h"
+#include "TFormula.h"
+#include "HROOTHistTFormula.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+
+TNAMED_DEF_VIRT(TFormula)
+TOBJECT_DEF_VIRT(TFormula)
+DELETABLE_DEF_VIRT(TFormula)
+
+TFORMULA_DEF_VIRT(TFormula)
+
+TFORMULA_DEF_NONVIRT(TFormula)
+
+
diff --git a/csrc/HROOTHistTFormula.h b/csrc/HROOTHistTFormula.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTFormula.h
@@ -0,0 +1,148 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TFormula__
+#define __HROOT_HIST__TFormula__
+
+#include "HROOT-histType.h"
+
+#include "HROOTCoreTNamed.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOT-coreType.h"
+
+#undef TFORMULA_DECL_VIRT
+#define TFORMULA_DECL_VIRT(Type) \
+int Type ## _Compile ( Type ## _p p, const char* expression ); \
+void Type ## _Clear ( Type ## _p p, const char* option ); \
+double Type ## _DefinedValue ( Type ## _p p, int code ); \
+double Type ## _Eval ( Type ## _p p, double x, double y, double z, double t ); \
+double Type ## _EvalParOld ( Type ## _p p, double * x, double * params ); \
+double Type ## _EvalPar ( Type ## _p p, double * x, double * params ); \
+int Type ## _GetNdim ( Type ## _p p ); \
+int Type ## _GetNpar ( Type ## _p p ); \
+int Type ## _GetNumber ( Type ## _p p ); \
+int Type ## _GetParNumber ( Type ## _p p, const char* name ); \
+int Type ## _IsLinear ( Type ## _p p ); \
+int Type ## _IsNormalized ( Type ## _p p ); \
+void Type ## _SetNumber ( Type ## _p p, int number ); \
+void Type ## _SetParameter ( Type ## _p p, const char* name, double parvalue ); \
+void Type ## _SetParameters ( Type ## _p p, double * params ); \
+void Type ## _SetParName ( Type ## _p p, int ipar, const char* name ); \
+void Type ## _SetParNames ( Type ## _p p, const char* name0, const char* name1, const char* name2, const char* name3, const char* name4, const char* name5, const char* name6, const char* name7, const char* name8, const char* name9, const char* name10 ); \
+void Type ## _Update ( Type ## _p p )
+
+#undef TFORMULA_DECL_NONVIRT
+#define TFORMULA_DECL_NONVIRT(Type) \
+Type ## _p Type ## _newTFormula ( const char* name, const char* formula ); \
+void Type ## _tFormulaOptimize ( Type ## _p p ); \
+double Type ## _tFormulaGetParameter ( Type ## _p p, const char* name )
+
+#undef TFORMULA_DEF_VIRT
+#define TFORMULA_DEF_VIRT(Type)\
+int Type ## _Compile ( Type ## _p p, const char* expression )\
+{\
+return TYPECASTMETHOD(Type,Compile,TFormula)(p)->Compile(expression);\
+}\
+void Type ## _Clear ( Type ## _p p, const char* option )\
+{\
+TYPECASTMETHOD(Type,Clear,TFormula)(p)->Clear(option);\
+}\
+double Type ## _DefinedValue ( Type ## _p p, int code )\
+{\
+return TYPECASTMETHOD(Type,DefinedValue,TFormula)(p)->DefinedValue(code);\
+}\
+double Type ## _Eval ( Type ## _p p, double x, double y, double z, double t )\
+{\
+return TYPECASTMETHOD(Type,Eval,TFormula)(p)->Eval(x, y, z, t);\
+}\
+double Type ## _EvalParOld ( Type ## _p p, double * x, double * params )\
+{\
+return TYPECASTMETHOD(Type,EvalParOld,TFormula)(p)->EvalParOld(x, params);\
+}\
+double Type ## _EvalPar ( Type ## _p p, double * x, double * params )\
+{\
+return TYPECASTMETHOD(Type,EvalPar,TFormula)(p)->EvalPar(x, params);\
+}\
+int Type ## _GetNdim ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetNdim,TFormula)(p)->GetNdim();\
+}\
+int Type ## _GetNpar ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetNpar,TFormula)(p)->GetNpar();\
+}\
+int Type ## _GetNumber ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetNumber,TFormula)(p)->GetNumber();\
+}\
+int Type ## _GetParNumber ( Type ## _p p, const char* name )\
+{\
+return TYPECASTMETHOD(Type,GetParNumber,TFormula)(p)->GetParNumber(name);\
+}\
+int Type ## _IsLinear ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,IsLinear,TFormula)(p)->IsLinear();\
+}\
+int Type ## _IsNormalized ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,IsNormalized,TFormula)(p)->IsNormalized();\
+}\
+void Type ## _SetNumber ( Type ## _p p, int number )\
+{\
+TYPECASTMETHOD(Type,SetNumber,TFormula)(p)->SetNumber(number);\
+}\
+void Type ## _SetParameter ( Type ## _p p, const char* name, double parvalue )\
+{\
+TYPECASTMETHOD(Type,SetParameter,TFormula)(p)->SetParameter(name, parvalue);\
+}\
+void Type ## _SetParameters ( Type ## _p p, double * params )\
+{\
+TYPECASTMETHOD(Type,SetParameters,TFormula)(p)->SetParameters(params);\
+}\
+void Type ## _SetParName ( Type ## _p p, int ipar, const char* name )\
+{\
+TYPECASTMETHOD(Type,SetParName,TFormula)(p)->SetParName(ipar, name);\
+}\
+void Type ## _SetParNames ( Type ## _p p, const char* name0, const char* name1, const char* name2, const char* name3, const char* name4, const char* name5, const char* name6, const char* name7, const char* name8, const char* name9, const char* name10 )\
+{\
+TYPECASTMETHOD(Type,SetParNames,TFormula)(p)->SetParNames(name0, name1, name2, name3, name4, name5, name6, name7, name8, name9, name10);\
+}\
+void Type ## _Update ( Type ## _p p )\
+{\
+TYPECASTMETHOD(Type,Update,TFormula)(p)->Update();\
+}
+
+#undef TFORMULA_DEF_NONVIRT
+#define TFORMULA_DEF_NONVIRT(Type)\
+Type ## _p Type ## _newTFormula ( const char* name, const char* formula )\
+{\
+Type * newp = new Type (name, formula); \
+return to_nonconst<Type ## _t, Type >(newp);\
+}\
+void Type ## _tFormulaOptimize ( Type ## _p p )\
+{\
+TYPECASTMETHOD(Type,tFormulaOptimize,TFormula)(p)->Optimize();\
+}\
+double Type ## _tFormulaGetParameter ( Type ## _p p, const char* name )\
+{\
+return TYPECASTMETHOD(Type,tFormulaGetParameter,TFormula)(p)->GetParameter(name);\
+}
+
+TNAMED_DECL_VIRT(TFormula);
+TOBJECT_DECL_VIRT(TFormula);
+DELETABLE_DECL_VIRT(TFormula);
+
+
+TFORMULA_DECL_VIRT(TFormula);
+
+
+TFORMULA_DECL_NONVIRT(TFormula);
+
+
+#endif // __HROOT_HIST__TFormula__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTGraph.cpp b/csrc/HROOTHistTGraph.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTGraph.cpp
@@ -0,0 +1,56 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTF1.h"
+#include "HROOTHistTH1F.h"
+#include "HROOTHistTAxis.h"
+#include "HROOTCoreTNamed.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "TGraph.h"
+#include "HROOTHistTGraph.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+
+TNAMED_DEF_VIRT(TGraph)
+TATTLINE_DEF_VIRT(TGraph)
+TATTFILL_DEF_VIRT(TGraph)
+TATTMARKER_DEF_VIRT(TGraph)
+TOBJECT_DEF_VIRT(TGraph)
+DELETABLE_DEF_VIRT(TGraph)
+
+TGRAPH_DEF_VIRT(TGraph)
+
+TGRAPH_DEF_NONVIRT(TGraph)
+
+
diff --git a/csrc/HROOTHistTGraph.h b/csrc/HROOTHistTGraph.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTGraph.h
@@ -0,0 +1,269 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TGraph__
+#define __HROOT_HIST__TGraph__
+
+#include "HROOT-histType.h"
+
+#include "HROOTCoreTNamed.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOT-coreType.h"
+
+#undef TGRAPH_DECL_VIRT
+#define TGRAPH_DECL_VIRT(Type) \
+void Type ## _Apply ( Type ## _p p, TF1_p f ); \
+double Type ## _Chisquare ( Type ## _p p, TF1_p f1 ); \
+void Type ## _DrawGraph ( Type ## _p p, int n, double * x, double * y, const char* option ); \
+void Type ## _drawPanelTGraph ( Type ## _p p ); \
+void Type ## _Expand ( Type ## _p p, int newsize, int step ); \
+void Type ## _FitPanelTGraph ( Type ## _p p ); \
+double Type ## _getCorrelationFactorTGraph ( Type ## _p p ); \
+double Type ## _getCovarianceTGraph ( Type ## _p p ); \
+double Type ## _getMeanTGraph ( Type ## _p p, int axis ); \
+double Type ## _getRMSTGraph ( Type ## _p p, int axis ); \
+double Type ## _GetErrorX ( Type ## _p p, int bin ); \
+double Type ## _GetErrorY ( Type ## _p p, int bin ); \
+double Type ## _GetErrorXhigh ( Type ## _p p, int bin ); \
+double Type ## _GetErrorXlow ( Type ## _p p, int bin ); \
+double Type ## _GetErrorYhigh ( Type ## _p p, int bin ); \
+double Type ## _GetErrorYlow ( Type ## _p p, int bin ); \
+void Type ## _InitExpo ( Type ## _p p, double xmin, double xmax ); \
+void Type ## _InitGaus ( Type ## _p p, double xmin, double xmax ); \
+void Type ## _InitPolynom ( Type ## _p p, double xmin, double xmax ); \
+int Type ## _InsertPoint ( Type ## _p p ); \
+double Type ## _integralTGraph ( Type ## _p p, int first, int last ); \
+int Type ## _IsEditable ( Type ## _p p ); \
+int Type ## _isInsideTGraph ( Type ## _p p, double x, double y ); \
+void Type ## _LeastSquareFit ( Type ## _p p, int m, double * a, double xmin, double xmax ); \
+void Type ## _PaintStats ( Type ## _p p, TF1_p fit ); \
+int Type ## _RemovePoint ( Type ## _p p, int ipoint ); \
+void Type ## _SetEditable ( Type ## _p p, int editable ); \
+void Type ## _SetHistogram ( Type ## _p p, TH1F_p h ); \
+void Type ## _setMaximumTGraph ( Type ## _p p, double maximum ); \
+void Type ## _setMinimumTGraph ( Type ## _p p, double minimum ); \
+void Type ## _Set ( Type ## _p p, int n ); \
+void Type ## _SetPoint ( Type ## _p p, int i, double x, double y )
+
+#undef TGRAPH_DECL_NONVIRT
+#define TGRAPH_DECL_NONVIRT(Type) \
+Type ## _p Type ## _newTGraph ( int n, double * x, double * y ); \
+int Type ## _tGraphGetEditable ( Type ## _p p ); \
+TF1_p Type ## _tGraphGetFunction ( Type ## _p p, const char* name ); \
+TH1F_p Type ## _tGraphGetHistogram ( Type ## _p p ); \
+int Type ## _tGraphGetMaxSize ( Type ## _p p ); \
+int Type ## _tGraphGetN ( Type ## _p p ); \
+double Type ## _tGraphGetMaximum ( Type ## _p p ); \
+double Type ## _tGraphGetMinimum ( Type ## _p p ); \
+TAxis_p Type ## _tGraphGetXaxis ( Type ## _p p ); \
+TAxis_p Type ## _tGraphGetYaxis ( Type ## _p p ); \
+void Type ## _tGraphPaintGraph ( Type ## _p p, int npoints, double * x, double * y, const char* chopt ); \
+void Type ## _tGraphPaintGrapHist ( Type ## _p p, int npoints, double * x, double * y, const char* chopt )
+
+#undef TGRAPH_DEF_VIRT
+#define TGRAPH_DEF_VIRT(Type)\
+void Type ## _Apply ( Type ## _p p, TF1_p f )\
+{\
+TYPECASTMETHOD(Type,Apply,TGraph)(p)->Apply(to_nonconst<TF1,TF1_t>(f));\
+}\
+double Type ## _Chisquare ( Type ## _p p, TF1_p f1 )\
+{\
+return TYPECASTMETHOD(Type,Chisquare,TGraph)(p)->Chisquare(to_nonconst<TF1,TF1_t>(f1));\
+}\
+void Type ## _DrawGraph ( Type ## _p p, int n, double * x, double * y, const char* option )\
+{\
+TYPECASTMETHOD(Type,DrawGraph,TGraph)(p)->DrawGraph(n, x, y, option);\
+}\
+void Type ## _drawPanelTGraph ( Type ## _p p )\
+{\
+TYPECASTMETHOD(Type,drawPanelTGraph,TGraph)(p)->DrawPanel();\
+}\
+void Type ## _Expand ( Type ## _p p, int newsize, int step )\
+{\
+TYPECASTMETHOD(Type,Expand,TGraph)(p)->Expand(newsize, step);\
+}\
+void Type ## _FitPanelTGraph ( Type ## _p p )\
+{\
+TYPECASTMETHOD(Type,FitPanelTGraph,TGraph)(p)->FitPanel();\
+}\
+double Type ## _getCorrelationFactorTGraph ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,getCorrelationFactorTGraph,TGraph)(p)->GetCorrelationFactor();\
+}\
+double Type ## _getCovarianceTGraph ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,getCovarianceTGraph,TGraph)(p)->GetCovariance();\
+}\
+double Type ## _getMeanTGraph ( Type ## _p p, int axis )\
+{\
+return TYPECASTMETHOD(Type,getMeanTGraph,TGraph)(p)->GetMean(axis);\
+}\
+double Type ## _getRMSTGraph ( Type ## _p p, int axis )\
+{\
+return TYPECASTMETHOD(Type,getRMSTGraph,TGraph)(p)->GetRMS(axis);\
+}\
+double Type ## _GetErrorX ( Type ## _p p, int bin )\
+{\
+return TYPECASTMETHOD(Type,GetErrorX,TGraph)(p)->GetErrorX(bin);\
+}\
+double Type ## _GetErrorY ( Type ## _p p, int bin )\
+{\
+return TYPECASTMETHOD(Type,GetErrorY,TGraph)(p)->GetErrorY(bin);\
+}\
+double Type ## _GetErrorXhigh ( Type ## _p p, int bin )\
+{\
+return TYPECASTMETHOD(Type,GetErrorXhigh,TGraph)(p)->GetErrorXhigh(bin);\
+}\
+double Type ## _GetErrorXlow ( Type ## _p p, int bin )\
+{\
+return TYPECASTMETHOD(Type,GetErrorXlow,TGraph)(p)->GetErrorXlow(bin);\
+}\
+double Type ## _GetErrorYhigh ( Type ## _p p, int bin )\
+{\
+return TYPECASTMETHOD(Type,GetErrorYhigh,TGraph)(p)->GetErrorYhigh(bin);\
+}\
+double Type ## _GetErrorYlow ( Type ## _p p, int bin )\
+{\
+return TYPECASTMETHOD(Type,GetErrorYlow,TGraph)(p)->GetErrorYlow(bin);\
+}\
+void Type ## _InitExpo ( Type ## _p p, double xmin, double xmax )\
+{\
+TYPECASTMETHOD(Type,InitExpo,TGraph)(p)->InitExpo(xmin, xmax);\
+}\
+void Type ## _InitGaus ( Type ## _p p, double xmin, double xmax )\
+{\
+TYPECASTMETHOD(Type,InitGaus,TGraph)(p)->InitGaus(xmin, xmax);\
+}\
+void Type ## _InitPolynom ( Type ## _p p, double xmin, double xmax )\
+{\
+TYPECASTMETHOD(Type,InitPolynom,TGraph)(p)->InitPolynom(xmin, xmax);\
+}\
+int Type ## _InsertPoint ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,InsertPoint,TGraph)(p)->InsertPoint();\
+}\
+double Type ## _integralTGraph ( Type ## _p p, int first, int last )\
+{\
+return TYPECASTMETHOD(Type,integralTGraph,TGraph)(p)->Integral(first, last);\
+}\
+int Type ## _IsEditable ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,IsEditable,TGraph)(p)->IsEditable();\
+}\
+int Type ## _isInsideTGraph ( Type ## _p p, double x, double y )\
+{\
+return TYPECASTMETHOD(Type,isInsideTGraph,TGraph)(p)->IsInside(x, y);\
+}\
+void Type ## _LeastSquareFit ( Type ## _p p, int m, double * a, double xmin, double xmax )\
+{\
+TYPECASTMETHOD(Type,LeastSquareFit,TGraph)(p)->LeastSquareFit(m, a, xmin, xmax);\
+}\
+void Type ## _PaintStats ( Type ## _p p, TF1_p fit )\
+{\
+TYPECASTMETHOD(Type,PaintStats,TGraph)(p)->PaintStats(to_nonconst<TF1,TF1_t>(fit));\
+}\
+int Type ## _RemovePoint ( Type ## _p p, int ipoint )\
+{\
+return TYPECASTMETHOD(Type,RemovePoint,TGraph)(p)->RemovePoint(ipoint);\
+}\
+void Type ## _SetEditable ( Type ## _p p, int editable )\
+{\
+TYPECASTMETHOD(Type,SetEditable,TGraph)(p)->SetEditable(editable);\
+}\
+void Type ## _SetHistogram ( Type ## _p p, TH1F_p h )\
+{\
+TYPECASTMETHOD(Type,SetHistogram,TGraph)(p)->SetHistogram(to_nonconst<TH1F,TH1F_t>(h));\
+}\
+void Type ## _setMaximumTGraph ( Type ## _p p, double maximum )\
+{\
+TYPECASTMETHOD(Type,setMaximumTGraph,TGraph)(p)->SetMaximum(maximum);\
+}\
+void Type ## _setMinimumTGraph ( Type ## _p p, double minimum )\
+{\
+TYPECASTMETHOD(Type,setMinimumTGraph,TGraph)(p)->SetMinimum(minimum);\
+}\
+void Type ## _Set ( Type ## _p p, int n )\
+{\
+TYPECASTMETHOD(Type,Set,TGraph)(p)->Set(n);\
+}\
+void Type ## _SetPoint ( Type ## _p p, int i, double x, double y )\
+{\
+TYPECASTMETHOD(Type,SetPoint,TGraph)(p)->SetPoint(i, x, y);\
+}
+
+#undef TGRAPH_DEF_NONVIRT
+#define TGRAPH_DEF_NONVIRT(Type)\
+Type ## _p Type ## _newTGraph ( int n, double * x, double * y )\
+{\
+Type * newp = new Type (n, x, y); \
+return to_nonconst<Type ## _t, Type >(newp);\
+}\
+int Type ## _tGraphGetEditable ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,tGraphGetEditable,TGraph)(p)->GetEditable();\
+}\
+TF1_p Type ## _tGraphGetFunction ( Type ## _p p, const char* name )\
+{\
+return to_nonconst<TF1_t,TF1>((TF1*)TYPECASTMETHOD(Type,tGraphGetFunction,TGraph)(p)->GetFunction(name));\
+}\
+TH1F_p Type ## _tGraphGetHistogram ( Type ## _p p )\
+{\
+return to_nonconst<TH1F_t,TH1F>((TH1F*)TYPECASTMETHOD(Type,tGraphGetHistogram,TGraph)(p)->GetHistogram());\
+}\
+int Type ## _tGraphGetMaxSize ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,tGraphGetMaxSize,TGraph)(p)->GetMaxSize();\
+}\
+int Type ## _tGraphGetN ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,tGraphGetN,TGraph)(p)->GetN();\
+}\
+double Type ## _tGraphGetMaximum ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,tGraphGetMaximum,TGraph)(p)->GetMaximum();\
+}\
+double Type ## _tGraphGetMinimum ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,tGraphGetMinimum,TGraph)(p)->GetMinimum();\
+}\
+TAxis_p Type ## _tGraphGetXaxis ( Type ## _p p )\
+{\
+return to_nonconst<TAxis_t,TAxis>((TAxis*)TYPECASTMETHOD(Type,tGraphGetXaxis,TGraph)(p)->GetXaxis());\
+}\
+TAxis_p Type ## _tGraphGetYaxis ( Type ## _p p )\
+{\
+return to_nonconst<TAxis_t,TAxis>((TAxis*)TYPECASTMETHOD(Type,tGraphGetYaxis,TGraph)(p)->GetYaxis());\
+}\
+void Type ## _tGraphPaintGraph ( Type ## _p p, int npoints, double * x, double * y, const char* chopt )\
+{\
+TYPECASTMETHOD(Type,tGraphPaintGraph,TGraph)(p)->PaintGraph(npoints, x, y, chopt);\
+}\
+void Type ## _tGraphPaintGrapHist ( Type ## _p p, int npoints, double * x, double * y, const char* chopt )\
+{\
+TYPECASTMETHOD(Type,tGraphPaintGrapHist,TGraph)(p)->PaintGrapHist(npoints, x, y, chopt);\
+}
+
+TNAMED_DECL_VIRT(TGraph);
+TATTLINE_DECL_VIRT(TGraph);
+TATTFILL_DECL_VIRT(TGraph);
+TATTMARKER_DECL_VIRT(TGraph);
+TOBJECT_DECL_VIRT(TGraph);
+DELETABLE_DECL_VIRT(TGraph);
+
+
+TGRAPH_DECL_VIRT(TGraph);
+
+
+TGRAPH_DECL_NONVIRT(TGraph);
+
+
+#endif // __HROOT_HIST__TGraph__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTGraphAsymmErrors.cpp b/csrc/HROOTHistTGraphAsymmErrors.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTGraphAsymmErrors.cpp
@@ -0,0 +1,51 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTGraph.h"
+#include "TGraphAsymmErrors.h"
+#include "HROOTHistTGraphAsymmErrors.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+
+TGRAPH_DEF_VIRT(TGraphAsymmErrors)
+TNAMED_DEF_VIRT(TGraphAsymmErrors)
+TATTLINE_DEF_VIRT(TGraphAsymmErrors)
+TATTFILL_DEF_VIRT(TGraphAsymmErrors)
+TATTMARKER_DEF_VIRT(TGraphAsymmErrors)
+TOBJECT_DEF_VIRT(TGraphAsymmErrors)
+DELETABLE_DEF_VIRT(TGraphAsymmErrors)
+
+TGRAPHASYMMERRORS_DEF_VIRT(TGraphAsymmErrors)
+
+TGRAPHASYMMERRORS_DEF_NONVIRT(TGraphAsymmErrors)
+
+
diff --git a/csrc/HROOTHistTGraphAsymmErrors.h b/csrc/HROOTHistTGraphAsymmErrors.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTGraphAsymmErrors.h
@@ -0,0 +1,57 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TGraphAsymmErrors__
+#define __HROOT_HIST__TGraphAsymmErrors__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTGraph.h"
+#include "HROOTCoreTNamed.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreDeletable.h"
+
+#undef TGRAPHASYMMERRORS_DECL_VIRT
+#define TGRAPHASYMMERRORS_DECL_VIRT(Type) \
+
+
+#undef TGRAPHASYMMERRORS_DECL_NONVIRT
+#define TGRAPHASYMMERRORS_DECL_NONVIRT(Type) \
+Type ## _p Type ## _newTGraphAsymmErrors ( int n, double * x, double * y, double * exl, double * exh, double * eyl, double * eyh )
+
+#undef TGRAPHASYMMERRORS_DEF_VIRT
+#define TGRAPHASYMMERRORS_DEF_VIRT(Type)\
+
+
+#undef TGRAPHASYMMERRORS_DEF_NONVIRT
+#define TGRAPHASYMMERRORS_DEF_NONVIRT(Type)\
+Type ## _p Type ## _newTGraphAsymmErrors ( int n, double * x, double * y, double * exl, double * exh, double * eyl, double * eyh )\
+{\
+Type * newp = new Type (n, x, y, exl, exh, eyl, eyh); \
+return to_nonconst<Type ## _t, Type >(newp);\
+}
+
+TGRAPH_DECL_VIRT(TGraphAsymmErrors);
+TNAMED_DECL_VIRT(TGraphAsymmErrors);
+TATTLINE_DECL_VIRT(TGraphAsymmErrors);
+TATTFILL_DECL_VIRT(TGraphAsymmErrors);
+TATTMARKER_DECL_VIRT(TGraphAsymmErrors);
+TOBJECT_DECL_VIRT(TGraphAsymmErrors);
+DELETABLE_DECL_VIRT(TGraphAsymmErrors);
+
+
+TGRAPHASYMMERRORS_DECL_VIRT(TGraphAsymmErrors);
+
+
+TGRAPHASYMMERRORS_DECL_NONVIRT(TGraphAsymmErrors);
+
+
+#endif // __HROOT_HIST__TGraphAsymmErrors__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTGraphBentErrors.cpp b/csrc/HROOTHistTGraphBentErrors.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTGraphBentErrors.cpp
@@ -0,0 +1,51 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTGraph.h"
+#include "TGraphBentErrors.h"
+#include "HROOTHistTGraphBentErrors.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+
+TGRAPH_DEF_VIRT(TGraphBentErrors)
+TNAMED_DEF_VIRT(TGraphBentErrors)
+TATTLINE_DEF_VIRT(TGraphBentErrors)
+TATTFILL_DEF_VIRT(TGraphBentErrors)
+TATTMARKER_DEF_VIRT(TGraphBentErrors)
+TOBJECT_DEF_VIRT(TGraphBentErrors)
+DELETABLE_DEF_VIRT(TGraphBentErrors)
+
+TGRAPHBENTERRORS_DEF_VIRT(TGraphBentErrors)
+
+TGRAPHBENTERRORS_DEF_NONVIRT(TGraphBentErrors)
+
+
diff --git a/csrc/HROOTHistTGraphBentErrors.h b/csrc/HROOTHistTGraphBentErrors.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTGraphBentErrors.h
@@ -0,0 +1,57 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TGraphBentErrors__
+#define __HROOT_HIST__TGraphBentErrors__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTGraph.h"
+#include "HROOTCoreTNamed.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreDeletable.h"
+
+#undef TGRAPHBENTERRORS_DECL_VIRT
+#define TGRAPHBENTERRORS_DECL_VIRT(Type) \
+
+
+#undef TGRAPHBENTERRORS_DECL_NONVIRT
+#define TGRAPHBENTERRORS_DECL_NONVIRT(Type) \
+Type ## _p Type ## _newTGraphBentErrors ( int n, double * x, double * y, double * exl, double * exh, double * eyl, double * eyh, double * exld, double * exhd, double * eyld, double * eyhd )
+
+#undef TGRAPHBENTERRORS_DEF_VIRT
+#define TGRAPHBENTERRORS_DEF_VIRT(Type)\
+
+
+#undef TGRAPHBENTERRORS_DEF_NONVIRT
+#define TGRAPHBENTERRORS_DEF_NONVIRT(Type)\
+Type ## _p Type ## _newTGraphBentErrors ( int n, double * x, double * y, double * exl, double * exh, double * eyl, double * eyh, double * exld, double * exhd, double * eyld, double * eyhd )\
+{\
+Type * newp = new Type (n, x, y, exl, exh, eyl, eyh, exld, exhd, eyld, eyhd); \
+return to_nonconst<Type ## _t, Type >(newp);\
+}
+
+TGRAPH_DECL_VIRT(TGraphBentErrors);
+TNAMED_DECL_VIRT(TGraphBentErrors);
+TATTLINE_DECL_VIRT(TGraphBentErrors);
+TATTFILL_DECL_VIRT(TGraphBentErrors);
+TATTMARKER_DECL_VIRT(TGraphBentErrors);
+TOBJECT_DECL_VIRT(TGraphBentErrors);
+DELETABLE_DECL_VIRT(TGraphBentErrors);
+
+
+TGRAPHBENTERRORS_DECL_VIRT(TGraphBentErrors);
+
+
+TGRAPHBENTERRORS_DECL_NONVIRT(TGraphBentErrors);
+
+
+#endif // __HROOT_HIST__TGraphBentErrors__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTGraphErrors.cpp b/csrc/HROOTHistTGraphErrors.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTGraphErrors.cpp
@@ -0,0 +1,51 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTGraph.h"
+#include "TGraphErrors.h"
+#include "HROOTHistTGraphErrors.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+
+TGRAPH_DEF_VIRT(TGraphErrors)
+TNAMED_DEF_VIRT(TGraphErrors)
+TATTLINE_DEF_VIRT(TGraphErrors)
+TATTFILL_DEF_VIRT(TGraphErrors)
+TATTMARKER_DEF_VIRT(TGraphErrors)
+TOBJECT_DEF_VIRT(TGraphErrors)
+DELETABLE_DEF_VIRT(TGraphErrors)
+
+TGRAPHERRORS_DEF_VIRT(TGraphErrors)
+
+TGRAPHERRORS_DEF_NONVIRT(TGraphErrors)
+
+
diff --git a/csrc/HROOTHistTGraphErrors.h b/csrc/HROOTHistTGraphErrors.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTGraphErrors.h
@@ -0,0 +1,57 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TGraphErrors__
+#define __HROOT_HIST__TGraphErrors__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTGraph.h"
+#include "HROOTCoreTNamed.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreDeletable.h"
+
+#undef TGRAPHERRORS_DECL_VIRT
+#define TGRAPHERRORS_DECL_VIRT(Type) \
+
+
+#undef TGRAPHERRORS_DECL_NONVIRT
+#define TGRAPHERRORS_DECL_NONVIRT(Type) \
+Type ## _p Type ## _newTGraphErrors ( int n, double * x, double * y, double * ex, double * ey )
+
+#undef TGRAPHERRORS_DEF_VIRT
+#define TGRAPHERRORS_DEF_VIRT(Type)\
+
+
+#undef TGRAPHERRORS_DEF_NONVIRT
+#define TGRAPHERRORS_DEF_NONVIRT(Type)\
+Type ## _p Type ## _newTGraphErrors ( int n, double * x, double * y, double * ex, double * ey )\
+{\
+Type * newp = new Type (n, x, y, ex, ey); \
+return to_nonconst<Type ## _t, Type >(newp);\
+}
+
+TGRAPH_DECL_VIRT(TGraphErrors);
+TNAMED_DECL_VIRT(TGraphErrors);
+TATTLINE_DECL_VIRT(TGraphErrors);
+TATTFILL_DECL_VIRT(TGraphErrors);
+TATTMARKER_DECL_VIRT(TGraphErrors);
+TOBJECT_DECL_VIRT(TGraphErrors);
+DELETABLE_DECL_VIRT(TGraphErrors);
+
+
+TGRAPHERRORS_DECL_VIRT(TGraphErrors);
+
+
+TGRAPHERRORS_DECL_NONVIRT(TGraphErrors);
+
+
+#endif // __HROOT_HIST__TGraphErrors__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH1.cpp b/csrc/HROOTHistTH1.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH1.cpp
@@ -0,0 +1,56 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTCoreTDirectory.h"
+#include "HROOTHistTF1.h"
+#include "HROOTCoreTArrayD.h"
+#include "HROOTHistTAxis.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "TH1.h"
+#include "HROOTHistTH1.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+
+TOBJECT_DEF_VIRT(TH1)
+TATTLINE_DEF_VIRT(TH1)
+TATTFILL_DEF_VIRT(TH1)
+TATTMARKER_DEF_VIRT(TH1)
+DELETABLE_DEF_VIRT(TH1)
+
+TH1_DEF_VIRT(TH1)
+
+TH1_DEF_NONVIRT(TH1)
+
+
diff --git a/csrc/HROOTHistTH1.h b/csrc/HROOTHistTH1.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH1.h
@@ -0,0 +1,761 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH1__
+#define __HROOT_HIST__TH1__
+
+#include "HROOT-histType.h"
+
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOT-coreType.h"
+
+#undef TH1_DECL_VIRT
+#define TH1_DECL_VIRT(Type) \
+void Type ## _Add ( Type ## _p p, TH1_p h1, double c1 ); \
+void Type ## _AddBinContent ( Type ## _p p, int bin, double w ); \
+double Type ## _Chi2Test ( Type ## _p p, TH1_p h2, const char* option, double * res ); \
+double Type ## _ComputeIntegral ( Type ## _p p ); \
+void Type ## _DirectoryAutoAdd ( Type ## _p p, TDirectory_p dir ); \
+void Type ## _Divide ( Type ## _p p, TH1_p h1, TH1_p h2, double c1, double c2, const char* option ); \
+Type ## _p Type ## _drawCopyTH1 ( Type ## _p p, const char* option ); \
+TH1_p Type ## _DrawNormalized ( Type ## _p p, const char* option, double norm ); \
+void Type ## _drawPanelTH1 ( Type ## _p p ); \
+int Type ## _BufferEmpty ( Type ## _p p, int action ); \
+void Type ## _evalF ( Type ## _p p, TF1_p f1, const char* option ); \
+TH1_p Type ## _FFT ( Type ## _p p, TH1_p h_output, const char* option ); \
+int Type ## _fill1 ( Type ## _p p, double x ); \
+int Type ## _fill1w ( Type ## _p p, double x, double w ); \
+void Type ## _fillN1 ( Type ## _p p, int ntimes, double * x, double * w, int stride ); \
+void Type ## _FillRandom ( Type ## _p p, TH1_p h, int ntimes ); \
+int Type ## _FindBin ( Type ## _p p, double x, double y, double z ); \
+int Type ## _FindFixBin ( Type ## _p p, double x, double y, double z ); \
+int Type ## _FindFirstBinAbove ( Type ## _p p, double threshold, int axis ); \
+int Type ## _FindLastBinAbove ( Type ## _p p, double threshold, int axis ); \
+void Type ## _FitPanelTH1 ( Type ## _p p ); \
+int Type ## _getNdivisionA ( Type ## _p p, const char* axis ); \
+int Type ## _getAxisColorA ( Type ## _p p, const char* axis ); \
+int Type ## _getLabelColorA ( Type ## _p p, const char* axis ); \
+int Type ## _getLabelFontA ( Type ## _p p, const char* axis ); \
+double Type ## _getLabelOffsetA ( Type ## _p p, const char* axis ); \
+double Type ## _getLabelSizeA ( Type ## _p p, const char* axis ); \
+int Type ## _getTitleFontA ( Type ## _p p, const char* axis ); \
+double Type ## _getTitleOffsetA ( Type ## _p p, const char* axis ); \
+double Type ## _getTitleSizeA ( Type ## _p p, const char* axis ); \
+double Type ## _getTickLengthA ( Type ## _p p, const char* axis ); \
+double Type ## _GetBarOffset ( Type ## _p p ); \
+double Type ## _GetBarWidth ( Type ## _p p ); \
+int Type ## _GetContour ( Type ## _p p, double * levels ); \
+double Type ## _GetContourLevel ( Type ## _p p, int level ); \
+double Type ## _GetContourLevelPad ( Type ## _p p, int level ); \
+int Type ## _GetBin ( Type ## _p p, int binx, int biny, int binz ); \
+double Type ## _GetBinCenter ( Type ## _p p, int bin ); \
+double Type ## _GetBinContent1 ( Type ## _p p, int binx ); \
+double Type ## _GetBinContent2 ( Type ## _p p, int binx, int biny ); \
+double Type ## _GetBinContent3 ( Type ## _p p, int binx, int biny, int binz ); \
+double Type ## _GetBinError1 ( Type ## _p p, int binx ); \
+double Type ## _GetBinError2 ( Type ## _p p, int binx, int biny ); \
+double Type ## _GetBinError3 ( Type ## _p p, int binx, int biny, int binz ); \
+double Type ## _GetBinLowEdge ( Type ## _p p, int bin ); \
+double Type ## _GetBinWidth ( Type ## _p p, int bin ); \
+double Type ## _GetCellContent ( Type ## _p p, int binx, int biny ); \
+double Type ## _GetCellError ( Type ## _p p, int binx, int biny ); \
+double Type ## _GetEntries ( Type ## _p p ); \
+double Type ## _GetEffectiveEntries ( Type ## _p p ); \
+TF1_p Type ## _GetFunction ( Type ## _p p, const char* name ); \
+int Type ## _GetDimension ( Type ## _p p ); \
+double Type ## _GetKurtosis ( Type ## _p p, int axis ); \
+void Type ## _GetLowEdge ( Type ## _p p, double * edge ); \
+double Type ## _getMaximumTH1 ( Type ## _p p, double maxval ); \
+int Type ## _GetMaximumBin ( Type ## _p p ); \
+double Type ## _GetMaximumStored ( Type ## _p p ); \
+double Type ## _getMinimumTH1 ( Type ## _p p, double minval ); \
+int Type ## _GetMinimumBin ( Type ## _p p ); \
+double Type ## _GetMinimumStored ( Type ## _p p ); \
+double Type ## _GetMean ( Type ## _p p, int axis ); \
+double Type ## _GetMeanError ( Type ## _p p, int axis ); \
+double Type ## _GetNbinsX ( Type ## _p p ); \
+double Type ## _GetNbinsY ( Type ## _p p ); \
+double Type ## _GetNbinsZ ( Type ## _p p ); \
+int Type ## _getQuantilesTH1 ( Type ## _p p, int nprobSum, double * q, double * pbSum ); \
+double Type ## _GetRandom ( Type ## _p p ); \
+void Type ## _GetStats ( Type ## _p p, double * stats ); \
+double Type ## _GetSumOfWeights ( Type ## _p p ); \
+TArrayD_p Type ## _GetSumw2 ( Type ## _p p ); \
+int Type ## _GetSumw2N ( Type ## _p p ); \
+double Type ## _GetRMS ( Type ## _p p, int axis ); \
+double Type ## _GetRMSError ( Type ## _p p, int axis ); \
+double Type ## _GetSkewness ( Type ## _p p, int axis ); \
+double Type ## _integral1 ( Type ## _p p, int binx1, int binx2, const char* option ); \
+double Type ## _interpolate1 ( Type ## _p p, double x ); \
+double Type ## _interpolate2 ( Type ## _p p, double x, double y ); \
+double Type ## _interpolate3 ( Type ## _p p, double x, double y, double z ); \
+double Type ## _KolmogorovTest ( Type ## _p p, TH1_p h2, const char* option ); \
+void Type ## _LabelsDeflate ( Type ## _p p, const char* axis ); \
+void Type ## _LabelsInflate ( Type ## _p p, const char* axis ); \
+void Type ## _LabelsOption ( Type ## _p p, const char* option, const char* axis ); \
+void Type ## _multiflyF ( Type ## _p p, TF1_p h1, double c1 ); \
+void Type ## _Multiply ( Type ## _p p, TH1_p h1, TH1_p h2, double c1, double c2, const char* option ); \
+void Type ## _PutStats ( Type ## _p p, double * stats ); \
+TH1_p Type ## _Rebin ( Type ## _p p, int ngroup, const char* newname, double * xbins ); \
+void Type ## _RebinAxis ( Type ## _p p, double x, TAxis_p axis ); \
+void Type ## _Rebuild ( Type ## _p p, const char* option ); \
+void Type ## _RecursiveRemove ( Type ## _p p, TObject_p obj ); \
+void Type ## _Reset ( Type ## _p p, const char* option ); \
+void Type ## _ResetStats ( Type ## _p p ); \
+void Type ## _Scale ( Type ## _p p, double c1, const char* option ); \
+void Type ## _setAxisColorA ( Type ## _p p, int color, const char* axis ); \
+void Type ## _SetAxisRange ( Type ## _p p, double xmin, double xmax, const char* axis ); \
+void Type ## _SetBarOffset ( Type ## _p p, double offset ); \
+void Type ## _SetBarWidth ( Type ## _p p, double width ); \
+void Type ## _setBinContent1 ( Type ## _p p, int bin, double content ); \
+void Type ## _setBinContent2 ( Type ## _p p, int binx, int biny, double content ); \
+void Type ## _setBinContent3 ( Type ## _p p, int binx, int biny, int binz, double content ); \
+void Type ## _setBinError1 ( Type ## _p p, int bin, double error ); \
+void Type ## _setBinError2 ( Type ## _p p, int binx, int biny, double error ); \
+void Type ## _setBinError3 ( Type ## _p p, int binx, int biny, int binz, double error ); \
+void Type ## _setBins1 ( Type ## _p p, int nx, double * xBins ); \
+void Type ## _setBins2 ( Type ## _p p, int nx, double * xBins, int ny, double * yBins ); \
+void Type ## _setBins3 ( Type ## _p p, int nx, double * xBins, int ny, double * yBins, int nz, double * zBins ); \
+void Type ## _SetBinsLength ( Type ## _p p, int bin ); \
+void Type ## _SetBuffer ( Type ## _p p, int buffersize, const char* option ); \
+void Type ## _SetCellContent ( Type ## _p p, int binx, int biny, double content ); \
+void Type ## _SetContent ( Type ## _p p, double * content ); \
+void Type ## _SetContour ( Type ## _p p, int nlevels, double * levels ); \
+void Type ## _SetContourLevel ( Type ## _p p, int level, double value ); \
+void Type ## _SetDirectory ( Type ## _p p, TDirectory_p dir ); \
+void Type ## _SetEntries ( Type ## _p p, double n ); \
+void Type ## _SetError ( Type ## _p p, double * error ); \
+void Type ## _setLabelColorA ( Type ## _p p, int color, const char* axis ); \
+void Type ## _setLabelSizeA ( Type ## _p p, double size, const char* axis ); \
+void Type ## _setLabelFontA ( Type ## _p p, int font, const char* axis ); \
+void Type ## _setLabelOffsetA ( Type ## _p p, double offset, const char* axis ); \
+void Type ## _SetMaximum ( Type ## _p p, double maximum ); \
+void Type ## _SetMinimum ( Type ## _p p, double minimum ); \
+void Type ## _SetNormFactor ( Type ## _p p, double factor ); \
+void Type ## _SetStats ( Type ## _p p, int stats ); \
+void Type ## _SetOption ( Type ## _p p, const char* option ); \
+void Type ## _SetXTitle ( Type ## _p p, const char* title ); \
+void Type ## _SetYTitle ( Type ## _p p, const char* title ); \
+void Type ## _SetZTitle ( Type ## _p p, const char* title ); \
+TH1_p Type ## _ShowBackground ( Type ## _p p, int niter, const char* option ); \
+int Type ## _ShowPeaks ( Type ## _p p, double sigma, const char* option, double threshold ); \
+void Type ## _Smooth ( Type ## _p p, int ntimes, const char* option ); \
+void Type ## _Sumw2 ( Type ## _p p )
+
+#undef TH1_DECL_NONVIRT
+#define TH1_DECL_NONVIRT(Type) \
+Type ## _p Type ## _tH1GetAsymmetry ( Type ## _p p, TH1_p h2, double c2, double dc2 ); \
+int Type ## _tH1GetBufferLength ( Type ## _p p ); \
+int Type ## _tH1GetBufferSize ( Type ## _p p ); \
+int Type ## _tH1GetDefaultBufferSize (  ); \
+int Type ## _tH1GetDefaultSumw2 (  ); \
+TDirectory_p Type ## _tH1GetDirectory ( Type ## _p p ); \
+int Type ## _tH1IsBinOverflow ( Type ## _p p, int bin ); \
+int Type ## _tH1IsBinUnderflow ( Type ## _p p, int bin ); \
+void Type ## _tH1SetDefaultBufferSize ( int buffersize ); \
+void Type ## _tH1SetDefaultSumw2 ( int sumw2 ); \
+void Type ## _tH1SmoothArray ( int NN, double * XX, int ntimes ); \
+void Type ## _tH1StatOverflows ( int flag ); \
+void Type ## _tH1UseCurrentStyle ( Type ## _p p )
+
+#undef TH1_DEF_VIRT
+#define TH1_DEF_VIRT(Type)\
+void Type ## _Add ( Type ## _p p, TH1_p h1, double c1 )\
+{\
+TYPECASTMETHOD(Type,Add,TH1)(p)->Add(to_nonconst<TH1,TH1_t>(h1), c1);\
+}\
+void Type ## _AddBinContent ( Type ## _p p, int bin, double w )\
+{\
+TYPECASTMETHOD(Type,AddBinContent,TH1)(p)->AddBinContent(bin, w);\
+}\
+double Type ## _Chi2Test ( Type ## _p p, TH1_p h2, const char* option, double * res )\
+{\
+return TYPECASTMETHOD(Type,Chi2Test,TH1)(p)->Chi2Test(to_nonconst<TH1,TH1_t>(h2), option, res);\
+}\
+double Type ## _ComputeIntegral ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,ComputeIntegral,TH1)(p)->ComputeIntegral();\
+}\
+void Type ## _DirectoryAutoAdd ( Type ## _p p, TDirectory_p dir )\
+{\
+TYPECASTMETHOD(Type,DirectoryAutoAdd,TH1)(p)->DirectoryAutoAdd(to_nonconst<TDirectory,TDirectory_t>(dir));\
+}\
+void Type ## _Divide ( Type ## _p p, TH1_p h1, TH1_p h2, double c1, double c2, const char* option )\
+{\
+TYPECASTMETHOD(Type,Divide,TH1)(p)->Divide(to_nonconst<TH1,TH1_t>(h1), to_nonconst<TH1,TH1_t>(h2), c1, c2, option);\
+}\
+Type ## _p Type ## _drawCopyTH1 ( Type ## _p p, const char* option )\
+{\
+return to_nonconst<Type ## _t, Type>((Type *)TYPECASTMETHOD(Type,drawCopyTH1,TH1)(p)->DrawCopy(option)) ;\
+}\
+TH1_p Type ## _DrawNormalized ( Type ## _p p, const char* option, double norm )\
+{\
+return to_nonconst<TH1_t,TH1>((TH1*)TYPECASTMETHOD(Type,DrawNormalized,TH1)(p)->DrawNormalized(option, norm));\
+}\
+void Type ## _drawPanelTH1 ( Type ## _p p )\
+{\
+TYPECASTMETHOD(Type,drawPanelTH1,TH1)(p)->DrawPanel();\
+}\
+int Type ## _BufferEmpty ( Type ## _p p, int action )\
+{\
+return TYPECASTMETHOD(Type,BufferEmpty,TH1)(p)->BufferEmpty(action);\
+}\
+void Type ## _evalF ( Type ## _p p, TF1_p f1, const char* option )\
+{\
+TYPECASTMETHOD(Type,evalF,TH1)(p)->Eval(to_nonconst<TF1,TF1_t>(f1), option);\
+}\
+TH1_p Type ## _FFT ( Type ## _p p, TH1_p h_output, const char* option )\
+{\
+return to_nonconst<TH1_t,TH1>((TH1*)TYPECASTMETHOD(Type,FFT,TH1)(p)->FFT(to_nonconst<TH1,TH1_t>(h_output), option));\
+}\
+int Type ## _fill1 ( Type ## _p p, double x )\
+{\
+return TYPECASTMETHOD(Type,fill1,TH1)(p)->Fill(x);\
+}\
+int Type ## _fill1w ( Type ## _p p, double x, double w )\
+{\
+return TYPECASTMETHOD(Type,fill1w,TH1)(p)->Fill(x, w);\
+}\
+void Type ## _fillN1 ( Type ## _p p, int ntimes, double * x, double * w, int stride )\
+{\
+TYPECASTMETHOD(Type,fillN1,TH1)(p)->FillN(ntimes, x, w, stride);\
+}\
+void Type ## _FillRandom ( Type ## _p p, TH1_p h, int ntimes )\
+{\
+TYPECASTMETHOD(Type,FillRandom,TH1)(p)->FillRandom(to_nonconst<TH1,TH1_t>(h), ntimes);\
+}\
+int Type ## _FindBin ( Type ## _p p, double x, double y, double z )\
+{\
+return TYPECASTMETHOD(Type,FindBin,TH1)(p)->FindBin(x, y, z);\
+}\
+int Type ## _FindFixBin ( Type ## _p p, double x, double y, double z )\
+{\
+return TYPECASTMETHOD(Type,FindFixBin,TH1)(p)->FindFixBin(x, y, z);\
+}\
+int Type ## _FindFirstBinAbove ( Type ## _p p, double threshold, int axis )\
+{\
+return TYPECASTMETHOD(Type,FindFirstBinAbove,TH1)(p)->FindFirstBinAbove(threshold, axis);\
+}\
+int Type ## _FindLastBinAbove ( Type ## _p p, double threshold, int axis )\
+{\
+return TYPECASTMETHOD(Type,FindLastBinAbove,TH1)(p)->FindLastBinAbove(threshold, axis);\
+}\
+void Type ## _FitPanelTH1 ( Type ## _p p )\
+{\
+TYPECASTMETHOD(Type,FitPanelTH1,TH1)(p)->FitPanel();\
+}\
+int Type ## _getNdivisionA ( Type ## _p p, const char* axis )\
+{\
+return TYPECASTMETHOD(Type,getNdivisionA,TH1)(p)->GetNdivisions(axis);\
+}\
+int Type ## _getAxisColorA ( Type ## _p p, const char* axis )\
+{\
+return TYPECASTMETHOD(Type,getAxisColorA,TH1)(p)->GetAxisColor(axis);\
+}\
+int Type ## _getLabelColorA ( Type ## _p p, const char* axis )\
+{\
+return TYPECASTMETHOD(Type,getLabelColorA,TH1)(p)->GetLabelColor(axis);\
+}\
+int Type ## _getLabelFontA ( Type ## _p p, const char* axis )\
+{\
+return TYPECASTMETHOD(Type,getLabelFontA,TH1)(p)->GetLabelFont(axis);\
+}\
+double Type ## _getLabelOffsetA ( Type ## _p p, const char* axis )\
+{\
+return TYPECASTMETHOD(Type,getLabelOffsetA,TH1)(p)->GetLabelOffset(axis);\
+}\
+double Type ## _getLabelSizeA ( Type ## _p p, const char* axis )\
+{\
+return TYPECASTMETHOD(Type,getLabelSizeA,TH1)(p)->GetLabelSize(axis);\
+}\
+int Type ## _getTitleFontA ( Type ## _p p, const char* axis )\
+{\
+return TYPECASTMETHOD(Type,getTitleFontA,TH1)(p)->GetTitleFont(axis);\
+}\
+double Type ## _getTitleOffsetA ( Type ## _p p, const char* axis )\
+{\
+return TYPECASTMETHOD(Type,getTitleOffsetA,TH1)(p)->GetTitleOffset(axis);\
+}\
+double Type ## _getTitleSizeA ( Type ## _p p, const char* axis )\
+{\
+return TYPECASTMETHOD(Type,getTitleSizeA,TH1)(p)->GetTitleSize(axis);\
+}\
+double Type ## _getTickLengthA ( Type ## _p p, const char* axis )\
+{\
+return TYPECASTMETHOD(Type,getTickLengthA,TH1)(p)->GetTickLength(axis);\
+}\
+double Type ## _GetBarOffset ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetBarOffset,TH1)(p)->GetBarOffset();\
+}\
+double Type ## _GetBarWidth ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetBarWidth,TH1)(p)->GetBarWidth();\
+}\
+int Type ## _GetContour ( Type ## _p p, double * levels )\
+{\
+return TYPECASTMETHOD(Type,GetContour,TH1)(p)->GetContour(levels);\
+}\
+double Type ## _GetContourLevel ( Type ## _p p, int level )\
+{\
+return TYPECASTMETHOD(Type,GetContourLevel,TH1)(p)->GetContourLevel(level);\
+}\
+double Type ## _GetContourLevelPad ( Type ## _p p, int level )\
+{\
+return TYPECASTMETHOD(Type,GetContourLevelPad,TH1)(p)->GetContourLevelPad(level);\
+}\
+int Type ## _GetBin ( Type ## _p p, int binx, int biny, int binz )\
+{\
+return TYPECASTMETHOD(Type,GetBin,TH1)(p)->GetBin(binx, biny, binz);\
+}\
+double Type ## _GetBinCenter ( Type ## _p p, int bin )\
+{\
+return TYPECASTMETHOD(Type,GetBinCenter,TH1)(p)->GetBinCenter(bin);\
+}\
+double Type ## _GetBinContent1 ( Type ## _p p, int binx )\
+{\
+return TYPECASTMETHOD(Type,GetBinContent1,TH1)(p)->GetBinContent(binx);\
+}\
+double Type ## _GetBinContent2 ( Type ## _p p, int binx, int biny )\
+{\
+return TYPECASTMETHOD(Type,GetBinContent2,TH1)(p)->GetBinContent(binx, biny);\
+}\
+double Type ## _GetBinContent3 ( Type ## _p p, int binx, int biny, int binz )\
+{\
+return TYPECASTMETHOD(Type,GetBinContent3,TH1)(p)->GetBinContent(binx, biny, binz);\
+}\
+double Type ## _GetBinError1 ( Type ## _p p, int binx )\
+{\
+return TYPECASTMETHOD(Type,GetBinError1,TH1)(p)->GetBinError(binx);\
+}\
+double Type ## _GetBinError2 ( Type ## _p p, int binx, int biny )\
+{\
+return TYPECASTMETHOD(Type,GetBinError2,TH1)(p)->GetBinError(binx, biny);\
+}\
+double Type ## _GetBinError3 ( Type ## _p p, int binx, int biny, int binz )\
+{\
+return TYPECASTMETHOD(Type,GetBinError3,TH1)(p)->GetBinError(binx, biny, binz);\
+}\
+double Type ## _GetBinLowEdge ( Type ## _p p, int bin )\
+{\
+return TYPECASTMETHOD(Type,GetBinLowEdge,TH1)(p)->GetBinLowEdge(bin);\
+}\
+double Type ## _GetBinWidth ( Type ## _p p, int bin )\
+{\
+return TYPECASTMETHOD(Type,GetBinWidth,TH1)(p)->GetBinWidth(bin);\
+}\
+double Type ## _GetCellContent ( Type ## _p p, int binx, int biny )\
+{\
+return TYPECASTMETHOD(Type,GetCellContent,TH1)(p)->GetCellContent(binx, biny);\
+}\
+double Type ## _GetCellError ( Type ## _p p, int binx, int biny )\
+{\
+return TYPECASTMETHOD(Type,GetCellError,TH1)(p)->GetCellError(binx, biny);\
+}\
+double Type ## _GetEntries ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetEntries,TH1)(p)->GetEntries();\
+}\
+double Type ## _GetEffectiveEntries ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetEffectiveEntries,TH1)(p)->GetEffectiveEntries();\
+}\
+TF1_p Type ## _GetFunction ( Type ## _p p, const char* name )\
+{\
+return to_nonconst<TF1_t,TF1>((TF1*)TYPECASTMETHOD(Type,GetFunction,TH1)(p)->GetFunction(name));\
+}\
+int Type ## _GetDimension ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetDimension,TH1)(p)->GetDimension();\
+}\
+double Type ## _GetKurtosis ( Type ## _p p, int axis )\
+{\
+return TYPECASTMETHOD(Type,GetKurtosis,TH1)(p)->GetKurtosis(axis);\
+}\
+void Type ## _GetLowEdge ( Type ## _p p, double * edge )\
+{\
+TYPECASTMETHOD(Type,GetLowEdge,TH1)(p)->GetLowEdge(edge);\
+}\
+double Type ## _getMaximumTH1 ( Type ## _p p, double maxval )\
+{\
+return TYPECASTMETHOD(Type,getMaximumTH1,TH1)(p)->GetMaximum(maxval);\
+}\
+int Type ## _GetMaximumBin ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetMaximumBin,TH1)(p)->GetMaximumBin();\
+}\
+double Type ## _GetMaximumStored ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetMaximumStored,TH1)(p)->GetMaximumStored();\
+}\
+double Type ## _getMinimumTH1 ( Type ## _p p, double minval )\
+{\
+return TYPECASTMETHOD(Type,getMinimumTH1,TH1)(p)->GetMinimum(minval);\
+}\
+int Type ## _GetMinimumBin ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetMinimumBin,TH1)(p)->GetMinimumBin();\
+}\
+double Type ## _GetMinimumStored ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetMinimumStored,TH1)(p)->GetMinimumStored();\
+}\
+double Type ## _GetMean ( Type ## _p p, int axis )\
+{\
+return TYPECASTMETHOD(Type,GetMean,TH1)(p)->GetMean(axis);\
+}\
+double Type ## _GetMeanError ( Type ## _p p, int axis )\
+{\
+return TYPECASTMETHOD(Type,GetMeanError,TH1)(p)->GetMeanError(axis);\
+}\
+double Type ## _GetNbinsX ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetNbinsX,TH1)(p)->GetNbinsX();\
+}\
+double Type ## _GetNbinsY ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetNbinsY,TH1)(p)->GetNbinsY();\
+}\
+double Type ## _GetNbinsZ ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetNbinsZ,TH1)(p)->GetNbinsZ();\
+}\
+int Type ## _getQuantilesTH1 ( Type ## _p p, int nprobSum, double * q, double * pbSum )\
+{\
+return TYPECASTMETHOD(Type,getQuantilesTH1,TH1)(p)->GetQuantiles(nprobSum, q, pbSum);\
+}\
+double Type ## _GetRandom ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetRandom,TH1)(p)->GetRandom();\
+}\
+void Type ## _GetStats ( Type ## _p p, double * stats )\
+{\
+TYPECASTMETHOD(Type,GetStats,TH1)(p)->GetStats(stats);\
+}\
+double Type ## _GetSumOfWeights ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetSumOfWeights,TH1)(p)->GetSumOfWeights();\
+}\
+TArrayD_p Type ## _GetSumw2 ( Type ## _p p )\
+{\
+return to_nonconst<TArrayD_t,TArrayD>((TArrayD*)TYPECASTMETHOD(Type,GetSumw2,TH1)(p)->GetSumw2());\
+}\
+int Type ## _GetSumw2N ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,GetSumw2N,TH1)(p)->GetSumw2N();\
+}\
+double Type ## _GetRMS ( Type ## _p p, int axis )\
+{\
+return TYPECASTMETHOD(Type,GetRMS,TH1)(p)->GetRMS(axis);\
+}\
+double Type ## _GetRMSError ( Type ## _p p, int axis )\
+{\
+return TYPECASTMETHOD(Type,GetRMSError,TH1)(p)->GetRMSError(axis);\
+}\
+double Type ## _GetSkewness ( Type ## _p p, int axis )\
+{\
+return TYPECASTMETHOD(Type,GetSkewness,TH1)(p)->GetSkewness(axis);\
+}\
+double Type ## _integral1 ( Type ## _p p, int binx1, int binx2, const char* option )\
+{\
+return TYPECASTMETHOD(Type,integral1,TH1)(p)->Integral(binx1, binx2, option);\
+}\
+double Type ## _interpolate1 ( Type ## _p p, double x )\
+{\
+return TYPECASTMETHOD(Type,interpolate1,TH1)(p)->Interpolate(x);\
+}\
+double Type ## _interpolate2 ( Type ## _p p, double x, double y )\
+{\
+return TYPECASTMETHOD(Type,interpolate2,TH1)(p)->Interpolate(x, y);\
+}\
+double Type ## _interpolate3 ( Type ## _p p, double x, double y, double z )\
+{\
+return TYPECASTMETHOD(Type,interpolate3,TH1)(p)->Interpolate(x, y, z);\
+}\
+double Type ## _KolmogorovTest ( Type ## _p p, TH1_p h2, const char* option )\
+{\
+return TYPECASTMETHOD(Type,KolmogorovTest,TH1)(p)->KolmogorovTest(to_nonconst<TH1,TH1_t>(h2), option);\
+}\
+void Type ## _LabelsDeflate ( Type ## _p p, const char* axis )\
+{\
+TYPECASTMETHOD(Type,LabelsDeflate,TH1)(p)->LabelsDeflate(axis);\
+}\
+void Type ## _LabelsInflate ( Type ## _p p, const char* axis )\
+{\
+TYPECASTMETHOD(Type,LabelsInflate,TH1)(p)->LabelsInflate(axis);\
+}\
+void Type ## _LabelsOption ( Type ## _p p, const char* option, const char* axis )\
+{\
+TYPECASTMETHOD(Type,LabelsOption,TH1)(p)->LabelsOption(option, axis);\
+}\
+void Type ## _multiflyF ( Type ## _p p, TF1_p h1, double c1 )\
+{\
+TYPECASTMETHOD(Type,multiflyF,TH1)(p)->Multiply(to_nonconst<TF1,TF1_t>(h1), c1);\
+}\
+void Type ## _Multiply ( Type ## _p p, TH1_p h1, TH1_p h2, double c1, double c2, const char* option )\
+{\
+TYPECASTMETHOD(Type,Multiply,TH1)(p)->Multiply(to_nonconst<TH1,TH1_t>(h1), to_nonconst<TH1,TH1_t>(h2), c1, c2, option);\
+}\
+void Type ## _PutStats ( Type ## _p p, double * stats )\
+{\
+TYPECASTMETHOD(Type,PutStats,TH1)(p)->PutStats(stats);\
+}\
+TH1_p Type ## _Rebin ( Type ## _p p, int ngroup, const char* newname, double * xbins )\
+{\
+return to_nonconst<TH1_t,TH1>((TH1*)TYPECASTMETHOD(Type,Rebin,TH1)(p)->Rebin(ngroup, newname, xbins));\
+}\
+void Type ## _RebinAxis ( Type ## _p p, double x, TAxis_p axis )\
+{\
+TYPECASTMETHOD(Type,RebinAxis,TH1)(p)->RebinAxis(x, to_nonconst<TAxis,TAxis_t>(axis));\
+}\
+void Type ## _Rebuild ( Type ## _p p, const char* option )\
+{\
+TYPECASTMETHOD(Type,Rebuild,TH1)(p)->Rebuild(option);\
+}\
+void Type ## _RecursiveRemove ( Type ## _p p, TObject_p obj )\
+{\
+TYPECASTMETHOD(Type,RecursiveRemove,TH1)(p)->RecursiveRemove(to_nonconst<TObject,TObject_t>(obj));\
+}\
+void Type ## _Reset ( Type ## _p p, const char* option )\
+{\
+TYPECASTMETHOD(Type,Reset,TH1)(p)->Reset(option);\
+}\
+void Type ## _ResetStats ( Type ## _p p )\
+{\
+TYPECASTMETHOD(Type,ResetStats,TH1)(p)->ResetStats();\
+}\
+void Type ## _Scale ( Type ## _p p, double c1, const char* option )\
+{\
+TYPECASTMETHOD(Type,Scale,TH1)(p)->Scale(c1, option);\
+}\
+void Type ## _setAxisColorA ( Type ## _p p, int color, const char* axis )\
+{\
+TYPECASTMETHOD(Type,setAxisColorA,TH1)(p)->SetAxisColor(color, axis);\
+}\
+void Type ## _SetAxisRange ( Type ## _p p, double xmin, double xmax, const char* axis )\
+{\
+TYPECASTMETHOD(Type,SetAxisRange,TH1)(p)->SetAxisRange(xmin, xmax, axis);\
+}\
+void Type ## _SetBarOffset ( Type ## _p p, double offset )\
+{\
+TYPECASTMETHOD(Type,SetBarOffset,TH1)(p)->SetBarOffset(offset);\
+}\
+void Type ## _SetBarWidth ( Type ## _p p, double width )\
+{\
+TYPECASTMETHOD(Type,SetBarWidth,TH1)(p)->SetBarWidth(width);\
+}\
+void Type ## _setBinContent1 ( Type ## _p p, int bin, double content )\
+{\
+TYPECASTMETHOD(Type,setBinContent1,TH1)(p)->SetBinContent(bin, content);\
+}\
+void Type ## _setBinContent2 ( Type ## _p p, int binx, int biny, double content )\
+{\
+TYPECASTMETHOD(Type,setBinContent2,TH1)(p)->SetBinContent(binx, biny, content);\
+}\
+void Type ## _setBinContent3 ( Type ## _p p, int binx, int biny, int binz, double content )\
+{\
+TYPECASTMETHOD(Type,setBinContent3,TH1)(p)->SetBinContent(binx, biny, binz, content);\
+}\
+void Type ## _setBinError1 ( Type ## _p p, int bin, double error )\
+{\
+TYPECASTMETHOD(Type,setBinError1,TH1)(p)->SetBinError(bin, error);\
+}\
+void Type ## _setBinError2 ( Type ## _p p, int binx, int biny, double error )\
+{\
+TYPECASTMETHOD(Type,setBinError2,TH1)(p)->SetBinError(binx, biny, error);\
+}\
+void Type ## _setBinError3 ( Type ## _p p, int binx, int biny, int binz, double error )\
+{\
+TYPECASTMETHOD(Type,setBinError3,TH1)(p)->SetBinError(binx, biny, binz, error);\
+}\
+void Type ## _setBins1 ( Type ## _p p, int nx, double * xBins )\
+{\
+TYPECASTMETHOD(Type,setBins1,TH1)(p)->SetBins(nx, xBins);\
+}\
+void Type ## _setBins2 ( Type ## _p p, int nx, double * xBins, int ny, double * yBins )\
+{\
+TYPECASTMETHOD(Type,setBins2,TH1)(p)->SetBins(nx, xBins, ny, yBins);\
+}\
+void Type ## _setBins3 ( Type ## _p p, int nx, double * xBins, int ny, double * yBins, int nz, double * zBins )\
+{\
+TYPECASTMETHOD(Type,setBins3,TH1)(p)->SetBins(nx, xBins, ny, yBins, nz, zBins);\
+}\
+void Type ## _SetBinsLength ( Type ## _p p, int bin )\
+{\
+TYPECASTMETHOD(Type,SetBinsLength,TH1)(p)->SetBinsLength(bin);\
+}\
+void Type ## _SetBuffer ( Type ## _p p, int buffersize, const char* option )\
+{\
+TYPECASTMETHOD(Type,SetBuffer,TH1)(p)->SetBuffer(buffersize, option);\
+}\
+void Type ## _SetCellContent ( Type ## _p p, int binx, int biny, double content )\
+{\
+TYPECASTMETHOD(Type,SetCellContent,TH1)(p)->SetCellContent(binx, biny, content);\
+}\
+void Type ## _SetContent ( Type ## _p p, double * content )\
+{\
+TYPECASTMETHOD(Type,SetContent,TH1)(p)->SetContent(content);\
+}\
+void Type ## _SetContour ( Type ## _p p, int nlevels, double * levels )\
+{\
+TYPECASTMETHOD(Type,SetContour,TH1)(p)->SetContour(nlevels, levels);\
+}\
+void Type ## _SetContourLevel ( Type ## _p p, int level, double value )\
+{\
+TYPECASTMETHOD(Type,SetContourLevel,TH1)(p)->SetContourLevel(level, value);\
+}\
+void Type ## _SetDirectory ( Type ## _p p, TDirectory_p dir )\
+{\
+TYPECASTMETHOD(Type,SetDirectory,TH1)(p)->SetDirectory(to_nonconst<TDirectory,TDirectory_t>(dir));\
+}\
+void Type ## _SetEntries ( Type ## _p p, double n )\
+{\
+TYPECASTMETHOD(Type,SetEntries,TH1)(p)->SetEntries(n);\
+}\
+void Type ## _SetError ( Type ## _p p, double * error )\
+{\
+TYPECASTMETHOD(Type,SetError,TH1)(p)->SetError(error);\
+}\
+void Type ## _setLabelColorA ( Type ## _p p, int color, const char* axis )\
+{\
+TYPECASTMETHOD(Type,setLabelColorA,TH1)(p)->SetLabelColor(color, axis);\
+}\
+void Type ## _setLabelSizeA ( Type ## _p p, double size, const char* axis )\
+{\
+TYPECASTMETHOD(Type,setLabelSizeA,TH1)(p)->SetLabelSize(size, axis);\
+}\
+void Type ## _setLabelFontA ( Type ## _p p, int font, const char* axis )\
+{\
+TYPECASTMETHOD(Type,setLabelFontA,TH1)(p)->SetLabelFont(font, axis);\
+}\
+void Type ## _setLabelOffsetA ( Type ## _p p, double offset, const char* axis )\
+{\
+TYPECASTMETHOD(Type,setLabelOffsetA,TH1)(p)->SetLabelOffset(offset, axis);\
+}\
+void Type ## _SetMaximum ( Type ## _p p, double maximum )\
+{\
+TYPECASTMETHOD(Type,SetMaximum,TH1)(p)->SetMaximum(maximum);\
+}\
+void Type ## _SetMinimum ( Type ## _p p, double minimum )\
+{\
+TYPECASTMETHOD(Type,SetMinimum,TH1)(p)->SetMinimum(minimum);\
+}\
+void Type ## _SetNormFactor ( Type ## _p p, double factor )\
+{\
+TYPECASTMETHOD(Type,SetNormFactor,TH1)(p)->SetNormFactor(factor);\
+}\
+void Type ## _SetStats ( Type ## _p p, int stats )\
+{\
+TYPECASTMETHOD(Type,SetStats,TH1)(p)->SetStats(stats);\
+}\
+void Type ## _SetOption ( Type ## _p p, const char* option )\
+{\
+TYPECASTMETHOD(Type,SetOption,TH1)(p)->SetOption(option);\
+}\
+void Type ## _SetXTitle ( Type ## _p p, const char* title )\
+{\
+TYPECASTMETHOD(Type,SetXTitle,TH1)(p)->SetXTitle(title);\
+}\
+void Type ## _SetYTitle ( Type ## _p p, const char* title )\
+{\
+TYPECASTMETHOD(Type,SetYTitle,TH1)(p)->SetYTitle(title);\
+}\
+void Type ## _SetZTitle ( Type ## _p p, const char* title )\
+{\
+TYPECASTMETHOD(Type,SetZTitle,TH1)(p)->SetZTitle(title);\
+}\
+TH1_p Type ## _ShowBackground ( Type ## _p p, int niter, const char* option )\
+{\
+return to_nonconst<TH1_t,TH1>((TH1*)TYPECASTMETHOD(Type,ShowBackground,TH1)(p)->ShowBackground(niter, option));\
+}\
+int Type ## _ShowPeaks ( Type ## _p p, double sigma, const char* option, double threshold )\
+{\
+return TYPECASTMETHOD(Type,ShowPeaks,TH1)(p)->ShowPeaks(sigma, option, threshold);\
+}\
+void Type ## _Smooth ( Type ## _p p, int ntimes, const char* option )\
+{\
+TYPECASTMETHOD(Type,Smooth,TH1)(p)->Smooth(ntimes, option);\
+}\
+void Type ## _Sumw2 ( Type ## _p p )\
+{\
+TYPECASTMETHOD(Type,Sumw2,TH1)(p)->Sumw2();\
+}
+
+#undef TH1_DEF_NONVIRT
+#define TH1_DEF_NONVIRT(Type)\
+Type ## _p Type ## _tH1GetAsymmetry ( Type ## _p p, TH1_p h2, double c2, double dc2 )\
+{\
+return to_nonconst<Type ## _t, Type>((Type *)TYPECASTMETHOD(Type,tH1GetAsymmetry,TH1)(p)->GetAsymmetry(to_nonconst<TH1,TH1_t>(h2), c2, dc2)) ;\
+}\
+int Type ## _tH1GetBufferLength ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,tH1GetBufferLength,TH1)(p)->GetBufferLength();\
+}\
+int Type ## _tH1GetBufferSize ( Type ## _p p )\
+{\
+return TYPECASTMETHOD(Type,tH1GetBufferSize,TH1)(p)->GetBufferSize();\
+}\
+int Type ## _tH1GetDefaultBufferSize (  )\
+{\
+return TH1::GetDefaultBufferSize();\
+}\
+int Type ## _tH1GetDefaultSumw2 (  )\
+{\
+return TH1::GetDefaultSumw2();\
+}\
+TDirectory_p Type ## _tH1GetDirectory ( Type ## _p p )\
+{\
+return to_nonconst<TDirectory_t,TDirectory>((TDirectory*)TYPECASTMETHOD(Type,tH1GetDirectory,TH1)(p)->GetDirectory());\
+}\
+int Type ## _tH1IsBinOverflow ( Type ## _p p, int bin )\
+{\
+return TYPECASTMETHOD(Type,tH1IsBinOverflow,TH1)(p)->IsBinOverflow(bin);\
+}\
+int Type ## _tH1IsBinUnderflow ( Type ## _p p, int bin )\
+{\
+return TYPECASTMETHOD(Type,tH1IsBinUnderflow,TH1)(p)->IsBinUnderflow(bin);\
+}\
+void Type ## _tH1SetDefaultBufferSize ( int buffersize )\
+{\
+TH1::SetDefaultBufferSize(buffersize);\
+}\
+void Type ## _tH1SetDefaultSumw2 ( int sumw2 )\
+{\
+TH1::SetDefaultSumw2(sumw2);\
+}\
+void Type ## _tH1SmoothArray ( int NN, double * XX, int ntimes )\
+{\
+TH1::SmoothArray(NN, XX, ntimes);\
+}\
+void Type ## _tH1StatOverflows ( int flag )\
+{\
+TH1::StatOverflows(flag);\
+}\
+void Type ## _tH1UseCurrentStyle ( Type ## _p p )\
+{\
+TYPECASTMETHOD(Type,tH1UseCurrentStyle,TH1)(p)->UseCurrentStyle();\
+}
+
+TOBJECT_DECL_VIRT(TH1);
+TATTLINE_DECL_VIRT(TH1);
+TATTFILL_DECL_VIRT(TH1);
+TATTMARKER_DECL_VIRT(TH1);
+DELETABLE_DECL_VIRT(TH1);
+
+
+TH1_DECL_VIRT(TH1);
+
+
+TH1_DECL_NONVIRT(TH1);
+
+
+#endif // __HROOT_HIST__TH1__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH1C.cpp b/csrc/HROOTHistTH1C.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH1C.cpp
@@ -0,0 +1,53 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTArrayC.h"
+#include "TH1C.h"
+#include "HROOTHistTH1C.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+
+TH1_DEF_VIRT(TH1C)
+TARRAYC_DEF_VIRT(TH1C)
+TOBJECT_DEF_VIRT(TH1C)
+TATTLINE_DEF_VIRT(TH1C)
+TATTFILL_DEF_VIRT(TH1C)
+TATTMARKER_DEF_VIRT(TH1C)
+DELETABLE_DEF_VIRT(TH1C)
+TARRAY_DEF_VIRT(TH1C)
+
+TH1C_DEF_VIRT(TH1C)
+
+TH1C_DEF_NONVIRT(TH1C)
+
+
diff --git a/csrc/HROOTHistTH1C.h b/csrc/HROOTHistTH1C.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH1C.h
@@ -0,0 +1,56 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH1C__
+#define __HROOT_HIST__TH1C__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTArrayC.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOTCoreTArray.h"
+#include "HROOT-coreType.h"
+
+#undef TH1C_DECL_VIRT
+#define TH1C_DECL_VIRT(Type) \
+
+
+#undef TH1C_DECL_NONVIRT
+#define TH1C_DECL_NONVIRT(Type) \
+
+
+#undef TH1C_DEF_VIRT
+#define TH1C_DEF_VIRT(Type)\
+
+
+#undef TH1C_DEF_NONVIRT
+#define TH1C_DEF_NONVIRT(Type)\
+
+
+TH1_DECL_VIRT(TH1C);
+TARRAYC_DECL_VIRT(TH1C);
+TOBJECT_DECL_VIRT(TH1C);
+TATTLINE_DECL_VIRT(TH1C);
+TATTFILL_DECL_VIRT(TH1C);
+TATTMARKER_DECL_VIRT(TH1C);
+DELETABLE_DECL_VIRT(TH1C);
+TARRAY_DECL_VIRT(TH1C);
+
+
+TH1C_DECL_VIRT(TH1C);
+
+
+TH1C_DECL_NONVIRT(TH1C);
+
+
+#endif // __HROOT_HIST__TH1C__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH1D.cpp b/csrc/HROOTHistTH1D.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH1D.cpp
@@ -0,0 +1,53 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTArrayD.h"
+#include "TH1D.h"
+#include "HROOTHistTH1D.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+
+TH1_DEF_VIRT(TH1D)
+TARRAYD_DEF_VIRT(TH1D)
+TOBJECT_DEF_VIRT(TH1D)
+TATTLINE_DEF_VIRT(TH1D)
+TATTFILL_DEF_VIRT(TH1D)
+TATTMARKER_DEF_VIRT(TH1D)
+DELETABLE_DEF_VIRT(TH1D)
+TARRAY_DEF_VIRT(TH1D)
+
+TH1D_DEF_VIRT(TH1D)
+
+TH1D_DEF_NONVIRT(TH1D)
+
+
diff --git a/csrc/HROOTHistTH1D.h b/csrc/HROOTHistTH1D.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH1D.h
@@ -0,0 +1,60 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH1D__
+#define __HROOT_HIST__TH1D__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTArrayD.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOTCoreTArray.h"
+#include "HROOT-coreType.h"
+
+#undef TH1D_DECL_VIRT
+#define TH1D_DECL_VIRT(Type) \
+
+
+#undef TH1D_DECL_NONVIRT
+#define TH1D_DECL_NONVIRT(Type) \
+Type ## _p Type ## _newTH1D ( const char* name, const char* title, int nbinsx, double xlow, double xup )
+
+#undef TH1D_DEF_VIRT
+#define TH1D_DEF_VIRT(Type)\
+
+
+#undef TH1D_DEF_NONVIRT
+#define TH1D_DEF_NONVIRT(Type)\
+Type ## _p Type ## _newTH1D ( const char* name, const char* title, int nbinsx, double xlow, double xup )\
+{\
+Type * newp = new Type (name, title, nbinsx, xlow, xup); \
+return to_nonconst<Type ## _t, Type >(newp);\
+}
+
+TH1_DECL_VIRT(TH1D);
+TARRAYD_DECL_VIRT(TH1D);
+TOBJECT_DECL_VIRT(TH1D);
+TATTLINE_DECL_VIRT(TH1D);
+TATTFILL_DECL_VIRT(TH1D);
+TATTMARKER_DECL_VIRT(TH1D);
+DELETABLE_DECL_VIRT(TH1D);
+TARRAY_DECL_VIRT(TH1D);
+
+
+TH1D_DECL_VIRT(TH1D);
+
+
+TH1D_DECL_NONVIRT(TH1D);
+
+
+#endif // __HROOT_HIST__TH1D__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH1F.cpp b/csrc/HROOTHistTH1F.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH1F.cpp
@@ -0,0 +1,53 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTArrayF.h"
+#include "TH1F.h"
+#include "HROOTHistTH1F.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+
+TH1_DEF_VIRT(TH1F)
+TARRAYF_DEF_VIRT(TH1F)
+TOBJECT_DEF_VIRT(TH1F)
+TATTLINE_DEF_VIRT(TH1F)
+TATTFILL_DEF_VIRT(TH1F)
+TATTMARKER_DEF_VIRT(TH1F)
+DELETABLE_DEF_VIRT(TH1F)
+TARRAY_DEF_VIRT(TH1F)
+
+TH1F_DEF_VIRT(TH1F)
+
+TH1F_DEF_NONVIRT(TH1F)
+
+
diff --git a/csrc/HROOTHistTH1F.h b/csrc/HROOTHistTH1F.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH1F.h
@@ -0,0 +1,60 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH1F__
+#define __HROOT_HIST__TH1F__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTArrayF.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOTCoreTArray.h"
+#include "HROOT-coreType.h"
+
+#undef TH1F_DECL_VIRT
+#define TH1F_DECL_VIRT(Type) \
+
+
+#undef TH1F_DECL_NONVIRT
+#define TH1F_DECL_NONVIRT(Type) \
+Type ## _p Type ## _newTH1F ( const char* name, const char* title, int nbinsx, double xlow, double xup )
+
+#undef TH1F_DEF_VIRT
+#define TH1F_DEF_VIRT(Type)\
+
+
+#undef TH1F_DEF_NONVIRT
+#define TH1F_DEF_NONVIRT(Type)\
+Type ## _p Type ## _newTH1F ( const char* name, const char* title, int nbinsx, double xlow, double xup )\
+{\
+Type * newp = new Type (name, title, nbinsx, xlow, xup); \
+return to_nonconst<Type ## _t, Type >(newp);\
+}
+
+TH1_DECL_VIRT(TH1F);
+TARRAYF_DECL_VIRT(TH1F);
+TOBJECT_DECL_VIRT(TH1F);
+TATTLINE_DECL_VIRT(TH1F);
+TATTFILL_DECL_VIRT(TH1F);
+TATTMARKER_DECL_VIRT(TH1F);
+DELETABLE_DECL_VIRT(TH1F);
+TARRAY_DECL_VIRT(TH1F);
+
+
+TH1F_DECL_VIRT(TH1F);
+
+
+TH1F_DECL_NONVIRT(TH1F);
+
+
+#endif // __HROOT_HIST__TH1F__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH1I.cpp b/csrc/HROOTHistTH1I.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH1I.cpp
@@ -0,0 +1,53 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTArrayI.h"
+#include "TH1I.h"
+#include "HROOTHistTH1I.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+
+TH1_DEF_VIRT(TH1I)
+TARRAYI_DEF_VIRT(TH1I)
+TOBJECT_DEF_VIRT(TH1I)
+TATTLINE_DEF_VIRT(TH1I)
+TATTFILL_DEF_VIRT(TH1I)
+TATTMARKER_DEF_VIRT(TH1I)
+DELETABLE_DEF_VIRT(TH1I)
+TARRAY_DEF_VIRT(TH1I)
+
+TH1I_DEF_VIRT(TH1I)
+
+TH1I_DEF_NONVIRT(TH1I)
+
+
diff --git a/csrc/HROOTHistTH1I.h b/csrc/HROOTHistTH1I.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH1I.h
@@ -0,0 +1,56 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH1I__
+#define __HROOT_HIST__TH1I__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTArrayI.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOTCoreTArray.h"
+#include "HROOT-coreType.h"
+
+#undef TH1I_DECL_VIRT
+#define TH1I_DECL_VIRT(Type) \
+
+
+#undef TH1I_DECL_NONVIRT
+#define TH1I_DECL_NONVIRT(Type) \
+
+
+#undef TH1I_DEF_VIRT
+#define TH1I_DEF_VIRT(Type)\
+
+
+#undef TH1I_DEF_NONVIRT
+#define TH1I_DEF_NONVIRT(Type)\
+
+
+TH1_DECL_VIRT(TH1I);
+TARRAYI_DECL_VIRT(TH1I);
+TOBJECT_DECL_VIRT(TH1I);
+TATTLINE_DECL_VIRT(TH1I);
+TATTFILL_DECL_VIRT(TH1I);
+TATTMARKER_DECL_VIRT(TH1I);
+DELETABLE_DECL_VIRT(TH1I);
+TARRAY_DECL_VIRT(TH1I);
+
+
+TH1I_DECL_VIRT(TH1I);
+
+
+TH1I_DECL_NONVIRT(TH1I);
+
+
+#endif // __HROOT_HIST__TH1I__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH1K.cpp b/csrc/HROOTHistTH1K.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH1K.cpp
@@ -0,0 +1,53 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTArrayF.h"
+#include "TH1K.h"
+#include "HROOTHistTH1K.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+
+TH1_DEF_VIRT(TH1K)
+TARRAYF_DEF_VIRT(TH1K)
+TOBJECT_DEF_VIRT(TH1K)
+TATTLINE_DEF_VIRT(TH1K)
+TATTFILL_DEF_VIRT(TH1K)
+TATTMARKER_DEF_VIRT(TH1K)
+DELETABLE_DEF_VIRT(TH1K)
+TARRAY_DEF_VIRT(TH1K)
+
+TH1K_DEF_VIRT(TH1K)
+
+TH1K_DEF_NONVIRT(TH1K)
+
+
diff --git a/csrc/HROOTHistTH1K.h b/csrc/HROOTHistTH1K.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH1K.h
@@ -0,0 +1,56 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH1K__
+#define __HROOT_HIST__TH1K__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTArrayF.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOTCoreTArray.h"
+#include "HROOT-coreType.h"
+
+#undef TH1K_DECL_VIRT
+#define TH1K_DECL_VIRT(Type) \
+
+
+#undef TH1K_DECL_NONVIRT
+#define TH1K_DECL_NONVIRT(Type) \
+
+
+#undef TH1K_DEF_VIRT
+#define TH1K_DEF_VIRT(Type)\
+
+
+#undef TH1K_DEF_NONVIRT
+#define TH1K_DEF_NONVIRT(Type)\
+
+
+TH1_DECL_VIRT(TH1K);
+TARRAYF_DECL_VIRT(TH1K);
+TOBJECT_DECL_VIRT(TH1K);
+TATTLINE_DECL_VIRT(TH1K);
+TATTFILL_DECL_VIRT(TH1K);
+TATTMARKER_DECL_VIRT(TH1K);
+DELETABLE_DECL_VIRT(TH1K);
+TARRAY_DECL_VIRT(TH1K);
+
+
+TH1K_DECL_VIRT(TH1K);
+
+
+TH1K_DECL_NONVIRT(TH1K);
+
+
+#endif // __HROOT_HIST__TH1K__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH1S.cpp b/csrc/HROOTHistTH1S.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH1S.cpp
@@ -0,0 +1,53 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTArrayS.h"
+#include "TH1S.h"
+#include "HROOTHistTH1S.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+
+TH1_DEF_VIRT(TH1S)
+TARRAYS_DEF_VIRT(TH1S)
+TOBJECT_DEF_VIRT(TH1S)
+TATTLINE_DEF_VIRT(TH1S)
+TATTFILL_DEF_VIRT(TH1S)
+TATTMARKER_DEF_VIRT(TH1S)
+DELETABLE_DEF_VIRT(TH1S)
+TARRAY_DEF_VIRT(TH1S)
+
+TH1S_DEF_VIRT(TH1S)
+
+TH1S_DEF_NONVIRT(TH1S)
+
+
diff --git a/csrc/HROOTHistTH1S.h b/csrc/HROOTHistTH1S.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH1S.h
@@ -0,0 +1,56 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH1S__
+#define __HROOT_HIST__TH1S__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTArrayS.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOTCoreTArray.h"
+#include "HROOT-coreType.h"
+
+#undef TH1S_DECL_VIRT
+#define TH1S_DECL_VIRT(Type) \
+
+
+#undef TH1S_DECL_NONVIRT
+#define TH1S_DECL_NONVIRT(Type) \
+
+
+#undef TH1S_DEF_VIRT
+#define TH1S_DEF_VIRT(Type)\
+
+
+#undef TH1S_DEF_NONVIRT
+#define TH1S_DEF_NONVIRT(Type)\
+
+
+TH1_DECL_VIRT(TH1S);
+TARRAYS_DECL_VIRT(TH1S);
+TOBJECT_DECL_VIRT(TH1S);
+TATTLINE_DECL_VIRT(TH1S);
+TATTFILL_DECL_VIRT(TH1S);
+TATTMARKER_DECL_VIRT(TH1S);
+DELETABLE_DECL_VIRT(TH1S);
+TARRAY_DECL_VIRT(TH1S);
+
+
+TH1S_DECL_VIRT(TH1S);
+
+
+TH1S_DECL_NONVIRT(TH1S);
+
+
+#endif // __HROOT_HIST__TH1S__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH2.cpp b/csrc/HROOTHistTH2.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH2.cpp
@@ -0,0 +1,54 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH1D.h"
+#include "HROOTHistTH1.h"
+#include "HROOTHistTF1.h"
+#include "HROOTCoreTObjArray.h"
+#include "TH2.h"
+#include "HROOTHistTH2.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+#define IS_TH2_fill1_PROTECTED ()
+
+TH1_DEF_VIRT(TH2)
+TOBJECT_DEF_VIRT(TH2)
+TATTLINE_DEF_VIRT(TH2)
+TATTFILL_DEF_VIRT(TH2)
+TATTMARKER_DEF_VIRT(TH2)
+DELETABLE_DEF_VIRT(TH2)
+
+TH2_DEF_VIRT(TH2)
+
+TH2_DEF_NONVIRT(TH2)
+
+
diff --git a/csrc/HROOTHistTH2.h b/csrc/HROOTHistTH2.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH2.h
@@ -0,0 +1,138 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH2__
+#define __HROOT_HIST__TH2__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOT-coreType.h"
+
+#undef TH2_DECL_VIRT
+#define TH2_DECL_VIRT(Type) \
+int Type ## _fill2 ( Type ## _p p, double x, double y ); \
+int Type ## _fill2w ( Type ## _p p, double x, double y, double w ); \
+void Type ## _fillN2 ( Type ## _p p, int ntimes, double * x, double * y, double * w, int stride ); \
+void Type ## _fillRandom2 ( Type ## _p p, TH1_p h, int ntimes ); \
+int Type ## _findFirstBinAbove2 ( Type ## _p p, double threshold, int axis ); \
+int Type ## _findLastBinAbove2 ( Type ## _p p, double threshold, int axis ); \
+void Type ## _FitSlicesX ( Type ## _p p, TF1_p f1, int firstybin, int lastybin, int cut, const char* option, TObjArray_p arr ); \
+void Type ## _FitSlicesY ( Type ## _p p, TF1_p f1, int firstxbin, int lastxbin, int cut, const char* option, TObjArray_p arr ); \
+double Type ## _getCorrelationFactor2 ( Type ## _p p, int axis1, int axis2 ); \
+double Type ## _getCovariance2 ( Type ## _p p, int axis1, int axis2 ); \
+double Type ## _integral2 ( Type ## _p p, int binx1, int binx2, int biny1, int biny2, const char* option ); \
+TH2_p Type ## _rebinX2 ( Type ## _p p, int ngroup, const char* newname ); \
+TH2_p Type ## _rebinY2 ( Type ## _p p, int ngroup, const char* newname ); \
+TH2_p Type ## _Rebin2D ( Type ## _p p, int nxgroup, int nygroup, const char* newname ); \
+void Type ## _SetShowProjectionX ( Type ## _p p, int nbins ); \
+void Type ## _SetShowProjectionY ( Type ## _p p, int nbins )
+
+#undef TH2_DECL_NONVIRT
+#define TH2_DECL_NONVIRT(Type) \
+TH1D_p Type ## _tH2ProjectionX ( Type ## _p p, const char* name, int firstybin, int lastybin, const char* option ); \
+TH1D_p Type ## _tH2ProjectionY ( Type ## _p p, const char* name, int firstxbin, int lastxbin, const char* option )
+
+#undef TH2_DEF_VIRT
+#define TH2_DEF_VIRT(Type)\
+int Type ## _fill2 ( Type ## _p p, double x, double y )\
+{\
+return TYPECASTMETHOD(Type,fill2,TH2)(p)->Fill(x, y);\
+}\
+int Type ## _fill2w ( Type ## _p p, double x, double y, double w )\
+{\
+return TYPECASTMETHOD(Type,fill2w,TH2)(p)->Fill(x, y, w);\
+}\
+void Type ## _fillN2 ( Type ## _p p, int ntimes, double * x, double * y, double * w, int stride )\
+{\
+TYPECASTMETHOD(Type,fillN2,TH2)(p)->FillN(ntimes, x, y, w, stride);\
+}\
+void Type ## _fillRandom2 ( Type ## _p p, TH1_p h, int ntimes )\
+{\
+TYPECASTMETHOD(Type,fillRandom2,TH2)(p)->FillRandom(to_nonconst<TH1,TH1_t>(h), ntimes);\
+}\
+int Type ## _findFirstBinAbove2 ( Type ## _p p, double threshold, int axis )\
+{\
+return TYPECASTMETHOD(Type,findFirstBinAbove2,TH2)(p)->FindFirstBinAbove(threshold, axis);\
+}\
+int Type ## _findLastBinAbove2 ( Type ## _p p, double threshold, int axis )\
+{\
+return TYPECASTMETHOD(Type,findLastBinAbove2,TH2)(p)->FindLastBinAbove(threshold, axis);\
+}\
+void Type ## _FitSlicesX ( Type ## _p p, TF1_p f1, int firstybin, int lastybin, int cut, const char* option, TObjArray_p arr )\
+{\
+TYPECASTMETHOD(Type,FitSlicesX,TH2)(p)->FitSlicesX(to_nonconst<TF1,TF1_t>(f1), firstybin, lastybin, cut, option, to_nonconst<TObjArray,TObjArray_t>(arr));\
+}\
+void Type ## _FitSlicesY ( Type ## _p p, TF1_p f1, int firstxbin, int lastxbin, int cut, const char* option, TObjArray_p arr )\
+{\
+TYPECASTMETHOD(Type,FitSlicesY,TH2)(p)->FitSlicesY(to_nonconst<TF1,TF1_t>(f1), firstxbin, lastxbin, cut, option, to_nonconst<TObjArray,TObjArray_t>(arr));\
+}\
+double Type ## _getCorrelationFactor2 ( Type ## _p p, int axis1, int axis2 )\
+{\
+return TYPECASTMETHOD(Type,getCorrelationFactor2,TH2)(p)->GetCorrelationFactor(axis1, axis2);\
+}\
+double Type ## _getCovariance2 ( Type ## _p p, int axis1, int axis2 )\
+{\
+return TYPECASTMETHOD(Type,getCovariance2,TH2)(p)->GetCovariance(axis1, axis2);\
+}\
+double Type ## _integral2 ( Type ## _p p, int binx1, int binx2, int biny1, int biny2, const char* option )\
+{\
+return TYPECASTMETHOD(Type,integral2,TH2)(p)->Integral(binx1, binx2, biny1, biny2, option);\
+}\
+TH2_p Type ## _rebinX2 ( Type ## _p p, int ngroup, const char* newname )\
+{\
+return to_nonconst<TH2_t,TH2>((TH2*)TYPECASTMETHOD(Type,rebinX2,TH2)(p)->RebinX(ngroup, newname));\
+}\
+TH2_p Type ## _rebinY2 ( Type ## _p p, int ngroup, const char* newname )\
+{\
+return to_nonconst<TH2_t,TH2>((TH2*)TYPECASTMETHOD(Type,rebinY2,TH2)(p)->RebinY(ngroup, newname));\
+}\
+TH2_p Type ## _Rebin2D ( Type ## _p p, int nxgroup, int nygroup, const char* newname )\
+{\
+return to_nonconst<TH2_t,TH2>((TH2*)TYPECASTMETHOD(Type,Rebin2D,TH2)(p)->Rebin2D(nxgroup, nygroup, newname));\
+}\
+void Type ## _SetShowProjectionX ( Type ## _p p, int nbins )\
+{\
+TYPECASTMETHOD(Type,SetShowProjectionX,TH2)(p)->SetShowProjectionX(nbins);\
+}\
+void Type ## _SetShowProjectionY ( Type ## _p p, int nbins )\
+{\
+TYPECASTMETHOD(Type,SetShowProjectionY,TH2)(p)->SetShowProjectionY(nbins);\
+}
+
+#undef TH2_DEF_NONVIRT
+#define TH2_DEF_NONVIRT(Type)\
+TH1D_p Type ## _tH2ProjectionX ( Type ## _p p, const char* name, int firstybin, int lastybin, const char* option )\
+{\
+return to_nonconst<TH1D_t,TH1D>((TH1D*)TYPECASTMETHOD(Type,tH2ProjectionX,TH2)(p)->ProjectionX(name, firstybin, lastybin, option));\
+}\
+TH1D_p Type ## _tH2ProjectionY ( Type ## _p p, const char* name, int firstxbin, int lastxbin, const char* option )\
+{\
+return to_nonconst<TH1D_t,TH1D>((TH1D*)TYPECASTMETHOD(Type,tH2ProjectionY,TH2)(p)->ProjectionY(name, firstxbin, lastxbin, option));\
+}
+
+TH1_DECL_VIRT(TH2);
+TOBJECT_DECL_VIRT(TH2);
+TATTLINE_DECL_VIRT(TH2);
+TATTFILL_DECL_VIRT(TH2);
+TATTMARKER_DECL_VIRT(TH2);
+DELETABLE_DECL_VIRT(TH2);
+
+
+TH2_DECL_VIRT(TH2);
+
+
+TH2_DECL_NONVIRT(TH2);
+
+
+#endif // __HROOT_HIST__TH2__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH2C.cpp b/csrc/HROOTHistTH2C.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH2C.cpp
@@ -0,0 +1,55 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH2.h"
+#include "HROOTCoreTArrayC.h"
+#include "TH2C.h"
+#include "HROOTHistTH2C.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+#define IS_TH2C_fill1_PROTECTED ()
+
+TH2_DEF_VIRT(TH2C)
+TARRAYC_DEF_VIRT(TH2C)
+TH1_DEF_VIRT(TH2C)
+TOBJECT_DEF_VIRT(TH2C)
+TATTLINE_DEF_VIRT(TH2C)
+TATTFILL_DEF_VIRT(TH2C)
+TATTMARKER_DEF_VIRT(TH2C)
+DELETABLE_DEF_VIRT(TH2C)
+TARRAY_DEF_VIRT(TH2C)
+
+TH2C_DEF_VIRT(TH2C)
+
+TH2C_DEF_NONVIRT(TH2C)
+
+
diff --git a/csrc/HROOTHistTH2C.h b/csrc/HROOTHistTH2C.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH2C.h
@@ -0,0 +1,58 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH2C__
+#define __HROOT_HIST__TH2C__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH2.h"
+#include "HROOTCoreTArrayC.h"
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOTCoreTArray.h"
+#include "HROOT-coreType.h"
+
+#undef TH2C_DECL_VIRT
+#define TH2C_DECL_VIRT(Type) \
+
+
+#undef TH2C_DECL_NONVIRT
+#define TH2C_DECL_NONVIRT(Type) \
+
+
+#undef TH2C_DEF_VIRT
+#define TH2C_DEF_VIRT(Type)\
+
+
+#undef TH2C_DEF_NONVIRT
+#define TH2C_DEF_NONVIRT(Type)\
+
+
+TH2_DECL_VIRT(TH2C);
+TARRAYC_DECL_VIRT(TH2C);
+TH1_DECL_VIRT(TH2C);
+TOBJECT_DECL_VIRT(TH2C);
+TATTLINE_DECL_VIRT(TH2C);
+TATTFILL_DECL_VIRT(TH2C);
+TATTMARKER_DECL_VIRT(TH2C);
+DELETABLE_DECL_VIRT(TH2C);
+TARRAY_DECL_VIRT(TH2C);
+
+
+TH2C_DECL_VIRT(TH2C);
+
+
+TH2C_DECL_NONVIRT(TH2C);
+
+
+#endif // __HROOT_HIST__TH2C__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH2D.cpp b/csrc/HROOTHistTH2D.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH2D.cpp
@@ -0,0 +1,55 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH2.h"
+#include "HROOTCoreTArrayD.h"
+#include "TH2D.h"
+#include "HROOTHistTH2D.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+#define IS_TH2D_fill1_PROTECTED ()
+
+TH2_DEF_VIRT(TH2D)
+TARRAYD_DEF_VIRT(TH2D)
+TH1_DEF_VIRT(TH2D)
+TOBJECT_DEF_VIRT(TH2D)
+TATTLINE_DEF_VIRT(TH2D)
+TATTFILL_DEF_VIRT(TH2D)
+TATTMARKER_DEF_VIRT(TH2D)
+DELETABLE_DEF_VIRT(TH2D)
+TARRAY_DEF_VIRT(TH2D)
+
+TH2D_DEF_VIRT(TH2D)
+
+TH2D_DEF_NONVIRT(TH2D)
+
+
diff --git a/csrc/HROOTHistTH2D.h b/csrc/HROOTHistTH2D.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH2D.h
@@ -0,0 +1,62 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH2D__
+#define __HROOT_HIST__TH2D__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH2.h"
+#include "HROOTCoreTArrayD.h"
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOTCoreTArray.h"
+#include "HROOT-coreType.h"
+
+#undef TH2D_DECL_VIRT
+#define TH2D_DECL_VIRT(Type) \
+
+
+#undef TH2D_DECL_NONVIRT
+#define TH2D_DECL_NONVIRT(Type) \
+Type ## _p Type ## _newTH2D ( const char* name, const char* title, int nbinsx, double xlow, double xup, int nbinsy, double ylow, double yup )
+
+#undef TH2D_DEF_VIRT
+#define TH2D_DEF_VIRT(Type)\
+
+
+#undef TH2D_DEF_NONVIRT
+#define TH2D_DEF_NONVIRT(Type)\
+Type ## _p Type ## _newTH2D ( const char* name, const char* title, int nbinsx, double xlow, double xup, int nbinsy, double ylow, double yup )\
+{\
+Type * newp = new Type (name, title, nbinsx, xlow, xup, nbinsy, ylow, yup); \
+return to_nonconst<Type ## _t, Type >(newp);\
+}
+
+TH2_DECL_VIRT(TH2D);
+TARRAYD_DECL_VIRT(TH2D);
+TH1_DECL_VIRT(TH2D);
+TOBJECT_DECL_VIRT(TH2D);
+TATTLINE_DECL_VIRT(TH2D);
+TATTFILL_DECL_VIRT(TH2D);
+TATTMARKER_DECL_VIRT(TH2D);
+DELETABLE_DECL_VIRT(TH2D);
+TARRAY_DECL_VIRT(TH2D);
+
+
+TH2D_DECL_VIRT(TH2D);
+
+
+TH2D_DECL_NONVIRT(TH2D);
+
+
+#endif // __HROOT_HIST__TH2D__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH2F.cpp b/csrc/HROOTHistTH2F.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH2F.cpp
@@ -0,0 +1,55 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH2.h"
+#include "HROOTCoreTArrayF.h"
+#include "TH2F.h"
+#include "HROOTHistTH2F.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+#define IS_TH2F_fill1_PROTECTED ()
+
+TH2_DEF_VIRT(TH2F)
+TARRAYF_DEF_VIRT(TH2F)
+TH1_DEF_VIRT(TH2F)
+TOBJECT_DEF_VIRT(TH2F)
+TATTLINE_DEF_VIRT(TH2F)
+TATTFILL_DEF_VIRT(TH2F)
+TATTMARKER_DEF_VIRT(TH2F)
+DELETABLE_DEF_VIRT(TH2F)
+TARRAY_DEF_VIRT(TH2F)
+
+TH2F_DEF_VIRT(TH2F)
+
+TH2F_DEF_NONVIRT(TH2F)
+
+
diff --git a/csrc/HROOTHistTH2F.h b/csrc/HROOTHistTH2F.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH2F.h
@@ -0,0 +1,62 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH2F__
+#define __HROOT_HIST__TH2F__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH2.h"
+#include "HROOTCoreTArrayF.h"
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOTCoreTArray.h"
+#include "HROOT-coreType.h"
+
+#undef TH2F_DECL_VIRT
+#define TH2F_DECL_VIRT(Type) \
+
+
+#undef TH2F_DECL_NONVIRT
+#define TH2F_DECL_NONVIRT(Type) \
+Type ## _p Type ## _newTH2F ( const char* name, const char* title, int nbinsx, double xlow, double xup, int nbinsy, double ylow, double yup )
+
+#undef TH2F_DEF_VIRT
+#define TH2F_DEF_VIRT(Type)\
+
+
+#undef TH2F_DEF_NONVIRT
+#define TH2F_DEF_NONVIRT(Type)\
+Type ## _p Type ## _newTH2F ( const char* name, const char* title, int nbinsx, double xlow, double xup, int nbinsy, double ylow, double yup )\
+{\
+Type * newp = new Type (name, title, nbinsx, xlow, xup, nbinsy, ylow, yup); \
+return to_nonconst<Type ## _t, Type >(newp);\
+}
+
+TH2_DECL_VIRT(TH2F);
+TARRAYF_DECL_VIRT(TH2F);
+TH1_DECL_VIRT(TH2F);
+TOBJECT_DECL_VIRT(TH2F);
+TATTLINE_DECL_VIRT(TH2F);
+TATTFILL_DECL_VIRT(TH2F);
+TATTMARKER_DECL_VIRT(TH2F);
+DELETABLE_DECL_VIRT(TH2F);
+TARRAY_DECL_VIRT(TH2F);
+
+
+TH2F_DECL_VIRT(TH2F);
+
+
+TH2F_DECL_NONVIRT(TH2F);
+
+
+#endif // __HROOT_HIST__TH2F__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH2I.cpp b/csrc/HROOTHistTH2I.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH2I.cpp
@@ -0,0 +1,55 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH2.h"
+#include "HROOTCoreTArrayI.h"
+#include "TH2I.h"
+#include "HROOTHistTH2I.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+#define IS_TH2I_fill1_PROTECTED ()
+
+TH2_DEF_VIRT(TH2I)
+TARRAYI_DEF_VIRT(TH2I)
+TH1_DEF_VIRT(TH2I)
+TOBJECT_DEF_VIRT(TH2I)
+TATTLINE_DEF_VIRT(TH2I)
+TATTFILL_DEF_VIRT(TH2I)
+TATTMARKER_DEF_VIRT(TH2I)
+DELETABLE_DEF_VIRT(TH2I)
+TARRAY_DEF_VIRT(TH2I)
+
+TH2I_DEF_VIRT(TH2I)
+
+TH2I_DEF_NONVIRT(TH2I)
+
+
diff --git a/csrc/HROOTHistTH2I.h b/csrc/HROOTHistTH2I.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH2I.h
@@ -0,0 +1,58 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH2I__
+#define __HROOT_HIST__TH2I__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH2.h"
+#include "HROOTCoreTArrayI.h"
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOTCoreTArray.h"
+#include "HROOT-coreType.h"
+
+#undef TH2I_DECL_VIRT
+#define TH2I_DECL_VIRT(Type) \
+
+
+#undef TH2I_DECL_NONVIRT
+#define TH2I_DECL_NONVIRT(Type) \
+
+
+#undef TH2I_DEF_VIRT
+#define TH2I_DEF_VIRT(Type)\
+
+
+#undef TH2I_DEF_NONVIRT
+#define TH2I_DEF_NONVIRT(Type)\
+
+
+TH2_DECL_VIRT(TH2I);
+TARRAYI_DECL_VIRT(TH2I);
+TH1_DECL_VIRT(TH2I);
+TOBJECT_DECL_VIRT(TH2I);
+TATTLINE_DECL_VIRT(TH2I);
+TATTFILL_DECL_VIRT(TH2I);
+TATTMARKER_DECL_VIRT(TH2I);
+DELETABLE_DECL_VIRT(TH2I);
+TARRAY_DECL_VIRT(TH2I);
+
+
+TH2I_DECL_VIRT(TH2I);
+
+
+TH2I_DECL_NONVIRT(TH2I);
+
+
+#endif // __HROOT_HIST__TH2I__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH2Poly.cpp b/csrc/HROOTHistTH2Poly.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH2Poly.cpp
@@ -0,0 +1,52 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH2.h"
+#include "TH2Poly.h"
+#include "HROOTHistTH2Poly.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+#define IS_TH2Poly_fill1_PROTECTED ()
+
+TH2_DEF_VIRT(TH2Poly)
+TH1_DEF_VIRT(TH2Poly)
+TOBJECT_DEF_VIRT(TH2Poly)
+TATTLINE_DEF_VIRT(TH2Poly)
+TATTFILL_DEF_VIRT(TH2Poly)
+TATTMARKER_DEF_VIRT(TH2Poly)
+DELETABLE_DEF_VIRT(TH2Poly)
+
+TH2POLY_DEF_VIRT(TH2Poly)
+
+TH2POLY_DEF_NONVIRT(TH2Poly)
+
+
diff --git a/csrc/HROOTHistTH2Poly.h b/csrc/HROOTHistTH2Poly.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH2Poly.h
@@ -0,0 +1,53 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH2Poly__
+#define __HROOT_HIST__TH2Poly__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH2.h"
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+
+#undef TH2POLY_DECL_VIRT
+#define TH2POLY_DECL_VIRT(Type) \
+
+
+#undef TH2POLY_DECL_NONVIRT
+#define TH2POLY_DECL_NONVIRT(Type) \
+
+
+#undef TH2POLY_DEF_VIRT
+#define TH2POLY_DEF_VIRT(Type)\
+
+
+#undef TH2POLY_DEF_NONVIRT
+#define TH2POLY_DEF_NONVIRT(Type)\
+
+
+TH2_DECL_VIRT(TH2Poly);
+TH1_DECL_VIRT(TH2Poly);
+TOBJECT_DECL_VIRT(TH2Poly);
+TATTLINE_DECL_VIRT(TH2Poly);
+TATTFILL_DECL_VIRT(TH2Poly);
+TATTMARKER_DECL_VIRT(TH2Poly);
+DELETABLE_DECL_VIRT(TH2Poly);
+
+
+TH2POLY_DECL_VIRT(TH2Poly);
+
+
+TH2POLY_DECL_NONVIRT(TH2Poly);
+
+
+#endif // __HROOT_HIST__TH2Poly__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH2S.cpp b/csrc/HROOTHistTH2S.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH2S.cpp
@@ -0,0 +1,55 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH2.h"
+#include "HROOTCoreTArrayS.h"
+#include "TH2S.h"
+#include "HROOTHistTH2S.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+#define IS_TH2S_fill1_PROTECTED ()
+
+TH2_DEF_VIRT(TH2S)
+TARRAYS_DEF_VIRT(TH2S)
+TH1_DEF_VIRT(TH2S)
+TOBJECT_DEF_VIRT(TH2S)
+TATTLINE_DEF_VIRT(TH2S)
+TATTFILL_DEF_VIRT(TH2S)
+TATTMARKER_DEF_VIRT(TH2S)
+DELETABLE_DEF_VIRT(TH2S)
+TARRAY_DEF_VIRT(TH2S)
+
+TH2S_DEF_VIRT(TH2S)
+
+TH2S_DEF_NONVIRT(TH2S)
+
+
diff --git a/csrc/HROOTHistTH2S.h b/csrc/HROOTHistTH2S.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH2S.h
@@ -0,0 +1,58 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH2S__
+#define __HROOT_HIST__TH2S__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH2.h"
+#include "HROOTCoreTArrayS.h"
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOTCoreTArray.h"
+#include "HROOT-coreType.h"
+
+#undef TH2S_DECL_VIRT
+#define TH2S_DECL_VIRT(Type) \
+
+
+#undef TH2S_DECL_NONVIRT
+#define TH2S_DECL_NONVIRT(Type) \
+
+
+#undef TH2S_DEF_VIRT
+#define TH2S_DEF_VIRT(Type)\
+
+
+#undef TH2S_DEF_NONVIRT
+#define TH2S_DEF_NONVIRT(Type)\
+
+
+TH2_DECL_VIRT(TH2S);
+TARRAYS_DECL_VIRT(TH2S);
+TH1_DECL_VIRT(TH2S);
+TOBJECT_DECL_VIRT(TH2S);
+TATTLINE_DECL_VIRT(TH2S);
+TATTFILL_DECL_VIRT(TH2S);
+TATTMARKER_DECL_VIRT(TH2S);
+DELETABLE_DECL_VIRT(TH2S);
+TARRAY_DECL_VIRT(TH2S);
+
+
+TH2S_DECL_VIRT(TH2S);
+
+
+TH2S_DECL_NONVIRT(TH2S);
+
+
+#endif // __HROOT_HIST__TH2S__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH3.cpp b/csrc/HROOTHistTH3.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH3.cpp
@@ -0,0 +1,56 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH1D.h"
+#include "HROOTHistTH1.h"
+#include "HROOTHistTF1.h"
+#include "HROOTCoreTAtt3D.h"
+#include "TH3.h"
+#include "HROOTHistTH3.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+#define IS_TH3_fill1_PROTECTED ()
+#define IS_TH3_fill1w_PROTECTED ()
+
+TH1_DEF_VIRT(TH3)
+TATT3D_DEF_VIRT(TH3)
+TOBJECT_DEF_VIRT(TH3)
+TATTLINE_DEF_VIRT(TH3)
+TATTFILL_DEF_VIRT(TH3)
+TATTMARKER_DEF_VIRT(TH3)
+DELETABLE_DEF_VIRT(TH3)
+
+TH3_DEF_VIRT(TH3)
+
+TH3_DEF_NONVIRT(TH3)
+
+
diff --git a/csrc/HROOTHistTH3.h b/csrc/HROOTHistTH3.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH3.h
@@ -0,0 +1,115 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH3__
+#define __HROOT_HIST__TH3__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTAtt3D.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOT-coreType.h"
+
+#undef TH3_DECL_VIRT
+#define TH3_DECL_VIRT(Type) \
+int Type ## _fill3 ( Type ## _p p, double x, double y, double z ); \
+int Type ## _fill3w ( Type ## _p p, double x, double y, double z, double w ); \
+void Type ## _FitSlicesZ ( Type ## _p p, TF1_p f1, int binminx, int binmaxx, int binminy, int binmaxy, int cut, const char* option ); \
+double Type ## _getCorrelationFactor3 ( Type ## _p p, int axis1, int axis2 ); \
+double Type ## _getCovariance3 ( Type ## _p p, int axis1, int axis2 ); \
+TH3_p Type ## _rebinX3 ( Type ## _p p, int ngroup, const char* newname ); \
+TH3_p Type ## _rebinY3 ( Type ## _p p, int ngroup, const char* newname ); \
+TH3_p Type ## _rebinZ3 ( Type ## _p p, int ngroup, const char* newname ); \
+TH3_p Type ## _Rebin3D ( Type ## _p p, int nxgroup, int nygroup, int nzgroup, const char* newname )
+
+#undef TH3_DECL_NONVIRT
+#define TH3_DECL_NONVIRT(Type) \
+TH1D_p Type ## _tH3ProjectionX ( Type ## _p p, const char* name, int firstybin, int lastybin, int firstzbin, int lastzbin, const char* option ); \
+TH1D_p Type ## _tH3ProjectionY ( Type ## _p p, const char* name, int firstxbin, int lastxbin, int firstzbin, int lastzbin, const char* option ); \
+TH1D_p Type ## _tH3ProjectionZ ( Type ## _p p, const char* name, int firstxbin, int lastxbin, int firstybin, int lastybin, const char* option ); \
+TH1_p Type ## _tH3Project3D ( Type ## _p p, const char* option )
+
+#undef TH3_DEF_VIRT
+#define TH3_DEF_VIRT(Type)\
+int Type ## _fill3 ( Type ## _p p, double x, double y, double z )\
+{\
+return TYPECASTMETHOD(Type,fill3,TH3)(p)->Fill(x, y, z);\
+}\
+int Type ## _fill3w ( Type ## _p p, double x, double y, double z, double w )\
+{\
+return TYPECASTMETHOD(Type,fill3w,TH3)(p)->Fill(x, y, z, w);\
+}\
+void Type ## _FitSlicesZ ( Type ## _p p, TF1_p f1, int binminx, int binmaxx, int binminy, int binmaxy, int cut, const char* option )\
+{\
+TYPECASTMETHOD(Type,FitSlicesZ,TH3)(p)->FitSlicesZ(to_nonconst<TF1,TF1_t>(f1), binminx, binmaxx, binminy, binmaxy, cut, option);\
+}\
+double Type ## _getCorrelationFactor3 ( Type ## _p p, int axis1, int axis2 )\
+{\
+return TYPECASTMETHOD(Type,getCorrelationFactor3,TH3)(p)->GetCorrelationFactor(axis1, axis2);\
+}\
+double Type ## _getCovariance3 ( Type ## _p p, int axis1, int axis2 )\
+{\
+return TYPECASTMETHOD(Type,getCovariance3,TH3)(p)->GetCovariance(axis1, axis2);\
+}\
+TH3_p Type ## _rebinX3 ( Type ## _p p, int ngroup, const char* newname )\
+{\
+return to_nonconst<TH3_t,TH3>((TH3*)TYPECASTMETHOD(Type,rebinX3,TH3)(p)->RebinX(ngroup, newname));\
+}\
+TH3_p Type ## _rebinY3 ( Type ## _p p, int ngroup, const char* newname )\
+{\
+return to_nonconst<TH3_t,TH3>((TH3*)TYPECASTMETHOD(Type,rebinY3,TH3)(p)->RebinY(ngroup, newname));\
+}\
+TH3_p Type ## _rebinZ3 ( Type ## _p p, int ngroup, const char* newname )\
+{\
+return to_nonconst<TH3_t,TH3>((TH3*)TYPECASTMETHOD(Type,rebinZ3,TH3)(p)->RebinZ(ngroup, newname));\
+}\
+TH3_p Type ## _Rebin3D ( Type ## _p p, int nxgroup, int nygroup, int nzgroup, const char* newname )\
+{\
+return to_nonconst<TH3_t,TH3>((TH3*)TYPECASTMETHOD(Type,Rebin3D,TH3)(p)->Rebin3D(nxgroup, nygroup, nzgroup, newname));\
+}
+
+#undef TH3_DEF_NONVIRT
+#define TH3_DEF_NONVIRT(Type)\
+TH1D_p Type ## _tH3ProjectionX ( Type ## _p p, const char* name, int firstybin, int lastybin, int firstzbin, int lastzbin, const char* option )\
+{\
+return to_nonconst<TH1D_t,TH1D>((TH1D*)TYPECASTMETHOD(Type,tH3ProjectionX,TH3)(p)->ProjectionX(name, firstybin, lastybin, firstzbin, lastzbin, option));\
+}\
+TH1D_p Type ## _tH3ProjectionY ( Type ## _p p, const char* name, int firstxbin, int lastxbin, int firstzbin, int lastzbin, const char* option )\
+{\
+return to_nonconst<TH1D_t,TH1D>((TH1D*)TYPECASTMETHOD(Type,tH3ProjectionY,TH3)(p)->ProjectionY(name, firstxbin, lastxbin, firstzbin, lastzbin, option));\
+}\
+TH1D_p Type ## _tH3ProjectionZ ( Type ## _p p, const char* name, int firstxbin, int lastxbin, int firstybin, int lastybin, const char* option )\
+{\
+return to_nonconst<TH1D_t,TH1D>((TH1D*)TYPECASTMETHOD(Type,tH3ProjectionZ,TH3)(p)->ProjectionZ(name, firstxbin, lastxbin, firstybin, lastybin, option));\
+}\
+TH1_p Type ## _tH3Project3D ( Type ## _p p, const char* option )\
+{\
+return to_nonconst<TH1_t,TH1>((TH1*)TYPECASTMETHOD(Type,tH3Project3D,TH3)(p)->Project3D(option));\
+}
+
+TH1_DECL_VIRT(TH3);
+TATT3D_DECL_VIRT(TH3);
+TOBJECT_DECL_VIRT(TH3);
+TATTLINE_DECL_VIRT(TH3);
+TATTFILL_DECL_VIRT(TH3);
+TATTMARKER_DECL_VIRT(TH3);
+DELETABLE_DECL_VIRT(TH3);
+
+
+TH3_DECL_VIRT(TH3);
+
+
+TH3_DECL_NONVIRT(TH3);
+
+
+#endif // __HROOT_HIST__TH3__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH3C.cpp b/csrc/HROOTHistTH3C.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH3C.cpp
@@ -0,0 +1,57 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH3.h"
+#include "HROOTCoreTArrayC.h"
+#include "TH3C.h"
+#include "HROOTHistTH3C.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+#define IS_TH3C_fill1_PROTECTED ()
+#define IS_TH3C_fill1w_PROTECTED ()
+
+TH3_DEF_VIRT(TH3C)
+TARRAYC_DEF_VIRT(TH3C)
+TH1_DEF_VIRT(TH3C)
+TATT3D_DEF_VIRT(TH3C)
+TOBJECT_DEF_VIRT(TH3C)
+TATTLINE_DEF_VIRT(TH3C)
+TATTFILL_DEF_VIRT(TH3C)
+TATTMARKER_DEF_VIRT(TH3C)
+DELETABLE_DEF_VIRT(TH3C)
+TARRAY_DEF_VIRT(TH3C)
+
+TH3C_DEF_VIRT(TH3C)
+
+TH3C_DEF_NONVIRT(TH3C)
+
+
diff --git a/csrc/HROOTHistTH3C.h b/csrc/HROOTHistTH3C.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH3C.h
@@ -0,0 +1,60 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH3C__
+#define __HROOT_HIST__TH3C__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH3.h"
+#include "HROOTCoreTArrayC.h"
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTAtt3D.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOTCoreTArray.h"
+#include "HROOT-coreType.h"
+
+#undef TH3C_DECL_VIRT
+#define TH3C_DECL_VIRT(Type) \
+
+
+#undef TH3C_DECL_NONVIRT
+#define TH3C_DECL_NONVIRT(Type) \
+
+
+#undef TH3C_DEF_VIRT
+#define TH3C_DEF_VIRT(Type)\
+
+
+#undef TH3C_DEF_NONVIRT
+#define TH3C_DEF_NONVIRT(Type)\
+
+
+TH3_DECL_VIRT(TH3C);
+TARRAYC_DECL_VIRT(TH3C);
+TH1_DECL_VIRT(TH3C);
+TATT3D_DECL_VIRT(TH3C);
+TOBJECT_DECL_VIRT(TH3C);
+TATTLINE_DECL_VIRT(TH3C);
+TATTFILL_DECL_VIRT(TH3C);
+TATTMARKER_DECL_VIRT(TH3C);
+DELETABLE_DECL_VIRT(TH3C);
+TARRAY_DECL_VIRT(TH3C);
+
+
+TH3C_DECL_VIRT(TH3C);
+
+
+TH3C_DECL_NONVIRT(TH3C);
+
+
+#endif // __HROOT_HIST__TH3C__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH3D.cpp b/csrc/HROOTHistTH3D.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH3D.cpp
@@ -0,0 +1,57 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH3.h"
+#include "HROOTCoreTArrayD.h"
+#include "TH3D.h"
+#include "HROOTHistTH3D.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+#define IS_TH3D_fill1_PROTECTED ()
+#define IS_TH3D_fill1w_PROTECTED ()
+
+TH3_DEF_VIRT(TH3D)
+TARRAYD_DEF_VIRT(TH3D)
+TH1_DEF_VIRT(TH3D)
+TATT3D_DEF_VIRT(TH3D)
+TOBJECT_DEF_VIRT(TH3D)
+TATTLINE_DEF_VIRT(TH3D)
+TATTFILL_DEF_VIRT(TH3D)
+TATTMARKER_DEF_VIRT(TH3D)
+DELETABLE_DEF_VIRT(TH3D)
+TARRAY_DEF_VIRT(TH3D)
+
+TH3D_DEF_VIRT(TH3D)
+
+TH3D_DEF_NONVIRT(TH3D)
+
+
diff --git a/csrc/HROOTHistTH3D.h b/csrc/HROOTHistTH3D.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH3D.h
@@ -0,0 +1,60 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH3D__
+#define __HROOT_HIST__TH3D__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH3.h"
+#include "HROOTCoreTArrayD.h"
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTAtt3D.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOTCoreTArray.h"
+#include "HROOT-coreType.h"
+
+#undef TH3D_DECL_VIRT
+#define TH3D_DECL_VIRT(Type) \
+
+
+#undef TH3D_DECL_NONVIRT
+#define TH3D_DECL_NONVIRT(Type) \
+
+
+#undef TH3D_DEF_VIRT
+#define TH3D_DEF_VIRT(Type)\
+
+
+#undef TH3D_DEF_NONVIRT
+#define TH3D_DEF_NONVIRT(Type)\
+
+
+TH3_DECL_VIRT(TH3D);
+TARRAYD_DECL_VIRT(TH3D);
+TH1_DECL_VIRT(TH3D);
+TATT3D_DECL_VIRT(TH3D);
+TOBJECT_DECL_VIRT(TH3D);
+TATTLINE_DECL_VIRT(TH3D);
+TATTFILL_DECL_VIRT(TH3D);
+TATTMARKER_DECL_VIRT(TH3D);
+DELETABLE_DECL_VIRT(TH3D);
+TARRAY_DECL_VIRT(TH3D);
+
+
+TH3D_DECL_VIRT(TH3D);
+
+
+TH3D_DECL_NONVIRT(TH3D);
+
+
+#endif // __HROOT_HIST__TH3D__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH3F.cpp b/csrc/HROOTHistTH3F.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH3F.cpp
@@ -0,0 +1,57 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH3.h"
+#include "HROOTCoreTArrayF.h"
+#include "TH3F.h"
+#include "HROOTHistTH3F.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+#define IS_TH3F_fill1_PROTECTED ()
+#define IS_TH3F_fill1w_PROTECTED ()
+
+TH3_DEF_VIRT(TH3F)
+TARRAYF_DEF_VIRT(TH3F)
+TH1_DEF_VIRT(TH3F)
+TATT3D_DEF_VIRT(TH3F)
+TOBJECT_DEF_VIRT(TH3F)
+TATTLINE_DEF_VIRT(TH3F)
+TATTFILL_DEF_VIRT(TH3F)
+TATTMARKER_DEF_VIRT(TH3F)
+DELETABLE_DEF_VIRT(TH3F)
+TARRAY_DEF_VIRT(TH3F)
+
+TH3F_DEF_VIRT(TH3F)
+
+TH3F_DEF_NONVIRT(TH3F)
+
+
diff --git a/csrc/HROOTHistTH3F.h b/csrc/HROOTHistTH3F.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH3F.h
@@ -0,0 +1,60 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH3F__
+#define __HROOT_HIST__TH3F__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH3.h"
+#include "HROOTCoreTArrayF.h"
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTAtt3D.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOTCoreTArray.h"
+#include "HROOT-coreType.h"
+
+#undef TH3F_DECL_VIRT
+#define TH3F_DECL_VIRT(Type) \
+
+
+#undef TH3F_DECL_NONVIRT
+#define TH3F_DECL_NONVIRT(Type) \
+
+
+#undef TH3F_DEF_VIRT
+#define TH3F_DEF_VIRT(Type)\
+
+
+#undef TH3F_DEF_NONVIRT
+#define TH3F_DEF_NONVIRT(Type)\
+
+
+TH3_DECL_VIRT(TH3F);
+TARRAYF_DECL_VIRT(TH3F);
+TH1_DECL_VIRT(TH3F);
+TATT3D_DECL_VIRT(TH3F);
+TOBJECT_DECL_VIRT(TH3F);
+TATTLINE_DECL_VIRT(TH3F);
+TATTFILL_DECL_VIRT(TH3F);
+TATTMARKER_DECL_VIRT(TH3F);
+DELETABLE_DECL_VIRT(TH3F);
+TARRAY_DECL_VIRT(TH3F);
+
+
+TH3F_DECL_VIRT(TH3F);
+
+
+TH3F_DECL_NONVIRT(TH3F);
+
+
+#endif // __HROOT_HIST__TH3F__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH3I.cpp b/csrc/HROOTHistTH3I.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH3I.cpp
@@ -0,0 +1,57 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH3.h"
+#include "HROOTCoreTArrayI.h"
+#include "TH3I.h"
+#include "HROOTHistTH3I.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+#define IS_TH3I_fill1_PROTECTED ()
+#define IS_TH3I_fill1w_PROTECTED ()
+
+TH3_DEF_VIRT(TH3I)
+TARRAYI_DEF_VIRT(TH3I)
+TH1_DEF_VIRT(TH3I)
+TATT3D_DEF_VIRT(TH3I)
+TOBJECT_DEF_VIRT(TH3I)
+TATTLINE_DEF_VIRT(TH3I)
+TATTFILL_DEF_VIRT(TH3I)
+TATTMARKER_DEF_VIRT(TH3I)
+DELETABLE_DEF_VIRT(TH3I)
+TARRAY_DEF_VIRT(TH3I)
+
+TH3I_DEF_VIRT(TH3I)
+
+TH3I_DEF_NONVIRT(TH3I)
+
+
diff --git a/csrc/HROOTHistTH3I.h b/csrc/HROOTHistTH3I.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH3I.h
@@ -0,0 +1,60 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH3I__
+#define __HROOT_HIST__TH3I__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH3.h"
+#include "HROOTCoreTArrayI.h"
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTAtt3D.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOTCoreTArray.h"
+#include "HROOT-coreType.h"
+
+#undef TH3I_DECL_VIRT
+#define TH3I_DECL_VIRT(Type) \
+
+
+#undef TH3I_DECL_NONVIRT
+#define TH3I_DECL_NONVIRT(Type) \
+
+
+#undef TH3I_DEF_VIRT
+#define TH3I_DEF_VIRT(Type)\
+
+
+#undef TH3I_DEF_NONVIRT
+#define TH3I_DEF_NONVIRT(Type)\
+
+
+TH3_DECL_VIRT(TH3I);
+TARRAYI_DECL_VIRT(TH3I);
+TH1_DECL_VIRT(TH3I);
+TATT3D_DECL_VIRT(TH3I);
+TOBJECT_DECL_VIRT(TH3I);
+TATTLINE_DECL_VIRT(TH3I);
+TATTFILL_DECL_VIRT(TH3I);
+TATTMARKER_DECL_VIRT(TH3I);
+DELETABLE_DECL_VIRT(TH3I);
+TARRAY_DECL_VIRT(TH3I);
+
+
+TH3I_DECL_VIRT(TH3I);
+
+
+TH3I_DECL_NONVIRT(TH3I);
+
+
+#endif // __HROOT_HIST__TH3I__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTH3S.cpp b/csrc/HROOTHistTH3S.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH3S.cpp
@@ -0,0 +1,57 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTHistTH3.h"
+#include "HROOTCoreTArrayS.h"
+#include "TH3S.h"
+#include "HROOTHistTH3S.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+#define IS_TH3S_fill1_PROTECTED ()
+#define IS_TH3S_fill1w_PROTECTED ()
+
+TH3_DEF_VIRT(TH3S)
+TARRAYS_DEF_VIRT(TH3S)
+TH1_DEF_VIRT(TH3S)
+TATT3D_DEF_VIRT(TH3S)
+TOBJECT_DEF_VIRT(TH3S)
+TATTLINE_DEF_VIRT(TH3S)
+TATTFILL_DEF_VIRT(TH3S)
+TATTMARKER_DEF_VIRT(TH3S)
+DELETABLE_DEF_VIRT(TH3S)
+TARRAY_DEF_VIRT(TH3S)
+
+TH3S_DEF_VIRT(TH3S)
+
+TH3S_DEF_NONVIRT(TH3S)
+
+
diff --git a/csrc/HROOTHistTH3S.h b/csrc/HROOTHistTH3S.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTH3S.h
@@ -0,0 +1,60 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__TH3S__
+#define __HROOT_HIST__TH3S__
+
+#include "HROOT-histType.h"
+
+#include "HROOTHistTH3.h"
+#include "HROOTCoreTArrayS.h"
+#include "HROOTHistTH1.h"
+#include "HROOTCoreTAtt3D.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreTAttLine.h"
+#include "HROOTCoreTAttFill.h"
+#include "HROOTCoreTAttMarker.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOTCoreTArray.h"
+#include "HROOT-coreType.h"
+
+#undef TH3S_DECL_VIRT
+#define TH3S_DECL_VIRT(Type) \
+
+
+#undef TH3S_DECL_NONVIRT
+#define TH3S_DECL_NONVIRT(Type) \
+
+
+#undef TH3S_DEF_VIRT
+#define TH3S_DEF_VIRT(Type)\
+
+
+#undef TH3S_DEF_NONVIRT
+#define TH3S_DEF_NONVIRT(Type)\
+
+
+TH3_DECL_VIRT(TH3S);
+TARRAYS_DECL_VIRT(TH3S);
+TH1_DECL_VIRT(TH3S);
+TATT3D_DECL_VIRT(TH3S);
+TOBJECT_DECL_VIRT(TH3S);
+TATTLINE_DECL_VIRT(TH3S);
+TATTFILL_DECL_VIRT(TH3S);
+TATTMARKER_DECL_VIRT(TH3S);
+DELETABLE_DECL_VIRT(TH3S);
+TARRAY_DECL_VIRT(TH3S);
+
+
+TH3S_DECL_VIRT(TH3S);
+
+
+TH3S_DECL_NONVIRT(TH3S);
+
+
+#endif // __HROOT_HIST__TH3S__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/csrc/HROOTHistTHStack.cpp b/csrc/HROOTHistTHStack.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTHStack.cpp
@@ -0,0 +1,47 @@
+#include <MacroPatternMatch.h>
+
+#include "HROOTCoreTNamed.h"
+#include "THStack.h"
+#include "HROOTHistTHStack.h"
+
+using namespace std;
+
+
+template<class ToType, class FromType>
+const ToType* to_const(const FromType* x) {
+  return reinterpret_cast<const ToType*>(x);
+}
+
+template<class ToType, class FromType>
+ToType* to_nonconst(FromType* x) {
+  return reinterpret_cast<ToType*>(x);
+}
+
+template<class ToType, class FromType>
+const ToType& to_constref(const FromType& x) {
+  return reinterpret_cast<const ToType&>(x);
+}
+
+template<class ToType, class FromType>
+ToType& to_nonconstref(FromType& x) {
+  return reinterpret_cast<ToType&>(x);
+}
+
+
+#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  IIF( CHECKPROTECT(cname,mname) ) ( \
+  (to_nonconst<oname,cname ## _t>), \
+  (to_nonconst<cname,cname ## _t>) )
+
+
+TNAMED_DEF_VIRT(THStack)
+TOBJECT_DEF_VIRT(THStack)
+DELETABLE_DEF_VIRT(THStack)
+
+THSTACK_DEF_VIRT(THStack)
+
+THSTACK_DEF_NONVIRT(THStack)
+
+
diff --git a/csrc/HROOTHistTHStack.h b/csrc/HROOTHistTHStack.h
new file mode 100644
--- /dev/null
+++ b/csrc/HROOTHistTHStack.h
@@ -0,0 +1,50 @@
+#ifdef __cplusplus
+extern "C" { 
+#endif 
+
+#ifndef __HROOT_HIST__THStack__
+#define __HROOT_HIST__THStack__
+
+#include "HROOT-histType.h"
+
+#include "HROOTCoreTNamed.h"
+#include "HROOTCoreTObject.h"
+#include "HROOTCoreDeletable.h"
+#include "HROOT-coreType.h"
+
+#undef THSTACK_DECL_VIRT
+#define THSTACK_DECL_VIRT(Type) \
+
+
+#undef THSTACK_DECL_NONVIRT
+#define THSTACK_DECL_NONVIRT(Type) \
+Type ## _p Type ## _newTHStack ( const char* name, const char* title )
+
+#undef THSTACK_DEF_VIRT
+#define THSTACK_DEF_VIRT(Type)\
+
+
+#undef THSTACK_DEF_NONVIRT
+#define THSTACK_DEF_NONVIRT(Type)\
+Type ## _p Type ## _newTHStack ( const char* name, const char* title )\
+{\
+Type * newp = new Type (name, title); \
+return to_nonconst<Type ## _t, Type >(newp);\
+}
+
+TNAMED_DECL_VIRT(THStack);
+TOBJECT_DECL_VIRT(THStack);
+DELETABLE_DECL_VIRT(THStack);
+
+
+THSTACK_DECL_VIRT(THStack);
+
+
+THSTACK_DECL_NONVIRT(THStack);
+
+
+#endif // __HROOT_HIST__THStack__
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/HROOT/Hist.hs b/src/HROOT/Hist.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist.hs
@@ -0,0 +1,63 @@
+module HROOT.Hist (
+module HROOT.Hist.TAxis
+, module HROOT.Hist.TF1
+, module HROOT.Hist.TFormula
+, module HROOT.Hist.TGraph
+, module HROOT.Hist.TGraphAsymmErrors
+, module HROOT.Hist.TGraphBentErrors
+, module HROOT.Hist.TGraphErrors
+, module HROOT.Hist.TH1
+, module HROOT.Hist.TH1C
+, module HROOT.Hist.TH1D
+, module HROOT.Hist.TH1F
+, module HROOT.Hist.TH1I
+, module HROOT.Hist.TH1K
+, module HROOT.Hist.TH1S
+, module HROOT.Hist.TH2
+, module HROOT.Hist.TH2C
+, module HROOT.Hist.TH2D
+, module HROOT.Hist.TH2F
+, module HROOT.Hist.TH2I
+, module HROOT.Hist.TH2Poly
+, module HROOT.Hist.TH2S
+, module HROOT.Hist.TH3
+, module HROOT.Hist.TH3C
+, module HROOT.Hist.TH3D
+, module HROOT.Hist.TH3F
+, module HROOT.Hist.TH3I
+, module HROOT.Hist.TH3S
+, module HROOT.Hist.THStack 
+) where
+
+import HROOT.Hist.TAxis
+import HROOT.Hist.TF1
+import HROOT.Hist.TFormula
+import HROOT.Hist.TGraph
+import HROOT.Hist.TGraphAsymmErrors
+import HROOT.Hist.TGraphBentErrors
+import HROOT.Hist.TGraphErrors
+import HROOT.Hist.TH1
+import HROOT.Hist.TH1C
+import HROOT.Hist.TH1D
+import HROOT.Hist.TH1F
+import HROOT.Hist.TH1I
+import HROOT.Hist.TH1K
+import HROOT.Hist.TH1S
+import HROOT.Hist.TH2
+import HROOT.Hist.TH2C
+import HROOT.Hist.TH2D
+import HROOT.Hist.TH2F
+import HROOT.Hist.TH2I
+import HROOT.Hist.TH2Poly
+import HROOT.Hist.TH2S
+import HROOT.Hist.TH3
+import HROOT.Hist.TH3C
+import HROOT.Hist.TH3D
+import HROOT.Hist.TH3F
+import HROOT.Hist.TH3I
+import HROOT.Hist.TH3S
+import HROOT.Hist.THStack
+
+
+
+
diff --git a/src/HROOT/Hist/TAxis.hs b/src/HROOT/Hist/TAxis.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TAxis.hs
@@ -0,0 +1,17 @@
+module HROOT.Hist.TAxis
+  (
+    TAxis(..)
+  , ITAxis(..)
+  , upcastTAxis
+  , downcastTAxis
+  , newTAxis
+  , tAxisGetCenterLabels
+  , tAxisGetCenterTitle
+ 
+  ) where
+
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Interface
+import HROOT.Hist.TAxis.Implementation
+
+
diff --git a/src/HROOT/Hist/TAxis/Cast.hs b/src/HROOT/Hist/TAxis/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TAxis/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TAxis.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Interface
+
+instance (ITAxis a, FPtr a) => Castable a (Ptr RawTAxis) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TAxis (Ptr RawTAxis) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TAxis/FFI.hsc b/src/HROOT/Hist/TAxis/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TAxis/FFI.hsc
@@ -0,0 +1,152 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TAxis.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTAxis.h"
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SetName" c_taxis_setname 
+  :: (Ptr RawTAxis) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SetNameTitle" c_taxis_setnametitle 
+  :: (Ptr RawTAxis) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SetTitle" c_taxis_settitle 
+  :: (Ptr RawTAxis) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_GetNdivisions" c_taxis_getndivisions 
+  :: (Ptr RawTAxis) -> IO CInt
+
+foreign import ccall "HROOTHistTAxis.h TAxis_GetAxisColor" c_taxis_getaxiscolor 
+  :: (Ptr RawTAxis) -> IO CInt
+
+foreign import ccall "HROOTHistTAxis.h TAxis_GetLabelColor" c_taxis_getlabelcolor 
+  :: (Ptr RawTAxis) -> IO CInt
+
+foreign import ccall "HROOTHistTAxis.h TAxis_GetLabelFont" c_taxis_getlabelfont 
+  :: (Ptr RawTAxis) -> IO CInt
+
+foreign import ccall "HROOTHistTAxis.h TAxis_GetLabelOffset" c_taxis_getlabeloffset 
+  :: (Ptr RawTAxis) -> IO CDouble
+
+foreign import ccall "HROOTHistTAxis.h TAxis_GetLabelSize" c_taxis_getlabelsize 
+  :: (Ptr RawTAxis) -> IO CDouble
+
+foreign import ccall "HROOTHistTAxis.h TAxis_GetTitleOffset" c_taxis_gettitleoffset 
+  :: (Ptr RawTAxis) -> IO CDouble
+
+foreign import ccall "HROOTHistTAxis.h TAxis_GetTitleSize" c_taxis_gettitlesize 
+  :: (Ptr RawTAxis) -> IO CDouble
+
+foreign import ccall "HROOTHistTAxis.h TAxis_GetTickLength" c_taxis_getticklength 
+  :: (Ptr RawTAxis) -> IO CDouble
+
+foreign import ccall "HROOTHistTAxis.h TAxis_GetTitleFont" c_taxis_gettitlefont 
+  :: (Ptr RawTAxis) -> IO CInt
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SetNdivisions" c_taxis_setndivisions 
+  :: (Ptr RawTAxis) -> CInt -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SetAxisColor" c_taxis_setaxiscolor 
+  :: (Ptr RawTAxis) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SetLabelColor" c_taxis_setlabelcolor 
+  :: (Ptr RawTAxis) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SetLabelFont" c_taxis_setlabelfont 
+  :: (Ptr RawTAxis) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SetLabelOffset" c_taxis_setlabeloffset 
+  :: (Ptr RawTAxis) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SetLabelSize" c_taxis_setlabelsize 
+  :: (Ptr RawTAxis) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SetTickLength" c_taxis_setticklength 
+  :: (Ptr RawTAxis) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SetTitleOffset" c_taxis_settitleoffset 
+  :: (Ptr RawTAxis) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SetTitleSize" c_taxis_settitlesize 
+  :: (Ptr RawTAxis) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SetTitleColor" c_taxis_settitlecolor 
+  :: (Ptr RawTAxis) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SetTitleFont" c_taxis_settitlefont 
+  :: (Ptr RawTAxis) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_Draw" c_taxis_draw 
+  :: (Ptr RawTAxis) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_FindObject" c_taxis_findobject 
+  :: (Ptr RawTAxis) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTAxis.h TAxis_GetName" c_taxis_getname 
+  :: (Ptr RawTAxis) -> IO CString
+
+foreign import ccall "HROOTHistTAxis.h TAxis_IsA" c_taxis_isa 
+  :: (Ptr RawTAxis) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTAxis.h TAxis_Paint" c_taxis_paint 
+  :: (Ptr RawTAxis) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_printObj" c_taxis_printobj 
+  :: (Ptr RawTAxis) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SaveAs" c_taxis_saveas 
+  :: (Ptr RawTAxis) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_Write" c_taxis_write 
+  :: (Ptr RawTAxis) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTAxis.h TAxis_delete" c_taxis_delete 
+  :: (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_newTAxis" c_taxis_newtaxis 
+  :: CInt -> CDouble -> CDouble -> IO (Ptr RawTAxis)
+
+foreign import ccall "HROOTHistTAxis.h TAxis_findBinTAxis" c_taxis_findbintaxis 
+  :: (Ptr RawTAxis) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTAxis.h TAxis_findFixBinTAxis" c_taxis_findfixbintaxis 
+  :: (Ptr RawTAxis) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTAxis.h TAxis_getBinCenterTAxis" c_taxis_getbincentertaxis 
+  :: (Ptr RawTAxis) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTAxis.h TAxis_GetBinCenterLog" c_taxis_getbincenterlog 
+  :: (Ptr RawTAxis) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTAxis.h TAxis_GetBinUpEdge" c_taxis_getbinupedge 
+  :: (Ptr RawTAxis) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTAxis.h TAxis_tAxisGetCenterLabels" c_taxis_taxisgetcenterlabels 
+  :: (Ptr RawTAxis) -> IO CInt
+
+foreign import ccall "HROOTHistTAxis.h TAxis_tAxisGetCenterTitle" c_taxis_taxisgetcentertitle 
+  :: (Ptr RawTAxis) -> IO CInt
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SetTimeDisplay" c_taxis_settimedisplay 
+  :: (Ptr RawTAxis) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SetTimeFormat" c_taxis_settimeformat 
+  :: (Ptr RawTAxis) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTAxis.h TAxis_SetTimeOffset" c_taxis_settimeoffset 
+  :: (Ptr RawTAxis) -> CDouble -> CString -> IO ()
+
diff --git a/src/HROOT/Hist/TAxis/Implementation.hs b/src/HROOT/Hist/TAxis/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TAxis/Implementation.hs
@@ -0,0 +1,147 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TAxis.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.FFI
+import HROOT.Hist.TAxis.Interface
+import HROOT.Hist.TAxis.Cast
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Core.TNamed.RawType
+import HROOT.Core.TNamed.Cast
+import HROOT.Core.TNamed.Interface
+import HROOT.Core.TAttAxis.RawType
+import HROOT.Core.TAttAxis.Cast
+import HROOT.Core.TAttAxis.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITAxis TAxis where
+  findBinTAxis = xform1 c_taxis_findbintaxis
+  findFixBinTAxis = xform1 c_taxis_findfixbintaxis
+  getBinCenterTAxis = xform1 c_taxis_getbincentertaxis
+  getBinCenterLog = xform1 c_taxis_getbincenterlog
+  getBinUpEdge = xform1 c_taxis_getbinupedge
+  setTimeDisplay = xform1 c_taxis_settimedisplay
+  setTimeFormat = xform1 c_taxis_settimeformat
+  setTimeOffset = xform2 c_taxis_settimeoffset
+instance ITNamed TAxis where
+  setName = xform1 c_taxis_setname
+  setNameTitle = xform2 c_taxis_setnametitle
+  setTitle = xform1 c_taxis_settitle
+instance ITAttAxis TAxis where
+  getNdivisions = xform0 c_taxis_getndivisions
+  getAxisColor = xform0 c_taxis_getaxiscolor
+  getLabelColor = xform0 c_taxis_getlabelcolor
+  getLabelFont = xform0 c_taxis_getlabelfont
+  getLabelOffset = xform0 c_taxis_getlabeloffset
+  getLabelSize = xform0 c_taxis_getlabelsize
+  getTitleOffset = xform0 c_taxis_gettitleoffset
+  getTitleSize = xform0 c_taxis_gettitlesize
+  getTickLength = xform0 c_taxis_getticklength
+  getTitleFont = xform0 c_taxis_gettitlefont
+  setNdivisions = xform2 c_taxis_setndivisions
+  setAxisColor = xform1 c_taxis_setaxiscolor
+  setLabelColor = xform1 c_taxis_setlabelcolor
+  setLabelFont = xform1 c_taxis_setlabelfont
+  setLabelOffset = xform1 c_taxis_setlabeloffset
+  setLabelSize = xform1 c_taxis_setlabelsize
+  setTickLength = xform1 c_taxis_setticklength
+  setTitleOffset = xform1 c_taxis_settitleoffset
+  setTitleSize = xform1 c_taxis_settitlesize
+  setTitleColor = xform1 c_taxis_settitlecolor
+  setTitleFont = xform1 c_taxis_settitlefont
+instance ITObject TAxis where
+  draw = xform1 c_taxis_draw
+  findObject = xform1 c_taxis_findobject
+  getName = xform0 c_taxis_getname
+  isA = xform0 c_taxis_isa
+  paint = xform1 c_taxis_paint
+  printObj = xform1 c_taxis_printobj
+  saveAs = xform2 c_taxis_saveas
+  write = xform3 c_taxis_write
+instance IDeletable TAxis where
+  delete = xform0 c_taxis_delete
+
+instance ITAxis (Exist TAxis) where
+  findBinTAxis (ETAxis x) = findBinTAxis x
+  findFixBinTAxis (ETAxis x) = findFixBinTAxis x
+  getBinCenterTAxis (ETAxis x) = getBinCenterTAxis x
+  getBinCenterLog (ETAxis x) = getBinCenterLog x
+  getBinUpEdge (ETAxis x) = getBinUpEdge x
+  setTimeDisplay (ETAxis x) = setTimeDisplay x
+  setTimeFormat (ETAxis x) = setTimeFormat x
+  setTimeOffset (ETAxis x) = setTimeOffset x
+instance ITNamed (Exist TAxis) where
+  setName (ETAxis x) = setName x
+  setNameTitle (ETAxis x) = setNameTitle x
+  setTitle (ETAxis x) = setTitle x
+instance ITAttAxis (Exist TAxis) where
+  getNdivisions (ETAxis x) = getNdivisions x
+  getAxisColor (ETAxis x) = getAxisColor x
+  getLabelColor (ETAxis x) = getLabelColor x
+  getLabelFont (ETAxis x) = getLabelFont x
+  getLabelOffset (ETAxis x) = getLabelOffset x
+  getLabelSize (ETAxis x) = getLabelSize x
+  getTitleOffset (ETAxis x) = getTitleOffset x
+  getTitleSize (ETAxis x) = getTitleSize x
+  getTickLength (ETAxis x) = getTickLength x
+  getTitleFont (ETAxis x) = getTitleFont x
+  setNdivisions (ETAxis x) = setNdivisions x
+  setAxisColor (ETAxis x) = setAxisColor x
+  setLabelColor (ETAxis x) = setLabelColor x
+  setLabelFont (ETAxis x) = setLabelFont x
+  setLabelOffset (ETAxis x) = setLabelOffset x
+  setLabelSize (ETAxis x) = setLabelSize x
+  setTickLength (ETAxis x) = setTickLength x
+  setTitleOffset (ETAxis x) = setTitleOffset x
+  setTitleSize (ETAxis x) = setTitleSize x
+  setTitleColor (ETAxis x) = setTitleColor x
+  setTitleFont (ETAxis x) = setTitleFont x
+instance ITObject (Exist TAxis) where
+  draw (ETAxis x) = draw x
+  findObject (ETAxis x) = findObject x
+  getName (ETAxis x) = getName x
+  isA (ETAxis x) = isA x
+  paint (ETAxis x) = paint x
+  printObj (ETAxis x) = printObj x
+  saveAs (ETAxis x) = saveAs x
+  write (ETAxis x) = write x
+instance IDeletable (Exist TAxis) where
+  delete (ETAxis x) = delete x
+
+
+newTAxis :: CInt -> CDouble -> CDouble -> IO TAxis
+newTAxis = xform2 c_taxis_newtaxis
+
+tAxisGetCenterLabels :: TAxis -> IO CInt
+tAxisGetCenterLabels = xform0 c_taxis_taxisgetcenterlabels
+
+tAxisGetCenterTitle :: TAxis -> IO CInt
+tAxisGetCenterTitle = xform0 c_taxis_taxisgetcentertitle
+
+
+
+instance FPtr (Exist TAxis) where
+  type Raw (Exist TAxis) = RawTAxis
+  get_fptr (ETAxis obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETAxis (cast_fptr_to_obj (fptr :: ForeignPtr RawTAxis) :: TAxis)
diff --git a/src/HROOT/Hist/TAxis/Interface.hs b/src/HROOT/Hist/TAxis/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TAxis/Interface.hs
@@ -0,0 +1,53 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TAxis.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TAxis.RawType
+
+import HROOT.Core.TNamed.Interface
+import HROOT.Core.TAttAxis.Interface
+---- ============ ----
+
+
+
+class (ITNamed a,ITAttAxis a) => ITAxis a where
+
+    findBinTAxis :: a -> CDouble -> IO CInt 
+
+    findFixBinTAxis :: a -> CDouble -> IO CInt 
+
+    getBinCenterTAxis :: a -> CInt -> IO CDouble 
+
+    getBinCenterLog :: a -> CInt -> IO CDouble 
+
+    getBinUpEdge :: a -> CInt -> IO CDouble 
+
+    setTimeDisplay :: a -> CInt -> IO () 
+
+    setTimeFormat :: a -> CString -> IO () 
+
+    setTimeOffset :: a -> CDouble -> CString -> IO () 
+
+instance Existable TAxis where
+  data Exist TAxis = forall a. (FPtr a, ITAxis a) => ETAxis a
+
+upcastTAxis :: (FPtr a, ITAxis a) => a -> TAxis
+upcastTAxis h = let fh = get_fptr h
+                    fh2 :: ForeignPtr RawTAxis = castForeignPtr fh
+                in cast_fptr_to_obj fh2
+
+downcastTAxis :: (FPtr a, ITAxis a) => TAxis -> a 
+downcastTAxis h = let fh = get_fptr h
+                      fh2 = castForeignPtr fh
+                  in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TAxis/Interface.hs-boot b/src/HROOT/Hist/TAxis/Interface.hs-boot
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TAxis/Interface.hs-boot
@@ -0,0 +1,3 @@
+module HROOT.Hist.TAxis.Interface where
+
+class ITAxis a
diff --git a/src/HROOT/Hist/TAxis/RawType.hs b/src/HROOT/Hist/TAxis/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TAxis/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TAxis.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTAxis
+newtype TAxis = TAxis (ForeignPtr RawTAxis) deriving (Eq, Ord, Show)
+instance FPtr TAxis where
+   type Raw TAxis = RawTAxis
+   get_fptr (TAxis fptr) = fptr
+   cast_fptr_to_obj = TAxis
diff --git a/src/HROOT/Hist/TF1.hs b/src/HROOT/Hist/TF1.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TF1.hs
@@ -0,0 +1,28 @@
+module HROOT.Hist.TF1
+  (
+    TF1(..)
+  , ITF1(..)
+  , upcastTF1
+  , downcastTF1
+  , newTF1
+  , tF1GetChisquare
+  , tF1GetHistogram
+  , tF1GetParent
+  , tF1GetXaxis
+  , tF1GetYaxis
+  , tF1GetZaxis
+  , tF1DerivativeError
+  , tF1InitStandardFunctions
+  , tF1GetCurrent
+  , tF1AbsValue
+  , tF1RejectPoint
+  , tF1RejectedPoint
+  , tF1SetCurrent
+  , tF1CalcGaussLegendreSamplingPoints 
+  ) where
+
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Interface
+import HROOT.Hist.TF1.Implementation
+
+
diff --git a/src/HROOT/Hist/TF1/Cast.hs b/src/HROOT/Hist/TF1/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TF1/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TF1.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Interface
+
+instance (ITF1 a, FPtr a) => Castable a (Ptr RawTF1) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TF1 (Ptr RawTF1) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TF1/FFI.hsc b/src/HROOT/Hist/TF1/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TF1/FFI.hsc
@@ -0,0 +1,358 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TF1.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TAxis.RawType
+
+#include "HROOTHistTF1.h"
+
+foreign import ccall "HROOTHistTF1.h TF1_Compile" c_tf1_compile 
+  :: (Ptr RawTF1) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_Clear" c_tf1_clear 
+  :: (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_DefinedValue" c_tf1_definedvalue 
+  :: (Ptr RawTF1) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_Eval" c_tf1_eval 
+  :: (Ptr RawTF1) -> CDouble -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_EvalParOld" c_tf1_evalparold 
+  :: (Ptr RawTF1) -> (Ptr CDouble) -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_EvalPar" c_tf1_evalpar 
+  :: (Ptr RawTF1) -> (Ptr CDouble) -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_GetNdim" c_tf1_getndim 
+  :: (Ptr RawTF1) -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_GetNpar" c_tf1_getnpar 
+  :: (Ptr RawTF1) -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_GetNumber" c_tf1_getnumber 
+  :: (Ptr RawTF1) -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_GetParNumber" c_tf1_getparnumber 
+  :: (Ptr RawTF1) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_IsLinear" c_tf1_islinear 
+  :: (Ptr RawTF1) -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_IsNormalized" c_tf1_isnormalized 
+  :: (Ptr RawTF1) -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_SetNumber" c_tf1_setnumber 
+  :: (Ptr RawTF1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetParameter" c_tf1_setparameter 
+  :: (Ptr RawTF1) -> CString -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetParameters" c_tf1_setparameters 
+  :: (Ptr RawTF1) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetParName" c_tf1_setparname 
+  :: (Ptr RawTF1) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetParNames" c_tf1_setparnames 
+  :: (Ptr RawTF1) -> CString -> CString -> CString -> CString -> CString -> CString -> CString -> CString -> CString -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_Update" c_tf1_update 
+  :: (Ptr RawTF1) -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_GetLineColor" c_tf1_getlinecolor 
+  :: (Ptr RawTF1) -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_GetLineStyle" c_tf1_getlinestyle 
+  :: (Ptr RawTF1) -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_GetLineWidth" c_tf1_getlinewidth 
+  :: (Ptr RawTF1) -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_ResetAttLine" c_tf1_resetattline 
+  :: (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetLineAttributes" c_tf1_setlineattributes 
+  :: (Ptr RawTF1) -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetLineColor" c_tf1_setlinecolor 
+  :: (Ptr RawTF1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetLineStyle" c_tf1_setlinestyle 
+  :: (Ptr RawTF1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetLineWidth" c_tf1_setlinewidth 
+  :: (Ptr RawTF1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetFillColor" c_tf1_setfillcolor 
+  :: (Ptr RawTF1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetFillStyle" c_tf1_setfillstyle 
+  :: (Ptr RawTF1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_GetMarkerColor" c_tf1_getmarkercolor 
+  :: (Ptr RawTF1) -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_GetMarkerStyle" c_tf1_getmarkerstyle 
+  :: (Ptr RawTF1) -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_GetMarkerSize" c_tf1_getmarkersize 
+  :: (Ptr RawTF1) -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_ResetAttMarker" c_tf1_resetattmarker 
+  :: (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetMarkerAttributes" c_tf1_setmarkerattributes 
+  :: (Ptr RawTF1) -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetMarkerColor" c_tf1_setmarkercolor 
+  :: (Ptr RawTF1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetMarkerStyle" c_tf1_setmarkerstyle 
+  :: (Ptr RawTF1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetMarkerSize" c_tf1_setmarkersize 
+  :: (Ptr RawTF1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetName" c_tf1_setname 
+  :: (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetNameTitle" c_tf1_setnametitle 
+  :: (Ptr RawTF1) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetTitle" c_tf1_settitle 
+  :: (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_Draw" c_tf1_draw 
+  :: (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_FindObject" c_tf1_findobject 
+  :: (Ptr RawTF1) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTF1.h TF1_GetName" c_tf1_getname 
+  :: (Ptr RawTF1) -> IO CString
+
+foreign import ccall "HROOTHistTF1.h TF1_IsA" c_tf1_isa 
+  :: (Ptr RawTF1) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTF1.h TF1_Paint" c_tf1_paint 
+  :: (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_printObj" c_tf1_printobj 
+  :: (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SaveAs" c_tf1_saveas 
+  :: (Ptr RawTF1) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_Write" c_tf1_write 
+  :: (Ptr RawTF1) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_delete" c_tf1_delete 
+  :: (Ptr RawTF1) -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_newTF1" c_tf1_newtf1 
+  :: CString -> CString -> CDouble -> CDouble -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTF1.h TF1_Derivative" c_tf1_derivative 
+  :: (Ptr RawTF1) -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_Derivative2" c_tf1_derivative2 
+  :: (Ptr RawTF1) -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_Derivative3" c_tf1_derivative3 
+  :: (Ptr RawTF1) -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_tF1DerivativeError" c_tf1_tf1derivativeerror 
+  :: IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_drawCopyTF1" c_tf1_drawcopytf1 
+  :: (Ptr RawTF1) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTF1.h TF1_DrawDerivative" c_tf1_drawderivative 
+  :: (Ptr RawTF1) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTF1.h TF1_DrawIntegral" c_tf1_drawintegral 
+  :: (Ptr RawTF1) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTF1.h TF1_DrawF1" c_tf1_drawf1 
+  :: (Ptr RawTF1) -> CString -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_FixParameter" c_tf1_fixparameter 
+  :: (Ptr RawTF1) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_tF1GetChisquare" c_tf1_tf1getchisquare 
+  :: (Ptr RawTF1) -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_tF1GetHistogram" c_tf1_tf1gethistogram 
+  :: (Ptr RawTF1) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTF1.h TF1_getMaximumTF1" c_tf1_getmaximumtf1 
+  :: (Ptr RawTF1) -> CDouble -> CDouble -> CDouble -> CDouble -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_getMinimumTF1" c_tf1_getminimumtf1 
+  :: (Ptr RawTF1) -> CDouble -> CDouble -> CDouble -> CDouble -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_GetMaximumX" c_tf1_getmaximumx 
+  :: (Ptr RawTF1) -> CDouble -> CDouble -> CDouble -> CDouble -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_GetMinimumX" c_tf1_getminimumx 
+  :: (Ptr RawTF1) -> CDouble -> CDouble -> CDouble -> CDouble -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_GetNDF" c_tf1_getndf 
+  :: (Ptr RawTF1) -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_GetNpx" c_tf1_getnpx 
+  :: (Ptr RawTF1) -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_GetNumberFreeParameters" c_tf1_getnumberfreeparameters 
+  :: (Ptr RawTF1) -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_GetNumberFitPoints" c_tf1_getnumberfitpoints 
+  :: (Ptr RawTF1) -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_tF1GetParent" c_tf1_tf1getparent 
+  :: (Ptr RawTF1) -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTF1.h TF1_GetParError" c_tf1_getparerror 
+  :: (Ptr RawTF1) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_GetProb" c_tf1_getprob 
+  :: (Ptr RawTF1) -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_getQuantilesTF1" c_tf1_getquantilestf1 
+  :: (Ptr RawTF1) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_getRandomTF1" c_tf1_getrandomtf1 
+  :: (Ptr RawTF1) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_GetSave" c_tf1_getsave 
+  :: (Ptr RawTF1) -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_GetX" c_tf1_getx 
+  :: (Ptr RawTF1) -> CDouble -> CDouble -> CDouble -> CDouble -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_GetXmin" c_tf1_getxmin 
+  :: (Ptr RawTF1) -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_GetXmax" c_tf1_getxmax 
+  :: (Ptr RawTF1) -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_tF1GetXaxis" c_tf1_tf1getxaxis 
+  :: (Ptr RawTF1) -> IO (Ptr RawTAxis)
+
+foreign import ccall "HROOTHistTF1.h TF1_tF1GetYaxis" c_tf1_tf1getyaxis 
+  :: (Ptr RawTF1) -> IO (Ptr RawTAxis)
+
+foreign import ccall "HROOTHistTF1.h TF1_tF1GetZaxis" c_tf1_tf1getzaxis 
+  :: (Ptr RawTF1) -> IO (Ptr RawTAxis)
+
+foreign import ccall "HROOTHistTF1.h TF1_GradientPar" c_tf1_gradientpar 
+  :: (Ptr RawTF1) -> CInt -> (Ptr CDouble) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_InitArgs" c_tf1_initargs 
+  :: (Ptr RawTF1) -> (Ptr CDouble) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_tF1InitStandardFunctions" c_tf1_tf1initstandardfunctions 
+  :: IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_IntegralTF1" c_tf1_integraltf1 
+  :: (Ptr RawTF1) -> CDouble -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_IntegralError" c_tf1_integralerror 
+  :: (Ptr RawTF1) -> CDouble -> CDouble -> (Ptr CDouble) -> (Ptr CDouble) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_IntegralFast" c_tf1_integralfast 
+  :: (Ptr RawTF1) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CDouble -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_IsInside" c_tf1_isinside 
+  :: (Ptr RawTF1) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_ReleaseParameter" c_tf1_releaseparameter 
+  :: (Ptr RawTF1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetChisquare" c_tf1_setchisquare 
+  :: (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_setMaximumTF1" c_tf1_setmaximumtf1 
+  :: (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_setMinimumTF1" c_tf1_setminimumtf1 
+  :: (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetNDF" c_tf1_setndf 
+  :: (Ptr RawTF1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetNumberFitPoints" c_tf1_setnumberfitpoints 
+  :: (Ptr RawTF1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetNpx" c_tf1_setnpx 
+  :: (Ptr RawTF1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetParError" c_tf1_setparerror 
+  :: (Ptr RawTF1) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetParErrors" c_tf1_setparerrors 
+  :: (Ptr RawTF1) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetParLimits" c_tf1_setparlimits 
+  :: (Ptr RawTF1) -> CInt -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetParent" c_tf1_setparent 
+  :: (Ptr RawTF1) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_setRange1" c_tf1_setrange1 
+  :: (Ptr RawTF1) -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_setRange2" c_tf1_setrange2 
+  :: (Ptr RawTF1) -> CDouble -> CDouble -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_setRange3" c_tf1_setrange3 
+  :: (Ptr RawTF1) -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_SetSavedPoint" c_tf1_setsavedpoint 
+  :: (Ptr RawTF1) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_tF1GetCurrent" c_tf1_tf1getcurrent 
+  :: IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTF1.h TF1_tF1AbsValue" c_tf1_tf1absvalue 
+  :: CInt -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_tF1RejectPoint" c_tf1_tf1rejectpoint 
+  :: CInt -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_tF1RejectedPoint" c_tf1_tf1rejectedpoint 
+  :: IO CInt
+
+foreign import ccall "HROOTHistTF1.h TF1_tF1SetCurrent" c_tf1_tf1setcurrent 
+  :: (Ptr RawTF1) -> IO ()
+
+foreign import ccall "HROOTHistTF1.h TF1_Moment" c_tf1_moment 
+  :: (Ptr RawTF1) -> CDouble -> CDouble -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_CentralMoment" c_tf1_centralmoment 
+  :: (Ptr RawTF1) -> CDouble -> CDouble -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_Mean" c_tf1_mean 
+  :: (Ptr RawTF1) -> CDouble -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_Variance" c_tf1_variance 
+  :: (Ptr RawTF1) -> CDouble -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTF1.h TF1_tF1CalcGaussLegendreSamplingPoints" c_tf1_tf1calcgausslegendresamplingpoints 
+  :: CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CDouble -> IO ()
+
diff --git a/src/HROOT/Hist/TF1/Implementation.hs b/src/HROOT/Hist/TF1/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TF1/Implementation.hs
@@ -0,0 +1,314 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TF1.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.FFI
+import HROOT.Hist.TF1.Interface
+import HROOT.Hist.TF1.Cast
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Hist.TFormula.RawType
+import HROOT.Hist.TFormula.Cast
+import HROOT.Hist.TFormula.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.TNamed.RawType
+import HROOT.Core.TNamed.Cast
+import HROOT.Core.TNamed.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITF1 TF1 where
+  derivative = xform3 c_tf1_derivative
+  derivative2 = xform3 c_tf1_derivative2
+  derivative3 = xform3 c_tf1_derivative3
+  drawCopyTF1 = xform1 c_tf1_drawcopytf1
+  drawDerivative = xform1 c_tf1_drawderivative
+  drawIntegral = xform1 c_tf1_drawintegral
+  drawF1 = xform4 c_tf1_drawf1
+  fixParameter = xform2 c_tf1_fixparameter
+  getMaximumTF1 = xform5 c_tf1_getmaximumtf1
+  getMinimumTF1 = xform5 c_tf1_getminimumtf1
+  getMaximumX = xform5 c_tf1_getmaximumx
+  getMinimumX = xform5 c_tf1_getminimumx
+  getNDF = xform0 c_tf1_getndf
+  getNpx = xform0 c_tf1_getnpx
+  getNumberFreeParameters = xform0 c_tf1_getnumberfreeparameters
+  getNumberFitPoints = xform0 c_tf1_getnumberfitpoints
+  getParError = xform1 c_tf1_getparerror
+  getProb = xform0 c_tf1_getprob
+  getQuantilesTF1 = xform3 c_tf1_getquantilestf1
+  getRandomTF1 = xform2 c_tf1_getrandomtf1
+  getSave = xform1 c_tf1_getsave
+  getX = xform5 c_tf1_getx
+  getXmin = xform0 c_tf1_getxmin
+  getXmax = xform0 c_tf1_getxmax
+  gradientPar = xform3 c_tf1_gradientpar
+  initArgs = xform2 c_tf1_initargs
+  integralTF1 = xform4 c_tf1_integraltf1
+  integralError = xform5 c_tf1_integralerror
+  integralFast = xform7 c_tf1_integralfast
+  isInside = xform1 c_tf1_isinside
+  releaseParameter = xform1 c_tf1_releaseparameter
+  setChisquare = xform1 c_tf1_setchisquare
+  setMaximumTF1 = xform1 c_tf1_setmaximumtf1
+  setMinimumTF1 = xform1 c_tf1_setminimumtf1
+  setNDF = xform1 c_tf1_setndf
+  setNumberFitPoints = xform1 c_tf1_setnumberfitpoints
+  setNpx = xform1 c_tf1_setnpx
+  setParError = xform2 c_tf1_setparerror
+  setParErrors = xform1 c_tf1_setparerrors
+  setParLimits = xform3 c_tf1_setparlimits
+  setParent = xform1 c_tf1_setparent
+  setRange1 = xform2 c_tf1_setrange1
+  setRange2 = xform4 c_tf1_setrange2
+  setRange3 = xform6 c_tf1_setrange3
+  setSavedPoint = xform2 c_tf1_setsavedpoint
+  moment = xform5 c_tf1_moment
+  centralMoment = xform5 c_tf1_centralmoment
+  mean = xform4 c_tf1_mean
+  variance = xform4 c_tf1_variance
+instance ITFormula TF1 where
+  compile = xform1 c_tf1_compile
+  clear = xform1 c_tf1_clear
+  definedValue = xform1 c_tf1_definedvalue
+  eval = xform4 c_tf1_eval
+  evalParOld = xform2 c_tf1_evalparold
+  evalPar = xform2 c_tf1_evalpar
+  getNdim = xform0 c_tf1_getndim
+  getNpar = xform0 c_tf1_getnpar
+  getNumber = xform0 c_tf1_getnumber
+  getParNumber = xform1 c_tf1_getparnumber
+  isLinear = xform0 c_tf1_islinear
+  isNormalized = xform0 c_tf1_isnormalized
+  setNumber = xform1 c_tf1_setnumber
+  setParameter = xform2 c_tf1_setparameter
+  setParameters = xform1 c_tf1_setparameters
+  setParName = xform2 c_tf1_setparname
+  setParNames = xform11 c_tf1_setparnames
+  update = xform0 c_tf1_update
+instance ITAttLine TF1 where
+  getLineColor = xform0 c_tf1_getlinecolor
+  getLineStyle = xform0 c_tf1_getlinestyle
+  getLineWidth = xform0 c_tf1_getlinewidth
+  resetAttLine = xform1 c_tf1_resetattline
+  setLineAttributes = xform0 c_tf1_setlineattributes
+  setLineColor = xform1 c_tf1_setlinecolor
+  setLineStyle = xform1 c_tf1_setlinestyle
+  setLineWidth = xform1 c_tf1_setlinewidth
+instance ITAttFill TF1 where
+  setFillColor = xform1 c_tf1_setfillcolor
+  setFillStyle = xform1 c_tf1_setfillstyle
+instance ITAttMarker TF1 where
+  getMarkerColor = xform0 c_tf1_getmarkercolor
+  getMarkerStyle = xform0 c_tf1_getmarkerstyle
+  getMarkerSize = xform0 c_tf1_getmarkersize
+  resetAttMarker = xform1 c_tf1_resetattmarker
+  setMarkerAttributes = xform0 c_tf1_setmarkerattributes
+  setMarkerColor = xform1 c_tf1_setmarkercolor
+  setMarkerStyle = xform1 c_tf1_setmarkerstyle
+  setMarkerSize = xform1 c_tf1_setmarkersize
+instance ITNamed TF1 where
+  setName = xform1 c_tf1_setname
+  setNameTitle = xform2 c_tf1_setnametitle
+  setTitle = xform1 c_tf1_settitle
+instance ITObject TF1 where
+  draw = xform1 c_tf1_draw
+  findObject = xform1 c_tf1_findobject
+  getName = xform0 c_tf1_getname
+  isA = xform0 c_tf1_isa
+  paint = xform1 c_tf1_paint
+  printObj = xform1 c_tf1_printobj
+  saveAs = xform2 c_tf1_saveas
+  write = xform3 c_tf1_write
+instance IDeletable TF1 where
+  delete = xform0 c_tf1_delete
+
+instance ITF1 (Exist TF1) where
+  derivative (ETF1 x) = derivative x
+  derivative2 (ETF1 x) = derivative2 x
+  derivative3 (ETF1 x) = derivative3 x
+  drawCopyTF1 (ETF1 x) a1 = return . ETF1 =<< drawCopyTF1 x a1
+  drawDerivative (ETF1 x) = drawDerivative x
+  drawIntegral (ETF1 x) = drawIntegral x
+  drawF1 (ETF1 x) = drawF1 x
+  fixParameter (ETF1 x) = fixParameter x
+  getMaximumTF1 (ETF1 x) = getMaximumTF1 x
+  getMinimumTF1 (ETF1 x) = getMinimumTF1 x
+  getMaximumX (ETF1 x) = getMaximumX x
+  getMinimumX (ETF1 x) = getMinimumX x
+  getNDF (ETF1 x) = getNDF x
+  getNpx (ETF1 x) = getNpx x
+  getNumberFreeParameters (ETF1 x) = getNumberFreeParameters x
+  getNumberFitPoints (ETF1 x) = getNumberFitPoints x
+  getParError (ETF1 x) = getParError x
+  getProb (ETF1 x) = getProb x
+  getQuantilesTF1 (ETF1 x) = getQuantilesTF1 x
+  getRandomTF1 (ETF1 x) = getRandomTF1 x
+  getSave (ETF1 x) = getSave x
+  getX (ETF1 x) = getX x
+  getXmin (ETF1 x) = getXmin x
+  getXmax (ETF1 x) = getXmax x
+  gradientPar (ETF1 x) = gradientPar x
+  initArgs (ETF1 x) = initArgs x
+  integralTF1 (ETF1 x) = integralTF1 x
+  integralError (ETF1 x) = integralError x
+  integralFast (ETF1 x) = integralFast x
+  isInside (ETF1 x) = isInside x
+  releaseParameter (ETF1 x) = releaseParameter x
+  setChisquare (ETF1 x) = setChisquare x
+  setMaximumTF1 (ETF1 x) = setMaximumTF1 x
+  setMinimumTF1 (ETF1 x) = setMinimumTF1 x
+  setNDF (ETF1 x) = setNDF x
+  setNumberFitPoints (ETF1 x) = setNumberFitPoints x
+  setNpx (ETF1 x) = setNpx x
+  setParError (ETF1 x) = setParError x
+  setParErrors (ETF1 x) = setParErrors x
+  setParLimits (ETF1 x) = setParLimits x
+  setParent (ETF1 x) = setParent x
+  setRange1 (ETF1 x) = setRange1 x
+  setRange2 (ETF1 x) = setRange2 x
+  setRange3 (ETF1 x) = setRange3 x
+  setSavedPoint (ETF1 x) = setSavedPoint x
+  moment (ETF1 x) = moment x
+  centralMoment (ETF1 x) = centralMoment x
+  mean (ETF1 x) = mean x
+  variance (ETF1 x) = variance x
+instance ITFormula (Exist TF1) where
+  compile (ETF1 x) = compile x
+  clear (ETF1 x) = clear x
+  definedValue (ETF1 x) = definedValue x
+  eval (ETF1 x) = eval x
+  evalParOld (ETF1 x) = evalParOld x
+  evalPar (ETF1 x) = evalPar x
+  getNdim (ETF1 x) = getNdim x
+  getNpar (ETF1 x) = getNpar x
+  getNumber (ETF1 x) = getNumber x
+  getParNumber (ETF1 x) = getParNumber x
+  isLinear (ETF1 x) = isLinear x
+  isNormalized (ETF1 x) = isNormalized x
+  setNumber (ETF1 x) = setNumber x
+  setParameter (ETF1 x) = setParameter x
+  setParameters (ETF1 x) = setParameters x
+  setParName (ETF1 x) = setParName x
+  setParNames (ETF1 x) = setParNames x
+  update (ETF1 x) = update x
+instance ITAttLine (Exist TF1) where
+  getLineColor (ETF1 x) = getLineColor x
+  getLineStyle (ETF1 x) = getLineStyle x
+  getLineWidth (ETF1 x) = getLineWidth x
+  resetAttLine (ETF1 x) = resetAttLine x
+  setLineAttributes (ETF1 x) = setLineAttributes x
+  setLineColor (ETF1 x) = setLineColor x
+  setLineStyle (ETF1 x) = setLineStyle x
+  setLineWidth (ETF1 x) = setLineWidth x
+instance ITAttFill (Exist TF1) where
+  setFillColor (ETF1 x) = setFillColor x
+  setFillStyle (ETF1 x) = setFillStyle x
+instance ITAttMarker (Exist TF1) where
+  getMarkerColor (ETF1 x) = getMarkerColor x
+  getMarkerStyle (ETF1 x) = getMarkerStyle x
+  getMarkerSize (ETF1 x) = getMarkerSize x
+  resetAttMarker (ETF1 x) = resetAttMarker x
+  setMarkerAttributes (ETF1 x) = setMarkerAttributes x
+  setMarkerColor (ETF1 x) = setMarkerColor x
+  setMarkerStyle (ETF1 x) = setMarkerStyle x
+  setMarkerSize (ETF1 x) = setMarkerSize x
+instance ITNamed (Exist TF1) where
+  setName (ETF1 x) = setName x
+  setNameTitle (ETF1 x) = setNameTitle x
+  setTitle (ETF1 x) = setTitle x
+instance ITObject (Exist TF1) where
+  draw (ETF1 x) = draw x
+  findObject (ETF1 x) = findObject x
+  getName (ETF1 x) = getName x
+  isA (ETF1 x) = isA x
+  paint (ETF1 x) = paint x
+  printObj (ETF1 x) = printObj x
+  saveAs (ETF1 x) = saveAs x
+  write (ETF1 x) = write x
+instance IDeletable (Exist TF1) where
+  delete (ETF1 x) = delete x
+
+
+newTF1 :: CString -> CString -> CDouble -> CDouble -> IO TF1
+newTF1 = xform3 c_tf1_newtf1
+
+tF1GetChisquare :: TF1 -> IO CDouble
+tF1GetChisquare = xform0 c_tf1_tf1getchisquare
+
+tF1GetHistogram :: TF1 -> IO TH1
+tF1GetHistogram = xform0 c_tf1_tf1gethistogram
+
+tF1GetParent :: TF1 -> IO TObject
+tF1GetParent = xform0 c_tf1_tf1getparent
+
+tF1GetXaxis :: TF1 -> IO TAxis
+tF1GetXaxis = xform0 c_tf1_tf1getxaxis
+
+tF1GetYaxis :: TF1 -> IO TAxis
+tF1GetYaxis = xform0 c_tf1_tf1getyaxis
+
+tF1GetZaxis :: TF1 -> IO TAxis
+tF1GetZaxis = xform0 c_tf1_tf1getzaxis
+
+tF1DerivativeError :: IO CDouble
+tF1DerivativeError = xformnull c_tf1_tf1derivativeerror
+
+tF1InitStandardFunctions :: IO ()
+tF1InitStandardFunctions = xformnull c_tf1_tf1initstandardfunctions
+
+tF1GetCurrent :: IO TF1
+tF1GetCurrent = xformnull c_tf1_tf1getcurrent
+
+tF1AbsValue :: CInt -> IO ()
+tF1AbsValue = xform0 c_tf1_tf1absvalue
+
+tF1RejectPoint :: CInt -> IO ()
+tF1RejectPoint = xform0 c_tf1_tf1rejectpoint
+
+tF1RejectedPoint :: IO CInt
+tF1RejectedPoint = xformnull c_tf1_tf1rejectedpoint
+
+tF1SetCurrent :: TF1 -> IO ()
+tF1SetCurrent = xform0 c_tf1_tf1setcurrent
+
+tF1CalcGaussLegendreSamplingPoints :: CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CDouble -> IO ()
+tF1CalcGaussLegendreSamplingPoints = xform3 c_tf1_tf1calcgausslegendresamplingpoints
+
+instance FPtr (Exist TF1) where
+  type Raw (Exist TF1) = RawTF1
+  get_fptr (ETF1 obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETF1 (cast_fptr_to_obj (fptr :: ForeignPtr RawTF1) :: TF1)
diff --git a/src/HROOT/Hist/TF1/Interface.hs b/src/HROOT/Hist/TF1/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TF1/Interface.hs
@@ -0,0 +1,140 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TF1.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TFormula.Interface
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.TObject.Interface
+---- ============ ----
+
+
+
+class (ITFormula a,ITAttLine a,ITAttFill a,ITAttMarker a) => ITF1 a where
+
+    derivative :: a -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble 
+
+    derivative2 :: a -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble 
+
+    derivative3 :: a -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble 
+
+    drawCopyTF1 :: a -> CString -> IO a 
+
+    drawDerivative :: a -> CString -> IO TObject 
+
+    drawIntegral :: a -> CString -> IO TObject 
+
+    drawF1 :: a -> CString -> CDouble -> CDouble -> CString -> IO () 
+
+    fixParameter :: a -> CInt -> CDouble -> IO () 
+
+    getMaximumTF1 :: a -> CDouble -> CDouble -> CDouble -> CDouble -> CInt -> IO CDouble 
+
+    getMinimumTF1 :: a -> CDouble -> CDouble -> CDouble -> CDouble -> CInt -> IO CDouble 
+
+    getMaximumX :: a -> CDouble -> CDouble -> CDouble -> CDouble -> CInt -> IO CDouble 
+
+    getMinimumX :: a -> CDouble -> CDouble -> CDouble -> CDouble -> CInt -> IO CDouble 
+
+    getNDF :: a -> IO CInt 
+
+    getNpx :: a -> IO CInt 
+
+    getNumberFreeParameters :: a -> IO CInt 
+
+    getNumberFitPoints :: a -> IO CInt 
+
+    getParError :: a -> CInt -> IO CDouble 
+
+    getProb :: a -> IO CDouble 
+
+    getQuantilesTF1 :: a -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt 
+
+    getRandomTF1 :: a -> CDouble -> CDouble -> IO CDouble 
+
+    getSave :: a -> (Ptr CDouble) -> IO CDouble 
+
+    getX :: a -> CDouble -> CDouble -> CDouble -> CDouble -> CInt -> IO CDouble 
+
+    getXmin :: a -> IO CDouble 
+
+    getXmax :: a -> IO CDouble 
+
+    gradientPar :: a -> CInt -> (Ptr CDouble) -> CDouble -> IO CDouble 
+
+    initArgs :: a -> (Ptr CDouble) -> (Ptr CDouble) -> IO () 
+
+    integralTF1 :: a -> CDouble -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble 
+
+    integralError :: a -> CDouble -> CDouble -> (Ptr CDouble) -> (Ptr CDouble) -> CDouble -> IO CDouble 
+
+    integralFast :: a -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CDouble -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble 
+
+    isInside :: a -> (Ptr CDouble) -> IO CInt 
+
+    releaseParameter :: a -> CInt -> IO () 
+
+    setChisquare :: a -> CDouble -> IO () 
+
+    setMaximumTF1 :: a -> CDouble -> IO () 
+
+    setMinimumTF1 :: a -> CDouble -> IO () 
+
+    setNDF :: a -> CInt -> IO () 
+
+    setNumberFitPoints :: a -> CInt -> IO () 
+
+    setNpx :: a -> CInt -> IO () 
+
+    setParError :: a -> CInt -> CDouble -> IO () 
+
+    setParErrors :: a -> (Ptr CDouble) -> IO () 
+
+    setParLimits :: a -> CInt -> CDouble -> CDouble -> IO () 
+
+    setParent :: (ITObject c0, FPtr c0) => a -> c0 -> IO () 
+
+    setRange1 :: a -> CDouble -> CDouble -> IO () 
+
+    setRange2 :: a -> CDouble -> CDouble -> CDouble -> CDouble -> IO () 
+
+    setRange3 :: a -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> IO () 
+
+    setSavedPoint :: a -> CInt -> CDouble -> IO () 
+
+    moment :: a -> CDouble -> CDouble -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble 
+
+    centralMoment :: a -> CDouble -> CDouble -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble 
+
+    mean :: a -> CDouble -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble 
+
+    variance :: a -> CDouble -> CDouble -> (Ptr CDouble) -> CDouble -> IO CDouble 
+
+instance Existable TF1 where
+  data Exist TF1 = forall a. (FPtr a, ITF1 a) => ETF1 a
+
+upcastTF1 :: (FPtr a, ITF1 a) => a -> TF1
+upcastTF1 h = let fh = get_fptr h
+                  fh2 :: ForeignPtr RawTF1 = castForeignPtr fh
+              in cast_fptr_to_obj fh2
+
+downcastTF1 :: (FPtr a, ITF1 a) => TF1 -> a 
+downcastTF1 h = let fh = get_fptr h
+                    fh2 = castForeignPtr fh
+                in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TF1/Interface.hs-boot b/src/HROOT/Hist/TF1/Interface.hs-boot
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TF1/Interface.hs-boot
@@ -0,0 +1,3 @@
+module HROOT.Hist.TF1.Interface where
+
+class ITF1 a
diff --git a/src/HROOT/Hist/TF1/RawType.hs b/src/HROOT/Hist/TF1/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TF1/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TF1.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTF1
+newtype TF1 = TF1 (ForeignPtr RawTF1) deriving (Eq, Ord, Show)
+instance FPtr TF1 where
+   type Raw TF1 = RawTF1
+   get_fptr (TF1 fptr) = fptr
+   cast_fptr_to_obj = TF1
diff --git a/src/HROOT/Hist/TFormula.hs b/src/HROOT/Hist/TFormula.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TFormula.hs
@@ -0,0 +1,17 @@
+module HROOT.Hist.TFormula
+  (
+    TFormula(..)
+  , ITFormula(..)
+  , upcastTFormula
+  , downcastTFormula
+  , newTFormula
+  , tFormulaOptimize
+  , tFormulaGetParameter
+ 
+  ) where
+
+import HROOT.Hist.TFormula.RawType
+import HROOT.Hist.TFormula.Interface
+import HROOT.Hist.TFormula.Implementation
+
+
diff --git a/src/HROOT/Hist/TFormula/Cast.hs b/src/HROOT/Hist/TFormula/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TFormula/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TFormula.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TFormula.RawType
+import HROOT.Hist.TFormula.Interface
+
+instance (ITFormula a, FPtr a) => Castable a (Ptr RawTFormula) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TFormula (Ptr RawTFormula) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TFormula/FFI.hsc b/src/HROOT/Hist/TFormula/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TFormula/FFI.hsc
@@ -0,0 +1,119 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TFormula.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TFormula.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTFormula.h"
+
+foreign import ccall "HROOTHistTFormula.h TFormula_SetName" c_tformula_setname 
+  :: (Ptr RawTFormula) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTFormula.h TFormula_SetNameTitle" c_tformula_setnametitle 
+  :: (Ptr RawTFormula) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTFormula.h TFormula_SetTitle" c_tformula_settitle 
+  :: (Ptr RawTFormula) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTFormula.h TFormula_Draw" c_tformula_draw 
+  :: (Ptr RawTFormula) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTFormula.h TFormula_FindObject" c_tformula_findobject 
+  :: (Ptr RawTFormula) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTFormula.h TFormula_GetName" c_tformula_getname 
+  :: (Ptr RawTFormula) -> IO CString
+
+foreign import ccall "HROOTHistTFormula.h TFormula_IsA" c_tformula_isa 
+  :: (Ptr RawTFormula) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTFormula.h TFormula_Paint" c_tformula_paint 
+  :: (Ptr RawTFormula) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTFormula.h TFormula_printObj" c_tformula_printobj 
+  :: (Ptr RawTFormula) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTFormula.h TFormula_SaveAs" c_tformula_saveas 
+  :: (Ptr RawTFormula) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTFormula.h TFormula_Write" c_tformula_write 
+  :: (Ptr RawTFormula) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTFormula.h TFormula_delete" c_tformula_delete 
+  :: (Ptr RawTFormula) -> IO ()
+
+foreign import ccall "HROOTHistTFormula.h TFormula_newTFormula" c_tformula_newtformula 
+  :: CString -> CString -> IO (Ptr RawTFormula)
+
+foreign import ccall "HROOTHistTFormula.h TFormula_tFormulaOptimize" c_tformula_tformulaoptimize 
+  :: (Ptr RawTFormula) -> IO ()
+
+foreign import ccall "HROOTHistTFormula.h TFormula_Compile" c_tformula_compile 
+  :: (Ptr RawTFormula) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTFormula.h TFormula_Clear" c_tformula_clear 
+  :: (Ptr RawTFormula) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTFormula.h TFormula_DefinedValue" c_tformula_definedvalue 
+  :: (Ptr RawTFormula) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTFormula.h TFormula_Eval" c_tformula_eval 
+  :: (Ptr RawTFormula) -> CDouble -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTFormula.h TFormula_EvalParOld" c_tformula_evalparold 
+  :: (Ptr RawTFormula) -> (Ptr CDouble) -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTFormula.h TFormula_EvalPar" c_tformula_evalpar 
+  :: (Ptr RawTFormula) -> (Ptr CDouble) -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTFormula.h TFormula_GetNdim" c_tformula_getndim 
+  :: (Ptr RawTFormula) -> IO CInt
+
+foreign import ccall "HROOTHistTFormula.h TFormula_GetNpar" c_tformula_getnpar 
+  :: (Ptr RawTFormula) -> IO CInt
+
+foreign import ccall "HROOTHistTFormula.h TFormula_GetNumber" c_tformula_getnumber 
+  :: (Ptr RawTFormula) -> IO CInt
+
+foreign import ccall "HROOTHistTFormula.h TFormula_tFormulaGetParameter" c_tformula_tformulagetparameter 
+  :: (Ptr RawTFormula) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTFormula.h TFormula_GetParNumber" c_tformula_getparnumber 
+  :: (Ptr RawTFormula) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTFormula.h TFormula_IsLinear" c_tformula_islinear 
+  :: (Ptr RawTFormula) -> IO CInt
+
+foreign import ccall "HROOTHistTFormula.h TFormula_IsNormalized" c_tformula_isnormalized 
+  :: (Ptr RawTFormula) -> IO CInt
+
+foreign import ccall "HROOTHistTFormula.h TFormula_SetNumber" c_tformula_setnumber 
+  :: (Ptr RawTFormula) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTFormula.h TFormula_SetParameter" c_tformula_setparameter 
+  :: (Ptr RawTFormula) -> CString -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTFormula.h TFormula_SetParameters" c_tformula_setparameters 
+  :: (Ptr RawTFormula) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTFormula.h TFormula_SetParName" c_tformula_setparname 
+  :: (Ptr RawTFormula) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTFormula.h TFormula_SetParNames" c_tformula_setparnames 
+  :: (Ptr RawTFormula) -> CString -> CString -> CString -> CString -> CString -> CString -> CString -> CString -> CString -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTFormula.h TFormula_Update" c_tformula_update 
+  :: (Ptr RawTFormula) -> IO ()
+
diff --git a/src/HROOT/Hist/TFormula/Implementation.hs b/src/HROOT/Hist/TFormula/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TFormula/Implementation.hs
@@ -0,0 +1,120 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TFormula.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TFormula.RawType
+import HROOT.Hist.TFormula.FFI
+import HROOT.Hist.TFormula.Interface
+import HROOT.Hist.TFormula.Cast
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Core.TNamed.RawType
+import HROOT.Core.TNamed.Cast
+import HROOT.Core.TNamed.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITFormula TFormula where
+  compile = xform1 c_tformula_compile
+  clear = xform1 c_tformula_clear
+  definedValue = xform1 c_tformula_definedvalue
+  eval = xform4 c_tformula_eval
+  evalParOld = xform2 c_tformula_evalparold
+  evalPar = xform2 c_tformula_evalpar
+  getNdim = xform0 c_tformula_getndim
+  getNpar = xform0 c_tformula_getnpar
+  getNumber = xform0 c_tformula_getnumber
+  getParNumber = xform1 c_tformula_getparnumber
+  isLinear = xform0 c_tformula_islinear
+  isNormalized = xform0 c_tformula_isnormalized
+  setNumber = xform1 c_tformula_setnumber
+  setParameter = xform2 c_tformula_setparameter
+  setParameters = xform1 c_tformula_setparameters
+  setParName = xform2 c_tformula_setparname
+  setParNames = xform11 c_tformula_setparnames
+  update = xform0 c_tformula_update
+instance ITNamed TFormula where
+  setName = xform1 c_tformula_setname
+  setNameTitle = xform2 c_tformula_setnametitle
+  setTitle = xform1 c_tformula_settitle
+instance ITObject TFormula where
+  draw = xform1 c_tformula_draw
+  findObject = xform1 c_tformula_findobject
+  getName = xform0 c_tformula_getname
+  isA = xform0 c_tformula_isa
+  paint = xform1 c_tformula_paint
+  printObj = xform1 c_tformula_printobj
+  saveAs = xform2 c_tformula_saveas
+  write = xform3 c_tformula_write
+instance IDeletable TFormula where
+  delete = xform0 c_tformula_delete
+
+instance ITFormula (Exist TFormula) where
+  compile (ETFormula x) = compile x
+  clear (ETFormula x) = clear x
+  definedValue (ETFormula x) = definedValue x
+  eval (ETFormula x) = eval x
+  evalParOld (ETFormula x) = evalParOld x
+  evalPar (ETFormula x) = evalPar x
+  getNdim (ETFormula x) = getNdim x
+  getNpar (ETFormula x) = getNpar x
+  getNumber (ETFormula x) = getNumber x
+  getParNumber (ETFormula x) = getParNumber x
+  isLinear (ETFormula x) = isLinear x
+  isNormalized (ETFormula x) = isNormalized x
+  setNumber (ETFormula x) = setNumber x
+  setParameter (ETFormula x) = setParameter x
+  setParameters (ETFormula x) = setParameters x
+  setParName (ETFormula x) = setParName x
+  setParNames (ETFormula x) = setParNames x
+  update (ETFormula x) = update x
+instance ITNamed (Exist TFormula) where
+  setName (ETFormula x) = setName x
+  setNameTitle (ETFormula x) = setNameTitle x
+  setTitle (ETFormula x) = setTitle x
+instance ITObject (Exist TFormula) where
+  draw (ETFormula x) = draw x
+  findObject (ETFormula x) = findObject x
+  getName (ETFormula x) = getName x
+  isA (ETFormula x) = isA x
+  paint (ETFormula x) = paint x
+  printObj (ETFormula x) = printObj x
+  saveAs (ETFormula x) = saveAs x
+  write (ETFormula x) = write x
+instance IDeletable (Exist TFormula) where
+  delete (ETFormula x) = delete x
+
+
+newTFormula :: CString -> CString -> IO TFormula
+newTFormula = xform1 c_tformula_newtformula
+
+tFormulaOptimize :: TFormula -> IO ()
+tFormulaOptimize = xform0 c_tformula_tformulaoptimize
+
+tFormulaGetParameter :: TFormula -> CString -> IO CDouble
+tFormulaGetParameter = xform1 c_tformula_tformulagetparameter
+
+
+
+instance FPtr (Exist TFormula) where
+  type Raw (Exist TFormula) = RawTFormula
+  get_fptr (ETFormula obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETFormula (cast_fptr_to_obj (fptr :: ForeignPtr RawTFormula) :: TFormula)
diff --git a/src/HROOT/Hist/TFormula/Interface.hs b/src/HROOT/Hist/TFormula/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TFormula/Interface.hs
@@ -0,0 +1,72 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TFormula.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TFormula.RawType
+
+import HROOT.Core.TNamed.Interface
+---- ============ ----
+
+
+
+class (ITNamed a) => ITFormula a where
+
+    compile :: a -> CString -> IO CInt 
+
+    clear :: a -> CString -> IO () 
+
+    definedValue :: a -> CInt -> IO CDouble 
+
+    eval :: a -> CDouble -> CDouble -> CDouble -> CDouble -> IO CDouble 
+
+    evalParOld :: a -> (Ptr CDouble) -> (Ptr CDouble) -> IO CDouble 
+
+    evalPar :: a -> (Ptr CDouble) -> (Ptr CDouble) -> IO CDouble 
+
+    getNdim :: a -> IO CInt 
+
+    getNpar :: a -> IO CInt 
+
+    getNumber :: a -> IO CInt 
+
+    getParNumber :: a -> CString -> IO CInt 
+
+    isLinear :: a -> IO CInt 
+
+    isNormalized :: a -> IO CInt 
+
+    setNumber :: a -> CInt -> IO () 
+
+    setParameter :: a -> CString -> CDouble -> IO () 
+
+    setParameters :: a -> (Ptr CDouble) -> IO () 
+
+    setParName :: a -> CInt -> CString -> IO () 
+
+    setParNames :: a -> CString -> CString -> CString -> CString -> CString -> CString -> CString -> CString -> CString -> CString -> CString -> IO () 
+
+    update :: a -> IO () 
+
+instance Existable TFormula where
+  data Exist TFormula = forall a. (FPtr a, ITFormula a) => ETFormula a
+
+upcastTFormula :: (FPtr a, ITFormula a) => a -> TFormula
+upcastTFormula h = let fh = get_fptr h
+                       fh2 :: ForeignPtr RawTFormula = castForeignPtr fh
+                   in cast_fptr_to_obj fh2
+
+downcastTFormula :: (FPtr a, ITFormula a) => TFormula -> a 
+downcastTFormula h = let fh = get_fptr h
+                         fh2 = castForeignPtr fh
+                     in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TFormula/RawType.hs b/src/HROOT/Hist/TFormula/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TFormula/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TFormula.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTFormula
+newtype TFormula = TFormula (ForeignPtr RawTFormula) deriving (Eq, Ord, Show)
+instance FPtr TFormula where
+   type Raw TFormula = RawTFormula
+   get_fptr (TFormula fptr) = fptr
+   cast_fptr_to_obj = TFormula
diff --git a/src/HROOT/Hist/TGraph.hs b/src/HROOT/Hist/TGraph.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraph.hs
@@ -0,0 +1,26 @@
+module HROOT.Hist.TGraph
+  (
+    TGraph(..)
+  , ITGraph(..)
+  , upcastTGraph
+  , downcastTGraph
+  , newTGraph
+  , tGraphGetEditable
+  , tGraphGetFunction
+  , tGraphGetHistogram
+  , tGraphGetMaxSize
+  , tGraphGetN
+  , tGraphGetMaximum
+  , tGraphGetMinimum
+  , tGraphGetXaxis
+  , tGraphGetYaxis
+  , tGraphPaintGraph
+  , tGraphPaintGrapHist
+ 
+  ) where
+
+import HROOT.Hist.TGraph.RawType
+import HROOT.Hist.TGraph.Interface
+import HROOT.Hist.TGraph.Implementation
+
+
diff --git a/src/HROOT/Hist/TGraph/Cast.hs b/src/HROOT/Hist/TGraph/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraph/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TGraph.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TGraph.RawType
+import HROOT.Hist.TGraph.Interface
+
+instance (ITGraph a, FPtr a) => Castable a (Ptr RawTGraph) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TGraph (Ptr RawTGraph) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TGraph/FFI.hsc b/src/HROOT/Hist/TGraph/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraph/FFI.hsc
@@ -0,0 +1,245 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TGraph.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TGraph.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TH1F.RawType
+import HROOT.Hist.TAxis.RawType
+
+#include "HROOTHistTGraph.h"
+
+foreign import ccall "HROOTHistTGraph.h TGraph_SetName" c_tgraph_setname 
+  :: (Ptr RawTGraph) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_SetNameTitle" c_tgraph_setnametitle 
+  :: (Ptr RawTGraph) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_SetTitle" c_tgraph_settitle 
+  :: (Ptr RawTGraph) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_GetLineColor" c_tgraph_getlinecolor 
+  :: (Ptr RawTGraph) -> IO CInt
+
+foreign import ccall "HROOTHistTGraph.h TGraph_GetLineStyle" c_tgraph_getlinestyle 
+  :: (Ptr RawTGraph) -> IO CInt
+
+foreign import ccall "HROOTHistTGraph.h TGraph_GetLineWidth" c_tgraph_getlinewidth 
+  :: (Ptr RawTGraph) -> IO CInt
+
+foreign import ccall "HROOTHistTGraph.h TGraph_ResetAttLine" c_tgraph_resetattline 
+  :: (Ptr RawTGraph) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_SetLineAttributes" c_tgraph_setlineattributes 
+  :: (Ptr RawTGraph) -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_SetLineColor" c_tgraph_setlinecolor 
+  :: (Ptr RawTGraph) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_SetLineStyle" c_tgraph_setlinestyle 
+  :: (Ptr RawTGraph) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_SetLineWidth" c_tgraph_setlinewidth 
+  :: (Ptr RawTGraph) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_SetFillColor" c_tgraph_setfillcolor 
+  :: (Ptr RawTGraph) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_SetFillStyle" c_tgraph_setfillstyle 
+  :: (Ptr RawTGraph) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_GetMarkerColor" c_tgraph_getmarkercolor 
+  :: (Ptr RawTGraph) -> IO CInt
+
+foreign import ccall "HROOTHistTGraph.h TGraph_GetMarkerStyle" c_tgraph_getmarkerstyle 
+  :: (Ptr RawTGraph) -> IO CInt
+
+foreign import ccall "HROOTHistTGraph.h TGraph_GetMarkerSize" c_tgraph_getmarkersize 
+  :: (Ptr RawTGraph) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraph.h TGraph_ResetAttMarker" c_tgraph_resetattmarker 
+  :: (Ptr RawTGraph) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_SetMarkerAttributes" c_tgraph_setmarkerattributes 
+  :: (Ptr RawTGraph) -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_SetMarkerColor" c_tgraph_setmarkercolor 
+  :: (Ptr RawTGraph) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_SetMarkerStyle" c_tgraph_setmarkerstyle 
+  :: (Ptr RawTGraph) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_SetMarkerSize" c_tgraph_setmarkersize 
+  :: (Ptr RawTGraph) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_Draw" c_tgraph_draw 
+  :: (Ptr RawTGraph) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_FindObject" c_tgraph_findobject 
+  :: (Ptr RawTGraph) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTGraph.h TGraph_GetName" c_tgraph_getname 
+  :: (Ptr RawTGraph) -> IO CString
+
+foreign import ccall "HROOTHistTGraph.h TGraph_IsA" c_tgraph_isa 
+  :: (Ptr RawTGraph) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTGraph.h TGraph_Paint" c_tgraph_paint 
+  :: (Ptr RawTGraph) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_printObj" c_tgraph_printobj 
+  :: (Ptr RawTGraph) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_SaveAs" c_tgraph_saveas 
+  :: (Ptr RawTGraph) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_Write" c_tgraph_write 
+  :: (Ptr RawTGraph) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTGraph.h TGraph_delete" c_tgraph_delete 
+  :: (Ptr RawTGraph) -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_newTGraph" c_tgraph_newtgraph 
+  :: CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO (Ptr RawTGraph)
+
+foreign import ccall "HROOTHistTGraph.h TGraph_Apply" c_tgraph_apply 
+  :: (Ptr RawTGraph) -> (Ptr RawTF1) -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_Chisquare" c_tgraph_chisquare 
+  :: (Ptr RawTGraph) -> (Ptr RawTF1) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraph.h TGraph_DrawGraph" c_tgraph_drawgraph 
+  :: (Ptr RawTGraph) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_drawPanelTGraph" c_tgraph_drawpaneltgraph 
+  :: (Ptr RawTGraph) -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_Expand" c_tgraph_expand 
+  :: (Ptr RawTGraph) -> CInt -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_FitPanelTGraph" c_tgraph_fitpaneltgraph 
+  :: (Ptr RawTGraph) -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_tGraphGetEditable" c_tgraph_tgraphgeteditable 
+  :: (Ptr RawTGraph) -> IO CInt
+
+foreign import ccall "HROOTHistTGraph.h TGraph_tGraphGetFunction" c_tgraph_tgraphgetfunction 
+  :: (Ptr RawTGraph) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTGraph.h TGraph_tGraphGetHistogram" c_tgraph_tgraphgethistogram 
+  :: (Ptr RawTGraph) -> IO (Ptr RawTH1F)
+
+foreign import ccall "HROOTHistTGraph.h TGraph_getCorrelationFactorTGraph" c_tgraph_getcorrelationfactortgraph 
+  :: (Ptr RawTGraph) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraph.h TGraph_getCovarianceTGraph" c_tgraph_getcovariancetgraph 
+  :: (Ptr RawTGraph) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraph.h TGraph_getMeanTGraph" c_tgraph_getmeantgraph 
+  :: (Ptr RawTGraph) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraph.h TGraph_getRMSTGraph" c_tgraph_getrmstgraph 
+  :: (Ptr RawTGraph) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraph.h TGraph_tGraphGetMaxSize" c_tgraph_tgraphgetmaxsize 
+  :: (Ptr RawTGraph) -> IO CInt
+
+foreign import ccall "HROOTHistTGraph.h TGraph_tGraphGetN" c_tgraph_tgraphgetn 
+  :: (Ptr RawTGraph) -> IO CInt
+
+foreign import ccall "HROOTHistTGraph.h TGraph_GetErrorX" c_tgraph_geterrorx 
+  :: (Ptr RawTGraph) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraph.h TGraph_GetErrorY" c_tgraph_geterrory 
+  :: (Ptr RawTGraph) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraph.h TGraph_GetErrorXhigh" c_tgraph_geterrorxhigh 
+  :: (Ptr RawTGraph) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraph.h TGraph_GetErrorXlow" c_tgraph_geterrorxlow 
+  :: (Ptr RawTGraph) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraph.h TGraph_GetErrorYhigh" c_tgraph_geterroryhigh 
+  :: (Ptr RawTGraph) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraph.h TGraph_GetErrorYlow" c_tgraph_geterrorylow 
+  :: (Ptr RawTGraph) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraph.h TGraph_tGraphGetMaximum" c_tgraph_tgraphgetmaximum 
+  :: (Ptr RawTGraph) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraph.h TGraph_tGraphGetMinimum" c_tgraph_tgraphgetminimum 
+  :: (Ptr RawTGraph) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraph.h TGraph_tGraphGetXaxis" c_tgraph_tgraphgetxaxis 
+  :: (Ptr RawTGraph) -> IO (Ptr RawTAxis)
+
+foreign import ccall "HROOTHistTGraph.h TGraph_tGraphGetYaxis" c_tgraph_tgraphgetyaxis 
+  :: (Ptr RawTGraph) -> IO (Ptr RawTAxis)
+
+foreign import ccall "HROOTHistTGraph.h TGraph_InitExpo" c_tgraph_initexpo 
+  :: (Ptr RawTGraph) -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_InitGaus" c_tgraph_initgaus 
+  :: (Ptr RawTGraph) -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_InitPolynom" c_tgraph_initpolynom 
+  :: (Ptr RawTGraph) -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_InsertPoint" c_tgraph_insertpoint 
+  :: (Ptr RawTGraph) -> IO CInt
+
+foreign import ccall "HROOTHistTGraph.h TGraph_integralTGraph" c_tgraph_integraltgraph 
+  :: (Ptr RawTGraph) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraph.h TGraph_IsEditable" c_tgraph_iseditable 
+  :: (Ptr RawTGraph) -> IO CInt
+
+foreign import ccall "HROOTHistTGraph.h TGraph_isInsideTGraph" c_tgraph_isinsidetgraph 
+  :: (Ptr RawTGraph) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTGraph.h TGraph_LeastSquareFit" c_tgraph_leastsquarefit 
+  :: (Ptr RawTGraph) -> CInt -> (Ptr CDouble) -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_tGraphPaintGraph" c_tgraph_tgraphpaintgraph 
+  :: (Ptr RawTGraph) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_tGraphPaintGrapHist" c_tgraph_tgraphpaintgraphist 
+  :: (Ptr RawTGraph) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_PaintStats" c_tgraph_paintstats 
+  :: (Ptr RawTGraph) -> (Ptr RawTF1) -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_RemovePoint" c_tgraph_removepoint 
+  :: (Ptr RawTGraph) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTGraph.h TGraph_SetEditable" c_tgraph_seteditable 
+  :: (Ptr RawTGraph) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_SetHistogram" c_tgraph_sethistogram 
+  :: (Ptr RawTGraph) -> (Ptr RawTH1F) -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_setMaximumTGraph" c_tgraph_setmaximumtgraph 
+  :: (Ptr RawTGraph) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_setMinimumTGraph" c_tgraph_setminimumtgraph 
+  :: (Ptr RawTGraph) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_Set" c_tgraph_set 
+  :: (Ptr RawTGraph) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraph.h TGraph_SetPoint" c_tgraph_setpoint 
+  :: (Ptr RawTGraph) -> CInt -> CDouble -> CDouble -> IO ()
+
diff --git a/src/HROOT/Hist/TGraph/Implementation.hs b/src/HROOT/Hist/TGraph/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraph/Implementation.hs
@@ -0,0 +1,235 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TGraph.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TGraph.RawType
+import HROOT.Hist.TGraph.FFI
+import HROOT.Hist.TGraph.Interface
+import HROOT.Hist.TGraph.Cast
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Hist.TH1F.RawType
+import HROOT.Hist.TH1F.Cast
+import HROOT.Hist.TH1F.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TNamed.RawType
+import HROOT.Core.TNamed.Cast
+import HROOT.Core.TNamed.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITGraph TGraph where
+  apply = xform1 c_tgraph_apply
+  chisquare = xform1 c_tgraph_chisquare
+  drawGraph = xform4 c_tgraph_drawgraph
+  drawPanelTGraph = xform0 c_tgraph_drawpaneltgraph
+  expand = xform2 c_tgraph_expand
+  fitPanelTGraph = xform0 c_tgraph_fitpaneltgraph
+  getCorrelationFactorTGraph = xform0 c_tgraph_getcorrelationfactortgraph
+  getCovarianceTGraph = xform0 c_tgraph_getcovariancetgraph
+  getMeanTGraph = xform1 c_tgraph_getmeantgraph
+  getRMSTGraph = xform1 c_tgraph_getrmstgraph
+  getErrorX = xform1 c_tgraph_geterrorx
+  getErrorY = xform1 c_tgraph_geterrory
+  getErrorXhigh = xform1 c_tgraph_geterrorxhigh
+  getErrorXlow = xform1 c_tgraph_geterrorxlow
+  getErrorYhigh = xform1 c_tgraph_geterroryhigh
+  getErrorYlow = xform1 c_tgraph_geterrorylow
+  initExpo = xform2 c_tgraph_initexpo
+  initGaus = xform2 c_tgraph_initgaus
+  initPolynom = xform2 c_tgraph_initpolynom
+  insertPoint = xform0 c_tgraph_insertpoint
+  integralTGraph = xform2 c_tgraph_integraltgraph
+  isEditable = xform0 c_tgraph_iseditable
+  isInsideTGraph = xform2 c_tgraph_isinsidetgraph
+  leastSquareFit = xform4 c_tgraph_leastsquarefit
+  paintStats = xform1 c_tgraph_paintstats
+  removePoint = xform1 c_tgraph_removepoint
+  setEditable = xform1 c_tgraph_seteditable
+  setHistogram = xform1 c_tgraph_sethistogram
+  setMaximumTGraph = xform1 c_tgraph_setmaximumtgraph
+  setMinimumTGraph = xform1 c_tgraph_setminimumtgraph
+  set = xform1 c_tgraph_set
+  setPoint = xform3 c_tgraph_setpoint
+instance ITNamed TGraph where
+  setName = xform1 c_tgraph_setname
+  setNameTitle = xform2 c_tgraph_setnametitle
+  setTitle = xform1 c_tgraph_settitle
+instance ITAttLine TGraph where
+  getLineColor = xform0 c_tgraph_getlinecolor
+  getLineStyle = xform0 c_tgraph_getlinestyle
+  getLineWidth = xform0 c_tgraph_getlinewidth
+  resetAttLine = xform1 c_tgraph_resetattline
+  setLineAttributes = xform0 c_tgraph_setlineattributes
+  setLineColor = xform1 c_tgraph_setlinecolor
+  setLineStyle = xform1 c_tgraph_setlinestyle
+  setLineWidth = xform1 c_tgraph_setlinewidth
+instance ITAttFill TGraph where
+  setFillColor = xform1 c_tgraph_setfillcolor
+  setFillStyle = xform1 c_tgraph_setfillstyle
+instance ITAttMarker TGraph where
+  getMarkerColor = xform0 c_tgraph_getmarkercolor
+  getMarkerStyle = xform0 c_tgraph_getmarkerstyle
+  getMarkerSize = xform0 c_tgraph_getmarkersize
+  resetAttMarker = xform1 c_tgraph_resetattmarker
+  setMarkerAttributes = xform0 c_tgraph_setmarkerattributes
+  setMarkerColor = xform1 c_tgraph_setmarkercolor
+  setMarkerStyle = xform1 c_tgraph_setmarkerstyle
+  setMarkerSize = xform1 c_tgraph_setmarkersize
+instance ITObject TGraph where
+  draw = xform1 c_tgraph_draw
+  findObject = xform1 c_tgraph_findobject
+  getName = xform0 c_tgraph_getname
+  isA = xform0 c_tgraph_isa
+  paint = xform1 c_tgraph_paint
+  printObj = xform1 c_tgraph_printobj
+  saveAs = xform2 c_tgraph_saveas
+  write = xform3 c_tgraph_write
+instance IDeletable TGraph where
+  delete = xform0 c_tgraph_delete
+
+instance ITGraph (Exist TGraph) where
+  apply (ETGraph x) = apply x
+  chisquare (ETGraph x) = chisquare x
+  drawGraph (ETGraph x) = drawGraph x
+  drawPanelTGraph (ETGraph x) = drawPanelTGraph x
+  expand (ETGraph x) = expand x
+  fitPanelTGraph (ETGraph x) = fitPanelTGraph x
+  getCorrelationFactorTGraph (ETGraph x) = getCorrelationFactorTGraph x
+  getCovarianceTGraph (ETGraph x) = getCovarianceTGraph x
+  getMeanTGraph (ETGraph x) = getMeanTGraph x
+  getRMSTGraph (ETGraph x) = getRMSTGraph x
+  getErrorX (ETGraph x) = getErrorX x
+  getErrorY (ETGraph x) = getErrorY x
+  getErrorXhigh (ETGraph x) = getErrorXhigh x
+  getErrorXlow (ETGraph x) = getErrorXlow x
+  getErrorYhigh (ETGraph x) = getErrorYhigh x
+  getErrorYlow (ETGraph x) = getErrorYlow x
+  initExpo (ETGraph x) = initExpo x
+  initGaus (ETGraph x) = initGaus x
+  initPolynom (ETGraph x) = initPolynom x
+  insertPoint (ETGraph x) = insertPoint x
+  integralTGraph (ETGraph x) = integralTGraph x
+  isEditable (ETGraph x) = isEditable x
+  isInsideTGraph (ETGraph x) = isInsideTGraph x
+  leastSquareFit (ETGraph x) = leastSquareFit x
+  paintStats (ETGraph x) = paintStats x
+  removePoint (ETGraph x) = removePoint x
+  setEditable (ETGraph x) = setEditable x
+  setHistogram (ETGraph x) = setHistogram x
+  setMaximumTGraph (ETGraph x) = setMaximumTGraph x
+  setMinimumTGraph (ETGraph x) = setMinimumTGraph x
+  set (ETGraph x) = set x
+  setPoint (ETGraph x) = setPoint x
+instance ITNamed (Exist TGraph) where
+  setName (ETGraph x) = setName x
+  setNameTitle (ETGraph x) = setNameTitle x
+  setTitle (ETGraph x) = setTitle x
+instance ITAttLine (Exist TGraph) where
+  getLineColor (ETGraph x) = getLineColor x
+  getLineStyle (ETGraph x) = getLineStyle x
+  getLineWidth (ETGraph x) = getLineWidth x
+  resetAttLine (ETGraph x) = resetAttLine x
+  setLineAttributes (ETGraph x) = setLineAttributes x
+  setLineColor (ETGraph x) = setLineColor x
+  setLineStyle (ETGraph x) = setLineStyle x
+  setLineWidth (ETGraph x) = setLineWidth x
+instance ITAttFill (Exist TGraph) where
+  setFillColor (ETGraph x) = setFillColor x
+  setFillStyle (ETGraph x) = setFillStyle x
+instance ITAttMarker (Exist TGraph) where
+  getMarkerColor (ETGraph x) = getMarkerColor x
+  getMarkerStyle (ETGraph x) = getMarkerStyle x
+  getMarkerSize (ETGraph x) = getMarkerSize x
+  resetAttMarker (ETGraph x) = resetAttMarker x
+  setMarkerAttributes (ETGraph x) = setMarkerAttributes x
+  setMarkerColor (ETGraph x) = setMarkerColor x
+  setMarkerStyle (ETGraph x) = setMarkerStyle x
+  setMarkerSize (ETGraph x) = setMarkerSize x
+instance ITObject (Exist TGraph) where
+  draw (ETGraph x) = draw x
+  findObject (ETGraph x) = findObject x
+  getName (ETGraph x) = getName x
+  isA (ETGraph x) = isA x
+  paint (ETGraph x) = paint x
+  printObj (ETGraph x) = printObj x
+  saveAs (ETGraph x) = saveAs x
+  write (ETGraph x) = write x
+instance IDeletable (Exist TGraph) where
+  delete (ETGraph x) = delete x
+
+
+newTGraph :: CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO TGraph
+newTGraph = xform2 c_tgraph_newtgraph
+
+tGraphGetEditable :: TGraph -> IO CInt
+tGraphGetEditable = xform0 c_tgraph_tgraphgeteditable
+
+tGraphGetFunction :: TGraph -> CString -> IO TF1
+tGraphGetFunction = xform1 c_tgraph_tgraphgetfunction
+
+tGraphGetHistogram :: TGraph -> IO TH1F
+tGraphGetHistogram = xform0 c_tgraph_tgraphgethistogram
+
+tGraphGetMaxSize :: TGraph -> IO CInt
+tGraphGetMaxSize = xform0 c_tgraph_tgraphgetmaxsize
+
+tGraphGetN :: TGraph -> IO CInt
+tGraphGetN = xform0 c_tgraph_tgraphgetn
+
+tGraphGetMaximum :: TGraph -> IO CDouble
+tGraphGetMaximum = xform0 c_tgraph_tgraphgetmaximum
+
+tGraphGetMinimum :: TGraph -> IO CDouble
+tGraphGetMinimum = xform0 c_tgraph_tgraphgetminimum
+
+tGraphGetXaxis :: TGraph -> IO TAxis
+tGraphGetXaxis = xform0 c_tgraph_tgraphgetxaxis
+
+tGraphGetYaxis :: TGraph -> IO TAxis
+tGraphGetYaxis = xform0 c_tgraph_tgraphgetyaxis
+
+tGraphPaintGraph :: TGraph -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CString -> IO ()
+tGraphPaintGraph = xform4 c_tgraph_tgraphpaintgraph
+
+tGraphPaintGrapHist :: TGraph -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CString -> IO ()
+tGraphPaintGrapHist = xform4 c_tgraph_tgraphpaintgraphist
+
+
+
+instance FPtr (Exist TGraph) where
+  type Raw (Exist TGraph) = RawTGraph
+  get_fptr (ETGraph obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETGraph (cast_fptr_to_obj (fptr :: ForeignPtr RawTGraph) :: TGraph)
diff --git a/src/HROOT/Hist/TGraph/Interface.hs b/src/HROOT/Hist/TGraph/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraph/Interface.hs
@@ -0,0 +1,106 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TGraph.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TGraph.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TH1F.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TNamed.Interface
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.Interface
+---- ============ ----
+import {-# SOURCE #-} HROOT.Hist.TF1.Interface
+import {-# SOURCE #-} HROOT.Hist.TH1F.Interface
+
+
+class (ITNamed a,ITAttLine a,ITAttFill a,ITAttMarker a) => ITGraph a where
+
+    apply :: (ITF1 c0, FPtr c0) => a -> c0 -> IO () 
+
+    chisquare :: (ITF1 c0, FPtr c0) => a -> c0 -> IO CDouble 
+
+    drawGraph :: a -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CString -> IO () 
+
+    drawPanelTGraph :: a -> IO () 
+
+    expand :: a -> CInt -> CInt -> IO () 
+
+    fitPanelTGraph :: a -> IO () 
+
+    getCorrelationFactorTGraph :: a -> IO CDouble 
+
+    getCovarianceTGraph :: a -> IO CDouble 
+
+    getMeanTGraph :: a -> CInt -> IO CDouble 
+
+    getRMSTGraph :: a -> CInt -> IO CDouble 
+
+    getErrorX :: a -> CInt -> IO CDouble 
+
+    getErrorY :: a -> CInt -> IO CDouble 
+
+    getErrorXhigh :: a -> CInt -> IO CDouble 
+
+    getErrorXlow :: a -> CInt -> IO CDouble 
+
+    getErrorYhigh :: a -> CInt -> IO CDouble 
+
+    getErrorYlow :: a -> CInt -> IO CDouble 
+
+    initExpo :: a -> CDouble -> CDouble -> IO () 
+
+    initGaus :: a -> CDouble -> CDouble -> IO () 
+
+    initPolynom :: a -> CDouble -> CDouble -> IO () 
+
+    insertPoint :: a -> IO CInt 
+
+    integralTGraph :: a -> CInt -> CInt -> IO CDouble 
+
+    isEditable :: a -> IO CInt 
+
+    isInsideTGraph :: a -> CDouble -> CDouble -> IO CInt 
+
+    leastSquareFit :: a -> CInt -> (Ptr CDouble) -> CDouble -> CDouble -> IO () 
+
+    paintStats :: (ITF1 c0, FPtr c0) => a -> c0 -> IO () 
+
+    removePoint :: a -> CInt -> IO CInt 
+
+    setEditable :: a -> CInt -> IO () 
+
+    setHistogram :: (ITH1F c0, FPtr c0) => a -> c0 -> IO () 
+
+    setMaximumTGraph :: a -> CDouble -> IO () 
+
+    setMinimumTGraph :: a -> CDouble -> IO () 
+
+    set :: a -> CInt -> IO () 
+
+    setPoint :: a -> CInt -> CDouble -> CDouble -> IO () 
+
+instance Existable TGraph where
+  data Exist TGraph = forall a. (FPtr a, ITGraph a) => ETGraph a
+
+upcastTGraph :: (FPtr a, ITGraph a) => a -> TGraph
+upcastTGraph h = let fh = get_fptr h
+                     fh2 :: ForeignPtr RawTGraph = castForeignPtr fh
+                 in cast_fptr_to_obj fh2
+
+downcastTGraph :: (FPtr a, ITGraph a) => TGraph -> a 
+downcastTGraph h = let fh = get_fptr h
+                       fh2 = castForeignPtr fh
+                   in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TGraph/RawType.hs b/src/HROOT/Hist/TGraph/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraph/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TGraph.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTGraph
+newtype TGraph = TGraph (ForeignPtr RawTGraph) deriving (Eq, Ord, Show)
+instance FPtr TGraph where
+   type Raw TGraph = RawTGraph
+   get_fptr (TGraph fptr) = fptr
+   cast_fptr_to_obj = TGraph
diff --git a/src/HROOT/Hist/TGraphAsymmErrors.hs b/src/HROOT/Hist/TGraphAsymmErrors.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphAsymmErrors.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TGraphAsymmErrors
+  (
+    TGraphAsymmErrors(..)
+  , ITGraphAsymmErrors
+  , upcastTGraphAsymmErrors
+  , downcastTGraphAsymmErrors
+  , newTGraphAsymmErrors
+ 
+  ) where
+
+import HROOT.Hist.TGraphAsymmErrors.RawType
+import HROOT.Hist.TGraphAsymmErrors.Interface
+import HROOT.Hist.TGraphAsymmErrors.Implementation
+
+
diff --git a/src/HROOT/Hist/TGraphAsymmErrors/Cast.hs b/src/HROOT/Hist/TGraphAsymmErrors/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphAsymmErrors/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TGraphAsymmErrors.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TGraphAsymmErrors.RawType
+import HROOT.Hist.TGraphAsymmErrors.Interface
+
+instance (ITGraphAsymmErrors a, FPtr a) => Castable a (Ptr RawTGraphAsymmErrors) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TGraphAsymmErrors (Ptr RawTGraphAsymmErrors) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TGraphAsymmErrors/FFI.hsc b/src/HROOT/Hist/TGraphAsymmErrors/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphAsymmErrors/FFI.hsc
@@ -0,0 +1,212 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TGraphAsymmErrors.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TGraphAsymmErrors.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TH1F.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTGraphAsymmErrors.h"
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_Apply" c_tgraphasymmerrors_apply 
+  :: (Ptr RawTGraphAsymmErrors) -> (Ptr RawTF1) -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_Chisquare" c_tgraphasymmerrors_chisquare 
+  :: (Ptr RawTGraphAsymmErrors) -> (Ptr RawTF1) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_DrawGraph" c_tgraphasymmerrors_drawgraph 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_drawPanelTGraph" c_tgraphasymmerrors_drawpaneltgraph 
+  :: (Ptr RawTGraphAsymmErrors) -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_Expand" c_tgraphasymmerrors_expand 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_FitPanelTGraph" c_tgraphasymmerrors_fitpaneltgraph 
+  :: (Ptr RawTGraphAsymmErrors) -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_getCorrelationFactorTGraph" c_tgraphasymmerrors_getcorrelationfactortgraph 
+  :: (Ptr RawTGraphAsymmErrors) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_getCovarianceTGraph" c_tgraphasymmerrors_getcovariancetgraph 
+  :: (Ptr RawTGraphAsymmErrors) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_getMeanTGraph" c_tgraphasymmerrors_getmeantgraph 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_getRMSTGraph" c_tgraphasymmerrors_getrmstgraph 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_GetErrorX" c_tgraphasymmerrors_geterrorx 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_GetErrorY" c_tgraphasymmerrors_geterrory 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_GetErrorXhigh" c_tgraphasymmerrors_geterrorxhigh 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_GetErrorXlow" c_tgraphasymmerrors_geterrorxlow 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_GetErrorYhigh" c_tgraphasymmerrors_geterroryhigh 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_GetErrorYlow" c_tgraphasymmerrors_geterrorylow 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_InitExpo" c_tgraphasymmerrors_initexpo 
+  :: (Ptr RawTGraphAsymmErrors) -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_InitGaus" c_tgraphasymmerrors_initgaus 
+  :: (Ptr RawTGraphAsymmErrors) -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_InitPolynom" c_tgraphasymmerrors_initpolynom 
+  :: (Ptr RawTGraphAsymmErrors) -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_InsertPoint" c_tgraphasymmerrors_insertpoint 
+  :: (Ptr RawTGraphAsymmErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_integralTGraph" c_tgraphasymmerrors_integraltgraph 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_IsEditable" c_tgraphasymmerrors_iseditable 
+  :: (Ptr RawTGraphAsymmErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_isInsideTGraph" c_tgraphasymmerrors_isinsidetgraph 
+  :: (Ptr RawTGraphAsymmErrors) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_LeastSquareFit" c_tgraphasymmerrors_leastsquarefit 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> (Ptr CDouble) -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_PaintStats" c_tgraphasymmerrors_paintstats 
+  :: (Ptr RawTGraphAsymmErrors) -> (Ptr RawTF1) -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_RemovePoint" c_tgraphasymmerrors_removepoint 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_SetEditable" c_tgraphasymmerrors_seteditable 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_SetHistogram" c_tgraphasymmerrors_sethistogram 
+  :: (Ptr RawTGraphAsymmErrors) -> (Ptr RawTH1F) -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_setMaximumTGraph" c_tgraphasymmerrors_setmaximumtgraph 
+  :: (Ptr RawTGraphAsymmErrors) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_setMinimumTGraph" c_tgraphasymmerrors_setminimumtgraph 
+  :: (Ptr RawTGraphAsymmErrors) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_Set" c_tgraphasymmerrors_set 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_SetPoint" c_tgraphasymmerrors_setpoint 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_SetName" c_tgraphasymmerrors_setname 
+  :: (Ptr RawTGraphAsymmErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_SetNameTitle" c_tgraphasymmerrors_setnametitle 
+  :: (Ptr RawTGraphAsymmErrors) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_SetTitle" c_tgraphasymmerrors_settitle 
+  :: (Ptr RawTGraphAsymmErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_GetLineColor" c_tgraphasymmerrors_getlinecolor 
+  :: (Ptr RawTGraphAsymmErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_GetLineStyle" c_tgraphasymmerrors_getlinestyle 
+  :: (Ptr RawTGraphAsymmErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_GetLineWidth" c_tgraphasymmerrors_getlinewidth 
+  :: (Ptr RawTGraphAsymmErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_ResetAttLine" c_tgraphasymmerrors_resetattline 
+  :: (Ptr RawTGraphAsymmErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_SetLineAttributes" c_tgraphasymmerrors_setlineattributes 
+  :: (Ptr RawTGraphAsymmErrors) -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_SetLineColor" c_tgraphasymmerrors_setlinecolor 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_SetLineStyle" c_tgraphasymmerrors_setlinestyle 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_SetLineWidth" c_tgraphasymmerrors_setlinewidth 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_SetFillColor" c_tgraphasymmerrors_setfillcolor 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_SetFillStyle" c_tgraphasymmerrors_setfillstyle 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_GetMarkerColor" c_tgraphasymmerrors_getmarkercolor 
+  :: (Ptr RawTGraphAsymmErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_GetMarkerStyle" c_tgraphasymmerrors_getmarkerstyle 
+  :: (Ptr RawTGraphAsymmErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_GetMarkerSize" c_tgraphasymmerrors_getmarkersize 
+  :: (Ptr RawTGraphAsymmErrors) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_ResetAttMarker" c_tgraphasymmerrors_resetattmarker 
+  :: (Ptr RawTGraphAsymmErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_SetMarkerAttributes" c_tgraphasymmerrors_setmarkerattributes 
+  :: (Ptr RawTGraphAsymmErrors) -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_SetMarkerColor" c_tgraphasymmerrors_setmarkercolor 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_SetMarkerStyle" c_tgraphasymmerrors_setmarkerstyle 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_SetMarkerSize" c_tgraphasymmerrors_setmarkersize 
+  :: (Ptr RawTGraphAsymmErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_Draw" c_tgraphasymmerrors_draw 
+  :: (Ptr RawTGraphAsymmErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_FindObject" c_tgraphasymmerrors_findobject 
+  :: (Ptr RawTGraphAsymmErrors) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_GetName" c_tgraphasymmerrors_getname 
+  :: (Ptr RawTGraphAsymmErrors) -> IO CString
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_IsA" c_tgraphasymmerrors_isa 
+  :: (Ptr RawTGraphAsymmErrors) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_Paint" c_tgraphasymmerrors_paint 
+  :: (Ptr RawTGraphAsymmErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_printObj" c_tgraphasymmerrors_printobj 
+  :: (Ptr RawTGraphAsymmErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_SaveAs" c_tgraphasymmerrors_saveas 
+  :: (Ptr RawTGraphAsymmErrors) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_Write" c_tgraphasymmerrors_write 
+  :: (Ptr RawTGraphAsymmErrors) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_delete" c_tgraphasymmerrors_delete 
+  :: (Ptr RawTGraphAsymmErrors) -> IO ()
+
+foreign import ccall "HROOTHistTGraphAsymmErrors.h TGraphAsymmErrors_newTGraphAsymmErrors" c_tgraphasymmerrors_newtgraphasymmerrors 
+  :: CInt -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> IO (Ptr RawTGraphAsymmErrors)
+
diff --git a/src/HROOT/Hist/TGraphAsymmErrors/Implementation.hs b/src/HROOT/Hist/TGraphAsymmErrors/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphAsymmErrors/Implementation.hs
@@ -0,0 +1,210 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TGraphAsymmErrors.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TGraphAsymmErrors.RawType
+import HROOT.Hist.TGraphAsymmErrors.FFI
+import HROOT.Hist.TGraphAsymmErrors.Interface
+import HROOT.Hist.TGraphAsymmErrors.Cast
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Hist.TH1F.RawType
+import HROOT.Hist.TH1F.Cast
+import HROOT.Hist.TH1F.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TGraph.RawType
+import HROOT.Hist.TGraph.Cast
+import HROOT.Hist.TGraph.Interface
+import HROOT.Core.TNamed.RawType
+import HROOT.Core.TNamed.Cast
+import HROOT.Core.TNamed.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITGraphAsymmErrors TGraphAsymmErrors where
+instance ITGraph TGraphAsymmErrors where
+  apply = xform1 c_tgraphasymmerrors_apply
+  chisquare = xform1 c_tgraphasymmerrors_chisquare
+  drawGraph = xform4 c_tgraphasymmerrors_drawgraph
+  drawPanelTGraph = xform0 c_tgraphasymmerrors_drawpaneltgraph
+  expand = xform2 c_tgraphasymmerrors_expand
+  fitPanelTGraph = xform0 c_tgraphasymmerrors_fitpaneltgraph
+  getCorrelationFactorTGraph = xform0 c_tgraphasymmerrors_getcorrelationfactortgraph
+  getCovarianceTGraph = xform0 c_tgraphasymmerrors_getcovariancetgraph
+  getMeanTGraph = xform1 c_tgraphasymmerrors_getmeantgraph
+  getRMSTGraph = xform1 c_tgraphasymmerrors_getrmstgraph
+  getErrorX = xform1 c_tgraphasymmerrors_geterrorx
+  getErrorY = xform1 c_tgraphasymmerrors_geterrory
+  getErrorXhigh = xform1 c_tgraphasymmerrors_geterrorxhigh
+  getErrorXlow = xform1 c_tgraphasymmerrors_geterrorxlow
+  getErrorYhigh = xform1 c_tgraphasymmerrors_geterroryhigh
+  getErrorYlow = xform1 c_tgraphasymmerrors_geterrorylow
+  initExpo = xform2 c_tgraphasymmerrors_initexpo
+  initGaus = xform2 c_tgraphasymmerrors_initgaus
+  initPolynom = xform2 c_tgraphasymmerrors_initpolynom
+  insertPoint = xform0 c_tgraphasymmerrors_insertpoint
+  integralTGraph = xform2 c_tgraphasymmerrors_integraltgraph
+  isEditable = xform0 c_tgraphasymmerrors_iseditable
+  isInsideTGraph = xform2 c_tgraphasymmerrors_isinsidetgraph
+  leastSquareFit = xform4 c_tgraphasymmerrors_leastsquarefit
+  paintStats = xform1 c_tgraphasymmerrors_paintstats
+  removePoint = xform1 c_tgraphasymmerrors_removepoint
+  setEditable = xform1 c_tgraphasymmerrors_seteditable
+  setHistogram = xform1 c_tgraphasymmerrors_sethistogram
+  setMaximumTGraph = xform1 c_tgraphasymmerrors_setmaximumtgraph
+  setMinimumTGraph = xform1 c_tgraphasymmerrors_setminimumtgraph
+  set = xform1 c_tgraphasymmerrors_set
+  setPoint = xform3 c_tgraphasymmerrors_setpoint
+instance ITNamed TGraphAsymmErrors where
+  setName = xform1 c_tgraphasymmerrors_setname
+  setNameTitle = xform2 c_tgraphasymmerrors_setnametitle
+  setTitle = xform1 c_tgraphasymmerrors_settitle
+instance ITAttLine TGraphAsymmErrors where
+  getLineColor = xform0 c_tgraphasymmerrors_getlinecolor
+  getLineStyle = xform0 c_tgraphasymmerrors_getlinestyle
+  getLineWidth = xform0 c_tgraphasymmerrors_getlinewidth
+  resetAttLine = xform1 c_tgraphasymmerrors_resetattline
+  setLineAttributes = xform0 c_tgraphasymmerrors_setlineattributes
+  setLineColor = xform1 c_tgraphasymmerrors_setlinecolor
+  setLineStyle = xform1 c_tgraphasymmerrors_setlinestyle
+  setLineWidth = xform1 c_tgraphasymmerrors_setlinewidth
+instance ITAttFill TGraphAsymmErrors where
+  setFillColor = xform1 c_tgraphasymmerrors_setfillcolor
+  setFillStyle = xform1 c_tgraphasymmerrors_setfillstyle
+instance ITAttMarker TGraphAsymmErrors where
+  getMarkerColor = xform0 c_tgraphasymmerrors_getmarkercolor
+  getMarkerStyle = xform0 c_tgraphasymmerrors_getmarkerstyle
+  getMarkerSize = xform0 c_tgraphasymmerrors_getmarkersize
+  resetAttMarker = xform1 c_tgraphasymmerrors_resetattmarker
+  setMarkerAttributes = xform0 c_tgraphasymmerrors_setmarkerattributes
+  setMarkerColor = xform1 c_tgraphasymmerrors_setmarkercolor
+  setMarkerStyle = xform1 c_tgraphasymmerrors_setmarkerstyle
+  setMarkerSize = xform1 c_tgraphasymmerrors_setmarkersize
+instance ITObject TGraphAsymmErrors where
+  draw = xform1 c_tgraphasymmerrors_draw
+  findObject = xform1 c_tgraphasymmerrors_findobject
+  getName = xform0 c_tgraphasymmerrors_getname
+  isA = xform0 c_tgraphasymmerrors_isa
+  paint = xform1 c_tgraphasymmerrors_paint
+  printObj = xform1 c_tgraphasymmerrors_printobj
+  saveAs = xform2 c_tgraphasymmerrors_saveas
+  write = xform3 c_tgraphasymmerrors_write
+instance IDeletable TGraphAsymmErrors where
+  delete = xform0 c_tgraphasymmerrors_delete
+
+instance ITGraphAsymmErrors (Exist TGraphAsymmErrors) where
+
+instance ITGraph (Exist TGraphAsymmErrors) where
+  apply (ETGraphAsymmErrors x) = apply x
+  chisquare (ETGraphAsymmErrors x) = chisquare x
+  drawGraph (ETGraphAsymmErrors x) = drawGraph x
+  drawPanelTGraph (ETGraphAsymmErrors x) = drawPanelTGraph x
+  expand (ETGraphAsymmErrors x) = expand x
+  fitPanelTGraph (ETGraphAsymmErrors x) = fitPanelTGraph x
+  getCorrelationFactorTGraph (ETGraphAsymmErrors x) = getCorrelationFactorTGraph x
+  getCovarianceTGraph (ETGraphAsymmErrors x) = getCovarianceTGraph x
+  getMeanTGraph (ETGraphAsymmErrors x) = getMeanTGraph x
+  getRMSTGraph (ETGraphAsymmErrors x) = getRMSTGraph x
+  getErrorX (ETGraphAsymmErrors x) = getErrorX x
+  getErrorY (ETGraphAsymmErrors x) = getErrorY x
+  getErrorXhigh (ETGraphAsymmErrors x) = getErrorXhigh x
+  getErrorXlow (ETGraphAsymmErrors x) = getErrorXlow x
+  getErrorYhigh (ETGraphAsymmErrors x) = getErrorYhigh x
+  getErrorYlow (ETGraphAsymmErrors x) = getErrorYlow x
+  initExpo (ETGraphAsymmErrors x) = initExpo x
+  initGaus (ETGraphAsymmErrors x) = initGaus x
+  initPolynom (ETGraphAsymmErrors x) = initPolynom x
+  insertPoint (ETGraphAsymmErrors x) = insertPoint x
+  integralTGraph (ETGraphAsymmErrors x) = integralTGraph x
+  isEditable (ETGraphAsymmErrors x) = isEditable x
+  isInsideTGraph (ETGraphAsymmErrors x) = isInsideTGraph x
+  leastSquareFit (ETGraphAsymmErrors x) = leastSquareFit x
+  paintStats (ETGraphAsymmErrors x) = paintStats x
+  removePoint (ETGraphAsymmErrors x) = removePoint x
+  setEditable (ETGraphAsymmErrors x) = setEditable x
+  setHistogram (ETGraphAsymmErrors x) = setHistogram x
+  setMaximumTGraph (ETGraphAsymmErrors x) = setMaximumTGraph x
+  setMinimumTGraph (ETGraphAsymmErrors x) = setMinimumTGraph x
+  set (ETGraphAsymmErrors x) = set x
+  setPoint (ETGraphAsymmErrors x) = setPoint x
+instance ITNamed (Exist TGraphAsymmErrors) where
+  setName (ETGraphAsymmErrors x) = setName x
+  setNameTitle (ETGraphAsymmErrors x) = setNameTitle x
+  setTitle (ETGraphAsymmErrors x) = setTitle x
+instance ITAttLine (Exist TGraphAsymmErrors) where
+  getLineColor (ETGraphAsymmErrors x) = getLineColor x
+  getLineStyle (ETGraphAsymmErrors x) = getLineStyle x
+  getLineWidth (ETGraphAsymmErrors x) = getLineWidth x
+  resetAttLine (ETGraphAsymmErrors x) = resetAttLine x
+  setLineAttributes (ETGraphAsymmErrors x) = setLineAttributes x
+  setLineColor (ETGraphAsymmErrors x) = setLineColor x
+  setLineStyle (ETGraphAsymmErrors x) = setLineStyle x
+  setLineWidth (ETGraphAsymmErrors x) = setLineWidth x
+instance ITAttFill (Exist TGraphAsymmErrors) where
+  setFillColor (ETGraphAsymmErrors x) = setFillColor x
+  setFillStyle (ETGraphAsymmErrors x) = setFillStyle x
+instance ITAttMarker (Exist TGraphAsymmErrors) where
+  getMarkerColor (ETGraphAsymmErrors x) = getMarkerColor x
+  getMarkerStyle (ETGraphAsymmErrors x) = getMarkerStyle x
+  getMarkerSize (ETGraphAsymmErrors x) = getMarkerSize x
+  resetAttMarker (ETGraphAsymmErrors x) = resetAttMarker x
+  setMarkerAttributes (ETGraphAsymmErrors x) = setMarkerAttributes x
+  setMarkerColor (ETGraphAsymmErrors x) = setMarkerColor x
+  setMarkerStyle (ETGraphAsymmErrors x) = setMarkerStyle x
+  setMarkerSize (ETGraphAsymmErrors x) = setMarkerSize x
+instance ITObject (Exist TGraphAsymmErrors) where
+  draw (ETGraphAsymmErrors x) = draw x
+  findObject (ETGraphAsymmErrors x) = findObject x
+  getName (ETGraphAsymmErrors x) = getName x
+  isA (ETGraphAsymmErrors x) = isA x
+  paint (ETGraphAsymmErrors x) = paint x
+  printObj (ETGraphAsymmErrors x) = printObj x
+  saveAs (ETGraphAsymmErrors x) = saveAs x
+  write (ETGraphAsymmErrors x) = write x
+instance IDeletable (Exist TGraphAsymmErrors) where
+  delete (ETGraphAsymmErrors x) = delete x
+
+
+newTGraphAsymmErrors :: CInt -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> IO TGraphAsymmErrors
+newTGraphAsymmErrors = xform6 c_tgraphasymmerrors_newtgraphasymmerrors
+
+
+
+
+
+instance FPtr (Exist TGraphAsymmErrors) where
+  type Raw (Exist TGraphAsymmErrors) = RawTGraphAsymmErrors
+  get_fptr (ETGraphAsymmErrors obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETGraphAsymmErrors (cast_fptr_to_obj (fptr :: ForeignPtr RawTGraphAsymmErrors) :: TGraphAsymmErrors)
diff --git a/src/HROOT/Hist/TGraphAsymmErrors/Interface.hs b/src/HROOT/Hist/TGraphAsymmErrors/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphAsymmErrors/Interface.hs
@@ -0,0 +1,36 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TGraphAsymmErrors.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TGraphAsymmErrors.RawType
+
+import HROOT.Hist.TGraph.Interface
+---- ============ ----
+
+
+
+class (ITGraph a) => ITGraphAsymmErrors a where
+
+instance Existable TGraphAsymmErrors where
+  data Exist TGraphAsymmErrors = forall a. (FPtr a, ITGraphAsymmErrors a) => ETGraphAsymmErrors a
+
+upcastTGraphAsymmErrors :: (FPtr a, ITGraphAsymmErrors a) => a -> TGraphAsymmErrors
+upcastTGraphAsymmErrors h = let fh = get_fptr h
+                                fh2 :: ForeignPtr RawTGraphAsymmErrors = castForeignPtr fh
+                            in cast_fptr_to_obj fh2
+
+downcastTGraphAsymmErrors :: (FPtr a, ITGraphAsymmErrors a) => TGraphAsymmErrors -> a 
+downcastTGraphAsymmErrors h = let fh = get_fptr h
+                                  fh2 = castForeignPtr fh
+                              in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TGraphAsymmErrors/RawType.hs b/src/HROOT/Hist/TGraphAsymmErrors/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphAsymmErrors/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TGraphAsymmErrors.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTGraphAsymmErrors
+newtype TGraphAsymmErrors = TGraphAsymmErrors (ForeignPtr RawTGraphAsymmErrors) deriving (Eq, Ord, Show)
+instance FPtr TGraphAsymmErrors where
+   type Raw TGraphAsymmErrors = RawTGraphAsymmErrors
+   get_fptr (TGraphAsymmErrors fptr) = fptr
+   cast_fptr_to_obj = TGraphAsymmErrors
diff --git a/src/HROOT/Hist/TGraphBentErrors.hs b/src/HROOT/Hist/TGraphBentErrors.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphBentErrors.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TGraphBentErrors
+  (
+    TGraphBentErrors(..)
+  , ITGraphBentErrors
+  , upcastTGraphBentErrors
+  , downcastTGraphBentErrors
+  , newTGraphBentErrors
+ 
+  ) where
+
+import HROOT.Hist.TGraphBentErrors.RawType
+import HROOT.Hist.TGraphBentErrors.Interface
+import HROOT.Hist.TGraphBentErrors.Implementation
+
+
diff --git a/src/HROOT/Hist/TGraphBentErrors/Cast.hs b/src/HROOT/Hist/TGraphBentErrors/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphBentErrors/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TGraphBentErrors.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TGraphBentErrors.RawType
+import HROOT.Hist.TGraphBentErrors.Interface
+
+instance (ITGraphBentErrors a, FPtr a) => Castable a (Ptr RawTGraphBentErrors) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TGraphBentErrors (Ptr RawTGraphBentErrors) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TGraphBentErrors/FFI.hsc b/src/HROOT/Hist/TGraphBentErrors/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphBentErrors/FFI.hsc
@@ -0,0 +1,212 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TGraphBentErrors.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TGraphBentErrors.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TH1F.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTGraphBentErrors.h"
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_Apply" c_tgraphbenterrors_apply 
+  :: (Ptr RawTGraphBentErrors) -> (Ptr RawTF1) -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_Chisquare" c_tgraphbenterrors_chisquare 
+  :: (Ptr RawTGraphBentErrors) -> (Ptr RawTF1) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_DrawGraph" c_tgraphbenterrors_drawgraph 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_drawPanelTGraph" c_tgraphbenterrors_drawpaneltgraph 
+  :: (Ptr RawTGraphBentErrors) -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_Expand" c_tgraphbenterrors_expand 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_FitPanelTGraph" c_tgraphbenterrors_fitpaneltgraph 
+  :: (Ptr RawTGraphBentErrors) -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_getCorrelationFactorTGraph" c_tgraphbenterrors_getcorrelationfactortgraph 
+  :: (Ptr RawTGraphBentErrors) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_getCovarianceTGraph" c_tgraphbenterrors_getcovariancetgraph 
+  :: (Ptr RawTGraphBentErrors) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_getMeanTGraph" c_tgraphbenterrors_getmeantgraph 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_getRMSTGraph" c_tgraphbenterrors_getrmstgraph 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_GetErrorX" c_tgraphbenterrors_geterrorx 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_GetErrorY" c_tgraphbenterrors_geterrory 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_GetErrorXhigh" c_tgraphbenterrors_geterrorxhigh 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_GetErrorXlow" c_tgraphbenterrors_geterrorxlow 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_GetErrorYhigh" c_tgraphbenterrors_geterroryhigh 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_GetErrorYlow" c_tgraphbenterrors_geterrorylow 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_InitExpo" c_tgraphbenterrors_initexpo 
+  :: (Ptr RawTGraphBentErrors) -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_InitGaus" c_tgraphbenterrors_initgaus 
+  :: (Ptr RawTGraphBentErrors) -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_InitPolynom" c_tgraphbenterrors_initpolynom 
+  :: (Ptr RawTGraphBentErrors) -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_InsertPoint" c_tgraphbenterrors_insertpoint 
+  :: (Ptr RawTGraphBentErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_integralTGraph" c_tgraphbenterrors_integraltgraph 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_IsEditable" c_tgraphbenterrors_iseditable 
+  :: (Ptr RawTGraphBentErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_isInsideTGraph" c_tgraphbenterrors_isinsidetgraph 
+  :: (Ptr RawTGraphBentErrors) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_LeastSquareFit" c_tgraphbenterrors_leastsquarefit 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> (Ptr CDouble) -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_PaintStats" c_tgraphbenterrors_paintstats 
+  :: (Ptr RawTGraphBentErrors) -> (Ptr RawTF1) -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_RemovePoint" c_tgraphbenterrors_removepoint 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_SetEditable" c_tgraphbenterrors_seteditable 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_SetHistogram" c_tgraphbenterrors_sethistogram 
+  :: (Ptr RawTGraphBentErrors) -> (Ptr RawTH1F) -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_setMaximumTGraph" c_tgraphbenterrors_setmaximumtgraph 
+  :: (Ptr RawTGraphBentErrors) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_setMinimumTGraph" c_tgraphbenterrors_setminimumtgraph 
+  :: (Ptr RawTGraphBentErrors) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_Set" c_tgraphbenterrors_set 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_SetPoint" c_tgraphbenterrors_setpoint 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_SetName" c_tgraphbenterrors_setname 
+  :: (Ptr RawTGraphBentErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_SetNameTitle" c_tgraphbenterrors_setnametitle 
+  :: (Ptr RawTGraphBentErrors) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_SetTitle" c_tgraphbenterrors_settitle 
+  :: (Ptr RawTGraphBentErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_GetLineColor" c_tgraphbenterrors_getlinecolor 
+  :: (Ptr RawTGraphBentErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_GetLineStyle" c_tgraphbenterrors_getlinestyle 
+  :: (Ptr RawTGraphBentErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_GetLineWidth" c_tgraphbenterrors_getlinewidth 
+  :: (Ptr RawTGraphBentErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_ResetAttLine" c_tgraphbenterrors_resetattline 
+  :: (Ptr RawTGraphBentErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_SetLineAttributes" c_tgraphbenterrors_setlineattributes 
+  :: (Ptr RawTGraphBentErrors) -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_SetLineColor" c_tgraphbenterrors_setlinecolor 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_SetLineStyle" c_tgraphbenterrors_setlinestyle 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_SetLineWidth" c_tgraphbenterrors_setlinewidth 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_SetFillColor" c_tgraphbenterrors_setfillcolor 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_SetFillStyle" c_tgraphbenterrors_setfillstyle 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_GetMarkerColor" c_tgraphbenterrors_getmarkercolor 
+  :: (Ptr RawTGraphBentErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_GetMarkerStyle" c_tgraphbenterrors_getmarkerstyle 
+  :: (Ptr RawTGraphBentErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_GetMarkerSize" c_tgraphbenterrors_getmarkersize 
+  :: (Ptr RawTGraphBentErrors) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_ResetAttMarker" c_tgraphbenterrors_resetattmarker 
+  :: (Ptr RawTGraphBentErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_SetMarkerAttributes" c_tgraphbenterrors_setmarkerattributes 
+  :: (Ptr RawTGraphBentErrors) -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_SetMarkerColor" c_tgraphbenterrors_setmarkercolor 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_SetMarkerStyle" c_tgraphbenterrors_setmarkerstyle 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_SetMarkerSize" c_tgraphbenterrors_setmarkersize 
+  :: (Ptr RawTGraphBentErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_Draw" c_tgraphbenterrors_draw 
+  :: (Ptr RawTGraphBentErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_FindObject" c_tgraphbenterrors_findobject 
+  :: (Ptr RawTGraphBentErrors) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_GetName" c_tgraphbenterrors_getname 
+  :: (Ptr RawTGraphBentErrors) -> IO CString
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_IsA" c_tgraphbenterrors_isa 
+  :: (Ptr RawTGraphBentErrors) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_Paint" c_tgraphbenterrors_paint 
+  :: (Ptr RawTGraphBentErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_printObj" c_tgraphbenterrors_printobj 
+  :: (Ptr RawTGraphBentErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_SaveAs" c_tgraphbenterrors_saveas 
+  :: (Ptr RawTGraphBentErrors) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_Write" c_tgraphbenterrors_write 
+  :: (Ptr RawTGraphBentErrors) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_delete" c_tgraphbenterrors_delete 
+  :: (Ptr RawTGraphBentErrors) -> IO ()
+
+foreign import ccall "HROOTHistTGraphBentErrors.h TGraphBentErrors_newTGraphBentErrors" c_tgraphbenterrors_newtgraphbenterrors 
+  :: CInt -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> IO (Ptr RawTGraphBentErrors)
+
diff --git a/src/HROOT/Hist/TGraphBentErrors/Implementation.hs b/src/HROOT/Hist/TGraphBentErrors/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphBentErrors/Implementation.hs
@@ -0,0 +1,210 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TGraphBentErrors.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TGraphBentErrors.RawType
+import HROOT.Hist.TGraphBentErrors.FFI
+import HROOT.Hist.TGraphBentErrors.Interface
+import HROOT.Hist.TGraphBentErrors.Cast
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Hist.TH1F.RawType
+import HROOT.Hist.TH1F.Cast
+import HROOT.Hist.TH1F.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TGraph.RawType
+import HROOT.Hist.TGraph.Cast
+import HROOT.Hist.TGraph.Interface
+import HROOT.Core.TNamed.RawType
+import HROOT.Core.TNamed.Cast
+import HROOT.Core.TNamed.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITGraphBentErrors TGraphBentErrors where
+instance ITGraph TGraphBentErrors where
+  apply = xform1 c_tgraphbenterrors_apply
+  chisquare = xform1 c_tgraphbenterrors_chisquare
+  drawGraph = xform4 c_tgraphbenterrors_drawgraph
+  drawPanelTGraph = xform0 c_tgraphbenterrors_drawpaneltgraph
+  expand = xform2 c_tgraphbenterrors_expand
+  fitPanelTGraph = xform0 c_tgraphbenterrors_fitpaneltgraph
+  getCorrelationFactorTGraph = xform0 c_tgraphbenterrors_getcorrelationfactortgraph
+  getCovarianceTGraph = xform0 c_tgraphbenterrors_getcovariancetgraph
+  getMeanTGraph = xform1 c_tgraphbenterrors_getmeantgraph
+  getRMSTGraph = xform1 c_tgraphbenterrors_getrmstgraph
+  getErrorX = xform1 c_tgraphbenterrors_geterrorx
+  getErrorY = xform1 c_tgraphbenterrors_geterrory
+  getErrorXhigh = xform1 c_tgraphbenterrors_geterrorxhigh
+  getErrorXlow = xform1 c_tgraphbenterrors_geterrorxlow
+  getErrorYhigh = xform1 c_tgraphbenterrors_geterroryhigh
+  getErrorYlow = xform1 c_tgraphbenterrors_geterrorylow
+  initExpo = xform2 c_tgraphbenterrors_initexpo
+  initGaus = xform2 c_tgraphbenterrors_initgaus
+  initPolynom = xform2 c_tgraphbenterrors_initpolynom
+  insertPoint = xform0 c_tgraphbenterrors_insertpoint
+  integralTGraph = xform2 c_tgraphbenterrors_integraltgraph
+  isEditable = xform0 c_tgraphbenterrors_iseditable
+  isInsideTGraph = xform2 c_tgraphbenterrors_isinsidetgraph
+  leastSquareFit = xform4 c_tgraphbenterrors_leastsquarefit
+  paintStats = xform1 c_tgraphbenterrors_paintstats
+  removePoint = xform1 c_tgraphbenterrors_removepoint
+  setEditable = xform1 c_tgraphbenterrors_seteditable
+  setHistogram = xform1 c_tgraphbenterrors_sethistogram
+  setMaximumTGraph = xform1 c_tgraphbenterrors_setmaximumtgraph
+  setMinimumTGraph = xform1 c_tgraphbenterrors_setminimumtgraph
+  set = xform1 c_tgraphbenterrors_set
+  setPoint = xform3 c_tgraphbenterrors_setpoint
+instance ITNamed TGraphBentErrors where
+  setName = xform1 c_tgraphbenterrors_setname
+  setNameTitle = xform2 c_tgraphbenterrors_setnametitle
+  setTitle = xform1 c_tgraphbenterrors_settitle
+instance ITAttLine TGraphBentErrors where
+  getLineColor = xform0 c_tgraphbenterrors_getlinecolor
+  getLineStyle = xform0 c_tgraphbenterrors_getlinestyle
+  getLineWidth = xform0 c_tgraphbenterrors_getlinewidth
+  resetAttLine = xform1 c_tgraphbenterrors_resetattline
+  setLineAttributes = xform0 c_tgraphbenterrors_setlineattributes
+  setLineColor = xform1 c_tgraphbenterrors_setlinecolor
+  setLineStyle = xform1 c_tgraphbenterrors_setlinestyle
+  setLineWidth = xform1 c_tgraphbenterrors_setlinewidth
+instance ITAttFill TGraphBentErrors where
+  setFillColor = xform1 c_tgraphbenterrors_setfillcolor
+  setFillStyle = xform1 c_tgraphbenterrors_setfillstyle
+instance ITAttMarker TGraphBentErrors where
+  getMarkerColor = xform0 c_tgraphbenterrors_getmarkercolor
+  getMarkerStyle = xform0 c_tgraphbenterrors_getmarkerstyle
+  getMarkerSize = xform0 c_tgraphbenterrors_getmarkersize
+  resetAttMarker = xform1 c_tgraphbenterrors_resetattmarker
+  setMarkerAttributes = xform0 c_tgraphbenterrors_setmarkerattributes
+  setMarkerColor = xform1 c_tgraphbenterrors_setmarkercolor
+  setMarkerStyle = xform1 c_tgraphbenterrors_setmarkerstyle
+  setMarkerSize = xform1 c_tgraphbenterrors_setmarkersize
+instance ITObject TGraphBentErrors where
+  draw = xform1 c_tgraphbenterrors_draw
+  findObject = xform1 c_tgraphbenterrors_findobject
+  getName = xform0 c_tgraphbenterrors_getname
+  isA = xform0 c_tgraphbenterrors_isa
+  paint = xform1 c_tgraphbenterrors_paint
+  printObj = xform1 c_tgraphbenterrors_printobj
+  saveAs = xform2 c_tgraphbenterrors_saveas
+  write = xform3 c_tgraphbenterrors_write
+instance IDeletable TGraphBentErrors where
+  delete = xform0 c_tgraphbenterrors_delete
+
+instance ITGraphBentErrors (Exist TGraphBentErrors) where
+
+instance ITGraph (Exist TGraphBentErrors) where
+  apply (ETGraphBentErrors x) = apply x
+  chisquare (ETGraphBentErrors x) = chisquare x
+  drawGraph (ETGraphBentErrors x) = drawGraph x
+  drawPanelTGraph (ETGraphBentErrors x) = drawPanelTGraph x
+  expand (ETGraphBentErrors x) = expand x
+  fitPanelTGraph (ETGraphBentErrors x) = fitPanelTGraph x
+  getCorrelationFactorTGraph (ETGraphBentErrors x) = getCorrelationFactorTGraph x
+  getCovarianceTGraph (ETGraphBentErrors x) = getCovarianceTGraph x
+  getMeanTGraph (ETGraphBentErrors x) = getMeanTGraph x
+  getRMSTGraph (ETGraphBentErrors x) = getRMSTGraph x
+  getErrorX (ETGraphBentErrors x) = getErrorX x
+  getErrorY (ETGraphBentErrors x) = getErrorY x
+  getErrorXhigh (ETGraphBentErrors x) = getErrorXhigh x
+  getErrorXlow (ETGraphBentErrors x) = getErrorXlow x
+  getErrorYhigh (ETGraphBentErrors x) = getErrorYhigh x
+  getErrorYlow (ETGraphBentErrors x) = getErrorYlow x
+  initExpo (ETGraphBentErrors x) = initExpo x
+  initGaus (ETGraphBentErrors x) = initGaus x
+  initPolynom (ETGraphBentErrors x) = initPolynom x
+  insertPoint (ETGraphBentErrors x) = insertPoint x
+  integralTGraph (ETGraphBentErrors x) = integralTGraph x
+  isEditable (ETGraphBentErrors x) = isEditable x
+  isInsideTGraph (ETGraphBentErrors x) = isInsideTGraph x
+  leastSquareFit (ETGraphBentErrors x) = leastSquareFit x
+  paintStats (ETGraphBentErrors x) = paintStats x
+  removePoint (ETGraphBentErrors x) = removePoint x
+  setEditable (ETGraphBentErrors x) = setEditable x
+  setHistogram (ETGraphBentErrors x) = setHistogram x
+  setMaximumTGraph (ETGraphBentErrors x) = setMaximumTGraph x
+  setMinimumTGraph (ETGraphBentErrors x) = setMinimumTGraph x
+  set (ETGraphBentErrors x) = set x
+  setPoint (ETGraphBentErrors x) = setPoint x
+instance ITNamed (Exist TGraphBentErrors) where
+  setName (ETGraphBentErrors x) = setName x
+  setNameTitle (ETGraphBentErrors x) = setNameTitle x
+  setTitle (ETGraphBentErrors x) = setTitle x
+instance ITAttLine (Exist TGraphBentErrors) where
+  getLineColor (ETGraphBentErrors x) = getLineColor x
+  getLineStyle (ETGraphBentErrors x) = getLineStyle x
+  getLineWidth (ETGraphBentErrors x) = getLineWidth x
+  resetAttLine (ETGraphBentErrors x) = resetAttLine x
+  setLineAttributes (ETGraphBentErrors x) = setLineAttributes x
+  setLineColor (ETGraphBentErrors x) = setLineColor x
+  setLineStyle (ETGraphBentErrors x) = setLineStyle x
+  setLineWidth (ETGraphBentErrors x) = setLineWidth x
+instance ITAttFill (Exist TGraphBentErrors) where
+  setFillColor (ETGraphBentErrors x) = setFillColor x
+  setFillStyle (ETGraphBentErrors x) = setFillStyle x
+instance ITAttMarker (Exist TGraphBentErrors) where
+  getMarkerColor (ETGraphBentErrors x) = getMarkerColor x
+  getMarkerStyle (ETGraphBentErrors x) = getMarkerStyle x
+  getMarkerSize (ETGraphBentErrors x) = getMarkerSize x
+  resetAttMarker (ETGraphBentErrors x) = resetAttMarker x
+  setMarkerAttributes (ETGraphBentErrors x) = setMarkerAttributes x
+  setMarkerColor (ETGraphBentErrors x) = setMarkerColor x
+  setMarkerStyle (ETGraphBentErrors x) = setMarkerStyle x
+  setMarkerSize (ETGraphBentErrors x) = setMarkerSize x
+instance ITObject (Exist TGraphBentErrors) where
+  draw (ETGraphBentErrors x) = draw x
+  findObject (ETGraphBentErrors x) = findObject x
+  getName (ETGraphBentErrors x) = getName x
+  isA (ETGraphBentErrors x) = isA x
+  paint (ETGraphBentErrors x) = paint x
+  printObj (ETGraphBentErrors x) = printObj x
+  saveAs (ETGraphBentErrors x) = saveAs x
+  write (ETGraphBentErrors x) = write x
+instance IDeletable (Exist TGraphBentErrors) where
+  delete (ETGraphBentErrors x) = delete x
+
+
+newTGraphBentErrors :: CInt -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> IO TGraphBentErrors
+newTGraphBentErrors = xform10 c_tgraphbenterrors_newtgraphbenterrors
+
+
+
+
+
+instance FPtr (Exist TGraphBentErrors) where
+  type Raw (Exist TGraphBentErrors) = RawTGraphBentErrors
+  get_fptr (ETGraphBentErrors obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETGraphBentErrors (cast_fptr_to_obj (fptr :: ForeignPtr RawTGraphBentErrors) :: TGraphBentErrors)
diff --git a/src/HROOT/Hist/TGraphBentErrors/Interface.hs b/src/HROOT/Hist/TGraphBentErrors/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphBentErrors/Interface.hs
@@ -0,0 +1,36 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TGraphBentErrors.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TGraphBentErrors.RawType
+
+import HROOT.Hist.TGraph.Interface
+---- ============ ----
+
+
+
+class (ITGraph a) => ITGraphBentErrors a where
+
+instance Existable TGraphBentErrors where
+  data Exist TGraphBentErrors = forall a. (FPtr a, ITGraphBentErrors a) => ETGraphBentErrors a
+
+upcastTGraphBentErrors :: (FPtr a, ITGraphBentErrors a) => a -> TGraphBentErrors
+upcastTGraphBentErrors h = let fh = get_fptr h
+                               fh2 :: ForeignPtr RawTGraphBentErrors = castForeignPtr fh
+                           in cast_fptr_to_obj fh2
+
+downcastTGraphBentErrors :: (FPtr a, ITGraphBentErrors a) => TGraphBentErrors -> a 
+downcastTGraphBentErrors h = let fh = get_fptr h
+                                 fh2 = castForeignPtr fh
+                             in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TGraphBentErrors/RawType.hs b/src/HROOT/Hist/TGraphBentErrors/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphBentErrors/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TGraphBentErrors.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTGraphBentErrors
+newtype TGraphBentErrors = TGraphBentErrors (ForeignPtr RawTGraphBentErrors) deriving (Eq, Ord, Show)
+instance FPtr TGraphBentErrors where
+   type Raw TGraphBentErrors = RawTGraphBentErrors
+   get_fptr (TGraphBentErrors fptr) = fptr
+   cast_fptr_to_obj = TGraphBentErrors
diff --git a/src/HROOT/Hist/TGraphErrors.hs b/src/HROOT/Hist/TGraphErrors.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphErrors.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TGraphErrors
+  (
+    TGraphErrors(..)
+  , ITGraphErrors
+  , upcastTGraphErrors
+  , downcastTGraphErrors
+  , newTGraphErrors
+ 
+  ) where
+
+import HROOT.Hist.TGraphErrors.RawType
+import HROOT.Hist.TGraphErrors.Interface
+import HROOT.Hist.TGraphErrors.Implementation
+
+
diff --git a/src/HROOT/Hist/TGraphErrors/Cast.hs b/src/HROOT/Hist/TGraphErrors/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphErrors/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TGraphErrors.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TGraphErrors.RawType
+import HROOT.Hist.TGraphErrors.Interface
+
+instance (ITGraphErrors a, FPtr a) => Castable a (Ptr RawTGraphErrors) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TGraphErrors (Ptr RawTGraphErrors) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TGraphErrors/FFI.hsc b/src/HROOT/Hist/TGraphErrors/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphErrors/FFI.hsc
@@ -0,0 +1,212 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TGraphErrors.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TGraphErrors.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TH1F.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTGraphErrors.h"
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_Apply" c_tgrapherrors_apply 
+  :: (Ptr RawTGraphErrors) -> (Ptr RawTF1) -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_Chisquare" c_tgrapherrors_chisquare 
+  :: (Ptr RawTGraphErrors) -> (Ptr RawTF1) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_DrawGraph" c_tgrapherrors_drawgraph 
+  :: (Ptr RawTGraphErrors) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_drawPanelTGraph" c_tgrapherrors_drawpaneltgraph 
+  :: (Ptr RawTGraphErrors) -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_Expand" c_tgrapherrors_expand 
+  :: (Ptr RawTGraphErrors) -> CInt -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_FitPanelTGraph" c_tgrapherrors_fitpaneltgraph 
+  :: (Ptr RawTGraphErrors) -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_getCorrelationFactorTGraph" c_tgrapherrors_getcorrelationfactortgraph 
+  :: (Ptr RawTGraphErrors) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_getCovarianceTGraph" c_tgrapherrors_getcovariancetgraph 
+  :: (Ptr RawTGraphErrors) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_getMeanTGraph" c_tgrapherrors_getmeantgraph 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_getRMSTGraph" c_tgrapherrors_getrmstgraph 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_GetErrorX" c_tgrapherrors_geterrorx 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_GetErrorY" c_tgrapherrors_geterrory 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_GetErrorXhigh" c_tgrapherrors_geterrorxhigh 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_GetErrorXlow" c_tgrapherrors_geterrorxlow 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_GetErrorYhigh" c_tgrapherrors_geterroryhigh 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_GetErrorYlow" c_tgrapherrors_geterrorylow 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_InitExpo" c_tgrapherrors_initexpo 
+  :: (Ptr RawTGraphErrors) -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_InitGaus" c_tgrapherrors_initgaus 
+  :: (Ptr RawTGraphErrors) -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_InitPolynom" c_tgrapherrors_initpolynom 
+  :: (Ptr RawTGraphErrors) -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_InsertPoint" c_tgrapherrors_insertpoint 
+  :: (Ptr RawTGraphErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_integralTGraph" c_tgrapherrors_integraltgraph 
+  :: (Ptr RawTGraphErrors) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_IsEditable" c_tgrapherrors_iseditable 
+  :: (Ptr RawTGraphErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_isInsideTGraph" c_tgrapherrors_isinsidetgraph 
+  :: (Ptr RawTGraphErrors) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_LeastSquareFit" c_tgrapherrors_leastsquarefit 
+  :: (Ptr RawTGraphErrors) -> CInt -> (Ptr CDouble) -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_PaintStats" c_tgrapherrors_paintstats 
+  :: (Ptr RawTGraphErrors) -> (Ptr RawTF1) -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_RemovePoint" c_tgrapherrors_removepoint 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_SetEditable" c_tgrapherrors_seteditable 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_SetHistogram" c_tgrapherrors_sethistogram 
+  :: (Ptr RawTGraphErrors) -> (Ptr RawTH1F) -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_setMaximumTGraph" c_tgrapherrors_setmaximumtgraph 
+  :: (Ptr RawTGraphErrors) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_setMinimumTGraph" c_tgrapherrors_setminimumtgraph 
+  :: (Ptr RawTGraphErrors) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_Set" c_tgrapherrors_set 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_SetPoint" c_tgrapherrors_setpoint 
+  :: (Ptr RawTGraphErrors) -> CInt -> CDouble -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_SetName" c_tgrapherrors_setname 
+  :: (Ptr RawTGraphErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_SetNameTitle" c_tgrapherrors_setnametitle 
+  :: (Ptr RawTGraphErrors) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_SetTitle" c_tgrapherrors_settitle 
+  :: (Ptr RawTGraphErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_GetLineColor" c_tgrapherrors_getlinecolor 
+  :: (Ptr RawTGraphErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_GetLineStyle" c_tgrapherrors_getlinestyle 
+  :: (Ptr RawTGraphErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_GetLineWidth" c_tgrapherrors_getlinewidth 
+  :: (Ptr RawTGraphErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_ResetAttLine" c_tgrapherrors_resetattline 
+  :: (Ptr RawTGraphErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_SetLineAttributes" c_tgrapherrors_setlineattributes 
+  :: (Ptr RawTGraphErrors) -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_SetLineColor" c_tgrapherrors_setlinecolor 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_SetLineStyle" c_tgrapherrors_setlinestyle 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_SetLineWidth" c_tgrapherrors_setlinewidth 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_SetFillColor" c_tgrapherrors_setfillcolor 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_SetFillStyle" c_tgrapherrors_setfillstyle 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_GetMarkerColor" c_tgrapherrors_getmarkercolor 
+  :: (Ptr RawTGraphErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_GetMarkerStyle" c_tgrapherrors_getmarkerstyle 
+  :: (Ptr RawTGraphErrors) -> IO CInt
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_GetMarkerSize" c_tgrapherrors_getmarkersize 
+  :: (Ptr RawTGraphErrors) -> IO CDouble
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_ResetAttMarker" c_tgrapherrors_resetattmarker 
+  :: (Ptr RawTGraphErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_SetMarkerAttributes" c_tgrapherrors_setmarkerattributes 
+  :: (Ptr RawTGraphErrors) -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_SetMarkerColor" c_tgrapherrors_setmarkercolor 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_SetMarkerStyle" c_tgrapherrors_setmarkerstyle 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_SetMarkerSize" c_tgrapherrors_setmarkersize 
+  :: (Ptr RawTGraphErrors) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_Draw" c_tgrapherrors_draw 
+  :: (Ptr RawTGraphErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_FindObject" c_tgrapherrors_findobject 
+  :: (Ptr RawTGraphErrors) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_GetName" c_tgrapherrors_getname 
+  :: (Ptr RawTGraphErrors) -> IO CString
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_IsA" c_tgrapherrors_isa 
+  :: (Ptr RawTGraphErrors) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_Paint" c_tgrapherrors_paint 
+  :: (Ptr RawTGraphErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_printObj" c_tgrapherrors_printobj 
+  :: (Ptr RawTGraphErrors) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_SaveAs" c_tgrapherrors_saveas 
+  :: (Ptr RawTGraphErrors) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_Write" c_tgrapherrors_write 
+  :: (Ptr RawTGraphErrors) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_delete" c_tgrapherrors_delete 
+  :: (Ptr RawTGraphErrors) -> IO ()
+
+foreign import ccall "HROOTHistTGraphErrors.h TGraphErrors_newTGraphErrors" c_tgrapherrors_newtgrapherrors 
+  :: CInt -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> IO (Ptr RawTGraphErrors)
+
diff --git a/src/HROOT/Hist/TGraphErrors/Implementation.hs b/src/HROOT/Hist/TGraphErrors/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphErrors/Implementation.hs
@@ -0,0 +1,210 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TGraphErrors.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TGraphErrors.RawType
+import HROOT.Hist.TGraphErrors.FFI
+import HROOT.Hist.TGraphErrors.Interface
+import HROOT.Hist.TGraphErrors.Cast
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Hist.TH1F.RawType
+import HROOT.Hist.TH1F.Cast
+import HROOT.Hist.TH1F.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TGraph.RawType
+import HROOT.Hist.TGraph.Cast
+import HROOT.Hist.TGraph.Interface
+import HROOT.Core.TNamed.RawType
+import HROOT.Core.TNamed.Cast
+import HROOT.Core.TNamed.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITGraphErrors TGraphErrors where
+instance ITGraph TGraphErrors where
+  apply = xform1 c_tgrapherrors_apply
+  chisquare = xform1 c_tgrapherrors_chisquare
+  drawGraph = xform4 c_tgrapherrors_drawgraph
+  drawPanelTGraph = xform0 c_tgrapherrors_drawpaneltgraph
+  expand = xform2 c_tgrapherrors_expand
+  fitPanelTGraph = xform0 c_tgrapherrors_fitpaneltgraph
+  getCorrelationFactorTGraph = xform0 c_tgrapherrors_getcorrelationfactortgraph
+  getCovarianceTGraph = xform0 c_tgrapherrors_getcovariancetgraph
+  getMeanTGraph = xform1 c_tgrapherrors_getmeantgraph
+  getRMSTGraph = xform1 c_tgrapherrors_getrmstgraph
+  getErrorX = xform1 c_tgrapherrors_geterrorx
+  getErrorY = xform1 c_tgrapherrors_geterrory
+  getErrorXhigh = xform1 c_tgrapherrors_geterrorxhigh
+  getErrorXlow = xform1 c_tgrapherrors_geterrorxlow
+  getErrorYhigh = xform1 c_tgrapherrors_geterroryhigh
+  getErrorYlow = xform1 c_tgrapherrors_geterrorylow
+  initExpo = xform2 c_tgrapherrors_initexpo
+  initGaus = xform2 c_tgrapherrors_initgaus
+  initPolynom = xform2 c_tgrapherrors_initpolynom
+  insertPoint = xform0 c_tgrapherrors_insertpoint
+  integralTGraph = xform2 c_tgrapherrors_integraltgraph
+  isEditable = xform0 c_tgrapherrors_iseditable
+  isInsideTGraph = xform2 c_tgrapherrors_isinsidetgraph
+  leastSquareFit = xform4 c_tgrapherrors_leastsquarefit
+  paintStats = xform1 c_tgrapherrors_paintstats
+  removePoint = xform1 c_tgrapherrors_removepoint
+  setEditable = xform1 c_tgrapherrors_seteditable
+  setHistogram = xform1 c_tgrapherrors_sethistogram
+  setMaximumTGraph = xform1 c_tgrapherrors_setmaximumtgraph
+  setMinimumTGraph = xform1 c_tgrapherrors_setminimumtgraph
+  set = xform1 c_tgrapherrors_set
+  setPoint = xform3 c_tgrapherrors_setpoint
+instance ITNamed TGraphErrors where
+  setName = xform1 c_tgrapherrors_setname
+  setNameTitle = xform2 c_tgrapherrors_setnametitle
+  setTitle = xform1 c_tgrapherrors_settitle
+instance ITAttLine TGraphErrors where
+  getLineColor = xform0 c_tgrapherrors_getlinecolor
+  getLineStyle = xform0 c_tgrapherrors_getlinestyle
+  getLineWidth = xform0 c_tgrapherrors_getlinewidth
+  resetAttLine = xform1 c_tgrapherrors_resetattline
+  setLineAttributes = xform0 c_tgrapherrors_setlineattributes
+  setLineColor = xform1 c_tgrapherrors_setlinecolor
+  setLineStyle = xform1 c_tgrapherrors_setlinestyle
+  setLineWidth = xform1 c_tgrapherrors_setlinewidth
+instance ITAttFill TGraphErrors where
+  setFillColor = xform1 c_tgrapherrors_setfillcolor
+  setFillStyle = xform1 c_tgrapherrors_setfillstyle
+instance ITAttMarker TGraphErrors where
+  getMarkerColor = xform0 c_tgrapherrors_getmarkercolor
+  getMarkerStyle = xform0 c_tgrapherrors_getmarkerstyle
+  getMarkerSize = xform0 c_tgrapherrors_getmarkersize
+  resetAttMarker = xform1 c_tgrapherrors_resetattmarker
+  setMarkerAttributes = xform0 c_tgrapherrors_setmarkerattributes
+  setMarkerColor = xform1 c_tgrapherrors_setmarkercolor
+  setMarkerStyle = xform1 c_tgrapherrors_setmarkerstyle
+  setMarkerSize = xform1 c_tgrapherrors_setmarkersize
+instance ITObject TGraphErrors where
+  draw = xform1 c_tgrapherrors_draw
+  findObject = xform1 c_tgrapherrors_findobject
+  getName = xform0 c_tgrapherrors_getname
+  isA = xform0 c_tgrapherrors_isa
+  paint = xform1 c_tgrapherrors_paint
+  printObj = xform1 c_tgrapherrors_printobj
+  saveAs = xform2 c_tgrapherrors_saveas
+  write = xform3 c_tgrapherrors_write
+instance IDeletable TGraphErrors where
+  delete = xform0 c_tgrapherrors_delete
+
+instance ITGraphErrors (Exist TGraphErrors) where
+
+instance ITGraph (Exist TGraphErrors) where
+  apply (ETGraphErrors x) = apply x
+  chisquare (ETGraphErrors x) = chisquare x
+  drawGraph (ETGraphErrors x) = drawGraph x
+  drawPanelTGraph (ETGraphErrors x) = drawPanelTGraph x
+  expand (ETGraphErrors x) = expand x
+  fitPanelTGraph (ETGraphErrors x) = fitPanelTGraph x
+  getCorrelationFactorTGraph (ETGraphErrors x) = getCorrelationFactorTGraph x
+  getCovarianceTGraph (ETGraphErrors x) = getCovarianceTGraph x
+  getMeanTGraph (ETGraphErrors x) = getMeanTGraph x
+  getRMSTGraph (ETGraphErrors x) = getRMSTGraph x
+  getErrorX (ETGraphErrors x) = getErrorX x
+  getErrorY (ETGraphErrors x) = getErrorY x
+  getErrorXhigh (ETGraphErrors x) = getErrorXhigh x
+  getErrorXlow (ETGraphErrors x) = getErrorXlow x
+  getErrorYhigh (ETGraphErrors x) = getErrorYhigh x
+  getErrorYlow (ETGraphErrors x) = getErrorYlow x
+  initExpo (ETGraphErrors x) = initExpo x
+  initGaus (ETGraphErrors x) = initGaus x
+  initPolynom (ETGraphErrors x) = initPolynom x
+  insertPoint (ETGraphErrors x) = insertPoint x
+  integralTGraph (ETGraphErrors x) = integralTGraph x
+  isEditable (ETGraphErrors x) = isEditable x
+  isInsideTGraph (ETGraphErrors x) = isInsideTGraph x
+  leastSquareFit (ETGraphErrors x) = leastSquareFit x
+  paintStats (ETGraphErrors x) = paintStats x
+  removePoint (ETGraphErrors x) = removePoint x
+  setEditable (ETGraphErrors x) = setEditable x
+  setHistogram (ETGraphErrors x) = setHistogram x
+  setMaximumTGraph (ETGraphErrors x) = setMaximumTGraph x
+  setMinimumTGraph (ETGraphErrors x) = setMinimumTGraph x
+  set (ETGraphErrors x) = set x
+  setPoint (ETGraphErrors x) = setPoint x
+instance ITNamed (Exist TGraphErrors) where
+  setName (ETGraphErrors x) = setName x
+  setNameTitle (ETGraphErrors x) = setNameTitle x
+  setTitle (ETGraphErrors x) = setTitle x
+instance ITAttLine (Exist TGraphErrors) where
+  getLineColor (ETGraphErrors x) = getLineColor x
+  getLineStyle (ETGraphErrors x) = getLineStyle x
+  getLineWidth (ETGraphErrors x) = getLineWidth x
+  resetAttLine (ETGraphErrors x) = resetAttLine x
+  setLineAttributes (ETGraphErrors x) = setLineAttributes x
+  setLineColor (ETGraphErrors x) = setLineColor x
+  setLineStyle (ETGraphErrors x) = setLineStyle x
+  setLineWidth (ETGraphErrors x) = setLineWidth x
+instance ITAttFill (Exist TGraphErrors) where
+  setFillColor (ETGraphErrors x) = setFillColor x
+  setFillStyle (ETGraphErrors x) = setFillStyle x
+instance ITAttMarker (Exist TGraphErrors) where
+  getMarkerColor (ETGraphErrors x) = getMarkerColor x
+  getMarkerStyle (ETGraphErrors x) = getMarkerStyle x
+  getMarkerSize (ETGraphErrors x) = getMarkerSize x
+  resetAttMarker (ETGraphErrors x) = resetAttMarker x
+  setMarkerAttributes (ETGraphErrors x) = setMarkerAttributes x
+  setMarkerColor (ETGraphErrors x) = setMarkerColor x
+  setMarkerStyle (ETGraphErrors x) = setMarkerStyle x
+  setMarkerSize (ETGraphErrors x) = setMarkerSize x
+instance ITObject (Exist TGraphErrors) where
+  draw (ETGraphErrors x) = draw x
+  findObject (ETGraphErrors x) = findObject x
+  getName (ETGraphErrors x) = getName x
+  isA (ETGraphErrors x) = isA x
+  paint (ETGraphErrors x) = paint x
+  printObj (ETGraphErrors x) = printObj x
+  saveAs (ETGraphErrors x) = saveAs x
+  write (ETGraphErrors x) = write x
+instance IDeletable (Exist TGraphErrors) where
+  delete (ETGraphErrors x) = delete x
+
+
+newTGraphErrors :: CInt -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> IO TGraphErrors
+newTGraphErrors = xform4 c_tgrapherrors_newtgrapherrors
+
+
+
+
+
+instance FPtr (Exist TGraphErrors) where
+  type Raw (Exist TGraphErrors) = RawTGraphErrors
+  get_fptr (ETGraphErrors obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETGraphErrors (cast_fptr_to_obj (fptr :: ForeignPtr RawTGraphErrors) :: TGraphErrors)
diff --git a/src/HROOT/Hist/TGraphErrors/Interface.hs b/src/HROOT/Hist/TGraphErrors/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphErrors/Interface.hs
@@ -0,0 +1,36 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TGraphErrors.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TGraphErrors.RawType
+
+import HROOT.Hist.TGraph.Interface
+---- ============ ----
+
+
+
+class (ITGraph a) => ITGraphErrors a where
+
+instance Existable TGraphErrors where
+  data Exist TGraphErrors = forall a. (FPtr a, ITGraphErrors a) => ETGraphErrors a
+
+upcastTGraphErrors :: (FPtr a, ITGraphErrors a) => a -> TGraphErrors
+upcastTGraphErrors h = let fh = get_fptr h
+                           fh2 :: ForeignPtr RawTGraphErrors = castForeignPtr fh
+                       in cast_fptr_to_obj fh2
+
+downcastTGraphErrors :: (FPtr a, ITGraphErrors a) => TGraphErrors -> a 
+downcastTGraphErrors h = let fh = get_fptr h
+                             fh2 = castForeignPtr fh
+                         in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TGraphErrors/RawType.hs b/src/HROOT/Hist/TGraphErrors/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TGraphErrors/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TGraphErrors.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTGraphErrors
+newtype TGraphErrors = TGraphErrors (ForeignPtr RawTGraphErrors) deriving (Eq, Ord, Show)
+instance FPtr TGraphErrors where
+   type Raw TGraphErrors = RawTGraphErrors
+   get_fptr (TGraphErrors fptr) = fptr
+   cast_fptr_to_obj = TGraphErrors
diff --git a/src/HROOT/Hist/TH1.hs b/src/HROOT/Hist/TH1.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1.hs
@@ -0,0 +1,26 @@
+module HROOT.Hist.TH1
+  (
+    TH1(..)
+  , ITH1(..)
+  , upcastTH1
+  , downcastTH1
+  , tH1GetAsymmetry
+  , tH1GetBufferLength
+  , tH1GetBufferSize
+  , tH1GetDirectory
+  , tH1IsBinOverflow
+  , tH1IsBinUnderflow
+  , tH1UseCurrentStyle
+  , tH1GetDefaultBufferSize
+  , tH1GetDefaultSumw2
+  , tH1SetDefaultBufferSize
+  , tH1SetDefaultSumw2
+  , tH1SmoothArray
+  , tH1StatOverflows 
+  ) where
+
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Interface
+import HROOT.Hist.TH1.Implementation
+
+
diff --git a/src/HROOT/Hist/TH1/Cast.hs b/src/HROOT/Hist/TH1/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH1.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Interface
+
+instance (ITH1 a, FPtr a) => Castable a (Ptr RawTH1) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH1 (Ptr RawTH1) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH1/FFI.hsc b/src/HROOT/Hist/TH1/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1/FFI.hsc
@@ -0,0 +1,534 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH1.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH1.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+
+#include "HROOTHistTH1.h"
+
+foreign import ccall "HROOTHistTH1.h TH1_Draw" c_th1_draw 
+  :: (Ptr RawTH1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_FindObject" c_th1_findobject 
+  :: (Ptr RawTH1) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH1.h TH1_GetName" c_th1_getname 
+  :: (Ptr RawTH1) -> IO CString
+
+foreign import ccall "HROOTHistTH1.h TH1_IsA" c_th1_isa 
+  :: (Ptr RawTH1) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH1.h TH1_Paint" c_th1_paint 
+  :: (Ptr RawTH1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_printObj" c_th1_printobj 
+  :: (Ptr RawTH1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SaveAs" c_th1_saveas 
+  :: (Ptr RawTH1) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_Write" c_th1_write 
+  :: (Ptr RawTH1) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_GetLineColor" c_th1_getlinecolor 
+  :: (Ptr RawTH1) -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_GetLineStyle" c_th1_getlinestyle 
+  :: (Ptr RawTH1) -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_GetLineWidth" c_th1_getlinewidth 
+  :: (Ptr RawTH1) -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_ResetAttLine" c_th1_resetattline 
+  :: (Ptr RawTH1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetLineAttributes" c_th1_setlineattributes 
+  :: (Ptr RawTH1) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetLineColor" c_th1_setlinecolor 
+  :: (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetLineStyle" c_th1_setlinestyle 
+  :: (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetLineWidth" c_th1_setlinewidth 
+  :: (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetFillColor" c_th1_setfillcolor 
+  :: (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetFillStyle" c_th1_setfillstyle 
+  :: (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_GetMarkerColor" c_th1_getmarkercolor 
+  :: (Ptr RawTH1) -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_GetMarkerStyle" c_th1_getmarkerstyle 
+  :: (Ptr RawTH1) -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_GetMarkerSize" c_th1_getmarkersize 
+  :: (Ptr RawTH1) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_ResetAttMarker" c_th1_resetattmarker 
+  :: (Ptr RawTH1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetMarkerAttributes" c_th1_setmarkerattributes 
+  :: (Ptr RawTH1) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetMarkerColor" c_th1_setmarkercolor 
+  :: (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetMarkerStyle" c_th1_setmarkerstyle 
+  :: (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetMarkerSize" c_th1_setmarkersize 
+  :: (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_delete" c_th1_delete 
+  :: (Ptr RawTH1) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_Add" c_th1_add 
+  :: (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_AddBinContent" c_th1_addbincontent 
+  :: (Ptr RawTH1) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_Chi2Test" c_th1_chi2test 
+  :: (Ptr RawTH1) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_ComputeIntegral" c_th1_computeintegral 
+  :: (Ptr RawTH1) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_DirectoryAutoAdd" c_th1_directoryautoadd 
+  :: (Ptr RawTH1) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_Divide" c_th1_divide 
+  :: (Ptr RawTH1) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_drawCopyTH1" c_th1_drawcopyth1 
+  :: (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1.h TH1_DrawNormalized" c_th1_drawnormalized 
+  :: (Ptr RawTH1) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1.h TH1_drawPanelTH1" c_th1_drawpanelth1 
+  :: (Ptr RawTH1) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_BufferEmpty" c_th1_bufferempty 
+  :: (Ptr RawTH1) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_evalF" c_th1_evalf 
+  :: (Ptr RawTH1) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_FFT" c_th1_fft 
+  :: (Ptr RawTH1) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1.h TH1_fill1" c_th1_fill1 
+  :: (Ptr RawTH1) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_fill1w" c_th1_fill1w 
+  :: (Ptr RawTH1) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_fillN1" c_th1_filln1 
+  :: (Ptr RawTH1) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_FillRandom" c_th1_fillrandom 
+  :: (Ptr RawTH1) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_FindBin" c_th1_findbin 
+  :: (Ptr RawTH1) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_FindFixBin" c_th1_findfixbin 
+  :: (Ptr RawTH1) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_FindFirstBinAbove" c_th1_findfirstbinabove 
+  :: (Ptr RawTH1) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_FindLastBinAbove" c_th1_findlastbinabove 
+  :: (Ptr RawTH1) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_FitPanelTH1" c_th1_fitpanelth1 
+  :: (Ptr RawTH1) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_tH1GetAsymmetry" c_th1_th1getasymmetry 
+  :: (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1.h TH1_tH1GetBufferLength" c_th1_th1getbufferlength 
+  :: (Ptr RawTH1) -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_tH1GetBufferSize" c_th1_th1getbuffersize 
+  :: (Ptr RawTH1) -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_tH1GetDefaultBufferSize" c_th1_th1getdefaultbuffersize 
+  :: IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_getNdivisionA" c_th1_getndivisiona 
+  :: (Ptr RawTH1) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_getAxisColorA" c_th1_getaxiscolora 
+  :: (Ptr RawTH1) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_getLabelColorA" c_th1_getlabelcolora 
+  :: (Ptr RawTH1) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_getLabelFontA" c_th1_getlabelfonta 
+  :: (Ptr RawTH1) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_getLabelOffsetA" c_th1_getlabeloffseta 
+  :: (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_getLabelSizeA" c_th1_getlabelsizea 
+  :: (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_getTitleFontA" c_th1_gettitlefonta 
+  :: (Ptr RawTH1) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_getTitleOffsetA" c_th1_gettitleoffseta 
+  :: (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_getTitleSizeA" c_th1_gettitlesizea 
+  :: (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_getTickLengthA" c_th1_getticklengtha 
+  :: (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetBarOffset" c_th1_getbaroffset 
+  :: (Ptr RawTH1) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetBarWidth" c_th1_getbarwidth 
+  :: (Ptr RawTH1) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetContour" c_th1_getcontour 
+  :: (Ptr RawTH1) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_GetContourLevel" c_th1_getcontourlevel 
+  :: (Ptr RawTH1) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetContourLevelPad" c_th1_getcontourlevelpad 
+  :: (Ptr RawTH1) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetBin" c_th1_getbin 
+  :: (Ptr RawTH1) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_GetBinCenter" c_th1_getbincenter 
+  :: (Ptr RawTH1) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetBinContent1" c_th1_getbincontent1 
+  :: (Ptr RawTH1) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetBinContent2" c_th1_getbincontent2 
+  :: (Ptr RawTH1) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetBinContent3" c_th1_getbincontent3 
+  :: (Ptr RawTH1) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetBinError1" c_th1_getbinerror1 
+  :: (Ptr RawTH1) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetBinError2" c_th1_getbinerror2 
+  :: (Ptr RawTH1) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetBinError3" c_th1_getbinerror3 
+  :: (Ptr RawTH1) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetBinLowEdge" c_th1_getbinlowedge 
+  :: (Ptr RawTH1) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetBinWidth" c_th1_getbinwidth 
+  :: (Ptr RawTH1) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetCellContent" c_th1_getcellcontent 
+  :: (Ptr RawTH1) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetCellError" c_th1_getcellerror 
+  :: (Ptr RawTH1) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_tH1GetDefaultSumw2" c_th1_th1getdefaultsumw2 
+  :: IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_tH1GetDirectory" c_th1_th1getdirectory 
+  :: (Ptr RawTH1) -> IO (Ptr RawTDirectory)
+
+foreign import ccall "HROOTHistTH1.h TH1_GetEntries" c_th1_getentries 
+  :: (Ptr RawTH1) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetEffectiveEntries" c_th1_geteffectiveentries 
+  :: (Ptr RawTH1) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetFunction" c_th1_getfunction 
+  :: (Ptr RawTH1) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH1.h TH1_GetDimension" c_th1_getdimension 
+  :: (Ptr RawTH1) -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_GetKurtosis" c_th1_getkurtosis 
+  :: (Ptr RawTH1) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetLowEdge" c_th1_getlowedge 
+  :: (Ptr RawTH1) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_getMaximumTH1" c_th1_getmaximumth1 
+  :: (Ptr RawTH1) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetMaximumBin" c_th1_getmaximumbin 
+  :: (Ptr RawTH1) -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_GetMaximumStored" c_th1_getmaximumstored 
+  :: (Ptr RawTH1) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_getMinimumTH1" c_th1_getminimumth1 
+  :: (Ptr RawTH1) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetMinimumBin" c_th1_getminimumbin 
+  :: (Ptr RawTH1) -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_GetMinimumStored" c_th1_getminimumstored 
+  :: (Ptr RawTH1) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetMean" c_th1_getmean 
+  :: (Ptr RawTH1) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetMeanError" c_th1_getmeanerror 
+  :: (Ptr RawTH1) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetNbinsX" c_th1_getnbinsx 
+  :: (Ptr RawTH1) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetNbinsY" c_th1_getnbinsy 
+  :: (Ptr RawTH1) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetNbinsZ" c_th1_getnbinsz 
+  :: (Ptr RawTH1) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_getQuantilesTH1" c_th1_getquantilesth1 
+  :: (Ptr RawTH1) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_GetRandom" c_th1_getrandom 
+  :: (Ptr RawTH1) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetStats" c_th1_getstats 
+  :: (Ptr RawTH1) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_GetSumOfWeights" c_th1_getsumofweights 
+  :: (Ptr RawTH1) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetSumw2" c_th1_getsumw2 
+  :: (Ptr RawTH1) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH1.h TH1_GetSumw2N" c_th1_getsumw2n 
+  :: (Ptr RawTH1) -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_GetRMS" c_th1_getrms 
+  :: (Ptr RawTH1) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetRMSError" c_th1_getrmserror 
+  :: (Ptr RawTH1) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_GetSkewness" c_th1_getskewness 
+  :: (Ptr RawTH1) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_integral1" c_th1_integral1 
+  :: (Ptr RawTH1) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_interpolate1" c_th1_interpolate1 
+  :: (Ptr RawTH1) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_interpolate2" c_th1_interpolate2 
+  :: (Ptr RawTH1) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_interpolate3" c_th1_interpolate3 
+  :: (Ptr RawTH1) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_tH1IsBinOverflow" c_th1_th1isbinoverflow 
+  :: (Ptr RawTH1) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_tH1IsBinUnderflow" c_th1_th1isbinunderflow 
+  :: (Ptr RawTH1) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_KolmogorovTest" c_th1_kolmogorovtest 
+  :: (Ptr RawTH1) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1.h TH1_LabelsDeflate" c_th1_labelsdeflate 
+  :: (Ptr RawTH1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_LabelsInflate" c_th1_labelsinflate 
+  :: (Ptr RawTH1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_LabelsOption" c_th1_labelsoption 
+  :: (Ptr RawTH1) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_multiflyF" c_th1_multiflyf 
+  :: (Ptr RawTH1) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_Multiply" c_th1_multiply 
+  :: (Ptr RawTH1) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_PutStats" c_th1_putstats 
+  :: (Ptr RawTH1) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_Rebin" c_th1_rebin 
+  :: (Ptr RawTH1) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1.h TH1_RebinAxis" c_th1_rebinaxis 
+  :: (Ptr RawTH1) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_Rebuild" c_th1_rebuild 
+  :: (Ptr RawTH1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_RecursiveRemove" c_th1_recursiveremove 
+  :: (Ptr RawTH1) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_Reset" c_th1_reset 
+  :: (Ptr RawTH1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_ResetStats" c_th1_resetstats 
+  :: (Ptr RawTH1) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_Scale" c_th1_scale 
+  :: (Ptr RawTH1) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_setAxisColorA" c_th1_setaxiscolora 
+  :: (Ptr RawTH1) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetAxisRange" c_th1_setaxisrange 
+  :: (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetBarOffset" c_th1_setbaroffset 
+  :: (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetBarWidth" c_th1_setbarwidth 
+  :: (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_setBinContent1" c_th1_setbincontent1 
+  :: (Ptr RawTH1) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_setBinContent2" c_th1_setbincontent2 
+  :: (Ptr RawTH1) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_setBinContent3" c_th1_setbincontent3 
+  :: (Ptr RawTH1) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_setBinError1" c_th1_setbinerror1 
+  :: (Ptr RawTH1) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_setBinError2" c_th1_setbinerror2 
+  :: (Ptr RawTH1) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_setBinError3" c_th1_setbinerror3 
+  :: (Ptr RawTH1) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_setBins1" c_th1_setbins1 
+  :: (Ptr RawTH1) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_setBins2" c_th1_setbins2 
+  :: (Ptr RawTH1) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_setBins3" c_th1_setbins3 
+  :: (Ptr RawTH1) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetBinsLength" c_th1_setbinslength 
+  :: (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetBuffer" c_th1_setbuffer 
+  :: (Ptr RawTH1) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetCellContent" c_th1_setcellcontent 
+  :: (Ptr RawTH1) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetContent" c_th1_setcontent 
+  :: (Ptr RawTH1) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetContour" c_th1_setcontour 
+  :: (Ptr RawTH1) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetContourLevel" c_th1_setcontourlevel 
+  :: (Ptr RawTH1) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_tH1SetDefaultBufferSize" c_th1_th1setdefaultbuffersize 
+  :: CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_tH1SetDefaultSumw2" c_th1_th1setdefaultsumw2 
+  :: CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetDirectory" c_th1_setdirectory 
+  :: (Ptr RawTH1) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetEntries" c_th1_setentries 
+  :: (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetError" c_th1_seterror 
+  :: (Ptr RawTH1) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_setLabelColorA" c_th1_setlabelcolora 
+  :: (Ptr RawTH1) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_setLabelSizeA" c_th1_setlabelsizea 
+  :: (Ptr RawTH1) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_setLabelFontA" c_th1_setlabelfonta 
+  :: (Ptr RawTH1) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_setLabelOffsetA" c_th1_setlabeloffseta 
+  :: (Ptr RawTH1) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetMaximum" c_th1_setmaximum 
+  :: (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetMinimum" c_th1_setminimum 
+  :: (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetNormFactor" c_th1_setnormfactor 
+  :: (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetStats" c_th1_setstats 
+  :: (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetOption" c_th1_setoption 
+  :: (Ptr RawTH1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetXTitle" c_th1_setxtitle 
+  :: (Ptr RawTH1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetYTitle" c_th1_setytitle 
+  :: (Ptr RawTH1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_SetZTitle" c_th1_setztitle 
+  :: (Ptr RawTH1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_ShowBackground" c_th1_showbackground 
+  :: (Ptr RawTH1) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1.h TH1_ShowPeaks" c_th1_showpeaks 
+  :: (Ptr RawTH1) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1.h TH1_Smooth" c_th1_smooth 
+  :: (Ptr RawTH1) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_tH1SmoothArray" c_th1_th1smootharray 
+  :: CInt -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_tH1StatOverflows" c_th1_th1statoverflows 
+  :: CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_Sumw2" c_th1_sumw2 
+  :: (Ptr RawTH1) -> IO ()
+
+foreign import ccall "HROOTHistTH1.h TH1_tH1UseCurrentStyle" c_th1_th1usecurrentstyle 
+  :: (Ptr RawTH1) -> IO ()
+
diff --git a/src/HROOT/Hist/TH1/Implementation.hs b/src/HROOT/Hist/TH1/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1/Implementation.hs
@@ -0,0 +1,425 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH1.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.FFI
+import HROOT.Hist.TH1.Interface
+import HROOT.Hist.TH1.Cast
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH1 TH1 where
+  add = xform2 c_th1_add
+  addBinContent = xform2 c_th1_addbincontent
+  chi2Test = xform3 c_th1_chi2test
+  computeIntegral = xform0 c_th1_computeintegral
+  directoryAutoAdd = xform1 c_th1_directoryautoadd
+  divide = xform5 c_th1_divide
+  drawCopyTH1 = xform1 c_th1_drawcopyth1
+  drawNormalized = xform2 c_th1_drawnormalized
+  drawPanelTH1 = xform0 c_th1_drawpanelth1
+  bufferEmpty = xform1 c_th1_bufferempty
+  evalF = xform2 c_th1_evalf
+  fFT = xform2 c_th1_fft
+  fill1 = xform1 c_th1_fill1
+  fill1w = xform2 c_th1_fill1w
+  fillN1 = xform4 c_th1_filln1
+  fillRandom = xform2 c_th1_fillrandom
+  findBin = xform3 c_th1_findbin
+  findFixBin = xform3 c_th1_findfixbin
+  findFirstBinAbove = xform2 c_th1_findfirstbinabove
+  findLastBinAbove = xform2 c_th1_findlastbinabove
+  fitPanelTH1 = xform0 c_th1_fitpanelth1
+  getNdivisionA = xform1 c_th1_getndivisiona
+  getAxisColorA = xform1 c_th1_getaxiscolora
+  getLabelColorA = xform1 c_th1_getlabelcolora
+  getLabelFontA = xform1 c_th1_getlabelfonta
+  getLabelOffsetA = xform1 c_th1_getlabeloffseta
+  getLabelSizeA = xform1 c_th1_getlabelsizea
+  getTitleFontA = xform1 c_th1_gettitlefonta
+  getTitleOffsetA = xform1 c_th1_gettitleoffseta
+  getTitleSizeA = xform1 c_th1_gettitlesizea
+  getTickLengthA = xform1 c_th1_getticklengtha
+  getBarOffset = xform0 c_th1_getbaroffset
+  getBarWidth = xform0 c_th1_getbarwidth
+  getContour = xform1 c_th1_getcontour
+  getContourLevel = xform1 c_th1_getcontourlevel
+  getContourLevelPad = xform1 c_th1_getcontourlevelpad
+  getBin = xform3 c_th1_getbin
+  getBinCenter = xform1 c_th1_getbincenter
+  getBinContent1 = xform1 c_th1_getbincontent1
+  getBinContent2 = xform2 c_th1_getbincontent2
+  getBinContent3 = xform3 c_th1_getbincontent3
+  getBinError1 = xform1 c_th1_getbinerror1
+  getBinError2 = xform2 c_th1_getbinerror2
+  getBinError3 = xform3 c_th1_getbinerror3
+  getBinLowEdge = xform1 c_th1_getbinlowedge
+  getBinWidth = xform1 c_th1_getbinwidth
+  getCellContent = xform2 c_th1_getcellcontent
+  getCellError = xform2 c_th1_getcellerror
+  getEntries = xform0 c_th1_getentries
+  getEffectiveEntries = xform0 c_th1_geteffectiveentries
+  getFunction = xform1 c_th1_getfunction
+  getDimension = xform0 c_th1_getdimension
+  getKurtosis = xform1 c_th1_getkurtosis
+  getLowEdge = xform1 c_th1_getlowedge
+  getMaximumTH1 = xform1 c_th1_getmaximumth1
+  getMaximumBin = xform0 c_th1_getmaximumbin
+  getMaximumStored = xform0 c_th1_getmaximumstored
+  getMinimumTH1 = xform1 c_th1_getminimumth1
+  getMinimumBin = xform0 c_th1_getminimumbin
+  getMinimumStored = xform0 c_th1_getminimumstored
+  getMean = xform1 c_th1_getmean
+  getMeanError = xform1 c_th1_getmeanerror
+  getNbinsX = xform0 c_th1_getnbinsx
+  getNbinsY = xform0 c_th1_getnbinsy
+  getNbinsZ = xform0 c_th1_getnbinsz
+  getQuantilesTH1 = xform3 c_th1_getquantilesth1
+  getRandom = xform0 c_th1_getrandom
+  getStats = xform1 c_th1_getstats
+  getSumOfWeights = xform0 c_th1_getsumofweights
+  getSumw2 = xform0 c_th1_getsumw2
+  getSumw2N = xform0 c_th1_getsumw2n
+  getRMS = xform1 c_th1_getrms
+  getRMSError = xform1 c_th1_getrmserror
+  getSkewness = xform1 c_th1_getskewness
+  integral1 = xform3 c_th1_integral1
+  interpolate1 = xform1 c_th1_interpolate1
+  interpolate2 = xform2 c_th1_interpolate2
+  interpolate3 = xform3 c_th1_interpolate3
+  kolmogorovTest = xform2 c_th1_kolmogorovtest
+  labelsDeflate = xform1 c_th1_labelsdeflate
+  labelsInflate = xform1 c_th1_labelsinflate
+  labelsOption = xform2 c_th1_labelsoption
+  multiflyF = xform2 c_th1_multiflyf
+  multiply = xform5 c_th1_multiply
+  putStats = xform1 c_th1_putstats
+  rebin = xform3 c_th1_rebin
+  rebinAxis = xform2 c_th1_rebinaxis
+  rebuild = xform1 c_th1_rebuild
+  recursiveRemove = xform1 c_th1_recursiveremove
+  reset = xform1 c_th1_reset
+  resetStats = xform0 c_th1_resetstats
+  scale = xform2 c_th1_scale
+  setAxisColorA = xform2 c_th1_setaxiscolora
+  setAxisRange = xform3 c_th1_setaxisrange
+  setBarOffset = xform1 c_th1_setbaroffset
+  setBarWidth = xform1 c_th1_setbarwidth
+  setBinContent1 = xform2 c_th1_setbincontent1
+  setBinContent2 = xform3 c_th1_setbincontent2
+  setBinContent3 = xform4 c_th1_setbincontent3
+  setBinError1 = xform2 c_th1_setbinerror1
+  setBinError2 = xform3 c_th1_setbinerror2
+  setBinError3 = xform4 c_th1_setbinerror3
+  setBins1 = xform2 c_th1_setbins1
+  setBins2 = xform4 c_th1_setbins2
+  setBins3 = xform6 c_th1_setbins3
+  setBinsLength = xform1 c_th1_setbinslength
+  setBuffer = xform2 c_th1_setbuffer
+  setCellContent = xform3 c_th1_setcellcontent
+  setContent = xform1 c_th1_setcontent
+  setContour = xform2 c_th1_setcontour
+  setContourLevel = xform2 c_th1_setcontourlevel
+  setDirectory = xform1 c_th1_setdirectory
+  setEntries = xform1 c_th1_setentries
+  setError = xform1 c_th1_seterror
+  setLabelColorA = xform2 c_th1_setlabelcolora
+  setLabelSizeA = xform2 c_th1_setlabelsizea
+  setLabelFontA = xform2 c_th1_setlabelfonta
+  setLabelOffsetA = xform2 c_th1_setlabeloffseta
+  setMaximum = xform1 c_th1_setmaximum
+  setMinimum = xform1 c_th1_setminimum
+  setNormFactor = xform1 c_th1_setnormfactor
+  setStats = xform1 c_th1_setstats
+  setOption = xform1 c_th1_setoption
+  setXTitle = xform1 c_th1_setxtitle
+  setYTitle = xform1 c_th1_setytitle
+  setZTitle = xform1 c_th1_setztitle
+  showBackground = xform2 c_th1_showbackground
+  showPeaks = xform3 c_th1_showpeaks
+  smooth = xform2 c_th1_smooth
+  sumw2 = xform0 c_th1_sumw2
+instance ITObject TH1 where
+  draw = xform1 c_th1_draw
+  findObject = xform1 c_th1_findobject
+  getName = xform0 c_th1_getname
+  isA = xform0 c_th1_isa
+  paint = xform1 c_th1_paint
+  printObj = xform1 c_th1_printobj
+  saveAs = xform2 c_th1_saveas
+  write = xform3 c_th1_write
+instance ITAttLine TH1 where
+  getLineColor = xform0 c_th1_getlinecolor
+  getLineStyle = xform0 c_th1_getlinestyle
+  getLineWidth = xform0 c_th1_getlinewidth
+  resetAttLine = xform1 c_th1_resetattline
+  setLineAttributes = xform0 c_th1_setlineattributes
+  setLineColor = xform1 c_th1_setlinecolor
+  setLineStyle = xform1 c_th1_setlinestyle
+  setLineWidth = xform1 c_th1_setlinewidth
+instance ITAttFill TH1 where
+  setFillColor = xform1 c_th1_setfillcolor
+  setFillStyle = xform1 c_th1_setfillstyle
+instance ITAttMarker TH1 where
+  getMarkerColor = xform0 c_th1_getmarkercolor
+  getMarkerStyle = xform0 c_th1_getmarkerstyle
+  getMarkerSize = xform0 c_th1_getmarkersize
+  resetAttMarker = xform1 c_th1_resetattmarker
+  setMarkerAttributes = xform0 c_th1_setmarkerattributes
+  setMarkerColor = xform1 c_th1_setmarkercolor
+  setMarkerStyle = xform1 c_th1_setmarkerstyle
+  setMarkerSize = xform1 c_th1_setmarkersize
+instance IDeletable TH1 where
+  delete = xform0 c_th1_delete
+
+instance ITH1 (Exist TH1) where
+  add (ETH1 x) = add x
+  addBinContent (ETH1 x) = addBinContent x
+  chi2Test (ETH1 x) = chi2Test x
+  computeIntegral (ETH1 x) = computeIntegral x
+  directoryAutoAdd (ETH1 x) = directoryAutoAdd x
+  divide (ETH1 x) = divide x
+  drawCopyTH1 (ETH1 x) a1 = return . ETH1 =<< drawCopyTH1 x a1
+  drawNormalized (ETH1 x) = drawNormalized x
+  drawPanelTH1 (ETH1 x) = drawPanelTH1 x
+  bufferEmpty (ETH1 x) = bufferEmpty x
+  evalF (ETH1 x) = evalF x
+  fFT (ETH1 x) = fFT x
+  fill1 (ETH1 x) = fill1 x
+  fill1w (ETH1 x) = fill1w x
+  fillN1 (ETH1 x) = fillN1 x
+  fillRandom (ETH1 x) = fillRandom x
+  findBin (ETH1 x) = findBin x
+  findFixBin (ETH1 x) = findFixBin x
+  findFirstBinAbove (ETH1 x) = findFirstBinAbove x
+  findLastBinAbove (ETH1 x) = findLastBinAbove x
+  fitPanelTH1 (ETH1 x) = fitPanelTH1 x
+  getNdivisionA (ETH1 x) = getNdivisionA x
+  getAxisColorA (ETH1 x) = getAxisColorA x
+  getLabelColorA (ETH1 x) = getLabelColorA x
+  getLabelFontA (ETH1 x) = getLabelFontA x
+  getLabelOffsetA (ETH1 x) = getLabelOffsetA x
+  getLabelSizeA (ETH1 x) = getLabelSizeA x
+  getTitleFontA (ETH1 x) = getTitleFontA x
+  getTitleOffsetA (ETH1 x) = getTitleOffsetA x
+  getTitleSizeA (ETH1 x) = getTitleSizeA x
+  getTickLengthA (ETH1 x) = getTickLengthA x
+  getBarOffset (ETH1 x) = getBarOffset x
+  getBarWidth (ETH1 x) = getBarWidth x
+  getContour (ETH1 x) = getContour x
+  getContourLevel (ETH1 x) = getContourLevel x
+  getContourLevelPad (ETH1 x) = getContourLevelPad x
+  getBin (ETH1 x) = getBin x
+  getBinCenter (ETH1 x) = getBinCenter x
+  getBinContent1 (ETH1 x) = getBinContent1 x
+  getBinContent2 (ETH1 x) = getBinContent2 x
+  getBinContent3 (ETH1 x) = getBinContent3 x
+  getBinError1 (ETH1 x) = getBinError1 x
+  getBinError2 (ETH1 x) = getBinError2 x
+  getBinError3 (ETH1 x) = getBinError3 x
+  getBinLowEdge (ETH1 x) = getBinLowEdge x
+  getBinWidth (ETH1 x) = getBinWidth x
+  getCellContent (ETH1 x) = getCellContent x
+  getCellError (ETH1 x) = getCellError x
+  getEntries (ETH1 x) = getEntries x
+  getEffectiveEntries (ETH1 x) = getEffectiveEntries x
+  getFunction (ETH1 x) = getFunction x
+  getDimension (ETH1 x) = getDimension x
+  getKurtosis (ETH1 x) = getKurtosis x
+  getLowEdge (ETH1 x) = getLowEdge x
+  getMaximumTH1 (ETH1 x) = getMaximumTH1 x
+  getMaximumBin (ETH1 x) = getMaximumBin x
+  getMaximumStored (ETH1 x) = getMaximumStored x
+  getMinimumTH1 (ETH1 x) = getMinimumTH1 x
+  getMinimumBin (ETH1 x) = getMinimumBin x
+  getMinimumStored (ETH1 x) = getMinimumStored x
+  getMean (ETH1 x) = getMean x
+  getMeanError (ETH1 x) = getMeanError x
+  getNbinsX (ETH1 x) = getNbinsX x
+  getNbinsY (ETH1 x) = getNbinsY x
+  getNbinsZ (ETH1 x) = getNbinsZ x
+  getQuantilesTH1 (ETH1 x) = getQuantilesTH1 x
+  getRandom (ETH1 x) = getRandom x
+  getStats (ETH1 x) = getStats x
+  getSumOfWeights (ETH1 x) = getSumOfWeights x
+  getSumw2 (ETH1 x) = getSumw2 x
+  getSumw2N (ETH1 x) = getSumw2N x
+  getRMS (ETH1 x) = getRMS x
+  getRMSError (ETH1 x) = getRMSError x
+  getSkewness (ETH1 x) = getSkewness x
+  integral1 (ETH1 x) = integral1 x
+  interpolate1 (ETH1 x) = interpolate1 x
+  interpolate2 (ETH1 x) = interpolate2 x
+  interpolate3 (ETH1 x) = interpolate3 x
+  kolmogorovTest (ETH1 x) = kolmogorovTest x
+  labelsDeflate (ETH1 x) = labelsDeflate x
+  labelsInflate (ETH1 x) = labelsInflate x
+  labelsOption (ETH1 x) = labelsOption x
+  multiflyF (ETH1 x) = multiflyF x
+  multiply (ETH1 x) = multiply x
+  putStats (ETH1 x) = putStats x
+  rebin (ETH1 x) = rebin x
+  rebinAxis (ETH1 x) = rebinAxis x
+  rebuild (ETH1 x) = rebuild x
+  recursiveRemove (ETH1 x) = recursiveRemove x
+  reset (ETH1 x) = reset x
+  resetStats (ETH1 x) = resetStats x
+  scale (ETH1 x) = scale x
+  setAxisColorA (ETH1 x) = setAxisColorA x
+  setAxisRange (ETH1 x) = setAxisRange x
+  setBarOffset (ETH1 x) = setBarOffset x
+  setBarWidth (ETH1 x) = setBarWidth x
+  setBinContent1 (ETH1 x) = setBinContent1 x
+  setBinContent2 (ETH1 x) = setBinContent2 x
+  setBinContent3 (ETH1 x) = setBinContent3 x
+  setBinError1 (ETH1 x) = setBinError1 x
+  setBinError2 (ETH1 x) = setBinError2 x
+  setBinError3 (ETH1 x) = setBinError3 x
+  setBins1 (ETH1 x) = setBins1 x
+  setBins2 (ETH1 x) = setBins2 x
+  setBins3 (ETH1 x) = setBins3 x
+  setBinsLength (ETH1 x) = setBinsLength x
+  setBuffer (ETH1 x) = setBuffer x
+  setCellContent (ETH1 x) = setCellContent x
+  setContent (ETH1 x) = setContent x
+  setContour (ETH1 x) = setContour x
+  setContourLevel (ETH1 x) = setContourLevel x
+  setDirectory (ETH1 x) = setDirectory x
+  setEntries (ETH1 x) = setEntries x
+  setError (ETH1 x) = setError x
+  setLabelColorA (ETH1 x) = setLabelColorA x
+  setLabelSizeA (ETH1 x) = setLabelSizeA x
+  setLabelFontA (ETH1 x) = setLabelFontA x
+  setLabelOffsetA (ETH1 x) = setLabelOffsetA x
+  setMaximum (ETH1 x) = setMaximum x
+  setMinimum (ETH1 x) = setMinimum x
+  setNormFactor (ETH1 x) = setNormFactor x
+  setStats (ETH1 x) = setStats x
+  setOption (ETH1 x) = setOption x
+  setXTitle (ETH1 x) = setXTitle x
+  setYTitle (ETH1 x) = setYTitle x
+  setZTitle (ETH1 x) = setZTitle x
+  showBackground (ETH1 x) = showBackground x
+  showPeaks (ETH1 x) = showPeaks x
+  smooth (ETH1 x) = smooth x
+  sumw2 (ETH1 x) = sumw2 x
+instance ITObject (Exist TH1) where
+  draw (ETH1 x) = draw x
+  findObject (ETH1 x) = findObject x
+  getName (ETH1 x) = getName x
+  isA (ETH1 x) = isA x
+  paint (ETH1 x) = paint x
+  printObj (ETH1 x) = printObj x
+  saveAs (ETH1 x) = saveAs x
+  write (ETH1 x) = write x
+instance ITAttLine (Exist TH1) where
+  getLineColor (ETH1 x) = getLineColor x
+  getLineStyle (ETH1 x) = getLineStyle x
+  getLineWidth (ETH1 x) = getLineWidth x
+  resetAttLine (ETH1 x) = resetAttLine x
+  setLineAttributes (ETH1 x) = setLineAttributes x
+  setLineColor (ETH1 x) = setLineColor x
+  setLineStyle (ETH1 x) = setLineStyle x
+  setLineWidth (ETH1 x) = setLineWidth x
+instance ITAttFill (Exist TH1) where
+  setFillColor (ETH1 x) = setFillColor x
+  setFillStyle (ETH1 x) = setFillStyle x
+instance ITAttMarker (Exist TH1) where
+  getMarkerColor (ETH1 x) = getMarkerColor x
+  getMarkerStyle (ETH1 x) = getMarkerStyle x
+  getMarkerSize (ETH1 x) = getMarkerSize x
+  resetAttMarker (ETH1 x) = resetAttMarker x
+  setMarkerAttributes (ETH1 x) = setMarkerAttributes x
+  setMarkerColor (ETH1 x) = setMarkerColor x
+  setMarkerStyle (ETH1 x) = setMarkerStyle x
+  setMarkerSize (ETH1 x) = setMarkerSize x
+instance IDeletable (Exist TH1) where
+  delete (ETH1 x) = delete x
+
+
+
+tH1GetAsymmetry :: TH1 -> TH1 -> CDouble -> CDouble -> IO TH1
+tH1GetAsymmetry = xform3 c_th1_th1getasymmetry
+
+tH1GetBufferLength :: TH1 -> IO CInt
+tH1GetBufferLength = xform0 c_th1_th1getbufferlength
+
+tH1GetBufferSize :: TH1 -> IO CInt
+tH1GetBufferSize = xform0 c_th1_th1getbuffersize
+
+tH1GetDirectory :: TH1 -> IO TDirectory
+tH1GetDirectory = xform0 c_th1_th1getdirectory
+
+tH1IsBinOverflow :: TH1 -> CInt -> IO CInt
+tH1IsBinOverflow = xform1 c_th1_th1isbinoverflow
+
+tH1IsBinUnderflow :: TH1 -> CInt -> IO CInt
+tH1IsBinUnderflow = xform1 c_th1_th1isbinunderflow
+
+tH1UseCurrentStyle :: TH1 -> IO ()
+tH1UseCurrentStyle = xform0 c_th1_th1usecurrentstyle
+
+tH1GetDefaultBufferSize :: IO CInt
+tH1GetDefaultBufferSize = xformnull c_th1_th1getdefaultbuffersize
+
+tH1GetDefaultSumw2 :: IO CInt
+tH1GetDefaultSumw2 = xformnull c_th1_th1getdefaultsumw2
+
+tH1SetDefaultBufferSize :: CInt -> IO ()
+tH1SetDefaultBufferSize = xform0 c_th1_th1setdefaultbuffersize
+
+tH1SetDefaultSumw2 :: CInt -> IO ()
+tH1SetDefaultSumw2 = xform0 c_th1_th1setdefaultsumw2
+
+tH1SmoothArray :: CInt -> (Ptr CDouble) -> CInt -> IO ()
+tH1SmoothArray = xform2 c_th1_th1smootharray
+
+tH1StatOverflows :: CInt -> IO ()
+tH1StatOverflows = xform0 c_th1_th1statoverflows
+
+instance FPtr (Exist TH1) where
+  type Raw (Exist TH1) = RawTH1
+  get_fptr (ETH1 obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH1 (cast_fptr_to_obj (fptr :: ForeignPtr RawTH1) :: TH1)
diff --git a/src/HROOT/Hist/TH1/Interface.hs b/src/HROOT/Hist/TH1/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1/Interface.hs
@@ -0,0 +1,409 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH1.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH1.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.TDirectory.Interface
+---- ============ ----
+import {-# SOURCE #-} HROOT.Hist.TF1.Interface
+import {-# SOURCE #-} HROOT.Hist.TAxis.Interface
+
+-- |  the TH1 class : the mother class of all histogram classes 
+--   
+--   > class TH1 : TNamed, TAttLine, TAttFill, TAttMarker
+--   
+
+class (ITObject a,ITAttLine a,ITAttFill a,ITAttMarker a) => ITH1 a where
+    -- |  
+    --   > void TH1::Add( TH1* h1, Double_t c1 ) 
+    --   
+
+    add :: (ITH1 c0, FPtr c0) => a -> c0 -> CDouble -> IO () 
+    -- | 
+    --   > void TH1::AddBinContent( Int_t bin, Double_t w )
+    --   
+
+    addBinContent :: a -> CInt -> CDouble -> IO () 
+    -- | 
+    --   > Double_t TH1::Chi2Test( const TH1* h2, Option_t* option="UU", Double_t* res=0 ) const
+    --   
+
+    chi2Test :: (ITH1 c0, FPtr c0) => a -> c0 -> CString -> (Ptr CDouble) -> IO CDouble 
+    -- | 
+    --   > Double_t TH1::ComputeIntegral ()
+    --   
+
+    computeIntegral :: a -> IO CDouble 
+    -- | 
+    --   > void TH1::DirectoryAutoAdd(TDirectory* )
+    --   
+
+    directoryAutoAdd :: (ITDirectory c0, FPtr c0) => a -> c0 -> IO () 
+    -- | 
+    --   > void TH1::Divide(const TH1* h1, const TH1* h2, Double_t c1=1, Double_t c2=1, Option_t* option="")
+    --   
+
+    divide :: (ITH1 c1, FPtr c1, ITH1 c0, FPtr c0) => a -> c0 -> c1 -> CDouble -> CDouble -> CString -> IO () 
+
+    drawCopyTH1 :: a -> CString -> IO a 
+    -- | 
+    --   > TH1* TH1::DrawNormalized (Option_t* option="", Double_t norm=1) const
+    --   
+
+    drawNormalized :: a -> CString -> CDouble -> IO TH1 
+
+    drawPanelTH1 :: a -> IO () 
+
+    bufferEmpty :: a -> CInt -> IO CInt 
+
+    evalF :: (ITF1 c0, FPtr c0) => a -> c0 -> CString -> IO () 
+
+    fFT :: (ITH1 c0, FPtr c0) => a -> c0 -> CString -> IO TH1 
+
+    fill1 :: a -> CDouble -> IO CInt 
+
+    fill1w :: a -> CDouble -> CDouble -> IO CInt 
+
+    fillN1 :: a -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO () 
+
+    fillRandom :: (ITH1 c0, FPtr c0) => a -> c0 -> CInt -> IO () 
+
+    findBin :: a -> CDouble -> CDouble -> CDouble -> IO CInt 
+
+    findFixBin :: a -> CDouble -> CDouble -> CDouble -> IO CInt 
+
+    findFirstBinAbove :: a -> CDouble -> CInt -> IO CInt 
+
+    findLastBinAbove :: a -> CDouble -> CInt -> IO CInt 
+
+    fitPanelTH1 :: a -> IO () 
+
+    getNdivisionA :: a -> CString -> IO CInt 
+
+    getAxisColorA :: a -> CString -> IO CInt 
+
+    getLabelColorA :: a -> CString -> IO CInt 
+
+    getLabelFontA :: a -> CString -> IO CInt 
+
+    getLabelOffsetA :: a -> CString -> IO CDouble 
+
+    getLabelSizeA :: a -> CString -> IO CDouble 
+
+    getTitleFontA :: a -> CString -> IO CInt 
+
+    getTitleOffsetA :: a -> CString -> IO CDouble 
+
+    getTitleSizeA :: a -> CString -> IO CDouble 
+
+    getTickLengthA :: a -> CString -> IO CDouble 
+
+    getBarOffset :: a -> IO CDouble 
+
+    getBarWidth :: a -> IO CDouble 
+
+    getContour :: a -> (Ptr CDouble) -> IO CInt 
+
+    getContourLevel :: a -> CInt -> IO CDouble 
+
+    getContourLevelPad :: a -> CInt -> IO CDouble 
+
+    getBin :: a -> CInt -> CInt -> CInt -> IO CInt 
+
+    getBinCenter :: a -> CInt -> IO CDouble 
+
+    getBinContent1 :: a -> CInt -> IO CDouble 
+
+    getBinContent2 :: a -> CInt -> CInt -> IO CDouble 
+
+    getBinContent3 :: a -> CInt -> CInt -> CInt -> IO CDouble 
+
+    getBinError1 :: a -> CInt -> IO CDouble 
+
+    getBinError2 :: a -> CInt -> CInt -> IO CDouble 
+
+    getBinError3 :: a -> CInt -> CInt -> CInt -> IO CDouble 
+
+    getBinLowEdge :: a -> CInt -> IO CDouble 
+
+    getBinWidth :: a -> CInt -> IO CDouble 
+
+    getCellContent :: a -> CInt -> CInt -> IO CDouble 
+
+    getCellError :: a -> CInt -> CInt -> IO CDouble 
+
+    getEntries :: a -> IO CDouble 
+
+    getEffectiveEntries :: a -> IO CDouble 
+
+    getFunction :: a -> CString -> IO TF1 
+
+    getDimension :: a -> IO CInt 
+
+    getKurtosis :: a -> CInt -> IO CDouble 
+
+    getLowEdge :: a -> (Ptr CDouble) -> IO () 
+
+    getMaximumTH1 :: a -> CDouble -> IO CDouble 
+
+    getMaximumBin :: a -> IO CInt 
+
+    getMaximumStored :: a -> IO CDouble 
+
+    getMinimumTH1 :: a -> CDouble -> IO CDouble 
+
+    getMinimumBin :: a -> IO CInt 
+
+    getMinimumStored :: a -> IO CDouble 
+
+    getMean :: a -> CInt -> IO CDouble 
+
+    getMeanError :: a -> CInt -> IO CDouble 
+
+    getNbinsX :: a -> IO CDouble 
+
+    getNbinsY :: a -> IO CDouble 
+
+    getNbinsZ :: a -> IO CDouble 
+
+    getQuantilesTH1 :: a -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt 
+
+    getRandom :: a -> IO CDouble 
+    -- | 
+    --   > void     GetStats(Double_t *stats) const;
+    --   
+
+    getStats :: a -> (Ptr CDouble) -> IO () 
+
+    getSumOfWeights :: a -> IO CDouble 
+
+    getSumw2 :: a -> IO TArrayD 
+
+    getSumw2N :: a -> IO CInt 
+
+    getRMS :: a -> CInt -> IO CDouble 
+
+    getRMSError :: a -> CInt -> IO CDouble 
+
+    getSkewness :: a -> CInt -> IO CDouble 
+
+    integral1 :: a -> CInt -> CInt -> CString -> IO CDouble 
+    -- | 
+    --   > Double_t Interpolate(Double_t x)
+    --   
+
+    interpolate1 :: a -> CDouble -> IO CDouble 
+    -- | 
+    --   > Double_t Interpolate(Double_t x, Double_t y)
+    --   
+
+    interpolate2 :: a -> CDouble -> CDouble -> IO CDouble 
+    -- | 
+    --   > Double_t Interpolate(Double_t x, Double_t y, Double_t z)
+    --   
+
+    interpolate3 :: a -> CDouble -> CDouble -> CDouble -> IO CDouble 
+    -- | 
+    --   > Double_t KolmogorovTest(const TH1 *h2, Option_t *option="") const
+    --   
+
+    kolmogorovTest :: (ITH1 c0, FPtr c0) => a -> c0 -> CString -> IO CDouble 
+    -- | 
+    --   > void     LabelsDeflate(Option_t *axis="X")
+    --   
+
+    labelsDeflate :: a -> CString -> IO () 
+    -- | 
+    --   > void     LabelsInflate(Option_t *axis="X")
+    --   
+
+    labelsInflate :: a -> CString -> IO () 
+    -- | 
+    --   > void     LabelsOption(Option_t *option="h", Option_t *axis="X")
+    --   
+
+    labelsOption :: a -> CString -> CString -> IO () 
+
+    multiflyF :: (ITF1 c0, FPtr c0) => a -> c0 -> CDouble -> IO () 
+    -- | 
+    --   > void     Multiply(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option=""); // *MENU*
+    --   
+
+    multiply :: (ITH1 c1, FPtr c1, ITH1 c0, FPtr c0) => a -> c0 -> c1 -> CDouble -> CDouble -> CString -> IO () 
+    -- | 
+    --   > void     PutStats(Double_t *stats)
+    --   
+
+    putStats :: a -> (Ptr CDouble) -> IO () 
+    -- | 
+    --   > TH1     *Rebin(Int_t ngroup=2, const char*newname="", const Double_t *xbins=0);  // *MENU*
+    --   
+
+    rebin :: a -> CInt -> CString -> (Ptr CDouble) -> IO TH1 
+    -- | 
+    --   > void     RebinAxis(Double_t x, TAxis *axis)
+    --   
+
+    rebinAxis :: (ITAxis c0, FPtr c0) => a -> CDouble -> c0 -> IO () 
+    -- | 
+    --   > void     Rebuild(Option_t *option="")
+    --   
+
+    rebuild :: a -> CString -> IO () 
+    -- | 
+    --   > void     RecursiveRemove(TObject *obj)
+    --   
+
+    recursiveRemove :: (ITObject c0, FPtr c0) => a -> c0 -> IO () 
+    -- | 
+    --   > void     Reset(Option_t *option="")
+    --   
+
+    reset :: a -> CString -> IO () 
+    -- | 
+    --   > void     ResetStats()
+    --   
+
+    resetStats :: a -> IO () 
+    -- | 
+    --   > void     Scale(Double_t c1=1, Option_t *option="")
+    --   
+
+    scale :: a -> CDouble -> CString -> IO () 
+    -- | 
+    --   > void     SetAxisColor(Color_t color=1, Option_t *axis="X")
+    --   
+
+    setAxisColorA :: a -> CInt -> CString -> IO () 
+    -- | 
+    --   > void     SetAxisRange(Double_t xmin, Double_t xmax, Option_t *axis="X")
+    --   
+
+    setAxisRange :: a -> CDouble -> CDouble -> CString -> IO () 
+    -- | 
+    --   > void     SetBarOffset(Float_t offset=0.25)
+    --   
+
+    setBarOffset :: a -> CDouble -> IO () 
+    -- | 
+    --   > void     SetBarWidth(Float_t width=0.5) 
+    --   
+
+    setBarWidth :: a -> CDouble -> IO () 
+    -- | 
+    --   > void     SetBinContent(Int_t bin, Double_t content)
+    --   
+
+    setBinContent1 :: a -> CInt -> CDouble -> IO () 
+    -- | 
+    --   > void     SetBinContent(Int_t binx, Int_t biny, Double_t content)
+    --   
+
+    setBinContent2 :: a -> CInt -> CInt -> CDouble -> IO () 
+    -- | 
+    --   > void     SetBinContent(Int_t binx, Int_t biny, Int_t binz, Double_t content)
+    --   
+
+    setBinContent3 :: a -> CInt -> CInt -> CInt -> CDouble -> IO () 
+
+    setBinError1 :: a -> CInt -> CDouble -> IO () 
+
+    setBinError2 :: a -> CInt -> CInt -> CDouble -> IO () 
+
+    setBinError3 :: a -> CInt -> CInt -> CInt -> CDouble -> IO () 
+
+    setBins1 :: a -> CInt -> (Ptr CDouble) -> IO () 
+
+    setBins2 :: a -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO () 
+
+    setBins3 :: a -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO () 
+
+    setBinsLength :: a -> CInt -> IO () 
+
+    setBuffer :: a -> CInt -> CString -> IO () 
+
+    setCellContent :: a -> CInt -> CInt -> CDouble -> IO () 
+
+    setContent :: a -> (Ptr CDouble) -> IO () 
+
+    setContour :: a -> CInt -> (Ptr CDouble) -> IO () 
+
+    setContourLevel :: a -> CInt -> CDouble -> IO () 
+
+    setDirectory :: (ITDirectory c0, FPtr c0) => a -> c0 -> IO () 
+
+    setEntries :: a -> CDouble -> IO () 
+
+    setError :: a -> (Ptr CDouble) -> IO () 
+
+    setLabelColorA :: a -> CInt -> CString -> IO () 
+
+    setLabelSizeA :: a -> CDouble -> CString -> IO () 
+
+    setLabelFontA :: a -> CInt -> CString -> IO () 
+
+    setLabelOffsetA :: a -> CDouble -> CString -> IO () 
+
+    setMaximum :: a -> CDouble -> IO () 
+
+    setMinimum :: a -> CDouble -> IO () 
+
+    setNormFactor :: a -> CDouble -> IO () 
+
+    setStats :: a -> CInt -> IO () 
+
+    setOption :: a -> CString -> IO () 
+
+    setXTitle :: a -> CString -> IO () 
+
+    setYTitle :: a -> CString -> IO () 
+
+    setZTitle :: a -> CString -> IO () 
+    -- | 
+    --   > TH1     *ShowBackground(Int_t niter=20, Option_t *option="same");
+    --   
+
+    showBackground :: a -> CInt -> CString -> IO TH1 
+    -- | 
+    --   > Int_t    ShowPeaks(Double_t sigma=2, Option_t *option="", Double_t threshold=0.05); // *MENU*
+    --   
+
+    showPeaks :: a -> CDouble -> CString -> CDouble -> IO CInt 
+    -- | 
+    --   > void     Smooth(Int_t ntimes=1, Option_t *option=""); // *MENU*
+    --   
+
+    smooth :: a -> CInt -> CString -> IO () 
+
+    sumw2 :: a -> IO () 
+
+instance Existable TH1 where
+  data Exist TH1 = forall a. (FPtr a, ITH1 a) => ETH1 a
+
+upcastTH1 :: (FPtr a, ITH1 a) => a -> TH1
+upcastTH1 h = let fh = get_fptr h
+                  fh2 :: ForeignPtr RawTH1 = castForeignPtr fh
+              in cast_fptr_to_obj fh2
+
+downcastTH1 :: (FPtr a, ITH1 a) => TH1 -> a 
+downcastTH1 h = let fh = get_fptr h
+                    fh2 = castForeignPtr fh
+                in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH1/RawType.hs b/src/HROOT/Hist/TH1/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH1.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH1
+newtype TH1 = TH1 (ForeignPtr RawTH1) deriving (Eq, Ord, Show)
+instance FPtr TH1 where
+   type Raw TH1 = RawTH1
+   get_fptr (TH1 fptr) = fptr
+   cast_fptr_to_obj = TH1
diff --git a/src/HROOT/Hist/TH1C.hs b/src/HROOT/Hist/TH1C.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1C.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TH1C
+  (
+    TH1C(..)
+  , ITH1C
+  , upcastTH1C
+  , downcastTH1C
+
+ 
+  ) where
+
+import HROOT.Hist.TH1C.RawType
+import HROOT.Hist.TH1C.Interface
+import HROOT.Hist.TH1C.Implementation
+
+
diff --git a/src/HROOT/Hist/TH1C/Cast.hs b/src/HROOT/Hist/TH1C/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1C/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH1C.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH1C.RawType
+import HROOT.Hist.TH1C.Interface
+
+instance (ITH1C a, FPtr a) => Castable a (Ptr RawTH1C) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH1C (Ptr RawTH1C) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH1C/FFI.hsc b/src/HROOT/Hist/TH1C/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1C/FFI.hsc
@@ -0,0 +1,496 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH1C.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH1C.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTH1C.h"
+
+foreign import ccall "HROOTHistTH1C.h TH1C_Add" c_th1c_add 
+  :: (Ptr RawTH1C) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_AddBinContent" c_th1c_addbincontent 
+  :: (Ptr RawTH1C) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_Chi2Test" c_th1c_chi2test 
+  :: (Ptr RawTH1C) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_ComputeIntegral" c_th1c_computeintegral 
+  :: (Ptr RawTH1C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_DirectoryAutoAdd" c_th1c_directoryautoadd 
+  :: (Ptr RawTH1C) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_Divide" c_th1c_divide 
+  :: (Ptr RawTH1C) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_drawCopyTH1" c_th1c_drawcopyth1 
+  :: (Ptr RawTH1C) -> CString -> IO (Ptr RawTH1C)
+
+foreign import ccall "HROOTHistTH1C.h TH1C_DrawNormalized" c_th1c_drawnormalized 
+  :: (Ptr RawTH1C) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1C.h TH1C_drawPanelTH1" c_th1c_drawpanelth1 
+  :: (Ptr RawTH1C) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_BufferEmpty" c_th1c_bufferempty 
+  :: (Ptr RawTH1C) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_evalF" c_th1c_evalf 
+  :: (Ptr RawTH1C) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_FFT" c_th1c_fft 
+  :: (Ptr RawTH1C) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1C.h TH1C_fill1" c_th1c_fill1 
+  :: (Ptr RawTH1C) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_fill1w" c_th1c_fill1w 
+  :: (Ptr RawTH1C) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_fillN1" c_th1c_filln1 
+  :: (Ptr RawTH1C) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_FillRandom" c_th1c_fillrandom 
+  :: (Ptr RawTH1C) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_FindBin" c_th1c_findbin 
+  :: (Ptr RawTH1C) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_FindFixBin" c_th1c_findfixbin 
+  :: (Ptr RawTH1C) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_FindFirstBinAbove" c_th1c_findfirstbinabove 
+  :: (Ptr RawTH1C) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_FindLastBinAbove" c_th1c_findlastbinabove 
+  :: (Ptr RawTH1C) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_FitPanelTH1" c_th1c_fitpanelth1 
+  :: (Ptr RawTH1C) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_getNdivisionA" c_th1c_getndivisiona 
+  :: (Ptr RawTH1C) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_getAxisColorA" c_th1c_getaxiscolora 
+  :: (Ptr RawTH1C) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_getLabelColorA" c_th1c_getlabelcolora 
+  :: (Ptr RawTH1C) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_getLabelFontA" c_th1c_getlabelfonta 
+  :: (Ptr RawTH1C) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_getLabelOffsetA" c_th1c_getlabeloffseta 
+  :: (Ptr RawTH1C) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_getLabelSizeA" c_th1c_getlabelsizea 
+  :: (Ptr RawTH1C) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_getTitleFontA" c_th1c_gettitlefonta 
+  :: (Ptr RawTH1C) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_getTitleOffsetA" c_th1c_gettitleoffseta 
+  :: (Ptr RawTH1C) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_getTitleSizeA" c_th1c_gettitlesizea 
+  :: (Ptr RawTH1C) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_getTickLengthA" c_th1c_getticklengtha 
+  :: (Ptr RawTH1C) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetBarOffset" c_th1c_getbaroffset 
+  :: (Ptr RawTH1C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetBarWidth" c_th1c_getbarwidth 
+  :: (Ptr RawTH1C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetContour" c_th1c_getcontour 
+  :: (Ptr RawTH1C) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetContourLevel" c_th1c_getcontourlevel 
+  :: (Ptr RawTH1C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetContourLevelPad" c_th1c_getcontourlevelpad 
+  :: (Ptr RawTH1C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetBin" c_th1c_getbin 
+  :: (Ptr RawTH1C) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetBinCenter" c_th1c_getbincenter 
+  :: (Ptr RawTH1C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetBinContent1" c_th1c_getbincontent1 
+  :: (Ptr RawTH1C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetBinContent2" c_th1c_getbincontent2 
+  :: (Ptr RawTH1C) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetBinContent3" c_th1c_getbincontent3 
+  :: (Ptr RawTH1C) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetBinError1" c_th1c_getbinerror1 
+  :: (Ptr RawTH1C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetBinError2" c_th1c_getbinerror2 
+  :: (Ptr RawTH1C) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetBinError3" c_th1c_getbinerror3 
+  :: (Ptr RawTH1C) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetBinLowEdge" c_th1c_getbinlowedge 
+  :: (Ptr RawTH1C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetBinWidth" c_th1c_getbinwidth 
+  :: (Ptr RawTH1C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetCellContent" c_th1c_getcellcontent 
+  :: (Ptr RawTH1C) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetCellError" c_th1c_getcellerror 
+  :: (Ptr RawTH1C) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetEntries" c_th1c_getentries 
+  :: (Ptr RawTH1C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetEffectiveEntries" c_th1c_geteffectiveentries 
+  :: (Ptr RawTH1C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetFunction" c_th1c_getfunction 
+  :: (Ptr RawTH1C) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetDimension" c_th1c_getdimension 
+  :: (Ptr RawTH1C) -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetKurtosis" c_th1c_getkurtosis 
+  :: (Ptr RawTH1C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetLowEdge" c_th1c_getlowedge 
+  :: (Ptr RawTH1C) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_getMaximumTH1" c_th1c_getmaximumth1 
+  :: (Ptr RawTH1C) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetMaximumBin" c_th1c_getmaximumbin 
+  :: (Ptr RawTH1C) -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetMaximumStored" c_th1c_getmaximumstored 
+  :: (Ptr RawTH1C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_getMinimumTH1" c_th1c_getminimumth1 
+  :: (Ptr RawTH1C) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetMinimumBin" c_th1c_getminimumbin 
+  :: (Ptr RawTH1C) -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetMinimumStored" c_th1c_getminimumstored 
+  :: (Ptr RawTH1C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetMean" c_th1c_getmean 
+  :: (Ptr RawTH1C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetMeanError" c_th1c_getmeanerror 
+  :: (Ptr RawTH1C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetNbinsX" c_th1c_getnbinsx 
+  :: (Ptr RawTH1C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetNbinsY" c_th1c_getnbinsy 
+  :: (Ptr RawTH1C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetNbinsZ" c_th1c_getnbinsz 
+  :: (Ptr RawTH1C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_getQuantilesTH1" c_th1c_getquantilesth1 
+  :: (Ptr RawTH1C) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetRandom" c_th1c_getrandom 
+  :: (Ptr RawTH1C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetStats" c_th1c_getstats 
+  :: (Ptr RawTH1C) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetSumOfWeights" c_th1c_getsumofweights 
+  :: (Ptr RawTH1C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetSumw2" c_th1c_getsumw2 
+  :: (Ptr RawTH1C) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetSumw2N" c_th1c_getsumw2n 
+  :: (Ptr RawTH1C) -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetRMS" c_th1c_getrms 
+  :: (Ptr RawTH1C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetRMSError" c_th1c_getrmserror 
+  :: (Ptr RawTH1C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetSkewness" c_th1c_getskewness 
+  :: (Ptr RawTH1C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_integral1" c_th1c_integral1 
+  :: (Ptr RawTH1C) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_interpolate1" c_th1c_interpolate1 
+  :: (Ptr RawTH1C) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_interpolate2" c_th1c_interpolate2 
+  :: (Ptr RawTH1C) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_interpolate3" c_th1c_interpolate3 
+  :: (Ptr RawTH1C) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_KolmogorovTest" c_th1c_kolmogorovtest 
+  :: (Ptr RawTH1C) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_LabelsDeflate" c_th1c_labelsdeflate 
+  :: (Ptr RawTH1C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_LabelsInflate" c_th1c_labelsinflate 
+  :: (Ptr RawTH1C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_LabelsOption" c_th1c_labelsoption 
+  :: (Ptr RawTH1C) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_multiflyF" c_th1c_multiflyf 
+  :: (Ptr RawTH1C) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_Multiply" c_th1c_multiply 
+  :: (Ptr RawTH1C) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_PutStats" c_th1c_putstats 
+  :: (Ptr RawTH1C) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_Rebin" c_th1c_rebin 
+  :: (Ptr RawTH1C) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1C.h TH1C_RebinAxis" c_th1c_rebinaxis 
+  :: (Ptr RawTH1C) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_Rebuild" c_th1c_rebuild 
+  :: (Ptr RawTH1C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_RecursiveRemove" c_th1c_recursiveremove 
+  :: (Ptr RawTH1C) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_Reset" c_th1c_reset 
+  :: (Ptr RawTH1C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_ResetStats" c_th1c_resetstats 
+  :: (Ptr RawTH1C) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_Scale" c_th1c_scale 
+  :: (Ptr RawTH1C) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_setAxisColorA" c_th1c_setaxiscolora 
+  :: (Ptr RawTH1C) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetAxisRange" c_th1c_setaxisrange 
+  :: (Ptr RawTH1C) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetBarOffset" c_th1c_setbaroffset 
+  :: (Ptr RawTH1C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetBarWidth" c_th1c_setbarwidth 
+  :: (Ptr RawTH1C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_setBinContent1" c_th1c_setbincontent1 
+  :: (Ptr RawTH1C) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_setBinContent2" c_th1c_setbincontent2 
+  :: (Ptr RawTH1C) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_setBinContent3" c_th1c_setbincontent3 
+  :: (Ptr RawTH1C) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_setBinError1" c_th1c_setbinerror1 
+  :: (Ptr RawTH1C) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_setBinError2" c_th1c_setbinerror2 
+  :: (Ptr RawTH1C) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_setBinError3" c_th1c_setbinerror3 
+  :: (Ptr RawTH1C) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_setBins1" c_th1c_setbins1 
+  :: (Ptr RawTH1C) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_setBins2" c_th1c_setbins2 
+  :: (Ptr RawTH1C) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_setBins3" c_th1c_setbins3 
+  :: (Ptr RawTH1C) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetBinsLength" c_th1c_setbinslength 
+  :: (Ptr RawTH1C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetBuffer" c_th1c_setbuffer 
+  :: (Ptr RawTH1C) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetCellContent" c_th1c_setcellcontent 
+  :: (Ptr RawTH1C) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetContent" c_th1c_setcontent 
+  :: (Ptr RawTH1C) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetContour" c_th1c_setcontour 
+  :: (Ptr RawTH1C) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetContourLevel" c_th1c_setcontourlevel 
+  :: (Ptr RawTH1C) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetDirectory" c_th1c_setdirectory 
+  :: (Ptr RawTH1C) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetEntries" c_th1c_setentries 
+  :: (Ptr RawTH1C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetError" c_th1c_seterror 
+  :: (Ptr RawTH1C) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_setLabelColorA" c_th1c_setlabelcolora 
+  :: (Ptr RawTH1C) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_setLabelSizeA" c_th1c_setlabelsizea 
+  :: (Ptr RawTH1C) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_setLabelFontA" c_th1c_setlabelfonta 
+  :: (Ptr RawTH1C) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_setLabelOffsetA" c_th1c_setlabeloffseta 
+  :: (Ptr RawTH1C) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetMaximum" c_th1c_setmaximum 
+  :: (Ptr RawTH1C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetMinimum" c_th1c_setminimum 
+  :: (Ptr RawTH1C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetNormFactor" c_th1c_setnormfactor 
+  :: (Ptr RawTH1C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetStats" c_th1c_setstats 
+  :: (Ptr RawTH1C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetOption" c_th1c_setoption 
+  :: (Ptr RawTH1C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetXTitle" c_th1c_setxtitle 
+  :: (Ptr RawTH1C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetYTitle" c_th1c_setytitle 
+  :: (Ptr RawTH1C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetZTitle" c_th1c_setztitle 
+  :: (Ptr RawTH1C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_ShowBackground" c_th1c_showbackground 
+  :: (Ptr RawTH1C) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1C.h TH1C_ShowPeaks" c_th1c_showpeaks 
+  :: (Ptr RawTH1C) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_Smooth" c_th1c_smooth 
+  :: (Ptr RawTH1C) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_Sumw2" c_th1c_sumw2 
+  :: (Ptr RawTH1C) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_Draw" c_th1c_draw 
+  :: (Ptr RawTH1C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_FindObject" c_th1c_findobject 
+  :: (Ptr RawTH1C) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetName" c_th1c_getname 
+  :: (Ptr RawTH1C) -> IO CString
+
+foreign import ccall "HROOTHistTH1C.h TH1C_IsA" c_th1c_isa 
+  :: (Ptr RawTH1C) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH1C.h TH1C_Paint" c_th1c_paint 
+  :: (Ptr RawTH1C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_printObj" c_th1c_printobj 
+  :: (Ptr RawTH1C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SaveAs" c_th1c_saveas 
+  :: (Ptr RawTH1C) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_Write" c_th1c_write 
+  :: (Ptr RawTH1C) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetLineColor" c_th1c_getlinecolor 
+  :: (Ptr RawTH1C) -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetLineStyle" c_th1c_getlinestyle 
+  :: (Ptr RawTH1C) -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetLineWidth" c_th1c_getlinewidth 
+  :: (Ptr RawTH1C) -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_ResetAttLine" c_th1c_resetattline 
+  :: (Ptr RawTH1C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetLineAttributes" c_th1c_setlineattributes 
+  :: (Ptr RawTH1C) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetLineColor" c_th1c_setlinecolor 
+  :: (Ptr RawTH1C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetLineStyle" c_th1c_setlinestyle 
+  :: (Ptr RawTH1C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetLineWidth" c_th1c_setlinewidth 
+  :: (Ptr RawTH1C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetFillColor" c_th1c_setfillcolor 
+  :: (Ptr RawTH1C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetFillStyle" c_th1c_setfillstyle 
+  :: (Ptr RawTH1C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetMarkerColor" c_th1c_getmarkercolor 
+  :: (Ptr RawTH1C) -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetMarkerStyle" c_th1c_getmarkerstyle 
+  :: (Ptr RawTH1C) -> IO CInt
+
+foreign import ccall "HROOTHistTH1C.h TH1C_GetMarkerSize" c_th1c_getmarkersize 
+  :: (Ptr RawTH1C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1C.h TH1C_ResetAttMarker" c_th1c_resetattmarker 
+  :: (Ptr RawTH1C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetMarkerAttributes" c_th1c_setmarkerattributes 
+  :: (Ptr RawTH1C) -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetMarkerColor" c_th1c_setmarkercolor 
+  :: (Ptr RawTH1C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetMarkerStyle" c_th1c_setmarkerstyle 
+  :: (Ptr RawTH1C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_SetMarkerSize" c_th1c_setmarkersize 
+  :: (Ptr RawTH1C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1C.h TH1C_delete" c_th1c_delete 
+  :: (Ptr RawTH1C) -> IO ()
+
diff --git a/src/HROOT/Hist/TH1C/Implementation.hs b/src/HROOT/Hist/TH1C/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1C/Implementation.hs
@@ -0,0 +1,408 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH1C.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH1C.RawType
+import HROOT.Hist.TH1C.FFI
+import HROOT.Hist.TH1C.Interface
+import HROOT.Hist.TH1C.Cast
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TArrayC.RawType
+import HROOT.Core.TArrayC.Cast
+import HROOT.Core.TArrayC.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+import HROOT.Core.TArray.RawType
+import HROOT.Core.TArray.Cast
+import HROOT.Core.TArray.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH1C TH1C where
+instance ITH1 TH1C where
+  add = xform2 c_th1c_add
+  addBinContent = xform2 c_th1c_addbincontent
+  chi2Test = xform3 c_th1c_chi2test
+  computeIntegral = xform0 c_th1c_computeintegral
+  directoryAutoAdd = xform1 c_th1c_directoryautoadd
+  divide = xform5 c_th1c_divide
+  drawCopyTH1 = xform1 c_th1c_drawcopyth1
+  drawNormalized = xform2 c_th1c_drawnormalized
+  drawPanelTH1 = xform0 c_th1c_drawpanelth1
+  bufferEmpty = xform1 c_th1c_bufferempty
+  evalF = xform2 c_th1c_evalf
+  fFT = xform2 c_th1c_fft
+  fill1 = xform1 c_th1c_fill1
+  fill1w = xform2 c_th1c_fill1w
+  fillN1 = xform4 c_th1c_filln1
+  fillRandom = xform2 c_th1c_fillrandom
+  findBin = xform3 c_th1c_findbin
+  findFixBin = xform3 c_th1c_findfixbin
+  findFirstBinAbove = xform2 c_th1c_findfirstbinabove
+  findLastBinAbove = xform2 c_th1c_findlastbinabove
+  fitPanelTH1 = xform0 c_th1c_fitpanelth1
+  getNdivisionA = xform1 c_th1c_getndivisiona
+  getAxisColorA = xform1 c_th1c_getaxiscolora
+  getLabelColorA = xform1 c_th1c_getlabelcolora
+  getLabelFontA = xform1 c_th1c_getlabelfonta
+  getLabelOffsetA = xform1 c_th1c_getlabeloffseta
+  getLabelSizeA = xform1 c_th1c_getlabelsizea
+  getTitleFontA = xform1 c_th1c_gettitlefonta
+  getTitleOffsetA = xform1 c_th1c_gettitleoffseta
+  getTitleSizeA = xform1 c_th1c_gettitlesizea
+  getTickLengthA = xform1 c_th1c_getticklengtha
+  getBarOffset = xform0 c_th1c_getbaroffset
+  getBarWidth = xform0 c_th1c_getbarwidth
+  getContour = xform1 c_th1c_getcontour
+  getContourLevel = xform1 c_th1c_getcontourlevel
+  getContourLevelPad = xform1 c_th1c_getcontourlevelpad
+  getBin = xform3 c_th1c_getbin
+  getBinCenter = xform1 c_th1c_getbincenter
+  getBinContent1 = xform1 c_th1c_getbincontent1
+  getBinContent2 = xform2 c_th1c_getbincontent2
+  getBinContent3 = xform3 c_th1c_getbincontent3
+  getBinError1 = xform1 c_th1c_getbinerror1
+  getBinError2 = xform2 c_th1c_getbinerror2
+  getBinError3 = xform3 c_th1c_getbinerror3
+  getBinLowEdge = xform1 c_th1c_getbinlowedge
+  getBinWidth = xform1 c_th1c_getbinwidth
+  getCellContent = xform2 c_th1c_getcellcontent
+  getCellError = xform2 c_th1c_getcellerror
+  getEntries = xform0 c_th1c_getentries
+  getEffectiveEntries = xform0 c_th1c_geteffectiveentries
+  getFunction = xform1 c_th1c_getfunction
+  getDimension = xform0 c_th1c_getdimension
+  getKurtosis = xform1 c_th1c_getkurtosis
+  getLowEdge = xform1 c_th1c_getlowedge
+  getMaximumTH1 = xform1 c_th1c_getmaximumth1
+  getMaximumBin = xform0 c_th1c_getmaximumbin
+  getMaximumStored = xform0 c_th1c_getmaximumstored
+  getMinimumTH1 = xform1 c_th1c_getminimumth1
+  getMinimumBin = xform0 c_th1c_getminimumbin
+  getMinimumStored = xform0 c_th1c_getminimumstored
+  getMean = xform1 c_th1c_getmean
+  getMeanError = xform1 c_th1c_getmeanerror
+  getNbinsX = xform0 c_th1c_getnbinsx
+  getNbinsY = xform0 c_th1c_getnbinsy
+  getNbinsZ = xform0 c_th1c_getnbinsz
+  getQuantilesTH1 = xform3 c_th1c_getquantilesth1
+  getRandom = xform0 c_th1c_getrandom
+  getStats = xform1 c_th1c_getstats
+  getSumOfWeights = xform0 c_th1c_getsumofweights
+  getSumw2 = xform0 c_th1c_getsumw2
+  getSumw2N = xform0 c_th1c_getsumw2n
+  getRMS = xform1 c_th1c_getrms
+  getRMSError = xform1 c_th1c_getrmserror
+  getSkewness = xform1 c_th1c_getskewness
+  integral1 = xform3 c_th1c_integral1
+  interpolate1 = xform1 c_th1c_interpolate1
+  interpolate2 = xform2 c_th1c_interpolate2
+  interpolate3 = xform3 c_th1c_interpolate3
+  kolmogorovTest = xform2 c_th1c_kolmogorovtest
+  labelsDeflate = xform1 c_th1c_labelsdeflate
+  labelsInflate = xform1 c_th1c_labelsinflate
+  labelsOption = xform2 c_th1c_labelsoption
+  multiflyF = xform2 c_th1c_multiflyf
+  multiply = xform5 c_th1c_multiply
+  putStats = xform1 c_th1c_putstats
+  rebin = xform3 c_th1c_rebin
+  rebinAxis = xform2 c_th1c_rebinaxis
+  rebuild = xform1 c_th1c_rebuild
+  recursiveRemove = xform1 c_th1c_recursiveremove
+  reset = xform1 c_th1c_reset
+  resetStats = xform0 c_th1c_resetstats
+  scale = xform2 c_th1c_scale
+  setAxisColorA = xform2 c_th1c_setaxiscolora
+  setAxisRange = xform3 c_th1c_setaxisrange
+  setBarOffset = xform1 c_th1c_setbaroffset
+  setBarWidth = xform1 c_th1c_setbarwidth
+  setBinContent1 = xform2 c_th1c_setbincontent1
+  setBinContent2 = xform3 c_th1c_setbincontent2
+  setBinContent3 = xform4 c_th1c_setbincontent3
+  setBinError1 = xform2 c_th1c_setbinerror1
+  setBinError2 = xform3 c_th1c_setbinerror2
+  setBinError3 = xform4 c_th1c_setbinerror3
+  setBins1 = xform2 c_th1c_setbins1
+  setBins2 = xform4 c_th1c_setbins2
+  setBins3 = xform6 c_th1c_setbins3
+  setBinsLength = xform1 c_th1c_setbinslength
+  setBuffer = xform2 c_th1c_setbuffer
+  setCellContent = xform3 c_th1c_setcellcontent
+  setContent = xform1 c_th1c_setcontent
+  setContour = xform2 c_th1c_setcontour
+  setContourLevel = xform2 c_th1c_setcontourlevel
+  setDirectory = xform1 c_th1c_setdirectory
+  setEntries = xform1 c_th1c_setentries
+  setError = xform1 c_th1c_seterror
+  setLabelColorA = xform2 c_th1c_setlabelcolora
+  setLabelSizeA = xform2 c_th1c_setlabelsizea
+  setLabelFontA = xform2 c_th1c_setlabelfonta
+  setLabelOffsetA = xform2 c_th1c_setlabeloffseta
+  setMaximum = xform1 c_th1c_setmaximum
+  setMinimum = xform1 c_th1c_setminimum
+  setNormFactor = xform1 c_th1c_setnormfactor
+  setStats = xform1 c_th1c_setstats
+  setOption = xform1 c_th1c_setoption
+  setXTitle = xform1 c_th1c_setxtitle
+  setYTitle = xform1 c_th1c_setytitle
+  setZTitle = xform1 c_th1c_setztitle
+  showBackground = xform2 c_th1c_showbackground
+  showPeaks = xform3 c_th1c_showpeaks
+  smooth = xform2 c_th1c_smooth
+  sumw2 = xform0 c_th1c_sumw2
+instance ITArrayC TH1C where
+instance ITObject TH1C where
+  draw = xform1 c_th1c_draw
+  findObject = xform1 c_th1c_findobject
+  getName = xform0 c_th1c_getname
+  isA = xform0 c_th1c_isa
+  paint = xform1 c_th1c_paint
+  printObj = xform1 c_th1c_printobj
+  saveAs = xform2 c_th1c_saveas
+  write = xform3 c_th1c_write
+instance ITAttLine TH1C where
+  getLineColor = xform0 c_th1c_getlinecolor
+  getLineStyle = xform0 c_th1c_getlinestyle
+  getLineWidth = xform0 c_th1c_getlinewidth
+  resetAttLine = xform1 c_th1c_resetattline
+  setLineAttributes = xform0 c_th1c_setlineattributes
+  setLineColor = xform1 c_th1c_setlinecolor
+  setLineStyle = xform1 c_th1c_setlinestyle
+  setLineWidth = xform1 c_th1c_setlinewidth
+instance ITAttFill TH1C where
+  setFillColor = xform1 c_th1c_setfillcolor
+  setFillStyle = xform1 c_th1c_setfillstyle
+instance ITAttMarker TH1C where
+  getMarkerColor = xform0 c_th1c_getmarkercolor
+  getMarkerStyle = xform0 c_th1c_getmarkerstyle
+  getMarkerSize = xform0 c_th1c_getmarkersize
+  resetAttMarker = xform1 c_th1c_resetattmarker
+  setMarkerAttributes = xform0 c_th1c_setmarkerattributes
+  setMarkerColor = xform1 c_th1c_setmarkercolor
+  setMarkerStyle = xform1 c_th1c_setmarkerstyle
+  setMarkerSize = xform1 c_th1c_setmarkersize
+instance IDeletable TH1C where
+  delete = xform0 c_th1c_delete
+instance ITArray TH1C where
+
+instance ITH1C (Exist TH1C) where
+
+instance ITH1 (Exist TH1C) where
+  add (ETH1C x) = add x
+  addBinContent (ETH1C x) = addBinContent x
+  chi2Test (ETH1C x) = chi2Test x
+  computeIntegral (ETH1C x) = computeIntegral x
+  directoryAutoAdd (ETH1C x) = directoryAutoAdd x
+  divide (ETH1C x) = divide x
+  drawCopyTH1 (ETH1C x) a1 = return . ETH1C =<< drawCopyTH1 x a1
+  drawNormalized (ETH1C x) = drawNormalized x
+  drawPanelTH1 (ETH1C x) = drawPanelTH1 x
+  bufferEmpty (ETH1C x) = bufferEmpty x
+  evalF (ETH1C x) = evalF x
+  fFT (ETH1C x) = fFT x
+  fill1 (ETH1C x) = fill1 x
+  fill1w (ETH1C x) = fill1w x
+  fillN1 (ETH1C x) = fillN1 x
+  fillRandom (ETH1C x) = fillRandom x
+  findBin (ETH1C x) = findBin x
+  findFixBin (ETH1C x) = findFixBin x
+  findFirstBinAbove (ETH1C x) = findFirstBinAbove x
+  findLastBinAbove (ETH1C x) = findLastBinAbove x
+  fitPanelTH1 (ETH1C x) = fitPanelTH1 x
+  getNdivisionA (ETH1C x) = getNdivisionA x
+  getAxisColorA (ETH1C x) = getAxisColorA x
+  getLabelColorA (ETH1C x) = getLabelColorA x
+  getLabelFontA (ETH1C x) = getLabelFontA x
+  getLabelOffsetA (ETH1C x) = getLabelOffsetA x
+  getLabelSizeA (ETH1C x) = getLabelSizeA x
+  getTitleFontA (ETH1C x) = getTitleFontA x
+  getTitleOffsetA (ETH1C x) = getTitleOffsetA x
+  getTitleSizeA (ETH1C x) = getTitleSizeA x
+  getTickLengthA (ETH1C x) = getTickLengthA x
+  getBarOffset (ETH1C x) = getBarOffset x
+  getBarWidth (ETH1C x) = getBarWidth x
+  getContour (ETH1C x) = getContour x
+  getContourLevel (ETH1C x) = getContourLevel x
+  getContourLevelPad (ETH1C x) = getContourLevelPad x
+  getBin (ETH1C x) = getBin x
+  getBinCenter (ETH1C x) = getBinCenter x
+  getBinContent1 (ETH1C x) = getBinContent1 x
+  getBinContent2 (ETH1C x) = getBinContent2 x
+  getBinContent3 (ETH1C x) = getBinContent3 x
+  getBinError1 (ETH1C x) = getBinError1 x
+  getBinError2 (ETH1C x) = getBinError2 x
+  getBinError3 (ETH1C x) = getBinError3 x
+  getBinLowEdge (ETH1C x) = getBinLowEdge x
+  getBinWidth (ETH1C x) = getBinWidth x
+  getCellContent (ETH1C x) = getCellContent x
+  getCellError (ETH1C x) = getCellError x
+  getEntries (ETH1C x) = getEntries x
+  getEffectiveEntries (ETH1C x) = getEffectiveEntries x
+  getFunction (ETH1C x) = getFunction x
+  getDimension (ETH1C x) = getDimension x
+  getKurtosis (ETH1C x) = getKurtosis x
+  getLowEdge (ETH1C x) = getLowEdge x
+  getMaximumTH1 (ETH1C x) = getMaximumTH1 x
+  getMaximumBin (ETH1C x) = getMaximumBin x
+  getMaximumStored (ETH1C x) = getMaximumStored x
+  getMinimumTH1 (ETH1C x) = getMinimumTH1 x
+  getMinimumBin (ETH1C x) = getMinimumBin x
+  getMinimumStored (ETH1C x) = getMinimumStored x
+  getMean (ETH1C x) = getMean x
+  getMeanError (ETH1C x) = getMeanError x
+  getNbinsX (ETH1C x) = getNbinsX x
+  getNbinsY (ETH1C x) = getNbinsY x
+  getNbinsZ (ETH1C x) = getNbinsZ x
+  getQuantilesTH1 (ETH1C x) = getQuantilesTH1 x
+  getRandom (ETH1C x) = getRandom x
+  getStats (ETH1C x) = getStats x
+  getSumOfWeights (ETH1C x) = getSumOfWeights x
+  getSumw2 (ETH1C x) = getSumw2 x
+  getSumw2N (ETH1C x) = getSumw2N x
+  getRMS (ETH1C x) = getRMS x
+  getRMSError (ETH1C x) = getRMSError x
+  getSkewness (ETH1C x) = getSkewness x
+  integral1 (ETH1C x) = integral1 x
+  interpolate1 (ETH1C x) = interpolate1 x
+  interpolate2 (ETH1C x) = interpolate2 x
+  interpolate3 (ETH1C x) = interpolate3 x
+  kolmogorovTest (ETH1C x) = kolmogorovTest x
+  labelsDeflate (ETH1C x) = labelsDeflate x
+  labelsInflate (ETH1C x) = labelsInflate x
+  labelsOption (ETH1C x) = labelsOption x
+  multiflyF (ETH1C x) = multiflyF x
+  multiply (ETH1C x) = multiply x
+  putStats (ETH1C x) = putStats x
+  rebin (ETH1C x) = rebin x
+  rebinAxis (ETH1C x) = rebinAxis x
+  rebuild (ETH1C x) = rebuild x
+  recursiveRemove (ETH1C x) = recursiveRemove x
+  reset (ETH1C x) = reset x
+  resetStats (ETH1C x) = resetStats x
+  scale (ETH1C x) = scale x
+  setAxisColorA (ETH1C x) = setAxisColorA x
+  setAxisRange (ETH1C x) = setAxisRange x
+  setBarOffset (ETH1C x) = setBarOffset x
+  setBarWidth (ETH1C x) = setBarWidth x
+  setBinContent1 (ETH1C x) = setBinContent1 x
+  setBinContent2 (ETH1C x) = setBinContent2 x
+  setBinContent3 (ETH1C x) = setBinContent3 x
+  setBinError1 (ETH1C x) = setBinError1 x
+  setBinError2 (ETH1C x) = setBinError2 x
+  setBinError3 (ETH1C x) = setBinError3 x
+  setBins1 (ETH1C x) = setBins1 x
+  setBins2 (ETH1C x) = setBins2 x
+  setBins3 (ETH1C x) = setBins3 x
+  setBinsLength (ETH1C x) = setBinsLength x
+  setBuffer (ETH1C x) = setBuffer x
+  setCellContent (ETH1C x) = setCellContent x
+  setContent (ETH1C x) = setContent x
+  setContour (ETH1C x) = setContour x
+  setContourLevel (ETH1C x) = setContourLevel x
+  setDirectory (ETH1C x) = setDirectory x
+  setEntries (ETH1C x) = setEntries x
+  setError (ETH1C x) = setError x
+  setLabelColorA (ETH1C x) = setLabelColorA x
+  setLabelSizeA (ETH1C x) = setLabelSizeA x
+  setLabelFontA (ETH1C x) = setLabelFontA x
+  setLabelOffsetA (ETH1C x) = setLabelOffsetA x
+  setMaximum (ETH1C x) = setMaximum x
+  setMinimum (ETH1C x) = setMinimum x
+  setNormFactor (ETH1C x) = setNormFactor x
+  setStats (ETH1C x) = setStats x
+  setOption (ETH1C x) = setOption x
+  setXTitle (ETH1C x) = setXTitle x
+  setYTitle (ETH1C x) = setYTitle x
+  setZTitle (ETH1C x) = setZTitle x
+  showBackground (ETH1C x) = showBackground x
+  showPeaks (ETH1C x) = showPeaks x
+  smooth (ETH1C x) = smooth x
+  sumw2 (ETH1C x) = sumw2 x
+instance ITArrayC (Exist TH1C) where
+
+instance ITObject (Exist TH1C) where
+  draw (ETH1C x) = draw x
+  findObject (ETH1C x) = findObject x
+  getName (ETH1C x) = getName x
+  isA (ETH1C x) = isA x
+  paint (ETH1C x) = paint x
+  printObj (ETH1C x) = printObj x
+  saveAs (ETH1C x) = saveAs x
+  write (ETH1C x) = write x
+instance ITAttLine (Exist TH1C) where
+  getLineColor (ETH1C x) = getLineColor x
+  getLineStyle (ETH1C x) = getLineStyle x
+  getLineWidth (ETH1C x) = getLineWidth x
+  resetAttLine (ETH1C x) = resetAttLine x
+  setLineAttributes (ETH1C x) = setLineAttributes x
+  setLineColor (ETH1C x) = setLineColor x
+  setLineStyle (ETH1C x) = setLineStyle x
+  setLineWidth (ETH1C x) = setLineWidth x
+instance ITAttFill (Exist TH1C) where
+  setFillColor (ETH1C x) = setFillColor x
+  setFillStyle (ETH1C x) = setFillStyle x
+instance ITAttMarker (Exist TH1C) where
+  getMarkerColor (ETH1C x) = getMarkerColor x
+  getMarkerStyle (ETH1C x) = getMarkerStyle x
+  getMarkerSize (ETH1C x) = getMarkerSize x
+  resetAttMarker (ETH1C x) = resetAttMarker x
+  setMarkerAttributes (ETH1C x) = setMarkerAttributes x
+  setMarkerColor (ETH1C x) = setMarkerColor x
+  setMarkerStyle (ETH1C x) = setMarkerStyle x
+  setMarkerSize (ETH1C x) = setMarkerSize x
+instance IDeletable (Exist TH1C) where
+  delete (ETH1C x) = delete x
+instance ITArray (Exist TH1C) where
+
+
+
+
+
+
+
+
+instance FPtr (Exist TH1C) where
+  type Raw (Exist TH1C) = RawTH1C
+  get_fptr (ETH1C obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH1C (cast_fptr_to_obj (fptr :: ForeignPtr RawTH1C) :: TH1C)
diff --git a/src/HROOT/Hist/TH1C/Interface.hs b/src/HROOT/Hist/TH1C/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1C/Interface.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH1C.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH1C.RawType
+
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TArrayC.Interface
+---- ============ ----
+
+
+
+class (ITH1 a,ITArrayC a) => ITH1C a where
+
+instance Existable TH1C where
+  data Exist TH1C = forall a. (FPtr a, ITH1C a) => ETH1C a
+
+upcastTH1C :: (FPtr a, ITH1C a) => a -> TH1C
+upcastTH1C h = let fh = get_fptr h
+                   fh2 :: ForeignPtr RawTH1C = castForeignPtr fh
+               in cast_fptr_to_obj fh2
+
+downcastTH1C :: (FPtr a, ITH1C a) => TH1C -> a 
+downcastTH1C h = let fh = get_fptr h
+                     fh2 = castForeignPtr fh
+                 in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH1C/RawType.hs b/src/HROOT/Hist/TH1C/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1C/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH1C.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH1C
+newtype TH1C = TH1C (ForeignPtr RawTH1C) deriving (Eq, Ord, Show)
+instance FPtr TH1C where
+   type Raw TH1C = RawTH1C
+   get_fptr (TH1C fptr) = fptr
+   cast_fptr_to_obj = TH1C
diff --git a/src/HROOT/Hist/TH1D.hs b/src/HROOT/Hist/TH1D.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1D.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TH1D
+  (
+    TH1D(..)
+  , ITH1D
+  , upcastTH1D
+  , downcastTH1D
+  , newTH1D
+ 
+  ) where
+
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1D.Interface
+import HROOT.Hist.TH1D.Implementation
+
+
diff --git a/src/HROOT/Hist/TH1D/Cast.hs b/src/HROOT/Hist/TH1D/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1D/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH1D.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1D.Interface
+
+instance (ITH1D a, FPtr a) => Castable a (Ptr RawTH1D) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH1D (Ptr RawTH1D) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH1D/FFI.hsc b/src/HROOT/Hist/TH1D/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1D/FFI.hsc
@@ -0,0 +1,499 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH1D.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTH1D.h"
+
+foreign import ccall "HROOTHistTH1D.h TH1D_Add" c_th1d_add 
+  :: (Ptr RawTH1D) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_AddBinContent" c_th1d_addbincontent 
+  :: (Ptr RawTH1D) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_Chi2Test" c_th1d_chi2test 
+  :: (Ptr RawTH1D) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_ComputeIntegral" c_th1d_computeintegral 
+  :: (Ptr RawTH1D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_DirectoryAutoAdd" c_th1d_directoryautoadd 
+  :: (Ptr RawTH1D) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_Divide" c_th1d_divide 
+  :: (Ptr RawTH1D) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_drawCopyTH1" c_th1d_drawcopyth1 
+  :: (Ptr RawTH1D) -> CString -> IO (Ptr RawTH1D)
+
+foreign import ccall "HROOTHistTH1D.h TH1D_DrawNormalized" c_th1d_drawnormalized 
+  :: (Ptr RawTH1D) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1D.h TH1D_drawPanelTH1" c_th1d_drawpanelth1 
+  :: (Ptr RawTH1D) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_BufferEmpty" c_th1d_bufferempty 
+  :: (Ptr RawTH1D) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_evalF" c_th1d_evalf 
+  :: (Ptr RawTH1D) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_FFT" c_th1d_fft 
+  :: (Ptr RawTH1D) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1D.h TH1D_fill1" c_th1d_fill1 
+  :: (Ptr RawTH1D) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_fill1w" c_th1d_fill1w 
+  :: (Ptr RawTH1D) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_fillN1" c_th1d_filln1 
+  :: (Ptr RawTH1D) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_FillRandom" c_th1d_fillrandom 
+  :: (Ptr RawTH1D) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_FindBin" c_th1d_findbin 
+  :: (Ptr RawTH1D) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_FindFixBin" c_th1d_findfixbin 
+  :: (Ptr RawTH1D) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_FindFirstBinAbove" c_th1d_findfirstbinabove 
+  :: (Ptr RawTH1D) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_FindLastBinAbove" c_th1d_findlastbinabove 
+  :: (Ptr RawTH1D) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_FitPanelTH1" c_th1d_fitpanelth1 
+  :: (Ptr RawTH1D) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_getNdivisionA" c_th1d_getndivisiona 
+  :: (Ptr RawTH1D) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_getAxisColorA" c_th1d_getaxiscolora 
+  :: (Ptr RawTH1D) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_getLabelColorA" c_th1d_getlabelcolora 
+  :: (Ptr RawTH1D) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_getLabelFontA" c_th1d_getlabelfonta 
+  :: (Ptr RawTH1D) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_getLabelOffsetA" c_th1d_getlabeloffseta 
+  :: (Ptr RawTH1D) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_getLabelSizeA" c_th1d_getlabelsizea 
+  :: (Ptr RawTH1D) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_getTitleFontA" c_th1d_gettitlefonta 
+  :: (Ptr RawTH1D) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_getTitleOffsetA" c_th1d_gettitleoffseta 
+  :: (Ptr RawTH1D) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_getTitleSizeA" c_th1d_gettitlesizea 
+  :: (Ptr RawTH1D) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_getTickLengthA" c_th1d_getticklengtha 
+  :: (Ptr RawTH1D) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetBarOffset" c_th1d_getbaroffset 
+  :: (Ptr RawTH1D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetBarWidth" c_th1d_getbarwidth 
+  :: (Ptr RawTH1D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetContour" c_th1d_getcontour 
+  :: (Ptr RawTH1D) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetContourLevel" c_th1d_getcontourlevel 
+  :: (Ptr RawTH1D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetContourLevelPad" c_th1d_getcontourlevelpad 
+  :: (Ptr RawTH1D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetBin" c_th1d_getbin 
+  :: (Ptr RawTH1D) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetBinCenter" c_th1d_getbincenter 
+  :: (Ptr RawTH1D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetBinContent1" c_th1d_getbincontent1 
+  :: (Ptr RawTH1D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetBinContent2" c_th1d_getbincontent2 
+  :: (Ptr RawTH1D) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetBinContent3" c_th1d_getbincontent3 
+  :: (Ptr RawTH1D) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetBinError1" c_th1d_getbinerror1 
+  :: (Ptr RawTH1D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetBinError2" c_th1d_getbinerror2 
+  :: (Ptr RawTH1D) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetBinError3" c_th1d_getbinerror3 
+  :: (Ptr RawTH1D) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetBinLowEdge" c_th1d_getbinlowedge 
+  :: (Ptr RawTH1D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetBinWidth" c_th1d_getbinwidth 
+  :: (Ptr RawTH1D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetCellContent" c_th1d_getcellcontent 
+  :: (Ptr RawTH1D) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetCellError" c_th1d_getcellerror 
+  :: (Ptr RawTH1D) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetEntries" c_th1d_getentries 
+  :: (Ptr RawTH1D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetEffectiveEntries" c_th1d_geteffectiveentries 
+  :: (Ptr RawTH1D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetFunction" c_th1d_getfunction 
+  :: (Ptr RawTH1D) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetDimension" c_th1d_getdimension 
+  :: (Ptr RawTH1D) -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetKurtosis" c_th1d_getkurtosis 
+  :: (Ptr RawTH1D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetLowEdge" c_th1d_getlowedge 
+  :: (Ptr RawTH1D) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_getMaximumTH1" c_th1d_getmaximumth1 
+  :: (Ptr RawTH1D) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetMaximumBin" c_th1d_getmaximumbin 
+  :: (Ptr RawTH1D) -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetMaximumStored" c_th1d_getmaximumstored 
+  :: (Ptr RawTH1D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_getMinimumTH1" c_th1d_getminimumth1 
+  :: (Ptr RawTH1D) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetMinimumBin" c_th1d_getminimumbin 
+  :: (Ptr RawTH1D) -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetMinimumStored" c_th1d_getminimumstored 
+  :: (Ptr RawTH1D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetMean" c_th1d_getmean 
+  :: (Ptr RawTH1D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetMeanError" c_th1d_getmeanerror 
+  :: (Ptr RawTH1D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetNbinsX" c_th1d_getnbinsx 
+  :: (Ptr RawTH1D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetNbinsY" c_th1d_getnbinsy 
+  :: (Ptr RawTH1D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetNbinsZ" c_th1d_getnbinsz 
+  :: (Ptr RawTH1D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_getQuantilesTH1" c_th1d_getquantilesth1 
+  :: (Ptr RawTH1D) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetRandom" c_th1d_getrandom 
+  :: (Ptr RawTH1D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetStats" c_th1d_getstats 
+  :: (Ptr RawTH1D) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetSumOfWeights" c_th1d_getsumofweights 
+  :: (Ptr RawTH1D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetSumw2" c_th1d_getsumw2 
+  :: (Ptr RawTH1D) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetSumw2N" c_th1d_getsumw2n 
+  :: (Ptr RawTH1D) -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetRMS" c_th1d_getrms 
+  :: (Ptr RawTH1D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetRMSError" c_th1d_getrmserror 
+  :: (Ptr RawTH1D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetSkewness" c_th1d_getskewness 
+  :: (Ptr RawTH1D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_integral1" c_th1d_integral1 
+  :: (Ptr RawTH1D) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_interpolate1" c_th1d_interpolate1 
+  :: (Ptr RawTH1D) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_interpolate2" c_th1d_interpolate2 
+  :: (Ptr RawTH1D) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_interpolate3" c_th1d_interpolate3 
+  :: (Ptr RawTH1D) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_KolmogorovTest" c_th1d_kolmogorovtest 
+  :: (Ptr RawTH1D) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_LabelsDeflate" c_th1d_labelsdeflate 
+  :: (Ptr RawTH1D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_LabelsInflate" c_th1d_labelsinflate 
+  :: (Ptr RawTH1D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_LabelsOption" c_th1d_labelsoption 
+  :: (Ptr RawTH1D) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_multiflyF" c_th1d_multiflyf 
+  :: (Ptr RawTH1D) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_Multiply" c_th1d_multiply 
+  :: (Ptr RawTH1D) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_PutStats" c_th1d_putstats 
+  :: (Ptr RawTH1D) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_Rebin" c_th1d_rebin 
+  :: (Ptr RawTH1D) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1D.h TH1D_RebinAxis" c_th1d_rebinaxis 
+  :: (Ptr RawTH1D) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_Rebuild" c_th1d_rebuild 
+  :: (Ptr RawTH1D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_RecursiveRemove" c_th1d_recursiveremove 
+  :: (Ptr RawTH1D) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_Reset" c_th1d_reset 
+  :: (Ptr RawTH1D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_ResetStats" c_th1d_resetstats 
+  :: (Ptr RawTH1D) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_Scale" c_th1d_scale 
+  :: (Ptr RawTH1D) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_setAxisColorA" c_th1d_setaxiscolora 
+  :: (Ptr RawTH1D) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetAxisRange" c_th1d_setaxisrange 
+  :: (Ptr RawTH1D) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetBarOffset" c_th1d_setbaroffset 
+  :: (Ptr RawTH1D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetBarWidth" c_th1d_setbarwidth 
+  :: (Ptr RawTH1D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_setBinContent1" c_th1d_setbincontent1 
+  :: (Ptr RawTH1D) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_setBinContent2" c_th1d_setbincontent2 
+  :: (Ptr RawTH1D) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_setBinContent3" c_th1d_setbincontent3 
+  :: (Ptr RawTH1D) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_setBinError1" c_th1d_setbinerror1 
+  :: (Ptr RawTH1D) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_setBinError2" c_th1d_setbinerror2 
+  :: (Ptr RawTH1D) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_setBinError3" c_th1d_setbinerror3 
+  :: (Ptr RawTH1D) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_setBins1" c_th1d_setbins1 
+  :: (Ptr RawTH1D) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_setBins2" c_th1d_setbins2 
+  :: (Ptr RawTH1D) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_setBins3" c_th1d_setbins3 
+  :: (Ptr RawTH1D) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetBinsLength" c_th1d_setbinslength 
+  :: (Ptr RawTH1D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetBuffer" c_th1d_setbuffer 
+  :: (Ptr RawTH1D) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetCellContent" c_th1d_setcellcontent 
+  :: (Ptr RawTH1D) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetContent" c_th1d_setcontent 
+  :: (Ptr RawTH1D) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetContour" c_th1d_setcontour 
+  :: (Ptr RawTH1D) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetContourLevel" c_th1d_setcontourlevel 
+  :: (Ptr RawTH1D) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetDirectory" c_th1d_setdirectory 
+  :: (Ptr RawTH1D) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetEntries" c_th1d_setentries 
+  :: (Ptr RawTH1D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetError" c_th1d_seterror 
+  :: (Ptr RawTH1D) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_setLabelColorA" c_th1d_setlabelcolora 
+  :: (Ptr RawTH1D) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_setLabelSizeA" c_th1d_setlabelsizea 
+  :: (Ptr RawTH1D) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_setLabelFontA" c_th1d_setlabelfonta 
+  :: (Ptr RawTH1D) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_setLabelOffsetA" c_th1d_setlabeloffseta 
+  :: (Ptr RawTH1D) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetMaximum" c_th1d_setmaximum 
+  :: (Ptr RawTH1D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetMinimum" c_th1d_setminimum 
+  :: (Ptr RawTH1D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetNormFactor" c_th1d_setnormfactor 
+  :: (Ptr RawTH1D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetStats" c_th1d_setstats 
+  :: (Ptr RawTH1D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetOption" c_th1d_setoption 
+  :: (Ptr RawTH1D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetXTitle" c_th1d_setxtitle 
+  :: (Ptr RawTH1D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetYTitle" c_th1d_setytitle 
+  :: (Ptr RawTH1D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetZTitle" c_th1d_setztitle 
+  :: (Ptr RawTH1D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_ShowBackground" c_th1d_showbackground 
+  :: (Ptr RawTH1D) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1D.h TH1D_ShowPeaks" c_th1d_showpeaks 
+  :: (Ptr RawTH1D) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_Smooth" c_th1d_smooth 
+  :: (Ptr RawTH1D) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_Sumw2" c_th1d_sumw2 
+  :: (Ptr RawTH1D) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_Draw" c_th1d_draw 
+  :: (Ptr RawTH1D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_FindObject" c_th1d_findobject 
+  :: (Ptr RawTH1D) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetName" c_th1d_getname 
+  :: (Ptr RawTH1D) -> IO CString
+
+foreign import ccall "HROOTHistTH1D.h TH1D_IsA" c_th1d_isa 
+  :: (Ptr RawTH1D) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH1D.h TH1D_Paint" c_th1d_paint 
+  :: (Ptr RawTH1D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_printObj" c_th1d_printobj 
+  :: (Ptr RawTH1D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SaveAs" c_th1d_saveas 
+  :: (Ptr RawTH1D) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_Write" c_th1d_write 
+  :: (Ptr RawTH1D) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetLineColor" c_th1d_getlinecolor 
+  :: (Ptr RawTH1D) -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetLineStyle" c_th1d_getlinestyle 
+  :: (Ptr RawTH1D) -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetLineWidth" c_th1d_getlinewidth 
+  :: (Ptr RawTH1D) -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_ResetAttLine" c_th1d_resetattline 
+  :: (Ptr RawTH1D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetLineAttributes" c_th1d_setlineattributes 
+  :: (Ptr RawTH1D) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetLineColor" c_th1d_setlinecolor 
+  :: (Ptr RawTH1D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetLineStyle" c_th1d_setlinestyle 
+  :: (Ptr RawTH1D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetLineWidth" c_th1d_setlinewidth 
+  :: (Ptr RawTH1D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetFillColor" c_th1d_setfillcolor 
+  :: (Ptr RawTH1D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetFillStyle" c_th1d_setfillstyle 
+  :: (Ptr RawTH1D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetMarkerColor" c_th1d_getmarkercolor 
+  :: (Ptr RawTH1D) -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetMarkerStyle" c_th1d_getmarkerstyle 
+  :: (Ptr RawTH1D) -> IO CInt
+
+foreign import ccall "HROOTHistTH1D.h TH1D_GetMarkerSize" c_th1d_getmarkersize 
+  :: (Ptr RawTH1D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1D.h TH1D_ResetAttMarker" c_th1d_resetattmarker 
+  :: (Ptr RawTH1D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetMarkerAttributes" c_th1d_setmarkerattributes 
+  :: (Ptr RawTH1D) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetMarkerColor" c_th1d_setmarkercolor 
+  :: (Ptr RawTH1D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetMarkerStyle" c_th1d_setmarkerstyle 
+  :: (Ptr RawTH1D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_SetMarkerSize" c_th1d_setmarkersize 
+  :: (Ptr RawTH1D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_delete" c_th1d_delete 
+  :: (Ptr RawTH1D) -> IO ()
+
+foreign import ccall "HROOTHistTH1D.h TH1D_newTH1D" c_th1d_newth1d 
+  :: CString -> CString -> CInt -> CDouble -> CDouble -> IO (Ptr RawTH1D)
+
diff --git a/src/HROOT/Hist/TH1D/Implementation.hs b/src/HROOT/Hist/TH1D/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1D/Implementation.hs
@@ -0,0 +1,407 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH1D.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1D.FFI
+import HROOT.Hist.TH1D.Interface
+import HROOT.Hist.TH1D.Cast
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+import HROOT.Core.TArray.RawType
+import HROOT.Core.TArray.Cast
+import HROOT.Core.TArray.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH1D TH1D where
+instance ITH1 TH1D where
+  add = xform2 c_th1d_add
+  addBinContent = xform2 c_th1d_addbincontent
+  chi2Test = xform3 c_th1d_chi2test
+  computeIntegral = xform0 c_th1d_computeintegral
+  directoryAutoAdd = xform1 c_th1d_directoryautoadd
+  divide = xform5 c_th1d_divide
+  drawCopyTH1 = xform1 c_th1d_drawcopyth1
+  drawNormalized = xform2 c_th1d_drawnormalized
+  drawPanelTH1 = xform0 c_th1d_drawpanelth1
+  bufferEmpty = xform1 c_th1d_bufferempty
+  evalF = xform2 c_th1d_evalf
+  fFT = xform2 c_th1d_fft
+  fill1 = xform1 c_th1d_fill1
+  fill1w = xform2 c_th1d_fill1w
+  fillN1 = xform4 c_th1d_filln1
+  fillRandom = xform2 c_th1d_fillrandom
+  findBin = xform3 c_th1d_findbin
+  findFixBin = xform3 c_th1d_findfixbin
+  findFirstBinAbove = xform2 c_th1d_findfirstbinabove
+  findLastBinAbove = xform2 c_th1d_findlastbinabove
+  fitPanelTH1 = xform0 c_th1d_fitpanelth1
+  getNdivisionA = xform1 c_th1d_getndivisiona
+  getAxisColorA = xform1 c_th1d_getaxiscolora
+  getLabelColorA = xform1 c_th1d_getlabelcolora
+  getLabelFontA = xform1 c_th1d_getlabelfonta
+  getLabelOffsetA = xform1 c_th1d_getlabeloffseta
+  getLabelSizeA = xform1 c_th1d_getlabelsizea
+  getTitleFontA = xform1 c_th1d_gettitlefonta
+  getTitleOffsetA = xform1 c_th1d_gettitleoffseta
+  getTitleSizeA = xform1 c_th1d_gettitlesizea
+  getTickLengthA = xform1 c_th1d_getticklengtha
+  getBarOffset = xform0 c_th1d_getbaroffset
+  getBarWidth = xform0 c_th1d_getbarwidth
+  getContour = xform1 c_th1d_getcontour
+  getContourLevel = xform1 c_th1d_getcontourlevel
+  getContourLevelPad = xform1 c_th1d_getcontourlevelpad
+  getBin = xform3 c_th1d_getbin
+  getBinCenter = xform1 c_th1d_getbincenter
+  getBinContent1 = xform1 c_th1d_getbincontent1
+  getBinContent2 = xform2 c_th1d_getbincontent2
+  getBinContent3 = xform3 c_th1d_getbincontent3
+  getBinError1 = xform1 c_th1d_getbinerror1
+  getBinError2 = xform2 c_th1d_getbinerror2
+  getBinError3 = xform3 c_th1d_getbinerror3
+  getBinLowEdge = xform1 c_th1d_getbinlowedge
+  getBinWidth = xform1 c_th1d_getbinwidth
+  getCellContent = xform2 c_th1d_getcellcontent
+  getCellError = xform2 c_th1d_getcellerror
+  getEntries = xform0 c_th1d_getentries
+  getEffectiveEntries = xform0 c_th1d_geteffectiveentries
+  getFunction = xform1 c_th1d_getfunction
+  getDimension = xform0 c_th1d_getdimension
+  getKurtosis = xform1 c_th1d_getkurtosis
+  getLowEdge = xform1 c_th1d_getlowedge
+  getMaximumTH1 = xform1 c_th1d_getmaximumth1
+  getMaximumBin = xform0 c_th1d_getmaximumbin
+  getMaximumStored = xform0 c_th1d_getmaximumstored
+  getMinimumTH1 = xform1 c_th1d_getminimumth1
+  getMinimumBin = xform0 c_th1d_getminimumbin
+  getMinimumStored = xform0 c_th1d_getminimumstored
+  getMean = xform1 c_th1d_getmean
+  getMeanError = xform1 c_th1d_getmeanerror
+  getNbinsX = xform0 c_th1d_getnbinsx
+  getNbinsY = xform0 c_th1d_getnbinsy
+  getNbinsZ = xform0 c_th1d_getnbinsz
+  getQuantilesTH1 = xform3 c_th1d_getquantilesth1
+  getRandom = xform0 c_th1d_getrandom
+  getStats = xform1 c_th1d_getstats
+  getSumOfWeights = xform0 c_th1d_getsumofweights
+  getSumw2 = xform0 c_th1d_getsumw2
+  getSumw2N = xform0 c_th1d_getsumw2n
+  getRMS = xform1 c_th1d_getrms
+  getRMSError = xform1 c_th1d_getrmserror
+  getSkewness = xform1 c_th1d_getskewness
+  integral1 = xform3 c_th1d_integral1
+  interpolate1 = xform1 c_th1d_interpolate1
+  interpolate2 = xform2 c_th1d_interpolate2
+  interpolate3 = xform3 c_th1d_interpolate3
+  kolmogorovTest = xform2 c_th1d_kolmogorovtest
+  labelsDeflate = xform1 c_th1d_labelsdeflate
+  labelsInflate = xform1 c_th1d_labelsinflate
+  labelsOption = xform2 c_th1d_labelsoption
+  multiflyF = xform2 c_th1d_multiflyf
+  multiply = xform5 c_th1d_multiply
+  putStats = xform1 c_th1d_putstats
+  rebin = xform3 c_th1d_rebin
+  rebinAxis = xform2 c_th1d_rebinaxis
+  rebuild = xform1 c_th1d_rebuild
+  recursiveRemove = xform1 c_th1d_recursiveremove
+  reset = xform1 c_th1d_reset
+  resetStats = xform0 c_th1d_resetstats
+  scale = xform2 c_th1d_scale
+  setAxisColorA = xform2 c_th1d_setaxiscolora
+  setAxisRange = xform3 c_th1d_setaxisrange
+  setBarOffset = xform1 c_th1d_setbaroffset
+  setBarWidth = xform1 c_th1d_setbarwidth
+  setBinContent1 = xform2 c_th1d_setbincontent1
+  setBinContent2 = xform3 c_th1d_setbincontent2
+  setBinContent3 = xform4 c_th1d_setbincontent3
+  setBinError1 = xform2 c_th1d_setbinerror1
+  setBinError2 = xform3 c_th1d_setbinerror2
+  setBinError3 = xform4 c_th1d_setbinerror3
+  setBins1 = xform2 c_th1d_setbins1
+  setBins2 = xform4 c_th1d_setbins2
+  setBins3 = xform6 c_th1d_setbins3
+  setBinsLength = xform1 c_th1d_setbinslength
+  setBuffer = xform2 c_th1d_setbuffer
+  setCellContent = xform3 c_th1d_setcellcontent
+  setContent = xform1 c_th1d_setcontent
+  setContour = xform2 c_th1d_setcontour
+  setContourLevel = xform2 c_th1d_setcontourlevel
+  setDirectory = xform1 c_th1d_setdirectory
+  setEntries = xform1 c_th1d_setentries
+  setError = xform1 c_th1d_seterror
+  setLabelColorA = xform2 c_th1d_setlabelcolora
+  setLabelSizeA = xform2 c_th1d_setlabelsizea
+  setLabelFontA = xform2 c_th1d_setlabelfonta
+  setLabelOffsetA = xform2 c_th1d_setlabeloffseta
+  setMaximum = xform1 c_th1d_setmaximum
+  setMinimum = xform1 c_th1d_setminimum
+  setNormFactor = xform1 c_th1d_setnormfactor
+  setStats = xform1 c_th1d_setstats
+  setOption = xform1 c_th1d_setoption
+  setXTitle = xform1 c_th1d_setxtitle
+  setYTitle = xform1 c_th1d_setytitle
+  setZTitle = xform1 c_th1d_setztitle
+  showBackground = xform2 c_th1d_showbackground
+  showPeaks = xform3 c_th1d_showpeaks
+  smooth = xform2 c_th1d_smooth
+  sumw2 = xform0 c_th1d_sumw2
+instance ITArrayD TH1D where
+instance ITObject TH1D where
+  draw = xform1 c_th1d_draw
+  findObject = xform1 c_th1d_findobject
+  getName = xform0 c_th1d_getname
+  isA = xform0 c_th1d_isa
+  paint = xform1 c_th1d_paint
+  printObj = xform1 c_th1d_printobj
+  saveAs = xform2 c_th1d_saveas
+  write = xform3 c_th1d_write
+instance ITAttLine TH1D where
+  getLineColor = xform0 c_th1d_getlinecolor
+  getLineStyle = xform0 c_th1d_getlinestyle
+  getLineWidth = xform0 c_th1d_getlinewidth
+  resetAttLine = xform1 c_th1d_resetattline
+  setLineAttributes = xform0 c_th1d_setlineattributes
+  setLineColor = xform1 c_th1d_setlinecolor
+  setLineStyle = xform1 c_th1d_setlinestyle
+  setLineWidth = xform1 c_th1d_setlinewidth
+instance ITAttFill TH1D where
+  setFillColor = xform1 c_th1d_setfillcolor
+  setFillStyle = xform1 c_th1d_setfillstyle
+instance ITAttMarker TH1D where
+  getMarkerColor = xform0 c_th1d_getmarkercolor
+  getMarkerStyle = xform0 c_th1d_getmarkerstyle
+  getMarkerSize = xform0 c_th1d_getmarkersize
+  resetAttMarker = xform1 c_th1d_resetattmarker
+  setMarkerAttributes = xform0 c_th1d_setmarkerattributes
+  setMarkerColor = xform1 c_th1d_setmarkercolor
+  setMarkerStyle = xform1 c_th1d_setmarkerstyle
+  setMarkerSize = xform1 c_th1d_setmarkersize
+instance IDeletable TH1D where
+  delete = xform0 c_th1d_delete
+instance ITArray TH1D where
+
+instance ITH1D (Exist TH1D) where
+
+instance ITH1 (Exist TH1D) where
+  add (ETH1D x) = add x
+  addBinContent (ETH1D x) = addBinContent x
+  chi2Test (ETH1D x) = chi2Test x
+  computeIntegral (ETH1D x) = computeIntegral x
+  directoryAutoAdd (ETH1D x) = directoryAutoAdd x
+  divide (ETH1D x) = divide x
+  drawCopyTH1 (ETH1D x) a1 = return . ETH1D =<< drawCopyTH1 x a1
+  drawNormalized (ETH1D x) = drawNormalized x
+  drawPanelTH1 (ETH1D x) = drawPanelTH1 x
+  bufferEmpty (ETH1D x) = bufferEmpty x
+  evalF (ETH1D x) = evalF x
+  fFT (ETH1D x) = fFT x
+  fill1 (ETH1D x) = fill1 x
+  fill1w (ETH1D x) = fill1w x
+  fillN1 (ETH1D x) = fillN1 x
+  fillRandom (ETH1D x) = fillRandom x
+  findBin (ETH1D x) = findBin x
+  findFixBin (ETH1D x) = findFixBin x
+  findFirstBinAbove (ETH1D x) = findFirstBinAbove x
+  findLastBinAbove (ETH1D x) = findLastBinAbove x
+  fitPanelTH1 (ETH1D x) = fitPanelTH1 x
+  getNdivisionA (ETH1D x) = getNdivisionA x
+  getAxisColorA (ETH1D x) = getAxisColorA x
+  getLabelColorA (ETH1D x) = getLabelColorA x
+  getLabelFontA (ETH1D x) = getLabelFontA x
+  getLabelOffsetA (ETH1D x) = getLabelOffsetA x
+  getLabelSizeA (ETH1D x) = getLabelSizeA x
+  getTitleFontA (ETH1D x) = getTitleFontA x
+  getTitleOffsetA (ETH1D x) = getTitleOffsetA x
+  getTitleSizeA (ETH1D x) = getTitleSizeA x
+  getTickLengthA (ETH1D x) = getTickLengthA x
+  getBarOffset (ETH1D x) = getBarOffset x
+  getBarWidth (ETH1D x) = getBarWidth x
+  getContour (ETH1D x) = getContour x
+  getContourLevel (ETH1D x) = getContourLevel x
+  getContourLevelPad (ETH1D x) = getContourLevelPad x
+  getBin (ETH1D x) = getBin x
+  getBinCenter (ETH1D x) = getBinCenter x
+  getBinContent1 (ETH1D x) = getBinContent1 x
+  getBinContent2 (ETH1D x) = getBinContent2 x
+  getBinContent3 (ETH1D x) = getBinContent3 x
+  getBinError1 (ETH1D x) = getBinError1 x
+  getBinError2 (ETH1D x) = getBinError2 x
+  getBinError3 (ETH1D x) = getBinError3 x
+  getBinLowEdge (ETH1D x) = getBinLowEdge x
+  getBinWidth (ETH1D x) = getBinWidth x
+  getCellContent (ETH1D x) = getCellContent x
+  getCellError (ETH1D x) = getCellError x
+  getEntries (ETH1D x) = getEntries x
+  getEffectiveEntries (ETH1D x) = getEffectiveEntries x
+  getFunction (ETH1D x) = getFunction x
+  getDimension (ETH1D x) = getDimension x
+  getKurtosis (ETH1D x) = getKurtosis x
+  getLowEdge (ETH1D x) = getLowEdge x
+  getMaximumTH1 (ETH1D x) = getMaximumTH1 x
+  getMaximumBin (ETH1D x) = getMaximumBin x
+  getMaximumStored (ETH1D x) = getMaximumStored x
+  getMinimumTH1 (ETH1D x) = getMinimumTH1 x
+  getMinimumBin (ETH1D x) = getMinimumBin x
+  getMinimumStored (ETH1D x) = getMinimumStored x
+  getMean (ETH1D x) = getMean x
+  getMeanError (ETH1D x) = getMeanError x
+  getNbinsX (ETH1D x) = getNbinsX x
+  getNbinsY (ETH1D x) = getNbinsY x
+  getNbinsZ (ETH1D x) = getNbinsZ x
+  getQuantilesTH1 (ETH1D x) = getQuantilesTH1 x
+  getRandom (ETH1D x) = getRandom x
+  getStats (ETH1D x) = getStats x
+  getSumOfWeights (ETH1D x) = getSumOfWeights x
+  getSumw2 (ETH1D x) = getSumw2 x
+  getSumw2N (ETH1D x) = getSumw2N x
+  getRMS (ETH1D x) = getRMS x
+  getRMSError (ETH1D x) = getRMSError x
+  getSkewness (ETH1D x) = getSkewness x
+  integral1 (ETH1D x) = integral1 x
+  interpolate1 (ETH1D x) = interpolate1 x
+  interpolate2 (ETH1D x) = interpolate2 x
+  interpolate3 (ETH1D x) = interpolate3 x
+  kolmogorovTest (ETH1D x) = kolmogorovTest x
+  labelsDeflate (ETH1D x) = labelsDeflate x
+  labelsInflate (ETH1D x) = labelsInflate x
+  labelsOption (ETH1D x) = labelsOption x
+  multiflyF (ETH1D x) = multiflyF x
+  multiply (ETH1D x) = multiply x
+  putStats (ETH1D x) = putStats x
+  rebin (ETH1D x) = rebin x
+  rebinAxis (ETH1D x) = rebinAxis x
+  rebuild (ETH1D x) = rebuild x
+  recursiveRemove (ETH1D x) = recursiveRemove x
+  reset (ETH1D x) = reset x
+  resetStats (ETH1D x) = resetStats x
+  scale (ETH1D x) = scale x
+  setAxisColorA (ETH1D x) = setAxisColorA x
+  setAxisRange (ETH1D x) = setAxisRange x
+  setBarOffset (ETH1D x) = setBarOffset x
+  setBarWidth (ETH1D x) = setBarWidth x
+  setBinContent1 (ETH1D x) = setBinContent1 x
+  setBinContent2 (ETH1D x) = setBinContent2 x
+  setBinContent3 (ETH1D x) = setBinContent3 x
+  setBinError1 (ETH1D x) = setBinError1 x
+  setBinError2 (ETH1D x) = setBinError2 x
+  setBinError3 (ETH1D x) = setBinError3 x
+  setBins1 (ETH1D x) = setBins1 x
+  setBins2 (ETH1D x) = setBins2 x
+  setBins3 (ETH1D x) = setBins3 x
+  setBinsLength (ETH1D x) = setBinsLength x
+  setBuffer (ETH1D x) = setBuffer x
+  setCellContent (ETH1D x) = setCellContent x
+  setContent (ETH1D x) = setContent x
+  setContour (ETH1D x) = setContour x
+  setContourLevel (ETH1D x) = setContourLevel x
+  setDirectory (ETH1D x) = setDirectory x
+  setEntries (ETH1D x) = setEntries x
+  setError (ETH1D x) = setError x
+  setLabelColorA (ETH1D x) = setLabelColorA x
+  setLabelSizeA (ETH1D x) = setLabelSizeA x
+  setLabelFontA (ETH1D x) = setLabelFontA x
+  setLabelOffsetA (ETH1D x) = setLabelOffsetA x
+  setMaximum (ETH1D x) = setMaximum x
+  setMinimum (ETH1D x) = setMinimum x
+  setNormFactor (ETH1D x) = setNormFactor x
+  setStats (ETH1D x) = setStats x
+  setOption (ETH1D x) = setOption x
+  setXTitle (ETH1D x) = setXTitle x
+  setYTitle (ETH1D x) = setYTitle x
+  setZTitle (ETH1D x) = setZTitle x
+  showBackground (ETH1D x) = showBackground x
+  showPeaks (ETH1D x) = showPeaks x
+  smooth (ETH1D x) = smooth x
+  sumw2 (ETH1D x) = sumw2 x
+instance ITArrayD (Exist TH1D) where
+
+instance ITObject (Exist TH1D) where
+  draw (ETH1D x) = draw x
+  findObject (ETH1D x) = findObject x
+  getName (ETH1D x) = getName x
+  isA (ETH1D x) = isA x
+  paint (ETH1D x) = paint x
+  printObj (ETH1D x) = printObj x
+  saveAs (ETH1D x) = saveAs x
+  write (ETH1D x) = write x
+instance ITAttLine (Exist TH1D) where
+  getLineColor (ETH1D x) = getLineColor x
+  getLineStyle (ETH1D x) = getLineStyle x
+  getLineWidth (ETH1D x) = getLineWidth x
+  resetAttLine (ETH1D x) = resetAttLine x
+  setLineAttributes (ETH1D x) = setLineAttributes x
+  setLineColor (ETH1D x) = setLineColor x
+  setLineStyle (ETH1D x) = setLineStyle x
+  setLineWidth (ETH1D x) = setLineWidth x
+instance ITAttFill (Exist TH1D) where
+  setFillColor (ETH1D x) = setFillColor x
+  setFillStyle (ETH1D x) = setFillStyle x
+instance ITAttMarker (Exist TH1D) where
+  getMarkerColor (ETH1D x) = getMarkerColor x
+  getMarkerStyle (ETH1D x) = getMarkerStyle x
+  getMarkerSize (ETH1D x) = getMarkerSize x
+  resetAttMarker (ETH1D x) = resetAttMarker x
+  setMarkerAttributes (ETH1D x) = setMarkerAttributes x
+  setMarkerColor (ETH1D x) = setMarkerColor x
+  setMarkerStyle (ETH1D x) = setMarkerStyle x
+  setMarkerSize (ETH1D x) = setMarkerSize x
+instance IDeletable (Exist TH1D) where
+  delete (ETH1D x) = delete x
+instance ITArray (Exist TH1D) where
+
+
+
+newTH1D :: CString -> CString -> CInt -> CDouble -> CDouble -> IO TH1D
+newTH1D = xform4 c_th1d_newth1d
+
+
+
+
+
+instance FPtr (Exist TH1D) where
+  type Raw (Exist TH1D) = RawTH1D
+  get_fptr (ETH1D obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH1D (cast_fptr_to_obj (fptr :: ForeignPtr RawTH1D) :: TH1D)
diff --git a/src/HROOT/Hist/TH1D/Interface.hs b/src/HROOT/Hist/TH1D/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1D/Interface.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH1D.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH1D.RawType
+
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TArrayD.Interface
+---- ============ ----
+
+
+
+class (ITH1 a,ITArrayD a) => ITH1D a where
+
+instance Existable TH1D where
+  data Exist TH1D = forall a. (FPtr a, ITH1D a) => ETH1D a
+
+upcastTH1D :: (FPtr a, ITH1D a) => a -> TH1D
+upcastTH1D h = let fh = get_fptr h
+                   fh2 :: ForeignPtr RawTH1D = castForeignPtr fh
+               in cast_fptr_to_obj fh2
+
+downcastTH1D :: (FPtr a, ITH1D a) => TH1D -> a 
+downcastTH1D h = let fh = get_fptr h
+                     fh2 = castForeignPtr fh
+                 in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH1D/RawType.hs b/src/HROOT/Hist/TH1D/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1D/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH1D.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH1D
+newtype TH1D = TH1D (ForeignPtr RawTH1D) deriving (Eq, Ord, Show)
+instance FPtr TH1D where
+   type Raw TH1D = RawTH1D
+   get_fptr (TH1D fptr) = fptr
+   cast_fptr_to_obj = TH1D
diff --git a/src/HROOT/Hist/TH1F.hs b/src/HROOT/Hist/TH1F.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1F.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TH1F
+  (
+    TH1F(..)
+  , ITH1F
+  , upcastTH1F
+  , downcastTH1F
+  , newTH1F
+ 
+  ) where
+
+import HROOT.Hist.TH1F.RawType
+import HROOT.Hist.TH1F.Interface
+import HROOT.Hist.TH1F.Implementation
+
+
diff --git a/src/HROOT/Hist/TH1F/Cast.hs b/src/HROOT/Hist/TH1F/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1F/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH1F.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH1F.RawType
+import HROOT.Hist.TH1F.Interface
+
+instance (ITH1F a, FPtr a) => Castable a (Ptr RawTH1F) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH1F (Ptr RawTH1F) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH1F/FFI.hsc b/src/HROOT/Hist/TH1F/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1F/FFI.hsc
@@ -0,0 +1,499 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH1F.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH1F.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTH1F.h"
+
+foreign import ccall "HROOTHistTH1F.h TH1F_Add" c_th1f_add 
+  :: (Ptr RawTH1F) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_AddBinContent" c_th1f_addbincontent 
+  :: (Ptr RawTH1F) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_Chi2Test" c_th1f_chi2test 
+  :: (Ptr RawTH1F) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_ComputeIntegral" c_th1f_computeintegral 
+  :: (Ptr RawTH1F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_DirectoryAutoAdd" c_th1f_directoryautoadd 
+  :: (Ptr RawTH1F) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_Divide" c_th1f_divide 
+  :: (Ptr RawTH1F) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_drawCopyTH1" c_th1f_drawcopyth1 
+  :: (Ptr RawTH1F) -> CString -> IO (Ptr RawTH1F)
+
+foreign import ccall "HROOTHistTH1F.h TH1F_DrawNormalized" c_th1f_drawnormalized 
+  :: (Ptr RawTH1F) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1F.h TH1F_drawPanelTH1" c_th1f_drawpanelth1 
+  :: (Ptr RawTH1F) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_BufferEmpty" c_th1f_bufferempty 
+  :: (Ptr RawTH1F) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_evalF" c_th1f_evalf 
+  :: (Ptr RawTH1F) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_FFT" c_th1f_fft 
+  :: (Ptr RawTH1F) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1F.h TH1F_fill1" c_th1f_fill1 
+  :: (Ptr RawTH1F) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_fill1w" c_th1f_fill1w 
+  :: (Ptr RawTH1F) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_fillN1" c_th1f_filln1 
+  :: (Ptr RawTH1F) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_FillRandom" c_th1f_fillrandom 
+  :: (Ptr RawTH1F) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_FindBin" c_th1f_findbin 
+  :: (Ptr RawTH1F) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_FindFixBin" c_th1f_findfixbin 
+  :: (Ptr RawTH1F) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_FindFirstBinAbove" c_th1f_findfirstbinabove 
+  :: (Ptr RawTH1F) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_FindLastBinAbove" c_th1f_findlastbinabove 
+  :: (Ptr RawTH1F) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_FitPanelTH1" c_th1f_fitpanelth1 
+  :: (Ptr RawTH1F) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_getNdivisionA" c_th1f_getndivisiona 
+  :: (Ptr RawTH1F) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_getAxisColorA" c_th1f_getaxiscolora 
+  :: (Ptr RawTH1F) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_getLabelColorA" c_th1f_getlabelcolora 
+  :: (Ptr RawTH1F) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_getLabelFontA" c_th1f_getlabelfonta 
+  :: (Ptr RawTH1F) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_getLabelOffsetA" c_th1f_getlabeloffseta 
+  :: (Ptr RawTH1F) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_getLabelSizeA" c_th1f_getlabelsizea 
+  :: (Ptr RawTH1F) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_getTitleFontA" c_th1f_gettitlefonta 
+  :: (Ptr RawTH1F) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_getTitleOffsetA" c_th1f_gettitleoffseta 
+  :: (Ptr RawTH1F) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_getTitleSizeA" c_th1f_gettitlesizea 
+  :: (Ptr RawTH1F) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_getTickLengthA" c_th1f_getticklengtha 
+  :: (Ptr RawTH1F) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetBarOffset" c_th1f_getbaroffset 
+  :: (Ptr RawTH1F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetBarWidth" c_th1f_getbarwidth 
+  :: (Ptr RawTH1F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetContour" c_th1f_getcontour 
+  :: (Ptr RawTH1F) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetContourLevel" c_th1f_getcontourlevel 
+  :: (Ptr RawTH1F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetContourLevelPad" c_th1f_getcontourlevelpad 
+  :: (Ptr RawTH1F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetBin" c_th1f_getbin 
+  :: (Ptr RawTH1F) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetBinCenter" c_th1f_getbincenter 
+  :: (Ptr RawTH1F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetBinContent1" c_th1f_getbincontent1 
+  :: (Ptr RawTH1F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetBinContent2" c_th1f_getbincontent2 
+  :: (Ptr RawTH1F) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetBinContent3" c_th1f_getbincontent3 
+  :: (Ptr RawTH1F) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetBinError1" c_th1f_getbinerror1 
+  :: (Ptr RawTH1F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetBinError2" c_th1f_getbinerror2 
+  :: (Ptr RawTH1F) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetBinError3" c_th1f_getbinerror3 
+  :: (Ptr RawTH1F) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetBinLowEdge" c_th1f_getbinlowedge 
+  :: (Ptr RawTH1F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetBinWidth" c_th1f_getbinwidth 
+  :: (Ptr RawTH1F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetCellContent" c_th1f_getcellcontent 
+  :: (Ptr RawTH1F) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetCellError" c_th1f_getcellerror 
+  :: (Ptr RawTH1F) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetEntries" c_th1f_getentries 
+  :: (Ptr RawTH1F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetEffectiveEntries" c_th1f_geteffectiveentries 
+  :: (Ptr RawTH1F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetFunction" c_th1f_getfunction 
+  :: (Ptr RawTH1F) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetDimension" c_th1f_getdimension 
+  :: (Ptr RawTH1F) -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetKurtosis" c_th1f_getkurtosis 
+  :: (Ptr RawTH1F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetLowEdge" c_th1f_getlowedge 
+  :: (Ptr RawTH1F) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_getMaximumTH1" c_th1f_getmaximumth1 
+  :: (Ptr RawTH1F) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetMaximumBin" c_th1f_getmaximumbin 
+  :: (Ptr RawTH1F) -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetMaximumStored" c_th1f_getmaximumstored 
+  :: (Ptr RawTH1F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_getMinimumTH1" c_th1f_getminimumth1 
+  :: (Ptr RawTH1F) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetMinimumBin" c_th1f_getminimumbin 
+  :: (Ptr RawTH1F) -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetMinimumStored" c_th1f_getminimumstored 
+  :: (Ptr RawTH1F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetMean" c_th1f_getmean 
+  :: (Ptr RawTH1F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetMeanError" c_th1f_getmeanerror 
+  :: (Ptr RawTH1F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetNbinsX" c_th1f_getnbinsx 
+  :: (Ptr RawTH1F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetNbinsY" c_th1f_getnbinsy 
+  :: (Ptr RawTH1F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetNbinsZ" c_th1f_getnbinsz 
+  :: (Ptr RawTH1F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_getQuantilesTH1" c_th1f_getquantilesth1 
+  :: (Ptr RawTH1F) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetRandom" c_th1f_getrandom 
+  :: (Ptr RawTH1F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetStats" c_th1f_getstats 
+  :: (Ptr RawTH1F) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetSumOfWeights" c_th1f_getsumofweights 
+  :: (Ptr RawTH1F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetSumw2" c_th1f_getsumw2 
+  :: (Ptr RawTH1F) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetSumw2N" c_th1f_getsumw2n 
+  :: (Ptr RawTH1F) -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetRMS" c_th1f_getrms 
+  :: (Ptr RawTH1F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetRMSError" c_th1f_getrmserror 
+  :: (Ptr RawTH1F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetSkewness" c_th1f_getskewness 
+  :: (Ptr RawTH1F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_integral1" c_th1f_integral1 
+  :: (Ptr RawTH1F) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_interpolate1" c_th1f_interpolate1 
+  :: (Ptr RawTH1F) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_interpolate2" c_th1f_interpolate2 
+  :: (Ptr RawTH1F) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_interpolate3" c_th1f_interpolate3 
+  :: (Ptr RawTH1F) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_KolmogorovTest" c_th1f_kolmogorovtest 
+  :: (Ptr RawTH1F) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_LabelsDeflate" c_th1f_labelsdeflate 
+  :: (Ptr RawTH1F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_LabelsInflate" c_th1f_labelsinflate 
+  :: (Ptr RawTH1F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_LabelsOption" c_th1f_labelsoption 
+  :: (Ptr RawTH1F) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_multiflyF" c_th1f_multiflyf 
+  :: (Ptr RawTH1F) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_Multiply" c_th1f_multiply 
+  :: (Ptr RawTH1F) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_PutStats" c_th1f_putstats 
+  :: (Ptr RawTH1F) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_Rebin" c_th1f_rebin 
+  :: (Ptr RawTH1F) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1F.h TH1F_RebinAxis" c_th1f_rebinaxis 
+  :: (Ptr RawTH1F) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_Rebuild" c_th1f_rebuild 
+  :: (Ptr RawTH1F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_RecursiveRemove" c_th1f_recursiveremove 
+  :: (Ptr RawTH1F) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_Reset" c_th1f_reset 
+  :: (Ptr RawTH1F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_ResetStats" c_th1f_resetstats 
+  :: (Ptr RawTH1F) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_Scale" c_th1f_scale 
+  :: (Ptr RawTH1F) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_setAxisColorA" c_th1f_setaxiscolora 
+  :: (Ptr RawTH1F) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetAxisRange" c_th1f_setaxisrange 
+  :: (Ptr RawTH1F) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetBarOffset" c_th1f_setbaroffset 
+  :: (Ptr RawTH1F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetBarWidth" c_th1f_setbarwidth 
+  :: (Ptr RawTH1F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_setBinContent1" c_th1f_setbincontent1 
+  :: (Ptr RawTH1F) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_setBinContent2" c_th1f_setbincontent2 
+  :: (Ptr RawTH1F) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_setBinContent3" c_th1f_setbincontent3 
+  :: (Ptr RawTH1F) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_setBinError1" c_th1f_setbinerror1 
+  :: (Ptr RawTH1F) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_setBinError2" c_th1f_setbinerror2 
+  :: (Ptr RawTH1F) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_setBinError3" c_th1f_setbinerror3 
+  :: (Ptr RawTH1F) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_setBins1" c_th1f_setbins1 
+  :: (Ptr RawTH1F) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_setBins2" c_th1f_setbins2 
+  :: (Ptr RawTH1F) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_setBins3" c_th1f_setbins3 
+  :: (Ptr RawTH1F) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetBinsLength" c_th1f_setbinslength 
+  :: (Ptr RawTH1F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetBuffer" c_th1f_setbuffer 
+  :: (Ptr RawTH1F) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetCellContent" c_th1f_setcellcontent 
+  :: (Ptr RawTH1F) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetContent" c_th1f_setcontent 
+  :: (Ptr RawTH1F) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetContour" c_th1f_setcontour 
+  :: (Ptr RawTH1F) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetContourLevel" c_th1f_setcontourlevel 
+  :: (Ptr RawTH1F) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetDirectory" c_th1f_setdirectory 
+  :: (Ptr RawTH1F) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetEntries" c_th1f_setentries 
+  :: (Ptr RawTH1F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetError" c_th1f_seterror 
+  :: (Ptr RawTH1F) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_setLabelColorA" c_th1f_setlabelcolora 
+  :: (Ptr RawTH1F) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_setLabelSizeA" c_th1f_setlabelsizea 
+  :: (Ptr RawTH1F) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_setLabelFontA" c_th1f_setlabelfonta 
+  :: (Ptr RawTH1F) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_setLabelOffsetA" c_th1f_setlabeloffseta 
+  :: (Ptr RawTH1F) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetMaximum" c_th1f_setmaximum 
+  :: (Ptr RawTH1F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetMinimum" c_th1f_setminimum 
+  :: (Ptr RawTH1F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetNormFactor" c_th1f_setnormfactor 
+  :: (Ptr RawTH1F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetStats" c_th1f_setstats 
+  :: (Ptr RawTH1F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetOption" c_th1f_setoption 
+  :: (Ptr RawTH1F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetXTitle" c_th1f_setxtitle 
+  :: (Ptr RawTH1F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetYTitle" c_th1f_setytitle 
+  :: (Ptr RawTH1F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetZTitle" c_th1f_setztitle 
+  :: (Ptr RawTH1F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_ShowBackground" c_th1f_showbackground 
+  :: (Ptr RawTH1F) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1F.h TH1F_ShowPeaks" c_th1f_showpeaks 
+  :: (Ptr RawTH1F) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_Smooth" c_th1f_smooth 
+  :: (Ptr RawTH1F) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_Sumw2" c_th1f_sumw2 
+  :: (Ptr RawTH1F) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_Draw" c_th1f_draw 
+  :: (Ptr RawTH1F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_FindObject" c_th1f_findobject 
+  :: (Ptr RawTH1F) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetName" c_th1f_getname 
+  :: (Ptr RawTH1F) -> IO CString
+
+foreign import ccall "HROOTHistTH1F.h TH1F_IsA" c_th1f_isa 
+  :: (Ptr RawTH1F) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH1F.h TH1F_Paint" c_th1f_paint 
+  :: (Ptr RawTH1F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_printObj" c_th1f_printobj 
+  :: (Ptr RawTH1F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SaveAs" c_th1f_saveas 
+  :: (Ptr RawTH1F) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_Write" c_th1f_write 
+  :: (Ptr RawTH1F) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetLineColor" c_th1f_getlinecolor 
+  :: (Ptr RawTH1F) -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetLineStyle" c_th1f_getlinestyle 
+  :: (Ptr RawTH1F) -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetLineWidth" c_th1f_getlinewidth 
+  :: (Ptr RawTH1F) -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_ResetAttLine" c_th1f_resetattline 
+  :: (Ptr RawTH1F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetLineAttributes" c_th1f_setlineattributes 
+  :: (Ptr RawTH1F) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetLineColor" c_th1f_setlinecolor 
+  :: (Ptr RawTH1F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetLineStyle" c_th1f_setlinestyle 
+  :: (Ptr RawTH1F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetLineWidth" c_th1f_setlinewidth 
+  :: (Ptr RawTH1F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetFillColor" c_th1f_setfillcolor 
+  :: (Ptr RawTH1F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetFillStyle" c_th1f_setfillstyle 
+  :: (Ptr RawTH1F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetMarkerColor" c_th1f_getmarkercolor 
+  :: (Ptr RawTH1F) -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetMarkerStyle" c_th1f_getmarkerstyle 
+  :: (Ptr RawTH1F) -> IO CInt
+
+foreign import ccall "HROOTHistTH1F.h TH1F_GetMarkerSize" c_th1f_getmarkersize 
+  :: (Ptr RawTH1F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1F.h TH1F_ResetAttMarker" c_th1f_resetattmarker 
+  :: (Ptr RawTH1F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetMarkerAttributes" c_th1f_setmarkerattributes 
+  :: (Ptr RawTH1F) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetMarkerColor" c_th1f_setmarkercolor 
+  :: (Ptr RawTH1F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetMarkerStyle" c_th1f_setmarkerstyle 
+  :: (Ptr RawTH1F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_SetMarkerSize" c_th1f_setmarkersize 
+  :: (Ptr RawTH1F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_delete" c_th1f_delete 
+  :: (Ptr RawTH1F) -> IO ()
+
+foreign import ccall "HROOTHistTH1F.h TH1F_newTH1F" c_th1f_newth1f 
+  :: CString -> CString -> CInt -> CDouble -> CDouble -> IO (Ptr RawTH1F)
+
diff --git a/src/HROOT/Hist/TH1F/Implementation.hs b/src/HROOT/Hist/TH1F/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1F/Implementation.hs
@@ -0,0 +1,410 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH1F.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH1F.RawType
+import HROOT.Hist.TH1F.FFI
+import HROOT.Hist.TH1F.Interface
+import HROOT.Hist.TH1F.Cast
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TArrayF.RawType
+import HROOT.Core.TArrayF.Cast
+import HROOT.Core.TArrayF.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+import HROOT.Core.TArray.RawType
+import HROOT.Core.TArray.Cast
+import HROOT.Core.TArray.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH1F TH1F where
+instance ITH1 TH1F where
+  add = xform2 c_th1f_add
+  addBinContent = xform2 c_th1f_addbincontent
+  chi2Test = xform3 c_th1f_chi2test
+  computeIntegral = xform0 c_th1f_computeintegral
+  directoryAutoAdd = xform1 c_th1f_directoryautoadd
+  divide = xform5 c_th1f_divide
+  drawCopyTH1 = xform1 c_th1f_drawcopyth1
+  drawNormalized = xform2 c_th1f_drawnormalized
+  drawPanelTH1 = xform0 c_th1f_drawpanelth1
+  bufferEmpty = xform1 c_th1f_bufferempty
+  evalF = xform2 c_th1f_evalf
+  fFT = xform2 c_th1f_fft
+  fill1 = xform1 c_th1f_fill1
+  fill1w = xform2 c_th1f_fill1w
+  fillN1 = xform4 c_th1f_filln1
+  fillRandom = xform2 c_th1f_fillrandom
+  findBin = xform3 c_th1f_findbin
+  findFixBin = xform3 c_th1f_findfixbin
+  findFirstBinAbove = xform2 c_th1f_findfirstbinabove
+  findLastBinAbove = xform2 c_th1f_findlastbinabove
+  fitPanelTH1 = xform0 c_th1f_fitpanelth1
+  getNdivisionA = xform1 c_th1f_getndivisiona
+  getAxisColorA = xform1 c_th1f_getaxiscolora
+  getLabelColorA = xform1 c_th1f_getlabelcolora
+  getLabelFontA = xform1 c_th1f_getlabelfonta
+  getLabelOffsetA = xform1 c_th1f_getlabeloffseta
+  getLabelSizeA = xform1 c_th1f_getlabelsizea
+  getTitleFontA = xform1 c_th1f_gettitlefonta
+  getTitleOffsetA = xform1 c_th1f_gettitleoffseta
+  getTitleSizeA = xform1 c_th1f_gettitlesizea
+  getTickLengthA = xform1 c_th1f_getticklengtha
+  getBarOffset = xform0 c_th1f_getbaroffset
+  getBarWidth = xform0 c_th1f_getbarwidth
+  getContour = xform1 c_th1f_getcontour
+  getContourLevel = xform1 c_th1f_getcontourlevel
+  getContourLevelPad = xform1 c_th1f_getcontourlevelpad
+  getBin = xform3 c_th1f_getbin
+  getBinCenter = xform1 c_th1f_getbincenter
+  getBinContent1 = xform1 c_th1f_getbincontent1
+  getBinContent2 = xform2 c_th1f_getbincontent2
+  getBinContent3 = xform3 c_th1f_getbincontent3
+  getBinError1 = xform1 c_th1f_getbinerror1
+  getBinError2 = xform2 c_th1f_getbinerror2
+  getBinError3 = xform3 c_th1f_getbinerror3
+  getBinLowEdge = xform1 c_th1f_getbinlowedge
+  getBinWidth = xform1 c_th1f_getbinwidth
+  getCellContent = xform2 c_th1f_getcellcontent
+  getCellError = xform2 c_th1f_getcellerror
+  getEntries = xform0 c_th1f_getentries
+  getEffectiveEntries = xform0 c_th1f_geteffectiveentries
+  getFunction = xform1 c_th1f_getfunction
+  getDimension = xform0 c_th1f_getdimension
+  getKurtosis = xform1 c_th1f_getkurtosis
+  getLowEdge = xform1 c_th1f_getlowedge
+  getMaximumTH1 = xform1 c_th1f_getmaximumth1
+  getMaximumBin = xform0 c_th1f_getmaximumbin
+  getMaximumStored = xform0 c_th1f_getmaximumstored
+  getMinimumTH1 = xform1 c_th1f_getminimumth1
+  getMinimumBin = xform0 c_th1f_getminimumbin
+  getMinimumStored = xform0 c_th1f_getminimumstored
+  getMean = xform1 c_th1f_getmean
+  getMeanError = xform1 c_th1f_getmeanerror
+  getNbinsX = xform0 c_th1f_getnbinsx
+  getNbinsY = xform0 c_th1f_getnbinsy
+  getNbinsZ = xform0 c_th1f_getnbinsz
+  getQuantilesTH1 = xform3 c_th1f_getquantilesth1
+  getRandom = xform0 c_th1f_getrandom
+  getStats = xform1 c_th1f_getstats
+  getSumOfWeights = xform0 c_th1f_getsumofweights
+  getSumw2 = xform0 c_th1f_getsumw2
+  getSumw2N = xform0 c_th1f_getsumw2n
+  getRMS = xform1 c_th1f_getrms
+  getRMSError = xform1 c_th1f_getrmserror
+  getSkewness = xform1 c_th1f_getskewness
+  integral1 = xform3 c_th1f_integral1
+  interpolate1 = xform1 c_th1f_interpolate1
+  interpolate2 = xform2 c_th1f_interpolate2
+  interpolate3 = xform3 c_th1f_interpolate3
+  kolmogorovTest = xform2 c_th1f_kolmogorovtest
+  labelsDeflate = xform1 c_th1f_labelsdeflate
+  labelsInflate = xform1 c_th1f_labelsinflate
+  labelsOption = xform2 c_th1f_labelsoption
+  multiflyF = xform2 c_th1f_multiflyf
+  multiply = xform5 c_th1f_multiply
+  putStats = xform1 c_th1f_putstats
+  rebin = xform3 c_th1f_rebin
+  rebinAxis = xform2 c_th1f_rebinaxis
+  rebuild = xform1 c_th1f_rebuild
+  recursiveRemove = xform1 c_th1f_recursiveremove
+  reset = xform1 c_th1f_reset
+  resetStats = xform0 c_th1f_resetstats
+  scale = xform2 c_th1f_scale
+  setAxisColorA = xform2 c_th1f_setaxiscolora
+  setAxisRange = xform3 c_th1f_setaxisrange
+  setBarOffset = xform1 c_th1f_setbaroffset
+  setBarWidth = xform1 c_th1f_setbarwidth
+  setBinContent1 = xform2 c_th1f_setbincontent1
+  setBinContent2 = xform3 c_th1f_setbincontent2
+  setBinContent3 = xform4 c_th1f_setbincontent3
+  setBinError1 = xform2 c_th1f_setbinerror1
+  setBinError2 = xform3 c_th1f_setbinerror2
+  setBinError3 = xform4 c_th1f_setbinerror3
+  setBins1 = xform2 c_th1f_setbins1
+  setBins2 = xform4 c_th1f_setbins2
+  setBins3 = xform6 c_th1f_setbins3
+  setBinsLength = xform1 c_th1f_setbinslength
+  setBuffer = xform2 c_th1f_setbuffer
+  setCellContent = xform3 c_th1f_setcellcontent
+  setContent = xform1 c_th1f_setcontent
+  setContour = xform2 c_th1f_setcontour
+  setContourLevel = xform2 c_th1f_setcontourlevel
+  setDirectory = xform1 c_th1f_setdirectory
+  setEntries = xform1 c_th1f_setentries
+  setError = xform1 c_th1f_seterror
+  setLabelColorA = xform2 c_th1f_setlabelcolora
+  setLabelSizeA = xform2 c_th1f_setlabelsizea
+  setLabelFontA = xform2 c_th1f_setlabelfonta
+  setLabelOffsetA = xform2 c_th1f_setlabeloffseta
+  setMaximum = xform1 c_th1f_setmaximum
+  setMinimum = xform1 c_th1f_setminimum
+  setNormFactor = xform1 c_th1f_setnormfactor
+  setStats = xform1 c_th1f_setstats
+  setOption = xform1 c_th1f_setoption
+  setXTitle = xform1 c_th1f_setxtitle
+  setYTitle = xform1 c_th1f_setytitle
+  setZTitle = xform1 c_th1f_setztitle
+  showBackground = xform2 c_th1f_showbackground
+  showPeaks = xform3 c_th1f_showpeaks
+  smooth = xform2 c_th1f_smooth
+  sumw2 = xform0 c_th1f_sumw2
+instance ITArrayF TH1F where
+instance ITObject TH1F where
+  draw = xform1 c_th1f_draw
+  findObject = xform1 c_th1f_findobject
+  getName = xform0 c_th1f_getname
+  isA = xform0 c_th1f_isa
+  paint = xform1 c_th1f_paint
+  printObj = xform1 c_th1f_printobj
+  saveAs = xform2 c_th1f_saveas
+  write = xform3 c_th1f_write
+instance ITAttLine TH1F where
+  getLineColor = xform0 c_th1f_getlinecolor
+  getLineStyle = xform0 c_th1f_getlinestyle
+  getLineWidth = xform0 c_th1f_getlinewidth
+  resetAttLine = xform1 c_th1f_resetattline
+  setLineAttributes = xform0 c_th1f_setlineattributes
+  setLineColor = xform1 c_th1f_setlinecolor
+  setLineStyle = xform1 c_th1f_setlinestyle
+  setLineWidth = xform1 c_th1f_setlinewidth
+instance ITAttFill TH1F where
+  setFillColor = xform1 c_th1f_setfillcolor
+  setFillStyle = xform1 c_th1f_setfillstyle
+instance ITAttMarker TH1F where
+  getMarkerColor = xform0 c_th1f_getmarkercolor
+  getMarkerStyle = xform0 c_th1f_getmarkerstyle
+  getMarkerSize = xform0 c_th1f_getmarkersize
+  resetAttMarker = xform1 c_th1f_resetattmarker
+  setMarkerAttributes = xform0 c_th1f_setmarkerattributes
+  setMarkerColor = xform1 c_th1f_setmarkercolor
+  setMarkerStyle = xform1 c_th1f_setmarkerstyle
+  setMarkerSize = xform1 c_th1f_setmarkersize
+instance IDeletable TH1F where
+  delete = xform0 c_th1f_delete
+instance ITArray TH1F where
+
+instance ITH1F (Exist TH1F) where
+
+instance ITH1 (Exist TH1F) where
+  add (ETH1F x) = add x
+  addBinContent (ETH1F x) = addBinContent x
+  chi2Test (ETH1F x) = chi2Test x
+  computeIntegral (ETH1F x) = computeIntegral x
+  directoryAutoAdd (ETH1F x) = directoryAutoAdd x
+  divide (ETH1F x) = divide x
+  drawCopyTH1 (ETH1F x) a1 = return . ETH1F =<< drawCopyTH1 x a1
+  drawNormalized (ETH1F x) = drawNormalized x
+  drawPanelTH1 (ETH1F x) = drawPanelTH1 x
+  bufferEmpty (ETH1F x) = bufferEmpty x
+  evalF (ETH1F x) = evalF x
+  fFT (ETH1F x) = fFT x
+  fill1 (ETH1F x) = fill1 x
+  fill1w (ETH1F x) = fill1w x
+  fillN1 (ETH1F x) = fillN1 x
+  fillRandom (ETH1F x) = fillRandom x
+  findBin (ETH1F x) = findBin x
+  findFixBin (ETH1F x) = findFixBin x
+  findFirstBinAbove (ETH1F x) = findFirstBinAbove x
+  findLastBinAbove (ETH1F x) = findLastBinAbove x
+  fitPanelTH1 (ETH1F x) = fitPanelTH1 x
+  getNdivisionA (ETH1F x) = getNdivisionA x
+  getAxisColorA (ETH1F x) = getAxisColorA x
+  getLabelColorA (ETH1F x) = getLabelColorA x
+  getLabelFontA (ETH1F x) = getLabelFontA x
+  getLabelOffsetA (ETH1F x) = getLabelOffsetA x
+  getLabelSizeA (ETH1F x) = getLabelSizeA x
+  getTitleFontA (ETH1F x) = getTitleFontA x
+  getTitleOffsetA (ETH1F x) = getTitleOffsetA x
+  getTitleSizeA (ETH1F x) = getTitleSizeA x
+  getTickLengthA (ETH1F x) = getTickLengthA x
+  getBarOffset (ETH1F x) = getBarOffset x
+  getBarWidth (ETH1F x) = getBarWidth x
+  getContour (ETH1F x) = getContour x
+  getContourLevel (ETH1F x) = getContourLevel x
+  getContourLevelPad (ETH1F x) = getContourLevelPad x
+  getBin (ETH1F x) = getBin x
+  getBinCenter (ETH1F x) = getBinCenter x
+  getBinContent1 (ETH1F x) = getBinContent1 x
+  getBinContent2 (ETH1F x) = getBinContent2 x
+  getBinContent3 (ETH1F x) = getBinContent3 x
+  getBinError1 (ETH1F x) = getBinError1 x
+  getBinError2 (ETH1F x) = getBinError2 x
+  getBinError3 (ETH1F x) = getBinError3 x
+  getBinLowEdge (ETH1F x) = getBinLowEdge x
+  getBinWidth (ETH1F x) = getBinWidth x
+  getCellContent (ETH1F x) = getCellContent x
+  getCellError (ETH1F x) = getCellError x
+  getEntries (ETH1F x) = getEntries x
+  getEffectiveEntries (ETH1F x) = getEffectiveEntries x
+  getFunction (ETH1F x) = getFunction x
+  getDimension (ETH1F x) = getDimension x
+  getKurtosis (ETH1F x) = getKurtosis x
+  getLowEdge (ETH1F x) = getLowEdge x
+  getMaximumTH1 (ETH1F x) = getMaximumTH1 x
+  getMaximumBin (ETH1F x) = getMaximumBin x
+  getMaximumStored (ETH1F x) = getMaximumStored x
+  getMinimumTH1 (ETH1F x) = getMinimumTH1 x
+  getMinimumBin (ETH1F x) = getMinimumBin x
+  getMinimumStored (ETH1F x) = getMinimumStored x
+  getMean (ETH1F x) = getMean x
+  getMeanError (ETH1F x) = getMeanError x
+  getNbinsX (ETH1F x) = getNbinsX x
+  getNbinsY (ETH1F x) = getNbinsY x
+  getNbinsZ (ETH1F x) = getNbinsZ x
+  getQuantilesTH1 (ETH1F x) = getQuantilesTH1 x
+  getRandom (ETH1F x) = getRandom x
+  getStats (ETH1F x) = getStats x
+  getSumOfWeights (ETH1F x) = getSumOfWeights x
+  getSumw2 (ETH1F x) = getSumw2 x
+  getSumw2N (ETH1F x) = getSumw2N x
+  getRMS (ETH1F x) = getRMS x
+  getRMSError (ETH1F x) = getRMSError x
+  getSkewness (ETH1F x) = getSkewness x
+  integral1 (ETH1F x) = integral1 x
+  interpolate1 (ETH1F x) = interpolate1 x
+  interpolate2 (ETH1F x) = interpolate2 x
+  interpolate3 (ETH1F x) = interpolate3 x
+  kolmogorovTest (ETH1F x) = kolmogorovTest x
+  labelsDeflate (ETH1F x) = labelsDeflate x
+  labelsInflate (ETH1F x) = labelsInflate x
+  labelsOption (ETH1F x) = labelsOption x
+  multiflyF (ETH1F x) = multiflyF x
+  multiply (ETH1F x) = multiply x
+  putStats (ETH1F x) = putStats x
+  rebin (ETH1F x) = rebin x
+  rebinAxis (ETH1F x) = rebinAxis x
+  rebuild (ETH1F x) = rebuild x
+  recursiveRemove (ETH1F x) = recursiveRemove x
+  reset (ETH1F x) = reset x
+  resetStats (ETH1F x) = resetStats x
+  scale (ETH1F x) = scale x
+  setAxisColorA (ETH1F x) = setAxisColorA x
+  setAxisRange (ETH1F x) = setAxisRange x
+  setBarOffset (ETH1F x) = setBarOffset x
+  setBarWidth (ETH1F x) = setBarWidth x
+  setBinContent1 (ETH1F x) = setBinContent1 x
+  setBinContent2 (ETH1F x) = setBinContent2 x
+  setBinContent3 (ETH1F x) = setBinContent3 x
+  setBinError1 (ETH1F x) = setBinError1 x
+  setBinError2 (ETH1F x) = setBinError2 x
+  setBinError3 (ETH1F x) = setBinError3 x
+  setBins1 (ETH1F x) = setBins1 x
+  setBins2 (ETH1F x) = setBins2 x
+  setBins3 (ETH1F x) = setBins3 x
+  setBinsLength (ETH1F x) = setBinsLength x
+  setBuffer (ETH1F x) = setBuffer x
+  setCellContent (ETH1F x) = setCellContent x
+  setContent (ETH1F x) = setContent x
+  setContour (ETH1F x) = setContour x
+  setContourLevel (ETH1F x) = setContourLevel x
+  setDirectory (ETH1F x) = setDirectory x
+  setEntries (ETH1F x) = setEntries x
+  setError (ETH1F x) = setError x
+  setLabelColorA (ETH1F x) = setLabelColorA x
+  setLabelSizeA (ETH1F x) = setLabelSizeA x
+  setLabelFontA (ETH1F x) = setLabelFontA x
+  setLabelOffsetA (ETH1F x) = setLabelOffsetA x
+  setMaximum (ETH1F x) = setMaximum x
+  setMinimum (ETH1F x) = setMinimum x
+  setNormFactor (ETH1F x) = setNormFactor x
+  setStats (ETH1F x) = setStats x
+  setOption (ETH1F x) = setOption x
+  setXTitle (ETH1F x) = setXTitle x
+  setYTitle (ETH1F x) = setYTitle x
+  setZTitle (ETH1F x) = setZTitle x
+  showBackground (ETH1F x) = showBackground x
+  showPeaks (ETH1F x) = showPeaks x
+  smooth (ETH1F x) = smooth x
+  sumw2 (ETH1F x) = sumw2 x
+instance ITArrayF (Exist TH1F) where
+
+instance ITObject (Exist TH1F) where
+  draw (ETH1F x) = draw x
+  findObject (ETH1F x) = findObject x
+  getName (ETH1F x) = getName x
+  isA (ETH1F x) = isA x
+  paint (ETH1F x) = paint x
+  printObj (ETH1F x) = printObj x
+  saveAs (ETH1F x) = saveAs x
+  write (ETH1F x) = write x
+instance ITAttLine (Exist TH1F) where
+  getLineColor (ETH1F x) = getLineColor x
+  getLineStyle (ETH1F x) = getLineStyle x
+  getLineWidth (ETH1F x) = getLineWidth x
+  resetAttLine (ETH1F x) = resetAttLine x
+  setLineAttributes (ETH1F x) = setLineAttributes x
+  setLineColor (ETH1F x) = setLineColor x
+  setLineStyle (ETH1F x) = setLineStyle x
+  setLineWidth (ETH1F x) = setLineWidth x
+instance ITAttFill (Exist TH1F) where
+  setFillColor (ETH1F x) = setFillColor x
+  setFillStyle (ETH1F x) = setFillStyle x
+instance ITAttMarker (Exist TH1F) where
+  getMarkerColor (ETH1F x) = getMarkerColor x
+  getMarkerStyle (ETH1F x) = getMarkerStyle x
+  getMarkerSize (ETH1F x) = getMarkerSize x
+  resetAttMarker (ETH1F x) = resetAttMarker x
+  setMarkerAttributes (ETH1F x) = setMarkerAttributes x
+  setMarkerColor (ETH1F x) = setMarkerColor x
+  setMarkerStyle (ETH1F x) = setMarkerStyle x
+  setMarkerSize (ETH1F x) = setMarkerSize x
+instance IDeletable (Exist TH1F) where
+  delete (ETH1F x) = delete x
+instance ITArray (Exist TH1F) where
+
+
+
+newTH1F :: CString -> CString -> CInt -> CDouble -> CDouble -> IO TH1F
+newTH1F = xform4 c_th1f_newth1f
+
+
+
+
+
+instance FPtr (Exist TH1F) where
+  type Raw (Exist TH1F) = RawTH1F
+  get_fptr (ETH1F obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH1F (cast_fptr_to_obj (fptr :: ForeignPtr RawTH1F) :: TH1F)
diff --git a/src/HROOT/Hist/TH1F/Interface.hs b/src/HROOT/Hist/TH1F/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1F/Interface.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH1F.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH1F.RawType
+
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TArrayF.Interface
+---- ============ ----
+
+
+
+class (ITH1 a,ITArrayF a) => ITH1F a where
+
+instance Existable TH1F where
+  data Exist TH1F = forall a. (FPtr a, ITH1F a) => ETH1F a
+
+upcastTH1F :: (FPtr a, ITH1F a) => a -> TH1F
+upcastTH1F h = let fh = get_fptr h
+                   fh2 :: ForeignPtr RawTH1F = castForeignPtr fh
+               in cast_fptr_to_obj fh2
+
+downcastTH1F :: (FPtr a, ITH1F a) => TH1F -> a 
+downcastTH1F h = let fh = get_fptr h
+                     fh2 = castForeignPtr fh
+                 in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH1F/Interface.hs-boot b/src/HROOT/Hist/TH1F/Interface.hs-boot
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1F/Interface.hs-boot
@@ -0,0 +1,3 @@
+module HROOT.Hist.TH1F.Interface where
+
+class ITH1F a
diff --git a/src/HROOT/Hist/TH1F/RawType.hs b/src/HROOT/Hist/TH1F/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1F/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH1F.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH1F
+newtype TH1F = TH1F (ForeignPtr RawTH1F) deriving (Eq, Ord, Show)
+instance FPtr TH1F where
+   type Raw TH1F = RawTH1F
+   get_fptr (TH1F fptr) = fptr
+   cast_fptr_to_obj = TH1F
diff --git a/src/HROOT/Hist/TH1I.hs b/src/HROOT/Hist/TH1I.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1I.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TH1I
+  (
+    TH1I(..)
+  , ITH1I
+  , upcastTH1I
+  , downcastTH1I
+
+ 
+  ) where
+
+import HROOT.Hist.TH1I.RawType
+import HROOT.Hist.TH1I.Interface
+import HROOT.Hist.TH1I.Implementation
+
+
diff --git a/src/HROOT/Hist/TH1I/Cast.hs b/src/HROOT/Hist/TH1I/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1I/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH1I.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH1I.RawType
+import HROOT.Hist.TH1I.Interface
+
+instance (ITH1I a, FPtr a) => Castable a (Ptr RawTH1I) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH1I (Ptr RawTH1I) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH1I/FFI.hsc b/src/HROOT/Hist/TH1I/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1I/FFI.hsc
@@ -0,0 +1,496 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH1I.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH1I.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTH1I.h"
+
+foreign import ccall "HROOTHistTH1I.h TH1I_Add" c_th1i_add 
+  :: (Ptr RawTH1I) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_AddBinContent" c_th1i_addbincontent 
+  :: (Ptr RawTH1I) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_Chi2Test" c_th1i_chi2test 
+  :: (Ptr RawTH1I) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_ComputeIntegral" c_th1i_computeintegral 
+  :: (Ptr RawTH1I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_DirectoryAutoAdd" c_th1i_directoryautoadd 
+  :: (Ptr RawTH1I) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_Divide" c_th1i_divide 
+  :: (Ptr RawTH1I) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_drawCopyTH1" c_th1i_drawcopyth1 
+  :: (Ptr RawTH1I) -> CString -> IO (Ptr RawTH1I)
+
+foreign import ccall "HROOTHistTH1I.h TH1I_DrawNormalized" c_th1i_drawnormalized 
+  :: (Ptr RawTH1I) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1I.h TH1I_drawPanelTH1" c_th1i_drawpanelth1 
+  :: (Ptr RawTH1I) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_BufferEmpty" c_th1i_bufferempty 
+  :: (Ptr RawTH1I) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_evalF" c_th1i_evalf 
+  :: (Ptr RawTH1I) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_FFT" c_th1i_fft 
+  :: (Ptr RawTH1I) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1I.h TH1I_fill1" c_th1i_fill1 
+  :: (Ptr RawTH1I) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_fill1w" c_th1i_fill1w 
+  :: (Ptr RawTH1I) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_fillN1" c_th1i_filln1 
+  :: (Ptr RawTH1I) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_FillRandom" c_th1i_fillrandom 
+  :: (Ptr RawTH1I) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_FindBin" c_th1i_findbin 
+  :: (Ptr RawTH1I) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_FindFixBin" c_th1i_findfixbin 
+  :: (Ptr RawTH1I) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_FindFirstBinAbove" c_th1i_findfirstbinabove 
+  :: (Ptr RawTH1I) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_FindLastBinAbove" c_th1i_findlastbinabove 
+  :: (Ptr RawTH1I) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_FitPanelTH1" c_th1i_fitpanelth1 
+  :: (Ptr RawTH1I) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_getNdivisionA" c_th1i_getndivisiona 
+  :: (Ptr RawTH1I) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_getAxisColorA" c_th1i_getaxiscolora 
+  :: (Ptr RawTH1I) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_getLabelColorA" c_th1i_getlabelcolora 
+  :: (Ptr RawTH1I) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_getLabelFontA" c_th1i_getlabelfonta 
+  :: (Ptr RawTH1I) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_getLabelOffsetA" c_th1i_getlabeloffseta 
+  :: (Ptr RawTH1I) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_getLabelSizeA" c_th1i_getlabelsizea 
+  :: (Ptr RawTH1I) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_getTitleFontA" c_th1i_gettitlefonta 
+  :: (Ptr RawTH1I) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_getTitleOffsetA" c_th1i_gettitleoffseta 
+  :: (Ptr RawTH1I) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_getTitleSizeA" c_th1i_gettitlesizea 
+  :: (Ptr RawTH1I) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_getTickLengthA" c_th1i_getticklengtha 
+  :: (Ptr RawTH1I) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetBarOffset" c_th1i_getbaroffset 
+  :: (Ptr RawTH1I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetBarWidth" c_th1i_getbarwidth 
+  :: (Ptr RawTH1I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetContour" c_th1i_getcontour 
+  :: (Ptr RawTH1I) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetContourLevel" c_th1i_getcontourlevel 
+  :: (Ptr RawTH1I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetContourLevelPad" c_th1i_getcontourlevelpad 
+  :: (Ptr RawTH1I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetBin" c_th1i_getbin 
+  :: (Ptr RawTH1I) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetBinCenter" c_th1i_getbincenter 
+  :: (Ptr RawTH1I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetBinContent1" c_th1i_getbincontent1 
+  :: (Ptr RawTH1I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetBinContent2" c_th1i_getbincontent2 
+  :: (Ptr RawTH1I) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetBinContent3" c_th1i_getbincontent3 
+  :: (Ptr RawTH1I) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetBinError1" c_th1i_getbinerror1 
+  :: (Ptr RawTH1I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetBinError2" c_th1i_getbinerror2 
+  :: (Ptr RawTH1I) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetBinError3" c_th1i_getbinerror3 
+  :: (Ptr RawTH1I) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetBinLowEdge" c_th1i_getbinlowedge 
+  :: (Ptr RawTH1I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetBinWidth" c_th1i_getbinwidth 
+  :: (Ptr RawTH1I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetCellContent" c_th1i_getcellcontent 
+  :: (Ptr RawTH1I) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetCellError" c_th1i_getcellerror 
+  :: (Ptr RawTH1I) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetEntries" c_th1i_getentries 
+  :: (Ptr RawTH1I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetEffectiveEntries" c_th1i_geteffectiveentries 
+  :: (Ptr RawTH1I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetFunction" c_th1i_getfunction 
+  :: (Ptr RawTH1I) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetDimension" c_th1i_getdimension 
+  :: (Ptr RawTH1I) -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetKurtosis" c_th1i_getkurtosis 
+  :: (Ptr RawTH1I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetLowEdge" c_th1i_getlowedge 
+  :: (Ptr RawTH1I) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_getMaximumTH1" c_th1i_getmaximumth1 
+  :: (Ptr RawTH1I) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetMaximumBin" c_th1i_getmaximumbin 
+  :: (Ptr RawTH1I) -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetMaximumStored" c_th1i_getmaximumstored 
+  :: (Ptr RawTH1I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_getMinimumTH1" c_th1i_getminimumth1 
+  :: (Ptr RawTH1I) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetMinimumBin" c_th1i_getminimumbin 
+  :: (Ptr RawTH1I) -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetMinimumStored" c_th1i_getminimumstored 
+  :: (Ptr RawTH1I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetMean" c_th1i_getmean 
+  :: (Ptr RawTH1I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetMeanError" c_th1i_getmeanerror 
+  :: (Ptr RawTH1I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetNbinsX" c_th1i_getnbinsx 
+  :: (Ptr RawTH1I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetNbinsY" c_th1i_getnbinsy 
+  :: (Ptr RawTH1I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetNbinsZ" c_th1i_getnbinsz 
+  :: (Ptr RawTH1I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_getQuantilesTH1" c_th1i_getquantilesth1 
+  :: (Ptr RawTH1I) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetRandom" c_th1i_getrandom 
+  :: (Ptr RawTH1I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetStats" c_th1i_getstats 
+  :: (Ptr RawTH1I) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetSumOfWeights" c_th1i_getsumofweights 
+  :: (Ptr RawTH1I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetSumw2" c_th1i_getsumw2 
+  :: (Ptr RawTH1I) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetSumw2N" c_th1i_getsumw2n 
+  :: (Ptr RawTH1I) -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetRMS" c_th1i_getrms 
+  :: (Ptr RawTH1I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetRMSError" c_th1i_getrmserror 
+  :: (Ptr RawTH1I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetSkewness" c_th1i_getskewness 
+  :: (Ptr RawTH1I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_integral1" c_th1i_integral1 
+  :: (Ptr RawTH1I) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_interpolate1" c_th1i_interpolate1 
+  :: (Ptr RawTH1I) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_interpolate2" c_th1i_interpolate2 
+  :: (Ptr RawTH1I) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_interpolate3" c_th1i_interpolate3 
+  :: (Ptr RawTH1I) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_KolmogorovTest" c_th1i_kolmogorovtest 
+  :: (Ptr RawTH1I) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_LabelsDeflate" c_th1i_labelsdeflate 
+  :: (Ptr RawTH1I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_LabelsInflate" c_th1i_labelsinflate 
+  :: (Ptr RawTH1I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_LabelsOption" c_th1i_labelsoption 
+  :: (Ptr RawTH1I) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_multiflyF" c_th1i_multiflyf 
+  :: (Ptr RawTH1I) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_Multiply" c_th1i_multiply 
+  :: (Ptr RawTH1I) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_PutStats" c_th1i_putstats 
+  :: (Ptr RawTH1I) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_Rebin" c_th1i_rebin 
+  :: (Ptr RawTH1I) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1I.h TH1I_RebinAxis" c_th1i_rebinaxis 
+  :: (Ptr RawTH1I) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_Rebuild" c_th1i_rebuild 
+  :: (Ptr RawTH1I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_RecursiveRemove" c_th1i_recursiveremove 
+  :: (Ptr RawTH1I) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_Reset" c_th1i_reset 
+  :: (Ptr RawTH1I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_ResetStats" c_th1i_resetstats 
+  :: (Ptr RawTH1I) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_Scale" c_th1i_scale 
+  :: (Ptr RawTH1I) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_setAxisColorA" c_th1i_setaxiscolora 
+  :: (Ptr RawTH1I) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetAxisRange" c_th1i_setaxisrange 
+  :: (Ptr RawTH1I) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetBarOffset" c_th1i_setbaroffset 
+  :: (Ptr RawTH1I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetBarWidth" c_th1i_setbarwidth 
+  :: (Ptr RawTH1I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_setBinContent1" c_th1i_setbincontent1 
+  :: (Ptr RawTH1I) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_setBinContent2" c_th1i_setbincontent2 
+  :: (Ptr RawTH1I) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_setBinContent3" c_th1i_setbincontent3 
+  :: (Ptr RawTH1I) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_setBinError1" c_th1i_setbinerror1 
+  :: (Ptr RawTH1I) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_setBinError2" c_th1i_setbinerror2 
+  :: (Ptr RawTH1I) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_setBinError3" c_th1i_setbinerror3 
+  :: (Ptr RawTH1I) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_setBins1" c_th1i_setbins1 
+  :: (Ptr RawTH1I) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_setBins2" c_th1i_setbins2 
+  :: (Ptr RawTH1I) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_setBins3" c_th1i_setbins3 
+  :: (Ptr RawTH1I) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetBinsLength" c_th1i_setbinslength 
+  :: (Ptr RawTH1I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetBuffer" c_th1i_setbuffer 
+  :: (Ptr RawTH1I) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetCellContent" c_th1i_setcellcontent 
+  :: (Ptr RawTH1I) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetContent" c_th1i_setcontent 
+  :: (Ptr RawTH1I) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetContour" c_th1i_setcontour 
+  :: (Ptr RawTH1I) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetContourLevel" c_th1i_setcontourlevel 
+  :: (Ptr RawTH1I) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetDirectory" c_th1i_setdirectory 
+  :: (Ptr RawTH1I) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetEntries" c_th1i_setentries 
+  :: (Ptr RawTH1I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetError" c_th1i_seterror 
+  :: (Ptr RawTH1I) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_setLabelColorA" c_th1i_setlabelcolora 
+  :: (Ptr RawTH1I) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_setLabelSizeA" c_th1i_setlabelsizea 
+  :: (Ptr RawTH1I) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_setLabelFontA" c_th1i_setlabelfonta 
+  :: (Ptr RawTH1I) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_setLabelOffsetA" c_th1i_setlabeloffseta 
+  :: (Ptr RawTH1I) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetMaximum" c_th1i_setmaximum 
+  :: (Ptr RawTH1I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetMinimum" c_th1i_setminimum 
+  :: (Ptr RawTH1I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetNormFactor" c_th1i_setnormfactor 
+  :: (Ptr RawTH1I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetStats" c_th1i_setstats 
+  :: (Ptr RawTH1I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetOption" c_th1i_setoption 
+  :: (Ptr RawTH1I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetXTitle" c_th1i_setxtitle 
+  :: (Ptr RawTH1I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetYTitle" c_th1i_setytitle 
+  :: (Ptr RawTH1I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetZTitle" c_th1i_setztitle 
+  :: (Ptr RawTH1I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_ShowBackground" c_th1i_showbackground 
+  :: (Ptr RawTH1I) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1I.h TH1I_ShowPeaks" c_th1i_showpeaks 
+  :: (Ptr RawTH1I) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_Smooth" c_th1i_smooth 
+  :: (Ptr RawTH1I) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_Sumw2" c_th1i_sumw2 
+  :: (Ptr RawTH1I) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_Draw" c_th1i_draw 
+  :: (Ptr RawTH1I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_FindObject" c_th1i_findobject 
+  :: (Ptr RawTH1I) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetName" c_th1i_getname 
+  :: (Ptr RawTH1I) -> IO CString
+
+foreign import ccall "HROOTHistTH1I.h TH1I_IsA" c_th1i_isa 
+  :: (Ptr RawTH1I) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH1I.h TH1I_Paint" c_th1i_paint 
+  :: (Ptr RawTH1I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_printObj" c_th1i_printobj 
+  :: (Ptr RawTH1I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SaveAs" c_th1i_saveas 
+  :: (Ptr RawTH1I) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_Write" c_th1i_write 
+  :: (Ptr RawTH1I) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetLineColor" c_th1i_getlinecolor 
+  :: (Ptr RawTH1I) -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetLineStyle" c_th1i_getlinestyle 
+  :: (Ptr RawTH1I) -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetLineWidth" c_th1i_getlinewidth 
+  :: (Ptr RawTH1I) -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_ResetAttLine" c_th1i_resetattline 
+  :: (Ptr RawTH1I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetLineAttributes" c_th1i_setlineattributes 
+  :: (Ptr RawTH1I) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetLineColor" c_th1i_setlinecolor 
+  :: (Ptr RawTH1I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetLineStyle" c_th1i_setlinestyle 
+  :: (Ptr RawTH1I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetLineWidth" c_th1i_setlinewidth 
+  :: (Ptr RawTH1I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetFillColor" c_th1i_setfillcolor 
+  :: (Ptr RawTH1I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetFillStyle" c_th1i_setfillstyle 
+  :: (Ptr RawTH1I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetMarkerColor" c_th1i_getmarkercolor 
+  :: (Ptr RawTH1I) -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetMarkerStyle" c_th1i_getmarkerstyle 
+  :: (Ptr RawTH1I) -> IO CInt
+
+foreign import ccall "HROOTHistTH1I.h TH1I_GetMarkerSize" c_th1i_getmarkersize 
+  :: (Ptr RawTH1I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1I.h TH1I_ResetAttMarker" c_th1i_resetattmarker 
+  :: (Ptr RawTH1I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetMarkerAttributes" c_th1i_setmarkerattributes 
+  :: (Ptr RawTH1I) -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetMarkerColor" c_th1i_setmarkercolor 
+  :: (Ptr RawTH1I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetMarkerStyle" c_th1i_setmarkerstyle 
+  :: (Ptr RawTH1I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_SetMarkerSize" c_th1i_setmarkersize 
+  :: (Ptr RawTH1I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1I.h TH1I_delete" c_th1i_delete 
+  :: (Ptr RawTH1I) -> IO ()
+
diff --git a/src/HROOT/Hist/TH1I/Implementation.hs b/src/HROOT/Hist/TH1I/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1I/Implementation.hs
@@ -0,0 +1,408 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH1I.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH1I.RawType
+import HROOT.Hist.TH1I.FFI
+import HROOT.Hist.TH1I.Interface
+import HROOT.Hist.TH1I.Cast
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TArrayI.RawType
+import HROOT.Core.TArrayI.Cast
+import HROOT.Core.TArrayI.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+import HROOT.Core.TArray.RawType
+import HROOT.Core.TArray.Cast
+import HROOT.Core.TArray.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH1I TH1I where
+instance ITH1 TH1I where
+  add = xform2 c_th1i_add
+  addBinContent = xform2 c_th1i_addbincontent
+  chi2Test = xform3 c_th1i_chi2test
+  computeIntegral = xform0 c_th1i_computeintegral
+  directoryAutoAdd = xform1 c_th1i_directoryautoadd
+  divide = xform5 c_th1i_divide
+  drawCopyTH1 = xform1 c_th1i_drawcopyth1
+  drawNormalized = xform2 c_th1i_drawnormalized
+  drawPanelTH1 = xform0 c_th1i_drawpanelth1
+  bufferEmpty = xform1 c_th1i_bufferempty
+  evalF = xform2 c_th1i_evalf
+  fFT = xform2 c_th1i_fft
+  fill1 = xform1 c_th1i_fill1
+  fill1w = xform2 c_th1i_fill1w
+  fillN1 = xform4 c_th1i_filln1
+  fillRandom = xform2 c_th1i_fillrandom
+  findBin = xform3 c_th1i_findbin
+  findFixBin = xform3 c_th1i_findfixbin
+  findFirstBinAbove = xform2 c_th1i_findfirstbinabove
+  findLastBinAbove = xform2 c_th1i_findlastbinabove
+  fitPanelTH1 = xform0 c_th1i_fitpanelth1
+  getNdivisionA = xform1 c_th1i_getndivisiona
+  getAxisColorA = xform1 c_th1i_getaxiscolora
+  getLabelColorA = xform1 c_th1i_getlabelcolora
+  getLabelFontA = xform1 c_th1i_getlabelfonta
+  getLabelOffsetA = xform1 c_th1i_getlabeloffseta
+  getLabelSizeA = xform1 c_th1i_getlabelsizea
+  getTitleFontA = xform1 c_th1i_gettitlefonta
+  getTitleOffsetA = xform1 c_th1i_gettitleoffseta
+  getTitleSizeA = xform1 c_th1i_gettitlesizea
+  getTickLengthA = xform1 c_th1i_getticklengtha
+  getBarOffset = xform0 c_th1i_getbaroffset
+  getBarWidth = xform0 c_th1i_getbarwidth
+  getContour = xform1 c_th1i_getcontour
+  getContourLevel = xform1 c_th1i_getcontourlevel
+  getContourLevelPad = xform1 c_th1i_getcontourlevelpad
+  getBin = xform3 c_th1i_getbin
+  getBinCenter = xform1 c_th1i_getbincenter
+  getBinContent1 = xform1 c_th1i_getbincontent1
+  getBinContent2 = xform2 c_th1i_getbincontent2
+  getBinContent3 = xform3 c_th1i_getbincontent3
+  getBinError1 = xform1 c_th1i_getbinerror1
+  getBinError2 = xform2 c_th1i_getbinerror2
+  getBinError3 = xform3 c_th1i_getbinerror3
+  getBinLowEdge = xform1 c_th1i_getbinlowedge
+  getBinWidth = xform1 c_th1i_getbinwidth
+  getCellContent = xform2 c_th1i_getcellcontent
+  getCellError = xform2 c_th1i_getcellerror
+  getEntries = xform0 c_th1i_getentries
+  getEffectiveEntries = xform0 c_th1i_geteffectiveentries
+  getFunction = xform1 c_th1i_getfunction
+  getDimension = xform0 c_th1i_getdimension
+  getKurtosis = xform1 c_th1i_getkurtosis
+  getLowEdge = xform1 c_th1i_getlowedge
+  getMaximumTH1 = xform1 c_th1i_getmaximumth1
+  getMaximumBin = xform0 c_th1i_getmaximumbin
+  getMaximumStored = xform0 c_th1i_getmaximumstored
+  getMinimumTH1 = xform1 c_th1i_getminimumth1
+  getMinimumBin = xform0 c_th1i_getminimumbin
+  getMinimumStored = xform0 c_th1i_getminimumstored
+  getMean = xform1 c_th1i_getmean
+  getMeanError = xform1 c_th1i_getmeanerror
+  getNbinsX = xform0 c_th1i_getnbinsx
+  getNbinsY = xform0 c_th1i_getnbinsy
+  getNbinsZ = xform0 c_th1i_getnbinsz
+  getQuantilesTH1 = xform3 c_th1i_getquantilesth1
+  getRandom = xform0 c_th1i_getrandom
+  getStats = xform1 c_th1i_getstats
+  getSumOfWeights = xform0 c_th1i_getsumofweights
+  getSumw2 = xform0 c_th1i_getsumw2
+  getSumw2N = xform0 c_th1i_getsumw2n
+  getRMS = xform1 c_th1i_getrms
+  getRMSError = xform1 c_th1i_getrmserror
+  getSkewness = xform1 c_th1i_getskewness
+  integral1 = xform3 c_th1i_integral1
+  interpolate1 = xform1 c_th1i_interpolate1
+  interpolate2 = xform2 c_th1i_interpolate2
+  interpolate3 = xform3 c_th1i_interpolate3
+  kolmogorovTest = xform2 c_th1i_kolmogorovtest
+  labelsDeflate = xform1 c_th1i_labelsdeflate
+  labelsInflate = xform1 c_th1i_labelsinflate
+  labelsOption = xform2 c_th1i_labelsoption
+  multiflyF = xform2 c_th1i_multiflyf
+  multiply = xform5 c_th1i_multiply
+  putStats = xform1 c_th1i_putstats
+  rebin = xform3 c_th1i_rebin
+  rebinAxis = xform2 c_th1i_rebinaxis
+  rebuild = xform1 c_th1i_rebuild
+  recursiveRemove = xform1 c_th1i_recursiveremove
+  reset = xform1 c_th1i_reset
+  resetStats = xform0 c_th1i_resetstats
+  scale = xform2 c_th1i_scale
+  setAxisColorA = xform2 c_th1i_setaxiscolora
+  setAxisRange = xform3 c_th1i_setaxisrange
+  setBarOffset = xform1 c_th1i_setbaroffset
+  setBarWidth = xform1 c_th1i_setbarwidth
+  setBinContent1 = xform2 c_th1i_setbincontent1
+  setBinContent2 = xform3 c_th1i_setbincontent2
+  setBinContent3 = xform4 c_th1i_setbincontent3
+  setBinError1 = xform2 c_th1i_setbinerror1
+  setBinError2 = xform3 c_th1i_setbinerror2
+  setBinError3 = xform4 c_th1i_setbinerror3
+  setBins1 = xform2 c_th1i_setbins1
+  setBins2 = xform4 c_th1i_setbins2
+  setBins3 = xform6 c_th1i_setbins3
+  setBinsLength = xform1 c_th1i_setbinslength
+  setBuffer = xform2 c_th1i_setbuffer
+  setCellContent = xform3 c_th1i_setcellcontent
+  setContent = xform1 c_th1i_setcontent
+  setContour = xform2 c_th1i_setcontour
+  setContourLevel = xform2 c_th1i_setcontourlevel
+  setDirectory = xform1 c_th1i_setdirectory
+  setEntries = xform1 c_th1i_setentries
+  setError = xform1 c_th1i_seterror
+  setLabelColorA = xform2 c_th1i_setlabelcolora
+  setLabelSizeA = xform2 c_th1i_setlabelsizea
+  setLabelFontA = xform2 c_th1i_setlabelfonta
+  setLabelOffsetA = xform2 c_th1i_setlabeloffseta
+  setMaximum = xform1 c_th1i_setmaximum
+  setMinimum = xform1 c_th1i_setminimum
+  setNormFactor = xform1 c_th1i_setnormfactor
+  setStats = xform1 c_th1i_setstats
+  setOption = xform1 c_th1i_setoption
+  setXTitle = xform1 c_th1i_setxtitle
+  setYTitle = xform1 c_th1i_setytitle
+  setZTitle = xform1 c_th1i_setztitle
+  showBackground = xform2 c_th1i_showbackground
+  showPeaks = xform3 c_th1i_showpeaks
+  smooth = xform2 c_th1i_smooth
+  sumw2 = xform0 c_th1i_sumw2
+instance ITArrayI TH1I where
+instance ITObject TH1I where
+  draw = xform1 c_th1i_draw
+  findObject = xform1 c_th1i_findobject
+  getName = xform0 c_th1i_getname
+  isA = xform0 c_th1i_isa
+  paint = xform1 c_th1i_paint
+  printObj = xform1 c_th1i_printobj
+  saveAs = xform2 c_th1i_saveas
+  write = xform3 c_th1i_write
+instance ITAttLine TH1I where
+  getLineColor = xform0 c_th1i_getlinecolor
+  getLineStyle = xform0 c_th1i_getlinestyle
+  getLineWidth = xform0 c_th1i_getlinewidth
+  resetAttLine = xform1 c_th1i_resetattline
+  setLineAttributes = xform0 c_th1i_setlineattributes
+  setLineColor = xform1 c_th1i_setlinecolor
+  setLineStyle = xform1 c_th1i_setlinestyle
+  setLineWidth = xform1 c_th1i_setlinewidth
+instance ITAttFill TH1I where
+  setFillColor = xform1 c_th1i_setfillcolor
+  setFillStyle = xform1 c_th1i_setfillstyle
+instance ITAttMarker TH1I where
+  getMarkerColor = xform0 c_th1i_getmarkercolor
+  getMarkerStyle = xform0 c_th1i_getmarkerstyle
+  getMarkerSize = xform0 c_th1i_getmarkersize
+  resetAttMarker = xform1 c_th1i_resetattmarker
+  setMarkerAttributes = xform0 c_th1i_setmarkerattributes
+  setMarkerColor = xform1 c_th1i_setmarkercolor
+  setMarkerStyle = xform1 c_th1i_setmarkerstyle
+  setMarkerSize = xform1 c_th1i_setmarkersize
+instance IDeletable TH1I where
+  delete = xform0 c_th1i_delete
+instance ITArray TH1I where
+
+instance ITH1I (Exist TH1I) where
+
+instance ITH1 (Exist TH1I) where
+  add (ETH1I x) = add x
+  addBinContent (ETH1I x) = addBinContent x
+  chi2Test (ETH1I x) = chi2Test x
+  computeIntegral (ETH1I x) = computeIntegral x
+  directoryAutoAdd (ETH1I x) = directoryAutoAdd x
+  divide (ETH1I x) = divide x
+  drawCopyTH1 (ETH1I x) a1 = return . ETH1I =<< drawCopyTH1 x a1
+  drawNormalized (ETH1I x) = drawNormalized x
+  drawPanelTH1 (ETH1I x) = drawPanelTH1 x
+  bufferEmpty (ETH1I x) = bufferEmpty x
+  evalF (ETH1I x) = evalF x
+  fFT (ETH1I x) = fFT x
+  fill1 (ETH1I x) = fill1 x
+  fill1w (ETH1I x) = fill1w x
+  fillN1 (ETH1I x) = fillN1 x
+  fillRandom (ETH1I x) = fillRandom x
+  findBin (ETH1I x) = findBin x
+  findFixBin (ETH1I x) = findFixBin x
+  findFirstBinAbove (ETH1I x) = findFirstBinAbove x
+  findLastBinAbove (ETH1I x) = findLastBinAbove x
+  fitPanelTH1 (ETH1I x) = fitPanelTH1 x
+  getNdivisionA (ETH1I x) = getNdivisionA x
+  getAxisColorA (ETH1I x) = getAxisColorA x
+  getLabelColorA (ETH1I x) = getLabelColorA x
+  getLabelFontA (ETH1I x) = getLabelFontA x
+  getLabelOffsetA (ETH1I x) = getLabelOffsetA x
+  getLabelSizeA (ETH1I x) = getLabelSizeA x
+  getTitleFontA (ETH1I x) = getTitleFontA x
+  getTitleOffsetA (ETH1I x) = getTitleOffsetA x
+  getTitleSizeA (ETH1I x) = getTitleSizeA x
+  getTickLengthA (ETH1I x) = getTickLengthA x
+  getBarOffset (ETH1I x) = getBarOffset x
+  getBarWidth (ETH1I x) = getBarWidth x
+  getContour (ETH1I x) = getContour x
+  getContourLevel (ETH1I x) = getContourLevel x
+  getContourLevelPad (ETH1I x) = getContourLevelPad x
+  getBin (ETH1I x) = getBin x
+  getBinCenter (ETH1I x) = getBinCenter x
+  getBinContent1 (ETH1I x) = getBinContent1 x
+  getBinContent2 (ETH1I x) = getBinContent2 x
+  getBinContent3 (ETH1I x) = getBinContent3 x
+  getBinError1 (ETH1I x) = getBinError1 x
+  getBinError2 (ETH1I x) = getBinError2 x
+  getBinError3 (ETH1I x) = getBinError3 x
+  getBinLowEdge (ETH1I x) = getBinLowEdge x
+  getBinWidth (ETH1I x) = getBinWidth x
+  getCellContent (ETH1I x) = getCellContent x
+  getCellError (ETH1I x) = getCellError x
+  getEntries (ETH1I x) = getEntries x
+  getEffectiveEntries (ETH1I x) = getEffectiveEntries x
+  getFunction (ETH1I x) = getFunction x
+  getDimension (ETH1I x) = getDimension x
+  getKurtosis (ETH1I x) = getKurtosis x
+  getLowEdge (ETH1I x) = getLowEdge x
+  getMaximumTH1 (ETH1I x) = getMaximumTH1 x
+  getMaximumBin (ETH1I x) = getMaximumBin x
+  getMaximumStored (ETH1I x) = getMaximumStored x
+  getMinimumTH1 (ETH1I x) = getMinimumTH1 x
+  getMinimumBin (ETH1I x) = getMinimumBin x
+  getMinimumStored (ETH1I x) = getMinimumStored x
+  getMean (ETH1I x) = getMean x
+  getMeanError (ETH1I x) = getMeanError x
+  getNbinsX (ETH1I x) = getNbinsX x
+  getNbinsY (ETH1I x) = getNbinsY x
+  getNbinsZ (ETH1I x) = getNbinsZ x
+  getQuantilesTH1 (ETH1I x) = getQuantilesTH1 x
+  getRandom (ETH1I x) = getRandom x
+  getStats (ETH1I x) = getStats x
+  getSumOfWeights (ETH1I x) = getSumOfWeights x
+  getSumw2 (ETH1I x) = getSumw2 x
+  getSumw2N (ETH1I x) = getSumw2N x
+  getRMS (ETH1I x) = getRMS x
+  getRMSError (ETH1I x) = getRMSError x
+  getSkewness (ETH1I x) = getSkewness x
+  integral1 (ETH1I x) = integral1 x
+  interpolate1 (ETH1I x) = interpolate1 x
+  interpolate2 (ETH1I x) = interpolate2 x
+  interpolate3 (ETH1I x) = interpolate3 x
+  kolmogorovTest (ETH1I x) = kolmogorovTest x
+  labelsDeflate (ETH1I x) = labelsDeflate x
+  labelsInflate (ETH1I x) = labelsInflate x
+  labelsOption (ETH1I x) = labelsOption x
+  multiflyF (ETH1I x) = multiflyF x
+  multiply (ETH1I x) = multiply x
+  putStats (ETH1I x) = putStats x
+  rebin (ETH1I x) = rebin x
+  rebinAxis (ETH1I x) = rebinAxis x
+  rebuild (ETH1I x) = rebuild x
+  recursiveRemove (ETH1I x) = recursiveRemove x
+  reset (ETH1I x) = reset x
+  resetStats (ETH1I x) = resetStats x
+  scale (ETH1I x) = scale x
+  setAxisColorA (ETH1I x) = setAxisColorA x
+  setAxisRange (ETH1I x) = setAxisRange x
+  setBarOffset (ETH1I x) = setBarOffset x
+  setBarWidth (ETH1I x) = setBarWidth x
+  setBinContent1 (ETH1I x) = setBinContent1 x
+  setBinContent2 (ETH1I x) = setBinContent2 x
+  setBinContent3 (ETH1I x) = setBinContent3 x
+  setBinError1 (ETH1I x) = setBinError1 x
+  setBinError2 (ETH1I x) = setBinError2 x
+  setBinError3 (ETH1I x) = setBinError3 x
+  setBins1 (ETH1I x) = setBins1 x
+  setBins2 (ETH1I x) = setBins2 x
+  setBins3 (ETH1I x) = setBins3 x
+  setBinsLength (ETH1I x) = setBinsLength x
+  setBuffer (ETH1I x) = setBuffer x
+  setCellContent (ETH1I x) = setCellContent x
+  setContent (ETH1I x) = setContent x
+  setContour (ETH1I x) = setContour x
+  setContourLevel (ETH1I x) = setContourLevel x
+  setDirectory (ETH1I x) = setDirectory x
+  setEntries (ETH1I x) = setEntries x
+  setError (ETH1I x) = setError x
+  setLabelColorA (ETH1I x) = setLabelColorA x
+  setLabelSizeA (ETH1I x) = setLabelSizeA x
+  setLabelFontA (ETH1I x) = setLabelFontA x
+  setLabelOffsetA (ETH1I x) = setLabelOffsetA x
+  setMaximum (ETH1I x) = setMaximum x
+  setMinimum (ETH1I x) = setMinimum x
+  setNormFactor (ETH1I x) = setNormFactor x
+  setStats (ETH1I x) = setStats x
+  setOption (ETH1I x) = setOption x
+  setXTitle (ETH1I x) = setXTitle x
+  setYTitle (ETH1I x) = setYTitle x
+  setZTitle (ETH1I x) = setZTitle x
+  showBackground (ETH1I x) = showBackground x
+  showPeaks (ETH1I x) = showPeaks x
+  smooth (ETH1I x) = smooth x
+  sumw2 (ETH1I x) = sumw2 x
+instance ITArrayI (Exist TH1I) where
+
+instance ITObject (Exist TH1I) where
+  draw (ETH1I x) = draw x
+  findObject (ETH1I x) = findObject x
+  getName (ETH1I x) = getName x
+  isA (ETH1I x) = isA x
+  paint (ETH1I x) = paint x
+  printObj (ETH1I x) = printObj x
+  saveAs (ETH1I x) = saveAs x
+  write (ETH1I x) = write x
+instance ITAttLine (Exist TH1I) where
+  getLineColor (ETH1I x) = getLineColor x
+  getLineStyle (ETH1I x) = getLineStyle x
+  getLineWidth (ETH1I x) = getLineWidth x
+  resetAttLine (ETH1I x) = resetAttLine x
+  setLineAttributes (ETH1I x) = setLineAttributes x
+  setLineColor (ETH1I x) = setLineColor x
+  setLineStyle (ETH1I x) = setLineStyle x
+  setLineWidth (ETH1I x) = setLineWidth x
+instance ITAttFill (Exist TH1I) where
+  setFillColor (ETH1I x) = setFillColor x
+  setFillStyle (ETH1I x) = setFillStyle x
+instance ITAttMarker (Exist TH1I) where
+  getMarkerColor (ETH1I x) = getMarkerColor x
+  getMarkerStyle (ETH1I x) = getMarkerStyle x
+  getMarkerSize (ETH1I x) = getMarkerSize x
+  resetAttMarker (ETH1I x) = resetAttMarker x
+  setMarkerAttributes (ETH1I x) = setMarkerAttributes x
+  setMarkerColor (ETH1I x) = setMarkerColor x
+  setMarkerStyle (ETH1I x) = setMarkerStyle x
+  setMarkerSize (ETH1I x) = setMarkerSize x
+instance IDeletable (Exist TH1I) where
+  delete (ETH1I x) = delete x
+instance ITArray (Exist TH1I) where
+
+
+
+
+
+
+
+
+instance FPtr (Exist TH1I) where
+  type Raw (Exist TH1I) = RawTH1I
+  get_fptr (ETH1I obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH1I (cast_fptr_to_obj (fptr :: ForeignPtr RawTH1I) :: TH1I)
diff --git a/src/HROOT/Hist/TH1I/Interface.hs b/src/HROOT/Hist/TH1I/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1I/Interface.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH1I.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH1I.RawType
+
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TArrayI.Interface
+---- ============ ----
+
+
+
+class (ITH1 a,ITArrayI a) => ITH1I a where
+
+instance Existable TH1I where
+  data Exist TH1I = forall a. (FPtr a, ITH1I a) => ETH1I a
+
+upcastTH1I :: (FPtr a, ITH1I a) => a -> TH1I
+upcastTH1I h = let fh = get_fptr h
+                   fh2 :: ForeignPtr RawTH1I = castForeignPtr fh
+               in cast_fptr_to_obj fh2
+
+downcastTH1I :: (FPtr a, ITH1I a) => TH1I -> a 
+downcastTH1I h = let fh = get_fptr h
+                     fh2 = castForeignPtr fh
+                 in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH1I/RawType.hs b/src/HROOT/Hist/TH1I/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1I/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH1I.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH1I
+newtype TH1I = TH1I (ForeignPtr RawTH1I) deriving (Eq, Ord, Show)
+instance FPtr TH1I where
+   type Raw TH1I = RawTH1I
+   get_fptr (TH1I fptr) = fptr
+   cast_fptr_to_obj = TH1I
diff --git a/src/HROOT/Hist/TH1K.hs b/src/HROOT/Hist/TH1K.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1K.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TH1K
+  (
+    TH1K(..)
+  , ITH1K
+  , upcastTH1K
+  , downcastTH1K
+
+ 
+  ) where
+
+import HROOT.Hist.TH1K.RawType
+import HROOT.Hist.TH1K.Interface
+import HROOT.Hist.TH1K.Implementation
+
+
diff --git a/src/HROOT/Hist/TH1K/Cast.hs b/src/HROOT/Hist/TH1K/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1K/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH1K.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH1K.RawType
+import HROOT.Hist.TH1K.Interface
+
+instance (ITH1K a, FPtr a) => Castable a (Ptr RawTH1K) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH1K (Ptr RawTH1K) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH1K/FFI.hsc b/src/HROOT/Hist/TH1K/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1K/FFI.hsc
@@ -0,0 +1,496 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH1K.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH1K.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTH1K.h"
+
+foreign import ccall "HROOTHistTH1K.h TH1K_Add" c_th1k_add 
+  :: (Ptr RawTH1K) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_AddBinContent" c_th1k_addbincontent 
+  :: (Ptr RawTH1K) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_Chi2Test" c_th1k_chi2test 
+  :: (Ptr RawTH1K) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_ComputeIntegral" c_th1k_computeintegral 
+  :: (Ptr RawTH1K) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_DirectoryAutoAdd" c_th1k_directoryautoadd 
+  :: (Ptr RawTH1K) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_Divide" c_th1k_divide 
+  :: (Ptr RawTH1K) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_drawCopyTH1" c_th1k_drawcopyth1 
+  :: (Ptr RawTH1K) -> CString -> IO (Ptr RawTH1K)
+
+foreign import ccall "HROOTHistTH1K.h TH1K_DrawNormalized" c_th1k_drawnormalized 
+  :: (Ptr RawTH1K) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1K.h TH1K_drawPanelTH1" c_th1k_drawpanelth1 
+  :: (Ptr RawTH1K) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_BufferEmpty" c_th1k_bufferempty 
+  :: (Ptr RawTH1K) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_evalF" c_th1k_evalf 
+  :: (Ptr RawTH1K) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_FFT" c_th1k_fft 
+  :: (Ptr RawTH1K) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1K.h TH1K_fill1" c_th1k_fill1 
+  :: (Ptr RawTH1K) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_fill1w" c_th1k_fill1w 
+  :: (Ptr RawTH1K) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_fillN1" c_th1k_filln1 
+  :: (Ptr RawTH1K) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_FillRandom" c_th1k_fillrandom 
+  :: (Ptr RawTH1K) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_FindBin" c_th1k_findbin 
+  :: (Ptr RawTH1K) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_FindFixBin" c_th1k_findfixbin 
+  :: (Ptr RawTH1K) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_FindFirstBinAbove" c_th1k_findfirstbinabove 
+  :: (Ptr RawTH1K) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_FindLastBinAbove" c_th1k_findlastbinabove 
+  :: (Ptr RawTH1K) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_FitPanelTH1" c_th1k_fitpanelth1 
+  :: (Ptr RawTH1K) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_getNdivisionA" c_th1k_getndivisiona 
+  :: (Ptr RawTH1K) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_getAxisColorA" c_th1k_getaxiscolora 
+  :: (Ptr RawTH1K) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_getLabelColorA" c_th1k_getlabelcolora 
+  :: (Ptr RawTH1K) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_getLabelFontA" c_th1k_getlabelfonta 
+  :: (Ptr RawTH1K) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_getLabelOffsetA" c_th1k_getlabeloffseta 
+  :: (Ptr RawTH1K) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_getLabelSizeA" c_th1k_getlabelsizea 
+  :: (Ptr RawTH1K) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_getTitleFontA" c_th1k_gettitlefonta 
+  :: (Ptr RawTH1K) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_getTitleOffsetA" c_th1k_gettitleoffseta 
+  :: (Ptr RawTH1K) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_getTitleSizeA" c_th1k_gettitlesizea 
+  :: (Ptr RawTH1K) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_getTickLengthA" c_th1k_getticklengtha 
+  :: (Ptr RawTH1K) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetBarOffset" c_th1k_getbaroffset 
+  :: (Ptr RawTH1K) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetBarWidth" c_th1k_getbarwidth 
+  :: (Ptr RawTH1K) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetContour" c_th1k_getcontour 
+  :: (Ptr RawTH1K) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetContourLevel" c_th1k_getcontourlevel 
+  :: (Ptr RawTH1K) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetContourLevelPad" c_th1k_getcontourlevelpad 
+  :: (Ptr RawTH1K) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetBin" c_th1k_getbin 
+  :: (Ptr RawTH1K) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetBinCenter" c_th1k_getbincenter 
+  :: (Ptr RawTH1K) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetBinContent1" c_th1k_getbincontent1 
+  :: (Ptr RawTH1K) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetBinContent2" c_th1k_getbincontent2 
+  :: (Ptr RawTH1K) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetBinContent3" c_th1k_getbincontent3 
+  :: (Ptr RawTH1K) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetBinError1" c_th1k_getbinerror1 
+  :: (Ptr RawTH1K) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetBinError2" c_th1k_getbinerror2 
+  :: (Ptr RawTH1K) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetBinError3" c_th1k_getbinerror3 
+  :: (Ptr RawTH1K) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetBinLowEdge" c_th1k_getbinlowedge 
+  :: (Ptr RawTH1K) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetBinWidth" c_th1k_getbinwidth 
+  :: (Ptr RawTH1K) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetCellContent" c_th1k_getcellcontent 
+  :: (Ptr RawTH1K) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetCellError" c_th1k_getcellerror 
+  :: (Ptr RawTH1K) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetEntries" c_th1k_getentries 
+  :: (Ptr RawTH1K) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetEffectiveEntries" c_th1k_geteffectiveentries 
+  :: (Ptr RawTH1K) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetFunction" c_th1k_getfunction 
+  :: (Ptr RawTH1K) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetDimension" c_th1k_getdimension 
+  :: (Ptr RawTH1K) -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetKurtosis" c_th1k_getkurtosis 
+  :: (Ptr RawTH1K) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetLowEdge" c_th1k_getlowedge 
+  :: (Ptr RawTH1K) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_getMaximumTH1" c_th1k_getmaximumth1 
+  :: (Ptr RawTH1K) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetMaximumBin" c_th1k_getmaximumbin 
+  :: (Ptr RawTH1K) -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetMaximumStored" c_th1k_getmaximumstored 
+  :: (Ptr RawTH1K) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_getMinimumTH1" c_th1k_getminimumth1 
+  :: (Ptr RawTH1K) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetMinimumBin" c_th1k_getminimumbin 
+  :: (Ptr RawTH1K) -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetMinimumStored" c_th1k_getminimumstored 
+  :: (Ptr RawTH1K) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetMean" c_th1k_getmean 
+  :: (Ptr RawTH1K) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetMeanError" c_th1k_getmeanerror 
+  :: (Ptr RawTH1K) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetNbinsX" c_th1k_getnbinsx 
+  :: (Ptr RawTH1K) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetNbinsY" c_th1k_getnbinsy 
+  :: (Ptr RawTH1K) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetNbinsZ" c_th1k_getnbinsz 
+  :: (Ptr RawTH1K) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_getQuantilesTH1" c_th1k_getquantilesth1 
+  :: (Ptr RawTH1K) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetRandom" c_th1k_getrandom 
+  :: (Ptr RawTH1K) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetStats" c_th1k_getstats 
+  :: (Ptr RawTH1K) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetSumOfWeights" c_th1k_getsumofweights 
+  :: (Ptr RawTH1K) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetSumw2" c_th1k_getsumw2 
+  :: (Ptr RawTH1K) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetSumw2N" c_th1k_getsumw2n 
+  :: (Ptr RawTH1K) -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetRMS" c_th1k_getrms 
+  :: (Ptr RawTH1K) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetRMSError" c_th1k_getrmserror 
+  :: (Ptr RawTH1K) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetSkewness" c_th1k_getskewness 
+  :: (Ptr RawTH1K) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_integral1" c_th1k_integral1 
+  :: (Ptr RawTH1K) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_interpolate1" c_th1k_interpolate1 
+  :: (Ptr RawTH1K) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_interpolate2" c_th1k_interpolate2 
+  :: (Ptr RawTH1K) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_interpolate3" c_th1k_interpolate3 
+  :: (Ptr RawTH1K) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_KolmogorovTest" c_th1k_kolmogorovtest 
+  :: (Ptr RawTH1K) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_LabelsDeflate" c_th1k_labelsdeflate 
+  :: (Ptr RawTH1K) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_LabelsInflate" c_th1k_labelsinflate 
+  :: (Ptr RawTH1K) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_LabelsOption" c_th1k_labelsoption 
+  :: (Ptr RawTH1K) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_multiflyF" c_th1k_multiflyf 
+  :: (Ptr RawTH1K) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_Multiply" c_th1k_multiply 
+  :: (Ptr RawTH1K) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_PutStats" c_th1k_putstats 
+  :: (Ptr RawTH1K) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_Rebin" c_th1k_rebin 
+  :: (Ptr RawTH1K) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1K.h TH1K_RebinAxis" c_th1k_rebinaxis 
+  :: (Ptr RawTH1K) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_Rebuild" c_th1k_rebuild 
+  :: (Ptr RawTH1K) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_RecursiveRemove" c_th1k_recursiveremove 
+  :: (Ptr RawTH1K) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_Reset" c_th1k_reset 
+  :: (Ptr RawTH1K) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_ResetStats" c_th1k_resetstats 
+  :: (Ptr RawTH1K) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_Scale" c_th1k_scale 
+  :: (Ptr RawTH1K) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_setAxisColorA" c_th1k_setaxiscolora 
+  :: (Ptr RawTH1K) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetAxisRange" c_th1k_setaxisrange 
+  :: (Ptr RawTH1K) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetBarOffset" c_th1k_setbaroffset 
+  :: (Ptr RawTH1K) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetBarWidth" c_th1k_setbarwidth 
+  :: (Ptr RawTH1K) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_setBinContent1" c_th1k_setbincontent1 
+  :: (Ptr RawTH1K) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_setBinContent2" c_th1k_setbincontent2 
+  :: (Ptr RawTH1K) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_setBinContent3" c_th1k_setbincontent3 
+  :: (Ptr RawTH1K) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_setBinError1" c_th1k_setbinerror1 
+  :: (Ptr RawTH1K) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_setBinError2" c_th1k_setbinerror2 
+  :: (Ptr RawTH1K) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_setBinError3" c_th1k_setbinerror3 
+  :: (Ptr RawTH1K) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_setBins1" c_th1k_setbins1 
+  :: (Ptr RawTH1K) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_setBins2" c_th1k_setbins2 
+  :: (Ptr RawTH1K) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_setBins3" c_th1k_setbins3 
+  :: (Ptr RawTH1K) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetBinsLength" c_th1k_setbinslength 
+  :: (Ptr RawTH1K) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetBuffer" c_th1k_setbuffer 
+  :: (Ptr RawTH1K) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetCellContent" c_th1k_setcellcontent 
+  :: (Ptr RawTH1K) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetContent" c_th1k_setcontent 
+  :: (Ptr RawTH1K) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetContour" c_th1k_setcontour 
+  :: (Ptr RawTH1K) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetContourLevel" c_th1k_setcontourlevel 
+  :: (Ptr RawTH1K) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetDirectory" c_th1k_setdirectory 
+  :: (Ptr RawTH1K) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetEntries" c_th1k_setentries 
+  :: (Ptr RawTH1K) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetError" c_th1k_seterror 
+  :: (Ptr RawTH1K) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_setLabelColorA" c_th1k_setlabelcolora 
+  :: (Ptr RawTH1K) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_setLabelSizeA" c_th1k_setlabelsizea 
+  :: (Ptr RawTH1K) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_setLabelFontA" c_th1k_setlabelfonta 
+  :: (Ptr RawTH1K) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_setLabelOffsetA" c_th1k_setlabeloffseta 
+  :: (Ptr RawTH1K) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetMaximum" c_th1k_setmaximum 
+  :: (Ptr RawTH1K) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetMinimum" c_th1k_setminimum 
+  :: (Ptr RawTH1K) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetNormFactor" c_th1k_setnormfactor 
+  :: (Ptr RawTH1K) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetStats" c_th1k_setstats 
+  :: (Ptr RawTH1K) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetOption" c_th1k_setoption 
+  :: (Ptr RawTH1K) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetXTitle" c_th1k_setxtitle 
+  :: (Ptr RawTH1K) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetYTitle" c_th1k_setytitle 
+  :: (Ptr RawTH1K) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetZTitle" c_th1k_setztitle 
+  :: (Ptr RawTH1K) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_ShowBackground" c_th1k_showbackground 
+  :: (Ptr RawTH1K) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1K.h TH1K_ShowPeaks" c_th1k_showpeaks 
+  :: (Ptr RawTH1K) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_Smooth" c_th1k_smooth 
+  :: (Ptr RawTH1K) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_Sumw2" c_th1k_sumw2 
+  :: (Ptr RawTH1K) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_Draw" c_th1k_draw 
+  :: (Ptr RawTH1K) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_FindObject" c_th1k_findobject 
+  :: (Ptr RawTH1K) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetName" c_th1k_getname 
+  :: (Ptr RawTH1K) -> IO CString
+
+foreign import ccall "HROOTHistTH1K.h TH1K_IsA" c_th1k_isa 
+  :: (Ptr RawTH1K) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH1K.h TH1K_Paint" c_th1k_paint 
+  :: (Ptr RawTH1K) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_printObj" c_th1k_printobj 
+  :: (Ptr RawTH1K) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SaveAs" c_th1k_saveas 
+  :: (Ptr RawTH1K) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_Write" c_th1k_write 
+  :: (Ptr RawTH1K) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetLineColor" c_th1k_getlinecolor 
+  :: (Ptr RawTH1K) -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetLineStyle" c_th1k_getlinestyle 
+  :: (Ptr RawTH1K) -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetLineWidth" c_th1k_getlinewidth 
+  :: (Ptr RawTH1K) -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_ResetAttLine" c_th1k_resetattline 
+  :: (Ptr RawTH1K) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetLineAttributes" c_th1k_setlineattributes 
+  :: (Ptr RawTH1K) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetLineColor" c_th1k_setlinecolor 
+  :: (Ptr RawTH1K) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetLineStyle" c_th1k_setlinestyle 
+  :: (Ptr RawTH1K) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetLineWidth" c_th1k_setlinewidth 
+  :: (Ptr RawTH1K) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetFillColor" c_th1k_setfillcolor 
+  :: (Ptr RawTH1K) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetFillStyle" c_th1k_setfillstyle 
+  :: (Ptr RawTH1K) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetMarkerColor" c_th1k_getmarkercolor 
+  :: (Ptr RawTH1K) -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetMarkerStyle" c_th1k_getmarkerstyle 
+  :: (Ptr RawTH1K) -> IO CInt
+
+foreign import ccall "HROOTHistTH1K.h TH1K_GetMarkerSize" c_th1k_getmarkersize 
+  :: (Ptr RawTH1K) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1K.h TH1K_ResetAttMarker" c_th1k_resetattmarker 
+  :: (Ptr RawTH1K) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetMarkerAttributes" c_th1k_setmarkerattributes 
+  :: (Ptr RawTH1K) -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetMarkerColor" c_th1k_setmarkercolor 
+  :: (Ptr RawTH1K) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetMarkerStyle" c_th1k_setmarkerstyle 
+  :: (Ptr RawTH1K) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_SetMarkerSize" c_th1k_setmarkersize 
+  :: (Ptr RawTH1K) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1K.h TH1K_delete" c_th1k_delete 
+  :: (Ptr RawTH1K) -> IO ()
+
diff --git a/src/HROOT/Hist/TH1K/Implementation.hs b/src/HROOT/Hist/TH1K/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1K/Implementation.hs
@@ -0,0 +1,408 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH1K.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH1K.RawType
+import HROOT.Hist.TH1K.FFI
+import HROOT.Hist.TH1K.Interface
+import HROOT.Hist.TH1K.Cast
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TArrayF.RawType
+import HROOT.Core.TArrayF.Cast
+import HROOT.Core.TArrayF.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+import HROOT.Core.TArray.RawType
+import HROOT.Core.TArray.Cast
+import HROOT.Core.TArray.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH1K TH1K where
+instance ITH1 TH1K where
+  add = xform2 c_th1k_add
+  addBinContent = xform2 c_th1k_addbincontent
+  chi2Test = xform3 c_th1k_chi2test
+  computeIntegral = xform0 c_th1k_computeintegral
+  directoryAutoAdd = xform1 c_th1k_directoryautoadd
+  divide = xform5 c_th1k_divide
+  drawCopyTH1 = xform1 c_th1k_drawcopyth1
+  drawNormalized = xform2 c_th1k_drawnormalized
+  drawPanelTH1 = xform0 c_th1k_drawpanelth1
+  bufferEmpty = xform1 c_th1k_bufferempty
+  evalF = xform2 c_th1k_evalf
+  fFT = xform2 c_th1k_fft
+  fill1 = xform1 c_th1k_fill1
+  fill1w = xform2 c_th1k_fill1w
+  fillN1 = xform4 c_th1k_filln1
+  fillRandom = xform2 c_th1k_fillrandom
+  findBin = xform3 c_th1k_findbin
+  findFixBin = xform3 c_th1k_findfixbin
+  findFirstBinAbove = xform2 c_th1k_findfirstbinabove
+  findLastBinAbove = xform2 c_th1k_findlastbinabove
+  fitPanelTH1 = xform0 c_th1k_fitpanelth1
+  getNdivisionA = xform1 c_th1k_getndivisiona
+  getAxisColorA = xform1 c_th1k_getaxiscolora
+  getLabelColorA = xform1 c_th1k_getlabelcolora
+  getLabelFontA = xform1 c_th1k_getlabelfonta
+  getLabelOffsetA = xform1 c_th1k_getlabeloffseta
+  getLabelSizeA = xform1 c_th1k_getlabelsizea
+  getTitleFontA = xform1 c_th1k_gettitlefonta
+  getTitleOffsetA = xform1 c_th1k_gettitleoffseta
+  getTitleSizeA = xform1 c_th1k_gettitlesizea
+  getTickLengthA = xform1 c_th1k_getticklengtha
+  getBarOffset = xform0 c_th1k_getbaroffset
+  getBarWidth = xform0 c_th1k_getbarwidth
+  getContour = xform1 c_th1k_getcontour
+  getContourLevel = xform1 c_th1k_getcontourlevel
+  getContourLevelPad = xform1 c_th1k_getcontourlevelpad
+  getBin = xform3 c_th1k_getbin
+  getBinCenter = xform1 c_th1k_getbincenter
+  getBinContent1 = xform1 c_th1k_getbincontent1
+  getBinContent2 = xform2 c_th1k_getbincontent2
+  getBinContent3 = xform3 c_th1k_getbincontent3
+  getBinError1 = xform1 c_th1k_getbinerror1
+  getBinError2 = xform2 c_th1k_getbinerror2
+  getBinError3 = xform3 c_th1k_getbinerror3
+  getBinLowEdge = xform1 c_th1k_getbinlowedge
+  getBinWidth = xform1 c_th1k_getbinwidth
+  getCellContent = xform2 c_th1k_getcellcontent
+  getCellError = xform2 c_th1k_getcellerror
+  getEntries = xform0 c_th1k_getentries
+  getEffectiveEntries = xform0 c_th1k_geteffectiveentries
+  getFunction = xform1 c_th1k_getfunction
+  getDimension = xform0 c_th1k_getdimension
+  getKurtosis = xform1 c_th1k_getkurtosis
+  getLowEdge = xform1 c_th1k_getlowedge
+  getMaximumTH1 = xform1 c_th1k_getmaximumth1
+  getMaximumBin = xform0 c_th1k_getmaximumbin
+  getMaximumStored = xform0 c_th1k_getmaximumstored
+  getMinimumTH1 = xform1 c_th1k_getminimumth1
+  getMinimumBin = xform0 c_th1k_getminimumbin
+  getMinimumStored = xform0 c_th1k_getminimumstored
+  getMean = xform1 c_th1k_getmean
+  getMeanError = xform1 c_th1k_getmeanerror
+  getNbinsX = xform0 c_th1k_getnbinsx
+  getNbinsY = xform0 c_th1k_getnbinsy
+  getNbinsZ = xform0 c_th1k_getnbinsz
+  getQuantilesTH1 = xform3 c_th1k_getquantilesth1
+  getRandom = xform0 c_th1k_getrandom
+  getStats = xform1 c_th1k_getstats
+  getSumOfWeights = xform0 c_th1k_getsumofweights
+  getSumw2 = xform0 c_th1k_getsumw2
+  getSumw2N = xform0 c_th1k_getsumw2n
+  getRMS = xform1 c_th1k_getrms
+  getRMSError = xform1 c_th1k_getrmserror
+  getSkewness = xform1 c_th1k_getskewness
+  integral1 = xform3 c_th1k_integral1
+  interpolate1 = xform1 c_th1k_interpolate1
+  interpolate2 = xform2 c_th1k_interpolate2
+  interpolate3 = xform3 c_th1k_interpolate3
+  kolmogorovTest = xform2 c_th1k_kolmogorovtest
+  labelsDeflate = xform1 c_th1k_labelsdeflate
+  labelsInflate = xform1 c_th1k_labelsinflate
+  labelsOption = xform2 c_th1k_labelsoption
+  multiflyF = xform2 c_th1k_multiflyf
+  multiply = xform5 c_th1k_multiply
+  putStats = xform1 c_th1k_putstats
+  rebin = xform3 c_th1k_rebin
+  rebinAxis = xform2 c_th1k_rebinaxis
+  rebuild = xform1 c_th1k_rebuild
+  recursiveRemove = xform1 c_th1k_recursiveremove
+  reset = xform1 c_th1k_reset
+  resetStats = xform0 c_th1k_resetstats
+  scale = xform2 c_th1k_scale
+  setAxisColorA = xform2 c_th1k_setaxiscolora
+  setAxisRange = xform3 c_th1k_setaxisrange
+  setBarOffset = xform1 c_th1k_setbaroffset
+  setBarWidth = xform1 c_th1k_setbarwidth
+  setBinContent1 = xform2 c_th1k_setbincontent1
+  setBinContent2 = xform3 c_th1k_setbincontent2
+  setBinContent3 = xform4 c_th1k_setbincontent3
+  setBinError1 = xform2 c_th1k_setbinerror1
+  setBinError2 = xform3 c_th1k_setbinerror2
+  setBinError3 = xform4 c_th1k_setbinerror3
+  setBins1 = xform2 c_th1k_setbins1
+  setBins2 = xform4 c_th1k_setbins2
+  setBins3 = xform6 c_th1k_setbins3
+  setBinsLength = xform1 c_th1k_setbinslength
+  setBuffer = xform2 c_th1k_setbuffer
+  setCellContent = xform3 c_th1k_setcellcontent
+  setContent = xform1 c_th1k_setcontent
+  setContour = xform2 c_th1k_setcontour
+  setContourLevel = xform2 c_th1k_setcontourlevel
+  setDirectory = xform1 c_th1k_setdirectory
+  setEntries = xform1 c_th1k_setentries
+  setError = xform1 c_th1k_seterror
+  setLabelColorA = xform2 c_th1k_setlabelcolora
+  setLabelSizeA = xform2 c_th1k_setlabelsizea
+  setLabelFontA = xform2 c_th1k_setlabelfonta
+  setLabelOffsetA = xform2 c_th1k_setlabeloffseta
+  setMaximum = xform1 c_th1k_setmaximum
+  setMinimum = xform1 c_th1k_setminimum
+  setNormFactor = xform1 c_th1k_setnormfactor
+  setStats = xform1 c_th1k_setstats
+  setOption = xform1 c_th1k_setoption
+  setXTitle = xform1 c_th1k_setxtitle
+  setYTitle = xform1 c_th1k_setytitle
+  setZTitle = xform1 c_th1k_setztitle
+  showBackground = xform2 c_th1k_showbackground
+  showPeaks = xform3 c_th1k_showpeaks
+  smooth = xform2 c_th1k_smooth
+  sumw2 = xform0 c_th1k_sumw2
+instance ITArrayF TH1K where
+instance ITObject TH1K where
+  draw = xform1 c_th1k_draw
+  findObject = xform1 c_th1k_findobject
+  getName = xform0 c_th1k_getname
+  isA = xform0 c_th1k_isa
+  paint = xform1 c_th1k_paint
+  printObj = xform1 c_th1k_printobj
+  saveAs = xform2 c_th1k_saveas
+  write = xform3 c_th1k_write
+instance ITAttLine TH1K where
+  getLineColor = xform0 c_th1k_getlinecolor
+  getLineStyle = xform0 c_th1k_getlinestyle
+  getLineWidth = xform0 c_th1k_getlinewidth
+  resetAttLine = xform1 c_th1k_resetattline
+  setLineAttributes = xform0 c_th1k_setlineattributes
+  setLineColor = xform1 c_th1k_setlinecolor
+  setLineStyle = xform1 c_th1k_setlinestyle
+  setLineWidth = xform1 c_th1k_setlinewidth
+instance ITAttFill TH1K where
+  setFillColor = xform1 c_th1k_setfillcolor
+  setFillStyle = xform1 c_th1k_setfillstyle
+instance ITAttMarker TH1K where
+  getMarkerColor = xform0 c_th1k_getmarkercolor
+  getMarkerStyle = xform0 c_th1k_getmarkerstyle
+  getMarkerSize = xform0 c_th1k_getmarkersize
+  resetAttMarker = xform1 c_th1k_resetattmarker
+  setMarkerAttributes = xform0 c_th1k_setmarkerattributes
+  setMarkerColor = xform1 c_th1k_setmarkercolor
+  setMarkerStyle = xform1 c_th1k_setmarkerstyle
+  setMarkerSize = xform1 c_th1k_setmarkersize
+instance IDeletable TH1K where
+  delete = xform0 c_th1k_delete
+instance ITArray TH1K where
+
+instance ITH1K (Exist TH1K) where
+
+instance ITH1 (Exist TH1K) where
+  add (ETH1K x) = add x
+  addBinContent (ETH1K x) = addBinContent x
+  chi2Test (ETH1K x) = chi2Test x
+  computeIntegral (ETH1K x) = computeIntegral x
+  directoryAutoAdd (ETH1K x) = directoryAutoAdd x
+  divide (ETH1K x) = divide x
+  drawCopyTH1 (ETH1K x) a1 = return . ETH1K =<< drawCopyTH1 x a1
+  drawNormalized (ETH1K x) = drawNormalized x
+  drawPanelTH1 (ETH1K x) = drawPanelTH1 x
+  bufferEmpty (ETH1K x) = bufferEmpty x
+  evalF (ETH1K x) = evalF x
+  fFT (ETH1K x) = fFT x
+  fill1 (ETH1K x) = fill1 x
+  fill1w (ETH1K x) = fill1w x
+  fillN1 (ETH1K x) = fillN1 x
+  fillRandom (ETH1K x) = fillRandom x
+  findBin (ETH1K x) = findBin x
+  findFixBin (ETH1K x) = findFixBin x
+  findFirstBinAbove (ETH1K x) = findFirstBinAbove x
+  findLastBinAbove (ETH1K x) = findLastBinAbove x
+  fitPanelTH1 (ETH1K x) = fitPanelTH1 x
+  getNdivisionA (ETH1K x) = getNdivisionA x
+  getAxisColorA (ETH1K x) = getAxisColorA x
+  getLabelColorA (ETH1K x) = getLabelColorA x
+  getLabelFontA (ETH1K x) = getLabelFontA x
+  getLabelOffsetA (ETH1K x) = getLabelOffsetA x
+  getLabelSizeA (ETH1K x) = getLabelSizeA x
+  getTitleFontA (ETH1K x) = getTitleFontA x
+  getTitleOffsetA (ETH1K x) = getTitleOffsetA x
+  getTitleSizeA (ETH1K x) = getTitleSizeA x
+  getTickLengthA (ETH1K x) = getTickLengthA x
+  getBarOffset (ETH1K x) = getBarOffset x
+  getBarWidth (ETH1K x) = getBarWidth x
+  getContour (ETH1K x) = getContour x
+  getContourLevel (ETH1K x) = getContourLevel x
+  getContourLevelPad (ETH1K x) = getContourLevelPad x
+  getBin (ETH1K x) = getBin x
+  getBinCenter (ETH1K x) = getBinCenter x
+  getBinContent1 (ETH1K x) = getBinContent1 x
+  getBinContent2 (ETH1K x) = getBinContent2 x
+  getBinContent3 (ETH1K x) = getBinContent3 x
+  getBinError1 (ETH1K x) = getBinError1 x
+  getBinError2 (ETH1K x) = getBinError2 x
+  getBinError3 (ETH1K x) = getBinError3 x
+  getBinLowEdge (ETH1K x) = getBinLowEdge x
+  getBinWidth (ETH1K x) = getBinWidth x
+  getCellContent (ETH1K x) = getCellContent x
+  getCellError (ETH1K x) = getCellError x
+  getEntries (ETH1K x) = getEntries x
+  getEffectiveEntries (ETH1K x) = getEffectiveEntries x
+  getFunction (ETH1K x) = getFunction x
+  getDimension (ETH1K x) = getDimension x
+  getKurtosis (ETH1K x) = getKurtosis x
+  getLowEdge (ETH1K x) = getLowEdge x
+  getMaximumTH1 (ETH1K x) = getMaximumTH1 x
+  getMaximumBin (ETH1K x) = getMaximumBin x
+  getMaximumStored (ETH1K x) = getMaximumStored x
+  getMinimumTH1 (ETH1K x) = getMinimumTH1 x
+  getMinimumBin (ETH1K x) = getMinimumBin x
+  getMinimumStored (ETH1K x) = getMinimumStored x
+  getMean (ETH1K x) = getMean x
+  getMeanError (ETH1K x) = getMeanError x
+  getNbinsX (ETH1K x) = getNbinsX x
+  getNbinsY (ETH1K x) = getNbinsY x
+  getNbinsZ (ETH1K x) = getNbinsZ x
+  getQuantilesTH1 (ETH1K x) = getQuantilesTH1 x
+  getRandom (ETH1K x) = getRandom x
+  getStats (ETH1K x) = getStats x
+  getSumOfWeights (ETH1K x) = getSumOfWeights x
+  getSumw2 (ETH1K x) = getSumw2 x
+  getSumw2N (ETH1K x) = getSumw2N x
+  getRMS (ETH1K x) = getRMS x
+  getRMSError (ETH1K x) = getRMSError x
+  getSkewness (ETH1K x) = getSkewness x
+  integral1 (ETH1K x) = integral1 x
+  interpolate1 (ETH1K x) = interpolate1 x
+  interpolate2 (ETH1K x) = interpolate2 x
+  interpolate3 (ETH1K x) = interpolate3 x
+  kolmogorovTest (ETH1K x) = kolmogorovTest x
+  labelsDeflate (ETH1K x) = labelsDeflate x
+  labelsInflate (ETH1K x) = labelsInflate x
+  labelsOption (ETH1K x) = labelsOption x
+  multiflyF (ETH1K x) = multiflyF x
+  multiply (ETH1K x) = multiply x
+  putStats (ETH1K x) = putStats x
+  rebin (ETH1K x) = rebin x
+  rebinAxis (ETH1K x) = rebinAxis x
+  rebuild (ETH1K x) = rebuild x
+  recursiveRemove (ETH1K x) = recursiveRemove x
+  reset (ETH1K x) = reset x
+  resetStats (ETH1K x) = resetStats x
+  scale (ETH1K x) = scale x
+  setAxisColorA (ETH1K x) = setAxisColorA x
+  setAxisRange (ETH1K x) = setAxisRange x
+  setBarOffset (ETH1K x) = setBarOffset x
+  setBarWidth (ETH1K x) = setBarWidth x
+  setBinContent1 (ETH1K x) = setBinContent1 x
+  setBinContent2 (ETH1K x) = setBinContent2 x
+  setBinContent3 (ETH1K x) = setBinContent3 x
+  setBinError1 (ETH1K x) = setBinError1 x
+  setBinError2 (ETH1K x) = setBinError2 x
+  setBinError3 (ETH1K x) = setBinError3 x
+  setBins1 (ETH1K x) = setBins1 x
+  setBins2 (ETH1K x) = setBins2 x
+  setBins3 (ETH1K x) = setBins3 x
+  setBinsLength (ETH1K x) = setBinsLength x
+  setBuffer (ETH1K x) = setBuffer x
+  setCellContent (ETH1K x) = setCellContent x
+  setContent (ETH1K x) = setContent x
+  setContour (ETH1K x) = setContour x
+  setContourLevel (ETH1K x) = setContourLevel x
+  setDirectory (ETH1K x) = setDirectory x
+  setEntries (ETH1K x) = setEntries x
+  setError (ETH1K x) = setError x
+  setLabelColorA (ETH1K x) = setLabelColorA x
+  setLabelSizeA (ETH1K x) = setLabelSizeA x
+  setLabelFontA (ETH1K x) = setLabelFontA x
+  setLabelOffsetA (ETH1K x) = setLabelOffsetA x
+  setMaximum (ETH1K x) = setMaximum x
+  setMinimum (ETH1K x) = setMinimum x
+  setNormFactor (ETH1K x) = setNormFactor x
+  setStats (ETH1K x) = setStats x
+  setOption (ETH1K x) = setOption x
+  setXTitle (ETH1K x) = setXTitle x
+  setYTitle (ETH1K x) = setYTitle x
+  setZTitle (ETH1K x) = setZTitle x
+  showBackground (ETH1K x) = showBackground x
+  showPeaks (ETH1K x) = showPeaks x
+  smooth (ETH1K x) = smooth x
+  sumw2 (ETH1K x) = sumw2 x
+instance ITArrayF (Exist TH1K) where
+
+instance ITObject (Exist TH1K) where
+  draw (ETH1K x) = draw x
+  findObject (ETH1K x) = findObject x
+  getName (ETH1K x) = getName x
+  isA (ETH1K x) = isA x
+  paint (ETH1K x) = paint x
+  printObj (ETH1K x) = printObj x
+  saveAs (ETH1K x) = saveAs x
+  write (ETH1K x) = write x
+instance ITAttLine (Exist TH1K) where
+  getLineColor (ETH1K x) = getLineColor x
+  getLineStyle (ETH1K x) = getLineStyle x
+  getLineWidth (ETH1K x) = getLineWidth x
+  resetAttLine (ETH1K x) = resetAttLine x
+  setLineAttributes (ETH1K x) = setLineAttributes x
+  setLineColor (ETH1K x) = setLineColor x
+  setLineStyle (ETH1K x) = setLineStyle x
+  setLineWidth (ETH1K x) = setLineWidth x
+instance ITAttFill (Exist TH1K) where
+  setFillColor (ETH1K x) = setFillColor x
+  setFillStyle (ETH1K x) = setFillStyle x
+instance ITAttMarker (Exist TH1K) where
+  getMarkerColor (ETH1K x) = getMarkerColor x
+  getMarkerStyle (ETH1K x) = getMarkerStyle x
+  getMarkerSize (ETH1K x) = getMarkerSize x
+  resetAttMarker (ETH1K x) = resetAttMarker x
+  setMarkerAttributes (ETH1K x) = setMarkerAttributes x
+  setMarkerColor (ETH1K x) = setMarkerColor x
+  setMarkerStyle (ETH1K x) = setMarkerStyle x
+  setMarkerSize (ETH1K x) = setMarkerSize x
+instance IDeletable (Exist TH1K) where
+  delete (ETH1K x) = delete x
+instance ITArray (Exist TH1K) where
+
+
+
+
+
+
+
+
+instance FPtr (Exist TH1K) where
+  type Raw (Exist TH1K) = RawTH1K
+  get_fptr (ETH1K obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH1K (cast_fptr_to_obj (fptr :: ForeignPtr RawTH1K) :: TH1K)
diff --git a/src/HROOT/Hist/TH1K/Interface.hs b/src/HROOT/Hist/TH1K/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1K/Interface.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH1K.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH1K.RawType
+
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TArrayF.Interface
+---- ============ ----
+
+
+
+class (ITH1 a,ITArrayF a) => ITH1K a where
+
+instance Existable TH1K where
+  data Exist TH1K = forall a. (FPtr a, ITH1K a) => ETH1K a
+
+upcastTH1K :: (FPtr a, ITH1K a) => a -> TH1K
+upcastTH1K h = let fh = get_fptr h
+                   fh2 :: ForeignPtr RawTH1K = castForeignPtr fh
+               in cast_fptr_to_obj fh2
+
+downcastTH1K :: (FPtr a, ITH1K a) => TH1K -> a 
+downcastTH1K h = let fh = get_fptr h
+                     fh2 = castForeignPtr fh
+                 in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH1K/RawType.hs b/src/HROOT/Hist/TH1K/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1K/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH1K.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH1K
+newtype TH1K = TH1K (ForeignPtr RawTH1K) deriving (Eq, Ord, Show)
+instance FPtr TH1K where
+   type Raw TH1K = RawTH1K
+   get_fptr (TH1K fptr) = fptr
+   cast_fptr_to_obj = TH1K
diff --git a/src/HROOT/Hist/TH1S.hs b/src/HROOT/Hist/TH1S.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1S.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TH1S
+  (
+    TH1S(..)
+  , ITH1S
+  , upcastTH1S
+  , downcastTH1S
+
+ 
+  ) where
+
+import HROOT.Hist.TH1S.RawType
+import HROOT.Hist.TH1S.Interface
+import HROOT.Hist.TH1S.Implementation
+
+
diff --git a/src/HROOT/Hist/TH1S/Cast.hs b/src/HROOT/Hist/TH1S/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1S/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH1S.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH1S.RawType
+import HROOT.Hist.TH1S.Interface
+
+instance (ITH1S a, FPtr a) => Castable a (Ptr RawTH1S) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH1S (Ptr RawTH1S) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH1S/FFI.hsc b/src/HROOT/Hist/TH1S/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1S/FFI.hsc
@@ -0,0 +1,496 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH1S.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH1S.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTH1S.h"
+
+foreign import ccall "HROOTHistTH1S.h TH1S_Add" c_th1s_add 
+  :: (Ptr RawTH1S) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_AddBinContent" c_th1s_addbincontent 
+  :: (Ptr RawTH1S) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_Chi2Test" c_th1s_chi2test 
+  :: (Ptr RawTH1S) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_ComputeIntegral" c_th1s_computeintegral 
+  :: (Ptr RawTH1S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_DirectoryAutoAdd" c_th1s_directoryautoadd 
+  :: (Ptr RawTH1S) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_Divide" c_th1s_divide 
+  :: (Ptr RawTH1S) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_drawCopyTH1" c_th1s_drawcopyth1 
+  :: (Ptr RawTH1S) -> CString -> IO (Ptr RawTH1S)
+
+foreign import ccall "HROOTHistTH1S.h TH1S_DrawNormalized" c_th1s_drawnormalized 
+  :: (Ptr RawTH1S) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1S.h TH1S_drawPanelTH1" c_th1s_drawpanelth1 
+  :: (Ptr RawTH1S) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_BufferEmpty" c_th1s_bufferempty 
+  :: (Ptr RawTH1S) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_evalF" c_th1s_evalf 
+  :: (Ptr RawTH1S) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_FFT" c_th1s_fft 
+  :: (Ptr RawTH1S) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1S.h TH1S_fill1" c_th1s_fill1 
+  :: (Ptr RawTH1S) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_fill1w" c_th1s_fill1w 
+  :: (Ptr RawTH1S) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_fillN1" c_th1s_filln1 
+  :: (Ptr RawTH1S) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_FillRandom" c_th1s_fillrandom 
+  :: (Ptr RawTH1S) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_FindBin" c_th1s_findbin 
+  :: (Ptr RawTH1S) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_FindFixBin" c_th1s_findfixbin 
+  :: (Ptr RawTH1S) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_FindFirstBinAbove" c_th1s_findfirstbinabove 
+  :: (Ptr RawTH1S) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_FindLastBinAbove" c_th1s_findlastbinabove 
+  :: (Ptr RawTH1S) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_FitPanelTH1" c_th1s_fitpanelth1 
+  :: (Ptr RawTH1S) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_getNdivisionA" c_th1s_getndivisiona 
+  :: (Ptr RawTH1S) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_getAxisColorA" c_th1s_getaxiscolora 
+  :: (Ptr RawTH1S) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_getLabelColorA" c_th1s_getlabelcolora 
+  :: (Ptr RawTH1S) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_getLabelFontA" c_th1s_getlabelfonta 
+  :: (Ptr RawTH1S) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_getLabelOffsetA" c_th1s_getlabeloffseta 
+  :: (Ptr RawTH1S) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_getLabelSizeA" c_th1s_getlabelsizea 
+  :: (Ptr RawTH1S) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_getTitleFontA" c_th1s_gettitlefonta 
+  :: (Ptr RawTH1S) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_getTitleOffsetA" c_th1s_gettitleoffseta 
+  :: (Ptr RawTH1S) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_getTitleSizeA" c_th1s_gettitlesizea 
+  :: (Ptr RawTH1S) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_getTickLengthA" c_th1s_getticklengtha 
+  :: (Ptr RawTH1S) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetBarOffset" c_th1s_getbaroffset 
+  :: (Ptr RawTH1S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetBarWidth" c_th1s_getbarwidth 
+  :: (Ptr RawTH1S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetContour" c_th1s_getcontour 
+  :: (Ptr RawTH1S) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetContourLevel" c_th1s_getcontourlevel 
+  :: (Ptr RawTH1S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetContourLevelPad" c_th1s_getcontourlevelpad 
+  :: (Ptr RawTH1S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetBin" c_th1s_getbin 
+  :: (Ptr RawTH1S) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetBinCenter" c_th1s_getbincenter 
+  :: (Ptr RawTH1S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetBinContent1" c_th1s_getbincontent1 
+  :: (Ptr RawTH1S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetBinContent2" c_th1s_getbincontent2 
+  :: (Ptr RawTH1S) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetBinContent3" c_th1s_getbincontent3 
+  :: (Ptr RawTH1S) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetBinError1" c_th1s_getbinerror1 
+  :: (Ptr RawTH1S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetBinError2" c_th1s_getbinerror2 
+  :: (Ptr RawTH1S) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetBinError3" c_th1s_getbinerror3 
+  :: (Ptr RawTH1S) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetBinLowEdge" c_th1s_getbinlowedge 
+  :: (Ptr RawTH1S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetBinWidth" c_th1s_getbinwidth 
+  :: (Ptr RawTH1S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetCellContent" c_th1s_getcellcontent 
+  :: (Ptr RawTH1S) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetCellError" c_th1s_getcellerror 
+  :: (Ptr RawTH1S) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetEntries" c_th1s_getentries 
+  :: (Ptr RawTH1S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetEffectiveEntries" c_th1s_geteffectiveentries 
+  :: (Ptr RawTH1S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetFunction" c_th1s_getfunction 
+  :: (Ptr RawTH1S) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetDimension" c_th1s_getdimension 
+  :: (Ptr RawTH1S) -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetKurtosis" c_th1s_getkurtosis 
+  :: (Ptr RawTH1S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetLowEdge" c_th1s_getlowedge 
+  :: (Ptr RawTH1S) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_getMaximumTH1" c_th1s_getmaximumth1 
+  :: (Ptr RawTH1S) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetMaximumBin" c_th1s_getmaximumbin 
+  :: (Ptr RawTH1S) -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetMaximumStored" c_th1s_getmaximumstored 
+  :: (Ptr RawTH1S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_getMinimumTH1" c_th1s_getminimumth1 
+  :: (Ptr RawTH1S) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetMinimumBin" c_th1s_getminimumbin 
+  :: (Ptr RawTH1S) -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetMinimumStored" c_th1s_getminimumstored 
+  :: (Ptr RawTH1S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetMean" c_th1s_getmean 
+  :: (Ptr RawTH1S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetMeanError" c_th1s_getmeanerror 
+  :: (Ptr RawTH1S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetNbinsX" c_th1s_getnbinsx 
+  :: (Ptr RawTH1S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetNbinsY" c_th1s_getnbinsy 
+  :: (Ptr RawTH1S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetNbinsZ" c_th1s_getnbinsz 
+  :: (Ptr RawTH1S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_getQuantilesTH1" c_th1s_getquantilesth1 
+  :: (Ptr RawTH1S) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetRandom" c_th1s_getrandom 
+  :: (Ptr RawTH1S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetStats" c_th1s_getstats 
+  :: (Ptr RawTH1S) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetSumOfWeights" c_th1s_getsumofweights 
+  :: (Ptr RawTH1S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetSumw2" c_th1s_getsumw2 
+  :: (Ptr RawTH1S) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetSumw2N" c_th1s_getsumw2n 
+  :: (Ptr RawTH1S) -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetRMS" c_th1s_getrms 
+  :: (Ptr RawTH1S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetRMSError" c_th1s_getrmserror 
+  :: (Ptr RawTH1S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetSkewness" c_th1s_getskewness 
+  :: (Ptr RawTH1S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_integral1" c_th1s_integral1 
+  :: (Ptr RawTH1S) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_interpolate1" c_th1s_interpolate1 
+  :: (Ptr RawTH1S) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_interpolate2" c_th1s_interpolate2 
+  :: (Ptr RawTH1S) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_interpolate3" c_th1s_interpolate3 
+  :: (Ptr RawTH1S) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_KolmogorovTest" c_th1s_kolmogorovtest 
+  :: (Ptr RawTH1S) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_LabelsDeflate" c_th1s_labelsdeflate 
+  :: (Ptr RawTH1S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_LabelsInflate" c_th1s_labelsinflate 
+  :: (Ptr RawTH1S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_LabelsOption" c_th1s_labelsoption 
+  :: (Ptr RawTH1S) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_multiflyF" c_th1s_multiflyf 
+  :: (Ptr RawTH1S) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_Multiply" c_th1s_multiply 
+  :: (Ptr RawTH1S) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_PutStats" c_th1s_putstats 
+  :: (Ptr RawTH1S) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_Rebin" c_th1s_rebin 
+  :: (Ptr RawTH1S) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1S.h TH1S_RebinAxis" c_th1s_rebinaxis 
+  :: (Ptr RawTH1S) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_Rebuild" c_th1s_rebuild 
+  :: (Ptr RawTH1S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_RecursiveRemove" c_th1s_recursiveremove 
+  :: (Ptr RawTH1S) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_Reset" c_th1s_reset 
+  :: (Ptr RawTH1S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_ResetStats" c_th1s_resetstats 
+  :: (Ptr RawTH1S) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_Scale" c_th1s_scale 
+  :: (Ptr RawTH1S) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_setAxisColorA" c_th1s_setaxiscolora 
+  :: (Ptr RawTH1S) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetAxisRange" c_th1s_setaxisrange 
+  :: (Ptr RawTH1S) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetBarOffset" c_th1s_setbaroffset 
+  :: (Ptr RawTH1S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetBarWidth" c_th1s_setbarwidth 
+  :: (Ptr RawTH1S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_setBinContent1" c_th1s_setbincontent1 
+  :: (Ptr RawTH1S) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_setBinContent2" c_th1s_setbincontent2 
+  :: (Ptr RawTH1S) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_setBinContent3" c_th1s_setbincontent3 
+  :: (Ptr RawTH1S) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_setBinError1" c_th1s_setbinerror1 
+  :: (Ptr RawTH1S) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_setBinError2" c_th1s_setbinerror2 
+  :: (Ptr RawTH1S) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_setBinError3" c_th1s_setbinerror3 
+  :: (Ptr RawTH1S) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_setBins1" c_th1s_setbins1 
+  :: (Ptr RawTH1S) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_setBins2" c_th1s_setbins2 
+  :: (Ptr RawTH1S) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_setBins3" c_th1s_setbins3 
+  :: (Ptr RawTH1S) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetBinsLength" c_th1s_setbinslength 
+  :: (Ptr RawTH1S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetBuffer" c_th1s_setbuffer 
+  :: (Ptr RawTH1S) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetCellContent" c_th1s_setcellcontent 
+  :: (Ptr RawTH1S) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetContent" c_th1s_setcontent 
+  :: (Ptr RawTH1S) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetContour" c_th1s_setcontour 
+  :: (Ptr RawTH1S) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetContourLevel" c_th1s_setcontourlevel 
+  :: (Ptr RawTH1S) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetDirectory" c_th1s_setdirectory 
+  :: (Ptr RawTH1S) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetEntries" c_th1s_setentries 
+  :: (Ptr RawTH1S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetError" c_th1s_seterror 
+  :: (Ptr RawTH1S) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_setLabelColorA" c_th1s_setlabelcolora 
+  :: (Ptr RawTH1S) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_setLabelSizeA" c_th1s_setlabelsizea 
+  :: (Ptr RawTH1S) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_setLabelFontA" c_th1s_setlabelfonta 
+  :: (Ptr RawTH1S) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_setLabelOffsetA" c_th1s_setlabeloffseta 
+  :: (Ptr RawTH1S) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetMaximum" c_th1s_setmaximum 
+  :: (Ptr RawTH1S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetMinimum" c_th1s_setminimum 
+  :: (Ptr RawTH1S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetNormFactor" c_th1s_setnormfactor 
+  :: (Ptr RawTH1S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetStats" c_th1s_setstats 
+  :: (Ptr RawTH1S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetOption" c_th1s_setoption 
+  :: (Ptr RawTH1S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetXTitle" c_th1s_setxtitle 
+  :: (Ptr RawTH1S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetYTitle" c_th1s_setytitle 
+  :: (Ptr RawTH1S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetZTitle" c_th1s_setztitle 
+  :: (Ptr RawTH1S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_ShowBackground" c_th1s_showbackground 
+  :: (Ptr RawTH1S) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH1S.h TH1S_ShowPeaks" c_th1s_showpeaks 
+  :: (Ptr RawTH1S) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_Smooth" c_th1s_smooth 
+  :: (Ptr RawTH1S) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_Sumw2" c_th1s_sumw2 
+  :: (Ptr RawTH1S) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_Draw" c_th1s_draw 
+  :: (Ptr RawTH1S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_FindObject" c_th1s_findobject 
+  :: (Ptr RawTH1S) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetName" c_th1s_getname 
+  :: (Ptr RawTH1S) -> IO CString
+
+foreign import ccall "HROOTHistTH1S.h TH1S_IsA" c_th1s_isa 
+  :: (Ptr RawTH1S) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH1S.h TH1S_Paint" c_th1s_paint 
+  :: (Ptr RawTH1S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_printObj" c_th1s_printobj 
+  :: (Ptr RawTH1S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SaveAs" c_th1s_saveas 
+  :: (Ptr RawTH1S) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_Write" c_th1s_write 
+  :: (Ptr RawTH1S) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetLineColor" c_th1s_getlinecolor 
+  :: (Ptr RawTH1S) -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetLineStyle" c_th1s_getlinestyle 
+  :: (Ptr RawTH1S) -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetLineWidth" c_th1s_getlinewidth 
+  :: (Ptr RawTH1S) -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_ResetAttLine" c_th1s_resetattline 
+  :: (Ptr RawTH1S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetLineAttributes" c_th1s_setlineattributes 
+  :: (Ptr RawTH1S) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetLineColor" c_th1s_setlinecolor 
+  :: (Ptr RawTH1S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetLineStyle" c_th1s_setlinestyle 
+  :: (Ptr RawTH1S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetLineWidth" c_th1s_setlinewidth 
+  :: (Ptr RawTH1S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetFillColor" c_th1s_setfillcolor 
+  :: (Ptr RawTH1S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetFillStyle" c_th1s_setfillstyle 
+  :: (Ptr RawTH1S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetMarkerColor" c_th1s_getmarkercolor 
+  :: (Ptr RawTH1S) -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetMarkerStyle" c_th1s_getmarkerstyle 
+  :: (Ptr RawTH1S) -> IO CInt
+
+foreign import ccall "HROOTHistTH1S.h TH1S_GetMarkerSize" c_th1s_getmarkersize 
+  :: (Ptr RawTH1S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH1S.h TH1S_ResetAttMarker" c_th1s_resetattmarker 
+  :: (Ptr RawTH1S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetMarkerAttributes" c_th1s_setmarkerattributes 
+  :: (Ptr RawTH1S) -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetMarkerColor" c_th1s_setmarkercolor 
+  :: (Ptr RawTH1S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetMarkerStyle" c_th1s_setmarkerstyle 
+  :: (Ptr RawTH1S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_SetMarkerSize" c_th1s_setmarkersize 
+  :: (Ptr RawTH1S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH1S.h TH1S_delete" c_th1s_delete 
+  :: (Ptr RawTH1S) -> IO ()
+
diff --git a/src/HROOT/Hist/TH1S/Implementation.hs b/src/HROOT/Hist/TH1S/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1S/Implementation.hs
@@ -0,0 +1,408 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH1S.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH1S.RawType
+import HROOT.Hist.TH1S.FFI
+import HROOT.Hist.TH1S.Interface
+import HROOT.Hist.TH1S.Cast
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TArrayS.RawType
+import HROOT.Core.TArrayS.Cast
+import HROOT.Core.TArrayS.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+import HROOT.Core.TArray.RawType
+import HROOT.Core.TArray.Cast
+import HROOT.Core.TArray.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH1S TH1S where
+instance ITH1 TH1S where
+  add = xform2 c_th1s_add
+  addBinContent = xform2 c_th1s_addbincontent
+  chi2Test = xform3 c_th1s_chi2test
+  computeIntegral = xform0 c_th1s_computeintegral
+  directoryAutoAdd = xform1 c_th1s_directoryautoadd
+  divide = xform5 c_th1s_divide
+  drawCopyTH1 = xform1 c_th1s_drawcopyth1
+  drawNormalized = xform2 c_th1s_drawnormalized
+  drawPanelTH1 = xform0 c_th1s_drawpanelth1
+  bufferEmpty = xform1 c_th1s_bufferempty
+  evalF = xform2 c_th1s_evalf
+  fFT = xform2 c_th1s_fft
+  fill1 = xform1 c_th1s_fill1
+  fill1w = xform2 c_th1s_fill1w
+  fillN1 = xform4 c_th1s_filln1
+  fillRandom = xform2 c_th1s_fillrandom
+  findBin = xform3 c_th1s_findbin
+  findFixBin = xform3 c_th1s_findfixbin
+  findFirstBinAbove = xform2 c_th1s_findfirstbinabove
+  findLastBinAbove = xform2 c_th1s_findlastbinabove
+  fitPanelTH1 = xform0 c_th1s_fitpanelth1
+  getNdivisionA = xform1 c_th1s_getndivisiona
+  getAxisColorA = xform1 c_th1s_getaxiscolora
+  getLabelColorA = xform1 c_th1s_getlabelcolora
+  getLabelFontA = xform1 c_th1s_getlabelfonta
+  getLabelOffsetA = xform1 c_th1s_getlabeloffseta
+  getLabelSizeA = xform1 c_th1s_getlabelsizea
+  getTitleFontA = xform1 c_th1s_gettitlefonta
+  getTitleOffsetA = xform1 c_th1s_gettitleoffseta
+  getTitleSizeA = xform1 c_th1s_gettitlesizea
+  getTickLengthA = xform1 c_th1s_getticklengtha
+  getBarOffset = xform0 c_th1s_getbaroffset
+  getBarWidth = xform0 c_th1s_getbarwidth
+  getContour = xform1 c_th1s_getcontour
+  getContourLevel = xform1 c_th1s_getcontourlevel
+  getContourLevelPad = xform1 c_th1s_getcontourlevelpad
+  getBin = xform3 c_th1s_getbin
+  getBinCenter = xform1 c_th1s_getbincenter
+  getBinContent1 = xform1 c_th1s_getbincontent1
+  getBinContent2 = xform2 c_th1s_getbincontent2
+  getBinContent3 = xform3 c_th1s_getbincontent3
+  getBinError1 = xform1 c_th1s_getbinerror1
+  getBinError2 = xform2 c_th1s_getbinerror2
+  getBinError3 = xform3 c_th1s_getbinerror3
+  getBinLowEdge = xform1 c_th1s_getbinlowedge
+  getBinWidth = xform1 c_th1s_getbinwidth
+  getCellContent = xform2 c_th1s_getcellcontent
+  getCellError = xform2 c_th1s_getcellerror
+  getEntries = xform0 c_th1s_getentries
+  getEffectiveEntries = xform0 c_th1s_geteffectiveentries
+  getFunction = xform1 c_th1s_getfunction
+  getDimension = xform0 c_th1s_getdimension
+  getKurtosis = xform1 c_th1s_getkurtosis
+  getLowEdge = xform1 c_th1s_getlowedge
+  getMaximumTH1 = xform1 c_th1s_getmaximumth1
+  getMaximumBin = xform0 c_th1s_getmaximumbin
+  getMaximumStored = xform0 c_th1s_getmaximumstored
+  getMinimumTH1 = xform1 c_th1s_getminimumth1
+  getMinimumBin = xform0 c_th1s_getminimumbin
+  getMinimumStored = xform0 c_th1s_getminimumstored
+  getMean = xform1 c_th1s_getmean
+  getMeanError = xform1 c_th1s_getmeanerror
+  getNbinsX = xform0 c_th1s_getnbinsx
+  getNbinsY = xform0 c_th1s_getnbinsy
+  getNbinsZ = xform0 c_th1s_getnbinsz
+  getQuantilesTH1 = xform3 c_th1s_getquantilesth1
+  getRandom = xform0 c_th1s_getrandom
+  getStats = xform1 c_th1s_getstats
+  getSumOfWeights = xform0 c_th1s_getsumofweights
+  getSumw2 = xform0 c_th1s_getsumw2
+  getSumw2N = xform0 c_th1s_getsumw2n
+  getRMS = xform1 c_th1s_getrms
+  getRMSError = xform1 c_th1s_getrmserror
+  getSkewness = xform1 c_th1s_getskewness
+  integral1 = xform3 c_th1s_integral1
+  interpolate1 = xform1 c_th1s_interpolate1
+  interpolate2 = xform2 c_th1s_interpolate2
+  interpolate3 = xform3 c_th1s_interpolate3
+  kolmogorovTest = xform2 c_th1s_kolmogorovtest
+  labelsDeflate = xform1 c_th1s_labelsdeflate
+  labelsInflate = xform1 c_th1s_labelsinflate
+  labelsOption = xform2 c_th1s_labelsoption
+  multiflyF = xform2 c_th1s_multiflyf
+  multiply = xform5 c_th1s_multiply
+  putStats = xform1 c_th1s_putstats
+  rebin = xform3 c_th1s_rebin
+  rebinAxis = xform2 c_th1s_rebinaxis
+  rebuild = xform1 c_th1s_rebuild
+  recursiveRemove = xform1 c_th1s_recursiveremove
+  reset = xform1 c_th1s_reset
+  resetStats = xform0 c_th1s_resetstats
+  scale = xform2 c_th1s_scale
+  setAxisColorA = xform2 c_th1s_setaxiscolora
+  setAxisRange = xform3 c_th1s_setaxisrange
+  setBarOffset = xform1 c_th1s_setbaroffset
+  setBarWidth = xform1 c_th1s_setbarwidth
+  setBinContent1 = xform2 c_th1s_setbincontent1
+  setBinContent2 = xform3 c_th1s_setbincontent2
+  setBinContent3 = xform4 c_th1s_setbincontent3
+  setBinError1 = xform2 c_th1s_setbinerror1
+  setBinError2 = xform3 c_th1s_setbinerror2
+  setBinError3 = xform4 c_th1s_setbinerror3
+  setBins1 = xform2 c_th1s_setbins1
+  setBins2 = xform4 c_th1s_setbins2
+  setBins3 = xform6 c_th1s_setbins3
+  setBinsLength = xform1 c_th1s_setbinslength
+  setBuffer = xform2 c_th1s_setbuffer
+  setCellContent = xform3 c_th1s_setcellcontent
+  setContent = xform1 c_th1s_setcontent
+  setContour = xform2 c_th1s_setcontour
+  setContourLevel = xform2 c_th1s_setcontourlevel
+  setDirectory = xform1 c_th1s_setdirectory
+  setEntries = xform1 c_th1s_setentries
+  setError = xform1 c_th1s_seterror
+  setLabelColorA = xform2 c_th1s_setlabelcolora
+  setLabelSizeA = xform2 c_th1s_setlabelsizea
+  setLabelFontA = xform2 c_th1s_setlabelfonta
+  setLabelOffsetA = xform2 c_th1s_setlabeloffseta
+  setMaximum = xform1 c_th1s_setmaximum
+  setMinimum = xform1 c_th1s_setminimum
+  setNormFactor = xform1 c_th1s_setnormfactor
+  setStats = xform1 c_th1s_setstats
+  setOption = xform1 c_th1s_setoption
+  setXTitle = xform1 c_th1s_setxtitle
+  setYTitle = xform1 c_th1s_setytitle
+  setZTitle = xform1 c_th1s_setztitle
+  showBackground = xform2 c_th1s_showbackground
+  showPeaks = xform3 c_th1s_showpeaks
+  smooth = xform2 c_th1s_smooth
+  sumw2 = xform0 c_th1s_sumw2
+instance ITArrayS TH1S where
+instance ITObject TH1S where
+  draw = xform1 c_th1s_draw
+  findObject = xform1 c_th1s_findobject
+  getName = xform0 c_th1s_getname
+  isA = xform0 c_th1s_isa
+  paint = xform1 c_th1s_paint
+  printObj = xform1 c_th1s_printobj
+  saveAs = xform2 c_th1s_saveas
+  write = xform3 c_th1s_write
+instance ITAttLine TH1S where
+  getLineColor = xform0 c_th1s_getlinecolor
+  getLineStyle = xform0 c_th1s_getlinestyle
+  getLineWidth = xform0 c_th1s_getlinewidth
+  resetAttLine = xform1 c_th1s_resetattline
+  setLineAttributes = xform0 c_th1s_setlineattributes
+  setLineColor = xform1 c_th1s_setlinecolor
+  setLineStyle = xform1 c_th1s_setlinestyle
+  setLineWidth = xform1 c_th1s_setlinewidth
+instance ITAttFill TH1S where
+  setFillColor = xform1 c_th1s_setfillcolor
+  setFillStyle = xform1 c_th1s_setfillstyle
+instance ITAttMarker TH1S where
+  getMarkerColor = xform0 c_th1s_getmarkercolor
+  getMarkerStyle = xform0 c_th1s_getmarkerstyle
+  getMarkerSize = xform0 c_th1s_getmarkersize
+  resetAttMarker = xform1 c_th1s_resetattmarker
+  setMarkerAttributes = xform0 c_th1s_setmarkerattributes
+  setMarkerColor = xform1 c_th1s_setmarkercolor
+  setMarkerStyle = xform1 c_th1s_setmarkerstyle
+  setMarkerSize = xform1 c_th1s_setmarkersize
+instance IDeletable TH1S where
+  delete = xform0 c_th1s_delete
+instance ITArray TH1S where
+
+instance ITH1S (Exist TH1S) where
+
+instance ITH1 (Exist TH1S) where
+  add (ETH1S x) = add x
+  addBinContent (ETH1S x) = addBinContent x
+  chi2Test (ETH1S x) = chi2Test x
+  computeIntegral (ETH1S x) = computeIntegral x
+  directoryAutoAdd (ETH1S x) = directoryAutoAdd x
+  divide (ETH1S x) = divide x
+  drawCopyTH1 (ETH1S x) a1 = return . ETH1S =<< drawCopyTH1 x a1
+  drawNormalized (ETH1S x) = drawNormalized x
+  drawPanelTH1 (ETH1S x) = drawPanelTH1 x
+  bufferEmpty (ETH1S x) = bufferEmpty x
+  evalF (ETH1S x) = evalF x
+  fFT (ETH1S x) = fFT x
+  fill1 (ETH1S x) = fill1 x
+  fill1w (ETH1S x) = fill1w x
+  fillN1 (ETH1S x) = fillN1 x
+  fillRandom (ETH1S x) = fillRandom x
+  findBin (ETH1S x) = findBin x
+  findFixBin (ETH1S x) = findFixBin x
+  findFirstBinAbove (ETH1S x) = findFirstBinAbove x
+  findLastBinAbove (ETH1S x) = findLastBinAbove x
+  fitPanelTH1 (ETH1S x) = fitPanelTH1 x
+  getNdivisionA (ETH1S x) = getNdivisionA x
+  getAxisColorA (ETH1S x) = getAxisColorA x
+  getLabelColorA (ETH1S x) = getLabelColorA x
+  getLabelFontA (ETH1S x) = getLabelFontA x
+  getLabelOffsetA (ETH1S x) = getLabelOffsetA x
+  getLabelSizeA (ETH1S x) = getLabelSizeA x
+  getTitleFontA (ETH1S x) = getTitleFontA x
+  getTitleOffsetA (ETH1S x) = getTitleOffsetA x
+  getTitleSizeA (ETH1S x) = getTitleSizeA x
+  getTickLengthA (ETH1S x) = getTickLengthA x
+  getBarOffset (ETH1S x) = getBarOffset x
+  getBarWidth (ETH1S x) = getBarWidth x
+  getContour (ETH1S x) = getContour x
+  getContourLevel (ETH1S x) = getContourLevel x
+  getContourLevelPad (ETH1S x) = getContourLevelPad x
+  getBin (ETH1S x) = getBin x
+  getBinCenter (ETH1S x) = getBinCenter x
+  getBinContent1 (ETH1S x) = getBinContent1 x
+  getBinContent2 (ETH1S x) = getBinContent2 x
+  getBinContent3 (ETH1S x) = getBinContent3 x
+  getBinError1 (ETH1S x) = getBinError1 x
+  getBinError2 (ETH1S x) = getBinError2 x
+  getBinError3 (ETH1S x) = getBinError3 x
+  getBinLowEdge (ETH1S x) = getBinLowEdge x
+  getBinWidth (ETH1S x) = getBinWidth x
+  getCellContent (ETH1S x) = getCellContent x
+  getCellError (ETH1S x) = getCellError x
+  getEntries (ETH1S x) = getEntries x
+  getEffectiveEntries (ETH1S x) = getEffectiveEntries x
+  getFunction (ETH1S x) = getFunction x
+  getDimension (ETH1S x) = getDimension x
+  getKurtosis (ETH1S x) = getKurtosis x
+  getLowEdge (ETH1S x) = getLowEdge x
+  getMaximumTH1 (ETH1S x) = getMaximumTH1 x
+  getMaximumBin (ETH1S x) = getMaximumBin x
+  getMaximumStored (ETH1S x) = getMaximumStored x
+  getMinimumTH1 (ETH1S x) = getMinimumTH1 x
+  getMinimumBin (ETH1S x) = getMinimumBin x
+  getMinimumStored (ETH1S x) = getMinimumStored x
+  getMean (ETH1S x) = getMean x
+  getMeanError (ETH1S x) = getMeanError x
+  getNbinsX (ETH1S x) = getNbinsX x
+  getNbinsY (ETH1S x) = getNbinsY x
+  getNbinsZ (ETH1S x) = getNbinsZ x
+  getQuantilesTH1 (ETH1S x) = getQuantilesTH1 x
+  getRandom (ETH1S x) = getRandom x
+  getStats (ETH1S x) = getStats x
+  getSumOfWeights (ETH1S x) = getSumOfWeights x
+  getSumw2 (ETH1S x) = getSumw2 x
+  getSumw2N (ETH1S x) = getSumw2N x
+  getRMS (ETH1S x) = getRMS x
+  getRMSError (ETH1S x) = getRMSError x
+  getSkewness (ETH1S x) = getSkewness x
+  integral1 (ETH1S x) = integral1 x
+  interpolate1 (ETH1S x) = interpolate1 x
+  interpolate2 (ETH1S x) = interpolate2 x
+  interpolate3 (ETH1S x) = interpolate3 x
+  kolmogorovTest (ETH1S x) = kolmogorovTest x
+  labelsDeflate (ETH1S x) = labelsDeflate x
+  labelsInflate (ETH1S x) = labelsInflate x
+  labelsOption (ETH1S x) = labelsOption x
+  multiflyF (ETH1S x) = multiflyF x
+  multiply (ETH1S x) = multiply x
+  putStats (ETH1S x) = putStats x
+  rebin (ETH1S x) = rebin x
+  rebinAxis (ETH1S x) = rebinAxis x
+  rebuild (ETH1S x) = rebuild x
+  recursiveRemove (ETH1S x) = recursiveRemove x
+  reset (ETH1S x) = reset x
+  resetStats (ETH1S x) = resetStats x
+  scale (ETH1S x) = scale x
+  setAxisColorA (ETH1S x) = setAxisColorA x
+  setAxisRange (ETH1S x) = setAxisRange x
+  setBarOffset (ETH1S x) = setBarOffset x
+  setBarWidth (ETH1S x) = setBarWidth x
+  setBinContent1 (ETH1S x) = setBinContent1 x
+  setBinContent2 (ETH1S x) = setBinContent2 x
+  setBinContent3 (ETH1S x) = setBinContent3 x
+  setBinError1 (ETH1S x) = setBinError1 x
+  setBinError2 (ETH1S x) = setBinError2 x
+  setBinError3 (ETH1S x) = setBinError3 x
+  setBins1 (ETH1S x) = setBins1 x
+  setBins2 (ETH1S x) = setBins2 x
+  setBins3 (ETH1S x) = setBins3 x
+  setBinsLength (ETH1S x) = setBinsLength x
+  setBuffer (ETH1S x) = setBuffer x
+  setCellContent (ETH1S x) = setCellContent x
+  setContent (ETH1S x) = setContent x
+  setContour (ETH1S x) = setContour x
+  setContourLevel (ETH1S x) = setContourLevel x
+  setDirectory (ETH1S x) = setDirectory x
+  setEntries (ETH1S x) = setEntries x
+  setError (ETH1S x) = setError x
+  setLabelColorA (ETH1S x) = setLabelColorA x
+  setLabelSizeA (ETH1S x) = setLabelSizeA x
+  setLabelFontA (ETH1S x) = setLabelFontA x
+  setLabelOffsetA (ETH1S x) = setLabelOffsetA x
+  setMaximum (ETH1S x) = setMaximum x
+  setMinimum (ETH1S x) = setMinimum x
+  setNormFactor (ETH1S x) = setNormFactor x
+  setStats (ETH1S x) = setStats x
+  setOption (ETH1S x) = setOption x
+  setXTitle (ETH1S x) = setXTitle x
+  setYTitle (ETH1S x) = setYTitle x
+  setZTitle (ETH1S x) = setZTitle x
+  showBackground (ETH1S x) = showBackground x
+  showPeaks (ETH1S x) = showPeaks x
+  smooth (ETH1S x) = smooth x
+  sumw2 (ETH1S x) = sumw2 x
+instance ITArrayS (Exist TH1S) where
+
+instance ITObject (Exist TH1S) where
+  draw (ETH1S x) = draw x
+  findObject (ETH1S x) = findObject x
+  getName (ETH1S x) = getName x
+  isA (ETH1S x) = isA x
+  paint (ETH1S x) = paint x
+  printObj (ETH1S x) = printObj x
+  saveAs (ETH1S x) = saveAs x
+  write (ETH1S x) = write x
+instance ITAttLine (Exist TH1S) where
+  getLineColor (ETH1S x) = getLineColor x
+  getLineStyle (ETH1S x) = getLineStyle x
+  getLineWidth (ETH1S x) = getLineWidth x
+  resetAttLine (ETH1S x) = resetAttLine x
+  setLineAttributes (ETH1S x) = setLineAttributes x
+  setLineColor (ETH1S x) = setLineColor x
+  setLineStyle (ETH1S x) = setLineStyle x
+  setLineWidth (ETH1S x) = setLineWidth x
+instance ITAttFill (Exist TH1S) where
+  setFillColor (ETH1S x) = setFillColor x
+  setFillStyle (ETH1S x) = setFillStyle x
+instance ITAttMarker (Exist TH1S) where
+  getMarkerColor (ETH1S x) = getMarkerColor x
+  getMarkerStyle (ETH1S x) = getMarkerStyle x
+  getMarkerSize (ETH1S x) = getMarkerSize x
+  resetAttMarker (ETH1S x) = resetAttMarker x
+  setMarkerAttributes (ETH1S x) = setMarkerAttributes x
+  setMarkerColor (ETH1S x) = setMarkerColor x
+  setMarkerStyle (ETH1S x) = setMarkerStyle x
+  setMarkerSize (ETH1S x) = setMarkerSize x
+instance IDeletable (Exist TH1S) where
+  delete (ETH1S x) = delete x
+instance ITArray (Exist TH1S) where
+
+
+
+
+
+
+
+
+instance FPtr (Exist TH1S) where
+  type Raw (Exist TH1S) = RawTH1S
+  get_fptr (ETH1S obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH1S (cast_fptr_to_obj (fptr :: ForeignPtr RawTH1S) :: TH1S)
diff --git a/src/HROOT/Hist/TH1S/Interface.hs b/src/HROOT/Hist/TH1S/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1S/Interface.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH1S.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH1S.RawType
+
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TArrayS.Interface
+---- ============ ----
+
+
+
+class (ITH1 a,ITArrayS a) => ITH1S a where
+
+instance Existable TH1S where
+  data Exist TH1S = forall a. (FPtr a, ITH1S a) => ETH1S a
+
+upcastTH1S :: (FPtr a, ITH1S a) => a -> TH1S
+upcastTH1S h = let fh = get_fptr h
+                   fh2 :: ForeignPtr RawTH1S = castForeignPtr fh
+               in cast_fptr_to_obj fh2
+
+downcastTH1S :: (FPtr a, ITH1S a) => TH1S -> a 
+downcastTH1S h = let fh = get_fptr h
+                     fh2 = castForeignPtr fh
+                 in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH1S/RawType.hs b/src/HROOT/Hist/TH1S/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH1S/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH1S.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH1S
+newtype TH1S = TH1S (ForeignPtr RawTH1S) deriving (Eq, Ord, Show)
+instance FPtr TH1S where
+   type Raw TH1S = RawTH1S
+   get_fptr (TH1S fptr) = fptr
+   cast_fptr_to_obj = TH1S
diff --git a/src/HROOT/Hist/TH2.hs b/src/HROOT/Hist/TH2.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2.hs
@@ -0,0 +1,16 @@
+module HROOT.Hist.TH2
+  (
+    TH2(..)
+  , ITH2(..)
+  , upcastTH2
+  , downcastTH2
+  , tH2ProjectionX
+  , tH2ProjectionY
+ 
+  ) where
+
+import HROOT.Hist.TH2.RawType
+import HROOT.Hist.TH2.Interface
+import HROOT.Hist.TH2.Implementation
+
+
diff --git a/src/HROOT/Hist/TH2/Cast.hs b/src/HROOT/Hist/TH2/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH2.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH2.RawType
+import HROOT.Hist.TH2.Interface
+
+instance (ITH2 a, FPtr a) => Castable a (Ptr RawTH2) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH2 (Ptr RawTH2) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH2/FFI.hsc b/src/HROOT/Hist/TH2/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2/FFI.hsc
@@ -0,0 +1,552 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH2.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH2.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+import HROOT.Hist.TH1D.RawType
+import HROOT.Core.TObjArray.RawType
+
+#include "HROOTHistTH2.h"
+
+foreign import ccall "HROOTHistTH2.h TH2_Add" c_th2_add 
+  :: (Ptr RawTH2) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_AddBinContent" c_th2_addbincontent 
+  :: (Ptr RawTH2) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_Chi2Test" c_th2_chi2test 
+  :: (Ptr RawTH2) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_ComputeIntegral" c_th2_computeintegral 
+  :: (Ptr RawTH2) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_DirectoryAutoAdd" c_th2_directoryautoadd 
+  :: (Ptr RawTH2) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_Divide" c_th2_divide 
+  :: (Ptr RawTH2) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_drawCopyTH1" c_th2_drawcopyth1 
+  :: (Ptr RawTH2) -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2.h TH2_DrawNormalized" c_th2_drawnormalized 
+  :: (Ptr RawTH2) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2.h TH2_drawPanelTH1" c_th2_drawpanelth1 
+  :: (Ptr RawTH2) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_BufferEmpty" c_th2_bufferempty 
+  :: (Ptr RawTH2) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_evalF" c_th2_evalf 
+  :: (Ptr RawTH2) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_FFT" c_th2_fft 
+  :: (Ptr RawTH2) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2.h TH2_fill1" c_th2_fill1 
+  :: (Ptr RawTH2) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_fill1w" c_th2_fill1w 
+  :: (Ptr RawTH2) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_fillN1" c_th2_filln1 
+  :: (Ptr RawTH2) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_FillRandom" c_th2_fillrandom 
+  :: (Ptr RawTH2) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_FindBin" c_th2_findbin 
+  :: (Ptr RawTH2) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_FindFixBin" c_th2_findfixbin 
+  :: (Ptr RawTH2) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_FindFirstBinAbove" c_th2_findfirstbinabove 
+  :: (Ptr RawTH2) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_FindLastBinAbove" c_th2_findlastbinabove 
+  :: (Ptr RawTH2) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_FitPanelTH1" c_th2_fitpanelth1 
+  :: (Ptr RawTH2) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_getNdivisionA" c_th2_getndivisiona 
+  :: (Ptr RawTH2) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_getAxisColorA" c_th2_getaxiscolora 
+  :: (Ptr RawTH2) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_getLabelColorA" c_th2_getlabelcolora 
+  :: (Ptr RawTH2) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_getLabelFontA" c_th2_getlabelfonta 
+  :: (Ptr RawTH2) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_getLabelOffsetA" c_th2_getlabeloffseta 
+  :: (Ptr RawTH2) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_getLabelSizeA" c_th2_getlabelsizea 
+  :: (Ptr RawTH2) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_getTitleFontA" c_th2_gettitlefonta 
+  :: (Ptr RawTH2) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_getTitleOffsetA" c_th2_gettitleoffseta 
+  :: (Ptr RawTH2) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_getTitleSizeA" c_th2_gettitlesizea 
+  :: (Ptr RawTH2) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_getTickLengthA" c_th2_getticklengtha 
+  :: (Ptr RawTH2) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetBarOffset" c_th2_getbaroffset 
+  :: (Ptr RawTH2) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetBarWidth" c_th2_getbarwidth 
+  :: (Ptr RawTH2) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetContour" c_th2_getcontour 
+  :: (Ptr RawTH2) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_GetContourLevel" c_th2_getcontourlevel 
+  :: (Ptr RawTH2) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetContourLevelPad" c_th2_getcontourlevelpad 
+  :: (Ptr RawTH2) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetBin" c_th2_getbin 
+  :: (Ptr RawTH2) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_GetBinCenter" c_th2_getbincenter 
+  :: (Ptr RawTH2) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetBinContent1" c_th2_getbincontent1 
+  :: (Ptr RawTH2) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetBinContent2" c_th2_getbincontent2 
+  :: (Ptr RawTH2) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetBinContent3" c_th2_getbincontent3 
+  :: (Ptr RawTH2) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetBinError1" c_th2_getbinerror1 
+  :: (Ptr RawTH2) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetBinError2" c_th2_getbinerror2 
+  :: (Ptr RawTH2) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetBinError3" c_th2_getbinerror3 
+  :: (Ptr RawTH2) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetBinLowEdge" c_th2_getbinlowedge 
+  :: (Ptr RawTH2) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetBinWidth" c_th2_getbinwidth 
+  :: (Ptr RawTH2) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetCellContent" c_th2_getcellcontent 
+  :: (Ptr RawTH2) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetCellError" c_th2_getcellerror 
+  :: (Ptr RawTH2) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetEntries" c_th2_getentries 
+  :: (Ptr RawTH2) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetEffectiveEntries" c_th2_geteffectiveentries 
+  :: (Ptr RawTH2) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetFunction" c_th2_getfunction 
+  :: (Ptr RawTH2) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH2.h TH2_GetDimension" c_th2_getdimension 
+  :: (Ptr RawTH2) -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_GetKurtosis" c_th2_getkurtosis 
+  :: (Ptr RawTH2) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetLowEdge" c_th2_getlowedge 
+  :: (Ptr RawTH2) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_getMaximumTH1" c_th2_getmaximumth1 
+  :: (Ptr RawTH2) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetMaximumBin" c_th2_getmaximumbin 
+  :: (Ptr RawTH2) -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_GetMaximumStored" c_th2_getmaximumstored 
+  :: (Ptr RawTH2) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_getMinimumTH1" c_th2_getminimumth1 
+  :: (Ptr RawTH2) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetMinimumBin" c_th2_getminimumbin 
+  :: (Ptr RawTH2) -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_GetMinimumStored" c_th2_getminimumstored 
+  :: (Ptr RawTH2) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetMean" c_th2_getmean 
+  :: (Ptr RawTH2) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetMeanError" c_th2_getmeanerror 
+  :: (Ptr RawTH2) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetNbinsX" c_th2_getnbinsx 
+  :: (Ptr RawTH2) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetNbinsY" c_th2_getnbinsy 
+  :: (Ptr RawTH2) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetNbinsZ" c_th2_getnbinsz 
+  :: (Ptr RawTH2) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_getQuantilesTH1" c_th2_getquantilesth1 
+  :: (Ptr RawTH2) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_GetRandom" c_th2_getrandom 
+  :: (Ptr RawTH2) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetStats" c_th2_getstats 
+  :: (Ptr RawTH2) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_GetSumOfWeights" c_th2_getsumofweights 
+  :: (Ptr RawTH2) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetSumw2" c_th2_getsumw2 
+  :: (Ptr RawTH2) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH2.h TH2_GetSumw2N" c_th2_getsumw2n 
+  :: (Ptr RawTH2) -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_GetRMS" c_th2_getrms 
+  :: (Ptr RawTH2) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetRMSError" c_th2_getrmserror 
+  :: (Ptr RawTH2) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_GetSkewness" c_th2_getskewness 
+  :: (Ptr RawTH2) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_integral1" c_th2_integral1 
+  :: (Ptr RawTH2) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_interpolate1" c_th2_interpolate1 
+  :: (Ptr RawTH2) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_interpolate2" c_th2_interpolate2 
+  :: (Ptr RawTH2) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_interpolate3" c_th2_interpolate3 
+  :: (Ptr RawTH2) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_KolmogorovTest" c_th2_kolmogorovtest 
+  :: (Ptr RawTH2) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_LabelsDeflate" c_th2_labelsdeflate 
+  :: (Ptr RawTH2) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_LabelsInflate" c_th2_labelsinflate 
+  :: (Ptr RawTH2) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_LabelsOption" c_th2_labelsoption 
+  :: (Ptr RawTH2) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_multiflyF" c_th2_multiflyf 
+  :: (Ptr RawTH2) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_Multiply" c_th2_multiply 
+  :: (Ptr RawTH2) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_PutStats" c_th2_putstats 
+  :: (Ptr RawTH2) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_Rebin" c_th2_rebin 
+  :: (Ptr RawTH2) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2.h TH2_RebinAxis" c_th2_rebinaxis 
+  :: (Ptr RawTH2) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_Rebuild" c_th2_rebuild 
+  :: (Ptr RawTH2) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_RecursiveRemove" c_th2_recursiveremove 
+  :: (Ptr RawTH2) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_Reset" c_th2_reset 
+  :: (Ptr RawTH2) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_ResetStats" c_th2_resetstats 
+  :: (Ptr RawTH2) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_Scale" c_th2_scale 
+  :: (Ptr RawTH2) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_setAxisColorA" c_th2_setaxiscolora 
+  :: (Ptr RawTH2) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetAxisRange" c_th2_setaxisrange 
+  :: (Ptr RawTH2) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetBarOffset" c_th2_setbaroffset 
+  :: (Ptr RawTH2) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetBarWidth" c_th2_setbarwidth 
+  :: (Ptr RawTH2) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_setBinContent1" c_th2_setbincontent1 
+  :: (Ptr RawTH2) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_setBinContent2" c_th2_setbincontent2 
+  :: (Ptr RawTH2) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_setBinContent3" c_th2_setbincontent3 
+  :: (Ptr RawTH2) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_setBinError1" c_th2_setbinerror1 
+  :: (Ptr RawTH2) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_setBinError2" c_th2_setbinerror2 
+  :: (Ptr RawTH2) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_setBinError3" c_th2_setbinerror3 
+  :: (Ptr RawTH2) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_setBins1" c_th2_setbins1 
+  :: (Ptr RawTH2) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_setBins2" c_th2_setbins2 
+  :: (Ptr RawTH2) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_setBins3" c_th2_setbins3 
+  :: (Ptr RawTH2) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetBinsLength" c_th2_setbinslength 
+  :: (Ptr RawTH2) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetBuffer" c_th2_setbuffer 
+  :: (Ptr RawTH2) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetCellContent" c_th2_setcellcontent 
+  :: (Ptr RawTH2) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetContent" c_th2_setcontent 
+  :: (Ptr RawTH2) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetContour" c_th2_setcontour 
+  :: (Ptr RawTH2) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetContourLevel" c_th2_setcontourlevel 
+  :: (Ptr RawTH2) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetDirectory" c_th2_setdirectory 
+  :: (Ptr RawTH2) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetEntries" c_th2_setentries 
+  :: (Ptr RawTH2) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetError" c_th2_seterror 
+  :: (Ptr RawTH2) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_setLabelColorA" c_th2_setlabelcolora 
+  :: (Ptr RawTH2) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_setLabelSizeA" c_th2_setlabelsizea 
+  :: (Ptr RawTH2) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_setLabelFontA" c_th2_setlabelfonta 
+  :: (Ptr RawTH2) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_setLabelOffsetA" c_th2_setlabeloffseta 
+  :: (Ptr RawTH2) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetMaximum" c_th2_setmaximum 
+  :: (Ptr RawTH2) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetMinimum" c_th2_setminimum 
+  :: (Ptr RawTH2) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetNormFactor" c_th2_setnormfactor 
+  :: (Ptr RawTH2) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetStats" c_th2_setstats 
+  :: (Ptr RawTH2) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetOption" c_th2_setoption 
+  :: (Ptr RawTH2) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetXTitle" c_th2_setxtitle 
+  :: (Ptr RawTH2) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetYTitle" c_th2_setytitle 
+  :: (Ptr RawTH2) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetZTitle" c_th2_setztitle 
+  :: (Ptr RawTH2) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_ShowBackground" c_th2_showbackground 
+  :: (Ptr RawTH2) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2.h TH2_ShowPeaks" c_th2_showpeaks 
+  :: (Ptr RawTH2) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_Smooth" c_th2_smooth 
+  :: (Ptr RawTH2) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_Sumw2" c_th2_sumw2 
+  :: (Ptr RawTH2) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_Draw" c_th2_draw 
+  :: (Ptr RawTH2) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_FindObject" c_th2_findobject 
+  :: (Ptr RawTH2) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH2.h TH2_GetName" c_th2_getname 
+  :: (Ptr RawTH2) -> IO CString
+
+foreign import ccall "HROOTHistTH2.h TH2_IsA" c_th2_isa 
+  :: (Ptr RawTH2) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH2.h TH2_Paint" c_th2_paint 
+  :: (Ptr RawTH2) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_printObj" c_th2_printobj 
+  :: (Ptr RawTH2) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SaveAs" c_th2_saveas 
+  :: (Ptr RawTH2) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_Write" c_th2_write 
+  :: (Ptr RawTH2) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_GetLineColor" c_th2_getlinecolor 
+  :: (Ptr RawTH2) -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_GetLineStyle" c_th2_getlinestyle 
+  :: (Ptr RawTH2) -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_GetLineWidth" c_th2_getlinewidth 
+  :: (Ptr RawTH2) -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_ResetAttLine" c_th2_resetattline 
+  :: (Ptr RawTH2) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetLineAttributes" c_th2_setlineattributes 
+  :: (Ptr RawTH2) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetLineColor" c_th2_setlinecolor 
+  :: (Ptr RawTH2) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetLineStyle" c_th2_setlinestyle 
+  :: (Ptr RawTH2) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetLineWidth" c_th2_setlinewidth 
+  :: (Ptr RawTH2) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetFillColor" c_th2_setfillcolor 
+  :: (Ptr RawTH2) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetFillStyle" c_th2_setfillstyle 
+  :: (Ptr RawTH2) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_GetMarkerColor" c_th2_getmarkercolor 
+  :: (Ptr RawTH2) -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_GetMarkerStyle" c_th2_getmarkerstyle 
+  :: (Ptr RawTH2) -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_GetMarkerSize" c_th2_getmarkersize 
+  :: (Ptr RawTH2) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_ResetAttMarker" c_th2_resetattmarker 
+  :: (Ptr RawTH2) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetMarkerAttributes" c_th2_setmarkerattributes 
+  :: (Ptr RawTH2) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetMarkerColor" c_th2_setmarkercolor 
+  :: (Ptr RawTH2) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetMarkerStyle" c_th2_setmarkerstyle 
+  :: (Ptr RawTH2) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetMarkerSize" c_th2_setmarkersize 
+  :: (Ptr RawTH2) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_delete" c_th2_delete 
+  :: (Ptr RawTH2) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_fill2" c_th2_fill2 
+  :: (Ptr RawTH2) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_fill2w" c_th2_fill2w 
+  :: (Ptr RawTH2) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_fillN2" c_th2_filln2 
+  :: (Ptr RawTH2) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_fillRandom2" c_th2_fillrandom2 
+  :: (Ptr RawTH2) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_findFirstBinAbove2" c_th2_findfirstbinabove2 
+  :: (Ptr RawTH2) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_findLastBinAbove2" c_th2_findlastbinabove2 
+  :: (Ptr RawTH2) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2.h TH2_FitSlicesX" c_th2_fitslicesx 
+  :: (Ptr RawTH2) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CString -> (Ptr RawTObjArray) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_FitSlicesY" c_th2_fitslicesy 
+  :: (Ptr RawTH2) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CString -> (Ptr RawTObjArray) -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_getCorrelationFactor2" c_th2_getcorrelationfactor2 
+  :: (Ptr RawTH2) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_getCovariance2" c_th2_getcovariance2 
+  :: (Ptr RawTH2) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_integral2" c_th2_integral2 
+  :: (Ptr RawTH2) -> CInt -> CInt -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2.h TH2_tH2ProjectionX" c_th2_th2projectionx 
+  :: (Ptr RawTH2) -> CString -> CInt -> CInt -> CString -> IO (Ptr RawTH1D)
+
+foreign import ccall "HROOTHistTH2.h TH2_tH2ProjectionY" c_th2_th2projectiony 
+  :: (Ptr RawTH2) -> CString -> CInt -> CInt -> CString -> IO (Ptr RawTH1D)
+
+foreign import ccall "HROOTHistTH2.h TH2_rebinX2" c_th2_rebinx2 
+  :: (Ptr RawTH2) -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2.h TH2_rebinY2" c_th2_rebiny2 
+  :: (Ptr RawTH2) -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2.h TH2_Rebin2D" c_th2_rebin2d 
+  :: (Ptr RawTH2) -> CInt -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2.h TH2_SetShowProjectionX" c_th2_setshowprojectionx 
+  :: (Ptr RawTH2) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2.h TH2_SetShowProjectionY" c_th2_setshowprojectiony 
+  :: (Ptr RawTH2) -> CInt -> IO ()
+
diff --git a/src/HROOT/Hist/TH2/Implementation.hs b/src/HROOT/Hist/TH2/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2/Implementation.hs
@@ -0,0 +1,437 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH2.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH2.RawType
+import HROOT.Hist.TH2.FFI
+import HROOT.Hist.TH2.Interface
+import HROOT.Hist.TH2.Cast
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1D.Cast
+import HROOT.Hist.TH1D.Interface
+import HROOT.Core.TObjArray.RawType
+import HROOT.Core.TObjArray.Cast
+import HROOT.Core.TObjArray.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH2 TH2 where
+  fill2 = xform2 c_th2_fill2
+  fill2w = xform3 c_th2_fill2w
+  fillN2 = xform5 c_th2_filln2
+  fillRandom2 = xform2 c_th2_fillrandom2
+  findFirstBinAbove2 = xform2 c_th2_findfirstbinabove2
+  findLastBinAbove2 = xform2 c_th2_findlastbinabove2
+  fitSlicesX = xform6 c_th2_fitslicesx
+  fitSlicesY = xform6 c_th2_fitslicesy
+  getCorrelationFactor2 = xform2 c_th2_getcorrelationfactor2
+  getCovariance2 = xform2 c_th2_getcovariance2
+  integral2 = xform5 c_th2_integral2
+  rebinX2 = xform2 c_th2_rebinx2
+  rebinY2 = xform2 c_th2_rebiny2
+  rebin2D = xform3 c_th2_rebin2d
+  setShowProjectionX = xform1 c_th2_setshowprojectionx
+  setShowProjectionY = xform1 c_th2_setshowprojectiony
+instance ITH1 TH2 where
+  add = xform2 c_th2_add
+  addBinContent = xform2 c_th2_addbincontent
+  chi2Test = xform3 c_th2_chi2test
+  computeIntegral = xform0 c_th2_computeintegral
+  directoryAutoAdd = xform1 c_th2_directoryautoadd
+  divide = xform5 c_th2_divide
+  drawCopyTH1 = xform1 c_th2_drawcopyth1
+  drawNormalized = xform2 c_th2_drawnormalized
+  drawPanelTH1 = xform0 c_th2_drawpanelth1
+  bufferEmpty = xform1 c_th2_bufferempty
+  evalF = xform2 c_th2_evalf
+  fFT = xform2 c_th2_fft
+  fill1 = xform1 c_th2_fill1
+  fill1w = xform2 c_th2_fill1w
+  fillN1 = xform4 c_th2_filln1
+  fillRandom = xform2 c_th2_fillrandom
+  findBin = xform3 c_th2_findbin
+  findFixBin = xform3 c_th2_findfixbin
+  findFirstBinAbove = xform2 c_th2_findfirstbinabove
+  findLastBinAbove = xform2 c_th2_findlastbinabove
+  fitPanelTH1 = xform0 c_th2_fitpanelth1
+  getNdivisionA = xform1 c_th2_getndivisiona
+  getAxisColorA = xform1 c_th2_getaxiscolora
+  getLabelColorA = xform1 c_th2_getlabelcolora
+  getLabelFontA = xform1 c_th2_getlabelfonta
+  getLabelOffsetA = xform1 c_th2_getlabeloffseta
+  getLabelSizeA = xform1 c_th2_getlabelsizea
+  getTitleFontA = xform1 c_th2_gettitlefonta
+  getTitleOffsetA = xform1 c_th2_gettitleoffseta
+  getTitleSizeA = xform1 c_th2_gettitlesizea
+  getTickLengthA = xform1 c_th2_getticklengtha
+  getBarOffset = xform0 c_th2_getbaroffset
+  getBarWidth = xform0 c_th2_getbarwidth
+  getContour = xform1 c_th2_getcontour
+  getContourLevel = xform1 c_th2_getcontourlevel
+  getContourLevelPad = xform1 c_th2_getcontourlevelpad
+  getBin = xform3 c_th2_getbin
+  getBinCenter = xform1 c_th2_getbincenter
+  getBinContent1 = xform1 c_th2_getbincontent1
+  getBinContent2 = xform2 c_th2_getbincontent2
+  getBinContent3 = xform3 c_th2_getbincontent3
+  getBinError1 = xform1 c_th2_getbinerror1
+  getBinError2 = xform2 c_th2_getbinerror2
+  getBinError3 = xform3 c_th2_getbinerror3
+  getBinLowEdge = xform1 c_th2_getbinlowedge
+  getBinWidth = xform1 c_th2_getbinwidth
+  getCellContent = xform2 c_th2_getcellcontent
+  getCellError = xform2 c_th2_getcellerror
+  getEntries = xform0 c_th2_getentries
+  getEffectiveEntries = xform0 c_th2_geteffectiveentries
+  getFunction = xform1 c_th2_getfunction
+  getDimension = xform0 c_th2_getdimension
+  getKurtosis = xform1 c_th2_getkurtosis
+  getLowEdge = xform1 c_th2_getlowedge
+  getMaximumTH1 = xform1 c_th2_getmaximumth1
+  getMaximumBin = xform0 c_th2_getmaximumbin
+  getMaximumStored = xform0 c_th2_getmaximumstored
+  getMinimumTH1 = xform1 c_th2_getminimumth1
+  getMinimumBin = xform0 c_th2_getminimumbin
+  getMinimumStored = xform0 c_th2_getminimumstored
+  getMean = xform1 c_th2_getmean
+  getMeanError = xform1 c_th2_getmeanerror
+  getNbinsX = xform0 c_th2_getnbinsx
+  getNbinsY = xform0 c_th2_getnbinsy
+  getNbinsZ = xform0 c_th2_getnbinsz
+  getQuantilesTH1 = xform3 c_th2_getquantilesth1
+  getRandom = xform0 c_th2_getrandom
+  getStats = xform1 c_th2_getstats
+  getSumOfWeights = xform0 c_th2_getsumofweights
+  getSumw2 = xform0 c_th2_getsumw2
+  getSumw2N = xform0 c_th2_getsumw2n
+  getRMS = xform1 c_th2_getrms
+  getRMSError = xform1 c_th2_getrmserror
+  getSkewness = xform1 c_th2_getskewness
+  integral1 = xform3 c_th2_integral1
+  interpolate1 = xform1 c_th2_interpolate1
+  interpolate2 = xform2 c_th2_interpolate2
+  interpolate3 = xform3 c_th2_interpolate3
+  kolmogorovTest = xform2 c_th2_kolmogorovtest
+  labelsDeflate = xform1 c_th2_labelsdeflate
+  labelsInflate = xform1 c_th2_labelsinflate
+  labelsOption = xform2 c_th2_labelsoption
+  multiflyF = xform2 c_th2_multiflyf
+  multiply = xform5 c_th2_multiply
+  putStats = xform1 c_th2_putstats
+  rebin = xform3 c_th2_rebin
+  rebinAxis = xform2 c_th2_rebinaxis
+  rebuild = xform1 c_th2_rebuild
+  recursiveRemove = xform1 c_th2_recursiveremove
+  reset = xform1 c_th2_reset
+  resetStats = xform0 c_th2_resetstats
+  scale = xform2 c_th2_scale
+  setAxisColorA = xform2 c_th2_setaxiscolora
+  setAxisRange = xform3 c_th2_setaxisrange
+  setBarOffset = xform1 c_th2_setbaroffset
+  setBarWidth = xform1 c_th2_setbarwidth
+  setBinContent1 = xform2 c_th2_setbincontent1
+  setBinContent2 = xform3 c_th2_setbincontent2
+  setBinContent3 = xform4 c_th2_setbincontent3
+  setBinError1 = xform2 c_th2_setbinerror1
+  setBinError2 = xform3 c_th2_setbinerror2
+  setBinError3 = xform4 c_th2_setbinerror3
+  setBins1 = xform2 c_th2_setbins1
+  setBins2 = xform4 c_th2_setbins2
+  setBins3 = xform6 c_th2_setbins3
+  setBinsLength = xform1 c_th2_setbinslength
+  setBuffer = xform2 c_th2_setbuffer
+  setCellContent = xform3 c_th2_setcellcontent
+  setContent = xform1 c_th2_setcontent
+  setContour = xform2 c_th2_setcontour
+  setContourLevel = xform2 c_th2_setcontourlevel
+  setDirectory = xform1 c_th2_setdirectory
+  setEntries = xform1 c_th2_setentries
+  setError = xform1 c_th2_seterror
+  setLabelColorA = xform2 c_th2_setlabelcolora
+  setLabelSizeA = xform2 c_th2_setlabelsizea
+  setLabelFontA = xform2 c_th2_setlabelfonta
+  setLabelOffsetA = xform2 c_th2_setlabeloffseta
+  setMaximum = xform1 c_th2_setmaximum
+  setMinimum = xform1 c_th2_setminimum
+  setNormFactor = xform1 c_th2_setnormfactor
+  setStats = xform1 c_th2_setstats
+  setOption = xform1 c_th2_setoption
+  setXTitle = xform1 c_th2_setxtitle
+  setYTitle = xform1 c_th2_setytitle
+  setZTitle = xform1 c_th2_setztitle
+  showBackground = xform2 c_th2_showbackground
+  showPeaks = xform3 c_th2_showpeaks
+  smooth = xform2 c_th2_smooth
+  sumw2 = xform0 c_th2_sumw2
+instance ITObject TH2 where
+  draw = xform1 c_th2_draw
+  findObject = xform1 c_th2_findobject
+  getName = xform0 c_th2_getname
+  isA = xform0 c_th2_isa
+  paint = xform1 c_th2_paint
+  printObj = xform1 c_th2_printobj
+  saveAs = xform2 c_th2_saveas
+  write = xform3 c_th2_write
+instance ITAttLine TH2 where
+  getLineColor = xform0 c_th2_getlinecolor
+  getLineStyle = xform0 c_th2_getlinestyle
+  getLineWidth = xform0 c_th2_getlinewidth
+  resetAttLine = xform1 c_th2_resetattline
+  setLineAttributes = xform0 c_th2_setlineattributes
+  setLineColor = xform1 c_th2_setlinecolor
+  setLineStyle = xform1 c_th2_setlinestyle
+  setLineWidth = xform1 c_th2_setlinewidth
+instance ITAttFill TH2 where
+  setFillColor = xform1 c_th2_setfillcolor
+  setFillStyle = xform1 c_th2_setfillstyle
+instance ITAttMarker TH2 where
+  getMarkerColor = xform0 c_th2_getmarkercolor
+  getMarkerStyle = xform0 c_th2_getmarkerstyle
+  getMarkerSize = xform0 c_th2_getmarkersize
+  resetAttMarker = xform1 c_th2_resetattmarker
+  setMarkerAttributes = xform0 c_th2_setmarkerattributes
+  setMarkerColor = xform1 c_th2_setmarkercolor
+  setMarkerStyle = xform1 c_th2_setmarkerstyle
+  setMarkerSize = xform1 c_th2_setmarkersize
+instance IDeletable TH2 where
+  delete = xform0 c_th2_delete
+
+instance ITH2 (Exist TH2) where
+  fill2 (ETH2 x) = fill2 x
+  fill2w (ETH2 x) = fill2w x
+  fillN2 (ETH2 x) = fillN2 x
+  fillRandom2 (ETH2 x) = fillRandom2 x
+  findFirstBinAbove2 (ETH2 x) = findFirstBinAbove2 x
+  findLastBinAbove2 (ETH2 x) = findLastBinAbove2 x
+  fitSlicesX (ETH2 x) = fitSlicesX x
+  fitSlicesY (ETH2 x) = fitSlicesY x
+  getCorrelationFactor2 (ETH2 x) = getCorrelationFactor2 x
+  getCovariance2 (ETH2 x) = getCovariance2 x
+  integral2 (ETH2 x) = integral2 x
+  rebinX2 (ETH2 x) = rebinX2 x
+  rebinY2 (ETH2 x) = rebinY2 x
+  rebin2D (ETH2 x) = rebin2D x
+  setShowProjectionX (ETH2 x) = setShowProjectionX x
+  setShowProjectionY (ETH2 x) = setShowProjectionY x
+instance ITH1 (Exist TH2) where
+  add (ETH2 x) = add x
+  addBinContent (ETH2 x) = addBinContent x
+  chi2Test (ETH2 x) = chi2Test x
+  computeIntegral (ETH2 x) = computeIntegral x
+  directoryAutoAdd (ETH2 x) = directoryAutoAdd x
+  divide (ETH2 x) = divide x
+  drawCopyTH1 (ETH2 x) a1 = return . ETH2 =<< drawCopyTH1 x a1
+  drawNormalized (ETH2 x) = drawNormalized x
+  drawPanelTH1 (ETH2 x) = drawPanelTH1 x
+  bufferEmpty (ETH2 x) = bufferEmpty x
+  evalF (ETH2 x) = evalF x
+  fFT (ETH2 x) = fFT x
+  fill1 (ETH2 x) = fill1 x
+  fill1w (ETH2 x) = fill1w x
+  fillN1 (ETH2 x) = fillN1 x
+  fillRandom (ETH2 x) = fillRandom x
+  findBin (ETH2 x) = findBin x
+  findFixBin (ETH2 x) = findFixBin x
+  findFirstBinAbove (ETH2 x) = findFirstBinAbove x
+  findLastBinAbove (ETH2 x) = findLastBinAbove x
+  fitPanelTH1 (ETH2 x) = fitPanelTH1 x
+  getNdivisionA (ETH2 x) = getNdivisionA x
+  getAxisColorA (ETH2 x) = getAxisColorA x
+  getLabelColorA (ETH2 x) = getLabelColorA x
+  getLabelFontA (ETH2 x) = getLabelFontA x
+  getLabelOffsetA (ETH2 x) = getLabelOffsetA x
+  getLabelSizeA (ETH2 x) = getLabelSizeA x
+  getTitleFontA (ETH2 x) = getTitleFontA x
+  getTitleOffsetA (ETH2 x) = getTitleOffsetA x
+  getTitleSizeA (ETH2 x) = getTitleSizeA x
+  getTickLengthA (ETH2 x) = getTickLengthA x
+  getBarOffset (ETH2 x) = getBarOffset x
+  getBarWidth (ETH2 x) = getBarWidth x
+  getContour (ETH2 x) = getContour x
+  getContourLevel (ETH2 x) = getContourLevel x
+  getContourLevelPad (ETH2 x) = getContourLevelPad x
+  getBin (ETH2 x) = getBin x
+  getBinCenter (ETH2 x) = getBinCenter x
+  getBinContent1 (ETH2 x) = getBinContent1 x
+  getBinContent2 (ETH2 x) = getBinContent2 x
+  getBinContent3 (ETH2 x) = getBinContent3 x
+  getBinError1 (ETH2 x) = getBinError1 x
+  getBinError2 (ETH2 x) = getBinError2 x
+  getBinError3 (ETH2 x) = getBinError3 x
+  getBinLowEdge (ETH2 x) = getBinLowEdge x
+  getBinWidth (ETH2 x) = getBinWidth x
+  getCellContent (ETH2 x) = getCellContent x
+  getCellError (ETH2 x) = getCellError x
+  getEntries (ETH2 x) = getEntries x
+  getEffectiveEntries (ETH2 x) = getEffectiveEntries x
+  getFunction (ETH2 x) = getFunction x
+  getDimension (ETH2 x) = getDimension x
+  getKurtosis (ETH2 x) = getKurtosis x
+  getLowEdge (ETH2 x) = getLowEdge x
+  getMaximumTH1 (ETH2 x) = getMaximumTH1 x
+  getMaximumBin (ETH2 x) = getMaximumBin x
+  getMaximumStored (ETH2 x) = getMaximumStored x
+  getMinimumTH1 (ETH2 x) = getMinimumTH1 x
+  getMinimumBin (ETH2 x) = getMinimumBin x
+  getMinimumStored (ETH2 x) = getMinimumStored x
+  getMean (ETH2 x) = getMean x
+  getMeanError (ETH2 x) = getMeanError x
+  getNbinsX (ETH2 x) = getNbinsX x
+  getNbinsY (ETH2 x) = getNbinsY x
+  getNbinsZ (ETH2 x) = getNbinsZ x
+  getQuantilesTH1 (ETH2 x) = getQuantilesTH1 x
+  getRandom (ETH2 x) = getRandom x
+  getStats (ETH2 x) = getStats x
+  getSumOfWeights (ETH2 x) = getSumOfWeights x
+  getSumw2 (ETH2 x) = getSumw2 x
+  getSumw2N (ETH2 x) = getSumw2N x
+  getRMS (ETH2 x) = getRMS x
+  getRMSError (ETH2 x) = getRMSError x
+  getSkewness (ETH2 x) = getSkewness x
+  integral1 (ETH2 x) = integral1 x
+  interpolate1 (ETH2 x) = interpolate1 x
+  interpolate2 (ETH2 x) = interpolate2 x
+  interpolate3 (ETH2 x) = interpolate3 x
+  kolmogorovTest (ETH2 x) = kolmogorovTest x
+  labelsDeflate (ETH2 x) = labelsDeflate x
+  labelsInflate (ETH2 x) = labelsInflate x
+  labelsOption (ETH2 x) = labelsOption x
+  multiflyF (ETH2 x) = multiflyF x
+  multiply (ETH2 x) = multiply x
+  putStats (ETH2 x) = putStats x
+  rebin (ETH2 x) = rebin x
+  rebinAxis (ETH2 x) = rebinAxis x
+  rebuild (ETH2 x) = rebuild x
+  recursiveRemove (ETH2 x) = recursiveRemove x
+  reset (ETH2 x) = reset x
+  resetStats (ETH2 x) = resetStats x
+  scale (ETH2 x) = scale x
+  setAxisColorA (ETH2 x) = setAxisColorA x
+  setAxisRange (ETH2 x) = setAxisRange x
+  setBarOffset (ETH2 x) = setBarOffset x
+  setBarWidth (ETH2 x) = setBarWidth x
+  setBinContent1 (ETH2 x) = setBinContent1 x
+  setBinContent2 (ETH2 x) = setBinContent2 x
+  setBinContent3 (ETH2 x) = setBinContent3 x
+  setBinError1 (ETH2 x) = setBinError1 x
+  setBinError2 (ETH2 x) = setBinError2 x
+  setBinError3 (ETH2 x) = setBinError3 x
+  setBins1 (ETH2 x) = setBins1 x
+  setBins2 (ETH2 x) = setBins2 x
+  setBins3 (ETH2 x) = setBins3 x
+  setBinsLength (ETH2 x) = setBinsLength x
+  setBuffer (ETH2 x) = setBuffer x
+  setCellContent (ETH2 x) = setCellContent x
+  setContent (ETH2 x) = setContent x
+  setContour (ETH2 x) = setContour x
+  setContourLevel (ETH2 x) = setContourLevel x
+  setDirectory (ETH2 x) = setDirectory x
+  setEntries (ETH2 x) = setEntries x
+  setError (ETH2 x) = setError x
+  setLabelColorA (ETH2 x) = setLabelColorA x
+  setLabelSizeA (ETH2 x) = setLabelSizeA x
+  setLabelFontA (ETH2 x) = setLabelFontA x
+  setLabelOffsetA (ETH2 x) = setLabelOffsetA x
+  setMaximum (ETH2 x) = setMaximum x
+  setMinimum (ETH2 x) = setMinimum x
+  setNormFactor (ETH2 x) = setNormFactor x
+  setStats (ETH2 x) = setStats x
+  setOption (ETH2 x) = setOption x
+  setXTitle (ETH2 x) = setXTitle x
+  setYTitle (ETH2 x) = setYTitle x
+  setZTitle (ETH2 x) = setZTitle x
+  showBackground (ETH2 x) = showBackground x
+  showPeaks (ETH2 x) = showPeaks x
+  smooth (ETH2 x) = smooth x
+  sumw2 (ETH2 x) = sumw2 x
+instance ITObject (Exist TH2) where
+  draw (ETH2 x) = draw x
+  findObject (ETH2 x) = findObject x
+  getName (ETH2 x) = getName x
+  isA (ETH2 x) = isA x
+  paint (ETH2 x) = paint x
+  printObj (ETH2 x) = printObj x
+  saveAs (ETH2 x) = saveAs x
+  write (ETH2 x) = write x
+instance ITAttLine (Exist TH2) where
+  getLineColor (ETH2 x) = getLineColor x
+  getLineStyle (ETH2 x) = getLineStyle x
+  getLineWidth (ETH2 x) = getLineWidth x
+  resetAttLine (ETH2 x) = resetAttLine x
+  setLineAttributes (ETH2 x) = setLineAttributes x
+  setLineColor (ETH2 x) = setLineColor x
+  setLineStyle (ETH2 x) = setLineStyle x
+  setLineWidth (ETH2 x) = setLineWidth x
+instance ITAttFill (Exist TH2) where
+  setFillColor (ETH2 x) = setFillColor x
+  setFillStyle (ETH2 x) = setFillStyle x
+instance ITAttMarker (Exist TH2) where
+  getMarkerColor (ETH2 x) = getMarkerColor x
+  getMarkerStyle (ETH2 x) = getMarkerStyle x
+  getMarkerSize (ETH2 x) = getMarkerSize x
+  resetAttMarker (ETH2 x) = resetAttMarker x
+  setMarkerAttributes (ETH2 x) = setMarkerAttributes x
+  setMarkerColor (ETH2 x) = setMarkerColor x
+  setMarkerStyle (ETH2 x) = setMarkerStyle x
+  setMarkerSize (ETH2 x) = setMarkerSize x
+instance IDeletable (Exist TH2) where
+  delete (ETH2 x) = delete x
+
+
+
+tH2ProjectionX :: TH2 -> CString -> CInt -> CInt -> CString -> IO TH1D
+tH2ProjectionX = xform4 c_th2_th2projectionx
+
+tH2ProjectionY :: TH2 -> CString -> CInt -> CInt -> CString -> IO TH1D
+tH2ProjectionY = xform4 c_th2_th2projectiony
+
+
+
+instance FPtr (Exist TH2) where
+  type Raw (Exist TH2) = RawTH2
+  get_fptr (ETH2 obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH2 (cast_fptr_to_obj (fptr :: ForeignPtr RawTH2) :: TH2)
diff --git a/src/HROOT/Hist/TH2/Interface.hs b/src/HROOT/Hist/TH2/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2/Interface.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH2.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH2.RawType
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TObjArray.Interface
+---- ============ ----
+import {-# SOURCE #-} HROOT.Hist.TF1.Interface
+
+
+class (ITH1 a) => ITH2 a where
+    -- | 
+    --   > Int_t    Fill(Double_t x, Double_t y);
+
+    fill2 :: a -> CDouble -> CDouble -> IO CInt 
+
+    fill2w :: a -> CDouble -> CDouble -> CDouble -> IO CInt 
+
+    fillN2 :: a -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO () 
+    -- | 
+    --   > void     FillRandom(TH1 *h, Int_t ntimes=5000);
+    --   
+
+    fillRandom2 :: (ITH1 c0, FPtr c0) => a -> c0 -> CInt -> IO () 
+    -- | 
+    --   > Int_t    FindFirstBinAbove(Double_t threshold=0, Int_t axis=1) const;
+    --   
+
+    findFirstBinAbove2 :: a -> CDouble -> CInt -> IO CInt 
+    -- | 
+    --   > Int_t    FindLastBinAbove (Double_t threshold=0, Int_t axis=1) const;
+    --   
+
+    findLastBinAbove2 :: a -> CDouble -> CInt -> IO CInt 
+    -- | 
+    --   > void     FitSlicesX(TF1 *f1=0,Int_t firstybin=0, Int_t lastybin=-1, Int_t cut=0, Option_t *option="QNR", TObjArray* arr = 0); // *MENU*
+    --   
+
+    fitSlicesX :: (ITObjArray c1, FPtr c1, ITF1 c0, FPtr c0) => a -> c0 -> CInt -> CInt -> CInt -> CString -> c1 -> IO () 
+    -- | 
+    --   > void     FitSlicesY(TF1 *f1=0,Int_t firstxbin=0, Int_t lastxbin=-1, Int_t cut=0, Option_t *option="QNR", TObjArray* arr = 0); // *MENU*
+    --   
+
+    fitSlicesY :: (ITObjArray c1, FPtr c1, ITF1 c0, FPtr c0) => a -> c0 -> CInt -> CInt -> CInt -> CString -> c1 -> IO () 
+
+    getCorrelationFactor2 :: a -> CInt -> CInt -> IO CDouble 
+
+    getCovariance2 :: a -> CInt -> CInt -> IO CDouble 
+
+    integral2 :: a -> CInt -> CInt -> CInt -> CInt -> CString -> IO CDouble 
+
+    rebinX2 :: a -> CInt -> CString -> IO TH2 
+
+    rebinY2 :: a -> CInt -> CString -> IO TH2 
+    -- | 
+    --   > TH2     *Rebin2D(Int_t nxgroup=2, Int_t nygroup=2, const char *newname="");     
+    --   
+
+    rebin2D :: a -> CInt -> CInt -> CString -> IO TH2 
+    -- | 
+    --   > void     SetShowProjectionX(Int_t nbins);  // *MENU*
+    --   
+
+    setShowProjectionX :: a -> CInt -> IO () 
+    -- | 
+    --   > void     SetShowProjectionY(Int_t nbins);  // *MENU*
+    --   
+
+    setShowProjectionY :: a -> CInt -> IO () 
+
+instance Existable TH2 where
+  data Exist TH2 = forall a. (FPtr a, ITH2 a) => ETH2 a
+
+upcastTH2 :: (FPtr a, ITH2 a) => a -> TH2
+upcastTH2 h = let fh = get_fptr h
+                  fh2 :: ForeignPtr RawTH2 = castForeignPtr fh
+              in cast_fptr_to_obj fh2
+
+downcastTH2 :: (FPtr a, ITH2 a) => TH2 -> a 
+downcastTH2 h = let fh = get_fptr h
+                    fh2 = castForeignPtr fh
+                in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH2/RawType.hs b/src/HROOT/Hist/TH2/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH2.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH2
+newtype TH2 = TH2 (ForeignPtr RawTH2) deriving (Eq, Ord, Show)
+instance FPtr TH2 where
+   type Raw TH2 = RawTH2
+   get_fptr (TH2 fptr) = fptr
+   cast_fptr_to_obj = TH2
diff --git a/src/HROOT/Hist/TH2C.hs b/src/HROOT/Hist/TH2C.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2C.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TH2C
+  (
+    TH2C(..)
+  , ITH2C
+  , upcastTH2C
+  , downcastTH2C
+
+ 
+  ) where
+
+import HROOT.Hist.TH2C.RawType
+import HROOT.Hist.TH2C.Interface
+import HROOT.Hist.TH2C.Implementation
+
+
diff --git a/src/HROOT/Hist/TH2C/Cast.hs b/src/HROOT/Hist/TH2C/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2C/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH2C.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH2C.RawType
+import HROOT.Hist.TH2C.Interface
+
+instance (ITH2C a, FPtr a) => Castable a (Ptr RawTH2C) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH2C (Ptr RawTH2C) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH2C/FFI.hsc b/src/HROOT/Hist/TH2C/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2C/FFI.hsc
@@ -0,0 +1,547 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH2C.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH2C.RawType
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH2.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TObjArray.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTH2C.h"
+
+foreign import ccall "HROOTHistTH2C.h TH2C_fill2" c_th2c_fill2 
+  :: (Ptr RawTH2C) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_fill2w" c_th2c_fill2w 
+  :: (Ptr RawTH2C) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_fillN2" c_th2c_filln2 
+  :: (Ptr RawTH2C) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_fillRandom2" c_th2c_fillrandom2 
+  :: (Ptr RawTH2C) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_findFirstBinAbove2" c_th2c_findfirstbinabove2 
+  :: (Ptr RawTH2C) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_findLastBinAbove2" c_th2c_findlastbinabove2 
+  :: (Ptr RawTH2C) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_FitSlicesX" c_th2c_fitslicesx 
+  :: (Ptr RawTH2C) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CString -> (Ptr RawTObjArray) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_FitSlicesY" c_th2c_fitslicesy 
+  :: (Ptr RawTH2C) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CString -> (Ptr RawTObjArray) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_getCorrelationFactor2" c_th2c_getcorrelationfactor2 
+  :: (Ptr RawTH2C) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_getCovariance2" c_th2c_getcovariance2 
+  :: (Ptr RawTH2C) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_integral2" c_th2c_integral2 
+  :: (Ptr RawTH2C) -> CInt -> CInt -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_rebinX2" c_th2c_rebinx2 
+  :: (Ptr RawTH2C) -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2C.h TH2C_rebinY2" c_th2c_rebiny2 
+  :: (Ptr RawTH2C) -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2C.h TH2C_Rebin2D" c_th2c_rebin2d 
+  :: (Ptr RawTH2C) -> CInt -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetShowProjectionX" c_th2c_setshowprojectionx 
+  :: (Ptr RawTH2C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetShowProjectionY" c_th2c_setshowprojectiony 
+  :: (Ptr RawTH2C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_Add" c_th2c_add 
+  :: (Ptr RawTH2C) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_AddBinContent" c_th2c_addbincontent 
+  :: (Ptr RawTH2C) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_Chi2Test" c_th2c_chi2test 
+  :: (Ptr RawTH2C) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_ComputeIntegral" c_th2c_computeintegral 
+  :: (Ptr RawTH2C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_DirectoryAutoAdd" c_th2c_directoryautoadd 
+  :: (Ptr RawTH2C) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_Divide" c_th2c_divide 
+  :: (Ptr RawTH2C) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_drawCopyTH1" c_th2c_drawcopyth1 
+  :: (Ptr RawTH2C) -> CString -> IO (Ptr RawTH2C)
+
+foreign import ccall "HROOTHistTH2C.h TH2C_DrawNormalized" c_th2c_drawnormalized 
+  :: (Ptr RawTH2C) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2C.h TH2C_drawPanelTH1" c_th2c_drawpanelth1 
+  :: (Ptr RawTH2C) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_BufferEmpty" c_th2c_bufferempty 
+  :: (Ptr RawTH2C) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_evalF" c_th2c_evalf 
+  :: (Ptr RawTH2C) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_FFT" c_th2c_fft 
+  :: (Ptr RawTH2C) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2C.h TH2C_fill1" c_th2c_fill1 
+  :: (Ptr RawTH2C) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_fill1w" c_th2c_fill1w 
+  :: (Ptr RawTH2C) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_fillN1" c_th2c_filln1 
+  :: (Ptr RawTH2C) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_FillRandom" c_th2c_fillrandom 
+  :: (Ptr RawTH2C) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_FindBin" c_th2c_findbin 
+  :: (Ptr RawTH2C) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_FindFixBin" c_th2c_findfixbin 
+  :: (Ptr RawTH2C) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_FindFirstBinAbove" c_th2c_findfirstbinabove 
+  :: (Ptr RawTH2C) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_FindLastBinAbove" c_th2c_findlastbinabove 
+  :: (Ptr RawTH2C) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_FitPanelTH1" c_th2c_fitpanelth1 
+  :: (Ptr RawTH2C) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_getNdivisionA" c_th2c_getndivisiona 
+  :: (Ptr RawTH2C) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_getAxisColorA" c_th2c_getaxiscolora 
+  :: (Ptr RawTH2C) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_getLabelColorA" c_th2c_getlabelcolora 
+  :: (Ptr RawTH2C) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_getLabelFontA" c_th2c_getlabelfonta 
+  :: (Ptr RawTH2C) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_getLabelOffsetA" c_th2c_getlabeloffseta 
+  :: (Ptr RawTH2C) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_getLabelSizeA" c_th2c_getlabelsizea 
+  :: (Ptr RawTH2C) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_getTitleFontA" c_th2c_gettitlefonta 
+  :: (Ptr RawTH2C) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_getTitleOffsetA" c_th2c_gettitleoffseta 
+  :: (Ptr RawTH2C) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_getTitleSizeA" c_th2c_gettitlesizea 
+  :: (Ptr RawTH2C) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_getTickLengthA" c_th2c_getticklengtha 
+  :: (Ptr RawTH2C) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetBarOffset" c_th2c_getbaroffset 
+  :: (Ptr RawTH2C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetBarWidth" c_th2c_getbarwidth 
+  :: (Ptr RawTH2C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetContour" c_th2c_getcontour 
+  :: (Ptr RawTH2C) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetContourLevel" c_th2c_getcontourlevel 
+  :: (Ptr RawTH2C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetContourLevelPad" c_th2c_getcontourlevelpad 
+  :: (Ptr RawTH2C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetBin" c_th2c_getbin 
+  :: (Ptr RawTH2C) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetBinCenter" c_th2c_getbincenter 
+  :: (Ptr RawTH2C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetBinContent1" c_th2c_getbincontent1 
+  :: (Ptr RawTH2C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetBinContent2" c_th2c_getbincontent2 
+  :: (Ptr RawTH2C) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetBinContent3" c_th2c_getbincontent3 
+  :: (Ptr RawTH2C) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetBinError1" c_th2c_getbinerror1 
+  :: (Ptr RawTH2C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetBinError2" c_th2c_getbinerror2 
+  :: (Ptr RawTH2C) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetBinError3" c_th2c_getbinerror3 
+  :: (Ptr RawTH2C) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetBinLowEdge" c_th2c_getbinlowedge 
+  :: (Ptr RawTH2C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetBinWidth" c_th2c_getbinwidth 
+  :: (Ptr RawTH2C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetCellContent" c_th2c_getcellcontent 
+  :: (Ptr RawTH2C) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetCellError" c_th2c_getcellerror 
+  :: (Ptr RawTH2C) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetEntries" c_th2c_getentries 
+  :: (Ptr RawTH2C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetEffectiveEntries" c_th2c_geteffectiveentries 
+  :: (Ptr RawTH2C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetFunction" c_th2c_getfunction 
+  :: (Ptr RawTH2C) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetDimension" c_th2c_getdimension 
+  :: (Ptr RawTH2C) -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetKurtosis" c_th2c_getkurtosis 
+  :: (Ptr RawTH2C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetLowEdge" c_th2c_getlowedge 
+  :: (Ptr RawTH2C) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_getMaximumTH1" c_th2c_getmaximumth1 
+  :: (Ptr RawTH2C) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetMaximumBin" c_th2c_getmaximumbin 
+  :: (Ptr RawTH2C) -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetMaximumStored" c_th2c_getmaximumstored 
+  :: (Ptr RawTH2C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_getMinimumTH1" c_th2c_getminimumth1 
+  :: (Ptr RawTH2C) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetMinimumBin" c_th2c_getminimumbin 
+  :: (Ptr RawTH2C) -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetMinimumStored" c_th2c_getminimumstored 
+  :: (Ptr RawTH2C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetMean" c_th2c_getmean 
+  :: (Ptr RawTH2C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetMeanError" c_th2c_getmeanerror 
+  :: (Ptr RawTH2C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetNbinsX" c_th2c_getnbinsx 
+  :: (Ptr RawTH2C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetNbinsY" c_th2c_getnbinsy 
+  :: (Ptr RawTH2C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetNbinsZ" c_th2c_getnbinsz 
+  :: (Ptr RawTH2C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_getQuantilesTH1" c_th2c_getquantilesth1 
+  :: (Ptr RawTH2C) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetRandom" c_th2c_getrandom 
+  :: (Ptr RawTH2C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetStats" c_th2c_getstats 
+  :: (Ptr RawTH2C) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetSumOfWeights" c_th2c_getsumofweights 
+  :: (Ptr RawTH2C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetSumw2" c_th2c_getsumw2 
+  :: (Ptr RawTH2C) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetSumw2N" c_th2c_getsumw2n 
+  :: (Ptr RawTH2C) -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetRMS" c_th2c_getrms 
+  :: (Ptr RawTH2C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetRMSError" c_th2c_getrmserror 
+  :: (Ptr RawTH2C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetSkewness" c_th2c_getskewness 
+  :: (Ptr RawTH2C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_integral1" c_th2c_integral1 
+  :: (Ptr RawTH2C) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_interpolate1" c_th2c_interpolate1 
+  :: (Ptr RawTH2C) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_interpolate2" c_th2c_interpolate2 
+  :: (Ptr RawTH2C) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_interpolate3" c_th2c_interpolate3 
+  :: (Ptr RawTH2C) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_KolmogorovTest" c_th2c_kolmogorovtest 
+  :: (Ptr RawTH2C) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_LabelsDeflate" c_th2c_labelsdeflate 
+  :: (Ptr RawTH2C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_LabelsInflate" c_th2c_labelsinflate 
+  :: (Ptr RawTH2C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_LabelsOption" c_th2c_labelsoption 
+  :: (Ptr RawTH2C) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_multiflyF" c_th2c_multiflyf 
+  :: (Ptr RawTH2C) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_Multiply" c_th2c_multiply 
+  :: (Ptr RawTH2C) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_PutStats" c_th2c_putstats 
+  :: (Ptr RawTH2C) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_Rebin" c_th2c_rebin 
+  :: (Ptr RawTH2C) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2C.h TH2C_RebinAxis" c_th2c_rebinaxis 
+  :: (Ptr RawTH2C) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_Rebuild" c_th2c_rebuild 
+  :: (Ptr RawTH2C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_RecursiveRemove" c_th2c_recursiveremove 
+  :: (Ptr RawTH2C) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_Reset" c_th2c_reset 
+  :: (Ptr RawTH2C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_ResetStats" c_th2c_resetstats 
+  :: (Ptr RawTH2C) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_Scale" c_th2c_scale 
+  :: (Ptr RawTH2C) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_setAxisColorA" c_th2c_setaxiscolora 
+  :: (Ptr RawTH2C) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetAxisRange" c_th2c_setaxisrange 
+  :: (Ptr RawTH2C) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetBarOffset" c_th2c_setbaroffset 
+  :: (Ptr RawTH2C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetBarWidth" c_th2c_setbarwidth 
+  :: (Ptr RawTH2C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_setBinContent1" c_th2c_setbincontent1 
+  :: (Ptr RawTH2C) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_setBinContent2" c_th2c_setbincontent2 
+  :: (Ptr RawTH2C) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_setBinContent3" c_th2c_setbincontent3 
+  :: (Ptr RawTH2C) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_setBinError1" c_th2c_setbinerror1 
+  :: (Ptr RawTH2C) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_setBinError2" c_th2c_setbinerror2 
+  :: (Ptr RawTH2C) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_setBinError3" c_th2c_setbinerror3 
+  :: (Ptr RawTH2C) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_setBins1" c_th2c_setbins1 
+  :: (Ptr RawTH2C) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_setBins2" c_th2c_setbins2 
+  :: (Ptr RawTH2C) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_setBins3" c_th2c_setbins3 
+  :: (Ptr RawTH2C) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetBinsLength" c_th2c_setbinslength 
+  :: (Ptr RawTH2C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetBuffer" c_th2c_setbuffer 
+  :: (Ptr RawTH2C) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetCellContent" c_th2c_setcellcontent 
+  :: (Ptr RawTH2C) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetContent" c_th2c_setcontent 
+  :: (Ptr RawTH2C) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetContour" c_th2c_setcontour 
+  :: (Ptr RawTH2C) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetContourLevel" c_th2c_setcontourlevel 
+  :: (Ptr RawTH2C) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetDirectory" c_th2c_setdirectory 
+  :: (Ptr RawTH2C) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetEntries" c_th2c_setentries 
+  :: (Ptr RawTH2C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetError" c_th2c_seterror 
+  :: (Ptr RawTH2C) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_setLabelColorA" c_th2c_setlabelcolora 
+  :: (Ptr RawTH2C) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_setLabelSizeA" c_th2c_setlabelsizea 
+  :: (Ptr RawTH2C) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_setLabelFontA" c_th2c_setlabelfonta 
+  :: (Ptr RawTH2C) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_setLabelOffsetA" c_th2c_setlabeloffseta 
+  :: (Ptr RawTH2C) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetMaximum" c_th2c_setmaximum 
+  :: (Ptr RawTH2C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetMinimum" c_th2c_setminimum 
+  :: (Ptr RawTH2C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetNormFactor" c_th2c_setnormfactor 
+  :: (Ptr RawTH2C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetStats" c_th2c_setstats 
+  :: (Ptr RawTH2C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetOption" c_th2c_setoption 
+  :: (Ptr RawTH2C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetXTitle" c_th2c_setxtitle 
+  :: (Ptr RawTH2C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetYTitle" c_th2c_setytitle 
+  :: (Ptr RawTH2C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetZTitle" c_th2c_setztitle 
+  :: (Ptr RawTH2C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_ShowBackground" c_th2c_showbackground 
+  :: (Ptr RawTH2C) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2C.h TH2C_ShowPeaks" c_th2c_showpeaks 
+  :: (Ptr RawTH2C) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_Smooth" c_th2c_smooth 
+  :: (Ptr RawTH2C) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_Sumw2" c_th2c_sumw2 
+  :: (Ptr RawTH2C) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_Draw" c_th2c_draw 
+  :: (Ptr RawTH2C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_FindObject" c_th2c_findobject 
+  :: (Ptr RawTH2C) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetName" c_th2c_getname 
+  :: (Ptr RawTH2C) -> IO CString
+
+foreign import ccall "HROOTHistTH2C.h TH2C_IsA" c_th2c_isa 
+  :: (Ptr RawTH2C) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH2C.h TH2C_Paint" c_th2c_paint 
+  :: (Ptr RawTH2C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_printObj" c_th2c_printobj 
+  :: (Ptr RawTH2C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SaveAs" c_th2c_saveas 
+  :: (Ptr RawTH2C) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_Write" c_th2c_write 
+  :: (Ptr RawTH2C) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetLineColor" c_th2c_getlinecolor 
+  :: (Ptr RawTH2C) -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetLineStyle" c_th2c_getlinestyle 
+  :: (Ptr RawTH2C) -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetLineWidth" c_th2c_getlinewidth 
+  :: (Ptr RawTH2C) -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_ResetAttLine" c_th2c_resetattline 
+  :: (Ptr RawTH2C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetLineAttributes" c_th2c_setlineattributes 
+  :: (Ptr RawTH2C) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetLineColor" c_th2c_setlinecolor 
+  :: (Ptr RawTH2C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetLineStyle" c_th2c_setlinestyle 
+  :: (Ptr RawTH2C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetLineWidth" c_th2c_setlinewidth 
+  :: (Ptr RawTH2C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetFillColor" c_th2c_setfillcolor 
+  :: (Ptr RawTH2C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetFillStyle" c_th2c_setfillstyle 
+  :: (Ptr RawTH2C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetMarkerColor" c_th2c_getmarkercolor 
+  :: (Ptr RawTH2C) -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetMarkerStyle" c_th2c_getmarkerstyle 
+  :: (Ptr RawTH2C) -> IO CInt
+
+foreign import ccall "HROOTHistTH2C.h TH2C_GetMarkerSize" c_th2c_getmarkersize 
+  :: (Ptr RawTH2C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2C.h TH2C_ResetAttMarker" c_th2c_resetattmarker 
+  :: (Ptr RawTH2C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetMarkerAttributes" c_th2c_setmarkerattributes 
+  :: (Ptr RawTH2C) -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetMarkerColor" c_th2c_setmarkercolor 
+  :: (Ptr RawTH2C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetMarkerStyle" c_th2c_setmarkerstyle 
+  :: (Ptr RawTH2C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_SetMarkerSize" c_th2c_setmarkersize 
+  :: (Ptr RawTH2C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2C.h TH2C_delete" c_th2c_delete 
+  :: (Ptr RawTH2C) -> IO ()
+
diff --git a/src/HROOT/Hist/TH2C/Implementation.hs b/src/HROOT/Hist/TH2C/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2C/Implementation.hs
@@ -0,0 +1,451 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH2C.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH2C.RawType
+import HROOT.Hist.TH2C.FFI
+import HROOT.Hist.TH2C.Interface
+import HROOT.Hist.TH2C.Cast
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1D.Cast
+import HROOT.Hist.TH1D.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TObjArray.RawType
+import HROOT.Core.TObjArray.Cast
+import HROOT.Core.TObjArray.Interface
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH2.RawType
+import HROOT.Hist.TH2.Cast
+import HROOT.Hist.TH2.Interface
+import HROOT.Core.TArrayC.RawType
+import HROOT.Core.TArrayC.Cast
+import HROOT.Core.TArrayC.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+import HROOT.Core.TArray.RawType
+import HROOT.Core.TArray.Cast
+import HROOT.Core.TArray.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH2C TH2C where
+instance ITH2 TH2C where
+  fill2 = xform2 c_th2c_fill2
+  fill2w = xform3 c_th2c_fill2w
+  fillN2 = xform5 c_th2c_filln2
+  fillRandom2 = xform2 c_th2c_fillrandom2
+  findFirstBinAbove2 = xform2 c_th2c_findfirstbinabove2
+  findLastBinAbove2 = xform2 c_th2c_findlastbinabove2
+  fitSlicesX = xform6 c_th2c_fitslicesx
+  fitSlicesY = xform6 c_th2c_fitslicesy
+  getCorrelationFactor2 = xform2 c_th2c_getcorrelationfactor2
+  getCovariance2 = xform2 c_th2c_getcovariance2
+  integral2 = xform5 c_th2c_integral2
+  rebinX2 = xform2 c_th2c_rebinx2
+  rebinY2 = xform2 c_th2c_rebiny2
+  rebin2D = xform3 c_th2c_rebin2d
+  setShowProjectionX = xform1 c_th2c_setshowprojectionx
+  setShowProjectionY = xform1 c_th2c_setshowprojectiony
+instance ITArrayC TH2C where
+instance ITH1 TH2C where
+  add = xform2 c_th2c_add
+  addBinContent = xform2 c_th2c_addbincontent
+  chi2Test = xform3 c_th2c_chi2test
+  computeIntegral = xform0 c_th2c_computeintegral
+  directoryAutoAdd = xform1 c_th2c_directoryautoadd
+  divide = xform5 c_th2c_divide
+  drawCopyTH1 = xform1 c_th2c_drawcopyth1
+  drawNormalized = xform2 c_th2c_drawnormalized
+  drawPanelTH1 = xform0 c_th2c_drawpanelth1
+  bufferEmpty = xform1 c_th2c_bufferempty
+  evalF = xform2 c_th2c_evalf
+  fFT = xform2 c_th2c_fft
+  fill1 = xform1 c_th2c_fill1
+  fill1w = xform2 c_th2c_fill1w
+  fillN1 = xform4 c_th2c_filln1
+  fillRandom = xform2 c_th2c_fillrandom
+  findBin = xform3 c_th2c_findbin
+  findFixBin = xform3 c_th2c_findfixbin
+  findFirstBinAbove = xform2 c_th2c_findfirstbinabove
+  findLastBinAbove = xform2 c_th2c_findlastbinabove
+  fitPanelTH1 = xform0 c_th2c_fitpanelth1
+  getNdivisionA = xform1 c_th2c_getndivisiona
+  getAxisColorA = xform1 c_th2c_getaxiscolora
+  getLabelColorA = xform1 c_th2c_getlabelcolora
+  getLabelFontA = xform1 c_th2c_getlabelfonta
+  getLabelOffsetA = xform1 c_th2c_getlabeloffseta
+  getLabelSizeA = xform1 c_th2c_getlabelsizea
+  getTitleFontA = xform1 c_th2c_gettitlefonta
+  getTitleOffsetA = xform1 c_th2c_gettitleoffseta
+  getTitleSizeA = xform1 c_th2c_gettitlesizea
+  getTickLengthA = xform1 c_th2c_getticklengtha
+  getBarOffset = xform0 c_th2c_getbaroffset
+  getBarWidth = xform0 c_th2c_getbarwidth
+  getContour = xform1 c_th2c_getcontour
+  getContourLevel = xform1 c_th2c_getcontourlevel
+  getContourLevelPad = xform1 c_th2c_getcontourlevelpad
+  getBin = xform3 c_th2c_getbin
+  getBinCenter = xform1 c_th2c_getbincenter
+  getBinContent1 = xform1 c_th2c_getbincontent1
+  getBinContent2 = xform2 c_th2c_getbincontent2
+  getBinContent3 = xform3 c_th2c_getbincontent3
+  getBinError1 = xform1 c_th2c_getbinerror1
+  getBinError2 = xform2 c_th2c_getbinerror2
+  getBinError3 = xform3 c_th2c_getbinerror3
+  getBinLowEdge = xform1 c_th2c_getbinlowedge
+  getBinWidth = xform1 c_th2c_getbinwidth
+  getCellContent = xform2 c_th2c_getcellcontent
+  getCellError = xform2 c_th2c_getcellerror
+  getEntries = xform0 c_th2c_getentries
+  getEffectiveEntries = xform0 c_th2c_geteffectiveentries
+  getFunction = xform1 c_th2c_getfunction
+  getDimension = xform0 c_th2c_getdimension
+  getKurtosis = xform1 c_th2c_getkurtosis
+  getLowEdge = xform1 c_th2c_getlowedge
+  getMaximumTH1 = xform1 c_th2c_getmaximumth1
+  getMaximumBin = xform0 c_th2c_getmaximumbin
+  getMaximumStored = xform0 c_th2c_getmaximumstored
+  getMinimumTH1 = xform1 c_th2c_getminimumth1
+  getMinimumBin = xform0 c_th2c_getminimumbin
+  getMinimumStored = xform0 c_th2c_getminimumstored
+  getMean = xform1 c_th2c_getmean
+  getMeanError = xform1 c_th2c_getmeanerror
+  getNbinsX = xform0 c_th2c_getnbinsx
+  getNbinsY = xform0 c_th2c_getnbinsy
+  getNbinsZ = xform0 c_th2c_getnbinsz
+  getQuantilesTH1 = xform3 c_th2c_getquantilesth1
+  getRandom = xform0 c_th2c_getrandom
+  getStats = xform1 c_th2c_getstats
+  getSumOfWeights = xform0 c_th2c_getsumofweights
+  getSumw2 = xform0 c_th2c_getsumw2
+  getSumw2N = xform0 c_th2c_getsumw2n
+  getRMS = xform1 c_th2c_getrms
+  getRMSError = xform1 c_th2c_getrmserror
+  getSkewness = xform1 c_th2c_getskewness
+  integral1 = xform3 c_th2c_integral1
+  interpolate1 = xform1 c_th2c_interpolate1
+  interpolate2 = xform2 c_th2c_interpolate2
+  interpolate3 = xform3 c_th2c_interpolate3
+  kolmogorovTest = xform2 c_th2c_kolmogorovtest
+  labelsDeflate = xform1 c_th2c_labelsdeflate
+  labelsInflate = xform1 c_th2c_labelsinflate
+  labelsOption = xform2 c_th2c_labelsoption
+  multiflyF = xform2 c_th2c_multiflyf
+  multiply = xform5 c_th2c_multiply
+  putStats = xform1 c_th2c_putstats
+  rebin = xform3 c_th2c_rebin
+  rebinAxis = xform2 c_th2c_rebinaxis
+  rebuild = xform1 c_th2c_rebuild
+  recursiveRemove = xform1 c_th2c_recursiveremove
+  reset = xform1 c_th2c_reset
+  resetStats = xform0 c_th2c_resetstats
+  scale = xform2 c_th2c_scale
+  setAxisColorA = xform2 c_th2c_setaxiscolora
+  setAxisRange = xform3 c_th2c_setaxisrange
+  setBarOffset = xform1 c_th2c_setbaroffset
+  setBarWidth = xform1 c_th2c_setbarwidth
+  setBinContent1 = xform2 c_th2c_setbincontent1
+  setBinContent2 = xform3 c_th2c_setbincontent2
+  setBinContent3 = xform4 c_th2c_setbincontent3
+  setBinError1 = xform2 c_th2c_setbinerror1
+  setBinError2 = xform3 c_th2c_setbinerror2
+  setBinError3 = xform4 c_th2c_setbinerror3
+  setBins1 = xform2 c_th2c_setbins1
+  setBins2 = xform4 c_th2c_setbins2
+  setBins3 = xform6 c_th2c_setbins3
+  setBinsLength = xform1 c_th2c_setbinslength
+  setBuffer = xform2 c_th2c_setbuffer
+  setCellContent = xform3 c_th2c_setcellcontent
+  setContent = xform1 c_th2c_setcontent
+  setContour = xform2 c_th2c_setcontour
+  setContourLevel = xform2 c_th2c_setcontourlevel
+  setDirectory = xform1 c_th2c_setdirectory
+  setEntries = xform1 c_th2c_setentries
+  setError = xform1 c_th2c_seterror
+  setLabelColorA = xform2 c_th2c_setlabelcolora
+  setLabelSizeA = xform2 c_th2c_setlabelsizea
+  setLabelFontA = xform2 c_th2c_setlabelfonta
+  setLabelOffsetA = xform2 c_th2c_setlabeloffseta
+  setMaximum = xform1 c_th2c_setmaximum
+  setMinimum = xform1 c_th2c_setminimum
+  setNormFactor = xform1 c_th2c_setnormfactor
+  setStats = xform1 c_th2c_setstats
+  setOption = xform1 c_th2c_setoption
+  setXTitle = xform1 c_th2c_setxtitle
+  setYTitle = xform1 c_th2c_setytitle
+  setZTitle = xform1 c_th2c_setztitle
+  showBackground = xform2 c_th2c_showbackground
+  showPeaks = xform3 c_th2c_showpeaks
+  smooth = xform2 c_th2c_smooth
+  sumw2 = xform0 c_th2c_sumw2
+instance ITObject TH2C where
+  draw = xform1 c_th2c_draw
+  findObject = xform1 c_th2c_findobject
+  getName = xform0 c_th2c_getname
+  isA = xform0 c_th2c_isa
+  paint = xform1 c_th2c_paint
+  printObj = xform1 c_th2c_printobj
+  saveAs = xform2 c_th2c_saveas
+  write = xform3 c_th2c_write
+instance ITAttLine TH2C where
+  getLineColor = xform0 c_th2c_getlinecolor
+  getLineStyle = xform0 c_th2c_getlinestyle
+  getLineWidth = xform0 c_th2c_getlinewidth
+  resetAttLine = xform1 c_th2c_resetattline
+  setLineAttributes = xform0 c_th2c_setlineattributes
+  setLineColor = xform1 c_th2c_setlinecolor
+  setLineStyle = xform1 c_th2c_setlinestyle
+  setLineWidth = xform1 c_th2c_setlinewidth
+instance ITAttFill TH2C where
+  setFillColor = xform1 c_th2c_setfillcolor
+  setFillStyle = xform1 c_th2c_setfillstyle
+instance ITAttMarker TH2C where
+  getMarkerColor = xform0 c_th2c_getmarkercolor
+  getMarkerStyle = xform0 c_th2c_getmarkerstyle
+  getMarkerSize = xform0 c_th2c_getmarkersize
+  resetAttMarker = xform1 c_th2c_resetattmarker
+  setMarkerAttributes = xform0 c_th2c_setmarkerattributes
+  setMarkerColor = xform1 c_th2c_setmarkercolor
+  setMarkerStyle = xform1 c_th2c_setmarkerstyle
+  setMarkerSize = xform1 c_th2c_setmarkersize
+instance IDeletable TH2C where
+  delete = xform0 c_th2c_delete
+instance ITArray TH2C where
+
+instance ITH2C (Exist TH2C) where
+
+instance ITH2 (Exist TH2C) where
+  fill2 (ETH2C x) = fill2 x
+  fill2w (ETH2C x) = fill2w x
+  fillN2 (ETH2C x) = fillN2 x
+  fillRandom2 (ETH2C x) = fillRandom2 x
+  findFirstBinAbove2 (ETH2C x) = findFirstBinAbove2 x
+  findLastBinAbove2 (ETH2C x) = findLastBinAbove2 x
+  fitSlicesX (ETH2C x) = fitSlicesX x
+  fitSlicesY (ETH2C x) = fitSlicesY x
+  getCorrelationFactor2 (ETH2C x) = getCorrelationFactor2 x
+  getCovariance2 (ETH2C x) = getCovariance2 x
+  integral2 (ETH2C x) = integral2 x
+  rebinX2 (ETH2C x) = rebinX2 x
+  rebinY2 (ETH2C x) = rebinY2 x
+  rebin2D (ETH2C x) = rebin2D x
+  setShowProjectionX (ETH2C x) = setShowProjectionX x
+  setShowProjectionY (ETH2C x) = setShowProjectionY x
+instance ITArrayC (Exist TH2C) where
+
+instance ITH1 (Exist TH2C) where
+  add (ETH2C x) = add x
+  addBinContent (ETH2C x) = addBinContent x
+  chi2Test (ETH2C x) = chi2Test x
+  computeIntegral (ETH2C x) = computeIntegral x
+  directoryAutoAdd (ETH2C x) = directoryAutoAdd x
+  divide (ETH2C x) = divide x
+  drawCopyTH1 (ETH2C x) a1 = return . ETH2C =<< drawCopyTH1 x a1
+  drawNormalized (ETH2C x) = drawNormalized x
+  drawPanelTH1 (ETH2C x) = drawPanelTH1 x
+  bufferEmpty (ETH2C x) = bufferEmpty x
+  evalF (ETH2C x) = evalF x
+  fFT (ETH2C x) = fFT x
+  fill1 (ETH2C x) = fill1 x
+  fill1w (ETH2C x) = fill1w x
+  fillN1 (ETH2C x) = fillN1 x
+  fillRandom (ETH2C x) = fillRandom x
+  findBin (ETH2C x) = findBin x
+  findFixBin (ETH2C x) = findFixBin x
+  findFirstBinAbove (ETH2C x) = findFirstBinAbove x
+  findLastBinAbove (ETH2C x) = findLastBinAbove x
+  fitPanelTH1 (ETH2C x) = fitPanelTH1 x
+  getNdivisionA (ETH2C x) = getNdivisionA x
+  getAxisColorA (ETH2C x) = getAxisColorA x
+  getLabelColorA (ETH2C x) = getLabelColorA x
+  getLabelFontA (ETH2C x) = getLabelFontA x
+  getLabelOffsetA (ETH2C x) = getLabelOffsetA x
+  getLabelSizeA (ETH2C x) = getLabelSizeA x
+  getTitleFontA (ETH2C x) = getTitleFontA x
+  getTitleOffsetA (ETH2C x) = getTitleOffsetA x
+  getTitleSizeA (ETH2C x) = getTitleSizeA x
+  getTickLengthA (ETH2C x) = getTickLengthA x
+  getBarOffset (ETH2C x) = getBarOffset x
+  getBarWidth (ETH2C x) = getBarWidth x
+  getContour (ETH2C x) = getContour x
+  getContourLevel (ETH2C x) = getContourLevel x
+  getContourLevelPad (ETH2C x) = getContourLevelPad x
+  getBin (ETH2C x) = getBin x
+  getBinCenter (ETH2C x) = getBinCenter x
+  getBinContent1 (ETH2C x) = getBinContent1 x
+  getBinContent2 (ETH2C x) = getBinContent2 x
+  getBinContent3 (ETH2C x) = getBinContent3 x
+  getBinError1 (ETH2C x) = getBinError1 x
+  getBinError2 (ETH2C x) = getBinError2 x
+  getBinError3 (ETH2C x) = getBinError3 x
+  getBinLowEdge (ETH2C x) = getBinLowEdge x
+  getBinWidth (ETH2C x) = getBinWidth x
+  getCellContent (ETH2C x) = getCellContent x
+  getCellError (ETH2C x) = getCellError x
+  getEntries (ETH2C x) = getEntries x
+  getEffectiveEntries (ETH2C x) = getEffectiveEntries x
+  getFunction (ETH2C x) = getFunction x
+  getDimension (ETH2C x) = getDimension x
+  getKurtosis (ETH2C x) = getKurtosis x
+  getLowEdge (ETH2C x) = getLowEdge x
+  getMaximumTH1 (ETH2C x) = getMaximumTH1 x
+  getMaximumBin (ETH2C x) = getMaximumBin x
+  getMaximumStored (ETH2C x) = getMaximumStored x
+  getMinimumTH1 (ETH2C x) = getMinimumTH1 x
+  getMinimumBin (ETH2C x) = getMinimumBin x
+  getMinimumStored (ETH2C x) = getMinimumStored x
+  getMean (ETH2C x) = getMean x
+  getMeanError (ETH2C x) = getMeanError x
+  getNbinsX (ETH2C x) = getNbinsX x
+  getNbinsY (ETH2C x) = getNbinsY x
+  getNbinsZ (ETH2C x) = getNbinsZ x
+  getQuantilesTH1 (ETH2C x) = getQuantilesTH1 x
+  getRandom (ETH2C x) = getRandom x
+  getStats (ETH2C x) = getStats x
+  getSumOfWeights (ETH2C x) = getSumOfWeights x
+  getSumw2 (ETH2C x) = getSumw2 x
+  getSumw2N (ETH2C x) = getSumw2N x
+  getRMS (ETH2C x) = getRMS x
+  getRMSError (ETH2C x) = getRMSError x
+  getSkewness (ETH2C x) = getSkewness x
+  integral1 (ETH2C x) = integral1 x
+  interpolate1 (ETH2C x) = interpolate1 x
+  interpolate2 (ETH2C x) = interpolate2 x
+  interpolate3 (ETH2C x) = interpolate3 x
+  kolmogorovTest (ETH2C x) = kolmogorovTest x
+  labelsDeflate (ETH2C x) = labelsDeflate x
+  labelsInflate (ETH2C x) = labelsInflate x
+  labelsOption (ETH2C x) = labelsOption x
+  multiflyF (ETH2C x) = multiflyF x
+  multiply (ETH2C x) = multiply x
+  putStats (ETH2C x) = putStats x
+  rebin (ETH2C x) = rebin x
+  rebinAxis (ETH2C x) = rebinAxis x
+  rebuild (ETH2C x) = rebuild x
+  recursiveRemove (ETH2C x) = recursiveRemove x
+  reset (ETH2C x) = reset x
+  resetStats (ETH2C x) = resetStats x
+  scale (ETH2C x) = scale x
+  setAxisColorA (ETH2C x) = setAxisColorA x
+  setAxisRange (ETH2C x) = setAxisRange x
+  setBarOffset (ETH2C x) = setBarOffset x
+  setBarWidth (ETH2C x) = setBarWidth x
+  setBinContent1 (ETH2C x) = setBinContent1 x
+  setBinContent2 (ETH2C x) = setBinContent2 x
+  setBinContent3 (ETH2C x) = setBinContent3 x
+  setBinError1 (ETH2C x) = setBinError1 x
+  setBinError2 (ETH2C x) = setBinError2 x
+  setBinError3 (ETH2C x) = setBinError3 x
+  setBins1 (ETH2C x) = setBins1 x
+  setBins2 (ETH2C x) = setBins2 x
+  setBins3 (ETH2C x) = setBins3 x
+  setBinsLength (ETH2C x) = setBinsLength x
+  setBuffer (ETH2C x) = setBuffer x
+  setCellContent (ETH2C x) = setCellContent x
+  setContent (ETH2C x) = setContent x
+  setContour (ETH2C x) = setContour x
+  setContourLevel (ETH2C x) = setContourLevel x
+  setDirectory (ETH2C x) = setDirectory x
+  setEntries (ETH2C x) = setEntries x
+  setError (ETH2C x) = setError x
+  setLabelColorA (ETH2C x) = setLabelColorA x
+  setLabelSizeA (ETH2C x) = setLabelSizeA x
+  setLabelFontA (ETH2C x) = setLabelFontA x
+  setLabelOffsetA (ETH2C x) = setLabelOffsetA x
+  setMaximum (ETH2C x) = setMaximum x
+  setMinimum (ETH2C x) = setMinimum x
+  setNormFactor (ETH2C x) = setNormFactor x
+  setStats (ETH2C x) = setStats x
+  setOption (ETH2C x) = setOption x
+  setXTitle (ETH2C x) = setXTitle x
+  setYTitle (ETH2C x) = setYTitle x
+  setZTitle (ETH2C x) = setZTitle x
+  showBackground (ETH2C x) = showBackground x
+  showPeaks (ETH2C x) = showPeaks x
+  smooth (ETH2C x) = smooth x
+  sumw2 (ETH2C x) = sumw2 x
+instance ITObject (Exist TH2C) where
+  draw (ETH2C x) = draw x
+  findObject (ETH2C x) = findObject x
+  getName (ETH2C x) = getName x
+  isA (ETH2C x) = isA x
+  paint (ETH2C x) = paint x
+  printObj (ETH2C x) = printObj x
+  saveAs (ETH2C x) = saveAs x
+  write (ETH2C x) = write x
+instance ITAttLine (Exist TH2C) where
+  getLineColor (ETH2C x) = getLineColor x
+  getLineStyle (ETH2C x) = getLineStyle x
+  getLineWidth (ETH2C x) = getLineWidth x
+  resetAttLine (ETH2C x) = resetAttLine x
+  setLineAttributes (ETH2C x) = setLineAttributes x
+  setLineColor (ETH2C x) = setLineColor x
+  setLineStyle (ETH2C x) = setLineStyle x
+  setLineWidth (ETH2C x) = setLineWidth x
+instance ITAttFill (Exist TH2C) where
+  setFillColor (ETH2C x) = setFillColor x
+  setFillStyle (ETH2C x) = setFillStyle x
+instance ITAttMarker (Exist TH2C) where
+  getMarkerColor (ETH2C x) = getMarkerColor x
+  getMarkerStyle (ETH2C x) = getMarkerStyle x
+  getMarkerSize (ETH2C x) = getMarkerSize x
+  resetAttMarker (ETH2C x) = resetAttMarker x
+  setMarkerAttributes (ETH2C x) = setMarkerAttributes x
+  setMarkerColor (ETH2C x) = setMarkerColor x
+  setMarkerStyle (ETH2C x) = setMarkerStyle x
+  setMarkerSize (ETH2C x) = setMarkerSize x
+instance IDeletable (Exist TH2C) where
+  delete (ETH2C x) = delete x
+instance ITArray (Exist TH2C) where
+
+
+
+
+
+
+
+
+instance FPtr (Exist TH2C) where
+  type Raw (Exist TH2C) = RawTH2C
+  get_fptr (ETH2C obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH2C (cast_fptr_to_obj (fptr :: ForeignPtr RawTH2C) :: TH2C)
diff --git a/src/HROOT/Hist/TH2C/Interface.hs b/src/HROOT/Hist/TH2C/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2C/Interface.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH2C.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH2C.RawType
+
+import HROOT.Hist.TH2.Interface
+import HROOT.Core.TArrayC.Interface
+---- ============ ----
+
+
+
+class (ITH2 a,ITArrayC a) => ITH2C a where
+
+instance Existable TH2C where
+  data Exist TH2C = forall a. (FPtr a, ITH2C a) => ETH2C a
+
+upcastTH2C :: (FPtr a, ITH2C a) => a -> TH2C
+upcastTH2C h = let fh = get_fptr h
+                   fh2 :: ForeignPtr RawTH2C = castForeignPtr fh
+               in cast_fptr_to_obj fh2
+
+downcastTH2C :: (FPtr a, ITH2C a) => TH2C -> a 
+downcastTH2C h = let fh = get_fptr h
+                     fh2 = castForeignPtr fh
+                 in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH2C/RawType.hs b/src/HROOT/Hist/TH2C/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2C/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH2C.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH2C
+newtype TH2C = TH2C (ForeignPtr RawTH2C) deriving (Eq, Ord, Show)
+instance FPtr TH2C where
+   type Raw TH2C = RawTH2C
+   get_fptr (TH2C fptr) = fptr
+   cast_fptr_to_obj = TH2C
diff --git a/src/HROOT/Hist/TH2D.hs b/src/HROOT/Hist/TH2D.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2D.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TH2D
+  (
+    TH2D(..)
+  , ITH2D
+  , upcastTH2D
+  , downcastTH2D
+  , newTH2D
+ 
+  ) where
+
+import HROOT.Hist.TH2D.RawType
+import HROOT.Hist.TH2D.Interface
+import HROOT.Hist.TH2D.Implementation
+
+
diff --git a/src/HROOT/Hist/TH2D/Cast.hs b/src/HROOT/Hist/TH2D/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2D/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH2D.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH2D.RawType
+import HROOT.Hist.TH2D.Interface
+
+instance (ITH2D a, FPtr a) => Castable a (Ptr RawTH2D) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH2D (Ptr RawTH2D) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH2D/FFI.hsc b/src/HROOT/Hist/TH2D/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2D/FFI.hsc
@@ -0,0 +1,550 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH2D.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH2D.RawType
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH2.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TObjArray.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTH2D.h"
+
+foreign import ccall "HROOTHistTH2D.h TH2D_fill2" c_th2d_fill2 
+  :: (Ptr RawTH2D) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_fill2w" c_th2d_fill2w 
+  :: (Ptr RawTH2D) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_fillN2" c_th2d_filln2 
+  :: (Ptr RawTH2D) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_fillRandom2" c_th2d_fillrandom2 
+  :: (Ptr RawTH2D) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_findFirstBinAbove2" c_th2d_findfirstbinabove2 
+  :: (Ptr RawTH2D) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_findLastBinAbove2" c_th2d_findlastbinabove2 
+  :: (Ptr RawTH2D) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_FitSlicesX" c_th2d_fitslicesx 
+  :: (Ptr RawTH2D) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CString -> (Ptr RawTObjArray) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_FitSlicesY" c_th2d_fitslicesy 
+  :: (Ptr RawTH2D) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CString -> (Ptr RawTObjArray) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_getCorrelationFactor2" c_th2d_getcorrelationfactor2 
+  :: (Ptr RawTH2D) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_getCovariance2" c_th2d_getcovariance2 
+  :: (Ptr RawTH2D) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_integral2" c_th2d_integral2 
+  :: (Ptr RawTH2D) -> CInt -> CInt -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_rebinX2" c_th2d_rebinx2 
+  :: (Ptr RawTH2D) -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2D.h TH2D_rebinY2" c_th2d_rebiny2 
+  :: (Ptr RawTH2D) -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2D.h TH2D_Rebin2D" c_th2d_rebin2d 
+  :: (Ptr RawTH2D) -> CInt -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetShowProjectionX" c_th2d_setshowprojectionx 
+  :: (Ptr RawTH2D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetShowProjectionY" c_th2d_setshowprojectiony 
+  :: (Ptr RawTH2D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_Add" c_th2d_add 
+  :: (Ptr RawTH2D) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_AddBinContent" c_th2d_addbincontent 
+  :: (Ptr RawTH2D) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_Chi2Test" c_th2d_chi2test 
+  :: (Ptr RawTH2D) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_ComputeIntegral" c_th2d_computeintegral 
+  :: (Ptr RawTH2D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_DirectoryAutoAdd" c_th2d_directoryautoadd 
+  :: (Ptr RawTH2D) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_Divide" c_th2d_divide 
+  :: (Ptr RawTH2D) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_drawCopyTH1" c_th2d_drawcopyth1 
+  :: (Ptr RawTH2D) -> CString -> IO (Ptr RawTH2D)
+
+foreign import ccall "HROOTHistTH2D.h TH2D_DrawNormalized" c_th2d_drawnormalized 
+  :: (Ptr RawTH2D) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2D.h TH2D_drawPanelTH1" c_th2d_drawpanelth1 
+  :: (Ptr RawTH2D) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_BufferEmpty" c_th2d_bufferempty 
+  :: (Ptr RawTH2D) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_evalF" c_th2d_evalf 
+  :: (Ptr RawTH2D) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_FFT" c_th2d_fft 
+  :: (Ptr RawTH2D) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2D.h TH2D_fill1" c_th2d_fill1 
+  :: (Ptr RawTH2D) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_fill1w" c_th2d_fill1w 
+  :: (Ptr RawTH2D) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_fillN1" c_th2d_filln1 
+  :: (Ptr RawTH2D) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_FillRandom" c_th2d_fillrandom 
+  :: (Ptr RawTH2D) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_FindBin" c_th2d_findbin 
+  :: (Ptr RawTH2D) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_FindFixBin" c_th2d_findfixbin 
+  :: (Ptr RawTH2D) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_FindFirstBinAbove" c_th2d_findfirstbinabove 
+  :: (Ptr RawTH2D) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_FindLastBinAbove" c_th2d_findlastbinabove 
+  :: (Ptr RawTH2D) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_FitPanelTH1" c_th2d_fitpanelth1 
+  :: (Ptr RawTH2D) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_getNdivisionA" c_th2d_getndivisiona 
+  :: (Ptr RawTH2D) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_getAxisColorA" c_th2d_getaxiscolora 
+  :: (Ptr RawTH2D) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_getLabelColorA" c_th2d_getlabelcolora 
+  :: (Ptr RawTH2D) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_getLabelFontA" c_th2d_getlabelfonta 
+  :: (Ptr RawTH2D) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_getLabelOffsetA" c_th2d_getlabeloffseta 
+  :: (Ptr RawTH2D) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_getLabelSizeA" c_th2d_getlabelsizea 
+  :: (Ptr RawTH2D) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_getTitleFontA" c_th2d_gettitlefonta 
+  :: (Ptr RawTH2D) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_getTitleOffsetA" c_th2d_gettitleoffseta 
+  :: (Ptr RawTH2D) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_getTitleSizeA" c_th2d_gettitlesizea 
+  :: (Ptr RawTH2D) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_getTickLengthA" c_th2d_getticklengtha 
+  :: (Ptr RawTH2D) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetBarOffset" c_th2d_getbaroffset 
+  :: (Ptr RawTH2D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetBarWidth" c_th2d_getbarwidth 
+  :: (Ptr RawTH2D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetContour" c_th2d_getcontour 
+  :: (Ptr RawTH2D) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetContourLevel" c_th2d_getcontourlevel 
+  :: (Ptr RawTH2D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetContourLevelPad" c_th2d_getcontourlevelpad 
+  :: (Ptr RawTH2D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetBin" c_th2d_getbin 
+  :: (Ptr RawTH2D) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetBinCenter" c_th2d_getbincenter 
+  :: (Ptr RawTH2D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetBinContent1" c_th2d_getbincontent1 
+  :: (Ptr RawTH2D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetBinContent2" c_th2d_getbincontent2 
+  :: (Ptr RawTH2D) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetBinContent3" c_th2d_getbincontent3 
+  :: (Ptr RawTH2D) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetBinError1" c_th2d_getbinerror1 
+  :: (Ptr RawTH2D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetBinError2" c_th2d_getbinerror2 
+  :: (Ptr RawTH2D) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetBinError3" c_th2d_getbinerror3 
+  :: (Ptr RawTH2D) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetBinLowEdge" c_th2d_getbinlowedge 
+  :: (Ptr RawTH2D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetBinWidth" c_th2d_getbinwidth 
+  :: (Ptr RawTH2D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetCellContent" c_th2d_getcellcontent 
+  :: (Ptr RawTH2D) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetCellError" c_th2d_getcellerror 
+  :: (Ptr RawTH2D) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetEntries" c_th2d_getentries 
+  :: (Ptr RawTH2D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetEffectiveEntries" c_th2d_geteffectiveentries 
+  :: (Ptr RawTH2D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetFunction" c_th2d_getfunction 
+  :: (Ptr RawTH2D) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetDimension" c_th2d_getdimension 
+  :: (Ptr RawTH2D) -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetKurtosis" c_th2d_getkurtosis 
+  :: (Ptr RawTH2D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetLowEdge" c_th2d_getlowedge 
+  :: (Ptr RawTH2D) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_getMaximumTH1" c_th2d_getmaximumth1 
+  :: (Ptr RawTH2D) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetMaximumBin" c_th2d_getmaximumbin 
+  :: (Ptr RawTH2D) -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetMaximumStored" c_th2d_getmaximumstored 
+  :: (Ptr RawTH2D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_getMinimumTH1" c_th2d_getminimumth1 
+  :: (Ptr RawTH2D) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetMinimumBin" c_th2d_getminimumbin 
+  :: (Ptr RawTH2D) -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetMinimumStored" c_th2d_getminimumstored 
+  :: (Ptr RawTH2D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetMean" c_th2d_getmean 
+  :: (Ptr RawTH2D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetMeanError" c_th2d_getmeanerror 
+  :: (Ptr RawTH2D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetNbinsX" c_th2d_getnbinsx 
+  :: (Ptr RawTH2D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetNbinsY" c_th2d_getnbinsy 
+  :: (Ptr RawTH2D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetNbinsZ" c_th2d_getnbinsz 
+  :: (Ptr RawTH2D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_getQuantilesTH1" c_th2d_getquantilesth1 
+  :: (Ptr RawTH2D) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetRandom" c_th2d_getrandom 
+  :: (Ptr RawTH2D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetStats" c_th2d_getstats 
+  :: (Ptr RawTH2D) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetSumOfWeights" c_th2d_getsumofweights 
+  :: (Ptr RawTH2D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetSumw2" c_th2d_getsumw2 
+  :: (Ptr RawTH2D) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetSumw2N" c_th2d_getsumw2n 
+  :: (Ptr RawTH2D) -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetRMS" c_th2d_getrms 
+  :: (Ptr RawTH2D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetRMSError" c_th2d_getrmserror 
+  :: (Ptr RawTH2D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetSkewness" c_th2d_getskewness 
+  :: (Ptr RawTH2D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_integral1" c_th2d_integral1 
+  :: (Ptr RawTH2D) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_interpolate1" c_th2d_interpolate1 
+  :: (Ptr RawTH2D) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_interpolate2" c_th2d_interpolate2 
+  :: (Ptr RawTH2D) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_interpolate3" c_th2d_interpolate3 
+  :: (Ptr RawTH2D) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_KolmogorovTest" c_th2d_kolmogorovtest 
+  :: (Ptr RawTH2D) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_LabelsDeflate" c_th2d_labelsdeflate 
+  :: (Ptr RawTH2D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_LabelsInflate" c_th2d_labelsinflate 
+  :: (Ptr RawTH2D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_LabelsOption" c_th2d_labelsoption 
+  :: (Ptr RawTH2D) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_multiflyF" c_th2d_multiflyf 
+  :: (Ptr RawTH2D) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_Multiply" c_th2d_multiply 
+  :: (Ptr RawTH2D) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_PutStats" c_th2d_putstats 
+  :: (Ptr RawTH2D) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_Rebin" c_th2d_rebin 
+  :: (Ptr RawTH2D) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2D.h TH2D_RebinAxis" c_th2d_rebinaxis 
+  :: (Ptr RawTH2D) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_Rebuild" c_th2d_rebuild 
+  :: (Ptr RawTH2D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_RecursiveRemove" c_th2d_recursiveremove 
+  :: (Ptr RawTH2D) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_Reset" c_th2d_reset 
+  :: (Ptr RawTH2D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_ResetStats" c_th2d_resetstats 
+  :: (Ptr RawTH2D) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_Scale" c_th2d_scale 
+  :: (Ptr RawTH2D) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_setAxisColorA" c_th2d_setaxiscolora 
+  :: (Ptr RawTH2D) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetAxisRange" c_th2d_setaxisrange 
+  :: (Ptr RawTH2D) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetBarOffset" c_th2d_setbaroffset 
+  :: (Ptr RawTH2D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetBarWidth" c_th2d_setbarwidth 
+  :: (Ptr RawTH2D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_setBinContent1" c_th2d_setbincontent1 
+  :: (Ptr RawTH2D) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_setBinContent2" c_th2d_setbincontent2 
+  :: (Ptr RawTH2D) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_setBinContent3" c_th2d_setbincontent3 
+  :: (Ptr RawTH2D) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_setBinError1" c_th2d_setbinerror1 
+  :: (Ptr RawTH2D) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_setBinError2" c_th2d_setbinerror2 
+  :: (Ptr RawTH2D) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_setBinError3" c_th2d_setbinerror3 
+  :: (Ptr RawTH2D) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_setBins1" c_th2d_setbins1 
+  :: (Ptr RawTH2D) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_setBins2" c_th2d_setbins2 
+  :: (Ptr RawTH2D) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_setBins3" c_th2d_setbins3 
+  :: (Ptr RawTH2D) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetBinsLength" c_th2d_setbinslength 
+  :: (Ptr RawTH2D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetBuffer" c_th2d_setbuffer 
+  :: (Ptr RawTH2D) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetCellContent" c_th2d_setcellcontent 
+  :: (Ptr RawTH2D) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetContent" c_th2d_setcontent 
+  :: (Ptr RawTH2D) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetContour" c_th2d_setcontour 
+  :: (Ptr RawTH2D) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetContourLevel" c_th2d_setcontourlevel 
+  :: (Ptr RawTH2D) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetDirectory" c_th2d_setdirectory 
+  :: (Ptr RawTH2D) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetEntries" c_th2d_setentries 
+  :: (Ptr RawTH2D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetError" c_th2d_seterror 
+  :: (Ptr RawTH2D) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_setLabelColorA" c_th2d_setlabelcolora 
+  :: (Ptr RawTH2D) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_setLabelSizeA" c_th2d_setlabelsizea 
+  :: (Ptr RawTH2D) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_setLabelFontA" c_th2d_setlabelfonta 
+  :: (Ptr RawTH2D) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_setLabelOffsetA" c_th2d_setlabeloffseta 
+  :: (Ptr RawTH2D) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetMaximum" c_th2d_setmaximum 
+  :: (Ptr RawTH2D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetMinimum" c_th2d_setminimum 
+  :: (Ptr RawTH2D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetNormFactor" c_th2d_setnormfactor 
+  :: (Ptr RawTH2D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetStats" c_th2d_setstats 
+  :: (Ptr RawTH2D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetOption" c_th2d_setoption 
+  :: (Ptr RawTH2D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetXTitle" c_th2d_setxtitle 
+  :: (Ptr RawTH2D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetYTitle" c_th2d_setytitle 
+  :: (Ptr RawTH2D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetZTitle" c_th2d_setztitle 
+  :: (Ptr RawTH2D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_ShowBackground" c_th2d_showbackground 
+  :: (Ptr RawTH2D) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2D.h TH2D_ShowPeaks" c_th2d_showpeaks 
+  :: (Ptr RawTH2D) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_Smooth" c_th2d_smooth 
+  :: (Ptr RawTH2D) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_Sumw2" c_th2d_sumw2 
+  :: (Ptr RawTH2D) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_Draw" c_th2d_draw 
+  :: (Ptr RawTH2D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_FindObject" c_th2d_findobject 
+  :: (Ptr RawTH2D) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetName" c_th2d_getname 
+  :: (Ptr RawTH2D) -> IO CString
+
+foreign import ccall "HROOTHistTH2D.h TH2D_IsA" c_th2d_isa 
+  :: (Ptr RawTH2D) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH2D.h TH2D_Paint" c_th2d_paint 
+  :: (Ptr RawTH2D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_printObj" c_th2d_printobj 
+  :: (Ptr RawTH2D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SaveAs" c_th2d_saveas 
+  :: (Ptr RawTH2D) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_Write" c_th2d_write 
+  :: (Ptr RawTH2D) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetLineColor" c_th2d_getlinecolor 
+  :: (Ptr RawTH2D) -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetLineStyle" c_th2d_getlinestyle 
+  :: (Ptr RawTH2D) -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetLineWidth" c_th2d_getlinewidth 
+  :: (Ptr RawTH2D) -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_ResetAttLine" c_th2d_resetattline 
+  :: (Ptr RawTH2D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetLineAttributes" c_th2d_setlineattributes 
+  :: (Ptr RawTH2D) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetLineColor" c_th2d_setlinecolor 
+  :: (Ptr RawTH2D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetLineStyle" c_th2d_setlinestyle 
+  :: (Ptr RawTH2D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetLineWidth" c_th2d_setlinewidth 
+  :: (Ptr RawTH2D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetFillColor" c_th2d_setfillcolor 
+  :: (Ptr RawTH2D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetFillStyle" c_th2d_setfillstyle 
+  :: (Ptr RawTH2D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetMarkerColor" c_th2d_getmarkercolor 
+  :: (Ptr RawTH2D) -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetMarkerStyle" c_th2d_getmarkerstyle 
+  :: (Ptr RawTH2D) -> IO CInt
+
+foreign import ccall "HROOTHistTH2D.h TH2D_GetMarkerSize" c_th2d_getmarkersize 
+  :: (Ptr RawTH2D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2D.h TH2D_ResetAttMarker" c_th2d_resetattmarker 
+  :: (Ptr RawTH2D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetMarkerAttributes" c_th2d_setmarkerattributes 
+  :: (Ptr RawTH2D) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetMarkerColor" c_th2d_setmarkercolor 
+  :: (Ptr RawTH2D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetMarkerStyle" c_th2d_setmarkerstyle 
+  :: (Ptr RawTH2D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_SetMarkerSize" c_th2d_setmarkersize 
+  :: (Ptr RawTH2D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_delete" c_th2d_delete 
+  :: (Ptr RawTH2D) -> IO ()
+
+foreign import ccall "HROOTHistTH2D.h TH2D_newTH2D" c_th2d_newth2d 
+  :: CString -> CString -> CInt -> CDouble -> CDouble -> CInt -> CDouble -> CDouble -> IO (Ptr RawTH2D)
+
diff --git a/src/HROOT/Hist/TH2D/Implementation.hs b/src/HROOT/Hist/TH2D/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2D/Implementation.hs
@@ -0,0 +1,450 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH2D.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH2D.RawType
+import HROOT.Hist.TH2D.FFI
+import HROOT.Hist.TH2D.Interface
+import HROOT.Hist.TH2D.Cast
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1D.Cast
+import HROOT.Hist.TH1D.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TObjArray.RawType
+import HROOT.Core.TObjArray.Cast
+import HROOT.Core.TObjArray.Interface
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH2.RawType
+import HROOT.Hist.TH2.Cast
+import HROOT.Hist.TH2.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+import HROOT.Core.TArray.RawType
+import HROOT.Core.TArray.Cast
+import HROOT.Core.TArray.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH2D TH2D where
+instance ITH2 TH2D where
+  fill2 = xform2 c_th2d_fill2
+  fill2w = xform3 c_th2d_fill2w
+  fillN2 = xform5 c_th2d_filln2
+  fillRandom2 = xform2 c_th2d_fillrandom2
+  findFirstBinAbove2 = xform2 c_th2d_findfirstbinabove2
+  findLastBinAbove2 = xform2 c_th2d_findlastbinabove2
+  fitSlicesX = xform6 c_th2d_fitslicesx
+  fitSlicesY = xform6 c_th2d_fitslicesy
+  getCorrelationFactor2 = xform2 c_th2d_getcorrelationfactor2
+  getCovariance2 = xform2 c_th2d_getcovariance2
+  integral2 = xform5 c_th2d_integral2
+  rebinX2 = xform2 c_th2d_rebinx2
+  rebinY2 = xform2 c_th2d_rebiny2
+  rebin2D = xform3 c_th2d_rebin2d
+  setShowProjectionX = xform1 c_th2d_setshowprojectionx
+  setShowProjectionY = xform1 c_th2d_setshowprojectiony
+instance ITArrayD TH2D where
+instance ITH1 TH2D where
+  add = xform2 c_th2d_add
+  addBinContent = xform2 c_th2d_addbincontent
+  chi2Test = xform3 c_th2d_chi2test
+  computeIntegral = xform0 c_th2d_computeintegral
+  directoryAutoAdd = xform1 c_th2d_directoryautoadd
+  divide = xform5 c_th2d_divide
+  drawCopyTH1 = xform1 c_th2d_drawcopyth1
+  drawNormalized = xform2 c_th2d_drawnormalized
+  drawPanelTH1 = xform0 c_th2d_drawpanelth1
+  bufferEmpty = xform1 c_th2d_bufferempty
+  evalF = xform2 c_th2d_evalf
+  fFT = xform2 c_th2d_fft
+  fill1 = xform1 c_th2d_fill1
+  fill1w = xform2 c_th2d_fill1w
+  fillN1 = xform4 c_th2d_filln1
+  fillRandom = xform2 c_th2d_fillrandom
+  findBin = xform3 c_th2d_findbin
+  findFixBin = xform3 c_th2d_findfixbin
+  findFirstBinAbove = xform2 c_th2d_findfirstbinabove
+  findLastBinAbove = xform2 c_th2d_findlastbinabove
+  fitPanelTH1 = xform0 c_th2d_fitpanelth1
+  getNdivisionA = xform1 c_th2d_getndivisiona
+  getAxisColorA = xform1 c_th2d_getaxiscolora
+  getLabelColorA = xform1 c_th2d_getlabelcolora
+  getLabelFontA = xform1 c_th2d_getlabelfonta
+  getLabelOffsetA = xform1 c_th2d_getlabeloffseta
+  getLabelSizeA = xform1 c_th2d_getlabelsizea
+  getTitleFontA = xform1 c_th2d_gettitlefonta
+  getTitleOffsetA = xform1 c_th2d_gettitleoffseta
+  getTitleSizeA = xform1 c_th2d_gettitlesizea
+  getTickLengthA = xform1 c_th2d_getticklengtha
+  getBarOffset = xform0 c_th2d_getbaroffset
+  getBarWidth = xform0 c_th2d_getbarwidth
+  getContour = xform1 c_th2d_getcontour
+  getContourLevel = xform1 c_th2d_getcontourlevel
+  getContourLevelPad = xform1 c_th2d_getcontourlevelpad
+  getBin = xform3 c_th2d_getbin
+  getBinCenter = xform1 c_th2d_getbincenter
+  getBinContent1 = xform1 c_th2d_getbincontent1
+  getBinContent2 = xform2 c_th2d_getbincontent2
+  getBinContent3 = xform3 c_th2d_getbincontent3
+  getBinError1 = xform1 c_th2d_getbinerror1
+  getBinError2 = xform2 c_th2d_getbinerror2
+  getBinError3 = xform3 c_th2d_getbinerror3
+  getBinLowEdge = xform1 c_th2d_getbinlowedge
+  getBinWidth = xform1 c_th2d_getbinwidth
+  getCellContent = xform2 c_th2d_getcellcontent
+  getCellError = xform2 c_th2d_getcellerror
+  getEntries = xform0 c_th2d_getentries
+  getEffectiveEntries = xform0 c_th2d_geteffectiveentries
+  getFunction = xform1 c_th2d_getfunction
+  getDimension = xform0 c_th2d_getdimension
+  getKurtosis = xform1 c_th2d_getkurtosis
+  getLowEdge = xform1 c_th2d_getlowedge
+  getMaximumTH1 = xform1 c_th2d_getmaximumth1
+  getMaximumBin = xform0 c_th2d_getmaximumbin
+  getMaximumStored = xform0 c_th2d_getmaximumstored
+  getMinimumTH1 = xform1 c_th2d_getminimumth1
+  getMinimumBin = xform0 c_th2d_getminimumbin
+  getMinimumStored = xform0 c_th2d_getminimumstored
+  getMean = xform1 c_th2d_getmean
+  getMeanError = xform1 c_th2d_getmeanerror
+  getNbinsX = xform0 c_th2d_getnbinsx
+  getNbinsY = xform0 c_th2d_getnbinsy
+  getNbinsZ = xform0 c_th2d_getnbinsz
+  getQuantilesTH1 = xform3 c_th2d_getquantilesth1
+  getRandom = xform0 c_th2d_getrandom
+  getStats = xform1 c_th2d_getstats
+  getSumOfWeights = xform0 c_th2d_getsumofweights
+  getSumw2 = xform0 c_th2d_getsumw2
+  getSumw2N = xform0 c_th2d_getsumw2n
+  getRMS = xform1 c_th2d_getrms
+  getRMSError = xform1 c_th2d_getrmserror
+  getSkewness = xform1 c_th2d_getskewness
+  integral1 = xform3 c_th2d_integral1
+  interpolate1 = xform1 c_th2d_interpolate1
+  interpolate2 = xform2 c_th2d_interpolate2
+  interpolate3 = xform3 c_th2d_interpolate3
+  kolmogorovTest = xform2 c_th2d_kolmogorovtest
+  labelsDeflate = xform1 c_th2d_labelsdeflate
+  labelsInflate = xform1 c_th2d_labelsinflate
+  labelsOption = xform2 c_th2d_labelsoption
+  multiflyF = xform2 c_th2d_multiflyf
+  multiply = xform5 c_th2d_multiply
+  putStats = xform1 c_th2d_putstats
+  rebin = xform3 c_th2d_rebin
+  rebinAxis = xform2 c_th2d_rebinaxis
+  rebuild = xform1 c_th2d_rebuild
+  recursiveRemove = xform1 c_th2d_recursiveremove
+  reset = xform1 c_th2d_reset
+  resetStats = xform0 c_th2d_resetstats
+  scale = xform2 c_th2d_scale
+  setAxisColorA = xform2 c_th2d_setaxiscolora
+  setAxisRange = xform3 c_th2d_setaxisrange
+  setBarOffset = xform1 c_th2d_setbaroffset
+  setBarWidth = xform1 c_th2d_setbarwidth
+  setBinContent1 = xform2 c_th2d_setbincontent1
+  setBinContent2 = xform3 c_th2d_setbincontent2
+  setBinContent3 = xform4 c_th2d_setbincontent3
+  setBinError1 = xform2 c_th2d_setbinerror1
+  setBinError2 = xform3 c_th2d_setbinerror2
+  setBinError3 = xform4 c_th2d_setbinerror3
+  setBins1 = xform2 c_th2d_setbins1
+  setBins2 = xform4 c_th2d_setbins2
+  setBins3 = xform6 c_th2d_setbins3
+  setBinsLength = xform1 c_th2d_setbinslength
+  setBuffer = xform2 c_th2d_setbuffer
+  setCellContent = xform3 c_th2d_setcellcontent
+  setContent = xform1 c_th2d_setcontent
+  setContour = xform2 c_th2d_setcontour
+  setContourLevel = xform2 c_th2d_setcontourlevel
+  setDirectory = xform1 c_th2d_setdirectory
+  setEntries = xform1 c_th2d_setentries
+  setError = xform1 c_th2d_seterror
+  setLabelColorA = xform2 c_th2d_setlabelcolora
+  setLabelSizeA = xform2 c_th2d_setlabelsizea
+  setLabelFontA = xform2 c_th2d_setlabelfonta
+  setLabelOffsetA = xform2 c_th2d_setlabeloffseta
+  setMaximum = xform1 c_th2d_setmaximum
+  setMinimum = xform1 c_th2d_setminimum
+  setNormFactor = xform1 c_th2d_setnormfactor
+  setStats = xform1 c_th2d_setstats
+  setOption = xform1 c_th2d_setoption
+  setXTitle = xform1 c_th2d_setxtitle
+  setYTitle = xform1 c_th2d_setytitle
+  setZTitle = xform1 c_th2d_setztitle
+  showBackground = xform2 c_th2d_showbackground
+  showPeaks = xform3 c_th2d_showpeaks
+  smooth = xform2 c_th2d_smooth
+  sumw2 = xform0 c_th2d_sumw2
+instance ITObject TH2D where
+  draw = xform1 c_th2d_draw
+  findObject = xform1 c_th2d_findobject
+  getName = xform0 c_th2d_getname
+  isA = xform0 c_th2d_isa
+  paint = xform1 c_th2d_paint
+  printObj = xform1 c_th2d_printobj
+  saveAs = xform2 c_th2d_saveas
+  write = xform3 c_th2d_write
+instance ITAttLine TH2D where
+  getLineColor = xform0 c_th2d_getlinecolor
+  getLineStyle = xform0 c_th2d_getlinestyle
+  getLineWidth = xform0 c_th2d_getlinewidth
+  resetAttLine = xform1 c_th2d_resetattline
+  setLineAttributes = xform0 c_th2d_setlineattributes
+  setLineColor = xform1 c_th2d_setlinecolor
+  setLineStyle = xform1 c_th2d_setlinestyle
+  setLineWidth = xform1 c_th2d_setlinewidth
+instance ITAttFill TH2D where
+  setFillColor = xform1 c_th2d_setfillcolor
+  setFillStyle = xform1 c_th2d_setfillstyle
+instance ITAttMarker TH2D where
+  getMarkerColor = xform0 c_th2d_getmarkercolor
+  getMarkerStyle = xform0 c_th2d_getmarkerstyle
+  getMarkerSize = xform0 c_th2d_getmarkersize
+  resetAttMarker = xform1 c_th2d_resetattmarker
+  setMarkerAttributes = xform0 c_th2d_setmarkerattributes
+  setMarkerColor = xform1 c_th2d_setmarkercolor
+  setMarkerStyle = xform1 c_th2d_setmarkerstyle
+  setMarkerSize = xform1 c_th2d_setmarkersize
+instance IDeletable TH2D where
+  delete = xform0 c_th2d_delete
+instance ITArray TH2D where
+
+instance ITH2D (Exist TH2D) where
+
+instance ITH2 (Exist TH2D) where
+  fill2 (ETH2D x) = fill2 x
+  fill2w (ETH2D x) = fill2w x
+  fillN2 (ETH2D x) = fillN2 x
+  fillRandom2 (ETH2D x) = fillRandom2 x
+  findFirstBinAbove2 (ETH2D x) = findFirstBinAbove2 x
+  findLastBinAbove2 (ETH2D x) = findLastBinAbove2 x
+  fitSlicesX (ETH2D x) = fitSlicesX x
+  fitSlicesY (ETH2D x) = fitSlicesY x
+  getCorrelationFactor2 (ETH2D x) = getCorrelationFactor2 x
+  getCovariance2 (ETH2D x) = getCovariance2 x
+  integral2 (ETH2D x) = integral2 x
+  rebinX2 (ETH2D x) = rebinX2 x
+  rebinY2 (ETH2D x) = rebinY2 x
+  rebin2D (ETH2D x) = rebin2D x
+  setShowProjectionX (ETH2D x) = setShowProjectionX x
+  setShowProjectionY (ETH2D x) = setShowProjectionY x
+instance ITArrayD (Exist TH2D) where
+
+instance ITH1 (Exist TH2D) where
+  add (ETH2D x) = add x
+  addBinContent (ETH2D x) = addBinContent x
+  chi2Test (ETH2D x) = chi2Test x
+  computeIntegral (ETH2D x) = computeIntegral x
+  directoryAutoAdd (ETH2D x) = directoryAutoAdd x
+  divide (ETH2D x) = divide x
+  drawCopyTH1 (ETH2D x) a1 = return . ETH2D =<< drawCopyTH1 x a1
+  drawNormalized (ETH2D x) = drawNormalized x
+  drawPanelTH1 (ETH2D x) = drawPanelTH1 x
+  bufferEmpty (ETH2D x) = bufferEmpty x
+  evalF (ETH2D x) = evalF x
+  fFT (ETH2D x) = fFT x
+  fill1 (ETH2D x) = fill1 x
+  fill1w (ETH2D x) = fill1w x
+  fillN1 (ETH2D x) = fillN1 x
+  fillRandom (ETH2D x) = fillRandom x
+  findBin (ETH2D x) = findBin x
+  findFixBin (ETH2D x) = findFixBin x
+  findFirstBinAbove (ETH2D x) = findFirstBinAbove x
+  findLastBinAbove (ETH2D x) = findLastBinAbove x
+  fitPanelTH1 (ETH2D x) = fitPanelTH1 x
+  getNdivisionA (ETH2D x) = getNdivisionA x
+  getAxisColorA (ETH2D x) = getAxisColorA x
+  getLabelColorA (ETH2D x) = getLabelColorA x
+  getLabelFontA (ETH2D x) = getLabelFontA x
+  getLabelOffsetA (ETH2D x) = getLabelOffsetA x
+  getLabelSizeA (ETH2D x) = getLabelSizeA x
+  getTitleFontA (ETH2D x) = getTitleFontA x
+  getTitleOffsetA (ETH2D x) = getTitleOffsetA x
+  getTitleSizeA (ETH2D x) = getTitleSizeA x
+  getTickLengthA (ETH2D x) = getTickLengthA x
+  getBarOffset (ETH2D x) = getBarOffset x
+  getBarWidth (ETH2D x) = getBarWidth x
+  getContour (ETH2D x) = getContour x
+  getContourLevel (ETH2D x) = getContourLevel x
+  getContourLevelPad (ETH2D x) = getContourLevelPad x
+  getBin (ETH2D x) = getBin x
+  getBinCenter (ETH2D x) = getBinCenter x
+  getBinContent1 (ETH2D x) = getBinContent1 x
+  getBinContent2 (ETH2D x) = getBinContent2 x
+  getBinContent3 (ETH2D x) = getBinContent3 x
+  getBinError1 (ETH2D x) = getBinError1 x
+  getBinError2 (ETH2D x) = getBinError2 x
+  getBinError3 (ETH2D x) = getBinError3 x
+  getBinLowEdge (ETH2D x) = getBinLowEdge x
+  getBinWidth (ETH2D x) = getBinWidth x
+  getCellContent (ETH2D x) = getCellContent x
+  getCellError (ETH2D x) = getCellError x
+  getEntries (ETH2D x) = getEntries x
+  getEffectiveEntries (ETH2D x) = getEffectiveEntries x
+  getFunction (ETH2D x) = getFunction x
+  getDimension (ETH2D x) = getDimension x
+  getKurtosis (ETH2D x) = getKurtosis x
+  getLowEdge (ETH2D x) = getLowEdge x
+  getMaximumTH1 (ETH2D x) = getMaximumTH1 x
+  getMaximumBin (ETH2D x) = getMaximumBin x
+  getMaximumStored (ETH2D x) = getMaximumStored x
+  getMinimumTH1 (ETH2D x) = getMinimumTH1 x
+  getMinimumBin (ETH2D x) = getMinimumBin x
+  getMinimumStored (ETH2D x) = getMinimumStored x
+  getMean (ETH2D x) = getMean x
+  getMeanError (ETH2D x) = getMeanError x
+  getNbinsX (ETH2D x) = getNbinsX x
+  getNbinsY (ETH2D x) = getNbinsY x
+  getNbinsZ (ETH2D x) = getNbinsZ x
+  getQuantilesTH1 (ETH2D x) = getQuantilesTH1 x
+  getRandom (ETH2D x) = getRandom x
+  getStats (ETH2D x) = getStats x
+  getSumOfWeights (ETH2D x) = getSumOfWeights x
+  getSumw2 (ETH2D x) = getSumw2 x
+  getSumw2N (ETH2D x) = getSumw2N x
+  getRMS (ETH2D x) = getRMS x
+  getRMSError (ETH2D x) = getRMSError x
+  getSkewness (ETH2D x) = getSkewness x
+  integral1 (ETH2D x) = integral1 x
+  interpolate1 (ETH2D x) = interpolate1 x
+  interpolate2 (ETH2D x) = interpolate2 x
+  interpolate3 (ETH2D x) = interpolate3 x
+  kolmogorovTest (ETH2D x) = kolmogorovTest x
+  labelsDeflate (ETH2D x) = labelsDeflate x
+  labelsInflate (ETH2D x) = labelsInflate x
+  labelsOption (ETH2D x) = labelsOption x
+  multiflyF (ETH2D x) = multiflyF x
+  multiply (ETH2D x) = multiply x
+  putStats (ETH2D x) = putStats x
+  rebin (ETH2D x) = rebin x
+  rebinAxis (ETH2D x) = rebinAxis x
+  rebuild (ETH2D x) = rebuild x
+  recursiveRemove (ETH2D x) = recursiveRemove x
+  reset (ETH2D x) = reset x
+  resetStats (ETH2D x) = resetStats x
+  scale (ETH2D x) = scale x
+  setAxisColorA (ETH2D x) = setAxisColorA x
+  setAxisRange (ETH2D x) = setAxisRange x
+  setBarOffset (ETH2D x) = setBarOffset x
+  setBarWidth (ETH2D x) = setBarWidth x
+  setBinContent1 (ETH2D x) = setBinContent1 x
+  setBinContent2 (ETH2D x) = setBinContent2 x
+  setBinContent3 (ETH2D x) = setBinContent3 x
+  setBinError1 (ETH2D x) = setBinError1 x
+  setBinError2 (ETH2D x) = setBinError2 x
+  setBinError3 (ETH2D x) = setBinError3 x
+  setBins1 (ETH2D x) = setBins1 x
+  setBins2 (ETH2D x) = setBins2 x
+  setBins3 (ETH2D x) = setBins3 x
+  setBinsLength (ETH2D x) = setBinsLength x
+  setBuffer (ETH2D x) = setBuffer x
+  setCellContent (ETH2D x) = setCellContent x
+  setContent (ETH2D x) = setContent x
+  setContour (ETH2D x) = setContour x
+  setContourLevel (ETH2D x) = setContourLevel x
+  setDirectory (ETH2D x) = setDirectory x
+  setEntries (ETH2D x) = setEntries x
+  setError (ETH2D x) = setError x
+  setLabelColorA (ETH2D x) = setLabelColorA x
+  setLabelSizeA (ETH2D x) = setLabelSizeA x
+  setLabelFontA (ETH2D x) = setLabelFontA x
+  setLabelOffsetA (ETH2D x) = setLabelOffsetA x
+  setMaximum (ETH2D x) = setMaximum x
+  setMinimum (ETH2D x) = setMinimum x
+  setNormFactor (ETH2D x) = setNormFactor x
+  setStats (ETH2D x) = setStats x
+  setOption (ETH2D x) = setOption x
+  setXTitle (ETH2D x) = setXTitle x
+  setYTitle (ETH2D x) = setYTitle x
+  setZTitle (ETH2D x) = setZTitle x
+  showBackground (ETH2D x) = showBackground x
+  showPeaks (ETH2D x) = showPeaks x
+  smooth (ETH2D x) = smooth x
+  sumw2 (ETH2D x) = sumw2 x
+instance ITObject (Exist TH2D) where
+  draw (ETH2D x) = draw x
+  findObject (ETH2D x) = findObject x
+  getName (ETH2D x) = getName x
+  isA (ETH2D x) = isA x
+  paint (ETH2D x) = paint x
+  printObj (ETH2D x) = printObj x
+  saveAs (ETH2D x) = saveAs x
+  write (ETH2D x) = write x
+instance ITAttLine (Exist TH2D) where
+  getLineColor (ETH2D x) = getLineColor x
+  getLineStyle (ETH2D x) = getLineStyle x
+  getLineWidth (ETH2D x) = getLineWidth x
+  resetAttLine (ETH2D x) = resetAttLine x
+  setLineAttributes (ETH2D x) = setLineAttributes x
+  setLineColor (ETH2D x) = setLineColor x
+  setLineStyle (ETH2D x) = setLineStyle x
+  setLineWidth (ETH2D x) = setLineWidth x
+instance ITAttFill (Exist TH2D) where
+  setFillColor (ETH2D x) = setFillColor x
+  setFillStyle (ETH2D x) = setFillStyle x
+instance ITAttMarker (Exist TH2D) where
+  getMarkerColor (ETH2D x) = getMarkerColor x
+  getMarkerStyle (ETH2D x) = getMarkerStyle x
+  getMarkerSize (ETH2D x) = getMarkerSize x
+  resetAttMarker (ETH2D x) = resetAttMarker x
+  setMarkerAttributes (ETH2D x) = setMarkerAttributes x
+  setMarkerColor (ETH2D x) = setMarkerColor x
+  setMarkerStyle (ETH2D x) = setMarkerStyle x
+  setMarkerSize (ETH2D x) = setMarkerSize x
+instance IDeletable (Exist TH2D) where
+  delete (ETH2D x) = delete x
+instance ITArray (Exist TH2D) where
+
+
+
+newTH2D :: CString -> CString -> CInt -> CDouble -> CDouble -> CInt -> CDouble -> CDouble -> IO TH2D
+newTH2D = xform7 c_th2d_newth2d
+
+
+
+
+
+instance FPtr (Exist TH2D) where
+  type Raw (Exist TH2D) = RawTH2D
+  get_fptr (ETH2D obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH2D (cast_fptr_to_obj (fptr :: ForeignPtr RawTH2D) :: TH2D)
diff --git a/src/HROOT/Hist/TH2D/Interface.hs b/src/HROOT/Hist/TH2D/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2D/Interface.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH2D.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH2D.RawType
+
+import HROOT.Hist.TH2.Interface
+import HROOT.Core.TArrayD.Interface
+---- ============ ----
+
+
+
+class (ITH2 a,ITArrayD a) => ITH2D a where
+
+instance Existable TH2D where
+  data Exist TH2D = forall a. (FPtr a, ITH2D a) => ETH2D a
+
+upcastTH2D :: (FPtr a, ITH2D a) => a -> TH2D
+upcastTH2D h = let fh = get_fptr h
+                   fh2 :: ForeignPtr RawTH2D = castForeignPtr fh
+               in cast_fptr_to_obj fh2
+
+downcastTH2D :: (FPtr a, ITH2D a) => TH2D -> a 
+downcastTH2D h = let fh = get_fptr h
+                     fh2 = castForeignPtr fh
+                 in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH2D/RawType.hs b/src/HROOT/Hist/TH2D/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2D/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH2D.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH2D
+newtype TH2D = TH2D (ForeignPtr RawTH2D) deriving (Eq, Ord, Show)
+instance FPtr TH2D where
+   type Raw TH2D = RawTH2D
+   get_fptr (TH2D fptr) = fptr
+   cast_fptr_to_obj = TH2D
diff --git a/src/HROOT/Hist/TH2F.hs b/src/HROOT/Hist/TH2F.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2F.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TH2F
+  (
+    TH2F(..)
+  , ITH2F
+  , upcastTH2F
+  , downcastTH2F
+  , newTH2F
+ 
+  ) where
+
+import HROOT.Hist.TH2F.RawType
+import HROOT.Hist.TH2F.Interface
+import HROOT.Hist.TH2F.Implementation
+
+
diff --git a/src/HROOT/Hist/TH2F/Cast.hs b/src/HROOT/Hist/TH2F/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2F/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH2F.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH2F.RawType
+import HROOT.Hist.TH2F.Interface
+
+instance (ITH2F a, FPtr a) => Castable a (Ptr RawTH2F) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH2F (Ptr RawTH2F) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH2F/FFI.hsc b/src/HROOT/Hist/TH2F/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2F/FFI.hsc
@@ -0,0 +1,550 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH2F.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH2F.RawType
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH2.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TObjArray.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTH2F.h"
+
+foreign import ccall "HROOTHistTH2F.h TH2F_fill2" c_th2f_fill2 
+  :: (Ptr RawTH2F) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_fill2w" c_th2f_fill2w 
+  :: (Ptr RawTH2F) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_fillN2" c_th2f_filln2 
+  :: (Ptr RawTH2F) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_fillRandom2" c_th2f_fillrandom2 
+  :: (Ptr RawTH2F) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_findFirstBinAbove2" c_th2f_findfirstbinabove2 
+  :: (Ptr RawTH2F) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_findLastBinAbove2" c_th2f_findlastbinabove2 
+  :: (Ptr RawTH2F) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_FitSlicesX" c_th2f_fitslicesx 
+  :: (Ptr RawTH2F) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CString -> (Ptr RawTObjArray) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_FitSlicesY" c_th2f_fitslicesy 
+  :: (Ptr RawTH2F) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CString -> (Ptr RawTObjArray) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_getCorrelationFactor2" c_th2f_getcorrelationfactor2 
+  :: (Ptr RawTH2F) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_getCovariance2" c_th2f_getcovariance2 
+  :: (Ptr RawTH2F) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_integral2" c_th2f_integral2 
+  :: (Ptr RawTH2F) -> CInt -> CInt -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_rebinX2" c_th2f_rebinx2 
+  :: (Ptr RawTH2F) -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2F.h TH2F_rebinY2" c_th2f_rebiny2 
+  :: (Ptr RawTH2F) -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2F.h TH2F_Rebin2D" c_th2f_rebin2d 
+  :: (Ptr RawTH2F) -> CInt -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetShowProjectionX" c_th2f_setshowprojectionx 
+  :: (Ptr RawTH2F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetShowProjectionY" c_th2f_setshowprojectiony 
+  :: (Ptr RawTH2F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_Add" c_th2f_add 
+  :: (Ptr RawTH2F) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_AddBinContent" c_th2f_addbincontent 
+  :: (Ptr RawTH2F) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_Chi2Test" c_th2f_chi2test 
+  :: (Ptr RawTH2F) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_ComputeIntegral" c_th2f_computeintegral 
+  :: (Ptr RawTH2F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_DirectoryAutoAdd" c_th2f_directoryautoadd 
+  :: (Ptr RawTH2F) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_Divide" c_th2f_divide 
+  :: (Ptr RawTH2F) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_drawCopyTH1" c_th2f_drawcopyth1 
+  :: (Ptr RawTH2F) -> CString -> IO (Ptr RawTH2F)
+
+foreign import ccall "HROOTHistTH2F.h TH2F_DrawNormalized" c_th2f_drawnormalized 
+  :: (Ptr RawTH2F) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2F.h TH2F_drawPanelTH1" c_th2f_drawpanelth1 
+  :: (Ptr RawTH2F) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_BufferEmpty" c_th2f_bufferempty 
+  :: (Ptr RawTH2F) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_evalF" c_th2f_evalf 
+  :: (Ptr RawTH2F) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_FFT" c_th2f_fft 
+  :: (Ptr RawTH2F) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2F.h TH2F_fill1" c_th2f_fill1 
+  :: (Ptr RawTH2F) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_fill1w" c_th2f_fill1w 
+  :: (Ptr RawTH2F) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_fillN1" c_th2f_filln1 
+  :: (Ptr RawTH2F) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_FillRandom" c_th2f_fillrandom 
+  :: (Ptr RawTH2F) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_FindBin" c_th2f_findbin 
+  :: (Ptr RawTH2F) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_FindFixBin" c_th2f_findfixbin 
+  :: (Ptr RawTH2F) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_FindFirstBinAbove" c_th2f_findfirstbinabove 
+  :: (Ptr RawTH2F) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_FindLastBinAbove" c_th2f_findlastbinabove 
+  :: (Ptr RawTH2F) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_FitPanelTH1" c_th2f_fitpanelth1 
+  :: (Ptr RawTH2F) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_getNdivisionA" c_th2f_getndivisiona 
+  :: (Ptr RawTH2F) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_getAxisColorA" c_th2f_getaxiscolora 
+  :: (Ptr RawTH2F) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_getLabelColorA" c_th2f_getlabelcolora 
+  :: (Ptr RawTH2F) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_getLabelFontA" c_th2f_getlabelfonta 
+  :: (Ptr RawTH2F) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_getLabelOffsetA" c_th2f_getlabeloffseta 
+  :: (Ptr RawTH2F) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_getLabelSizeA" c_th2f_getlabelsizea 
+  :: (Ptr RawTH2F) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_getTitleFontA" c_th2f_gettitlefonta 
+  :: (Ptr RawTH2F) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_getTitleOffsetA" c_th2f_gettitleoffseta 
+  :: (Ptr RawTH2F) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_getTitleSizeA" c_th2f_gettitlesizea 
+  :: (Ptr RawTH2F) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_getTickLengthA" c_th2f_getticklengtha 
+  :: (Ptr RawTH2F) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetBarOffset" c_th2f_getbaroffset 
+  :: (Ptr RawTH2F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetBarWidth" c_th2f_getbarwidth 
+  :: (Ptr RawTH2F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetContour" c_th2f_getcontour 
+  :: (Ptr RawTH2F) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetContourLevel" c_th2f_getcontourlevel 
+  :: (Ptr RawTH2F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetContourLevelPad" c_th2f_getcontourlevelpad 
+  :: (Ptr RawTH2F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetBin" c_th2f_getbin 
+  :: (Ptr RawTH2F) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetBinCenter" c_th2f_getbincenter 
+  :: (Ptr RawTH2F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetBinContent1" c_th2f_getbincontent1 
+  :: (Ptr RawTH2F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetBinContent2" c_th2f_getbincontent2 
+  :: (Ptr RawTH2F) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetBinContent3" c_th2f_getbincontent3 
+  :: (Ptr RawTH2F) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetBinError1" c_th2f_getbinerror1 
+  :: (Ptr RawTH2F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetBinError2" c_th2f_getbinerror2 
+  :: (Ptr RawTH2F) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetBinError3" c_th2f_getbinerror3 
+  :: (Ptr RawTH2F) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetBinLowEdge" c_th2f_getbinlowedge 
+  :: (Ptr RawTH2F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetBinWidth" c_th2f_getbinwidth 
+  :: (Ptr RawTH2F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetCellContent" c_th2f_getcellcontent 
+  :: (Ptr RawTH2F) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetCellError" c_th2f_getcellerror 
+  :: (Ptr RawTH2F) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetEntries" c_th2f_getentries 
+  :: (Ptr RawTH2F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetEffectiveEntries" c_th2f_geteffectiveentries 
+  :: (Ptr RawTH2F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetFunction" c_th2f_getfunction 
+  :: (Ptr RawTH2F) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetDimension" c_th2f_getdimension 
+  :: (Ptr RawTH2F) -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetKurtosis" c_th2f_getkurtosis 
+  :: (Ptr RawTH2F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetLowEdge" c_th2f_getlowedge 
+  :: (Ptr RawTH2F) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_getMaximumTH1" c_th2f_getmaximumth1 
+  :: (Ptr RawTH2F) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetMaximumBin" c_th2f_getmaximumbin 
+  :: (Ptr RawTH2F) -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetMaximumStored" c_th2f_getmaximumstored 
+  :: (Ptr RawTH2F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_getMinimumTH1" c_th2f_getminimumth1 
+  :: (Ptr RawTH2F) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetMinimumBin" c_th2f_getminimumbin 
+  :: (Ptr RawTH2F) -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetMinimumStored" c_th2f_getminimumstored 
+  :: (Ptr RawTH2F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetMean" c_th2f_getmean 
+  :: (Ptr RawTH2F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetMeanError" c_th2f_getmeanerror 
+  :: (Ptr RawTH2F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetNbinsX" c_th2f_getnbinsx 
+  :: (Ptr RawTH2F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetNbinsY" c_th2f_getnbinsy 
+  :: (Ptr RawTH2F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetNbinsZ" c_th2f_getnbinsz 
+  :: (Ptr RawTH2F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_getQuantilesTH1" c_th2f_getquantilesth1 
+  :: (Ptr RawTH2F) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetRandom" c_th2f_getrandom 
+  :: (Ptr RawTH2F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetStats" c_th2f_getstats 
+  :: (Ptr RawTH2F) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetSumOfWeights" c_th2f_getsumofweights 
+  :: (Ptr RawTH2F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetSumw2" c_th2f_getsumw2 
+  :: (Ptr RawTH2F) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetSumw2N" c_th2f_getsumw2n 
+  :: (Ptr RawTH2F) -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetRMS" c_th2f_getrms 
+  :: (Ptr RawTH2F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetRMSError" c_th2f_getrmserror 
+  :: (Ptr RawTH2F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetSkewness" c_th2f_getskewness 
+  :: (Ptr RawTH2F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_integral1" c_th2f_integral1 
+  :: (Ptr RawTH2F) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_interpolate1" c_th2f_interpolate1 
+  :: (Ptr RawTH2F) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_interpolate2" c_th2f_interpolate2 
+  :: (Ptr RawTH2F) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_interpolate3" c_th2f_interpolate3 
+  :: (Ptr RawTH2F) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_KolmogorovTest" c_th2f_kolmogorovtest 
+  :: (Ptr RawTH2F) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_LabelsDeflate" c_th2f_labelsdeflate 
+  :: (Ptr RawTH2F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_LabelsInflate" c_th2f_labelsinflate 
+  :: (Ptr RawTH2F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_LabelsOption" c_th2f_labelsoption 
+  :: (Ptr RawTH2F) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_multiflyF" c_th2f_multiflyf 
+  :: (Ptr RawTH2F) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_Multiply" c_th2f_multiply 
+  :: (Ptr RawTH2F) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_PutStats" c_th2f_putstats 
+  :: (Ptr RawTH2F) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_Rebin" c_th2f_rebin 
+  :: (Ptr RawTH2F) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2F.h TH2F_RebinAxis" c_th2f_rebinaxis 
+  :: (Ptr RawTH2F) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_Rebuild" c_th2f_rebuild 
+  :: (Ptr RawTH2F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_RecursiveRemove" c_th2f_recursiveremove 
+  :: (Ptr RawTH2F) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_Reset" c_th2f_reset 
+  :: (Ptr RawTH2F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_ResetStats" c_th2f_resetstats 
+  :: (Ptr RawTH2F) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_Scale" c_th2f_scale 
+  :: (Ptr RawTH2F) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_setAxisColorA" c_th2f_setaxiscolora 
+  :: (Ptr RawTH2F) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetAxisRange" c_th2f_setaxisrange 
+  :: (Ptr RawTH2F) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetBarOffset" c_th2f_setbaroffset 
+  :: (Ptr RawTH2F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetBarWidth" c_th2f_setbarwidth 
+  :: (Ptr RawTH2F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_setBinContent1" c_th2f_setbincontent1 
+  :: (Ptr RawTH2F) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_setBinContent2" c_th2f_setbincontent2 
+  :: (Ptr RawTH2F) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_setBinContent3" c_th2f_setbincontent3 
+  :: (Ptr RawTH2F) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_setBinError1" c_th2f_setbinerror1 
+  :: (Ptr RawTH2F) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_setBinError2" c_th2f_setbinerror2 
+  :: (Ptr RawTH2F) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_setBinError3" c_th2f_setbinerror3 
+  :: (Ptr RawTH2F) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_setBins1" c_th2f_setbins1 
+  :: (Ptr RawTH2F) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_setBins2" c_th2f_setbins2 
+  :: (Ptr RawTH2F) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_setBins3" c_th2f_setbins3 
+  :: (Ptr RawTH2F) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetBinsLength" c_th2f_setbinslength 
+  :: (Ptr RawTH2F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetBuffer" c_th2f_setbuffer 
+  :: (Ptr RawTH2F) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetCellContent" c_th2f_setcellcontent 
+  :: (Ptr RawTH2F) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetContent" c_th2f_setcontent 
+  :: (Ptr RawTH2F) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetContour" c_th2f_setcontour 
+  :: (Ptr RawTH2F) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetContourLevel" c_th2f_setcontourlevel 
+  :: (Ptr RawTH2F) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetDirectory" c_th2f_setdirectory 
+  :: (Ptr RawTH2F) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetEntries" c_th2f_setentries 
+  :: (Ptr RawTH2F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetError" c_th2f_seterror 
+  :: (Ptr RawTH2F) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_setLabelColorA" c_th2f_setlabelcolora 
+  :: (Ptr RawTH2F) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_setLabelSizeA" c_th2f_setlabelsizea 
+  :: (Ptr RawTH2F) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_setLabelFontA" c_th2f_setlabelfonta 
+  :: (Ptr RawTH2F) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_setLabelOffsetA" c_th2f_setlabeloffseta 
+  :: (Ptr RawTH2F) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetMaximum" c_th2f_setmaximum 
+  :: (Ptr RawTH2F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetMinimum" c_th2f_setminimum 
+  :: (Ptr RawTH2F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetNormFactor" c_th2f_setnormfactor 
+  :: (Ptr RawTH2F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetStats" c_th2f_setstats 
+  :: (Ptr RawTH2F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetOption" c_th2f_setoption 
+  :: (Ptr RawTH2F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetXTitle" c_th2f_setxtitle 
+  :: (Ptr RawTH2F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetYTitle" c_th2f_setytitle 
+  :: (Ptr RawTH2F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetZTitle" c_th2f_setztitle 
+  :: (Ptr RawTH2F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_ShowBackground" c_th2f_showbackground 
+  :: (Ptr RawTH2F) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2F.h TH2F_ShowPeaks" c_th2f_showpeaks 
+  :: (Ptr RawTH2F) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_Smooth" c_th2f_smooth 
+  :: (Ptr RawTH2F) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_Sumw2" c_th2f_sumw2 
+  :: (Ptr RawTH2F) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_Draw" c_th2f_draw 
+  :: (Ptr RawTH2F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_FindObject" c_th2f_findobject 
+  :: (Ptr RawTH2F) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetName" c_th2f_getname 
+  :: (Ptr RawTH2F) -> IO CString
+
+foreign import ccall "HROOTHistTH2F.h TH2F_IsA" c_th2f_isa 
+  :: (Ptr RawTH2F) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH2F.h TH2F_Paint" c_th2f_paint 
+  :: (Ptr RawTH2F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_printObj" c_th2f_printobj 
+  :: (Ptr RawTH2F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SaveAs" c_th2f_saveas 
+  :: (Ptr RawTH2F) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_Write" c_th2f_write 
+  :: (Ptr RawTH2F) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetLineColor" c_th2f_getlinecolor 
+  :: (Ptr RawTH2F) -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetLineStyle" c_th2f_getlinestyle 
+  :: (Ptr RawTH2F) -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetLineWidth" c_th2f_getlinewidth 
+  :: (Ptr RawTH2F) -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_ResetAttLine" c_th2f_resetattline 
+  :: (Ptr RawTH2F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetLineAttributes" c_th2f_setlineattributes 
+  :: (Ptr RawTH2F) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetLineColor" c_th2f_setlinecolor 
+  :: (Ptr RawTH2F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetLineStyle" c_th2f_setlinestyle 
+  :: (Ptr RawTH2F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetLineWidth" c_th2f_setlinewidth 
+  :: (Ptr RawTH2F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetFillColor" c_th2f_setfillcolor 
+  :: (Ptr RawTH2F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetFillStyle" c_th2f_setfillstyle 
+  :: (Ptr RawTH2F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetMarkerColor" c_th2f_getmarkercolor 
+  :: (Ptr RawTH2F) -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetMarkerStyle" c_th2f_getmarkerstyle 
+  :: (Ptr RawTH2F) -> IO CInt
+
+foreign import ccall "HROOTHistTH2F.h TH2F_GetMarkerSize" c_th2f_getmarkersize 
+  :: (Ptr RawTH2F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2F.h TH2F_ResetAttMarker" c_th2f_resetattmarker 
+  :: (Ptr RawTH2F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetMarkerAttributes" c_th2f_setmarkerattributes 
+  :: (Ptr RawTH2F) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetMarkerColor" c_th2f_setmarkercolor 
+  :: (Ptr RawTH2F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetMarkerStyle" c_th2f_setmarkerstyle 
+  :: (Ptr RawTH2F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_SetMarkerSize" c_th2f_setmarkersize 
+  :: (Ptr RawTH2F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_delete" c_th2f_delete 
+  :: (Ptr RawTH2F) -> IO ()
+
+foreign import ccall "HROOTHistTH2F.h TH2F_newTH2F" c_th2f_newth2f 
+  :: CString -> CString -> CInt -> CDouble -> CDouble -> CInt -> CDouble -> CDouble -> IO (Ptr RawTH2F)
+
diff --git a/src/HROOT/Hist/TH2F/Implementation.hs b/src/HROOT/Hist/TH2F/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2F/Implementation.hs
@@ -0,0 +1,453 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH2F.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH2F.RawType
+import HROOT.Hist.TH2F.FFI
+import HROOT.Hist.TH2F.Interface
+import HROOT.Hist.TH2F.Cast
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1D.Cast
+import HROOT.Hist.TH1D.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TObjArray.RawType
+import HROOT.Core.TObjArray.Cast
+import HROOT.Core.TObjArray.Interface
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH2.RawType
+import HROOT.Hist.TH2.Cast
+import HROOT.Hist.TH2.Interface
+import HROOT.Core.TArrayF.RawType
+import HROOT.Core.TArrayF.Cast
+import HROOT.Core.TArrayF.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+import HROOT.Core.TArray.RawType
+import HROOT.Core.TArray.Cast
+import HROOT.Core.TArray.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH2F TH2F where
+instance ITH2 TH2F where
+  fill2 = xform2 c_th2f_fill2
+  fill2w = xform3 c_th2f_fill2w
+  fillN2 = xform5 c_th2f_filln2
+  fillRandom2 = xform2 c_th2f_fillrandom2
+  findFirstBinAbove2 = xform2 c_th2f_findfirstbinabove2
+  findLastBinAbove2 = xform2 c_th2f_findlastbinabove2
+  fitSlicesX = xform6 c_th2f_fitslicesx
+  fitSlicesY = xform6 c_th2f_fitslicesy
+  getCorrelationFactor2 = xform2 c_th2f_getcorrelationfactor2
+  getCovariance2 = xform2 c_th2f_getcovariance2
+  integral2 = xform5 c_th2f_integral2
+  rebinX2 = xform2 c_th2f_rebinx2
+  rebinY2 = xform2 c_th2f_rebiny2
+  rebin2D = xform3 c_th2f_rebin2d
+  setShowProjectionX = xform1 c_th2f_setshowprojectionx
+  setShowProjectionY = xform1 c_th2f_setshowprojectiony
+instance ITArrayF TH2F where
+instance ITH1 TH2F where
+  add = xform2 c_th2f_add
+  addBinContent = xform2 c_th2f_addbincontent
+  chi2Test = xform3 c_th2f_chi2test
+  computeIntegral = xform0 c_th2f_computeintegral
+  directoryAutoAdd = xform1 c_th2f_directoryautoadd
+  divide = xform5 c_th2f_divide
+  drawCopyTH1 = xform1 c_th2f_drawcopyth1
+  drawNormalized = xform2 c_th2f_drawnormalized
+  drawPanelTH1 = xform0 c_th2f_drawpanelth1
+  bufferEmpty = xform1 c_th2f_bufferempty
+  evalF = xform2 c_th2f_evalf
+  fFT = xform2 c_th2f_fft
+  fill1 = xform1 c_th2f_fill1
+  fill1w = xform2 c_th2f_fill1w
+  fillN1 = xform4 c_th2f_filln1
+  fillRandom = xform2 c_th2f_fillrandom
+  findBin = xform3 c_th2f_findbin
+  findFixBin = xform3 c_th2f_findfixbin
+  findFirstBinAbove = xform2 c_th2f_findfirstbinabove
+  findLastBinAbove = xform2 c_th2f_findlastbinabove
+  fitPanelTH1 = xform0 c_th2f_fitpanelth1
+  getNdivisionA = xform1 c_th2f_getndivisiona
+  getAxisColorA = xform1 c_th2f_getaxiscolora
+  getLabelColorA = xform1 c_th2f_getlabelcolora
+  getLabelFontA = xform1 c_th2f_getlabelfonta
+  getLabelOffsetA = xform1 c_th2f_getlabeloffseta
+  getLabelSizeA = xform1 c_th2f_getlabelsizea
+  getTitleFontA = xform1 c_th2f_gettitlefonta
+  getTitleOffsetA = xform1 c_th2f_gettitleoffseta
+  getTitleSizeA = xform1 c_th2f_gettitlesizea
+  getTickLengthA = xform1 c_th2f_getticklengtha
+  getBarOffset = xform0 c_th2f_getbaroffset
+  getBarWidth = xform0 c_th2f_getbarwidth
+  getContour = xform1 c_th2f_getcontour
+  getContourLevel = xform1 c_th2f_getcontourlevel
+  getContourLevelPad = xform1 c_th2f_getcontourlevelpad
+  getBin = xform3 c_th2f_getbin
+  getBinCenter = xform1 c_th2f_getbincenter
+  getBinContent1 = xform1 c_th2f_getbincontent1
+  getBinContent2 = xform2 c_th2f_getbincontent2
+  getBinContent3 = xform3 c_th2f_getbincontent3
+  getBinError1 = xform1 c_th2f_getbinerror1
+  getBinError2 = xform2 c_th2f_getbinerror2
+  getBinError3 = xform3 c_th2f_getbinerror3
+  getBinLowEdge = xform1 c_th2f_getbinlowedge
+  getBinWidth = xform1 c_th2f_getbinwidth
+  getCellContent = xform2 c_th2f_getcellcontent
+  getCellError = xform2 c_th2f_getcellerror
+  getEntries = xform0 c_th2f_getentries
+  getEffectiveEntries = xform0 c_th2f_geteffectiveentries
+  getFunction = xform1 c_th2f_getfunction
+  getDimension = xform0 c_th2f_getdimension
+  getKurtosis = xform1 c_th2f_getkurtosis
+  getLowEdge = xform1 c_th2f_getlowedge
+  getMaximumTH1 = xform1 c_th2f_getmaximumth1
+  getMaximumBin = xform0 c_th2f_getmaximumbin
+  getMaximumStored = xform0 c_th2f_getmaximumstored
+  getMinimumTH1 = xform1 c_th2f_getminimumth1
+  getMinimumBin = xform0 c_th2f_getminimumbin
+  getMinimumStored = xform0 c_th2f_getminimumstored
+  getMean = xform1 c_th2f_getmean
+  getMeanError = xform1 c_th2f_getmeanerror
+  getNbinsX = xform0 c_th2f_getnbinsx
+  getNbinsY = xform0 c_th2f_getnbinsy
+  getNbinsZ = xform0 c_th2f_getnbinsz
+  getQuantilesTH1 = xform3 c_th2f_getquantilesth1
+  getRandom = xform0 c_th2f_getrandom
+  getStats = xform1 c_th2f_getstats
+  getSumOfWeights = xform0 c_th2f_getsumofweights
+  getSumw2 = xform0 c_th2f_getsumw2
+  getSumw2N = xform0 c_th2f_getsumw2n
+  getRMS = xform1 c_th2f_getrms
+  getRMSError = xform1 c_th2f_getrmserror
+  getSkewness = xform1 c_th2f_getskewness
+  integral1 = xform3 c_th2f_integral1
+  interpolate1 = xform1 c_th2f_interpolate1
+  interpolate2 = xform2 c_th2f_interpolate2
+  interpolate3 = xform3 c_th2f_interpolate3
+  kolmogorovTest = xform2 c_th2f_kolmogorovtest
+  labelsDeflate = xform1 c_th2f_labelsdeflate
+  labelsInflate = xform1 c_th2f_labelsinflate
+  labelsOption = xform2 c_th2f_labelsoption
+  multiflyF = xform2 c_th2f_multiflyf
+  multiply = xform5 c_th2f_multiply
+  putStats = xform1 c_th2f_putstats
+  rebin = xform3 c_th2f_rebin
+  rebinAxis = xform2 c_th2f_rebinaxis
+  rebuild = xform1 c_th2f_rebuild
+  recursiveRemove = xform1 c_th2f_recursiveremove
+  reset = xform1 c_th2f_reset
+  resetStats = xform0 c_th2f_resetstats
+  scale = xform2 c_th2f_scale
+  setAxisColorA = xform2 c_th2f_setaxiscolora
+  setAxisRange = xform3 c_th2f_setaxisrange
+  setBarOffset = xform1 c_th2f_setbaroffset
+  setBarWidth = xform1 c_th2f_setbarwidth
+  setBinContent1 = xform2 c_th2f_setbincontent1
+  setBinContent2 = xform3 c_th2f_setbincontent2
+  setBinContent3 = xform4 c_th2f_setbincontent3
+  setBinError1 = xform2 c_th2f_setbinerror1
+  setBinError2 = xform3 c_th2f_setbinerror2
+  setBinError3 = xform4 c_th2f_setbinerror3
+  setBins1 = xform2 c_th2f_setbins1
+  setBins2 = xform4 c_th2f_setbins2
+  setBins3 = xform6 c_th2f_setbins3
+  setBinsLength = xform1 c_th2f_setbinslength
+  setBuffer = xform2 c_th2f_setbuffer
+  setCellContent = xform3 c_th2f_setcellcontent
+  setContent = xform1 c_th2f_setcontent
+  setContour = xform2 c_th2f_setcontour
+  setContourLevel = xform2 c_th2f_setcontourlevel
+  setDirectory = xform1 c_th2f_setdirectory
+  setEntries = xform1 c_th2f_setentries
+  setError = xform1 c_th2f_seterror
+  setLabelColorA = xform2 c_th2f_setlabelcolora
+  setLabelSizeA = xform2 c_th2f_setlabelsizea
+  setLabelFontA = xform2 c_th2f_setlabelfonta
+  setLabelOffsetA = xform2 c_th2f_setlabeloffseta
+  setMaximum = xform1 c_th2f_setmaximum
+  setMinimum = xform1 c_th2f_setminimum
+  setNormFactor = xform1 c_th2f_setnormfactor
+  setStats = xform1 c_th2f_setstats
+  setOption = xform1 c_th2f_setoption
+  setXTitle = xform1 c_th2f_setxtitle
+  setYTitle = xform1 c_th2f_setytitle
+  setZTitle = xform1 c_th2f_setztitle
+  showBackground = xform2 c_th2f_showbackground
+  showPeaks = xform3 c_th2f_showpeaks
+  smooth = xform2 c_th2f_smooth
+  sumw2 = xform0 c_th2f_sumw2
+instance ITObject TH2F where
+  draw = xform1 c_th2f_draw
+  findObject = xform1 c_th2f_findobject
+  getName = xform0 c_th2f_getname
+  isA = xform0 c_th2f_isa
+  paint = xform1 c_th2f_paint
+  printObj = xform1 c_th2f_printobj
+  saveAs = xform2 c_th2f_saveas
+  write = xform3 c_th2f_write
+instance ITAttLine TH2F where
+  getLineColor = xform0 c_th2f_getlinecolor
+  getLineStyle = xform0 c_th2f_getlinestyle
+  getLineWidth = xform0 c_th2f_getlinewidth
+  resetAttLine = xform1 c_th2f_resetattline
+  setLineAttributes = xform0 c_th2f_setlineattributes
+  setLineColor = xform1 c_th2f_setlinecolor
+  setLineStyle = xform1 c_th2f_setlinestyle
+  setLineWidth = xform1 c_th2f_setlinewidth
+instance ITAttFill TH2F where
+  setFillColor = xform1 c_th2f_setfillcolor
+  setFillStyle = xform1 c_th2f_setfillstyle
+instance ITAttMarker TH2F where
+  getMarkerColor = xform0 c_th2f_getmarkercolor
+  getMarkerStyle = xform0 c_th2f_getmarkerstyle
+  getMarkerSize = xform0 c_th2f_getmarkersize
+  resetAttMarker = xform1 c_th2f_resetattmarker
+  setMarkerAttributes = xform0 c_th2f_setmarkerattributes
+  setMarkerColor = xform1 c_th2f_setmarkercolor
+  setMarkerStyle = xform1 c_th2f_setmarkerstyle
+  setMarkerSize = xform1 c_th2f_setmarkersize
+instance IDeletable TH2F where
+  delete = xform0 c_th2f_delete
+instance ITArray TH2F where
+
+instance ITH2F (Exist TH2F) where
+
+instance ITH2 (Exist TH2F) where
+  fill2 (ETH2F x) = fill2 x
+  fill2w (ETH2F x) = fill2w x
+  fillN2 (ETH2F x) = fillN2 x
+  fillRandom2 (ETH2F x) = fillRandom2 x
+  findFirstBinAbove2 (ETH2F x) = findFirstBinAbove2 x
+  findLastBinAbove2 (ETH2F x) = findLastBinAbove2 x
+  fitSlicesX (ETH2F x) = fitSlicesX x
+  fitSlicesY (ETH2F x) = fitSlicesY x
+  getCorrelationFactor2 (ETH2F x) = getCorrelationFactor2 x
+  getCovariance2 (ETH2F x) = getCovariance2 x
+  integral2 (ETH2F x) = integral2 x
+  rebinX2 (ETH2F x) = rebinX2 x
+  rebinY2 (ETH2F x) = rebinY2 x
+  rebin2D (ETH2F x) = rebin2D x
+  setShowProjectionX (ETH2F x) = setShowProjectionX x
+  setShowProjectionY (ETH2F x) = setShowProjectionY x
+instance ITArrayF (Exist TH2F) where
+
+instance ITH1 (Exist TH2F) where
+  add (ETH2F x) = add x
+  addBinContent (ETH2F x) = addBinContent x
+  chi2Test (ETH2F x) = chi2Test x
+  computeIntegral (ETH2F x) = computeIntegral x
+  directoryAutoAdd (ETH2F x) = directoryAutoAdd x
+  divide (ETH2F x) = divide x
+  drawCopyTH1 (ETH2F x) a1 = return . ETH2F =<< drawCopyTH1 x a1
+  drawNormalized (ETH2F x) = drawNormalized x
+  drawPanelTH1 (ETH2F x) = drawPanelTH1 x
+  bufferEmpty (ETH2F x) = bufferEmpty x
+  evalF (ETH2F x) = evalF x
+  fFT (ETH2F x) = fFT x
+  fill1 (ETH2F x) = fill1 x
+  fill1w (ETH2F x) = fill1w x
+  fillN1 (ETH2F x) = fillN1 x
+  fillRandom (ETH2F x) = fillRandom x
+  findBin (ETH2F x) = findBin x
+  findFixBin (ETH2F x) = findFixBin x
+  findFirstBinAbove (ETH2F x) = findFirstBinAbove x
+  findLastBinAbove (ETH2F x) = findLastBinAbove x
+  fitPanelTH1 (ETH2F x) = fitPanelTH1 x
+  getNdivisionA (ETH2F x) = getNdivisionA x
+  getAxisColorA (ETH2F x) = getAxisColorA x
+  getLabelColorA (ETH2F x) = getLabelColorA x
+  getLabelFontA (ETH2F x) = getLabelFontA x
+  getLabelOffsetA (ETH2F x) = getLabelOffsetA x
+  getLabelSizeA (ETH2F x) = getLabelSizeA x
+  getTitleFontA (ETH2F x) = getTitleFontA x
+  getTitleOffsetA (ETH2F x) = getTitleOffsetA x
+  getTitleSizeA (ETH2F x) = getTitleSizeA x
+  getTickLengthA (ETH2F x) = getTickLengthA x
+  getBarOffset (ETH2F x) = getBarOffset x
+  getBarWidth (ETH2F x) = getBarWidth x
+  getContour (ETH2F x) = getContour x
+  getContourLevel (ETH2F x) = getContourLevel x
+  getContourLevelPad (ETH2F x) = getContourLevelPad x
+  getBin (ETH2F x) = getBin x
+  getBinCenter (ETH2F x) = getBinCenter x
+  getBinContent1 (ETH2F x) = getBinContent1 x
+  getBinContent2 (ETH2F x) = getBinContent2 x
+  getBinContent3 (ETH2F x) = getBinContent3 x
+  getBinError1 (ETH2F x) = getBinError1 x
+  getBinError2 (ETH2F x) = getBinError2 x
+  getBinError3 (ETH2F x) = getBinError3 x
+  getBinLowEdge (ETH2F x) = getBinLowEdge x
+  getBinWidth (ETH2F x) = getBinWidth x
+  getCellContent (ETH2F x) = getCellContent x
+  getCellError (ETH2F x) = getCellError x
+  getEntries (ETH2F x) = getEntries x
+  getEffectiveEntries (ETH2F x) = getEffectiveEntries x
+  getFunction (ETH2F x) = getFunction x
+  getDimension (ETH2F x) = getDimension x
+  getKurtosis (ETH2F x) = getKurtosis x
+  getLowEdge (ETH2F x) = getLowEdge x
+  getMaximumTH1 (ETH2F x) = getMaximumTH1 x
+  getMaximumBin (ETH2F x) = getMaximumBin x
+  getMaximumStored (ETH2F x) = getMaximumStored x
+  getMinimumTH1 (ETH2F x) = getMinimumTH1 x
+  getMinimumBin (ETH2F x) = getMinimumBin x
+  getMinimumStored (ETH2F x) = getMinimumStored x
+  getMean (ETH2F x) = getMean x
+  getMeanError (ETH2F x) = getMeanError x
+  getNbinsX (ETH2F x) = getNbinsX x
+  getNbinsY (ETH2F x) = getNbinsY x
+  getNbinsZ (ETH2F x) = getNbinsZ x
+  getQuantilesTH1 (ETH2F x) = getQuantilesTH1 x
+  getRandom (ETH2F x) = getRandom x
+  getStats (ETH2F x) = getStats x
+  getSumOfWeights (ETH2F x) = getSumOfWeights x
+  getSumw2 (ETH2F x) = getSumw2 x
+  getSumw2N (ETH2F x) = getSumw2N x
+  getRMS (ETH2F x) = getRMS x
+  getRMSError (ETH2F x) = getRMSError x
+  getSkewness (ETH2F x) = getSkewness x
+  integral1 (ETH2F x) = integral1 x
+  interpolate1 (ETH2F x) = interpolate1 x
+  interpolate2 (ETH2F x) = interpolate2 x
+  interpolate3 (ETH2F x) = interpolate3 x
+  kolmogorovTest (ETH2F x) = kolmogorovTest x
+  labelsDeflate (ETH2F x) = labelsDeflate x
+  labelsInflate (ETH2F x) = labelsInflate x
+  labelsOption (ETH2F x) = labelsOption x
+  multiflyF (ETH2F x) = multiflyF x
+  multiply (ETH2F x) = multiply x
+  putStats (ETH2F x) = putStats x
+  rebin (ETH2F x) = rebin x
+  rebinAxis (ETH2F x) = rebinAxis x
+  rebuild (ETH2F x) = rebuild x
+  recursiveRemove (ETH2F x) = recursiveRemove x
+  reset (ETH2F x) = reset x
+  resetStats (ETH2F x) = resetStats x
+  scale (ETH2F x) = scale x
+  setAxisColorA (ETH2F x) = setAxisColorA x
+  setAxisRange (ETH2F x) = setAxisRange x
+  setBarOffset (ETH2F x) = setBarOffset x
+  setBarWidth (ETH2F x) = setBarWidth x
+  setBinContent1 (ETH2F x) = setBinContent1 x
+  setBinContent2 (ETH2F x) = setBinContent2 x
+  setBinContent3 (ETH2F x) = setBinContent3 x
+  setBinError1 (ETH2F x) = setBinError1 x
+  setBinError2 (ETH2F x) = setBinError2 x
+  setBinError3 (ETH2F x) = setBinError3 x
+  setBins1 (ETH2F x) = setBins1 x
+  setBins2 (ETH2F x) = setBins2 x
+  setBins3 (ETH2F x) = setBins3 x
+  setBinsLength (ETH2F x) = setBinsLength x
+  setBuffer (ETH2F x) = setBuffer x
+  setCellContent (ETH2F x) = setCellContent x
+  setContent (ETH2F x) = setContent x
+  setContour (ETH2F x) = setContour x
+  setContourLevel (ETH2F x) = setContourLevel x
+  setDirectory (ETH2F x) = setDirectory x
+  setEntries (ETH2F x) = setEntries x
+  setError (ETH2F x) = setError x
+  setLabelColorA (ETH2F x) = setLabelColorA x
+  setLabelSizeA (ETH2F x) = setLabelSizeA x
+  setLabelFontA (ETH2F x) = setLabelFontA x
+  setLabelOffsetA (ETH2F x) = setLabelOffsetA x
+  setMaximum (ETH2F x) = setMaximum x
+  setMinimum (ETH2F x) = setMinimum x
+  setNormFactor (ETH2F x) = setNormFactor x
+  setStats (ETH2F x) = setStats x
+  setOption (ETH2F x) = setOption x
+  setXTitle (ETH2F x) = setXTitle x
+  setYTitle (ETH2F x) = setYTitle x
+  setZTitle (ETH2F x) = setZTitle x
+  showBackground (ETH2F x) = showBackground x
+  showPeaks (ETH2F x) = showPeaks x
+  smooth (ETH2F x) = smooth x
+  sumw2 (ETH2F x) = sumw2 x
+instance ITObject (Exist TH2F) where
+  draw (ETH2F x) = draw x
+  findObject (ETH2F x) = findObject x
+  getName (ETH2F x) = getName x
+  isA (ETH2F x) = isA x
+  paint (ETH2F x) = paint x
+  printObj (ETH2F x) = printObj x
+  saveAs (ETH2F x) = saveAs x
+  write (ETH2F x) = write x
+instance ITAttLine (Exist TH2F) where
+  getLineColor (ETH2F x) = getLineColor x
+  getLineStyle (ETH2F x) = getLineStyle x
+  getLineWidth (ETH2F x) = getLineWidth x
+  resetAttLine (ETH2F x) = resetAttLine x
+  setLineAttributes (ETH2F x) = setLineAttributes x
+  setLineColor (ETH2F x) = setLineColor x
+  setLineStyle (ETH2F x) = setLineStyle x
+  setLineWidth (ETH2F x) = setLineWidth x
+instance ITAttFill (Exist TH2F) where
+  setFillColor (ETH2F x) = setFillColor x
+  setFillStyle (ETH2F x) = setFillStyle x
+instance ITAttMarker (Exist TH2F) where
+  getMarkerColor (ETH2F x) = getMarkerColor x
+  getMarkerStyle (ETH2F x) = getMarkerStyle x
+  getMarkerSize (ETH2F x) = getMarkerSize x
+  resetAttMarker (ETH2F x) = resetAttMarker x
+  setMarkerAttributes (ETH2F x) = setMarkerAttributes x
+  setMarkerColor (ETH2F x) = setMarkerColor x
+  setMarkerStyle (ETH2F x) = setMarkerStyle x
+  setMarkerSize (ETH2F x) = setMarkerSize x
+instance IDeletable (Exist TH2F) where
+  delete (ETH2F x) = delete x
+instance ITArray (Exist TH2F) where
+
+
+
+newTH2F :: CString -> CString -> CInt -> CDouble -> CDouble -> CInt -> CDouble -> CDouble -> IO TH2F
+newTH2F = xform7 c_th2f_newth2f
+
+
+
+
+
+instance FPtr (Exist TH2F) where
+  type Raw (Exist TH2F) = RawTH2F
+  get_fptr (ETH2F obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH2F (cast_fptr_to_obj (fptr :: ForeignPtr RawTH2F) :: TH2F)
diff --git a/src/HROOT/Hist/TH2F/Interface.hs b/src/HROOT/Hist/TH2F/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2F/Interface.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH2F.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH2F.RawType
+
+import HROOT.Hist.TH2.Interface
+import HROOT.Core.TArrayF.Interface
+---- ============ ----
+
+
+
+class (ITH2 a,ITArrayF a) => ITH2F a where
+
+instance Existable TH2F where
+  data Exist TH2F = forall a. (FPtr a, ITH2F a) => ETH2F a
+
+upcastTH2F :: (FPtr a, ITH2F a) => a -> TH2F
+upcastTH2F h = let fh = get_fptr h
+                   fh2 :: ForeignPtr RawTH2F = castForeignPtr fh
+               in cast_fptr_to_obj fh2
+
+downcastTH2F :: (FPtr a, ITH2F a) => TH2F -> a 
+downcastTH2F h = let fh = get_fptr h
+                     fh2 = castForeignPtr fh
+                 in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH2F/RawType.hs b/src/HROOT/Hist/TH2F/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2F/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH2F.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH2F
+newtype TH2F = TH2F (ForeignPtr RawTH2F) deriving (Eq, Ord, Show)
+instance FPtr TH2F where
+   type Raw TH2F = RawTH2F
+   get_fptr (TH2F fptr) = fptr
+   cast_fptr_to_obj = TH2F
diff --git a/src/HROOT/Hist/TH2I.hs b/src/HROOT/Hist/TH2I.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2I.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TH2I
+  (
+    TH2I(..)
+  , ITH2I
+  , upcastTH2I
+  , downcastTH2I
+
+ 
+  ) where
+
+import HROOT.Hist.TH2I.RawType
+import HROOT.Hist.TH2I.Interface
+import HROOT.Hist.TH2I.Implementation
+
+
diff --git a/src/HROOT/Hist/TH2I/Cast.hs b/src/HROOT/Hist/TH2I/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2I/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH2I.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH2I.RawType
+import HROOT.Hist.TH2I.Interface
+
+instance (ITH2I a, FPtr a) => Castable a (Ptr RawTH2I) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH2I (Ptr RawTH2I) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH2I/FFI.hsc b/src/HROOT/Hist/TH2I/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2I/FFI.hsc
@@ -0,0 +1,547 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH2I.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH2I.RawType
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH2.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TObjArray.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTH2I.h"
+
+foreign import ccall "HROOTHistTH2I.h TH2I_fill2" c_th2i_fill2 
+  :: (Ptr RawTH2I) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_fill2w" c_th2i_fill2w 
+  :: (Ptr RawTH2I) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_fillN2" c_th2i_filln2 
+  :: (Ptr RawTH2I) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_fillRandom2" c_th2i_fillrandom2 
+  :: (Ptr RawTH2I) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_findFirstBinAbove2" c_th2i_findfirstbinabove2 
+  :: (Ptr RawTH2I) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_findLastBinAbove2" c_th2i_findlastbinabove2 
+  :: (Ptr RawTH2I) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_FitSlicesX" c_th2i_fitslicesx 
+  :: (Ptr RawTH2I) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CString -> (Ptr RawTObjArray) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_FitSlicesY" c_th2i_fitslicesy 
+  :: (Ptr RawTH2I) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CString -> (Ptr RawTObjArray) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_getCorrelationFactor2" c_th2i_getcorrelationfactor2 
+  :: (Ptr RawTH2I) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_getCovariance2" c_th2i_getcovariance2 
+  :: (Ptr RawTH2I) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_integral2" c_th2i_integral2 
+  :: (Ptr RawTH2I) -> CInt -> CInt -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_rebinX2" c_th2i_rebinx2 
+  :: (Ptr RawTH2I) -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2I.h TH2I_rebinY2" c_th2i_rebiny2 
+  :: (Ptr RawTH2I) -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2I.h TH2I_Rebin2D" c_th2i_rebin2d 
+  :: (Ptr RawTH2I) -> CInt -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetShowProjectionX" c_th2i_setshowprojectionx 
+  :: (Ptr RawTH2I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetShowProjectionY" c_th2i_setshowprojectiony 
+  :: (Ptr RawTH2I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_Add" c_th2i_add 
+  :: (Ptr RawTH2I) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_AddBinContent" c_th2i_addbincontent 
+  :: (Ptr RawTH2I) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_Chi2Test" c_th2i_chi2test 
+  :: (Ptr RawTH2I) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_ComputeIntegral" c_th2i_computeintegral 
+  :: (Ptr RawTH2I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_DirectoryAutoAdd" c_th2i_directoryautoadd 
+  :: (Ptr RawTH2I) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_Divide" c_th2i_divide 
+  :: (Ptr RawTH2I) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_drawCopyTH1" c_th2i_drawcopyth1 
+  :: (Ptr RawTH2I) -> CString -> IO (Ptr RawTH2I)
+
+foreign import ccall "HROOTHistTH2I.h TH2I_DrawNormalized" c_th2i_drawnormalized 
+  :: (Ptr RawTH2I) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2I.h TH2I_drawPanelTH1" c_th2i_drawpanelth1 
+  :: (Ptr RawTH2I) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_BufferEmpty" c_th2i_bufferempty 
+  :: (Ptr RawTH2I) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_evalF" c_th2i_evalf 
+  :: (Ptr RawTH2I) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_FFT" c_th2i_fft 
+  :: (Ptr RawTH2I) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2I.h TH2I_fill1" c_th2i_fill1 
+  :: (Ptr RawTH2I) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_fill1w" c_th2i_fill1w 
+  :: (Ptr RawTH2I) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_fillN1" c_th2i_filln1 
+  :: (Ptr RawTH2I) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_FillRandom" c_th2i_fillrandom 
+  :: (Ptr RawTH2I) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_FindBin" c_th2i_findbin 
+  :: (Ptr RawTH2I) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_FindFixBin" c_th2i_findfixbin 
+  :: (Ptr RawTH2I) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_FindFirstBinAbove" c_th2i_findfirstbinabove 
+  :: (Ptr RawTH2I) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_FindLastBinAbove" c_th2i_findlastbinabove 
+  :: (Ptr RawTH2I) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_FitPanelTH1" c_th2i_fitpanelth1 
+  :: (Ptr RawTH2I) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_getNdivisionA" c_th2i_getndivisiona 
+  :: (Ptr RawTH2I) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_getAxisColorA" c_th2i_getaxiscolora 
+  :: (Ptr RawTH2I) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_getLabelColorA" c_th2i_getlabelcolora 
+  :: (Ptr RawTH2I) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_getLabelFontA" c_th2i_getlabelfonta 
+  :: (Ptr RawTH2I) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_getLabelOffsetA" c_th2i_getlabeloffseta 
+  :: (Ptr RawTH2I) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_getLabelSizeA" c_th2i_getlabelsizea 
+  :: (Ptr RawTH2I) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_getTitleFontA" c_th2i_gettitlefonta 
+  :: (Ptr RawTH2I) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_getTitleOffsetA" c_th2i_gettitleoffseta 
+  :: (Ptr RawTH2I) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_getTitleSizeA" c_th2i_gettitlesizea 
+  :: (Ptr RawTH2I) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_getTickLengthA" c_th2i_getticklengtha 
+  :: (Ptr RawTH2I) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetBarOffset" c_th2i_getbaroffset 
+  :: (Ptr RawTH2I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetBarWidth" c_th2i_getbarwidth 
+  :: (Ptr RawTH2I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetContour" c_th2i_getcontour 
+  :: (Ptr RawTH2I) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetContourLevel" c_th2i_getcontourlevel 
+  :: (Ptr RawTH2I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetContourLevelPad" c_th2i_getcontourlevelpad 
+  :: (Ptr RawTH2I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetBin" c_th2i_getbin 
+  :: (Ptr RawTH2I) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetBinCenter" c_th2i_getbincenter 
+  :: (Ptr RawTH2I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetBinContent1" c_th2i_getbincontent1 
+  :: (Ptr RawTH2I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetBinContent2" c_th2i_getbincontent2 
+  :: (Ptr RawTH2I) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetBinContent3" c_th2i_getbincontent3 
+  :: (Ptr RawTH2I) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetBinError1" c_th2i_getbinerror1 
+  :: (Ptr RawTH2I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetBinError2" c_th2i_getbinerror2 
+  :: (Ptr RawTH2I) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetBinError3" c_th2i_getbinerror3 
+  :: (Ptr RawTH2I) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetBinLowEdge" c_th2i_getbinlowedge 
+  :: (Ptr RawTH2I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetBinWidth" c_th2i_getbinwidth 
+  :: (Ptr RawTH2I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetCellContent" c_th2i_getcellcontent 
+  :: (Ptr RawTH2I) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetCellError" c_th2i_getcellerror 
+  :: (Ptr RawTH2I) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetEntries" c_th2i_getentries 
+  :: (Ptr RawTH2I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetEffectiveEntries" c_th2i_geteffectiveentries 
+  :: (Ptr RawTH2I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetFunction" c_th2i_getfunction 
+  :: (Ptr RawTH2I) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetDimension" c_th2i_getdimension 
+  :: (Ptr RawTH2I) -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetKurtosis" c_th2i_getkurtosis 
+  :: (Ptr RawTH2I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetLowEdge" c_th2i_getlowedge 
+  :: (Ptr RawTH2I) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_getMaximumTH1" c_th2i_getmaximumth1 
+  :: (Ptr RawTH2I) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetMaximumBin" c_th2i_getmaximumbin 
+  :: (Ptr RawTH2I) -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetMaximumStored" c_th2i_getmaximumstored 
+  :: (Ptr RawTH2I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_getMinimumTH1" c_th2i_getminimumth1 
+  :: (Ptr RawTH2I) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetMinimumBin" c_th2i_getminimumbin 
+  :: (Ptr RawTH2I) -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetMinimumStored" c_th2i_getminimumstored 
+  :: (Ptr RawTH2I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetMean" c_th2i_getmean 
+  :: (Ptr RawTH2I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetMeanError" c_th2i_getmeanerror 
+  :: (Ptr RawTH2I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetNbinsX" c_th2i_getnbinsx 
+  :: (Ptr RawTH2I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetNbinsY" c_th2i_getnbinsy 
+  :: (Ptr RawTH2I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetNbinsZ" c_th2i_getnbinsz 
+  :: (Ptr RawTH2I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_getQuantilesTH1" c_th2i_getquantilesth1 
+  :: (Ptr RawTH2I) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetRandom" c_th2i_getrandom 
+  :: (Ptr RawTH2I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetStats" c_th2i_getstats 
+  :: (Ptr RawTH2I) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetSumOfWeights" c_th2i_getsumofweights 
+  :: (Ptr RawTH2I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetSumw2" c_th2i_getsumw2 
+  :: (Ptr RawTH2I) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetSumw2N" c_th2i_getsumw2n 
+  :: (Ptr RawTH2I) -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetRMS" c_th2i_getrms 
+  :: (Ptr RawTH2I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetRMSError" c_th2i_getrmserror 
+  :: (Ptr RawTH2I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetSkewness" c_th2i_getskewness 
+  :: (Ptr RawTH2I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_integral1" c_th2i_integral1 
+  :: (Ptr RawTH2I) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_interpolate1" c_th2i_interpolate1 
+  :: (Ptr RawTH2I) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_interpolate2" c_th2i_interpolate2 
+  :: (Ptr RawTH2I) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_interpolate3" c_th2i_interpolate3 
+  :: (Ptr RawTH2I) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_KolmogorovTest" c_th2i_kolmogorovtest 
+  :: (Ptr RawTH2I) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_LabelsDeflate" c_th2i_labelsdeflate 
+  :: (Ptr RawTH2I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_LabelsInflate" c_th2i_labelsinflate 
+  :: (Ptr RawTH2I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_LabelsOption" c_th2i_labelsoption 
+  :: (Ptr RawTH2I) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_multiflyF" c_th2i_multiflyf 
+  :: (Ptr RawTH2I) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_Multiply" c_th2i_multiply 
+  :: (Ptr RawTH2I) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_PutStats" c_th2i_putstats 
+  :: (Ptr RawTH2I) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_Rebin" c_th2i_rebin 
+  :: (Ptr RawTH2I) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2I.h TH2I_RebinAxis" c_th2i_rebinaxis 
+  :: (Ptr RawTH2I) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_Rebuild" c_th2i_rebuild 
+  :: (Ptr RawTH2I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_RecursiveRemove" c_th2i_recursiveremove 
+  :: (Ptr RawTH2I) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_Reset" c_th2i_reset 
+  :: (Ptr RawTH2I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_ResetStats" c_th2i_resetstats 
+  :: (Ptr RawTH2I) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_Scale" c_th2i_scale 
+  :: (Ptr RawTH2I) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_setAxisColorA" c_th2i_setaxiscolora 
+  :: (Ptr RawTH2I) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetAxisRange" c_th2i_setaxisrange 
+  :: (Ptr RawTH2I) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetBarOffset" c_th2i_setbaroffset 
+  :: (Ptr RawTH2I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetBarWidth" c_th2i_setbarwidth 
+  :: (Ptr RawTH2I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_setBinContent1" c_th2i_setbincontent1 
+  :: (Ptr RawTH2I) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_setBinContent2" c_th2i_setbincontent2 
+  :: (Ptr RawTH2I) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_setBinContent3" c_th2i_setbincontent3 
+  :: (Ptr RawTH2I) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_setBinError1" c_th2i_setbinerror1 
+  :: (Ptr RawTH2I) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_setBinError2" c_th2i_setbinerror2 
+  :: (Ptr RawTH2I) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_setBinError3" c_th2i_setbinerror3 
+  :: (Ptr RawTH2I) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_setBins1" c_th2i_setbins1 
+  :: (Ptr RawTH2I) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_setBins2" c_th2i_setbins2 
+  :: (Ptr RawTH2I) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_setBins3" c_th2i_setbins3 
+  :: (Ptr RawTH2I) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetBinsLength" c_th2i_setbinslength 
+  :: (Ptr RawTH2I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetBuffer" c_th2i_setbuffer 
+  :: (Ptr RawTH2I) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetCellContent" c_th2i_setcellcontent 
+  :: (Ptr RawTH2I) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetContent" c_th2i_setcontent 
+  :: (Ptr RawTH2I) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetContour" c_th2i_setcontour 
+  :: (Ptr RawTH2I) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetContourLevel" c_th2i_setcontourlevel 
+  :: (Ptr RawTH2I) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetDirectory" c_th2i_setdirectory 
+  :: (Ptr RawTH2I) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetEntries" c_th2i_setentries 
+  :: (Ptr RawTH2I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetError" c_th2i_seterror 
+  :: (Ptr RawTH2I) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_setLabelColorA" c_th2i_setlabelcolora 
+  :: (Ptr RawTH2I) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_setLabelSizeA" c_th2i_setlabelsizea 
+  :: (Ptr RawTH2I) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_setLabelFontA" c_th2i_setlabelfonta 
+  :: (Ptr RawTH2I) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_setLabelOffsetA" c_th2i_setlabeloffseta 
+  :: (Ptr RawTH2I) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetMaximum" c_th2i_setmaximum 
+  :: (Ptr RawTH2I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetMinimum" c_th2i_setminimum 
+  :: (Ptr RawTH2I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetNormFactor" c_th2i_setnormfactor 
+  :: (Ptr RawTH2I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetStats" c_th2i_setstats 
+  :: (Ptr RawTH2I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetOption" c_th2i_setoption 
+  :: (Ptr RawTH2I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetXTitle" c_th2i_setxtitle 
+  :: (Ptr RawTH2I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetYTitle" c_th2i_setytitle 
+  :: (Ptr RawTH2I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetZTitle" c_th2i_setztitle 
+  :: (Ptr RawTH2I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_ShowBackground" c_th2i_showbackground 
+  :: (Ptr RawTH2I) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2I.h TH2I_ShowPeaks" c_th2i_showpeaks 
+  :: (Ptr RawTH2I) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_Smooth" c_th2i_smooth 
+  :: (Ptr RawTH2I) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_Sumw2" c_th2i_sumw2 
+  :: (Ptr RawTH2I) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_Draw" c_th2i_draw 
+  :: (Ptr RawTH2I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_FindObject" c_th2i_findobject 
+  :: (Ptr RawTH2I) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetName" c_th2i_getname 
+  :: (Ptr RawTH2I) -> IO CString
+
+foreign import ccall "HROOTHistTH2I.h TH2I_IsA" c_th2i_isa 
+  :: (Ptr RawTH2I) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH2I.h TH2I_Paint" c_th2i_paint 
+  :: (Ptr RawTH2I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_printObj" c_th2i_printobj 
+  :: (Ptr RawTH2I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SaveAs" c_th2i_saveas 
+  :: (Ptr RawTH2I) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_Write" c_th2i_write 
+  :: (Ptr RawTH2I) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetLineColor" c_th2i_getlinecolor 
+  :: (Ptr RawTH2I) -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetLineStyle" c_th2i_getlinestyle 
+  :: (Ptr RawTH2I) -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetLineWidth" c_th2i_getlinewidth 
+  :: (Ptr RawTH2I) -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_ResetAttLine" c_th2i_resetattline 
+  :: (Ptr RawTH2I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetLineAttributes" c_th2i_setlineattributes 
+  :: (Ptr RawTH2I) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetLineColor" c_th2i_setlinecolor 
+  :: (Ptr RawTH2I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetLineStyle" c_th2i_setlinestyle 
+  :: (Ptr RawTH2I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetLineWidth" c_th2i_setlinewidth 
+  :: (Ptr RawTH2I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetFillColor" c_th2i_setfillcolor 
+  :: (Ptr RawTH2I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetFillStyle" c_th2i_setfillstyle 
+  :: (Ptr RawTH2I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetMarkerColor" c_th2i_getmarkercolor 
+  :: (Ptr RawTH2I) -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetMarkerStyle" c_th2i_getmarkerstyle 
+  :: (Ptr RawTH2I) -> IO CInt
+
+foreign import ccall "HROOTHistTH2I.h TH2I_GetMarkerSize" c_th2i_getmarkersize 
+  :: (Ptr RawTH2I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2I.h TH2I_ResetAttMarker" c_th2i_resetattmarker 
+  :: (Ptr RawTH2I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetMarkerAttributes" c_th2i_setmarkerattributes 
+  :: (Ptr RawTH2I) -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetMarkerColor" c_th2i_setmarkercolor 
+  :: (Ptr RawTH2I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetMarkerStyle" c_th2i_setmarkerstyle 
+  :: (Ptr RawTH2I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_SetMarkerSize" c_th2i_setmarkersize 
+  :: (Ptr RawTH2I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2I.h TH2I_delete" c_th2i_delete 
+  :: (Ptr RawTH2I) -> IO ()
+
diff --git a/src/HROOT/Hist/TH2I/Implementation.hs b/src/HROOT/Hist/TH2I/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2I/Implementation.hs
@@ -0,0 +1,451 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH2I.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH2I.RawType
+import HROOT.Hist.TH2I.FFI
+import HROOT.Hist.TH2I.Interface
+import HROOT.Hist.TH2I.Cast
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1D.Cast
+import HROOT.Hist.TH1D.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TObjArray.RawType
+import HROOT.Core.TObjArray.Cast
+import HROOT.Core.TObjArray.Interface
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH2.RawType
+import HROOT.Hist.TH2.Cast
+import HROOT.Hist.TH2.Interface
+import HROOT.Core.TArrayI.RawType
+import HROOT.Core.TArrayI.Cast
+import HROOT.Core.TArrayI.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+import HROOT.Core.TArray.RawType
+import HROOT.Core.TArray.Cast
+import HROOT.Core.TArray.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH2I TH2I where
+instance ITH2 TH2I where
+  fill2 = xform2 c_th2i_fill2
+  fill2w = xform3 c_th2i_fill2w
+  fillN2 = xform5 c_th2i_filln2
+  fillRandom2 = xform2 c_th2i_fillrandom2
+  findFirstBinAbove2 = xform2 c_th2i_findfirstbinabove2
+  findLastBinAbove2 = xform2 c_th2i_findlastbinabove2
+  fitSlicesX = xform6 c_th2i_fitslicesx
+  fitSlicesY = xform6 c_th2i_fitslicesy
+  getCorrelationFactor2 = xform2 c_th2i_getcorrelationfactor2
+  getCovariance2 = xform2 c_th2i_getcovariance2
+  integral2 = xform5 c_th2i_integral2
+  rebinX2 = xform2 c_th2i_rebinx2
+  rebinY2 = xform2 c_th2i_rebiny2
+  rebin2D = xform3 c_th2i_rebin2d
+  setShowProjectionX = xform1 c_th2i_setshowprojectionx
+  setShowProjectionY = xform1 c_th2i_setshowprojectiony
+instance ITArrayI TH2I where
+instance ITH1 TH2I where
+  add = xform2 c_th2i_add
+  addBinContent = xform2 c_th2i_addbincontent
+  chi2Test = xform3 c_th2i_chi2test
+  computeIntegral = xform0 c_th2i_computeintegral
+  directoryAutoAdd = xform1 c_th2i_directoryautoadd
+  divide = xform5 c_th2i_divide
+  drawCopyTH1 = xform1 c_th2i_drawcopyth1
+  drawNormalized = xform2 c_th2i_drawnormalized
+  drawPanelTH1 = xform0 c_th2i_drawpanelth1
+  bufferEmpty = xform1 c_th2i_bufferempty
+  evalF = xform2 c_th2i_evalf
+  fFT = xform2 c_th2i_fft
+  fill1 = xform1 c_th2i_fill1
+  fill1w = xform2 c_th2i_fill1w
+  fillN1 = xform4 c_th2i_filln1
+  fillRandom = xform2 c_th2i_fillrandom
+  findBin = xform3 c_th2i_findbin
+  findFixBin = xform3 c_th2i_findfixbin
+  findFirstBinAbove = xform2 c_th2i_findfirstbinabove
+  findLastBinAbove = xform2 c_th2i_findlastbinabove
+  fitPanelTH1 = xform0 c_th2i_fitpanelth1
+  getNdivisionA = xform1 c_th2i_getndivisiona
+  getAxisColorA = xform1 c_th2i_getaxiscolora
+  getLabelColorA = xform1 c_th2i_getlabelcolora
+  getLabelFontA = xform1 c_th2i_getlabelfonta
+  getLabelOffsetA = xform1 c_th2i_getlabeloffseta
+  getLabelSizeA = xform1 c_th2i_getlabelsizea
+  getTitleFontA = xform1 c_th2i_gettitlefonta
+  getTitleOffsetA = xform1 c_th2i_gettitleoffseta
+  getTitleSizeA = xform1 c_th2i_gettitlesizea
+  getTickLengthA = xform1 c_th2i_getticklengtha
+  getBarOffset = xform0 c_th2i_getbaroffset
+  getBarWidth = xform0 c_th2i_getbarwidth
+  getContour = xform1 c_th2i_getcontour
+  getContourLevel = xform1 c_th2i_getcontourlevel
+  getContourLevelPad = xform1 c_th2i_getcontourlevelpad
+  getBin = xform3 c_th2i_getbin
+  getBinCenter = xform1 c_th2i_getbincenter
+  getBinContent1 = xform1 c_th2i_getbincontent1
+  getBinContent2 = xform2 c_th2i_getbincontent2
+  getBinContent3 = xform3 c_th2i_getbincontent3
+  getBinError1 = xform1 c_th2i_getbinerror1
+  getBinError2 = xform2 c_th2i_getbinerror2
+  getBinError3 = xform3 c_th2i_getbinerror3
+  getBinLowEdge = xform1 c_th2i_getbinlowedge
+  getBinWidth = xform1 c_th2i_getbinwidth
+  getCellContent = xform2 c_th2i_getcellcontent
+  getCellError = xform2 c_th2i_getcellerror
+  getEntries = xform0 c_th2i_getentries
+  getEffectiveEntries = xform0 c_th2i_geteffectiveentries
+  getFunction = xform1 c_th2i_getfunction
+  getDimension = xform0 c_th2i_getdimension
+  getKurtosis = xform1 c_th2i_getkurtosis
+  getLowEdge = xform1 c_th2i_getlowedge
+  getMaximumTH1 = xform1 c_th2i_getmaximumth1
+  getMaximumBin = xform0 c_th2i_getmaximumbin
+  getMaximumStored = xform0 c_th2i_getmaximumstored
+  getMinimumTH1 = xform1 c_th2i_getminimumth1
+  getMinimumBin = xform0 c_th2i_getminimumbin
+  getMinimumStored = xform0 c_th2i_getminimumstored
+  getMean = xform1 c_th2i_getmean
+  getMeanError = xform1 c_th2i_getmeanerror
+  getNbinsX = xform0 c_th2i_getnbinsx
+  getNbinsY = xform0 c_th2i_getnbinsy
+  getNbinsZ = xform0 c_th2i_getnbinsz
+  getQuantilesTH1 = xform3 c_th2i_getquantilesth1
+  getRandom = xform0 c_th2i_getrandom
+  getStats = xform1 c_th2i_getstats
+  getSumOfWeights = xform0 c_th2i_getsumofweights
+  getSumw2 = xform0 c_th2i_getsumw2
+  getSumw2N = xform0 c_th2i_getsumw2n
+  getRMS = xform1 c_th2i_getrms
+  getRMSError = xform1 c_th2i_getrmserror
+  getSkewness = xform1 c_th2i_getskewness
+  integral1 = xform3 c_th2i_integral1
+  interpolate1 = xform1 c_th2i_interpolate1
+  interpolate2 = xform2 c_th2i_interpolate2
+  interpolate3 = xform3 c_th2i_interpolate3
+  kolmogorovTest = xform2 c_th2i_kolmogorovtest
+  labelsDeflate = xform1 c_th2i_labelsdeflate
+  labelsInflate = xform1 c_th2i_labelsinflate
+  labelsOption = xform2 c_th2i_labelsoption
+  multiflyF = xform2 c_th2i_multiflyf
+  multiply = xform5 c_th2i_multiply
+  putStats = xform1 c_th2i_putstats
+  rebin = xform3 c_th2i_rebin
+  rebinAxis = xform2 c_th2i_rebinaxis
+  rebuild = xform1 c_th2i_rebuild
+  recursiveRemove = xform1 c_th2i_recursiveremove
+  reset = xform1 c_th2i_reset
+  resetStats = xform0 c_th2i_resetstats
+  scale = xform2 c_th2i_scale
+  setAxisColorA = xform2 c_th2i_setaxiscolora
+  setAxisRange = xform3 c_th2i_setaxisrange
+  setBarOffset = xform1 c_th2i_setbaroffset
+  setBarWidth = xform1 c_th2i_setbarwidth
+  setBinContent1 = xform2 c_th2i_setbincontent1
+  setBinContent2 = xform3 c_th2i_setbincontent2
+  setBinContent3 = xform4 c_th2i_setbincontent3
+  setBinError1 = xform2 c_th2i_setbinerror1
+  setBinError2 = xform3 c_th2i_setbinerror2
+  setBinError3 = xform4 c_th2i_setbinerror3
+  setBins1 = xform2 c_th2i_setbins1
+  setBins2 = xform4 c_th2i_setbins2
+  setBins3 = xform6 c_th2i_setbins3
+  setBinsLength = xform1 c_th2i_setbinslength
+  setBuffer = xform2 c_th2i_setbuffer
+  setCellContent = xform3 c_th2i_setcellcontent
+  setContent = xform1 c_th2i_setcontent
+  setContour = xform2 c_th2i_setcontour
+  setContourLevel = xform2 c_th2i_setcontourlevel
+  setDirectory = xform1 c_th2i_setdirectory
+  setEntries = xform1 c_th2i_setentries
+  setError = xform1 c_th2i_seterror
+  setLabelColorA = xform2 c_th2i_setlabelcolora
+  setLabelSizeA = xform2 c_th2i_setlabelsizea
+  setLabelFontA = xform2 c_th2i_setlabelfonta
+  setLabelOffsetA = xform2 c_th2i_setlabeloffseta
+  setMaximum = xform1 c_th2i_setmaximum
+  setMinimum = xform1 c_th2i_setminimum
+  setNormFactor = xform1 c_th2i_setnormfactor
+  setStats = xform1 c_th2i_setstats
+  setOption = xform1 c_th2i_setoption
+  setXTitle = xform1 c_th2i_setxtitle
+  setYTitle = xform1 c_th2i_setytitle
+  setZTitle = xform1 c_th2i_setztitle
+  showBackground = xform2 c_th2i_showbackground
+  showPeaks = xform3 c_th2i_showpeaks
+  smooth = xform2 c_th2i_smooth
+  sumw2 = xform0 c_th2i_sumw2
+instance ITObject TH2I where
+  draw = xform1 c_th2i_draw
+  findObject = xform1 c_th2i_findobject
+  getName = xform0 c_th2i_getname
+  isA = xform0 c_th2i_isa
+  paint = xform1 c_th2i_paint
+  printObj = xform1 c_th2i_printobj
+  saveAs = xform2 c_th2i_saveas
+  write = xform3 c_th2i_write
+instance ITAttLine TH2I where
+  getLineColor = xform0 c_th2i_getlinecolor
+  getLineStyle = xform0 c_th2i_getlinestyle
+  getLineWidth = xform0 c_th2i_getlinewidth
+  resetAttLine = xform1 c_th2i_resetattline
+  setLineAttributes = xform0 c_th2i_setlineattributes
+  setLineColor = xform1 c_th2i_setlinecolor
+  setLineStyle = xform1 c_th2i_setlinestyle
+  setLineWidth = xform1 c_th2i_setlinewidth
+instance ITAttFill TH2I where
+  setFillColor = xform1 c_th2i_setfillcolor
+  setFillStyle = xform1 c_th2i_setfillstyle
+instance ITAttMarker TH2I where
+  getMarkerColor = xform0 c_th2i_getmarkercolor
+  getMarkerStyle = xform0 c_th2i_getmarkerstyle
+  getMarkerSize = xform0 c_th2i_getmarkersize
+  resetAttMarker = xform1 c_th2i_resetattmarker
+  setMarkerAttributes = xform0 c_th2i_setmarkerattributes
+  setMarkerColor = xform1 c_th2i_setmarkercolor
+  setMarkerStyle = xform1 c_th2i_setmarkerstyle
+  setMarkerSize = xform1 c_th2i_setmarkersize
+instance IDeletable TH2I where
+  delete = xform0 c_th2i_delete
+instance ITArray TH2I where
+
+instance ITH2I (Exist TH2I) where
+
+instance ITH2 (Exist TH2I) where
+  fill2 (ETH2I x) = fill2 x
+  fill2w (ETH2I x) = fill2w x
+  fillN2 (ETH2I x) = fillN2 x
+  fillRandom2 (ETH2I x) = fillRandom2 x
+  findFirstBinAbove2 (ETH2I x) = findFirstBinAbove2 x
+  findLastBinAbove2 (ETH2I x) = findLastBinAbove2 x
+  fitSlicesX (ETH2I x) = fitSlicesX x
+  fitSlicesY (ETH2I x) = fitSlicesY x
+  getCorrelationFactor2 (ETH2I x) = getCorrelationFactor2 x
+  getCovariance2 (ETH2I x) = getCovariance2 x
+  integral2 (ETH2I x) = integral2 x
+  rebinX2 (ETH2I x) = rebinX2 x
+  rebinY2 (ETH2I x) = rebinY2 x
+  rebin2D (ETH2I x) = rebin2D x
+  setShowProjectionX (ETH2I x) = setShowProjectionX x
+  setShowProjectionY (ETH2I x) = setShowProjectionY x
+instance ITArrayI (Exist TH2I) where
+
+instance ITH1 (Exist TH2I) where
+  add (ETH2I x) = add x
+  addBinContent (ETH2I x) = addBinContent x
+  chi2Test (ETH2I x) = chi2Test x
+  computeIntegral (ETH2I x) = computeIntegral x
+  directoryAutoAdd (ETH2I x) = directoryAutoAdd x
+  divide (ETH2I x) = divide x
+  drawCopyTH1 (ETH2I x) a1 = return . ETH2I =<< drawCopyTH1 x a1
+  drawNormalized (ETH2I x) = drawNormalized x
+  drawPanelTH1 (ETH2I x) = drawPanelTH1 x
+  bufferEmpty (ETH2I x) = bufferEmpty x
+  evalF (ETH2I x) = evalF x
+  fFT (ETH2I x) = fFT x
+  fill1 (ETH2I x) = fill1 x
+  fill1w (ETH2I x) = fill1w x
+  fillN1 (ETH2I x) = fillN1 x
+  fillRandom (ETH2I x) = fillRandom x
+  findBin (ETH2I x) = findBin x
+  findFixBin (ETH2I x) = findFixBin x
+  findFirstBinAbove (ETH2I x) = findFirstBinAbove x
+  findLastBinAbove (ETH2I x) = findLastBinAbove x
+  fitPanelTH1 (ETH2I x) = fitPanelTH1 x
+  getNdivisionA (ETH2I x) = getNdivisionA x
+  getAxisColorA (ETH2I x) = getAxisColorA x
+  getLabelColorA (ETH2I x) = getLabelColorA x
+  getLabelFontA (ETH2I x) = getLabelFontA x
+  getLabelOffsetA (ETH2I x) = getLabelOffsetA x
+  getLabelSizeA (ETH2I x) = getLabelSizeA x
+  getTitleFontA (ETH2I x) = getTitleFontA x
+  getTitleOffsetA (ETH2I x) = getTitleOffsetA x
+  getTitleSizeA (ETH2I x) = getTitleSizeA x
+  getTickLengthA (ETH2I x) = getTickLengthA x
+  getBarOffset (ETH2I x) = getBarOffset x
+  getBarWidth (ETH2I x) = getBarWidth x
+  getContour (ETH2I x) = getContour x
+  getContourLevel (ETH2I x) = getContourLevel x
+  getContourLevelPad (ETH2I x) = getContourLevelPad x
+  getBin (ETH2I x) = getBin x
+  getBinCenter (ETH2I x) = getBinCenter x
+  getBinContent1 (ETH2I x) = getBinContent1 x
+  getBinContent2 (ETH2I x) = getBinContent2 x
+  getBinContent3 (ETH2I x) = getBinContent3 x
+  getBinError1 (ETH2I x) = getBinError1 x
+  getBinError2 (ETH2I x) = getBinError2 x
+  getBinError3 (ETH2I x) = getBinError3 x
+  getBinLowEdge (ETH2I x) = getBinLowEdge x
+  getBinWidth (ETH2I x) = getBinWidth x
+  getCellContent (ETH2I x) = getCellContent x
+  getCellError (ETH2I x) = getCellError x
+  getEntries (ETH2I x) = getEntries x
+  getEffectiveEntries (ETH2I x) = getEffectiveEntries x
+  getFunction (ETH2I x) = getFunction x
+  getDimension (ETH2I x) = getDimension x
+  getKurtosis (ETH2I x) = getKurtosis x
+  getLowEdge (ETH2I x) = getLowEdge x
+  getMaximumTH1 (ETH2I x) = getMaximumTH1 x
+  getMaximumBin (ETH2I x) = getMaximumBin x
+  getMaximumStored (ETH2I x) = getMaximumStored x
+  getMinimumTH1 (ETH2I x) = getMinimumTH1 x
+  getMinimumBin (ETH2I x) = getMinimumBin x
+  getMinimumStored (ETH2I x) = getMinimumStored x
+  getMean (ETH2I x) = getMean x
+  getMeanError (ETH2I x) = getMeanError x
+  getNbinsX (ETH2I x) = getNbinsX x
+  getNbinsY (ETH2I x) = getNbinsY x
+  getNbinsZ (ETH2I x) = getNbinsZ x
+  getQuantilesTH1 (ETH2I x) = getQuantilesTH1 x
+  getRandom (ETH2I x) = getRandom x
+  getStats (ETH2I x) = getStats x
+  getSumOfWeights (ETH2I x) = getSumOfWeights x
+  getSumw2 (ETH2I x) = getSumw2 x
+  getSumw2N (ETH2I x) = getSumw2N x
+  getRMS (ETH2I x) = getRMS x
+  getRMSError (ETH2I x) = getRMSError x
+  getSkewness (ETH2I x) = getSkewness x
+  integral1 (ETH2I x) = integral1 x
+  interpolate1 (ETH2I x) = interpolate1 x
+  interpolate2 (ETH2I x) = interpolate2 x
+  interpolate3 (ETH2I x) = interpolate3 x
+  kolmogorovTest (ETH2I x) = kolmogorovTest x
+  labelsDeflate (ETH2I x) = labelsDeflate x
+  labelsInflate (ETH2I x) = labelsInflate x
+  labelsOption (ETH2I x) = labelsOption x
+  multiflyF (ETH2I x) = multiflyF x
+  multiply (ETH2I x) = multiply x
+  putStats (ETH2I x) = putStats x
+  rebin (ETH2I x) = rebin x
+  rebinAxis (ETH2I x) = rebinAxis x
+  rebuild (ETH2I x) = rebuild x
+  recursiveRemove (ETH2I x) = recursiveRemove x
+  reset (ETH2I x) = reset x
+  resetStats (ETH2I x) = resetStats x
+  scale (ETH2I x) = scale x
+  setAxisColorA (ETH2I x) = setAxisColorA x
+  setAxisRange (ETH2I x) = setAxisRange x
+  setBarOffset (ETH2I x) = setBarOffset x
+  setBarWidth (ETH2I x) = setBarWidth x
+  setBinContent1 (ETH2I x) = setBinContent1 x
+  setBinContent2 (ETH2I x) = setBinContent2 x
+  setBinContent3 (ETH2I x) = setBinContent3 x
+  setBinError1 (ETH2I x) = setBinError1 x
+  setBinError2 (ETH2I x) = setBinError2 x
+  setBinError3 (ETH2I x) = setBinError3 x
+  setBins1 (ETH2I x) = setBins1 x
+  setBins2 (ETH2I x) = setBins2 x
+  setBins3 (ETH2I x) = setBins3 x
+  setBinsLength (ETH2I x) = setBinsLength x
+  setBuffer (ETH2I x) = setBuffer x
+  setCellContent (ETH2I x) = setCellContent x
+  setContent (ETH2I x) = setContent x
+  setContour (ETH2I x) = setContour x
+  setContourLevel (ETH2I x) = setContourLevel x
+  setDirectory (ETH2I x) = setDirectory x
+  setEntries (ETH2I x) = setEntries x
+  setError (ETH2I x) = setError x
+  setLabelColorA (ETH2I x) = setLabelColorA x
+  setLabelSizeA (ETH2I x) = setLabelSizeA x
+  setLabelFontA (ETH2I x) = setLabelFontA x
+  setLabelOffsetA (ETH2I x) = setLabelOffsetA x
+  setMaximum (ETH2I x) = setMaximum x
+  setMinimum (ETH2I x) = setMinimum x
+  setNormFactor (ETH2I x) = setNormFactor x
+  setStats (ETH2I x) = setStats x
+  setOption (ETH2I x) = setOption x
+  setXTitle (ETH2I x) = setXTitle x
+  setYTitle (ETH2I x) = setYTitle x
+  setZTitle (ETH2I x) = setZTitle x
+  showBackground (ETH2I x) = showBackground x
+  showPeaks (ETH2I x) = showPeaks x
+  smooth (ETH2I x) = smooth x
+  sumw2 (ETH2I x) = sumw2 x
+instance ITObject (Exist TH2I) where
+  draw (ETH2I x) = draw x
+  findObject (ETH2I x) = findObject x
+  getName (ETH2I x) = getName x
+  isA (ETH2I x) = isA x
+  paint (ETH2I x) = paint x
+  printObj (ETH2I x) = printObj x
+  saveAs (ETH2I x) = saveAs x
+  write (ETH2I x) = write x
+instance ITAttLine (Exist TH2I) where
+  getLineColor (ETH2I x) = getLineColor x
+  getLineStyle (ETH2I x) = getLineStyle x
+  getLineWidth (ETH2I x) = getLineWidth x
+  resetAttLine (ETH2I x) = resetAttLine x
+  setLineAttributes (ETH2I x) = setLineAttributes x
+  setLineColor (ETH2I x) = setLineColor x
+  setLineStyle (ETH2I x) = setLineStyle x
+  setLineWidth (ETH2I x) = setLineWidth x
+instance ITAttFill (Exist TH2I) where
+  setFillColor (ETH2I x) = setFillColor x
+  setFillStyle (ETH2I x) = setFillStyle x
+instance ITAttMarker (Exist TH2I) where
+  getMarkerColor (ETH2I x) = getMarkerColor x
+  getMarkerStyle (ETH2I x) = getMarkerStyle x
+  getMarkerSize (ETH2I x) = getMarkerSize x
+  resetAttMarker (ETH2I x) = resetAttMarker x
+  setMarkerAttributes (ETH2I x) = setMarkerAttributes x
+  setMarkerColor (ETH2I x) = setMarkerColor x
+  setMarkerStyle (ETH2I x) = setMarkerStyle x
+  setMarkerSize (ETH2I x) = setMarkerSize x
+instance IDeletable (Exist TH2I) where
+  delete (ETH2I x) = delete x
+instance ITArray (Exist TH2I) where
+
+
+
+
+
+
+
+
+instance FPtr (Exist TH2I) where
+  type Raw (Exist TH2I) = RawTH2I
+  get_fptr (ETH2I obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH2I (cast_fptr_to_obj (fptr :: ForeignPtr RawTH2I) :: TH2I)
diff --git a/src/HROOT/Hist/TH2I/Interface.hs b/src/HROOT/Hist/TH2I/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2I/Interface.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH2I.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH2I.RawType
+
+import HROOT.Hist.TH2.Interface
+import HROOT.Core.TArrayI.Interface
+---- ============ ----
+
+
+
+class (ITH2 a,ITArrayI a) => ITH2I a where
+
+instance Existable TH2I where
+  data Exist TH2I = forall a. (FPtr a, ITH2I a) => ETH2I a
+
+upcastTH2I :: (FPtr a, ITH2I a) => a -> TH2I
+upcastTH2I h = let fh = get_fptr h
+                   fh2 :: ForeignPtr RawTH2I = castForeignPtr fh
+               in cast_fptr_to_obj fh2
+
+downcastTH2I :: (FPtr a, ITH2I a) => TH2I -> a 
+downcastTH2I h = let fh = get_fptr h
+                     fh2 = castForeignPtr fh
+                 in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH2I/RawType.hs b/src/HROOT/Hist/TH2I/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2I/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH2I.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH2I
+newtype TH2I = TH2I (ForeignPtr RawTH2I) deriving (Eq, Ord, Show)
+instance FPtr TH2I where
+   type Raw TH2I = RawTH2I
+   get_fptr (TH2I fptr) = fptr
+   cast_fptr_to_obj = TH2I
diff --git a/src/HROOT/Hist/TH2Poly.hs b/src/HROOT/Hist/TH2Poly.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2Poly.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TH2Poly
+  (
+    TH2Poly(..)
+  , ITH2Poly
+  , upcastTH2Poly
+  , downcastTH2Poly
+
+ 
+  ) where
+
+import HROOT.Hist.TH2Poly.RawType
+import HROOT.Hist.TH2Poly.Interface
+import HROOT.Hist.TH2Poly.Implementation
+
+
diff --git a/src/HROOT/Hist/TH2Poly/Cast.hs b/src/HROOT/Hist/TH2Poly/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2Poly/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH2Poly.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH2Poly.RawType
+import HROOT.Hist.TH2Poly.Interface
+
+instance (ITH2Poly a, FPtr a) => Castable a (Ptr RawTH2Poly) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH2Poly (Ptr RawTH2Poly) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH2Poly/FFI.hsc b/src/HROOT/Hist/TH2Poly/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2Poly/FFI.hsc
@@ -0,0 +1,547 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH2Poly.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH2Poly.RawType
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH2.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TObjArray.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTH2Poly.h"
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_fill2" c_th2poly_fill2 
+  :: (Ptr RawTH2Poly) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_fill2w" c_th2poly_fill2w 
+  :: (Ptr RawTH2Poly) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_fillN2" c_th2poly_filln2 
+  :: (Ptr RawTH2Poly) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_fillRandom2" c_th2poly_fillrandom2 
+  :: (Ptr RawTH2Poly) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_findFirstBinAbove2" c_th2poly_findfirstbinabove2 
+  :: (Ptr RawTH2Poly) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_findLastBinAbove2" c_th2poly_findlastbinabove2 
+  :: (Ptr RawTH2Poly) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_FitSlicesX" c_th2poly_fitslicesx 
+  :: (Ptr RawTH2Poly) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CString -> (Ptr RawTObjArray) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_FitSlicesY" c_th2poly_fitslicesy 
+  :: (Ptr RawTH2Poly) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CString -> (Ptr RawTObjArray) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_getCorrelationFactor2" c_th2poly_getcorrelationfactor2 
+  :: (Ptr RawTH2Poly) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_getCovariance2" c_th2poly_getcovariance2 
+  :: (Ptr RawTH2Poly) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_integral2" c_th2poly_integral2 
+  :: (Ptr RawTH2Poly) -> CInt -> CInt -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_rebinX2" c_th2poly_rebinx2 
+  :: (Ptr RawTH2Poly) -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_rebinY2" c_th2poly_rebiny2 
+  :: (Ptr RawTH2Poly) -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_Rebin2D" c_th2poly_rebin2d 
+  :: (Ptr RawTH2Poly) -> CInt -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetShowProjectionX" c_th2poly_setshowprojectionx 
+  :: (Ptr RawTH2Poly) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetShowProjectionY" c_th2poly_setshowprojectiony 
+  :: (Ptr RawTH2Poly) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_Add" c_th2poly_add 
+  :: (Ptr RawTH2Poly) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_AddBinContent" c_th2poly_addbincontent 
+  :: (Ptr RawTH2Poly) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_Chi2Test" c_th2poly_chi2test 
+  :: (Ptr RawTH2Poly) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_ComputeIntegral" c_th2poly_computeintegral 
+  :: (Ptr RawTH2Poly) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_DirectoryAutoAdd" c_th2poly_directoryautoadd 
+  :: (Ptr RawTH2Poly) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_Divide" c_th2poly_divide 
+  :: (Ptr RawTH2Poly) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_drawCopyTH1" c_th2poly_drawcopyth1 
+  :: (Ptr RawTH2Poly) -> CString -> IO (Ptr RawTH2Poly)
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_DrawNormalized" c_th2poly_drawnormalized 
+  :: (Ptr RawTH2Poly) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_drawPanelTH1" c_th2poly_drawpanelth1 
+  :: (Ptr RawTH2Poly) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_BufferEmpty" c_th2poly_bufferempty 
+  :: (Ptr RawTH2Poly) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_evalF" c_th2poly_evalf 
+  :: (Ptr RawTH2Poly) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_FFT" c_th2poly_fft 
+  :: (Ptr RawTH2Poly) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_fill1" c_th2poly_fill1 
+  :: (Ptr RawTH2Poly) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_fill1w" c_th2poly_fill1w 
+  :: (Ptr RawTH2Poly) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_fillN1" c_th2poly_filln1 
+  :: (Ptr RawTH2Poly) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_FillRandom" c_th2poly_fillrandom 
+  :: (Ptr RawTH2Poly) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_FindBin" c_th2poly_findbin 
+  :: (Ptr RawTH2Poly) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_FindFixBin" c_th2poly_findfixbin 
+  :: (Ptr RawTH2Poly) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_FindFirstBinAbove" c_th2poly_findfirstbinabove 
+  :: (Ptr RawTH2Poly) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_FindLastBinAbove" c_th2poly_findlastbinabove 
+  :: (Ptr RawTH2Poly) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_FitPanelTH1" c_th2poly_fitpanelth1 
+  :: (Ptr RawTH2Poly) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_getNdivisionA" c_th2poly_getndivisiona 
+  :: (Ptr RawTH2Poly) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_getAxisColorA" c_th2poly_getaxiscolora 
+  :: (Ptr RawTH2Poly) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_getLabelColorA" c_th2poly_getlabelcolora 
+  :: (Ptr RawTH2Poly) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_getLabelFontA" c_th2poly_getlabelfonta 
+  :: (Ptr RawTH2Poly) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_getLabelOffsetA" c_th2poly_getlabeloffseta 
+  :: (Ptr RawTH2Poly) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_getLabelSizeA" c_th2poly_getlabelsizea 
+  :: (Ptr RawTH2Poly) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_getTitleFontA" c_th2poly_gettitlefonta 
+  :: (Ptr RawTH2Poly) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_getTitleOffsetA" c_th2poly_gettitleoffseta 
+  :: (Ptr RawTH2Poly) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_getTitleSizeA" c_th2poly_gettitlesizea 
+  :: (Ptr RawTH2Poly) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_getTickLengthA" c_th2poly_getticklengtha 
+  :: (Ptr RawTH2Poly) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetBarOffset" c_th2poly_getbaroffset 
+  :: (Ptr RawTH2Poly) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetBarWidth" c_th2poly_getbarwidth 
+  :: (Ptr RawTH2Poly) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetContour" c_th2poly_getcontour 
+  :: (Ptr RawTH2Poly) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetContourLevel" c_th2poly_getcontourlevel 
+  :: (Ptr RawTH2Poly) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetContourLevelPad" c_th2poly_getcontourlevelpad 
+  :: (Ptr RawTH2Poly) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetBin" c_th2poly_getbin 
+  :: (Ptr RawTH2Poly) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetBinCenter" c_th2poly_getbincenter 
+  :: (Ptr RawTH2Poly) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetBinContent1" c_th2poly_getbincontent1 
+  :: (Ptr RawTH2Poly) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetBinContent2" c_th2poly_getbincontent2 
+  :: (Ptr RawTH2Poly) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetBinContent3" c_th2poly_getbincontent3 
+  :: (Ptr RawTH2Poly) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetBinError1" c_th2poly_getbinerror1 
+  :: (Ptr RawTH2Poly) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetBinError2" c_th2poly_getbinerror2 
+  :: (Ptr RawTH2Poly) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetBinError3" c_th2poly_getbinerror3 
+  :: (Ptr RawTH2Poly) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetBinLowEdge" c_th2poly_getbinlowedge 
+  :: (Ptr RawTH2Poly) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetBinWidth" c_th2poly_getbinwidth 
+  :: (Ptr RawTH2Poly) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetCellContent" c_th2poly_getcellcontent 
+  :: (Ptr RawTH2Poly) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetCellError" c_th2poly_getcellerror 
+  :: (Ptr RawTH2Poly) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetEntries" c_th2poly_getentries 
+  :: (Ptr RawTH2Poly) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetEffectiveEntries" c_th2poly_geteffectiveentries 
+  :: (Ptr RawTH2Poly) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetFunction" c_th2poly_getfunction 
+  :: (Ptr RawTH2Poly) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetDimension" c_th2poly_getdimension 
+  :: (Ptr RawTH2Poly) -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetKurtosis" c_th2poly_getkurtosis 
+  :: (Ptr RawTH2Poly) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetLowEdge" c_th2poly_getlowedge 
+  :: (Ptr RawTH2Poly) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_getMaximumTH1" c_th2poly_getmaximumth1 
+  :: (Ptr RawTH2Poly) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetMaximumBin" c_th2poly_getmaximumbin 
+  :: (Ptr RawTH2Poly) -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetMaximumStored" c_th2poly_getmaximumstored 
+  :: (Ptr RawTH2Poly) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_getMinimumTH1" c_th2poly_getminimumth1 
+  :: (Ptr RawTH2Poly) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetMinimumBin" c_th2poly_getminimumbin 
+  :: (Ptr RawTH2Poly) -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetMinimumStored" c_th2poly_getminimumstored 
+  :: (Ptr RawTH2Poly) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetMean" c_th2poly_getmean 
+  :: (Ptr RawTH2Poly) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetMeanError" c_th2poly_getmeanerror 
+  :: (Ptr RawTH2Poly) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetNbinsX" c_th2poly_getnbinsx 
+  :: (Ptr RawTH2Poly) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetNbinsY" c_th2poly_getnbinsy 
+  :: (Ptr RawTH2Poly) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetNbinsZ" c_th2poly_getnbinsz 
+  :: (Ptr RawTH2Poly) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_getQuantilesTH1" c_th2poly_getquantilesth1 
+  :: (Ptr RawTH2Poly) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetRandom" c_th2poly_getrandom 
+  :: (Ptr RawTH2Poly) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetStats" c_th2poly_getstats 
+  :: (Ptr RawTH2Poly) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetSumOfWeights" c_th2poly_getsumofweights 
+  :: (Ptr RawTH2Poly) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetSumw2" c_th2poly_getsumw2 
+  :: (Ptr RawTH2Poly) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetSumw2N" c_th2poly_getsumw2n 
+  :: (Ptr RawTH2Poly) -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetRMS" c_th2poly_getrms 
+  :: (Ptr RawTH2Poly) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetRMSError" c_th2poly_getrmserror 
+  :: (Ptr RawTH2Poly) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetSkewness" c_th2poly_getskewness 
+  :: (Ptr RawTH2Poly) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_integral1" c_th2poly_integral1 
+  :: (Ptr RawTH2Poly) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_interpolate1" c_th2poly_interpolate1 
+  :: (Ptr RawTH2Poly) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_interpolate2" c_th2poly_interpolate2 
+  :: (Ptr RawTH2Poly) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_interpolate3" c_th2poly_interpolate3 
+  :: (Ptr RawTH2Poly) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_KolmogorovTest" c_th2poly_kolmogorovtest 
+  :: (Ptr RawTH2Poly) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_LabelsDeflate" c_th2poly_labelsdeflate 
+  :: (Ptr RawTH2Poly) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_LabelsInflate" c_th2poly_labelsinflate 
+  :: (Ptr RawTH2Poly) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_LabelsOption" c_th2poly_labelsoption 
+  :: (Ptr RawTH2Poly) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_multiflyF" c_th2poly_multiflyf 
+  :: (Ptr RawTH2Poly) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_Multiply" c_th2poly_multiply 
+  :: (Ptr RawTH2Poly) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_PutStats" c_th2poly_putstats 
+  :: (Ptr RawTH2Poly) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_Rebin" c_th2poly_rebin 
+  :: (Ptr RawTH2Poly) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_RebinAxis" c_th2poly_rebinaxis 
+  :: (Ptr RawTH2Poly) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_Rebuild" c_th2poly_rebuild 
+  :: (Ptr RawTH2Poly) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_RecursiveRemove" c_th2poly_recursiveremove 
+  :: (Ptr RawTH2Poly) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_Reset" c_th2poly_reset 
+  :: (Ptr RawTH2Poly) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_ResetStats" c_th2poly_resetstats 
+  :: (Ptr RawTH2Poly) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_Scale" c_th2poly_scale 
+  :: (Ptr RawTH2Poly) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_setAxisColorA" c_th2poly_setaxiscolora 
+  :: (Ptr RawTH2Poly) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetAxisRange" c_th2poly_setaxisrange 
+  :: (Ptr RawTH2Poly) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetBarOffset" c_th2poly_setbaroffset 
+  :: (Ptr RawTH2Poly) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetBarWidth" c_th2poly_setbarwidth 
+  :: (Ptr RawTH2Poly) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_setBinContent1" c_th2poly_setbincontent1 
+  :: (Ptr RawTH2Poly) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_setBinContent2" c_th2poly_setbincontent2 
+  :: (Ptr RawTH2Poly) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_setBinContent3" c_th2poly_setbincontent3 
+  :: (Ptr RawTH2Poly) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_setBinError1" c_th2poly_setbinerror1 
+  :: (Ptr RawTH2Poly) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_setBinError2" c_th2poly_setbinerror2 
+  :: (Ptr RawTH2Poly) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_setBinError3" c_th2poly_setbinerror3 
+  :: (Ptr RawTH2Poly) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_setBins1" c_th2poly_setbins1 
+  :: (Ptr RawTH2Poly) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_setBins2" c_th2poly_setbins2 
+  :: (Ptr RawTH2Poly) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_setBins3" c_th2poly_setbins3 
+  :: (Ptr RawTH2Poly) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetBinsLength" c_th2poly_setbinslength 
+  :: (Ptr RawTH2Poly) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetBuffer" c_th2poly_setbuffer 
+  :: (Ptr RawTH2Poly) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetCellContent" c_th2poly_setcellcontent 
+  :: (Ptr RawTH2Poly) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetContent" c_th2poly_setcontent 
+  :: (Ptr RawTH2Poly) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetContour" c_th2poly_setcontour 
+  :: (Ptr RawTH2Poly) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetContourLevel" c_th2poly_setcontourlevel 
+  :: (Ptr RawTH2Poly) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetDirectory" c_th2poly_setdirectory 
+  :: (Ptr RawTH2Poly) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetEntries" c_th2poly_setentries 
+  :: (Ptr RawTH2Poly) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetError" c_th2poly_seterror 
+  :: (Ptr RawTH2Poly) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_setLabelColorA" c_th2poly_setlabelcolora 
+  :: (Ptr RawTH2Poly) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_setLabelSizeA" c_th2poly_setlabelsizea 
+  :: (Ptr RawTH2Poly) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_setLabelFontA" c_th2poly_setlabelfonta 
+  :: (Ptr RawTH2Poly) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_setLabelOffsetA" c_th2poly_setlabeloffseta 
+  :: (Ptr RawTH2Poly) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetMaximum" c_th2poly_setmaximum 
+  :: (Ptr RawTH2Poly) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetMinimum" c_th2poly_setminimum 
+  :: (Ptr RawTH2Poly) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetNormFactor" c_th2poly_setnormfactor 
+  :: (Ptr RawTH2Poly) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetStats" c_th2poly_setstats 
+  :: (Ptr RawTH2Poly) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetOption" c_th2poly_setoption 
+  :: (Ptr RawTH2Poly) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetXTitle" c_th2poly_setxtitle 
+  :: (Ptr RawTH2Poly) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetYTitle" c_th2poly_setytitle 
+  :: (Ptr RawTH2Poly) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetZTitle" c_th2poly_setztitle 
+  :: (Ptr RawTH2Poly) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_ShowBackground" c_th2poly_showbackground 
+  :: (Ptr RawTH2Poly) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_ShowPeaks" c_th2poly_showpeaks 
+  :: (Ptr RawTH2Poly) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_Smooth" c_th2poly_smooth 
+  :: (Ptr RawTH2Poly) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_Sumw2" c_th2poly_sumw2 
+  :: (Ptr RawTH2Poly) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_Draw" c_th2poly_draw 
+  :: (Ptr RawTH2Poly) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_FindObject" c_th2poly_findobject 
+  :: (Ptr RawTH2Poly) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetName" c_th2poly_getname 
+  :: (Ptr RawTH2Poly) -> IO CString
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_IsA" c_th2poly_isa 
+  :: (Ptr RawTH2Poly) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_Paint" c_th2poly_paint 
+  :: (Ptr RawTH2Poly) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_printObj" c_th2poly_printobj 
+  :: (Ptr RawTH2Poly) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SaveAs" c_th2poly_saveas 
+  :: (Ptr RawTH2Poly) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_Write" c_th2poly_write 
+  :: (Ptr RawTH2Poly) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetLineColor" c_th2poly_getlinecolor 
+  :: (Ptr RawTH2Poly) -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetLineStyle" c_th2poly_getlinestyle 
+  :: (Ptr RawTH2Poly) -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetLineWidth" c_th2poly_getlinewidth 
+  :: (Ptr RawTH2Poly) -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_ResetAttLine" c_th2poly_resetattline 
+  :: (Ptr RawTH2Poly) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetLineAttributes" c_th2poly_setlineattributes 
+  :: (Ptr RawTH2Poly) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetLineColor" c_th2poly_setlinecolor 
+  :: (Ptr RawTH2Poly) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetLineStyle" c_th2poly_setlinestyle 
+  :: (Ptr RawTH2Poly) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetLineWidth" c_th2poly_setlinewidth 
+  :: (Ptr RawTH2Poly) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetFillColor" c_th2poly_setfillcolor 
+  :: (Ptr RawTH2Poly) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetFillStyle" c_th2poly_setfillstyle 
+  :: (Ptr RawTH2Poly) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetMarkerColor" c_th2poly_getmarkercolor 
+  :: (Ptr RawTH2Poly) -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetMarkerStyle" c_th2poly_getmarkerstyle 
+  :: (Ptr RawTH2Poly) -> IO CInt
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_GetMarkerSize" c_th2poly_getmarkersize 
+  :: (Ptr RawTH2Poly) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_ResetAttMarker" c_th2poly_resetattmarker 
+  :: (Ptr RawTH2Poly) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetMarkerAttributes" c_th2poly_setmarkerattributes 
+  :: (Ptr RawTH2Poly) -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetMarkerColor" c_th2poly_setmarkercolor 
+  :: (Ptr RawTH2Poly) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetMarkerStyle" c_th2poly_setmarkerstyle 
+  :: (Ptr RawTH2Poly) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_SetMarkerSize" c_th2poly_setmarkersize 
+  :: (Ptr RawTH2Poly) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2Poly.h TH2Poly_delete" c_th2poly_delete 
+  :: (Ptr RawTH2Poly) -> IO ()
+
diff --git a/src/HROOT/Hist/TH2Poly/Implementation.hs b/src/HROOT/Hist/TH2Poly/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2Poly/Implementation.hs
@@ -0,0 +1,439 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH2Poly.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH2Poly.RawType
+import HROOT.Hist.TH2Poly.FFI
+import HROOT.Hist.TH2Poly.Interface
+import HROOT.Hist.TH2Poly.Cast
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1D.Cast
+import HROOT.Hist.TH1D.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TObjArray.RawType
+import HROOT.Core.TObjArray.Cast
+import HROOT.Core.TObjArray.Interface
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH2.RawType
+import HROOT.Hist.TH2.Cast
+import HROOT.Hist.TH2.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH2Poly TH2Poly where
+instance ITH2 TH2Poly where
+  fill2 = xform2 c_th2poly_fill2
+  fill2w = xform3 c_th2poly_fill2w
+  fillN2 = xform5 c_th2poly_filln2
+  fillRandom2 = xform2 c_th2poly_fillrandom2
+  findFirstBinAbove2 = xform2 c_th2poly_findfirstbinabove2
+  findLastBinAbove2 = xform2 c_th2poly_findlastbinabove2
+  fitSlicesX = xform6 c_th2poly_fitslicesx
+  fitSlicesY = xform6 c_th2poly_fitslicesy
+  getCorrelationFactor2 = xform2 c_th2poly_getcorrelationfactor2
+  getCovariance2 = xform2 c_th2poly_getcovariance2
+  integral2 = xform5 c_th2poly_integral2
+  rebinX2 = xform2 c_th2poly_rebinx2
+  rebinY2 = xform2 c_th2poly_rebiny2
+  rebin2D = xform3 c_th2poly_rebin2d
+  setShowProjectionX = xform1 c_th2poly_setshowprojectionx
+  setShowProjectionY = xform1 c_th2poly_setshowprojectiony
+instance ITH1 TH2Poly where
+  add = xform2 c_th2poly_add
+  addBinContent = xform2 c_th2poly_addbincontent
+  chi2Test = xform3 c_th2poly_chi2test
+  computeIntegral = xform0 c_th2poly_computeintegral
+  directoryAutoAdd = xform1 c_th2poly_directoryautoadd
+  divide = xform5 c_th2poly_divide
+  drawCopyTH1 = xform1 c_th2poly_drawcopyth1
+  drawNormalized = xform2 c_th2poly_drawnormalized
+  drawPanelTH1 = xform0 c_th2poly_drawpanelth1
+  bufferEmpty = xform1 c_th2poly_bufferempty
+  evalF = xform2 c_th2poly_evalf
+  fFT = xform2 c_th2poly_fft
+  fill1 = xform1 c_th2poly_fill1
+  fill1w = xform2 c_th2poly_fill1w
+  fillN1 = xform4 c_th2poly_filln1
+  fillRandom = xform2 c_th2poly_fillrandom
+  findBin = xform3 c_th2poly_findbin
+  findFixBin = xform3 c_th2poly_findfixbin
+  findFirstBinAbove = xform2 c_th2poly_findfirstbinabove
+  findLastBinAbove = xform2 c_th2poly_findlastbinabove
+  fitPanelTH1 = xform0 c_th2poly_fitpanelth1
+  getNdivisionA = xform1 c_th2poly_getndivisiona
+  getAxisColorA = xform1 c_th2poly_getaxiscolora
+  getLabelColorA = xform1 c_th2poly_getlabelcolora
+  getLabelFontA = xform1 c_th2poly_getlabelfonta
+  getLabelOffsetA = xform1 c_th2poly_getlabeloffseta
+  getLabelSizeA = xform1 c_th2poly_getlabelsizea
+  getTitleFontA = xform1 c_th2poly_gettitlefonta
+  getTitleOffsetA = xform1 c_th2poly_gettitleoffseta
+  getTitleSizeA = xform1 c_th2poly_gettitlesizea
+  getTickLengthA = xform1 c_th2poly_getticklengtha
+  getBarOffset = xform0 c_th2poly_getbaroffset
+  getBarWidth = xform0 c_th2poly_getbarwidth
+  getContour = xform1 c_th2poly_getcontour
+  getContourLevel = xform1 c_th2poly_getcontourlevel
+  getContourLevelPad = xform1 c_th2poly_getcontourlevelpad
+  getBin = xform3 c_th2poly_getbin
+  getBinCenter = xform1 c_th2poly_getbincenter
+  getBinContent1 = xform1 c_th2poly_getbincontent1
+  getBinContent2 = xform2 c_th2poly_getbincontent2
+  getBinContent3 = xform3 c_th2poly_getbincontent3
+  getBinError1 = xform1 c_th2poly_getbinerror1
+  getBinError2 = xform2 c_th2poly_getbinerror2
+  getBinError3 = xform3 c_th2poly_getbinerror3
+  getBinLowEdge = xform1 c_th2poly_getbinlowedge
+  getBinWidth = xform1 c_th2poly_getbinwidth
+  getCellContent = xform2 c_th2poly_getcellcontent
+  getCellError = xform2 c_th2poly_getcellerror
+  getEntries = xform0 c_th2poly_getentries
+  getEffectiveEntries = xform0 c_th2poly_geteffectiveentries
+  getFunction = xform1 c_th2poly_getfunction
+  getDimension = xform0 c_th2poly_getdimension
+  getKurtosis = xform1 c_th2poly_getkurtosis
+  getLowEdge = xform1 c_th2poly_getlowedge
+  getMaximumTH1 = xform1 c_th2poly_getmaximumth1
+  getMaximumBin = xform0 c_th2poly_getmaximumbin
+  getMaximumStored = xform0 c_th2poly_getmaximumstored
+  getMinimumTH1 = xform1 c_th2poly_getminimumth1
+  getMinimumBin = xform0 c_th2poly_getminimumbin
+  getMinimumStored = xform0 c_th2poly_getminimumstored
+  getMean = xform1 c_th2poly_getmean
+  getMeanError = xform1 c_th2poly_getmeanerror
+  getNbinsX = xform0 c_th2poly_getnbinsx
+  getNbinsY = xform0 c_th2poly_getnbinsy
+  getNbinsZ = xform0 c_th2poly_getnbinsz
+  getQuantilesTH1 = xform3 c_th2poly_getquantilesth1
+  getRandom = xform0 c_th2poly_getrandom
+  getStats = xform1 c_th2poly_getstats
+  getSumOfWeights = xform0 c_th2poly_getsumofweights
+  getSumw2 = xform0 c_th2poly_getsumw2
+  getSumw2N = xform0 c_th2poly_getsumw2n
+  getRMS = xform1 c_th2poly_getrms
+  getRMSError = xform1 c_th2poly_getrmserror
+  getSkewness = xform1 c_th2poly_getskewness
+  integral1 = xform3 c_th2poly_integral1
+  interpolate1 = xform1 c_th2poly_interpolate1
+  interpolate2 = xform2 c_th2poly_interpolate2
+  interpolate3 = xform3 c_th2poly_interpolate3
+  kolmogorovTest = xform2 c_th2poly_kolmogorovtest
+  labelsDeflate = xform1 c_th2poly_labelsdeflate
+  labelsInflate = xform1 c_th2poly_labelsinflate
+  labelsOption = xform2 c_th2poly_labelsoption
+  multiflyF = xform2 c_th2poly_multiflyf
+  multiply = xform5 c_th2poly_multiply
+  putStats = xform1 c_th2poly_putstats
+  rebin = xform3 c_th2poly_rebin
+  rebinAxis = xform2 c_th2poly_rebinaxis
+  rebuild = xform1 c_th2poly_rebuild
+  recursiveRemove = xform1 c_th2poly_recursiveremove
+  reset = xform1 c_th2poly_reset
+  resetStats = xform0 c_th2poly_resetstats
+  scale = xform2 c_th2poly_scale
+  setAxisColorA = xform2 c_th2poly_setaxiscolora
+  setAxisRange = xform3 c_th2poly_setaxisrange
+  setBarOffset = xform1 c_th2poly_setbaroffset
+  setBarWidth = xform1 c_th2poly_setbarwidth
+  setBinContent1 = xform2 c_th2poly_setbincontent1
+  setBinContent2 = xform3 c_th2poly_setbincontent2
+  setBinContent3 = xform4 c_th2poly_setbincontent3
+  setBinError1 = xform2 c_th2poly_setbinerror1
+  setBinError2 = xform3 c_th2poly_setbinerror2
+  setBinError3 = xform4 c_th2poly_setbinerror3
+  setBins1 = xform2 c_th2poly_setbins1
+  setBins2 = xform4 c_th2poly_setbins2
+  setBins3 = xform6 c_th2poly_setbins3
+  setBinsLength = xform1 c_th2poly_setbinslength
+  setBuffer = xform2 c_th2poly_setbuffer
+  setCellContent = xform3 c_th2poly_setcellcontent
+  setContent = xform1 c_th2poly_setcontent
+  setContour = xform2 c_th2poly_setcontour
+  setContourLevel = xform2 c_th2poly_setcontourlevel
+  setDirectory = xform1 c_th2poly_setdirectory
+  setEntries = xform1 c_th2poly_setentries
+  setError = xform1 c_th2poly_seterror
+  setLabelColorA = xform2 c_th2poly_setlabelcolora
+  setLabelSizeA = xform2 c_th2poly_setlabelsizea
+  setLabelFontA = xform2 c_th2poly_setlabelfonta
+  setLabelOffsetA = xform2 c_th2poly_setlabeloffseta
+  setMaximum = xform1 c_th2poly_setmaximum
+  setMinimum = xform1 c_th2poly_setminimum
+  setNormFactor = xform1 c_th2poly_setnormfactor
+  setStats = xform1 c_th2poly_setstats
+  setOption = xform1 c_th2poly_setoption
+  setXTitle = xform1 c_th2poly_setxtitle
+  setYTitle = xform1 c_th2poly_setytitle
+  setZTitle = xform1 c_th2poly_setztitle
+  showBackground = xform2 c_th2poly_showbackground
+  showPeaks = xform3 c_th2poly_showpeaks
+  smooth = xform2 c_th2poly_smooth
+  sumw2 = xform0 c_th2poly_sumw2
+instance ITObject TH2Poly where
+  draw = xform1 c_th2poly_draw
+  findObject = xform1 c_th2poly_findobject
+  getName = xform0 c_th2poly_getname
+  isA = xform0 c_th2poly_isa
+  paint = xform1 c_th2poly_paint
+  printObj = xform1 c_th2poly_printobj
+  saveAs = xform2 c_th2poly_saveas
+  write = xform3 c_th2poly_write
+instance ITAttLine TH2Poly where
+  getLineColor = xform0 c_th2poly_getlinecolor
+  getLineStyle = xform0 c_th2poly_getlinestyle
+  getLineWidth = xform0 c_th2poly_getlinewidth
+  resetAttLine = xform1 c_th2poly_resetattline
+  setLineAttributes = xform0 c_th2poly_setlineattributes
+  setLineColor = xform1 c_th2poly_setlinecolor
+  setLineStyle = xform1 c_th2poly_setlinestyle
+  setLineWidth = xform1 c_th2poly_setlinewidth
+instance ITAttFill TH2Poly where
+  setFillColor = xform1 c_th2poly_setfillcolor
+  setFillStyle = xform1 c_th2poly_setfillstyle
+instance ITAttMarker TH2Poly where
+  getMarkerColor = xform0 c_th2poly_getmarkercolor
+  getMarkerStyle = xform0 c_th2poly_getmarkerstyle
+  getMarkerSize = xform0 c_th2poly_getmarkersize
+  resetAttMarker = xform1 c_th2poly_resetattmarker
+  setMarkerAttributes = xform0 c_th2poly_setmarkerattributes
+  setMarkerColor = xform1 c_th2poly_setmarkercolor
+  setMarkerStyle = xform1 c_th2poly_setmarkerstyle
+  setMarkerSize = xform1 c_th2poly_setmarkersize
+instance IDeletable TH2Poly where
+  delete = xform0 c_th2poly_delete
+
+instance ITH2Poly (Exist TH2Poly) where
+
+instance ITH2 (Exist TH2Poly) where
+  fill2 (ETH2Poly x) = fill2 x
+  fill2w (ETH2Poly x) = fill2w x
+  fillN2 (ETH2Poly x) = fillN2 x
+  fillRandom2 (ETH2Poly x) = fillRandom2 x
+  findFirstBinAbove2 (ETH2Poly x) = findFirstBinAbove2 x
+  findLastBinAbove2 (ETH2Poly x) = findLastBinAbove2 x
+  fitSlicesX (ETH2Poly x) = fitSlicesX x
+  fitSlicesY (ETH2Poly x) = fitSlicesY x
+  getCorrelationFactor2 (ETH2Poly x) = getCorrelationFactor2 x
+  getCovariance2 (ETH2Poly x) = getCovariance2 x
+  integral2 (ETH2Poly x) = integral2 x
+  rebinX2 (ETH2Poly x) = rebinX2 x
+  rebinY2 (ETH2Poly x) = rebinY2 x
+  rebin2D (ETH2Poly x) = rebin2D x
+  setShowProjectionX (ETH2Poly x) = setShowProjectionX x
+  setShowProjectionY (ETH2Poly x) = setShowProjectionY x
+instance ITH1 (Exist TH2Poly) where
+  add (ETH2Poly x) = add x
+  addBinContent (ETH2Poly x) = addBinContent x
+  chi2Test (ETH2Poly x) = chi2Test x
+  computeIntegral (ETH2Poly x) = computeIntegral x
+  directoryAutoAdd (ETH2Poly x) = directoryAutoAdd x
+  divide (ETH2Poly x) = divide x
+  drawCopyTH1 (ETH2Poly x) a1 = return . ETH2Poly =<< drawCopyTH1 x a1
+  drawNormalized (ETH2Poly x) = drawNormalized x
+  drawPanelTH1 (ETH2Poly x) = drawPanelTH1 x
+  bufferEmpty (ETH2Poly x) = bufferEmpty x
+  evalF (ETH2Poly x) = evalF x
+  fFT (ETH2Poly x) = fFT x
+  fill1 (ETH2Poly x) = fill1 x
+  fill1w (ETH2Poly x) = fill1w x
+  fillN1 (ETH2Poly x) = fillN1 x
+  fillRandom (ETH2Poly x) = fillRandom x
+  findBin (ETH2Poly x) = findBin x
+  findFixBin (ETH2Poly x) = findFixBin x
+  findFirstBinAbove (ETH2Poly x) = findFirstBinAbove x
+  findLastBinAbove (ETH2Poly x) = findLastBinAbove x
+  fitPanelTH1 (ETH2Poly x) = fitPanelTH1 x
+  getNdivisionA (ETH2Poly x) = getNdivisionA x
+  getAxisColorA (ETH2Poly x) = getAxisColorA x
+  getLabelColorA (ETH2Poly x) = getLabelColorA x
+  getLabelFontA (ETH2Poly x) = getLabelFontA x
+  getLabelOffsetA (ETH2Poly x) = getLabelOffsetA x
+  getLabelSizeA (ETH2Poly x) = getLabelSizeA x
+  getTitleFontA (ETH2Poly x) = getTitleFontA x
+  getTitleOffsetA (ETH2Poly x) = getTitleOffsetA x
+  getTitleSizeA (ETH2Poly x) = getTitleSizeA x
+  getTickLengthA (ETH2Poly x) = getTickLengthA x
+  getBarOffset (ETH2Poly x) = getBarOffset x
+  getBarWidth (ETH2Poly x) = getBarWidth x
+  getContour (ETH2Poly x) = getContour x
+  getContourLevel (ETH2Poly x) = getContourLevel x
+  getContourLevelPad (ETH2Poly x) = getContourLevelPad x
+  getBin (ETH2Poly x) = getBin x
+  getBinCenter (ETH2Poly x) = getBinCenter x
+  getBinContent1 (ETH2Poly x) = getBinContent1 x
+  getBinContent2 (ETH2Poly x) = getBinContent2 x
+  getBinContent3 (ETH2Poly x) = getBinContent3 x
+  getBinError1 (ETH2Poly x) = getBinError1 x
+  getBinError2 (ETH2Poly x) = getBinError2 x
+  getBinError3 (ETH2Poly x) = getBinError3 x
+  getBinLowEdge (ETH2Poly x) = getBinLowEdge x
+  getBinWidth (ETH2Poly x) = getBinWidth x
+  getCellContent (ETH2Poly x) = getCellContent x
+  getCellError (ETH2Poly x) = getCellError x
+  getEntries (ETH2Poly x) = getEntries x
+  getEffectiveEntries (ETH2Poly x) = getEffectiveEntries x
+  getFunction (ETH2Poly x) = getFunction x
+  getDimension (ETH2Poly x) = getDimension x
+  getKurtosis (ETH2Poly x) = getKurtosis x
+  getLowEdge (ETH2Poly x) = getLowEdge x
+  getMaximumTH1 (ETH2Poly x) = getMaximumTH1 x
+  getMaximumBin (ETH2Poly x) = getMaximumBin x
+  getMaximumStored (ETH2Poly x) = getMaximumStored x
+  getMinimumTH1 (ETH2Poly x) = getMinimumTH1 x
+  getMinimumBin (ETH2Poly x) = getMinimumBin x
+  getMinimumStored (ETH2Poly x) = getMinimumStored x
+  getMean (ETH2Poly x) = getMean x
+  getMeanError (ETH2Poly x) = getMeanError x
+  getNbinsX (ETH2Poly x) = getNbinsX x
+  getNbinsY (ETH2Poly x) = getNbinsY x
+  getNbinsZ (ETH2Poly x) = getNbinsZ x
+  getQuantilesTH1 (ETH2Poly x) = getQuantilesTH1 x
+  getRandom (ETH2Poly x) = getRandom x
+  getStats (ETH2Poly x) = getStats x
+  getSumOfWeights (ETH2Poly x) = getSumOfWeights x
+  getSumw2 (ETH2Poly x) = getSumw2 x
+  getSumw2N (ETH2Poly x) = getSumw2N x
+  getRMS (ETH2Poly x) = getRMS x
+  getRMSError (ETH2Poly x) = getRMSError x
+  getSkewness (ETH2Poly x) = getSkewness x
+  integral1 (ETH2Poly x) = integral1 x
+  interpolate1 (ETH2Poly x) = interpolate1 x
+  interpolate2 (ETH2Poly x) = interpolate2 x
+  interpolate3 (ETH2Poly x) = interpolate3 x
+  kolmogorovTest (ETH2Poly x) = kolmogorovTest x
+  labelsDeflate (ETH2Poly x) = labelsDeflate x
+  labelsInflate (ETH2Poly x) = labelsInflate x
+  labelsOption (ETH2Poly x) = labelsOption x
+  multiflyF (ETH2Poly x) = multiflyF x
+  multiply (ETH2Poly x) = multiply x
+  putStats (ETH2Poly x) = putStats x
+  rebin (ETH2Poly x) = rebin x
+  rebinAxis (ETH2Poly x) = rebinAxis x
+  rebuild (ETH2Poly x) = rebuild x
+  recursiveRemove (ETH2Poly x) = recursiveRemove x
+  reset (ETH2Poly x) = reset x
+  resetStats (ETH2Poly x) = resetStats x
+  scale (ETH2Poly x) = scale x
+  setAxisColorA (ETH2Poly x) = setAxisColorA x
+  setAxisRange (ETH2Poly x) = setAxisRange x
+  setBarOffset (ETH2Poly x) = setBarOffset x
+  setBarWidth (ETH2Poly x) = setBarWidth x
+  setBinContent1 (ETH2Poly x) = setBinContent1 x
+  setBinContent2 (ETH2Poly x) = setBinContent2 x
+  setBinContent3 (ETH2Poly x) = setBinContent3 x
+  setBinError1 (ETH2Poly x) = setBinError1 x
+  setBinError2 (ETH2Poly x) = setBinError2 x
+  setBinError3 (ETH2Poly x) = setBinError3 x
+  setBins1 (ETH2Poly x) = setBins1 x
+  setBins2 (ETH2Poly x) = setBins2 x
+  setBins3 (ETH2Poly x) = setBins3 x
+  setBinsLength (ETH2Poly x) = setBinsLength x
+  setBuffer (ETH2Poly x) = setBuffer x
+  setCellContent (ETH2Poly x) = setCellContent x
+  setContent (ETH2Poly x) = setContent x
+  setContour (ETH2Poly x) = setContour x
+  setContourLevel (ETH2Poly x) = setContourLevel x
+  setDirectory (ETH2Poly x) = setDirectory x
+  setEntries (ETH2Poly x) = setEntries x
+  setError (ETH2Poly x) = setError x
+  setLabelColorA (ETH2Poly x) = setLabelColorA x
+  setLabelSizeA (ETH2Poly x) = setLabelSizeA x
+  setLabelFontA (ETH2Poly x) = setLabelFontA x
+  setLabelOffsetA (ETH2Poly x) = setLabelOffsetA x
+  setMaximum (ETH2Poly x) = setMaximum x
+  setMinimum (ETH2Poly x) = setMinimum x
+  setNormFactor (ETH2Poly x) = setNormFactor x
+  setStats (ETH2Poly x) = setStats x
+  setOption (ETH2Poly x) = setOption x
+  setXTitle (ETH2Poly x) = setXTitle x
+  setYTitle (ETH2Poly x) = setYTitle x
+  setZTitle (ETH2Poly x) = setZTitle x
+  showBackground (ETH2Poly x) = showBackground x
+  showPeaks (ETH2Poly x) = showPeaks x
+  smooth (ETH2Poly x) = smooth x
+  sumw2 (ETH2Poly x) = sumw2 x
+instance ITObject (Exist TH2Poly) where
+  draw (ETH2Poly x) = draw x
+  findObject (ETH2Poly x) = findObject x
+  getName (ETH2Poly x) = getName x
+  isA (ETH2Poly x) = isA x
+  paint (ETH2Poly x) = paint x
+  printObj (ETH2Poly x) = printObj x
+  saveAs (ETH2Poly x) = saveAs x
+  write (ETH2Poly x) = write x
+instance ITAttLine (Exist TH2Poly) where
+  getLineColor (ETH2Poly x) = getLineColor x
+  getLineStyle (ETH2Poly x) = getLineStyle x
+  getLineWidth (ETH2Poly x) = getLineWidth x
+  resetAttLine (ETH2Poly x) = resetAttLine x
+  setLineAttributes (ETH2Poly x) = setLineAttributes x
+  setLineColor (ETH2Poly x) = setLineColor x
+  setLineStyle (ETH2Poly x) = setLineStyle x
+  setLineWidth (ETH2Poly x) = setLineWidth x
+instance ITAttFill (Exist TH2Poly) where
+  setFillColor (ETH2Poly x) = setFillColor x
+  setFillStyle (ETH2Poly x) = setFillStyle x
+instance ITAttMarker (Exist TH2Poly) where
+  getMarkerColor (ETH2Poly x) = getMarkerColor x
+  getMarkerStyle (ETH2Poly x) = getMarkerStyle x
+  getMarkerSize (ETH2Poly x) = getMarkerSize x
+  resetAttMarker (ETH2Poly x) = resetAttMarker x
+  setMarkerAttributes (ETH2Poly x) = setMarkerAttributes x
+  setMarkerColor (ETH2Poly x) = setMarkerColor x
+  setMarkerStyle (ETH2Poly x) = setMarkerStyle x
+  setMarkerSize (ETH2Poly x) = setMarkerSize x
+instance IDeletable (Exist TH2Poly) where
+  delete (ETH2Poly x) = delete x
+
+
+
+
+
+
+
+instance FPtr (Exist TH2Poly) where
+  type Raw (Exist TH2Poly) = RawTH2Poly
+  get_fptr (ETH2Poly obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH2Poly (cast_fptr_to_obj (fptr :: ForeignPtr RawTH2Poly) :: TH2Poly)
diff --git a/src/HROOT/Hist/TH2Poly/Interface.hs b/src/HROOT/Hist/TH2Poly/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2Poly/Interface.hs
@@ -0,0 +1,36 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH2Poly.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH2Poly.RawType
+
+import HROOT.Hist.TH2.Interface
+---- ============ ----
+
+
+
+class (ITH2 a) => ITH2Poly a where
+
+instance Existable TH2Poly where
+  data Exist TH2Poly = forall a. (FPtr a, ITH2Poly a) => ETH2Poly a
+
+upcastTH2Poly :: (FPtr a, ITH2Poly a) => a -> TH2Poly
+upcastTH2Poly h = let fh = get_fptr h
+                      fh2 :: ForeignPtr RawTH2Poly = castForeignPtr fh
+                  in cast_fptr_to_obj fh2
+
+downcastTH2Poly :: (FPtr a, ITH2Poly a) => TH2Poly -> a 
+downcastTH2Poly h = let fh = get_fptr h
+                        fh2 = castForeignPtr fh
+                    in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH2Poly/RawType.hs b/src/HROOT/Hist/TH2Poly/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2Poly/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH2Poly.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH2Poly
+newtype TH2Poly = TH2Poly (ForeignPtr RawTH2Poly) deriving (Eq, Ord, Show)
+instance FPtr TH2Poly where
+   type Raw TH2Poly = RawTH2Poly
+   get_fptr (TH2Poly fptr) = fptr
+   cast_fptr_to_obj = TH2Poly
diff --git a/src/HROOT/Hist/TH2S.hs b/src/HROOT/Hist/TH2S.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2S.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TH2S
+  (
+    TH2S(..)
+  , ITH2S
+  , upcastTH2S
+  , downcastTH2S
+
+ 
+  ) where
+
+import HROOT.Hist.TH2S.RawType
+import HROOT.Hist.TH2S.Interface
+import HROOT.Hist.TH2S.Implementation
+
+
diff --git a/src/HROOT/Hist/TH2S/Cast.hs b/src/HROOT/Hist/TH2S/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2S/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH2S.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH2S.RawType
+import HROOT.Hist.TH2S.Interface
+
+instance (ITH2S a, FPtr a) => Castable a (Ptr RawTH2S) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH2S (Ptr RawTH2S) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH2S/FFI.hsc b/src/HROOT/Hist/TH2S/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2S/FFI.hsc
@@ -0,0 +1,547 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH2S.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH2S.RawType
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH2.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TObjArray.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTH2S.h"
+
+foreign import ccall "HROOTHistTH2S.h TH2S_fill2" c_th2s_fill2 
+  :: (Ptr RawTH2S) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_fill2w" c_th2s_fill2w 
+  :: (Ptr RawTH2S) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_fillN2" c_th2s_filln2 
+  :: (Ptr RawTH2S) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_fillRandom2" c_th2s_fillrandom2 
+  :: (Ptr RawTH2S) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_findFirstBinAbove2" c_th2s_findfirstbinabove2 
+  :: (Ptr RawTH2S) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_findLastBinAbove2" c_th2s_findlastbinabove2 
+  :: (Ptr RawTH2S) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_FitSlicesX" c_th2s_fitslicesx 
+  :: (Ptr RawTH2S) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CString -> (Ptr RawTObjArray) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_FitSlicesY" c_th2s_fitslicesy 
+  :: (Ptr RawTH2S) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CString -> (Ptr RawTObjArray) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_getCorrelationFactor2" c_th2s_getcorrelationfactor2 
+  :: (Ptr RawTH2S) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_getCovariance2" c_th2s_getcovariance2 
+  :: (Ptr RawTH2S) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_integral2" c_th2s_integral2 
+  :: (Ptr RawTH2S) -> CInt -> CInt -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_rebinX2" c_th2s_rebinx2 
+  :: (Ptr RawTH2S) -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2S.h TH2S_rebinY2" c_th2s_rebiny2 
+  :: (Ptr RawTH2S) -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2S.h TH2S_Rebin2D" c_th2s_rebin2d 
+  :: (Ptr RawTH2S) -> CInt -> CInt -> CString -> IO (Ptr RawTH2)
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetShowProjectionX" c_th2s_setshowprojectionx 
+  :: (Ptr RawTH2S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetShowProjectionY" c_th2s_setshowprojectiony 
+  :: (Ptr RawTH2S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_Add" c_th2s_add 
+  :: (Ptr RawTH2S) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_AddBinContent" c_th2s_addbincontent 
+  :: (Ptr RawTH2S) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_Chi2Test" c_th2s_chi2test 
+  :: (Ptr RawTH2S) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_ComputeIntegral" c_th2s_computeintegral 
+  :: (Ptr RawTH2S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_DirectoryAutoAdd" c_th2s_directoryautoadd 
+  :: (Ptr RawTH2S) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_Divide" c_th2s_divide 
+  :: (Ptr RawTH2S) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_drawCopyTH1" c_th2s_drawcopyth1 
+  :: (Ptr RawTH2S) -> CString -> IO (Ptr RawTH2S)
+
+foreign import ccall "HROOTHistTH2S.h TH2S_DrawNormalized" c_th2s_drawnormalized 
+  :: (Ptr RawTH2S) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2S.h TH2S_drawPanelTH1" c_th2s_drawpanelth1 
+  :: (Ptr RawTH2S) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_BufferEmpty" c_th2s_bufferempty 
+  :: (Ptr RawTH2S) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_evalF" c_th2s_evalf 
+  :: (Ptr RawTH2S) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_FFT" c_th2s_fft 
+  :: (Ptr RawTH2S) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2S.h TH2S_fill1" c_th2s_fill1 
+  :: (Ptr RawTH2S) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_fill1w" c_th2s_fill1w 
+  :: (Ptr RawTH2S) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_fillN1" c_th2s_filln1 
+  :: (Ptr RawTH2S) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_FillRandom" c_th2s_fillrandom 
+  :: (Ptr RawTH2S) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_FindBin" c_th2s_findbin 
+  :: (Ptr RawTH2S) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_FindFixBin" c_th2s_findfixbin 
+  :: (Ptr RawTH2S) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_FindFirstBinAbove" c_th2s_findfirstbinabove 
+  :: (Ptr RawTH2S) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_FindLastBinAbove" c_th2s_findlastbinabove 
+  :: (Ptr RawTH2S) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_FitPanelTH1" c_th2s_fitpanelth1 
+  :: (Ptr RawTH2S) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_getNdivisionA" c_th2s_getndivisiona 
+  :: (Ptr RawTH2S) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_getAxisColorA" c_th2s_getaxiscolora 
+  :: (Ptr RawTH2S) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_getLabelColorA" c_th2s_getlabelcolora 
+  :: (Ptr RawTH2S) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_getLabelFontA" c_th2s_getlabelfonta 
+  :: (Ptr RawTH2S) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_getLabelOffsetA" c_th2s_getlabeloffseta 
+  :: (Ptr RawTH2S) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_getLabelSizeA" c_th2s_getlabelsizea 
+  :: (Ptr RawTH2S) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_getTitleFontA" c_th2s_gettitlefonta 
+  :: (Ptr RawTH2S) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_getTitleOffsetA" c_th2s_gettitleoffseta 
+  :: (Ptr RawTH2S) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_getTitleSizeA" c_th2s_gettitlesizea 
+  :: (Ptr RawTH2S) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_getTickLengthA" c_th2s_getticklengtha 
+  :: (Ptr RawTH2S) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetBarOffset" c_th2s_getbaroffset 
+  :: (Ptr RawTH2S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetBarWidth" c_th2s_getbarwidth 
+  :: (Ptr RawTH2S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetContour" c_th2s_getcontour 
+  :: (Ptr RawTH2S) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetContourLevel" c_th2s_getcontourlevel 
+  :: (Ptr RawTH2S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetContourLevelPad" c_th2s_getcontourlevelpad 
+  :: (Ptr RawTH2S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetBin" c_th2s_getbin 
+  :: (Ptr RawTH2S) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetBinCenter" c_th2s_getbincenter 
+  :: (Ptr RawTH2S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetBinContent1" c_th2s_getbincontent1 
+  :: (Ptr RawTH2S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetBinContent2" c_th2s_getbincontent2 
+  :: (Ptr RawTH2S) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetBinContent3" c_th2s_getbincontent3 
+  :: (Ptr RawTH2S) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetBinError1" c_th2s_getbinerror1 
+  :: (Ptr RawTH2S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetBinError2" c_th2s_getbinerror2 
+  :: (Ptr RawTH2S) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetBinError3" c_th2s_getbinerror3 
+  :: (Ptr RawTH2S) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetBinLowEdge" c_th2s_getbinlowedge 
+  :: (Ptr RawTH2S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetBinWidth" c_th2s_getbinwidth 
+  :: (Ptr RawTH2S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetCellContent" c_th2s_getcellcontent 
+  :: (Ptr RawTH2S) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetCellError" c_th2s_getcellerror 
+  :: (Ptr RawTH2S) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetEntries" c_th2s_getentries 
+  :: (Ptr RawTH2S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetEffectiveEntries" c_th2s_geteffectiveentries 
+  :: (Ptr RawTH2S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetFunction" c_th2s_getfunction 
+  :: (Ptr RawTH2S) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetDimension" c_th2s_getdimension 
+  :: (Ptr RawTH2S) -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetKurtosis" c_th2s_getkurtosis 
+  :: (Ptr RawTH2S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetLowEdge" c_th2s_getlowedge 
+  :: (Ptr RawTH2S) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_getMaximumTH1" c_th2s_getmaximumth1 
+  :: (Ptr RawTH2S) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetMaximumBin" c_th2s_getmaximumbin 
+  :: (Ptr RawTH2S) -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetMaximumStored" c_th2s_getmaximumstored 
+  :: (Ptr RawTH2S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_getMinimumTH1" c_th2s_getminimumth1 
+  :: (Ptr RawTH2S) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetMinimumBin" c_th2s_getminimumbin 
+  :: (Ptr RawTH2S) -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetMinimumStored" c_th2s_getminimumstored 
+  :: (Ptr RawTH2S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetMean" c_th2s_getmean 
+  :: (Ptr RawTH2S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetMeanError" c_th2s_getmeanerror 
+  :: (Ptr RawTH2S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetNbinsX" c_th2s_getnbinsx 
+  :: (Ptr RawTH2S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetNbinsY" c_th2s_getnbinsy 
+  :: (Ptr RawTH2S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetNbinsZ" c_th2s_getnbinsz 
+  :: (Ptr RawTH2S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_getQuantilesTH1" c_th2s_getquantilesth1 
+  :: (Ptr RawTH2S) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetRandom" c_th2s_getrandom 
+  :: (Ptr RawTH2S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetStats" c_th2s_getstats 
+  :: (Ptr RawTH2S) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetSumOfWeights" c_th2s_getsumofweights 
+  :: (Ptr RawTH2S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetSumw2" c_th2s_getsumw2 
+  :: (Ptr RawTH2S) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetSumw2N" c_th2s_getsumw2n 
+  :: (Ptr RawTH2S) -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetRMS" c_th2s_getrms 
+  :: (Ptr RawTH2S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetRMSError" c_th2s_getrmserror 
+  :: (Ptr RawTH2S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetSkewness" c_th2s_getskewness 
+  :: (Ptr RawTH2S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_integral1" c_th2s_integral1 
+  :: (Ptr RawTH2S) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_interpolate1" c_th2s_interpolate1 
+  :: (Ptr RawTH2S) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_interpolate2" c_th2s_interpolate2 
+  :: (Ptr RawTH2S) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_interpolate3" c_th2s_interpolate3 
+  :: (Ptr RawTH2S) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_KolmogorovTest" c_th2s_kolmogorovtest 
+  :: (Ptr RawTH2S) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_LabelsDeflate" c_th2s_labelsdeflate 
+  :: (Ptr RawTH2S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_LabelsInflate" c_th2s_labelsinflate 
+  :: (Ptr RawTH2S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_LabelsOption" c_th2s_labelsoption 
+  :: (Ptr RawTH2S) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_multiflyF" c_th2s_multiflyf 
+  :: (Ptr RawTH2S) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_Multiply" c_th2s_multiply 
+  :: (Ptr RawTH2S) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_PutStats" c_th2s_putstats 
+  :: (Ptr RawTH2S) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_Rebin" c_th2s_rebin 
+  :: (Ptr RawTH2S) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2S.h TH2S_RebinAxis" c_th2s_rebinaxis 
+  :: (Ptr RawTH2S) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_Rebuild" c_th2s_rebuild 
+  :: (Ptr RawTH2S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_RecursiveRemove" c_th2s_recursiveremove 
+  :: (Ptr RawTH2S) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_Reset" c_th2s_reset 
+  :: (Ptr RawTH2S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_ResetStats" c_th2s_resetstats 
+  :: (Ptr RawTH2S) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_Scale" c_th2s_scale 
+  :: (Ptr RawTH2S) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_setAxisColorA" c_th2s_setaxiscolora 
+  :: (Ptr RawTH2S) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetAxisRange" c_th2s_setaxisrange 
+  :: (Ptr RawTH2S) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetBarOffset" c_th2s_setbaroffset 
+  :: (Ptr RawTH2S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetBarWidth" c_th2s_setbarwidth 
+  :: (Ptr RawTH2S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_setBinContent1" c_th2s_setbincontent1 
+  :: (Ptr RawTH2S) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_setBinContent2" c_th2s_setbincontent2 
+  :: (Ptr RawTH2S) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_setBinContent3" c_th2s_setbincontent3 
+  :: (Ptr RawTH2S) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_setBinError1" c_th2s_setbinerror1 
+  :: (Ptr RawTH2S) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_setBinError2" c_th2s_setbinerror2 
+  :: (Ptr RawTH2S) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_setBinError3" c_th2s_setbinerror3 
+  :: (Ptr RawTH2S) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_setBins1" c_th2s_setbins1 
+  :: (Ptr RawTH2S) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_setBins2" c_th2s_setbins2 
+  :: (Ptr RawTH2S) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_setBins3" c_th2s_setbins3 
+  :: (Ptr RawTH2S) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetBinsLength" c_th2s_setbinslength 
+  :: (Ptr RawTH2S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetBuffer" c_th2s_setbuffer 
+  :: (Ptr RawTH2S) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetCellContent" c_th2s_setcellcontent 
+  :: (Ptr RawTH2S) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetContent" c_th2s_setcontent 
+  :: (Ptr RawTH2S) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetContour" c_th2s_setcontour 
+  :: (Ptr RawTH2S) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetContourLevel" c_th2s_setcontourlevel 
+  :: (Ptr RawTH2S) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetDirectory" c_th2s_setdirectory 
+  :: (Ptr RawTH2S) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetEntries" c_th2s_setentries 
+  :: (Ptr RawTH2S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetError" c_th2s_seterror 
+  :: (Ptr RawTH2S) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_setLabelColorA" c_th2s_setlabelcolora 
+  :: (Ptr RawTH2S) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_setLabelSizeA" c_th2s_setlabelsizea 
+  :: (Ptr RawTH2S) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_setLabelFontA" c_th2s_setlabelfonta 
+  :: (Ptr RawTH2S) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_setLabelOffsetA" c_th2s_setlabeloffseta 
+  :: (Ptr RawTH2S) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetMaximum" c_th2s_setmaximum 
+  :: (Ptr RawTH2S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetMinimum" c_th2s_setminimum 
+  :: (Ptr RawTH2S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetNormFactor" c_th2s_setnormfactor 
+  :: (Ptr RawTH2S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetStats" c_th2s_setstats 
+  :: (Ptr RawTH2S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetOption" c_th2s_setoption 
+  :: (Ptr RawTH2S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetXTitle" c_th2s_setxtitle 
+  :: (Ptr RawTH2S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetYTitle" c_th2s_setytitle 
+  :: (Ptr RawTH2S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetZTitle" c_th2s_setztitle 
+  :: (Ptr RawTH2S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_ShowBackground" c_th2s_showbackground 
+  :: (Ptr RawTH2S) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH2S.h TH2S_ShowPeaks" c_th2s_showpeaks 
+  :: (Ptr RawTH2S) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_Smooth" c_th2s_smooth 
+  :: (Ptr RawTH2S) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_Sumw2" c_th2s_sumw2 
+  :: (Ptr RawTH2S) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_Draw" c_th2s_draw 
+  :: (Ptr RawTH2S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_FindObject" c_th2s_findobject 
+  :: (Ptr RawTH2S) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetName" c_th2s_getname 
+  :: (Ptr RawTH2S) -> IO CString
+
+foreign import ccall "HROOTHistTH2S.h TH2S_IsA" c_th2s_isa 
+  :: (Ptr RawTH2S) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH2S.h TH2S_Paint" c_th2s_paint 
+  :: (Ptr RawTH2S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_printObj" c_th2s_printobj 
+  :: (Ptr RawTH2S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SaveAs" c_th2s_saveas 
+  :: (Ptr RawTH2S) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_Write" c_th2s_write 
+  :: (Ptr RawTH2S) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetLineColor" c_th2s_getlinecolor 
+  :: (Ptr RawTH2S) -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetLineStyle" c_th2s_getlinestyle 
+  :: (Ptr RawTH2S) -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetLineWidth" c_th2s_getlinewidth 
+  :: (Ptr RawTH2S) -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_ResetAttLine" c_th2s_resetattline 
+  :: (Ptr RawTH2S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetLineAttributes" c_th2s_setlineattributes 
+  :: (Ptr RawTH2S) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetLineColor" c_th2s_setlinecolor 
+  :: (Ptr RawTH2S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetLineStyle" c_th2s_setlinestyle 
+  :: (Ptr RawTH2S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetLineWidth" c_th2s_setlinewidth 
+  :: (Ptr RawTH2S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetFillColor" c_th2s_setfillcolor 
+  :: (Ptr RawTH2S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetFillStyle" c_th2s_setfillstyle 
+  :: (Ptr RawTH2S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetMarkerColor" c_th2s_getmarkercolor 
+  :: (Ptr RawTH2S) -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetMarkerStyle" c_th2s_getmarkerstyle 
+  :: (Ptr RawTH2S) -> IO CInt
+
+foreign import ccall "HROOTHistTH2S.h TH2S_GetMarkerSize" c_th2s_getmarkersize 
+  :: (Ptr RawTH2S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH2S.h TH2S_ResetAttMarker" c_th2s_resetattmarker 
+  :: (Ptr RawTH2S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetMarkerAttributes" c_th2s_setmarkerattributes 
+  :: (Ptr RawTH2S) -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetMarkerColor" c_th2s_setmarkercolor 
+  :: (Ptr RawTH2S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetMarkerStyle" c_th2s_setmarkerstyle 
+  :: (Ptr RawTH2S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_SetMarkerSize" c_th2s_setmarkersize 
+  :: (Ptr RawTH2S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH2S.h TH2S_delete" c_th2s_delete 
+  :: (Ptr RawTH2S) -> IO ()
+
diff --git a/src/HROOT/Hist/TH2S/Implementation.hs b/src/HROOT/Hist/TH2S/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2S/Implementation.hs
@@ -0,0 +1,451 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH2S.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH2S.RawType
+import HROOT.Hist.TH2S.FFI
+import HROOT.Hist.TH2S.Interface
+import HROOT.Hist.TH2S.Cast
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1D.Cast
+import HROOT.Hist.TH1D.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TObjArray.RawType
+import HROOT.Core.TObjArray.Cast
+import HROOT.Core.TObjArray.Interface
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH2.RawType
+import HROOT.Hist.TH2.Cast
+import HROOT.Hist.TH2.Interface
+import HROOT.Core.TArrayS.RawType
+import HROOT.Core.TArrayS.Cast
+import HROOT.Core.TArrayS.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+import HROOT.Core.TArray.RawType
+import HROOT.Core.TArray.Cast
+import HROOT.Core.TArray.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH2S TH2S where
+instance ITH2 TH2S where
+  fill2 = xform2 c_th2s_fill2
+  fill2w = xform3 c_th2s_fill2w
+  fillN2 = xform5 c_th2s_filln2
+  fillRandom2 = xform2 c_th2s_fillrandom2
+  findFirstBinAbove2 = xform2 c_th2s_findfirstbinabove2
+  findLastBinAbove2 = xform2 c_th2s_findlastbinabove2
+  fitSlicesX = xform6 c_th2s_fitslicesx
+  fitSlicesY = xform6 c_th2s_fitslicesy
+  getCorrelationFactor2 = xform2 c_th2s_getcorrelationfactor2
+  getCovariance2 = xform2 c_th2s_getcovariance2
+  integral2 = xform5 c_th2s_integral2
+  rebinX2 = xform2 c_th2s_rebinx2
+  rebinY2 = xform2 c_th2s_rebiny2
+  rebin2D = xform3 c_th2s_rebin2d
+  setShowProjectionX = xform1 c_th2s_setshowprojectionx
+  setShowProjectionY = xform1 c_th2s_setshowprojectiony
+instance ITArrayS TH2S where
+instance ITH1 TH2S where
+  add = xform2 c_th2s_add
+  addBinContent = xform2 c_th2s_addbincontent
+  chi2Test = xform3 c_th2s_chi2test
+  computeIntegral = xform0 c_th2s_computeintegral
+  directoryAutoAdd = xform1 c_th2s_directoryautoadd
+  divide = xform5 c_th2s_divide
+  drawCopyTH1 = xform1 c_th2s_drawcopyth1
+  drawNormalized = xform2 c_th2s_drawnormalized
+  drawPanelTH1 = xform0 c_th2s_drawpanelth1
+  bufferEmpty = xform1 c_th2s_bufferempty
+  evalF = xform2 c_th2s_evalf
+  fFT = xform2 c_th2s_fft
+  fill1 = xform1 c_th2s_fill1
+  fill1w = xform2 c_th2s_fill1w
+  fillN1 = xform4 c_th2s_filln1
+  fillRandom = xform2 c_th2s_fillrandom
+  findBin = xform3 c_th2s_findbin
+  findFixBin = xform3 c_th2s_findfixbin
+  findFirstBinAbove = xform2 c_th2s_findfirstbinabove
+  findLastBinAbove = xform2 c_th2s_findlastbinabove
+  fitPanelTH1 = xform0 c_th2s_fitpanelth1
+  getNdivisionA = xform1 c_th2s_getndivisiona
+  getAxisColorA = xform1 c_th2s_getaxiscolora
+  getLabelColorA = xform1 c_th2s_getlabelcolora
+  getLabelFontA = xform1 c_th2s_getlabelfonta
+  getLabelOffsetA = xform1 c_th2s_getlabeloffseta
+  getLabelSizeA = xform1 c_th2s_getlabelsizea
+  getTitleFontA = xform1 c_th2s_gettitlefonta
+  getTitleOffsetA = xform1 c_th2s_gettitleoffseta
+  getTitleSizeA = xform1 c_th2s_gettitlesizea
+  getTickLengthA = xform1 c_th2s_getticklengtha
+  getBarOffset = xform0 c_th2s_getbaroffset
+  getBarWidth = xform0 c_th2s_getbarwidth
+  getContour = xform1 c_th2s_getcontour
+  getContourLevel = xform1 c_th2s_getcontourlevel
+  getContourLevelPad = xform1 c_th2s_getcontourlevelpad
+  getBin = xform3 c_th2s_getbin
+  getBinCenter = xform1 c_th2s_getbincenter
+  getBinContent1 = xform1 c_th2s_getbincontent1
+  getBinContent2 = xform2 c_th2s_getbincontent2
+  getBinContent3 = xform3 c_th2s_getbincontent3
+  getBinError1 = xform1 c_th2s_getbinerror1
+  getBinError2 = xform2 c_th2s_getbinerror2
+  getBinError3 = xform3 c_th2s_getbinerror3
+  getBinLowEdge = xform1 c_th2s_getbinlowedge
+  getBinWidth = xform1 c_th2s_getbinwidth
+  getCellContent = xform2 c_th2s_getcellcontent
+  getCellError = xform2 c_th2s_getcellerror
+  getEntries = xform0 c_th2s_getentries
+  getEffectiveEntries = xform0 c_th2s_geteffectiveentries
+  getFunction = xform1 c_th2s_getfunction
+  getDimension = xform0 c_th2s_getdimension
+  getKurtosis = xform1 c_th2s_getkurtosis
+  getLowEdge = xform1 c_th2s_getlowedge
+  getMaximumTH1 = xform1 c_th2s_getmaximumth1
+  getMaximumBin = xform0 c_th2s_getmaximumbin
+  getMaximumStored = xform0 c_th2s_getmaximumstored
+  getMinimumTH1 = xform1 c_th2s_getminimumth1
+  getMinimumBin = xform0 c_th2s_getminimumbin
+  getMinimumStored = xform0 c_th2s_getminimumstored
+  getMean = xform1 c_th2s_getmean
+  getMeanError = xform1 c_th2s_getmeanerror
+  getNbinsX = xform0 c_th2s_getnbinsx
+  getNbinsY = xform0 c_th2s_getnbinsy
+  getNbinsZ = xform0 c_th2s_getnbinsz
+  getQuantilesTH1 = xform3 c_th2s_getquantilesth1
+  getRandom = xform0 c_th2s_getrandom
+  getStats = xform1 c_th2s_getstats
+  getSumOfWeights = xform0 c_th2s_getsumofweights
+  getSumw2 = xform0 c_th2s_getsumw2
+  getSumw2N = xform0 c_th2s_getsumw2n
+  getRMS = xform1 c_th2s_getrms
+  getRMSError = xform1 c_th2s_getrmserror
+  getSkewness = xform1 c_th2s_getskewness
+  integral1 = xform3 c_th2s_integral1
+  interpolate1 = xform1 c_th2s_interpolate1
+  interpolate2 = xform2 c_th2s_interpolate2
+  interpolate3 = xform3 c_th2s_interpolate3
+  kolmogorovTest = xform2 c_th2s_kolmogorovtest
+  labelsDeflate = xform1 c_th2s_labelsdeflate
+  labelsInflate = xform1 c_th2s_labelsinflate
+  labelsOption = xform2 c_th2s_labelsoption
+  multiflyF = xform2 c_th2s_multiflyf
+  multiply = xform5 c_th2s_multiply
+  putStats = xform1 c_th2s_putstats
+  rebin = xform3 c_th2s_rebin
+  rebinAxis = xform2 c_th2s_rebinaxis
+  rebuild = xform1 c_th2s_rebuild
+  recursiveRemove = xform1 c_th2s_recursiveremove
+  reset = xform1 c_th2s_reset
+  resetStats = xform0 c_th2s_resetstats
+  scale = xform2 c_th2s_scale
+  setAxisColorA = xform2 c_th2s_setaxiscolora
+  setAxisRange = xform3 c_th2s_setaxisrange
+  setBarOffset = xform1 c_th2s_setbaroffset
+  setBarWidth = xform1 c_th2s_setbarwidth
+  setBinContent1 = xform2 c_th2s_setbincontent1
+  setBinContent2 = xform3 c_th2s_setbincontent2
+  setBinContent3 = xform4 c_th2s_setbincontent3
+  setBinError1 = xform2 c_th2s_setbinerror1
+  setBinError2 = xform3 c_th2s_setbinerror2
+  setBinError3 = xform4 c_th2s_setbinerror3
+  setBins1 = xform2 c_th2s_setbins1
+  setBins2 = xform4 c_th2s_setbins2
+  setBins3 = xform6 c_th2s_setbins3
+  setBinsLength = xform1 c_th2s_setbinslength
+  setBuffer = xform2 c_th2s_setbuffer
+  setCellContent = xform3 c_th2s_setcellcontent
+  setContent = xform1 c_th2s_setcontent
+  setContour = xform2 c_th2s_setcontour
+  setContourLevel = xform2 c_th2s_setcontourlevel
+  setDirectory = xform1 c_th2s_setdirectory
+  setEntries = xform1 c_th2s_setentries
+  setError = xform1 c_th2s_seterror
+  setLabelColorA = xform2 c_th2s_setlabelcolora
+  setLabelSizeA = xform2 c_th2s_setlabelsizea
+  setLabelFontA = xform2 c_th2s_setlabelfonta
+  setLabelOffsetA = xform2 c_th2s_setlabeloffseta
+  setMaximum = xform1 c_th2s_setmaximum
+  setMinimum = xform1 c_th2s_setminimum
+  setNormFactor = xform1 c_th2s_setnormfactor
+  setStats = xform1 c_th2s_setstats
+  setOption = xform1 c_th2s_setoption
+  setXTitle = xform1 c_th2s_setxtitle
+  setYTitle = xform1 c_th2s_setytitle
+  setZTitle = xform1 c_th2s_setztitle
+  showBackground = xform2 c_th2s_showbackground
+  showPeaks = xform3 c_th2s_showpeaks
+  smooth = xform2 c_th2s_smooth
+  sumw2 = xform0 c_th2s_sumw2
+instance ITObject TH2S where
+  draw = xform1 c_th2s_draw
+  findObject = xform1 c_th2s_findobject
+  getName = xform0 c_th2s_getname
+  isA = xform0 c_th2s_isa
+  paint = xform1 c_th2s_paint
+  printObj = xform1 c_th2s_printobj
+  saveAs = xform2 c_th2s_saveas
+  write = xform3 c_th2s_write
+instance ITAttLine TH2S where
+  getLineColor = xform0 c_th2s_getlinecolor
+  getLineStyle = xform0 c_th2s_getlinestyle
+  getLineWidth = xform0 c_th2s_getlinewidth
+  resetAttLine = xform1 c_th2s_resetattline
+  setLineAttributes = xform0 c_th2s_setlineattributes
+  setLineColor = xform1 c_th2s_setlinecolor
+  setLineStyle = xform1 c_th2s_setlinestyle
+  setLineWidth = xform1 c_th2s_setlinewidth
+instance ITAttFill TH2S where
+  setFillColor = xform1 c_th2s_setfillcolor
+  setFillStyle = xform1 c_th2s_setfillstyle
+instance ITAttMarker TH2S where
+  getMarkerColor = xform0 c_th2s_getmarkercolor
+  getMarkerStyle = xform0 c_th2s_getmarkerstyle
+  getMarkerSize = xform0 c_th2s_getmarkersize
+  resetAttMarker = xform1 c_th2s_resetattmarker
+  setMarkerAttributes = xform0 c_th2s_setmarkerattributes
+  setMarkerColor = xform1 c_th2s_setmarkercolor
+  setMarkerStyle = xform1 c_th2s_setmarkerstyle
+  setMarkerSize = xform1 c_th2s_setmarkersize
+instance IDeletable TH2S where
+  delete = xform0 c_th2s_delete
+instance ITArray TH2S where
+
+instance ITH2S (Exist TH2S) where
+
+instance ITH2 (Exist TH2S) where
+  fill2 (ETH2S x) = fill2 x
+  fill2w (ETH2S x) = fill2w x
+  fillN2 (ETH2S x) = fillN2 x
+  fillRandom2 (ETH2S x) = fillRandom2 x
+  findFirstBinAbove2 (ETH2S x) = findFirstBinAbove2 x
+  findLastBinAbove2 (ETH2S x) = findLastBinAbove2 x
+  fitSlicesX (ETH2S x) = fitSlicesX x
+  fitSlicesY (ETH2S x) = fitSlicesY x
+  getCorrelationFactor2 (ETH2S x) = getCorrelationFactor2 x
+  getCovariance2 (ETH2S x) = getCovariance2 x
+  integral2 (ETH2S x) = integral2 x
+  rebinX2 (ETH2S x) = rebinX2 x
+  rebinY2 (ETH2S x) = rebinY2 x
+  rebin2D (ETH2S x) = rebin2D x
+  setShowProjectionX (ETH2S x) = setShowProjectionX x
+  setShowProjectionY (ETH2S x) = setShowProjectionY x
+instance ITArrayS (Exist TH2S) where
+
+instance ITH1 (Exist TH2S) where
+  add (ETH2S x) = add x
+  addBinContent (ETH2S x) = addBinContent x
+  chi2Test (ETH2S x) = chi2Test x
+  computeIntegral (ETH2S x) = computeIntegral x
+  directoryAutoAdd (ETH2S x) = directoryAutoAdd x
+  divide (ETH2S x) = divide x
+  drawCopyTH1 (ETH2S x) a1 = return . ETH2S =<< drawCopyTH1 x a1
+  drawNormalized (ETH2S x) = drawNormalized x
+  drawPanelTH1 (ETH2S x) = drawPanelTH1 x
+  bufferEmpty (ETH2S x) = bufferEmpty x
+  evalF (ETH2S x) = evalF x
+  fFT (ETH2S x) = fFT x
+  fill1 (ETH2S x) = fill1 x
+  fill1w (ETH2S x) = fill1w x
+  fillN1 (ETH2S x) = fillN1 x
+  fillRandom (ETH2S x) = fillRandom x
+  findBin (ETH2S x) = findBin x
+  findFixBin (ETH2S x) = findFixBin x
+  findFirstBinAbove (ETH2S x) = findFirstBinAbove x
+  findLastBinAbove (ETH2S x) = findLastBinAbove x
+  fitPanelTH1 (ETH2S x) = fitPanelTH1 x
+  getNdivisionA (ETH2S x) = getNdivisionA x
+  getAxisColorA (ETH2S x) = getAxisColorA x
+  getLabelColorA (ETH2S x) = getLabelColorA x
+  getLabelFontA (ETH2S x) = getLabelFontA x
+  getLabelOffsetA (ETH2S x) = getLabelOffsetA x
+  getLabelSizeA (ETH2S x) = getLabelSizeA x
+  getTitleFontA (ETH2S x) = getTitleFontA x
+  getTitleOffsetA (ETH2S x) = getTitleOffsetA x
+  getTitleSizeA (ETH2S x) = getTitleSizeA x
+  getTickLengthA (ETH2S x) = getTickLengthA x
+  getBarOffset (ETH2S x) = getBarOffset x
+  getBarWidth (ETH2S x) = getBarWidth x
+  getContour (ETH2S x) = getContour x
+  getContourLevel (ETH2S x) = getContourLevel x
+  getContourLevelPad (ETH2S x) = getContourLevelPad x
+  getBin (ETH2S x) = getBin x
+  getBinCenter (ETH2S x) = getBinCenter x
+  getBinContent1 (ETH2S x) = getBinContent1 x
+  getBinContent2 (ETH2S x) = getBinContent2 x
+  getBinContent3 (ETH2S x) = getBinContent3 x
+  getBinError1 (ETH2S x) = getBinError1 x
+  getBinError2 (ETH2S x) = getBinError2 x
+  getBinError3 (ETH2S x) = getBinError3 x
+  getBinLowEdge (ETH2S x) = getBinLowEdge x
+  getBinWidth (ETH2S x) = getBinWidth x
+  getCellContent (ETH2S x) = getCellContent x
+  getCellError (ETH2S x) = getCellError x
+  getEntries (ETH2S x) = getEntries x
+  getEffectiveEntries (ETH2S x) = getEffectiveEntries x
+  getFunction (ETH2S x) = getFunction x
+  getDimension (ETH2S x) = getDimension x
+  getKurtosis (ETH2S x) = getKurtosis x
+  getLowEdge (ETH2S x) = getLowEdge x
+  getMaximumTH1 (ETH2S x) = getMaximumTH1 x
+  getMaximumBin (ETH2S x) = getMaximumBin x
+  getMaximumStored (ETH2S x) = getMaximumStored x
+  getMinimumTH1 (ETH2S x) = getMinimumTH1 x
+  getMinimumBin (ETH2S x) = getMinimumBin x
+  getMinimumStored (ETH2S x) = getMinimumStored x
+  getMean (ETH2S x) = getMean x
+  getMeanError (ETH2S x) = getMeanError x
+  getNbinsX (ETH2S x) = getNbinsX x
+  getNbinsY (ETH2S x) = getNbinsY x
+  getNbinsZ (ETH2S x) = getNbinsZ x
+  getQuantilesTH1 (ETH2S x) = getQuantilesTH1 x
+  getRandom (ETH2S x) = getRandom x
+  getStats (ETH2S x) = getStats x
+  getSumOfWeights (ETH2S x) = getSumOfWeights x
+  getSumw2 (ETH2S x) = getSumw2 x
+  getSumw2N (ETH2S x) = getSumw2N x
+  getRMS (ETH2S x) = getRMS x
+  getRMSError (ETH2S x) = getRMSError x
+  getSkewness (ETH2S x) = getSkewness x
+  integral1 (ETH2S x) = integral1 x
+  interpolate1 (ETH2S x) = interpolate1 x
+  interpolate2 (ETH2S x) = interpolate2 x
+  interpolate3 (ETH2S x) = interpolate3 x
+  kolmogorovTest (ETH2S x) = kolmogorovTest x
+  labelsDeflate (ETH2S x) = labelsDeflate x
+  labelsInflate (ETH2S x) = labelsInflate x
+  labelsOption (ETH2S x) = labelsOption x
+  multiflyF (ETH2S x) = multiflyF x
+  multiply (ETH2S x) = multiply x
+  putStats (ETH2S x) = putStats x
+  rebin (ETH2S x) = rebin x
+  rebinAxis (ETH2S x) = rebinAxis x
+  rebuild (ETH2S x) = rebuild x
+  recursiveRemove (ETH2S x) = recursiveRemove x
+  reset (ETH2S x) = reset x
+  resetStats (ETH2S x) = resetStats x
+  scale (ETH2S x) = scale x
+  setAxisColorA (ETH2S x) = setAxisColorA x
+  setAxisRange (ETH2S x) = setAxisRange x
+  setBarOffset (ETH2S x) = setBarOffset x
+  setBarWidth (ETH2S x) = setBarWidth x
+  setBinContent1 (ETH2S x) = setBinContent1 x
+  setBinContent2 (ETH2S x) = setBinContent2 x
+  setBinContent3 (ETH2S x) = setBinContent3 x
+  setBinError1 (ETH2S x) = setBinError1 x
+  setBinError2 (ETH2S x) = setBinError2 x
+  setBinError3 (ETH2S x) = setBinError3 x
+  setBins1 (ETH2S x) = setBins1 x
+  setBins2 (ETH2S x) = setBins2 x
+  setBins3 (ETH2S x) = setBins3 x
+  setBinsLength (ETH2S x) = setBinsLength x
+  setBuffer (ETH2S x) = setBuffer x
+  setCellContent (ETH2S x) = setCellContent x
+  setContent (ETH2S x) = setContent x
+  setContour (ETH2S x) = setContour x
+  setContourLevel (ETH2S x) = setContourLevel x
+  setDirectory (ETH2S x) = setDirectory x
+  setEntries (ETH2S x) = setEntries x
+  setError (ETH2S x) = setError x
+  setLabelColorA (ETH2S x) = setLabelColorA x
+  setLabelSizeA (ETH2S x) = setLabelSizeA x
+  setLabelFontA (ETH2S x) = setLabelFontA x
+  setLabelOffsetA (ETH2S x) = setLabelOffsetA x
+  setMaximum (ETH2S x) = setMaximum x
+  setMinimum (ETH2S x) = setMinimum x
+  setNormFactor (ETH2S x) = setNormFactor x
+  setStats (ETH2S x) = setStats x
+  setOption (ETH2S x) = setOption x
+  setXTitle (ETH2S x) = setXTitle x
+  setYTitle (ETH2S x) = setYTitle x
+  setZTitle (ETH2S x) = setZTitle x
+  showBackground (ETH2S x) = showBackground x
+  showPeaks (ETH2S x) = showPeaks x
+  smooth (ETH2S x) = smooth x
+  sumw2 (ETH2S x) = sumw2 x
+instance ITObject (Exist TH2S) where
+  draw (ETH2S x) = draw x
+  findObject (ETH2S x) = findObject x
+  getName (ETH2S x) = getName x
+  isA (ETH2S x) = isA x
+  paint (ETH2S x) = paint x
+  printObj (ETH2S x) = printObj x
+  saveAs (ETH2S x) = saveAs x
+  write (ETH2S x) = write x
+instance ITAttLine (Exist TH2S) where
+  getLineColor (ETH2S x) = getLineColor x
+  getLineStyle (ETH2S x) = getLineStyle x
+  getLineWidth (ETH2S x) = getLineWidth x
+  resetAttLine (ETH2S x) = resetAttLine x
+  setLineAttributes (ETH2S x) = setLineAttributes x
+  setLineColor (ETH2S x) = setLineColor x
+  setLineStyle (ETH2S x) = setLineStyle x
+  setLineWidth (ETH2S x) = setLineWidth x
+instance ITAttFill (Exist TH2S) where
+  setFillColor (ETH2S x) = setFillColor x
+  setFillStyle (ETH2S x) = setFillStyle x
+instance ITAttMarker (Exist TH2S) where
+  getMarkerColor (ETH2S x) = getMarkerColor x
+  getMarkerStyle (ETH2S x) = getMarkerStyle x
+  getMarkerSize (ETH2S x) = getMarkerSize x
+  resetAttMarker (ETH2S x) = resetAttMarker x
+  setMarkerAttributes (ETH2S x) = setMarkerAttributes x
+  setMarkerColor (ETH2S x) = setMarkerColor x
+  setMarkerStyle (ETH2S x) = setMarkerStyle x
+  setMarkerSize (ETH2S x) = setMarkerSize x
+instance IDeletable (Exist TH2S) where
+  delete (ETH2S x) = delete x
+instance ITArray (Exist TH2S) where
+
+
+
+
+
+
+
+
+instance FPtr (Exist TH2S) where
+  type Raw (Exist TH2S) = RawTH2S
+  get_fptr (ETH2S obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH2S (cast_fptr_to_obj (fptr :: ForeignPtr RawTH2S) :: TH2S)
diff --git a/src/HROOT/Hist/TH2S/Interface.hs b/src/HROOT/Hist/TH2S/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2S/Interface.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH2S.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH2S.RawType
+
+import HROOT.Hist.TH2.Interface
+import HROOT.Core.TArrayS.Interface
+---- ============ ----
+
+
+
+class (ITH2 a,ITArrayS a) => ITH2S a where
+
+instance Existable TH2S where
+  data Exist TH2S = forall a. (FPtr a, ITH2S a) => ETH2S a
+
+upcastTH2S :: (FPtr a, ITH2S a) => a -> TH2S
+upcastTH2S h = let fh = get_fptr h
+                   fh2 :: ForeignPtr RawTH2S = castForeignPtr fh
+               in cast_fptr_to_obj fh2
+
+downcastTH2S :: (FPtr a, ITH2S a) => TH2S -> a 
+downcastTH2S h = let fh = get_fptr h
+                     fh2 = castForeignPtr fh
+                 in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH2S/RawType.hs b/src/HROOT/Hist/TH2S/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH2S/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH2S.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH2S
+newtype TH2S = TH2S (ForeignPtr RawTH2S) deriving (Eq, Ord, Show)
+instance FPtr TH2S where
+   type Raw TH2S = RawTH2S
+   get_fptr (TH2S fptr) = fptr
+   cast_fptr_to_obj = TH2S
diff --git a/src/HROOT/Hist/TH3.hs b/src/HROOT/Hist/TH3.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3.hs
@@ -0,0 +1,18 @@
+module HROOT.Hist.TH3
+  (
+    TH3(..)
+  , ITH3(..)
+  , upcastTH3
+  , downcastTH3
+  , tH3ProjectionX
+  , tH3ProjectionY
+  , tH3ProjectionZ
+  , tH3Project3D
+ 
+  ) where
+
+import HROOT.Hist.TH3.RawType
+import HROOT.Hist.TH3.Interface
+import HROOT.Hist.TH3.Implementation
+
+
diff --git a/src/HROOT/Hist/TH3/Cast.hs b/src/HROOT/Hist/TH3/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH3.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH3.RawType
+import HROOT.Hist.TH3.Interface
+
+instance (ITH3 a, FPtr a) => Castable a (Ptr RawTH3) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH3 (Ptr RawTH3) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH3/FFI.hsc b/src/HROOT/Hist/TH3/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3/FFI.hsc
@@ -0,0 +1,536 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH3.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH3.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+import HROOT.Hist.TH1D.RawType
+
+#include "HROOTHistTH3.h"
+
+foreign import ccall "HROOTHistTH3.h TH3_Add" c_th3_add 
+  :: (Ptr RawTH3) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_AddBinContent" c_th3_addbincontent 
+  :: (Ptr RawTH3) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_Chi2Test" c_th3_chi2test 
+  :: (Ptr RawTH3) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_ComputeIntegral" c_th3_computeintegral 
+  :: (Ptr RawTH3) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_DirectoryAutoAdd" c_th3_directoryautoadd 
+  :: (Ptr RawTH3) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_Divide" c_th3_divide 
+  :: (Ptr RawTH3) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_drawCopyTH1" c_th3_drawcopyth1 
+  :: (Ptr RawTH3) -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3.h TH3_DrawNormalized" c_th3_drawnormalized 
+  :: (Ptr RawTH3) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3.h TH3_drawPanelTH1" c_th3_drawpanelth1 
+  :: (Ptr RawTH3) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_BufferEmpty" c_th3_bufferempty 
+  :: (Ptr RawTH3) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_evalF" c_th3_evalf 
+  :: (Ptr RawTH3) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_FFT" c_th3_fft 
+  :: (Ptr RawTH3) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3.h TH3_fill1" c_th3_fill1 
+  :: (Ptr RawTH3) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_fill1w" c_th3_fill1w 
+  :: (Ptr RawTH3) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_fillN1" c_th3_filln1 
+  :: (Ptr RawTH3) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_FillRandom" c_th3_fillrandom 
+  :: (Ptr RawTH3) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_FindBin" c_th3_findbin 
+  :: (Ptr RawTH3) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_FindFixBin" c_th3_findfixbin 
+  :: (Ptr RawTH3) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_FindFirstBinAbove" c_th3_findfirstbinabove 
+  :: (Ptr RawTH3) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_FindLastBinAbove" c_th3_findlastbinabove 
+  :: (Ptr RawTH3) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_FitPanelTH1" c_th3_fitpanelth1 
+  :: (Ptr RawTH3) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_getNdivisionA" c_th3_getndivisiona 
+  :: (Ptr RawTH3) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_getAxisColorA" c_th3_getaxiscolora 
+  :: (Ptr RawTH3) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_getLabelColorA" c_th3_getlabelcolora 
+  :: (Ptr RawTH3) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_getLabelFontA" c_th3_getlabelfonta 
+  :: (Ptr RawTH3) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_getLabelOffsetA" c_th3_getlabeloffseta 
+  :: (Ptr RawTH3) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_getLabelSizeA" c_th3_getlabelsizea 
+  :: (Ptr RawTH3) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_getTitleFontA" c_th3_gettitlefonta 
+  :: (Ptr RawTH3) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_getTitleOffsetA" c_th3_gettitleoffseta 
+  :: (Ptr RawTH3) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_getTitleSizeA" c_th3_gettitlesizea 
+  :: (Ptr RawTH3) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_getTickLengthA" c_th3_getticklengtha 
+  :: (Ptr RawTH3) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetBarOffset" c_th3_getbaroffset 
+  :: (Ptr RawTH3) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetBarWidth" c_th3_getbarwidth 
+  :: (Ptr RawTH3) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetContour" c_th3_getcontour 
+  :: (Ptr RawTH3) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_GetContourLevel" c_th3_getcontourlevel 
+  :: (Ptr RawTH3) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetContourLevelPad" c_th3_getcontourlevelpad 
+  :: (Ptr RawTH3) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetBin" c_th3_getbin 
+  :: (Ptr RawTH3) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_GetBinCenter" c_th3_getbincenter 
+  :: (Ptr RawTH3) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetBinContent1" c_th3_getbincontent1 
+  :: (Ptr RawTH3) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetBinContent2" c_th3_getbincontent2 
+  :: (Ptr RawTH3) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetBinContent3" c_th3_getbincontent3 
+  :: (Ptr RawTH3) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetBinError1" c_th3_getbinerror1 
+  :: (Ptr RawTH3) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetBinError2" c_th3_getbinerror2 
+  :: (Ptr RawTH3) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetBinError3" c_th3_getbinerror3 
+  :: (Ptr RawTH3) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetBinLowEdge" c_th3_getbinlowedge 
+  :: (Ptr RawTH3) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetBinWidth" c_th3_getbinwidth 
+  :: (Ptr RawTH3) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetCellContent" c_th3_getcellcontent 
+  :: (Ptr RawTH3) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetCellError" c_th3_getcellerror 
+  :: (Ptr RawTH3) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetEntries" c_th3_getentries 
+  :: (Ptr RawTH3) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetEffectiveEntries" c_th3_geteffectiveentries 
+  :: (Ptr RawTH3) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetFunction" c_th3_getfunction 
+  :: (Ptr RawTH3) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH3.h TH3_GetDimension" c_th3_getdimension 
+  :: (Ptr RawTH3) -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_GetKurtosis" c_th3_getkurtosis 
+  :: (Ptr RawTH3) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetLowEdge" c_th3_getlowedge 
+  :: (Ptr RawTH3) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_getMaximumTH1" c_th3_getmaximumth1 
+  :: (Ptr RawTH3) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetMaximumBin" c_th3_getmaximumbin 
+  :: (Ptr RawTH3) -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_GetMaximumStored" c_th3_getmaximumstored 
+  :: (Ptr RawTH3) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_getMinimumTH1" c_th3_getminimumth1 
+  :: (Ptr RawTH3) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetMinimumBin" c_th3_getminimumbin 
+  :: (Ptr RawTH3) -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_GetMinimumStored" c_th3_getminimumstored 
+  :: (Ptr RawTH3) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetMean" c_th3_getmean 
+  :: (Ptr RawTH3) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetMeanError" c_th3_getmeanerror 
+  :: (Ptr RawTH3) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetNbinsX" c_th3_getnbinsx 
+  :: (Ptr RawTH3) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetNbinsY" c_th3_getnbinsy 
+  :: (Ptr RawTH3) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetNbinsZ" c_th3_getnbinsz 
+  :: (Ptr RawTH3) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_getQuantilesTH1" c_th3_getquantilesth1 
+  :: (Ptr RawTH3) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_GetRandom" c_th3_getrandom 
+  :: (Ptr RawTH3) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetStats" c_th3_getstats 
+  :: (Ptr RawTH3) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_GetSumOfWeights" c_th3_getsumofweights 
+  :: (Ptr RawTH3) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetSumw2" c_th3_getsumw2 
+  :: (Ptr RawTH3) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH3.h TH3_GetSumw2N" c_th3_getsumw2n 
+  :: (Ptr RawTH3) -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_GetRMS" c_th3_getrms 
+  :: (Ptr RawTH3) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetRMSError" c_th3_getrmserror 
+  :: (Ptr RawTH3) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_GetSkewness" c_th3_getskewness 
+  :: (Ptr RawTH3) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_integral1" c_th3_integral1 
+  :: (Ptr RawTH3) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_interpolate1" c_th3_interpolate1 
+  :: (Ptr RawTH3) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_interpolate2" c_th3_interpolate2 
+  :: (Ptr RawTH3) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_interpolate3" c_th3_interpolate3 
+  :: (Ptr RawTH3) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_KolmogorovTest" c_th3_kolmogorovtest 
+  :: (Ptr RawTH3) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_LabelsDeflate" c_th3_labelsdeflate 
+  :: (Ptr RawTH3) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_LabelsInflate" c_th3_labelsinflate 
+  :: (Ptr RawTH3) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_LabelsOption" c_th3_labelsoption 
+  :: (Ptr RawTH3) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_multiflyF" c_th3_multiflyf 
+  :: (Ptr RawTH3) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_Multiply" c_th3_multiply 
+  :: (Ptr RawTH3) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_PutStats" c_th3_putstats 
+  :: (Ptr RawTH3) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_Rebin" c_th3_rebin 
+  :: (Ptr RawTH3) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3.h TH3_RebinAxis" c_th3_rebinaxis 
+  :: (Ptr RawTH3) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_Rebuild" c_th3_rebuild 
+  :: (Ptr RawTH3) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_RecursiveRemove" c_th3_recursiveremove 
+  :: (Ptr RawTH3) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_Reset" c_th3_reset 
+  :: (Ptr RawTH3) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_ResetStats" c_th3_resetstats 
+  :: (Ptr RawTH3) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_Scale" c_th3_scale 
+  :: (Ptr RawTH3) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_setAxisColorA" c_th3_setaxiscolora 
+  :: (Ptr RawTH3) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetAxisRange" c_th3_setaxisrange 
+  :: (Ptr RawTH3) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetBarOffset" c_th3_setbaroffset 
+  :: (Ptr RawTH3) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetBarWidth" c_th3_setbarwidth 
+  :: (Ptr RawTH3) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_setBinContent1" c_th3_setbincontent1 
+  :: (Ptr RawTH3) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_setBinContent2" c_th3_setbincontent2 
+  :: (Ptr RawTH3) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_setBinContent3" c_th3_setbincontent3 
+  :: (Ptr RawTH3) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_setBinError1" c_th3_setbinerror1 
+  :: (Ptr RawTH3) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_setBinError2" c_th3_setbinerror2 
+  :: (Ptr RawTH3) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_setBinError3" c_th3_setbinerror3 
+  :: (Ptr RawTH3) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_setBins1" c_th3_setbins1 
+  :: (Ptr RawTH3) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_setBins2" c_th3_setbins2 
+  :: (Ptr RawTH3) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_setBins3" c_th3_setbins3 
+  :: (Ptr RawTH3) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetBinsLength" c_th3_setbinslength 
+  :: (Ptr RawTH3) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetBuffer" c_th3_setbuffer 
+  :: (Ptr RawTH3) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetCellContent" c_th3_setcellcontent 
+  :: (Ptr RawTH3) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetContent" c_th3_setcontent 
+  :: (Ptr RawTH3) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetContour" c_th3_setcontour 
+  :: (Ptr RawTH3) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetContourLevel" c_th3_setcontourlevel 
+  :: (Ptr RawTH3) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetDirectory" c_th3_setdirectory 
+  :: (Ptr RawTH3) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetEntries" c_th3_setentries 
+  :: (Ptr RawTH3) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetError" c_th3_seterror 
+  :: (Ptr RawTH3) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_setLabelColorA" c_th3_setlabelcolora 
+  :: (Ptr RawTH3) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_setLabelSizeA" c_th3_setlabelsizea 
+  :: (Ptr RawTH3) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_setLabelFontA" c_th3_setlabelfonta 
+  :: (Ptr RawTH3) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_setLabelOffsetA" c_th3_setlabeloffseta 
+  :: (Ptr RawTH3) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetMaximum" c_th3_setmaximum 
+  :: (Ptr RawTH3) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetMinimum" c_th3_setminimum 
+  :: (Ptr RawTH3) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetNormFactor" c_th3_setnormfactor 
+  :: (Ptr RawTH3) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetStats" c_th3_setstats 
+  :: (Ptr RawTH3) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetOption" c_th3_setoption 
+  :: (Ptr RawTH3) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetXTitle" c_th3_setxtitle 
+  :: (Ptr RawTH3) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetYTitle" c_th3_setytitle 
+  :: (Ptr RawTH3) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetZTitle" c_th3_setztitle 
+  :: (Ptr RawTH3) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_ShowBackground" c_th3_showbackground 
+  :: (Ptr RawTH3) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3.h TH3_ShowPeaks" c_th3_showpeaks 
+  :: (Ptr RawTH3) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_Smooth" c_th3_smooth 
+  :: (Ptr RawTH3) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_Sumw2" c_th3_sumw2 
+  :: (Ptr RawTH3) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_Draw" c_th3_draw 
+  :: (Ptr RawTH3) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_FindObject" c_th3_findobject 
+  :: (Ptr RawTH3) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH3.h TH3_GetName" c_th3_getname 
+  :: (Ptr RawTH3) -> IO CString
+
+foreign import ccall "HROOTHistTH3.h TH3_IsA" c_th3_isa 
+  :: (Ptr RawTH3) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH3.h TH3_Paint" c_th3_paint 
+  :: (Ptr RawTH3) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_printObj" c_th3_printobj 
+  :: (Ptr RawTH3) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SaveAs" c_th3_saveas 
+  :: (Ptr RawTH3) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_Write" c_th3_write 
+  :: (Ptr RawTH3) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_GetLineColor" c_th3_getlinecolor 
+  :: (Ptr RawTH3) -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_GetLineStyle" c_th3_getlinestyle 
+  :: (Ptr RawTH3) -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_GetLineWidth" c_th3_getlinewidth 
+  :: (Ptr RawTH3) -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_ResetAttLine" c_th3_resetattline 
+  :: (Ptr RawTH3) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetLineAttributes" c_th3_setlineattributes 
+  :: (Ptr RawTH3) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetLineColor" c_th3_setlinecolor 
+  :: (Ptr RawTH3) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetLineStyle" c_th3_setlinestyle 
+  :: (Ptr RawTH3) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetLineWidth" c_th3_setlinewidth 
+  :: (Ptr RawTH3) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetFillColor" c_th3_setfillcolor 
+  :: (Ptr RawTH3) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetFillStyle" c_th3_setfillstyle 
+  :: (Ptr RawTH3) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_GetMarkerColor" c_th3_getmarkercolor 
+  :: (Ptr RawTH3) -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_GetMarkerStyle" c_th3_getmarkerstyle 
+  :: (Ptr RawTH3) -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_GetMarkerSize" c_th3_getmarkersize 
+  :: (Ptr RawTH3) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_ResetAttMarker" c_th3_resetattmarker 
+  :: (Ptr RawTH3) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetMarkerAttributes" c_th3_setmarkerattributes 
+  :: (Ptr RawTH3) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetMarkerColor" c_th3_setmarkercolor 
+  :: (Ptr RawTH3) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetMarkerStyle" c_th3_setmarkerstyle 
+  :: (Ptr RawTH3) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_SetMarkerSize" c_th3_setmarkersize 
+  :: (Ptr RawTH3) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_delete" c_th3_delete 
+  :: (Ptr RawTH3) -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_fill3" c_th3_fill3 
+  :: (Ptr RawTH3) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_fill3w" c_th3_fill3w 
+  :: (Ptr RawTH3) -> CDouble -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3.h TH3_FitSlicesZ" c_th3_fitslicesz 
+  :: (Ptr RawTH3) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CInt -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3.h TH3_getCorrelationFactor3" c_th3_getcorrelationfactor3 
+  :: (Ptr RawTH3) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_getCovariance3" c_th3_getcovariance3 
+  :: (Ptr RawTH3) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3.h TH3_tH3ProjectionX" c_th3_th3projectionx 
+  :: (Ptr RawTH3) -> CString -> CInt -> CInt -> CInt -> CInt -> CString -> IO (Ptr RawTH1D)
+
+foreign import ccall "HROOTHistTH3.h TH3_tH3ProjectionY" c_th3_th3projectiony 
+  :: (Ptr RawTH3) -> CString -> CInt -> CInt -> CInt -> CInt -> CString -> IO (Ptr RawTH1D)
+
+foreign import ccall "HROOTHistTH3.h TH3_tH3ProjectionZ" c_th3_th3projectionz 
+  :: (Ptr RawTH3) -> CString -> CInt -> CInt -> CInt -> CInt -> CString -> IO (Ptr RawTH1D)
+
+foreign import ccall "HROOTHistTH3.h TH3_tH3Project3D" c_th3_th3project3d 
+  :: (Ptr RawTH3) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3.h TH3_rebinX3" c_th3_rebinx3 
+  :: (Ptr RawTH3) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3.h TH3_rebinY3" c_th3_rebiny3 
+  :: (Ptr RawTH3) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3.h TH3_rebinZ3" c_th3_rebinz3 
+  :: (Ptr RawTH3) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3.h TH3_Rebin3D" c_th3_rebin3d 
+  :: (Ptr RawTH3) -> CInt -> CInt -> CInt -> CString -> IO (Ptr RawTH3)
+
diff --git a/src/HROOT/Hist/TH3/Implementation.hs b/src/HROOT/Hist/TH3/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3/Implementation.hs
@@ -0,0 +1,432 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH3.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH3.RawType
+import HROOT.Hist.TH3.FFI
+import HROOT.Hist.TH3.Interface
+import HROOT.Hist.TH3.Cast
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1D.Cast
+import HROOT.Hist.TH1D.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TAtt3D.RawType
+import HROOT.Core.TAtt3D.Cast
+import HROOT.Core.TAtt3D.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH3 TH3 where
+  fill3 = xform3 c_th3_fill3
+  fill3w = xform4 c_th3_fill3w
+  fitSlicesZ = xform7 c_th3_fitslicesz
+  getCorrelationFactor3 = xform2 c_th3_getcorrelationfactor3
+  getCovariance3 = xform2 c_th3_getcovariance3
+  rebinX3 = xform2 c_th3_rebinx3
+  rebinY3 = xform2 c_th3_rebiny3
+  rebinZ3 = xform2 c_th3_rebinz3
+  rebin3D = xform4 c_th3_rebin3d
+instance ITH1 TH3 where
+  add = xform2 c_th3_add
+  addBinContent = xform2 c_th3_addbincontent
+  chi2Test = xform3 c_th3_chi2test
+  computeIntegral = xform0 c_th3_computeintegral
+  directoryAutoAdd = xform1 c_th3_directoryautoadd
+  divide = xform5 c_th3_divide
+  drawCopyTH1 = xform1 c_th3_drawcopyth1
+  drawNormalized = xform2 c_th3_drawnormalized
+  drawPanelTH1 = xform0 c_th3_drawpanelth1
+  bufferEmpty = xform1 c_th3_bufferempty
+  evalF = xform2 c_th3_evalf
+  fFT = xform2 c_th3_fft
+  fill1 = xform1 c_th3_fill1
+  fill1w = xform2 c_th3_fill1w
+  fillN1 = xform4 c_th3_filln1
+  fillRandom = xform2 c_th3_fillrandom
+  findBin = xform3 c_th3_findbin
+  findFixBin = xform3 c_th3_findfixbin
+  findFirstBinAbove = xform2 c_th3_findfirstbinabove
+  findLastBinAbove = xform2 c_th3_findlastbinabove
+  fitPanelTH1 = xform0 c_th3_fitpanelth1
+  getNdivisionA = xform1 c_th3_getndivisiona
+  getAxisColorA = xform1 c_th3_getaxiscolora
+  getLabelColorA = xform1 c_th3_getlabelcolora
+  getLabelFontA = xform1 c_th3_getlabelfonta
+  getLabelOffsetA = xform1 c_th3_getlabeloffseta
+  getLabelSizeA = xform1 c_th3_getlabelsizea
+  getTitleFontA = xform1 c_th3_gettitlefonta
+  getTitleOffsetA = xform1 c_th3_gettitleoffseta
+  getTitleSizeA = xform1 c_th3_gettitlesizea
+  getTickLengthA = xform1 c_th3_getticklengtha
+  getBarOffset = xform0 c_th3_getbaroffset
+  getBarWidth = xform0 c_th3_getbarwidth
+  getContour = xform1 c_th3_getcontour
+  getContourLevel = xform1 c_th3_getcontourlevel
+  getContourLevelPad = xform1 c_th3_getcontourlevelpad
+  getBin = xform3 c_th3_getbin
+  getBinCenter = xform1 c_th3_getbincenter
+  getBinContent1 = xform1 c_th3_getbincontent1
+  getBinContent2 = xform2 c_th3_getbincontent2
+  getBinContent3 = xform3 c_th3_getbincontent3
+  getBinError1 = xform1 c_th3_getbinerror1
+  getBinError2 = xform2 c_th3_getbinerror2
+  getBinError3 = xform3 c_th3_getbinerror3
+  getBinLowEdge = xform1 c_th3_getbinlowedge
+  getBinWidth = xform1 c_th3_getbinwidth
+  getCellContent = xform2 c_th3_getcellcontent
+  getCellError = xform2 c_th3_getcellerror
+  getEntries = xform0 c_th3_getentries
+  getEffectiveEntries = xform0 c_th3_geteffectiveentries
+  getFunction = xform1 c_th3_getfunction
+  getDimension = xform0 c_th3_getdimension
+  getKurtosis = xform1 c_th3_getkurtosis
+  getLowEdge = xform1 c_th3_getlowedge
+  getMaximumTH1 = xform1 c_th3_getmaximumth1
+  getMaximumBin = xform0 c_th3_getmaximumbin
+  getMaximumStored = xform0 c_th3_getmaximumstored
+  getMinimumTH1 = xform1 c_th3_getminimumth1
+  getMinimumBin = xform0 c_th3_getminimumbin
+  getMinimumStored = xform0 c_th3_getminimumstored
+  getMean = xform1 c_th3_getmean
+  getMeanError = xform1 c_th3_getmeanerror
+  getNbinsX = xform0 c_th3_getnbinsx
+  getNbinsY = xform0 c_th3_getnbinsy
+  getNbinsZ = xform0 c_th3_getnbinsz
+  getQuantilesTH1 = xform3 c_th3_getquantilesth1
+  getRandom = xform0 c_th3_getrandom
+  getStats = xform1 c_th3_getstats
+  getSumOfWeights = xform0 c_th3_getsumofweights
+  getSumw2 = xform0 c_th3_getsumw2
+  getSumw2N = xform0 c_th3_getsumw2n
+  getRMS = xform1 c_th3_getrms
+  getRMSError = xform1 c_th3_getrmserror
+  getSkewness = xform1 c_th3_getskewness
+  integral1 = xform3 c_th3_integral1
+  interpolate1 = xform1 c_th3_interpolate1
+  interpolate2 = xform2 c_th3_interpolate2
+  interpolate3 = xform3 c_th3_interpolate3
+  kolmogorovTest = xform2 c_th3_kolmogorovtest
+  labelsDeflate = xform1 c_th3_labelsdeflate
+  labelsInflate = xform1 c_th3_labelsinflate
+  labelsOption = xform2 c_th3_labelsoption
+  multiflyF = xform2 c_th3_multiflyf
+  multiply = xform5 c_th3_multiply
+  putStats = xform1 c_th3_putstats
+  rebin = xform3 c_th3_rebin
+  rebinAxis = xform2 c_th3_rebinaxis
+  rebuild = xform1 c_th3_rebuild
+  recursiveRemove = xform1 c_th3_recursiveremove
+  reset = xform1 c_th3_reset
+  resetStats = xform0 c_th3_resetstats
+  scale = xform2 c_th3_scale
+  setAxisColorA = xform2 c_th3_setaxiscolora
+  setAxisRange = xform3 c_th3_setaxisrange
+  setBarOffset = xform1 c_th3_setbaroffset
+  setBarWidth = xform1 c_th3_setbarwidth
+  setBinContent1 = xform2 c_th3_setbincontent1
+  setBinContent2 = xform3 c_th3_setbincontent2
+  setBinContent3 = xform4 c_th3_setbincontent3
+  setBinError1 = xform2 c_th3_setbinerror1
+  setBinError2 = xform3 c_th3_setbinerror2
+  setBinError3 = xform4 c_th3_setbinerror3
+  setBins1 = xform2 c_th3_setbins1
+  setBins2 = xform4 c_th3_setbins2
+  setBins3 = xform6 c_th3_setbins3
+  setBinsLength = xform1 c_th3_setbinslength
+  setBuffer = xform2 c_th3_setbuffer
+  setCellContent = xform3 c_th3_setcellcontent
+  setContent = xform1 c_th3_setcontent
+  setContour = xform2 c_th3_setcontour
+  setContourLevel = xform2 c_th3_setcontourlevel
+  setDirectory = xform1 c_th3_setdirectory
+  setEntries = xform1 c_th3_setentries
+  setError = xform1 c_th3_seterror
+  setLabelColorA = xform2 c_th3_setlabelcolora
+  setLabelSizeA = xform2 c_th3_setlabelsizea
+  setLabelFontA = xform2 c_th3_setlabelfonta
+  setLabelOffsetA = xform2 c_th3_setlabeloffseta
+  setMaximum = xform1 c_th3_setmaximum
+  setMinimum = xform1 c_th3_setminimum
+  setNormFactor = xform1 c_th3_setnormfactor
+  setStats = xform1 c_th3_setstats
+  setOption = xform1 c_th3_setoption
+  setXTitle = xform1 c_th3_setxtitle
+  setYTitle = xform1 c_th3_setytitle
+  setZTitle = xform1 c_th3_setztitle
+  showBackground = xform2 c_th3_showbackground
+  showPeaks = xform3 c_th3_showpeaks
+  smooth = xform2 c_th3_smooth
+  sumw2 = xform0 c_th3_sumw2
+instance ITAtt3D TH3 where
+instance ITObject TH3 where
+  draw = xform1 c_th3_draw
+  findObject = xform1 c_th3_findobject
+  getName = xform0 c_th3_getname
+  isA = xform0 c_th3_isa
+  paint = xform1 c_th3_paint
+  printObj = xform1 c_th3_printobj
+  saveAs = xform2 c_th3_saveas
+  write = xform3 c_th3_write
+instance ITAttLine TH3 where
+  getLineColor = xform0 c_th3_getlinecolor
+  getLineStyle = xform0 c_th3_getlinestyle
+  getLineWidth = xform0 c_th3_getlinewidth
+  resetAttLine = xform1 c_th3_resetattline
+  setLineAttributes = xform0 c_th3_setlineattributes
+  setLineColor = xform1 c_th3_setlinecolor
+  setLineStyle = xform1 c_th3_setlinestyle
+  setLineWidth = xform1 c_th3_setlinewidth
+instance ITAttFill TH3 where
+  setFillColor = xform1 c_th3_setfillcolor
+  setFillStyle = xform1 c_th3_setfillstyle
+instance ITAttMarker TH3 where
+  getMarkerColor = xform0 c_th3_getmarkercolor
+  getMarkerStyle = xform0 c_th3_getmarkerstyle
+  getMarkerSize = xform0 c_th3_getmarkersize
+  resetAttMarker = xform1 c_th3_resetattmarker
+  setMarkerAttributes = xform0 c_th3_setmarkerattributes
+  setMarkerColor = xform1 c_th3_setmarkercolor
+  setMarkerStyle = xform1 c_th3_setmarkerstyle
+  setMarkerSize = xform1 c_th3_setmarkersize
+instance IDeletable TH3 where
+  delete = xform0 c_th3_delete
+
+instance ITH3 (Exist TH3) where
+  fill3 (ETH3 x) = fill3 x
+  fill3w (ETH3 x) = fill3w x
+  fitSlicesZ (ETH3 x) = fitSlicesZ x
+  getCorrelationFactor3 (ETH3 x) = getCorrelationFactor3 x
+  getCovariance3 (ETH3 x) = getCovariance3 x
+  rebinX3 (ETH3 x) = rebinX3 x
+  rebinY3 (ETH3 x) = rebinY3 x
+  rebinZ3 (ETH3 x) = rebinZ3 x
+  rebin3D (ETH3 x) = rebin3D x
+instance ITH1 (Exist TH3) where
+  add (ETH3 x) = add x
+  addBinContent (ETH3 x) = addBinContent x
+  chi2Test (ETH3 x) = chi2Test x
+  computeIntegral (ETH3 x) = computeIntegral x
+  directoryAutoAdd (ETH3 x) = directoryAutoAdd x
+  divide (ETH3 x) = divide x
+  drawCopyTH1 (ETH3 x) a1 = return . ETH3 =<< drawCopyTH1 x a1
+  drawNormalized (ETH3 x) = drawNormalized x
+  drawPanelTH1 (ETH3 x) = drawPanelTH1 x
+  bufferEmpty (ETH3 x) = bufferEmpty x
+  evalF (ETH3 x) = evalF x
+  fFT (ETH3 x) = fFT x
+  fill1 (ETH3 x) = fill1 x
+  fill1w (ETH3 x) = fill1w x
+  fillN1 (ETH3 x) = fillN1 x
+  fillRandom (ETH3 x) = fillRandom x
+  findBin (ETH3 x) = findBin x
+  findFixBin (ETH3 x) = findFixBin x
+  findFirstBinAbove (ETH3 x) = findFirstBinAbove x
+  findLastBinAbove (ETH3 x) = findLastBinAbove x
+  fitPanelTH1 (ETH3 x) = fitPanelTH1 x
+  getNdivisionA (ETH3 x) = getNdivisionA x
+  getAxisColorA (ETH3 x) = getAxisColorA x
+  getLabelColorA (ETH3 x) = getLabelColorA x
+  getLabelFontA (ETH3 x) = getLabelFontA x
+  getLabelOffsetA (ETH3 x) = getLabelOffsetA x
+  getLabelSizeA (ETH3 x) = getLabelSizeA x
+  getTitleFontA (ETH3 x) = getTitleFontA x
+  getTitleOffsetA (ETH3 x) = getTitleOffsetA x
+  getTitleSizeA (ETH3 x) = getTitleSizeA x
+  getTickLengthA (ETH3 x) = getTickLengthA x
+  getBarOffset (ETH3 x) = getBarOffset x
+  getBarWidth (ETH3 x) = getBarWidth x
+  getContour (ETH3 x) = getContour x
+  getContourLevel (ETH3 x) = getContourLevel x
+  getContourLevelPad (ETH3 x) = getContourLevelPad x
+  getBin (ETH3 x) = getBin x
+  getBinCenter (ETH3 x) = getBinCenter x
+  getBinContent1 (ETH3 x) = getBinContent1 x
+  getBinContent2 (ETH3 x) = getBinContent2 x
+  getBinContent3 (ETH3 x) = getBinContent3 x
+  getBinError1 (ETH3 x) = getBinError1 x
+  getBinError2 (ETH3 x) = getBinError2 x
+  getBinError3 (ETH3 x) = getBinError3 x
+  getBinLowEdge (ETH3 x) = getBinLowEdge x
+  getBinWidth (ETH3 x) = getBinWidth x
+  getCellContent (ETH3 x) = getCellContent x
+  getCellError (ETH3 x) = getCellError x
+  getEntries (ETH3 x) = getEntries x
+  getEffectiveEntries (ETH3 x) = getEffectiveEntries x
+  getFunction (ETH3 x) = getFunction x
+  getDimension (ETH3 x) = getDimension x
+  getKurtosis (ETH3 x) = getKurtosis x
+  getLowEdge (ETH3 x) = getLowEdge x
+  getMaximumTH1 (ETH3 x) = getMaximumTH1 x
+  getMaximumBin (ETH3 x) = getMaximumBin x
+  getMaximumStored (ETH3 x) = getMaximumStored x
+  getMinimumTH1 (ETH3 x) = getMinimumTH1 x
+  getMinimumBin (ETH3 x) = getMinimumBin x
+  getMinimumStored (ETH3 x) = getMinimumStored x
+  getMean (ETH3 x) = getMean x
+  getMeanError (ETH3 x) = getMeanError x
+  getNbinsX (ETH3 x) = getNbinsX x
+  getNbinsY (ETH3 x) = getNbinsY x
+  getNbinsZ (ETH3 x) = getNbinsZ x
+  getQuantilesTH1 (ETH3 x) = getQuantilesTH1 x
+  getRandom (ETH3 x) = getRandom x
+  getStats (ETH3 x) = getStats x
+  getSumOfWeights (ETH3 x) = getSumOfWeights x
+  getSumw2 (ETH3 x) = getSumw2 x
+  getSumw2N (ETH3 x) = getSumw2N x
+  getRMS (ETH3 x) = getRMS x
+  getRMSError (ETH3 x) = getRMSError x
+  getSkewness (ETH3 x) = getSkewness x
+  integral1 (ETH3 x) = integral1 x
+  interpolate1 (ETH3 x) = interpolate1 x
+  interpolate2 (ETH3 x) = interpolate2 x
+  interpolate3 (ETH3 x) = interpolate3 x
+  kolmogorovTest (ETH3 x) = kolmogorovTest x
+  labelsDeflate (ETH3 x) = labelsDeflate x
+  labelsInflate (ETH3 x) = labelsInflate x
+  labelsOption (ETH3 x) = labelsOption x
+  multiflyF (ETH3 x) = multiflyF x
+  multiply (ETH3 x) = multiply x
+  putStats (ETH3 x) = putStats x
+  rebin (ETH3 x) = rebin x
+  rebinAxis (ETH3 x) = rebinAxis x
+  rebuild (ETH3 x) = rebuild x
+  recursiveRemove (ETH3 x) = recursiveRemove x
+  reset (ETH3 x) = reset x
+  resetStats (ETH3 x) = resetStats x
+  scale (ETH3 x) = scale x
+  setAxisColorA (ETH3 x) = setAxisColorA x
+  setAxisRange (ETH3 x) = setAxisRange x
+  setBarOffset (ETH3 x) = setBarOffset x
+  setBarWidth (ETH3 x) = setBarWidth x
+  setBinContent1 (ETH3 x) = setBinContent1 x
+  setBinContent2 (ETH3 x) = setBinContent2 x
+  setBinContent3 (ETH3 x) = setBinContent3 x
+  setBinError1 (ETH3 x) = setBinError1 x
+  setBinError2 (ETH3 x) = setBinError2 x
+  setBinError3 (ETH3 x) = setBinError3 x
+  setBins1 (ETH3 x) = setBins1 x
+  setBins2 (ETH3 x) = setBins2 x
+  setBins3 (ETH3 x) = setBins3 x
+  setBinsLength (ETH3 x) = setBinsLength x
+  setBuffer (ETH3 x) = setBuffer x
+  setCellContent (ETH3 x) = setCellContent x
+  setContent (ETH3 x) = setContent x
+  setContour (ETH3 x) = setContour x
+  setContourLevel (ETH3 x) = setContourLevel x
+  setDirectory (ETH3 x) = setDirectory x
+  setEntries (ETH3 x) = setEntries x
+  setError (ETH3 x) = setError x
+  setLabelColorA (ETH3 x) = setLabelColorA x
+  setLabelSizeA (ETH3 x) = setLabelSizeA x
+  setLabelFontA (ETH3 x) = setLabelFontA x
+  setLabelOffsetA (ETH3 x) = setLabelOffsetA x
+  setMaximum (ETH3 x) = setMaximum x
+  setMinimum (ETH3 x) = setMinimum x
+  setNormFactor (ETH3 x) = setNormFactor x
+  setStats (ETH3 x) = setStats x
+  setOption (ETH3 x) = setOption x
+  setXTitle (ETH3 x) = setXTitle x
+  setYTitle (ETH3 x) = setYTitle x
+  setZTitle (ETH3 x) = setZTitle x
+  showBackground (ETH3 x) = showBackground x
+  showPeaks (ETH3 x) = showPeaks x
+  smooth (ETH3 x) = smooth x
+  sumw2 (ETH3 x) = sumw2 x
+instance ITAtt3D (Exist TH3) where
+
+instance ITObject (Exist TH3) where
+  draw (ETH3 x) = draw x
+  findObject (ETH3 x) = findObject x
+  getName (ETH3 x) = getName x
+  isA (ETH3 x) = isA x
+  paint (ETH3 x) = paint x
+  printObj (ETH3 x) = printObj x
+  saveAs (ETH3 x) = saveAs x
+  write (ETH3 x) = write x
+instance ITAttLine (Exist TH3) where
+  getLineColor (ETH3 x) = getLineColor x
+  getLineStyle (ETH3 x) = getLineStyle x
+  getLineWidth (ETH3 x) = getLineWidth x
+  resetAttLine (ETH3 x) = resetAttLine x
+  setLineAttributes (ETH3 x) = setLineAttributes x
+  setLineColor (ETH3 x) = setLineColor x
+  setLineStyle (ETH3 x) = setLineStyle x
+  setLineWidth (ETH3 x) = setLineWidth x
+instance ITAttFill (Exist TH3) where
+  setFillColor (ETH3 x) = setFillColor x
+  setFillStyle (ETH3 x) = setFillStyle x
+instance ITAttMarker (Exist TH3) where
+  getMarkerColor (ETH3 x) = getMarkerColor x
+  getMarkerStyle (ETH3 x) = getMarkerStyle x
+  getMarkerSize (ETH3 x) = getMarkerSize x
+  resetAttMarker (ETH3 x) = resetAttMarker x
+  setMarkerAttributes (ETH3 x) = setMarkerAttributes x
+  setMarkerColor (ETH3 x) = setMarkerColor x
+  setMarkerStyle (ETH3 x) = setMarkerStyle x
+  setMarkerSize (ETH3 x) = setMarkerSize x
+instance IDeletable (Exist TH3) where
+  delete (ETH3 x) = delete x
+
+
+
+tH3ProjectionX :: TH3 -> CString -> CInt -> CInt -> CInt -> CInt -> CString -> IO TH1D
+tH3ProjectionX = xform6 c_th3_th3projectionx
+
+tH3ProjectionY :: TH3 -> CString -> CInt -> CInt -> CInt -> CInt -> CString -> IO TH1D
+tH3ProjectionY = xform6 c_th3_th3projectiony
+
+tH3ProjectionZ :: TH3 -> CString -> CInt -> CInt -> CInt -> CInt -> CString -> IO TH1D
+tH3ProjectionZ = xform6 c_th3_th3projectionz
+
+tH3Project3D :: TH3 -> CString -> IO TH1
+tH3Project3D = xform1 c_th3_th3project3d
+
+
+
+instance FPtr (Exist TH3) where
+  type Raw (Exist TH3) = RawTH3
+  get_fptr (ETH3 obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH3 (cast_fptr_to_obj (fptr :: ForeignPtr RawTH3) :: TH3)
diff --git a/src/HROOT/Hist/TH3/Interface.hs b/src/HROOT/Hist/TH3/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3/Interface.hs
@@ -0,0 +1,56 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH3.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH3.RawType
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TAtt3D.Interface
+---- ============ ----
+import {-# SOURCE #-} HROOT.Hist.TF1.Interface
+
+
+class (ITH1 a,ITAtt3D a) => ITH3 a where
+
+    fill3 :: a -> CDouble -> CDouble -> CDouble -> IO CInt 
+
+    fill3w :: a -> CDouble -> CDouble -> CDouble -> CDouble -> IO CInt 
+
+    fitSlicesZ :: (ITF1 c0, FPtr c0) => a -> c0 -> CInt -> CInt -> CInt -> CInt -> CInt -> CString -> IO () 
+
+    getCorrelationFactor3 :: a -> CInt -> CInt -> IO CDouble 
+
+    getCovariance3 :: a -> CInt -> CInt -> IO CDouble 
+
+    rebinX3 :: a -> CInt -> CString -> IO TH3 
+
+    rebinY3 :: a -> CInt -> CString -> IO TH3 
+
+    rebinZ3 :: a -> CInt -> CString -> IO TH3 
+
+    rebin3D :: a -> CInt -> CInt -> CInt -> CString -> IO TH3 
+
+instance Existable TH3 where
+  data Exist TH3 = forall a. (FPtr a, ITH3 a) => ETH3 a
+
+upcastTH3 :: (FPtr a, ITH3 a) => a -> TH3
+upcastTH3 h = let fh = get_fptr h
+                  fh2 :: ForeignPtr RawTH3 = castForeignPtr fh
+              in cast_fptr_to_obj fh2
+
+downcastTH3 :: (FPtr a, ITH3 a) => TH3 -> a 
+downcastTH3 h = let fh = get_fptr h
+                    fh2 = castForeignPtr fh
+                in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH3/RawType.hs b/src/HROOT/Hist/TH3/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH3.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH3
+newtype TH3 = TH3 (ForeignPtr RawTH3) deriving (Eq, Ord, Show)
+instance FPtr TH3 where
+   type Raw TH3 = RawTH3
+   get_fptr (TH3 fptr) = fptr
+   cast_fptr_to_obj = TH3
diff --git a/src/HROOT/Hist/TH3C.hs b/src/HROOT/Hist/TH3C.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3C.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TH3C
+  (
+    TH3C(..)
+  , ITH3C
+  , upcastTH3C
+  , downcastTH3C
+
+ 
+  ) where
+
+import HROOT.Hist.TH3C.RawType
+import HROOT.Hist.TH3C.Interface
+import HROOT.Hist.TH3C.Implementation
+
+
diff --git a/src/HROOT/Hist/TH3C/Cast.hs b/src/HROOT/Hist/TH3C/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3C/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH3C.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH3C.RawType
+import HROOT.Hist.TH3C.Interface
+
+instance (ITH3C a, FPtr a) => Castable a (Ptr RawTH3C) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH3C (Ptr RawTH3C) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH3C/FFI.hsc b/src/HROOT/Hist/TH3C/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3C/FFI.hsc
@@ -0,0 +1,525 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH3C.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH3C.RawType
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH3.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTH3C.h"
+
+foreign import ccall "HROOTHistTH3C.h TH3C_fill3" c_th3c_fill3 
+  :: (Ptr RawTH3C) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_fill3w" c_th3c_fill3w 
+  :: (Ptr RawTH3C) -> CDouble -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_FitSlicesZ" c_th3c_fitslicesz 
+  :: (Ptr RawTH3C) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CInt -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_getCorrelationFactor3" c_th3c_getcorrelationfactor3 
+  :: (Ptr RawTH3C) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_getCovariance3" c_th3c_getcovariance3 
+  :: (Ptr RawTH3C) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_rebinX3" c_th3c_rebinx3 
+  :: (Ptr RawTH3C) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3C.h TH3C_rebinY3" c_th3c_rebiny3 
+  :: (Ptr RawTH3C) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3C.h TH3C_rebinZ3" c_th3c_rebinz3 
+  :: (Ptr RawTH3C) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3C.h TH3C_Rebin3D" c_th3c_rebin3d 
+  :: (Ptr RawTH3C) -> CInt -> CInt -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3C.h TH3C_Add" c_th3c_add 
+  :: (Ptr RawTH3C) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_AddBinContent" c_th3c_addbincontent 
+  :: (Ptr RawTH3C) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_Chi2Test" c_th3c_chi2test 
+  :: (Ptr RawTH3C) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_ComputeIntegral" c_th3c_computeintegral 
+  :: (Ptr RawTH3C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_DirectoryAutoAdd" c_th3c_directoryautoadd 
+  :: (Ptr RawTH3C) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_Divide" c_th3c_divide 
+  :: (Ptr RawTH3C) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_drawCopyTH1" c_th3c_drawcopyth1 
+  :: (Ptr RawTH3C) -> CString -> IO (Ptr RawTH3C)
+
+foreign import ccall "HROOTHistTH3C.h TH3C_DrawNormalized" c_th3c_drawnormalized 
+  :: (Ptr RawTH3C) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3C.h TH3C_drawPanelTH1" c_th3c_drawpanelth1 
+  :: (Ptr RawTH3C) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_BufferEmpty" c_th3c_bufferempty 
+  :: (Ptr RawTH3C) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_evalF" c_th3c_evalf 
+  :: (Ptr RawTH3C) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_FFT" c_th3c_fft 
+  :: (Ptr RawTH3C) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3C.h TH3C_fill1" c_th3c_fill1 
+  :: (Ptr RawTH3C) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_fill1w" c_th3c_fill1w 
+  :: (Ptr RawTH3C) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_fillN1" c_th3c_filln1 
+  :: (Ptr RawTH3C) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_FillRandom" c_th3c_fillrandom 
+  :: (Ptr RawTH3C) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_FindBin" c_th3c_findbin 
+  :: (Ptr RawTH3C) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_FindFixBin" c_th3c_findfixbin 
+  :: (Ptr RawTH3C) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_FindFirstBinAbove" c_th3c_findfirstbinabove 
+  :: (Ptr RawTH3C) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_FindLastBinAbove" c_th3c_findlastbinabove 
+  :: (Ptr RawTH3C) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_FitPanelTH1" c_th3c_fitpanelth1 
+  :: (Ptr RawTH3C) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_getNdivisionA" c_th3c_getndivisiona 
+  :: (Ptr RawTH3C) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_getAxisColorA" c_th3c_getaxiscolora 
+  :: (Ptr RawTH3C) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_getLabelColorA" c_th3c_getlabelcolora 
+  :: (Ptr RawTH3C) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_getLabelFontA" c_th3c_getlabelfonta 
+  :: (Ptr RawTH3C) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_getLabelOffsetA" c_th3c_getlabeloffseta 
+  :: (Ptr RawTH3C) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_getLabelSizeA" c_th3c_getlabelsizea 
+  :: (Ptr RawTH3C) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_getTitleFontA" c_th3c_gettitlefonta 
+  :: (Ptr RawTH3C) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_getTitleOffsetA" c_th3c_gettitleoffseta 
+  :: (Ptr RawTH3C) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_getTitleSizeA" c_th3c_gettitlesizea 
+  :: (Ptr RawTH3C) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_getTickLengthA" c_th3c_getticklengtha 
+  :: (Ptr RawTH3C) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetBarOffset" c_th3c_getbaroffset 
+  :: (Ptr RawTH3C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetBarWidth" c_th3c_getbarwidth 
+  :: (Ptr RawTH3C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetContour" c_th3c_getcontour 
+  :: (Ptr RawTH3C) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetContourLevel" c_th3c_getcontourlevel 
+  :: (Ptr RawTH3C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetContourLevelPad" c_th3c_getcontourlevelpad 
+  :: (Ptr RawTH3C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetBin" c_th3c_getbin 
+  :: (Ptr RawTH3C) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetBinCenter" c_th3c_getbincenter 
+  :: (Ptr RawTH3C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetBinContent1" c_th3c_getbincontent1 
+  :: (Ptr RawTH3C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetBinContent2" c_th3c_getbincontent2 
+  :: (Ptr RawTH3C) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetBinContent3" c_th3c_getbincontent3 
+  :: (Ptr RawTH3C) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetBinError1" c_th3c_getbinerror1 
+  :: (Ptr RawTH3C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetBinError2" c_th3c_getbinerror2 
+  :: (Ptr RawTH3C) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetBinError3" c_th3c_getbinerror3 
+  :: (Ptr RawTH3C) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetBinLowEdge" c_th3c_getbinlowedge 
+  :: (Ptr RawTH3C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetBinWidth" c_th3c_getbinwidth 
+  :: (Ptr RawTH3C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetCellContent" c_th3c_getcellcontent 
+  :: (Ptr RawTH3C) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetCellError" c_th3c_getcellerror 
+  :: (Ptr RawTH3C) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetEntries" c_th3c_getentries 
+  :: (Ptr RawTH3C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetEffectiveEntries" c_th3c_geteffectiveentries 
+  :: (Ptr RawTH3C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetFunction" c_th3c_getfunction 
+  :: (Ptr RawTH3C) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetDimension" c_th3c_getdimension 
+  :: (Ptr RawTH3C) -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetKurtosis" c_th3c_getkurtosis 
+  :: (Ptr RawTH3C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetLowEdge" c_th3c_getlowedge 
+  :: (Ptr RawTH3C) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_getMaximumTH1" c_th3c_getmaximumth1 
+  :: (Ptr RawTH3C) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetMaximumBin" c_th3c_getmaximumbin 
+  :: (Ptr RawTH3C) -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetMaximumStored" c_th3c_getmaximumstored 
+  :: (Ptr RawTH3C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_getMinimumTH1" c_th3c_getminimumth1 
+  :: (Ptr RawTH3C) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetMinimumBin" c_th3c_getminimumbin 
+  :: (Ptr RawTH3C) -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetMinimumStored" c_th3c_getminimumstored 
+  :: (Ptr RawTH3C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetMean" c_th3c_getmean 
+  :: (Ptr RawTH3C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetMeanError" c_th3c_getmeanerror 
+  :: (Ptr RawTH3C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetNbinsX" c_th3c_getnbinsx 
+  :: (Ptr RawTH3C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetNbinsY" c_th3c_getnbinsy 
+  :: (Ptr RawTH3C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetNbinsZ" c_th3c_getnbinsz 
+  :: (Ptr RawTH3C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_getQuantilesTH1" c_th3c_getquantilesth1 
+  :: (Ptr RawTH3C) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetRandom" c_th3c_getrandom 
+  :: (Ptr RawTH3C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetStats" c_th3c_getstats 
+  :: (Ptr RawTH3C) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetSumOfWeights" c_th3c_getsumofweights 
+  :: (Ptr RawTH3C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetSumw2" c_th3c_getsumw2 
+  :: (Ptr RawTH3C) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetSumw2N" c_th3c_getsumw2n 
+  :: (Ptr RawTH3C) -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetRMS" c_th3c_getrms 
+  :: (Ptr RawTH3C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetRMSError" c_th3c_getrmserror 
+  :: (Ptr RawTH3C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetSkewness" c_th3c_getskewness 
+  :: (Ptr RawTH3C) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_integral1" c_th3c_integral1 
+  :: (Ptr RawTH3C) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_interpolate1" c_th3c_interpolate1 
+  :: (Ptr RawTH3C) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_interpolate2" c_th3c_interpolate2 
+  :: (Ptr RawTH3C) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_interpolate3" c_th3c_interpolate3 
+  :: (Ptr RawTH3C) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_KolmogorovTest" c_th3c_kolmogorovtest 
+  :: (Ptr RawTH3C) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_LabelsDeflate" c_th3c_labelsdeflate 
+  :: (Ptr RawTH3C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_LabelsInflate" c_th3c_labelsinflate 
+  :: (Ptr RawTH3C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_LabelsOption" c_th3c_labelsoption 
+  :: (Ptr RawTH3C) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_multiflyF" c_th3c_multiflyf 
+  :: (Ptr RawTH3C) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_Multiply" c_th3c_multiply 
+  :: (Ptr RawTH3C) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_PutStats" c_th3c_putstats 
+  :: (Ptr RawTH3C) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_Rebin" c_th3c_rebin 
+  :: (Ptr RawTH3C) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3C.h TH3C_RebinAxis" c_th3c_rebinaxis 
+  :: (Ptr RawTH3C) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_Rebuild" c_th3c_rebuild 
+  :: (Ptr RawTH3C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_RecursiveRemove" c_th3c_recursiveremove 
+  :: (Ptr RawTH3C) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_Reset" c_th3c_reset 
+  :: (Ptr RawTH3C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_ResetStats" c_th3c_resetstats 
+  :: (Ptr RawTH3C) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_Scale" c_th3c_scale 
+  :: (Ptr RawTH3C) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_setAxisColorA" c_th3c_setaxiscolora 
+  :: (Ptr RawTH3C) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetAxisRange" c_th3c_setaxisrange 
+  :: (Ptr RawTH3C) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetBarOffset" c_th3c_setbaroffset 
+  :: (Ptr RawTH3C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetBarWidth" c_th3c_setbarwidth 
+  :: (Ptr RawTH3C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_setBinContent1" c_th3c_setbincontent1 
+  :: (Ptr RawTH3C) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_setBinContent2" c_th3c_setbincontent2 
+  :: (Ptr RawTH3C) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_setBinContent3" c_th3c_setbincontent3 
+  :: (Ptr RawTH3C) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_setBinError1" c_th3c_setbinerror1 
+  :: (Ptr RawTH3C) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_setBinError2" c_th3c_setbinerror2 
+  :: (Ptr RawTH3C) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_setBinError3" c_th3c_setbinerror3 
+  :: (Ptr RawTH3C) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_setBins1" c_th3c_setbins1 
+  :: (Ptr RawTH3C) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_setBins2" c_th3c_setbins2 
+  :: (Ptr RawTH3C) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_setBins3" c_th3c_setbins3 
+  :: (Ptr RawTH3C) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetBinsLength" c_th3c_setbinslength 
+  :: (Ptr RawTH3C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetBuffer" c_th3c_setbuffer 
+  :: (Ptr RawTH3C) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetCellContent" c_th3c_setcellcontent 
+  :: (Ptr RawTH3C) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetContent" c_th3c_setcontent 
+  :: (Ptr RawTH3C) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetContour" c_th3c_setcontour 
+  :: (Ptr RawTH3C) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetContourLevel" c_th3c_setcontourlevel 
+  :: (Ptr RawTH3C) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetDirectory" c_th3c_setdirectory 
+  :: (Ptr RawTH3C) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetEntries" c_th3c_setentries 
+  :: (Ptr RawTH3C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetError" c_th3c_seterror 
+  :: (Ptr RawTH3C) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_setLabelColorA" c_th3c_setlabelcolora 
+  :: (Ptr RawTH3C) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_setLabelSizeA" c_th3c_setlabelsizea 
+  :: (Ptr RawTH3C) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_setLabelFontA" c_th3c_setlabelfonta 
+  :: (Ptr RawTH3C) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_setLabelOffsetA" c_th3c_setlabeloffseta 
+  :: (Ptr RawTH3C) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetMaximum" c_th3c_setmaximum 
+  :: (Ptr RawTH3C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetMinimum" c_th3c_setminimum 
+  :: (Ptr RawTH3C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetNormFactor" c_th3c_setnormfactor 
+  :: (Ptr RawTH3C) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetStats" c_th3c_setstats 
+  :: (Ptr RawTH3C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetOption" c_th3c_setoption 
+  :: (Ptr RawTH3C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetXTitle" c_th3c_setxtitle 
+  :: (Ptr RawTH3C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetYTitle" c_th3c_setytitle 
+  :: (Ptr RawTH3C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetZTitle" c_th3c_setztitle 
+  :: (Ptr RawTH3C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_ShowBackground" c_th3c_showbackground 
+  :: (Ptr RawTH3C) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3C.h TH3C_ShowPeaks" c_th3c_showpeaks 
+  :: (Ptr RawTH3C) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_Smooth" c_th3c_smooth 
+  :: (Ptr RawTH3C) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_Sumw2" c_th3c_sumw2 
+  :: (Ptr RawTH3C) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_Draw" c_th3c_draw 
+  :: (Ptr RawTH3C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_FindObject" c_th3c_findobject 
+  :: (Ptr RawTH3C) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetName" c_th3c_getname 
+  :: (Ptr RawTH3C) -> IO CString
+
+foreign import ccall "HROOTHistTH3C.h TH3C_IsA" c_th3c_isa 
+  :: (Ptr RawTH3C) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH3C.h TH3C_Paint" c_th3c_paint 
+  :: (Ptr RawTH3C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_printObj" c_th3c_printobj 
+  :: (Ptr RawTH3C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SaveAs" c_th3c_saveas 
+  :: (Ptr RawTH3C) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_Write" c_th3c_write 
+  :: (Ptr RawTH3C) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetLineColor" c_th3c_getlinecolor 
+  :: (Ptr RawTH3C) -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetLineStyle" c_th3c_getlinestyle 
+  :: (Ptr RawTH3C) -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetLineWidth" c_th3c_getlinewidth 
+  :: (Ptr RawTH3C) -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_ResetAttLine" c_th3c_resetattline 
+  :: (Ptr RawTH3C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetLineAttributes" c_th3c_setlineattributes 
+  :: (Ptr RawTH3C) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetLineColor" c_th3c_setlinecolor 
+  :: (Ptr RawTH3C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetLineStyle" c_th3c_setlinestyle 
+  :: (Ptr RawTH3C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetLineWidth" c_th3c_setlinewidth 
+  :: (Ptr RawTH3C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetFillColor" c_th3c_setfillcolor 
+  :: (Ptr RawTH3C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetFillStyle" c_th3c_setfillstyle 
+  :: (Ptr RawTH3C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetMarkerColor" c_th3c_getmarkercolor 
+  :: (Ptr RawTH3C) -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetMarkerStyle" c_th3c_getmarkerstyle 
+  :: (Ptr RawTH3C) -> IO CInt
+
+foreign import ccall "HROOTHistTH3C.h TH3C_GetMarkerSize" c_th3c_getmarkersize 
+  :: (Ptr RawTH3C) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3C.h TH3C_ResetAttMarker" c_th3c_resetattmarker 
+  :: (Ptr RawTH3C) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetMarkerAttributes" c_th3c_setmarkerattributes 
+  :: (Ptr RawTH3C) -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetMarkerColor" c_th3c_setmarkercolor 
+  :: (Ptr RawTH3C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetMarkerStyle" c_th3c_setmarkerstyle 
+  :: (Ptr RawTH3C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_SetMarkerSize" c_th3c_setmarkersize 
+  :: (Ptr RawTH3C) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3C.h TH3C_delete" c_th3c_delete 
+  :: (Ptr RawTH3C) -> IO ()
+
diff --git a/src/HROOT/Hist/TH3C/Implementation.hs b/src/HROOT/Hist/TH3C/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3C/Implementation.hs
@@ -0,0 +1,440 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH3C.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH3C.RawType
+import HROOT.Hist.TH3C.FFI
+import HROOT.Hist.TH3C.Interface
+import HROOT.Hist.TH3C.Cast
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1D.Cast
+import HROOT.Hist.TH1D.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH3.RawType
+import HROOT.Hist.TH3.Cast
+import HROOT.Hist.TH3.Interface
+import HROOT.Core.TArrayC.RawType
+import HROOT.Core.TArrayC.Cast
+import HROOT.Core.TArrayC.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TAtt3D.RawType
+import HROOT.Core.TAtt3D.Cast
+import HROOT.Core.TAtt3D.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+import HROOT.Core.TArray.RawType
+import HROOT.Core.TArray.Cast
+import HROOT.Core.TArray.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH3C TH3C where
+instance ITH3 TH3C where
+  fill3 = xform3 c_th3c_fill3
+  fill3w = xform4 c_th3c_fill3w
+  fitSlicesZ = xform7 c_th3c_fitslicesz
+  getCorrelationFactor3 = xform2 c_th3c_getcorrelationfactor3
+  getCovariance3 = xform2 c_th3c_getcovariance3
+  rebinX3 = xform2 c_th3c_rebinx3
+  rebinY3 = xform2 c_th3c_rebiny3
+  rebinZ3 = xform2 c_th3c_rebinz3
+  rebin3D = xform4 c_th3c_rebin3d
+instance ITArrayC TH3C where
+instance ITH1 TH3C where
+  add = xform2 c_th3c_add
+  addBinContent = xform2 c_th3c_addbincontent
+  chi2Test = xform3 c_th3c_chi2test
+  computeIntegral = xform0 c_th3c_computeintegral
+  directoryAutoAdd = xform1 c_th3c_directoryautoadd
+  divide = xform5 c_th3c_divide
+  drawCopyTH1 = xform1 c_th3c_drawcopyth1
+  drawNormalized = xform2 c_th3c_drawnormalized
+  drawPanelTH1 = xform0 c_th3c_drawpanelth1
+  bufferEmpty = xform1 c_th3c_bufferempty
+  evalF = xform2 c_th3c_evalf
+  fFT = xform2 c_th3c_fft
+  fill1 = xform1 c_th3c_fill1
+  fill1w = xform2 c_th3c_fill1w
+  fillN1 = xform4 c_th3c_filln1
+  fillRandom = xform2 c_th3c_fillrandom
+  findBin = xform3 c_th3c_findbin
+  findFixBin = xform3 c_th3c_findfixbin
+  findFirstBinAbove = xform2 c_th3c_findfirstbinabove
+  findLastBinAbove = xform2 c_th3c_findlastbinabove
+  fitPanelTH1 = xform0 c_th3c_fitpanelth1
+  getNdivisionA = xform1 c_th3c_getndivisiona
+  getAxisColorA = xform1 c_th3c_getaxiscolora
+  getLabelColorA = xform1 c_th3c_getlabelcolora
+  getLabelFontA = xform1 c_th3c_getlabelfonta
+  getLabelOffsetA = xform1 c_th3c_getlabeloffseta
+  getLabelSizeA = xform1 c_th3c_getlabelsizea
+  getTitleFontA = xform1 c_th3c_gettitlefonta
+  getTitleOffsetA = xform1 c_th3c_gettitleoffseta
+  getTitleSizeA = xform1 c_th3c_gettitlesizea
+  getTickLengthA = xform1 c_th3c_getticklengtha
+  getBarOffset = xform0 c_th3c_getbaroffset
+  getBarWidth = xform0 c_th3c_getbarwidth
+  getContour = xform1 c_th3c_getcontour
+  getContourLevel = xform1 c_th3c_getcontourlevel
+  getContourLevelPad = xform1 c_th3c_getcontourlevelpad
+  getBin = xform3 c_th3c_getbin
+  getBinCenter = xform1 c_th3c_getbincenter
+  getBinContent1 = xform1 c_th3c_getbincontent1
+  getBinContent2 = xform2 c_th3c_getbincontent2
+  getBinContent3 = xform3 c_th3c_getbincontent3
+  getBinError1 = xform1 c_th3c_getbinerror1
+  getBinError2 = xform2 c_th3c_getbinerror2
+  getBinError3 = xform3 c_th3c_getbinerror3
+  getBinLowEdge = xform1 c_th3c_getbinlowedge
+  getBinWidth = xform1 c_th3c_getbinwidth
+  getCellContent = xform2 c_th3c_getcellcontent
+  getCellError = xform2 c_th3c_getcellerror
+  getEntries = xform0 c_th3c_getentries
+  getEffectiveEntries = xform0 c_th3c_geteffectiveentries
+  getFunction = xform1 c_th3c_getfunction
+  getDimension = xform0 c_th3c_getdimension
+  getKurtosis = xform1 c_th3c_getkurtosis
+  getLowEdge = xform1 c_th3c_getlowedge
+  getMaximumTH1 = xform1 c_th3c_getmaximumth1
+  getMaximumBin = xform0 c_th3c_getmaximumbin
+  getMaximumStored = xform0 c_th3c_getmaximumstored
+  getMinimumTH1 = xform1 c_th3c_getminimumth1
+  getMinimumBin = xform0 c_th3c_getminimumbin
+  getMinimumStored = xform0 c_th3c_getminimumstored
+  getMean = xform1 c_th3c_getmean
+  getMeanError = xform1 c_th3c_getmeanerror
+  getNbinsX = xform0 c_th3c_getnbinsx
+  getNbinsY = xform0 c_th3c_getnbinsy
+  getNbinsZ = xform0 c_th3c_getnbinsz
+  getQuantilesTH1 = xform3 c_th3c_getquantilesth1
+  getRandom = xform0 c_th3c_getrandom
+  getStats = xform1 c_th3c_getstats
+  getSumOfWeights = xform0 c_th3c_getsumofweights
+  getSumw2 = xform0 c_th3c_getsumw2
+  getSumw2N = xform0 c_th3c_getsumw2n
+  getRMS = xform1 c_th3c_getrms
+  getRMSError = xform1 c_th3c_getrmserror
+  getSkewness = xform1 c_th3c_getskewness
+  integral1 = xform3 c_th3c_integral1
+  interpolate1 = xform1 c_th3c_interpolate1
+  interpolate2 = xform2 c_th3c_interpolate2
+  interpolate3 = xform3 c_th3c_interpolate3
+  kolmogorovTest = xform2 c_th3c_kolmogorovtest
+  labelsDeflate = xform1 c_th3c_labelsdeflate
+  labelsInflate = xform1 c_th3c_labelsinflate
+  labelsOption = xform2 c_th3c_labelsoption
+  multiflyF = xform2 c_th3c_multiflyf
+  multiply = xform5 c_th3c_multiply
+  putStats = xform1 c_th3c_putstats
+  rebin = xform3 c_th3c_rebin
+  rebinAxis = xform2 c_th3c_rebinaxis
+  rebuild = xform1 c_th3c_rebuild
+  recursiveRemove = xform1 c_th3c_recursiveremove
+  reset = xform1 c_th3c_reset
+  resetStats = xform0 c_th3c_resetstats
+  scale = xform2 c_th3c_scale
+  setAxisColorA = xform2 c_th3c_setaxiscolora
+  setAxisRange = xform3 c_th3c_setaxisrange
+  setBarOffset = xform1 c_th3c_setbaroffset
+  setBarWidth = xform1 c_th3c_setbarwidth
+  setBinContent1 = xform2 c_th3c_setbincontent1
+  setBinContent2 = xform3 c_th3c_setbincontent2
+  setBinContent3 = xform4 c_th3c_setbincontent3
+  setBinError1 = xform2 c_th3c_setbinerror1
+  setBinError2 = xform3 c_th3c_setbinerror2
+  setBinError3 = xform4 c_th3c_setbinerror3
+  setBins1 = xform2 c_th3c_setbins1
+  setBins2 = xform4 c_th3c_setbins2
+  setBins3 = xform6 c_th3c_setbins3
+  setBinsLength = xform1 c_th3c_setbinslength
+  setBuffer = xform2 c_th3c_setbuffer
+  setCellContent = xform3 c_th3c_setcellcontent
+  setContent = xform1 c_th3c_setcontent
+  setContour = xform2 c_th3c_setcontour
+  setContourLevel = xform2 c_th3c_setcontourlevel
+  setDirectory = xform1 c_th3c_setdirectory
+  setEntries = xform1 c_th3c_setentries
+  setError = xform1 c_th3c_seterror
+  setLabelColorA = xform2 c_th3c_setlabelcolora
+  setLabelSizeA = xform2 c_th3c_setlabelsizea
+  setLabelFontA = xform2 c_th3c_setlabelfonta
+  setLabelOffsetA = xform2 c_th3c_setlabeloffseta
+  setMaximum = xform1 c_th3c_setmaximum
+  setMinimum = xform1 c_th3c_setminimum
+  setNormFactor = xform1 c_th3c_setnormfactor
+  setStats = xform1 c_th3c_setstats
+  setOption = xform1 c_th3c_setoption
+  setXTitle = xform1 c_th3c_setxtitle
+  setYTitle = xform1 c_th3c_setytitle
+  setZTitle = xform1 c_th3c_setztitle
+  showBackground = xform2 c_th3c_showbackground
+  showPeaks = xform3 c_th3c_showpeaks
+  smooth = xform2 c_th3c_smooth
+  sumw2 = xform0 c_th3c_sumw2
+instance ITAtt3D TH3C where
+instance ITObject TH3C where
+  draw = xform1 c_th3c_draw
+  findObject = xform1 c_th3c_findobject
+  getName = xform0 c_th3c_getname
+  isA = xform0 c_th3c_isa
+  paint = xform1 c_th3c_paint
+  printObj = xform1 c_th3c_printobj
+  saveAs = xform2 c_th3c_saveas
+  write = xform3 c_th3c_write
+instance ITAttLine TH3C where
+  getLineColor = xform0 c_th3c_getlinecolor
+  getLineStyle = xform0 c_th3c_getlinestyle
+  getLineWidth = xform0 c_th3c_getlinewidth
+  resetAttLine = xform1 c_th3c_resetattline
+  setLineAttributes = xform0 c_th3c_setlineattributes
+  setLineColor = xform1 c_th3c_setlinecolor
+  setLineStyle = xform1 c_th3c_setlinestyle
+  setLineWidth = xform1 c_th3c_setlinewidth
+instance ITAttFill TH3C where
+  setFillColor = xform1 c_th3c_setfillcolor
+  setFillStyle = xform1 c_th3c_setfillstyle
+instance ITAttMarker TH3C where
+  getMarkerColor = xform0 c_th3c_getmarkercolor
+  getMarkerStyle = xform0 c_th3c_getmarkerstyle
+  getMarkerSize = xform0 c_th3c_getmarkersize
+  resetAttMarker = xform1 c_th3c_resetattmarker
+  setMarkerAttributes = xform0 c_th3c_setmarkerattributes
+  setMarkerColor = xform1 c_th3c_setmarkercolor
+  setMarkerStyle = xform1 c_th3c_setmarkerstyle
+  setMarkerSize = xform1 c_th3c_setmarkersize
+instance IDeletable TH3C where
+  delete = xform0 c_th3c_delete
+instance ITArray TH3C where
+
+instance ITH3C (Exist TH3C) where
+
+instance ITH3 (Exist TH3C) where
+  fill3 (ETH3C x) = fill3 x
+  fill3w (ETH3C x) = fill3w x
+  fitSlicesZ (ETH3C x) = fitSlicesZ x
+  getCorrelationFactor3 (ETH3C x) = getCorrelationFactor3 x
+  getCovariance3 (ETH3C x) = getCovariance3 x
+  rebinX3 (ETH3C x) = rebinX3 x
+  rebinY3 (ETH3C x) = rebinY3 x
+  rebinZ3 (ETH3C x) = rebinZ3 x
+  rebin3D (ETH3C x) = rebin3D x
+instance ITArrayC (Exist TH3C) where
+
+instance ITH1 (Exist TH3C) where
+  add (ETH3C x) = add x
+  addBinContent (ETH3C x) = addBinContent x
+  chi2Test (ETH3C x) = chi2Test x
+  computeIntegral (ETH3C x) = computeIntegral x
+  directoryAutoAdd (ETH3C x) = directoryAutoAdd x
+  divide (ETH3C x) = divide x
+  drawCopyTH1 (ETH3C x) a1 = return . ETH3C =<< drawCopyTH1 x a1
+  drawNormalized (ETH3C x) = drawNormalized x
+  drawPanelTH1 (ETH3C x) = drawPanelTH1 x
+  bufferEmpty (ETH3C x) = bufferEmpty x
+  evalF (ETH3C x) = evalF x
+  fFT (ETH3C x) = fFT x
+  fill1 (ETH3C x) = fill1 x
+  fill1w (ETH3C x) = fill1w x
+  fillN1 (ETH3C x) = fillN1 x
+  fillRandom (ETH3C x) = fillRandom x
+  findBin (ETH3C x) = findBin x
+  findFixBin (ETH3C x) = findFixBin x
+  findFirstBinAbove (ETH3C x) = findFirstBinAbove x
+  findLastBinAbove (ETH3C x) = findLastBinAbove x
+  fitPanelTH1 (ETH3C x) = fitPanelTH1 x
+  getNdivisionA (ETH3C x) = getNdivisionA x
+  getAxisColorA (ETH3C x) = getAxisColorA x
+  getLabelColorA (ETH3C x) = getLabelColorA x
+  getLabelFontA (ETH3C x) = getLabelFontA x
+  getLabelOffsetA (ETH3C x) = getLabelOffsetA x
+  getLabelSizeA (ETH3C x) = getLabelSizeA x
+  getTitleFontA (ETH3C x) = getTitleFontA x
+  getTitleOffsetA (ETH3C x) = getTitleOffsetA x
+  getTitleSizeA (ETH3C x) = getTitleSizeA x
+  getTickLengthA (ETH3C x) = getTickLengthA x
+  getBarOffset (ETH3C x) = getBarOffset x
+  getBarWidth (ETH3C x) = getBarWidth x
+  getContour (ETH3C x) = getContour x
+  getContourLevel (ETH3C x) = getContourLevel x
+  getContourLevelPad (ETH3C x) = getContourLevelPad x
+  getBin (ETH3C x) = getBin x
+  getBinCenter (ETH3C x) = getBinCenter x
+  getBinContent1 (ETH3C x) = getBinContent1 x
+  getBinContent2 (ETH3C x) = getBinContent2 x
+  getBinContent3 (ETH3C x) = getBinContent3 x
+  getBinError1 (ETH3C x) = getBinError1 x
+  getBinError2 (ETH3C x) = getBinError2 x
+  getBinError3 (ETH3C x) = getBinError3 x
+  getBinLowEdge (ETH3C x) = getBinLowEdge x
+  getBinWidth (ETH3C x) = getBinWidth x
+  getCellContent (ETH3C x) = getCellContent x
+  getCellError (ETH3C x) = getCellError x
+  getEntries (ETH3C x) = getEntries x
+  getEffectiveEntries (ETH3C x) = getEffectiveEntries x
+  getFunction (ETH3C x) = getFunction x
+  getDimension (ETH3C x) = getDimension x
+  getKurtosis (ETH3C x) = getKurtosis x
+  getLowEdge (ETH3C x) = getLowEdge x
+  getMaximumTH1 (ETH3C x) = getMaximumTH1 x
+  getMaximumBin (ETH3C x) = getMaximumBin x
+  getMaximumStored (ETH3C x) = getMaximumStored x
+  getMinimumTH1 (ETH3C x) = getMinimumTH1 x
+  getMinimumBin (ETH3C x) = getMinimumBin x
+  getMinimumStored (ETH3C x) = getMinimumStored x
+  getMean (ETH3C x) = getMean x
+  getMeanError (ETH3C x) = getMeanError x
+  getNbinsX (ETH3C x) = getNbinsX x
+  getNbinsY (ETH3C x) = getNbinsY x
+  getNbinsZ (ETH3C x) = getNbinsZ x
+  getQuantilesTH1 (ETH3C x) = getQuantilesTH1 x
+  getRandom (ETH3C x) = getRandom x
+  getStats (ETH3C x) = getStats x
+  getSumOfWeights (ETH3C x) = getSumOfWeights x
+  getSumw2 (ETH3C x) = getSumw2 x
+  getSumw2N (ETH3C x) = getSumw2N x
+  getRMS (ETH3C x) = getRMS x
+  getRMSError (ETH3C x) = getRMSError x
+  getSkewness (ETH3C x) = getSkewness x
+  integral1 (ETH3C x) = integral1 x
+  interpolate1 (ETH3C x) = interpolate1 x
+  interpolate2 (ETH3C x) = interpolate2 x
+  interpolate3 (ETH3C x) = interpolate3 x
+  kolmogorovTest (ETH3C x) = kolmogorovTest x
+  labelsDeflate (ETH3C x) = labelsDeflate x
+  labelsInflate (ETH3C x) = labelsInflate x
+  labelsOption (ETH3C x) = labelsOption x
+  multiflyF (ETH3C x) = multiflyF x
+  multiply (ETH3C x) = multiply x
+  putStats (ETH3C x) = putStats x
+  rebin (ETH3C x) = rebin x
+  rebinAxis (ETH3C x) = rebinAxis x
+  rebuild (ETH3C x) = rebuild x
+  recursiveRemove (ETH3C x) = recursiveRemove x
+  reset (ETH3C x) = reset x
+  resetStats (ETH3C x) = resetStats x
+  scale (ETH3C x) = scale x
+  setAxisColorA (ETH3C x) = setAxisColorA x
+  setAxisRange (ETH3C x) = setAxisRange x
+  setBarOffset (ETH3C x) = setBarOffset x
+  setBarWidth (ETH3C x) = setBarWidth x
+  setBinContent1 (ETH3C x) = setBinContent1 x
+  setBinContent2 (ETH3C x) = setBinContent2 x
+  setBinContent3 (ETH3C x) = setBinContent3 x
+  setBinError1 (ETH3C x) = setBinError1 x
+  setBinError2 (ETH3C x) = setBinError2 x
+  setBinError3 (ETH3C x) = setBinError3 x
+  setBins1 (ETH3C x) = setBins1 x
+  setBins2 (ETH3C x) = setBins2 x
+  setBins3 (ETH3C x) = setBins3 x
+  setBinsLength (ETH3C x) = setBinsLength x
+  setBuffer (ETH3C x) = setBuffer x
+  setCellContent (ETH3C x) = setCellContent x
+  setContent (ETH3C x) = setContent x
+  setContour (ETH3C x) = setContour x
+  setContourLevel (ETH3C x) = setContourLevel x
+  setDirectory (ETH3C x) = setDirectory x
+  setEntries (ETH3C x) = setEntries x
+  setError (ETH3C x) = setError x
+  setLabelColorA (ETH3C x) = setLabelColorA x
+  setLabelSizeA (ETH3C x) = setLabelSizeA x
+  setLabelFontA (ETH3C x) = setLabelFontA x
+  setLabelOffsetA (ETH3C x) = setLabelOffsetA x
+  setMaximum (ETH3C x) = setMaximum x
+  setMinimum (ETH3C x) = setMinimum x
+  setNormFactor (ETH3C x) = setNormFactor x
+  setStats (ETH3C x) = setStats x
+  setOption (ETH3C x) = setOption x
+  setXTitle (ETH3C x) = setXTitle x
+  setYTitle (ETH3C x) = setYTitle x
+  setZTitle (ETH3C x) = setZTitle x
+  showBackground (ETH3C x) = showBackground x
+  showPeaks (ETH3C x) = showPeaks x
+  smooth (ETH3C x) = smooth x
+  sumw2 (ETH3C x) = sumw2 x
+instance ITAtt3D (Exist TH3C) where
+
+instance ITObject (Exist TH3C) where
+  draw (ETH3C x) = draw x
+  findObject (ETH3C x) = findObject x
+  getName (ETH3C x) = getName x
+  isA (ETH3C x) = isA x
+  paint (ETH3C x) = paint x
+  printObj (ETH3C x) = printObj x
+  saveAs (ETH3C x) = saveAs x
+  write (ETH3C x) = write x
+instance ITAttLine (Exist TH3C) where
+  getLineColor (ETH3C x) = getLineColor x
+  getLineStyle (ETH3C x) = getLineStyle x
+  getLineWidth (ETH3C x) = getLineWidth x
+  resetAttLine (ETH3C x) = resetAttLine x
+  setLineAttributes (ETH3C x) = setLineAttributes x
+  setLineColor (ETH3C x) = setLineColor x
+  setLineStyle (ETH3C x) = setLineStyle x
+  setLineWidth (ETH3C x) = setLineWidth x
+instance ITAttFill (Exist TH3C) where
+  setFillColor (ETH3C x) = setFillColor x
+  setFillStyle (ETH3C x) = setFillStyle x
+instance ITAttMarker (Exist TH3C) where
+  getMarkerColor (ETH3C x) = getMarkerColor x
+  getMarkerStyle (ETH3C x) = getMarkerStyle x
+  getMarkerSize (ETH3C x) = getMarkerSize x
+  resetAttMarker (ETH3C x) = resetAttMarker x
+  setMarkerAttributes (ETH3C x) = setMarkerAttributes x
+  setMarkerColor (ETH3C x) = setMarkerColor x
+  setMarkerStyle (ETH3C x) = setMarkerStyle x
+  setMarkerSize (ETH3C x) = setMarkerSize x
+instance IDeletable (Exist TH3C) where
+  delete (ETH3C x) = delete x
+instance ITArray (Exist TH3C) where
+
+
+
+
+
+
+
+
+instance FPtr (Exist TH3C) where
+  type Raw (Exist TH3C) = RawTH3C
+  get_fptr (ETH3C obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH3C (cast_fptr_to_obj (fptr :: ForeignPtr RawTH3C) :: TH3C)
diff --git a/src/HROOT/Hist/TH3C/Interface.hs b/src/HROOT/Hist/TH3C/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3C/Interface.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH3C.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH3C.RawType
+
+import HROOT.Hist.TH3.Interface
+import HROOT.Core.TArrayC.Interface
+---- ============ ----
+
+
+
+class (ITH3 a,ITArrayC a) => ITH3C a where
+
+instance Existable TH3C where
+  data Exist TH3C = forall a. (FPtr a, ITH3C a) => ETH3C a
+
+upcastTH3C :: (FPtr a, ITH3C a) => a -> TH3C
+upcastTH3C h = let fh = get_fptr h
+                   fh2 :: ForeignPtr RawTH3C = castForeignPtr fh
+               in cast_fptr_to_obj fh2
+
+downcastTH3C :: (FPtr a, ITH3C a) => TH3C -> a 
+downcastTH3C h = let fh = get_fptr h
+                     fh2 = castForeignPtr fh
+                 in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH3C/RawType.hs b/src/HROOT/Hist/TH3C/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3C/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH3C.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH3C
+newtype TH3C = TH3C (ForeignPtr RawTH3C) deriving (Eq, Ord, Show)
+instance FPtr TH3C where
+   type Raw TH3C = RawTH3C
+   get_fptr (TH3C fptr) = fptr
+   cast_fptr_to_obj = TH3C
diff --git a/src/HROOT/Hist/TH3D.hs b/src/HROOT/Hist/TH3D.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3D.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TH3D
+  (
+    TH3D(..)
+  , ITH3D
+  , upcastTH3D
+  , downcastTH3D
+
+ 
+  ) where
+
+import HROOT.Hist.TH3D.RawType
+import HROOT.Hist.TH3D.Interface
+import HROOT.Hist.TH3D.Implementation
+
+
diff --git a/src/HROOT/Hist/TH3D/Cast.hs b/src/HROOT/Hist/TH3D/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3D/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH3D.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH3D.RawType
+import HROOT.Hist.TH3D.Interface
+
+instance (ITH3D a, FPtr a) => Castable a (Ptr RawTH3D) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH3D (Ptr RawTH3D) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH3D/FFI.hsc b/src/HROOT/Hist/TH3D/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3D/FFI.hsc
@@ -0,0 +1,525 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH3D.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH3D.RawType
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH3.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTH3D.h"
+
+foreign import ccall "HROOTHistTH3D.h TH3D_fill3" c_th3d_fill3 
+  :: (Ptr RawTH3D) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_fill3w" c_th3d_fill3w 
+  :: (Ptr RawTH3D) -> CDouble -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_FitSlicesZ" c_th3d_fitslicesz 
+  :: (Ptr RawTH3D) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CInt -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_getCorrelationFactor3" c_th3d_getcorrelationfactor3 
+  :: (Ptr RawTH3D) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_getCovariance3" c_th3d_getcovariance3 
+  :: (Ptr RawTH3D) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_rebinX3" c_th3d_rebinx3 
+  :: (Ptr RawTH3D) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3D.h TH3D_rebinY3" c_th3d_rebiny3 
+  :: (Ptr RawTH3D) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3D.h TH3D_rebinZ3" c_th3d_rebinz3 
+  :: (Ptr RawTH3D) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3D.h TH3D_Rebin3D" c_th3d_rebin3d 
+  :: (Ptr RawTH3D) -> CInt -> CInt -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3D.h TH3D_Add" c_th3d_add 
+  :: (Ptr RawTH3D) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_AddBinContent" c_th3d_addbincontent 
+  :: (Ptr RawTH3D) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_Chi2Test" c_th3d_chi2test 
+  :: (Ptr RawTH3D) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_ComputeIntegral" c_th3d_computeintegral 
+  :: (Ptr RawTH3D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_DirectoryAutoAdd" c_th3d_directoryautoadd 
+  :: (Ptr RawTH3D) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_Divide" c_th3d_divide 
+  :: (Ptr RawTH3D) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_drawCopyTH1" c_th3d_drawcopyth1 
+  :: (Ptr RawTH3D) -> CString -> IO (Ptr RawTH3D)
+
+foreign import ccall "HROOTHistTH3D.h TH3D_DrawNormalized" c_th3d_drawnormalized 
+  :: (Ptr RawTH3D) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3D.h TH3D_drawPanelTH1" c_th3d_drawpanelth1 
+  :: (Ptr RawTH3D) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_BufferEmpty" c_th3d_bufferempty 
+  :: (Ptr RawTH3D) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_evalF" c_th3d_evalf 
+  :: (Ptr RawTH3D) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_FFT" c_th3d_fft 
+  :: (Ptr RawTH3D) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3D.h TH3D_fill1" c_th3d_fill1 
+  :: (Ptr RawTH3D) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_fill1w" c_th3d_fill1w 
+  :: (Ptr RawTH3D) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_fillN1" c_th3d_filln1 
+  :: (Ptr RawTH3D) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_FillRandom" c_th3d_fillrandom 
+  :: (Ptr RawTH3D) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_FindBin" c_th3d_findbin 
+  :: (Ptr RawTH3D) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_FindFixBin" c_th3d_findfixbin 
+  :: (Ptr RawTH3D) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_FindFirstBinAbove" c_th3d_findfirstbinabove 
+  :: (Ptr RawTH3D) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_FindLastBinAbove" c_th3d_findlastbinabove 
+  :: (Ptr RawTH3D) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_FitPanelTH1" c_th3d_fitpanelth1 
+  :: (Ptr RawTH3D) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_getNdivisionA" c_th3d_getndivisiona 
+  :: (Ptr RawTH3D) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_getAxisColorA" c_th3d_getaxiscolora 
+  :: (Ptr RawTH3D) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_getLabelColorA" c_th3d_getlabelcolora 
+  :: (Ptr RawTH3D) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_getLabelFontA" c_th3d_getlabelfonta 
+  :: (Ptr RawTH3D) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_getLabelOffsetA" c_th3d_getlabeloffseta 
+  :: (Ptr RawTH3D) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_getLabelSizeA" c_th3d_getlabelsizea 
+  :: (Ptr RawTH3D) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_getTitleFontA" c_th3d_gettitlefonta 
+  :: (Ptr RawTH3D) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_getTitleOffsetA" c_th3d_gettitleoffseta 
+  :: (Ptr RawTH3D) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_getTitleSizeA" c_th3d_gettitlesizea 
+  :: (Ptr RawTH3D) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_getTickLengthA" c_th3d_getticklengtha 
+  :: (Ptr RawTH3D) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetBarOffset" c_th3d_getbaroffset 
+  :: (Ptr RawTH3D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetBarWidth" c_th3d_getbarwidth 
+  :: (Ptr RawTH3D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetContour" c_th3d_getcontour 
+  :: (Ptr RawTH3D) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetContourLevel" c_th3d_getcontourlevel 
+  :: (Ptr RawTH3D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetContourLevelPad" c_th3d_getcontourlevelpad 
+  :: (Ptr RawTH3D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetBin" c_th3d_getbin 
+  :: (Ptr RawTH3D) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetBinCenter" c_th3d_getbincenter 
+  :: (Ptr RawTH3D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetBinContent1" c_th3d_getbincontent1 
+  :: (Ptr RawTH3D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetBinContent2" c_th3d_getbincontent2 
+  :: (Ptr RawTH3D) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetBinContent3" c_th3d_getbincontent3 
+  :: (Ptr RawTH3D) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetBinError1" c_th3d_getbinerror1 
+  :: (Ptr RawTH3D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetBinError2" c_th3d_getbinerror2 
+  :: (Ptr RawTH3D) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetBinError3" c_th3d_getbinerror3 
+  :: (Ptr RawTH3D) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetBinLowEdge" c_th3d_getbinlowedge 
+  :: (Ptr RawTH3D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetBinWidth" c_th3d_getbinwidth 
+  :: (Ptr RawTH3D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetCellContent" c_th3d_getcellcontent 
+  :: (Ptr RawTH3D) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetCellError" c_th3d_getcellerror 
+  :: (Ptr RawTH3D) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetEntries" c_th3d_getentries 
+  :: (Ptr RawTH3D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetEffectiveEntries" c_th3d_geteffectiveentries 
+  :: (Ptr RawTH3D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetFunction" c_th3d_getfunction 
+  :: (Ptr RawTH3D) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetDimension" c_th3d_getdimension 
+  :: (Ptr RawTH3D) -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetKurtosis" c_th3d_getkurtosis 
+  :: (Ptr RawTH3D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetLowEdge" c_th3d_getlowedge 
+  :: (Ptr RawTH3D) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_getMaximumTH1" c_th3d_getmaximumth1 
+  :: (Ptr RawTH3D) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetMaximumBin" c_th3d_getmaximumbin 
+  :: (Ptr RawTH3D) -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetMaximumStored" c_th3d_getmaximumstored 
+  :: (Ptr RawTH3D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_getMinimumTH1" c_th3d_getminimumth1 
+  :: (Ptr RawTH3D) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetMinimumBin" c_th3d_getminimumbin 
+  :: (Ptr RawTH3D) -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetMinimumStored" c_th3d_getminimumstored 
+  :: (Ptr RawTH3D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetMean" c_th3d_getmean 
+  :: (Ptr RawTH3D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetMeanError" c_th3d_getmeanerror 
+  :: (Ptr RawTH3D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetNbinsX" c_th3d_getnbinsx 
+  :: (Ptr RawTH3D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetNbinsY" c_th3d_getnbinsy 
+  :: (Ptr RawTH3D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetNbinsZ" c_th3d_getnbinsz 
+  :: (Ptr RawTH3D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_getQuantilesTH1" c_th3d_getquantilesth1 
+  :: (Ptr RawTH3D) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetRandom" c_th3d_getrandom 
+  :: (Ptr RawTH3D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetStats" c_th3d_getstats 
+  :: (Ptr RawTH3D) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetSumOfWeights" c_th3d_getsumofweights 
+  :: (Ptr RawTH3D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetSumw2" c_th3d_getsumw2 
+  :: (Ptr RawTH3D) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetSumw2N" c_th3d_getsumw2n 
+  :: (Ptr RawTH3D) -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetRMS" c_th3d_getrms 
+  :: (Ptr RawTH3D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetRMSError" c_th3d_getrmserror 
+  :: (Ptr RawTH3D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetSkewness" c_th3d_getskewness 
+  :: (Ptr RawTH3D) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_integral1" c_th3d_integral1 
+  :: (Ptr RawTH3D) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_interpolate1" c_th3d_interpolate1 
+  :: (Ptr RawTH3D) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_interpolate2" c_th3d_interpolate2 
+  :: (Ptr RawTH3D) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_interpolate3" c_th3d_interpolate3 
+  :: (Ptr RawTH3D) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_KolmogorovTest" c_th3d_kolmogorovtest 
+  :: (Ptr RawTH3D) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_LabelsDeflate" c_th3d_labelsdeflate 
+  :: (Ptr RawTH3D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_LabelsInflate" c_th3d_labelsinflate 
+  :: (Ptr RawTH3D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_LabelsOption" c_th3d_labelsoption 
+  :: (Ptr RawTH3D) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_multiflyF" c_th3d_multiflyf 
+  :: (Ptr RawTH3D) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_Multiply" c_th3d_multiply 
+  :: (Ptr RawTH3D) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_PutStats" c_th3d_putstats 
+  :: (Ptr RawTH3D) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_Rebin" c_th3d_rebin 
+  :: (Ptr RawTH3D) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3D.h TH3D_RebinAxis" c_th3d_rebinaxis 
+  :: (Ptr RawTH3D) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_Rebuild" c_th3d_rebuild 
+  :: (Ptr RawTH3D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_RecursiveRemove" c_th3d_recursiveremove 
+  :: (Ptr RawTH3D) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_Reset" c_th3d_reset 
+  :: (Ptr RawTH3D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_ResetStats" c_th3d_resetstats 
+  :: (Ptr RawTH3D) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_Scale" c_th3d_scale 
+  :: (Ptr RawTH3D) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_setAxisColorA" c_th3d_setaxiscolora 
+  :: (Ptr RawTH3D) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetAxisRange" c_th3d_setaxisrange 
+  :: (Ptr RawTH3D) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetBarOffset" c_th3d_setbaroffset 
+  :: (Ptr RawTH3D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetBarWidth" c_th3d_setbarwidth 
+  :: (Ptr RawTH3D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_setBinContent1" c_th3d_setbincontent1 
+  :: (Ptr RawTH3D) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_setBinContent2" c_th3d_setbincontent2 
+  :: (Ptr RawTH3D) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_setBinContent3" c_th3d_setbincontent3 
+  :: (Ptr RawTH3D) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_setBinError1" c_th3d_setbinerror1 
+  :: (Ptr RawTH3D) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_setBinError2" c_th3d_setbinerror2 
+  :: (Ptr RawTH3D) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_setBinError3" c_th3d_setbinerror3 
+  :: (Ptr RawTH3D) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_setBins1" c_th3d_setbins1 
+  :: (Ptr RawTH3D) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_setBins2" c_th3d_setbins2 
+  :: (Ptr RawTH3D) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_setBins3" c_th3d_setbins3 
+  :: (Ptr RawTH3D) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetBinsLength" c_th3d_setbinslength 
+  :: (Ptr RawTH3D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetBuffer" c_th3d_setbuffer 
+  :: (Ptr RawTH3D) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetCellContent" c_th3d_setcellcontent 
+  :: (Ptr RawTH3D) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetContent" c_th3d_setcontent 
+  :: (Ptr RawTH3D) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetContour" c_th3d_setcontour 
+  :: (Ptr RawTH3D) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetContourLevel" c_th3d_setcontourlevel 
+  :: (Ptr RawTH3D) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetDirectory" c_th3d_setdirectory 
+  :: (Ptr RawTH3D) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetEntries" c_th3d_setentries 
+  :: (Ptr RawTH3D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetError" c_th3d_seterror 
+  :: (Ptr RawTH3D) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_setLabelColorA" c_th3d_setlabelcolora 
+  :: (Ptr RawTH3D) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_setLabelSizeA" c_th3d_setlabelsizea 
+  :: (Ptr RawTH3D) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_setLabelFontA" c_th3d_setlabelfonta 
+  :: (Ptr RawTH3D) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_setLabelOffsetA" c_th3d_setlabeloffseta 
+  :: (Ptr RawTH3D) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetMaximum" c_th3d_setmaximum 
+  :: (Ptr RawTH3D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetMinimum" c_th3d_setminimum 
+  :: (Ptr RawTH3D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetNormFactor" c_th3d_setnormfactor 
+  :: (Ptr RawTH3D) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetStats" c_th3d_setstats 
+  :: (Ptr RawTH3D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetOption" c_th3d_setoption 
+  :: (Ptr RawTH3D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetXTitle" c_th3d_setxtitle 
+  :: (Ptr RawTH3D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetYTitle" c_th3d_setytitle 
+  :: (Ptr RawTH3D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetZTitle" c_th3d_setztitle 
+  :: (Ptr RawTH3D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_ShowBackground" c_th3d_showbackground 
+  :: (Ptr RawTH3D) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3D.h TH3D_ShowPeaks" c_th3d_showpeaks 
+  :: (Ptr RawTH3D) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_Smooth" c_th3d_smooth 
+  :: (Ptr RawTH3D) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_Sumw2" c_th3d_sumw2 
+  :: (Ptr RawTH3D) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_Draw" c_th3d_draw 
+  :: (Ptr RawTH3D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_FindObject" c_th3d_findobject 
+  :: (Ptr RawTH3D) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetName" c_th3d_getname 
+  :: (Ptr RawTH3D) -> IO CString
+
+foreign import ccall "HROOTHistTH3D.h TH3D_IsA" c_th3d_isa 
+  :: (Ptr RawTH3D) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH3D.h TH3D_Paint" c_th3d_paint 
+  :: (Ptr RawTH3D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_printObj" c_th3d_printobj 
+  :: (Ptr RawTH3D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SaveAs" c_th3d_saveas 
+  :: (Ptr RawTH3D) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_Write" c_th3d_write 
+  :: (Ptr RawTH3D) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetLineColor" c_th3d_getlinecolor 
+  :: (Ptr RawTH3D) -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetLineStyle" c_th3d_getlinestyle 
+  :: (Ptr RawTH3D) -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetLineWidth" c_th3d_getlinewidth 
+  :: (Ptr RawTH3D) -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_ResetAttLine" c_th3d_resetattline 
+  :: (Ptr RawTH3D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetLineAttributes" c_th3d_setlineattributes 
+  :: (Ptr RawTH3D) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetLineColor" c_th3d_setlinecolor 
+  :: (Ptr RawTH3D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetLineStyle" c_th3d_setlinestyle 
+  :: (Ptr RawTH3D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetLineWidth" c_th3d_setlinewidth 
+  :: (Ptr RawTH3D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetFillColor" c_th3d_setfillcolor 
+  :: (Ptr RawTH3D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetFillStyle" c_th3d_setfillstyle 
+  :: (Ptr RawTH3D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetMarkerColor" c_th3d_getmarkercolor 
+  :: (Ptr RawTH3D) -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetMarkerStyle" c_th3d_getmarkerstyle 
+  :: (Ptr RawTH3D) -> IO CInt
+
+foreign import ccall "HROOTHistTH3D.h TH3D_GetMarkerSize" c_th3d_getmarkersize 
+  :: (Ptr RawTH3D) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3D.h TH3D_ResetAttMarker" c_th3d_resetattmarker 
+  :: (Ptr RawTH3D) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetMarkerAttributes" c_th3d_setmarkerattributes 
+  :: (Ptr RawTH3D) -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetMarkerColor" c_th3d_setmarkercolor 
+  :: (Ptr RawTH3D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetMarkerStyle" c_th3d_setmarkerstyle 
+  :: (Ptr RawTH3D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_SetMarkerSize" c_th3d_setmarkersize 
+  :: (Ptr RawTH3D) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3D.h TH3D_delete" c_th3d_delete 
+  :: (Ptr RawTH3D) -> IO ()
+
diff --git a/src/HROOT/Hist/TH3D/Implementation.hs b/src/HROOT/Hist/TH3D/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3D/Implementation.hs
@@ -0,0 +1,437 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH3D.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH3D.RawType
+import HROOT.Hist.TH3D.FFI
+import HROOT.Hist.TH3D.Interface
+import HROOT.Hist.TH3D.Cast
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1D.Cast
+import HROOT.Hist.TH1D.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH3.RawType
+import HROOT.Hist.TH3.Cast
+import HROOT.Hist.TH3.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TAtt3D.RawType
+import HROOT.Core.TAtt3D.Cast
+import HROOT.Core.TAtt3D.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+import HROOT.Core.TArray.RawType
+import HROOT.Core.TArray.Cast
+import HROOT.Core.TArray.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH3D TH3D where
+instance ITH3 TH3D where
+  fill3 = xform3 c_th3d_fill3
+  fill3w = xform4 c_th3d_fill3w
+  fitSlicesZ = xform7 c_th3d_fitslicesz
+  getCorrelationFactor3 = xform2 c_th3d_getcorrelationfactor3
+  getCovariance3 = xform2 c_th3d_getcovariance3
+  rebinX3 = xform2 c_th3d_rebinx3
+  rebinY3 = xform2 c_th3d_rebiny3
+  rebinZ3 = xform2 c_th3d_rebinz3
+  rebin3D = xform4 c_th3d_rebin3d
+instance ITArrayD TH3D where
+instance ITH1 TH3D where
+  add = xform2 c_th3d_add
+  addBinContent = xform2 c_th3d_addbincontent
+  chi2Test = xform3 c_th3d_chi2test
+  computeIntegral = xform0 c_th3d_computeintegral
+  directoryAutoAdd = xform1 c_th3d_directoryautoadd
+  divide = xform5 c_th3d_divide
+  drawCopyTH1 = xform1 c_th3d_drawcopyth1
+  drawNormalized = xform2 c_th3d_drawnormalized
+  drawPanelTH1 = xform0 c_th3d_drawpanelth1
+  bufferEmpty = xform1 c_th3d_bufferempty
+  evalF = xform2 c_th3d_evalf
+  fFT = xform2 c_th3d_fft
+  fill1 = xform1 c_th3d_fill1
+  fill1w = xform2 c_th3d_fill1w
+  fillN1 = xform4 c_th3d_filln1
+  fillRandom = xform2 c_th3d_fillrandom
+  findBin = xform3 c_th3d_findbin
+  findFixBin = xform3 c_th3d_findfixbin
+  findFirstBinAbove = xform2 c_th3d_findfirstbinabove
+  findLastBinAbove = xform2 c_th3d_findlastbinabove
+  fitPanelTH1 = xform0 c_th3d_fitpanelth1
+  getNdivisionA = xform1 c_th3d_getndivisiona
+  getAxisColorA = xform1 c_th3d_getaxiscolora
+  getLabelColorA = xform1 c_th3d_getlabelcolora
+  getLabelFontA = xform1 c_th3d_getlabelfonta
+  getLabelOffsetA = xform1 c_th3d_getlabeloffseta
+  getLabelSizeA = xform1 c_th3d_getlabelsizea
+  getTitleFontA = xform1 c_th3d_gettitlefonta
+  getTitleOffsetA = xform1 c_th3d_gettitleoffseta
+  getTitleSizeA = xform1 c_th3d_gettitlesizea
+  getTickLengthA = xform1 c_th3d_getticklengtha
+  getBarOffset = xform0 c_th3d_getbaroffset
+  getBarWidth = xform0 c_th3d_getbarwidth
+  getContour = xform1 c_th3d_getcontour
+  getContourLevel = xform1 c_th3d_getcontourlevel
+  getContourLevelPad = xform1 c_th3d_getcontourlevelpad
+  getBin = xform3 c_th3d_getbin
+  getBinCenter = xform1 c_th3d_getbincenter
+  getBinContent1 = xform1 c_th3d_getbincontent1
+  getBinContent2 = xform2 c_th3d_getbincontent2
+  getBinContent3 = xform3 c_th3d_getbincontent3
+  getBinError1 = xform1 c_th3d_getbinerror1
+  getBinError2 = xform2 c_th3d_getbinerror2
+  getBinError3 = xform3 c_th3d_getbinerror3
+  getBinLowEdge = xform1 c_th3d_getbinlowedge
+  getBinWidth = xform1 c_th3d_getbinwidth
+  getCellContent = xform2 c_th3d_getcellcontent
+  getCellError = xform2 c_th3d_getcellerror
+  getEntries = xform0 c_th3d_getentries
+  getEffectiveEntries = xform0 c_th3d_geteffectiveentries
+  getFunction = xform1 c_th3d_getfunction
+  getDimension = xform0 c_th3d_getdimension
+  getKurtosis = xform1 c_th3d_getkurtosis
+  getLowEdge = xform1 c_th3d_getlowedge
+  getMaximumTH1 = xform1 c_th3d_getmaximumth1
+  getMaximumBin = xform0 c_th3d_getmaximumbin
+  getMaximumStored = xform0 c_th3d_getmaximumstored
+  getMinimumTH1 = xform1 c_th3d_getminimumth1
+  getMinimumBin = xform0 c_th3d_getminimumbin
+  getMinimumStored = xform0 c_th3d_getminimumstored
+  getMean = xform1 c_th3d_getmean
+  getMeanError = xform1 c_th3d_getmeanerror
+  getNbinsX = xform0 c_th3d_getnbinsx
+  getNbinsY = xform0 c_th3d_getnbinsy
+  getNbinsZ = xform0 c_th3d_getnbinsz
+  getQuantilesTH1 = xform3 c_th3d_getquantilesth1
+  getRandom = xform0 c_th3d_getrandom
+  getStats = xform1 c_th3d_getstats
+  getSumOfWeights = xform0 c_th3d_getsumofweights
+  getSumw2 = xform0 c_th3d_getsumw2
+  getSumw2N = xform0 c_th3d_getsumw2n
+  getRMS = xform1 c_th3d_getrms
+  getRMSError = xform1 c_th3d_getrmserror
+  getSkewness = xform1 c_th3d_getskewness
+  integral1 = xform3 c_th3d_integral1
+  interpolate1 = xform1 c_th3d_interpolate1
+  interpolate2 = xform2 c_th3d_interpolate2
+  interpolate3 = xform3 c_th3d_interpolate3
+  kolmogorovTest = xform2 c_th3d_kolmogorovtest
+  labelsDeflate = xform1 c_th3d_labelsdeflate
+  labelsInflate = xform1 c_th3d_labelsinflate
+  labelsOption = xform2 c_th3d_labelsoption
+  multiflyF = xform2 c_th3d_multiflyf
+  multiply = xform5 c_th3d_multiply
+  putStats = xform1 c_th3d_putstats
+  rebin = xform3 c_th3d_rebin
+  rebinAxis = xform2 c_th3d_rebinaxis
+  rebuild = xform1 c_th3d_rebuild
+  recursiveRemove = xform1 c_th3d_recursiveremove
+  reset = xform1 c_th3d_reset
+  resetStats = xform0 c_th3d_resetstats
+  scale = xform2 c_th3d_scale
+  setAxisColorA = xform2 c_th3d_setaxiscolora
+  setAxisRange = xform3 c_th3d_setaxisrange
+  setBarOffset = xform1 c_th3d_setbaroffset
+  setBarWidth = xform1 c_th3d_setbarwidth
+  setBinContent1 = xform2 c_th3d_setbincontent1
+  setBinContent2 = xform3 c_th3d_setbincontent2
+  setBinContent3 = xform4 c_th3d_setbincontent3
+  setBinError1 = xform2 c_th3d_setbinerror1
+  setBinError2 = xform3 c_th3d_setbinerror2
+  setBinError3 = xform4 c_th3d_setbinerror3
+  setBins1 = xform2 c_th3d_setbins1
+  setBins2 = xform4 c_th3d_setbins2
+  setBins3 = xform6 c_th3d_setbins3
+  setBinsLength = xform1 c_th3d_setbinslength
+  setBuffer = xform2 c_th3d_setbuffer
+  setCellContent = xform3 c_th3d_setcellcontent
+  setContent = xform1 c_th3d_setcontent
+  setContour = xform2 c_th3d_setcontour
+  setContourLevel = xform2 c_th3d_setcontourlevel
+  setDirectory = xform1 c_th3d_setdirectory
+  setEntries = xform1 c_th3d_setentries
+  setError = xform1 c_th3d_seterror
+  setLabelColorA = xform2 c_th3d_setlabelcolora
+  setLabelSizeA = xform2 c_th3d_setlabelsizea
+  setLabelFontA = xform2 c_th3d_setlabelfonta
+  setLabelOffsetA = xform2 c_th3d_setlabeloffseta
+  setMaximum = xform1 c_th3d_setmaximum
+  setMinimum = xform1 c_th3d_setminimum
+  setNormFactor = xform1 c_th3d_setnormfactor
+  setStats = xform1 c_th3d_setstats
+  setOption = xform1 c_th3d_setoption
+  setXTitle = xform1 c_th3d_setxtitle
+  setYTitle = xform1 c_th3d_setytitle
+  setZTitle = xform1 c_th3d_setztitle
+  showBackground = xform2 c_th3d_showbackground
+  showPeaks = xform3 c_th3d_showpeaks
+  smooth = xform2 c_th3d_smooth
+  sumw2 = xform0 c_th3d_sumw2
+instance ITAtt3D TH3D where
+instance ITObject TH3D where
+  draw = xform1 c_th3d_draw
+  findObject = xform1 c_th3d_findobject
+  getName = xform0 c_th3d_getname
+  isA = xform0 c_th3d_isa
+  paint = xform1 c_th3d_paint
+  printObj = xform1 c_th3d_printobj
+  saveAs = xform2 c_th3d_saveas
+  write = xform3 c_th3d_write
+instance ITAttLine TH3D where
+  getLineColor = xform0 c_th3d_getlinecolor
+  getLineStyle = xform0 c_th3d_getlinestyle
+  getLineWidth = xform0 c_th3d_getlinewidth
+  resetAttLine = xform1 c_th3d_resetattline
+  setLineAttributes = xform0 c_th3d_setlineattributes
+  setLineColor = xform1 c_th3d_setlinecolor
+  setLineStyle = xform1 c_th3d_setlinestyle
+  setLineWidth = xform1 c_th3d_setlinewidth
+instance ITAttFill TH3D where
+  setFillColor = xform1 c_th3d_setfillcolor
+  setFillStyle = xform1 c_th3d_setfillstyle
+instance ITAttMarker TH3D where
+  getMarkerColor = xform0 c_th3d_getmarkercolor
+  getMarkerStyle = xform0 c_th3d_getmarkerstyle
+  getMarkerSize = xform0 c_th3d_getmarkersize
+  resetAttMarker = xform1 c_th3d_resetattmarker
+  setMarkerAttributes = xform0 c_th3d_setmarkerattributes
+  setMarkerColor = xform1 c_th3d_setmarkercolor
+  setMarkerStyle = xform1 c_th3d_setmarkerstyle
+  setMarkerSize = xform1 c_th3d_setmarkersize
+instance IDeletable TH3D where
+  delete = xform0 c_th3d_delete
+instance ITArray TH3D where
+
+instance ITH3D (Exist TH3D) where
+
+instance ITH3 (Exist TH3D) where
+  fill3 (ETH3D x) = fill3 x
+  fill3w (ETH3D x) = fill3w x
+  fitSlicesZ (ETH3D x) = fitSlicesZ x
+  getCorrelationFactor3 (ETH3D x) = getCorrelationFactor3 x
+  getCovariance3 (ETH3D x) = getCovariance3 x
+  rebinX3 (ETH3D x) = rebinX3 x
+  rebinY3 (ETH3D x) = rebinY3 x
+  rebinZ3 (ETH3D x) = rebinZ3 x
+  rebin3D (ETH3D x) = rebin3D x
+instance ITArrayD (Exist TH3D) where
+
+instance ITH1 (Exist TH3D) where
+  add (ETH3D x) = add x
+  addBinContent (ETH3D x) = addBinContent x
+  chi2Test (ETH3D x) = chi2Test x
+  computeIntegral (ETH3D x) = computeIntegral x
+  directoryAutoAdd (ETH3D x) = directoryAutoAdd x
+  divide (ETH3D x) = divide x
+  drawCopyTH1 (ETH3D x) a1 = return . ETH3D =<< drawCopyTH1 x a1
+  drawNormalized (ETH3D x) = drawNormalized x
+  drawPanelTH1 (ETH3D x) = drawPanelTH1 x
+  bufferEmpty (ETH3D x) = bufferEmpty x
+  evalF (ETH3D x) = evalF x
+  fFT (ETH3D x) = fFT x
+  fill1 (ETH3D x) = fill1 x
+  fill1w (ETH3D x) = fill1w x
+  fillN1 (ETH3D x) = fillN1 x
+  fillRandom (ETH3D x) = fillRandom x
+  findBin (ETH3D x) = findBin x
+  findFixBin (ETH3D x) = findFixBin x
+  findFirstBinAbove (ETH3D x) = findFirstBinAbove x
+  findLastBinAbove (ETH3D x) = findLastBinAbove x
+  fitPanelTH1 (ETH3D x) = fitPanelTH1 x
+  getNdivisionA (ETH3D x) = getNdivisionA x
+  getAxisColorA (ETH3D x) = getAxisColorA x
+  getLabelColorA (ETH3D x) = getLabelColorA x
+  getLabelFontA (ETH3D x) = getLabelFontA x
+  getLabelOffsetA (ETH3D x) = getLabelOffsetA x
+  getLabelSizeA (ETH3D x) = getLabelSizeA x
+  getTitleFontA (ETH3D x) = getTitleFontA x
+  getTitleOffsetA (ETH3D x) = getTitleOffsetA x
+  getTitleSizeA (ETH3D x) = getTitleSizeA x
+  getTickLengthA (ETH3D x) = getTickLengthA x
+  getBarOffset (ETH3D x) = getBarOffset x
+  getBarWidth (ETH3D x) = getBarWidth x
+  getContour (ETH3D x) = getContour x
+  getContourLevel (ETH3D x) = getContourLevel x
+  getContourLevelPad (ETH3D x) = getContourLevelPad x
+  getBin (ETH3D x) = getBin x
+  getBinCenter (ETH3D x) = getBinCenter x
+  getBinContent1 (ETH3D x) = getBinContent1 x
+  getBinContent2 (ETH3D x) = getBinContent2 x
+  getBinContent3 (ETH3D x) = getBinContent3 x
+  getBinError1 (ETH3D x) = getBinError1 x
+  getBinError2 (ETH3D x) = getBinError2 x
+  getBinError3 (ETH3D x) = getBinError3 x
+  getBinLowEdge (ETH3D x) = getBinLowEdge x
+  getBinWidth (ETH3D x) = getBinWidth x
+  getCellContent (ETH3D x) = getCellContent x
+  getCellError (ETH3D x) = getCellError x
+  getEntries (ETH3D x) = getEntries x
+  getEffectiveEntries (ETH3D x) = getEffectiveEntries x
+  getFunction (ETH3D x) = getFunction x
+  getDimension (ETH3D x) = getDimension x
+  getKurtosis (ETH3D x) = getKurtosis x
+  getLowEdge (ETH3D x) = getLowEdge x
+  getMaximumTH1 (ETH3D x) = getMaximumTH1 x
+  getMaximumBin (ETH3D x) = getMaximumBin x
+  getMaximumStored (ETH3D x) = getMaximumStored x
+  getMinimumTH1 (ETH3D x) = getMinimumTH1 x
+  getMinimumBin (ETH3D x) = getMinimumBin x
+  getMinimumStored (ETH3D x) = getMinimumStored x
+  getMean (ETH3D x) = getMean x
+  getMeanError (ETH3D x) = getMeanError x
+  getNbinsX (ETH3D x) = getNbinsX x
+  getNbinsY (ETH3D x) = getNbinsY x
+  getNbinsZ (ETH3D x) = getNbinsZ x
+  getQuantilesTH1 (ETH3D x) = getQuantilesTH1 x
+  getRandom (ETH3D x) = getRandom x
+  getStats (ETH3D x) = getStats x
+  getSumOfWeights (ETH3D x) = getSumOfWeights x
+  getSumw2 (ETH3D x) = getSumw2 x
+  getSumw2N (ETH3D x) = getSumw2N x
+  getRMS (ETH3D x) = getRMS x
+  getRMSError (ETH3D x) = getRMSError x
+  getSkewness (ETH3D x) = getSkewness x
+  integral1 (ETH3D x) = integral1 x
+  interpolate1 (ETH3D x) = interpolate1 x
+  interpolate2 (ETH3D x) = interpolate2 x
+  interpolate3 (ETH3D x) = interpolate3 x
+  kolmogorovTest (ETH3D x) = kolmogorovTest x
+  labelsDeflate (ETH3D x) = labelsDeflate x
+  labelsInflate (ETH3D x) = labelsInflate x
+  labelsOption (ETH3D x) = labelsOption x
+  multiflyF (ETH3D x) = multiflyF x
+  multiply (ETH3D x) = multiply x
+  putStats (ETH3D x) = putStats x
+  rebin (ETH3D x) = rebin x
+  rebinAxis (ETH3D x) = rebinAxis x
+  rebuild (ETH3D x) = rebuild x
+  recursiveRemove (ETH3D x) = recursiveRemove x
+  reset (ETH3D x) = reset x
+  resetStats (ETH3D x) = resetStats x
+  scale (ETH3D x) = scale x
+  setAxisColorA (ETH3D x) = setAxisColorA x
+  setAxisRange (ETH3D x) = setAxisRange x
+  setBarOffset (ETH3D x) = setBarOffset x
+  setBarWidth (ETH3D x) = setBarWidth x
+  setBinContent1 (ETH3D x) = setBinContent1 x
+  setBinContent2 (ETH3D x) = setBinContent2 x
+  setBinContent3 (ETH3D x) = setBinContent3 x
+  setBinError1 (ETH3D x) = setBinError1 x
+  setBinError2 (ETH3D x) = setBinError2 x
+  setBinError3 (ETH3D x) = setBinError3 x
+  setBins1 (ETH3D x) = setBins1 x
+  setBins2 (ETH3D x) = setBins2 x
+  setBins3 (ETH3D x) = setBins3 x
+  setBinsLength (ETH3D x) = setBinsLength x
+  setBuffer (ETH3D x) = setBuffer x
+  setCellContent (ETH3D x) = setCellContent x
+  setContent (ETH3D x) = setContent x
+  setContour (ETH3D x) = setContour x
+  setContourLevel (ETH3D x) = setContourLevel x
+  setDirectory (ETH3D x) = setDirectory x
+  setEntries (ETH3D x) = setEntries x
+  setError (ETH3D x) = setError x
+  setLabelColorA (ETH3D x) = setLabelColorA x
+  setLabelSizeA (ETH3D x) = setLabelSizeA x
+  setLabelFontA (ETH3D x) = setLabelFontA x
+  setLabelOffsetA (ETH3D x) = setLabelOffsetA x
+  setMaximum (ETH3D x) = setMaximum x
+  setMinimum (ETH3D x) = setMinimum x
+  setNormFactor (ETH3D x) = setNormFactor x
+  setStats (ETH3D x) = setStats x
+  setOption (ETH3D x) = setOption x
+  setXTitle (ETH3D x) = setXTitle x
+  setYTitle (ETH3D x) = setYTitle x
+  setZTitle (ETH3D x) = setZTitle x
+  showBackground (ETH3D x) = showBackground x
+  showPeaks (ETH3D x) = showPeaks x
+  smooth (ETH3D x) = smooth x
+  sumw2 (ETH3D x) = sumw2 x
+instance ITAtt3D (Exist TH3D) where
+
+instance ITObject (Exist TH3D) where
+  draw (ETH3D x) = draw x
+  findObject (ETH3D x) = findObject x
+  getName (ETH3D x) = getName x
+  isA (ETH3D x) = isA x
+  paint (ETH3D x) = paint x
+  printObj (ETH3D x) = printObj x
+  saveAs (ETH3D x) = saveAs x
+  write (ETH3D x) = write x
+instance ITAttLine (Exist TH3D) where
+  getLineColor (ETH3D x) = getLineColor x
+  getLineStyle (ETH3D x) = getLineStyle x
+  getLineWidth (ETH3D x) = getLineWidth x
+  resetAttLine (ETH3D x) = resetAttLine x
+  setLineAttributes (ETH3D x) = setLineAttributes x
+  setLineColor (ETH3D x) = setLineColor x
+  setLineStyle (ETH3D x) = setLineStyle x
+  setLineWidth (ETH3D x) = setLineWidth x
+instance ITAttFill (Exist TH3D) where
+  setFillColor (ETH3D x) = setFillColor x
+  setFillStyle (ETH3D x) = setFillStyle x
+instance ITAttMarker (Exist TH3D) where
+  getMarkerColor (ETH3D x) = getMarkerColor x
+  getMarkerStyle (ETH3D x) = getMarkerStyle x
+  getMarkerSize (ETH3D x) = getMarkerSize x
+  resetAttMarker (ETH3D x) = resetAttMarker x
+  setMarkerAttributes (ETH3D x) = setMarkerAttributes x
+  setMarkerColor (ETH3D x) = setMarkerColor x
+  setMarkerStyle (ETH3D x) = setMarkerStyle x
+  setMarkerSize (ETH3D x) = setMarkerSize x
+instance IDeletable (Exist TH3D) where
+  delete (ETH3D x) = delete x
+instance ITArray (Exist TH3D) where
+
+
+
+
+
+
+
+
+instance FPtr (Exist TH3D) where
+  type Raw (Exist TH3D) = RawTH3D
+  get_fptr (ETH3D obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH3D (cast_fptr_to_obj (fptr :: ForeignPtr RawTH3D) :: TH3D)
diff --git a/src/HROOT/Hist/TH3D/Interface.hs b/src/HROOT/Hist/TH3D/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3D/Interface.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH3D.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH3D.RawType
+
+import HROOT.Hist.TH3.Interface
+import HROOT.Core.TArrayD.Interface
+---- ============ ----
+
+
+
+class (ITH3 a,ITArrayD a) => ITH3D a where
+
+instance Existable TH3D where
+  data Exist TH3D = forall a. (FPtr a, ITH3D a) => ETH3D a
+
+upcastTH3D :: (FPtr a, ITH3D a) => a -> TH3D
+upcastTH3D h = let fh = get_fptr h
+                   fh2 :: ForeignPtr RawTH3D = castForeignPtr fh
+               in cast_fptr_to_obj fh2
+
+downcastTH3D :: (FPtr a, ITH3D a) => TH3D -> a 
+downcastTH3D h = let fh = get_fptr h
+                     fh2 = castForeignPtr fh
+                 in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH3D/RawType.hs b/src/HROOT/Hist/TH3D/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3D/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH3D.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH3D
+newtype TH3D = TH3D (ForeignPtr RawTH3D) deriving (Eq, Ord, Show)
+instance FPtr TH3D where
+   type Raw TH3D = RawTH3D
+   get_fptr (TH3D fptr) = fptr
+   cast_fptr_to_obj = TH3D
diff --git a/src/HROOT/Hist/TH3F.hs b/src/HROOT/Hist/TH3F.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3F.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TH3F
+  (
+    TH3F(..)
+  , ITH3F
+  , upcastTH3F
+  , downcastTH3F
+
+ 
+  ) where
+
+import HROOT.Hist.TH3F.RawType
+import HROOT.Hist.TH3F.Interface
+import HROOT.Hist.TH3F.Implementation
+
+
diff --git a/src/HROOT/Hist/TH3F/Cast.hs b/src/HROOT/Hist/TH3F/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3F/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH3F.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH3F.RawType
+import HROOT.Hist.TH3F.Interface
+
+instance (ITH3F a, FPtr a) => Castable a (Ptr RawTH3F) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH3F (Ptr RawTH3F) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH3F/FFI.hsc b/src/HROOT/Hist/TH3F/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3F/FFI.hsc
@@ -0,0 +1,525 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH3F.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH3F.RawType
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH3.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTH3F.h"
+
+foreign import ccall "HROOTHistTH3F.h TH3F_fill3" c_th3f_fill3 
+  :: (Ptr RawTH3F) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_fill3w" c_th3f_fill3w 
+  :: (Ptr RawTH3F) -> CDouble -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_FitSlicesZ" c_th3f_fitslicesz 
+  :: (Ptr RawTH3F) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CInt -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_getCorrelationFactor3" c_th3f_getcorrelationfactor3 
+  :: (Ptr RawTH3F) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_getCovariance3" c_th3f_getcovariance3 
+  :: (Ptr RawTH3F) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_rebinX3" c_th3f_rebinx3 
+  :: (Ptr RawTH3F) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3F.h TH3F_rebinY3" c_th3f_rebiny3 
+  :: (Ptr RawTH3F) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3F.h TH3F_rebinZ3" c_th3f_rebinz3 
+  :: (Ptr RawTH3F) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3F.h TH3F_Rebin3D" c_th3f_rebin3d 
+  :: (Ptr RawTH3F) -> CInt -> CInt -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3F.h TH3F_Add" c_th3f_add 
+  :: (Ptr RawTH3F) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_AddBinContent" c_th3f_addbincontent 
+  :: (Ptr RawTH3F) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_Chi2Test" c_th3f_chi2test 
+  :: (Ptr RawTH3F) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_ComputeIntegral" c_th3f_computeintegral 
+  :: (Ptr RawTH3F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_DirectoryAutoAdd" c_th3f_directoryautoadd 
+  :: (Ptr RawTH3F) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_Divide" c_th3f_divide 
+  :: (Ptr RawTH3F) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_drawCopyTH1" c_th3f_drawcopyth1 
+  :: (Ptr RawTH3F) -> CString -> IO (Ptr RawTH3F)
+
+foreign import ccall "HROOTHistTH3F.h TH3F_DrawNormalized" c_th3f_drawnormalized 
+  :: (Ptr RawTH3F) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3F.h TH3F_drawPanelTH1" c_th3f_drawpanelth1 
+  :: (Ptr RawTH3F) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_BufferEmpty" c_th3f_bufferempty 
+  :: (Ptr RawTH3F) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_evalF" c_th3f_evalf 
+  :: (Ptr RawTH3F) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_FFT" c_th3f_fft 
+  :: (Ptr RawTH3F) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3F.h TH3F_fill1" c_th3f_fill1 
+  :: (Ptr RawTH3F) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_fill1w" c_th3f_fill1w 
+  :: (Ptr RawTH3F) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_fillN1" c_th3f_filln1 
+  :: (Ptr RawTH3F) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_FillRandom" c_th3f_fillrandom 
+  :: (Ptr RawTH3F) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_FindBin" c_th3f_findbin 
+  :: (Ptr RawTH3F) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_FindFixBin" c_th3f_findfixbin 
+  :: (Ptr RawTH3F) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_FindFirstBinAbove" c_th3f_findfirstbinabove 
+  :: (Ptr RawTH3F) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_FindLastBinAbove" c_th3f_findlastbinabove 
+  :: (Ptr RawTH3F) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_FitPanelTH1" c_th3f_fitpanelth1 
+  :: (Ptr RawTH3F) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_getNdivisionA" c_th3f_getndivisiona 
+  :: (Ptr RawTH3F) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_getAxisColorA" c_th3f_getaxiscolora 
+  :: (Ptr RawTH3F) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_getLabelColorA" c_th3f_getlabelcolora 
+  :: (Ptr RawTH3F) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_getLabelFontA" c_th3f_getlabelfonta 
+  :: (Ptr RawTH3F) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_getLabelOffsetA" c_th3f_getlabeloffseta 
+  :: (Ptr RawTH3F) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_getLabelSizeA" c_th3f_getlabelsizea 
+  :: (Ptr RawTH3F) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_getTitleFontA" c_th3f_gettitlefonta 
+  :: (Ptr RawTH3F) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_getTitleOffsetA" c_th3f_gettitleoffseta 
+  :: (Ptr RawTH3F) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_getTitleSizeA" c_th3f_gettitlesizea 
+  :: (Ptr RawTH3F) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_getTickLengthA" c_th3f_getticklengtha 
+  :: (Ptr RawTH3F) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetBarOffset" c_th3f_getbaroffset 
+  :: (Ptr RawTH3F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetBarWidth" c_th3f_getbarwidth 
+  :: (Ptr RawTH3F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetContour" c_th3f_getcontour 
+  :: (Ptr RawTH3F) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetContourLevel" c_th3f_getcontourlevel 
+  :: (Ptr RawTH3F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetContourLevelPad" c_th3f_getcontourlevelpad 
+  :: (Ptr RawTH3F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetBin" c_th3f_getbin 
+  :: (Ptr RawTH3F) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetBinCenter" c_th3f_getbincenter 
+  :: (Ptr RawTH3F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetBinContent1" c_th3f_getbincontent1 
+  :: (Ptr RawTH3F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetBinContent2" c_th3f_getbincontent2 
+  :: (Ptr RawTH3F) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetBinContent3" c_th3f_getbincontent3 
+  :: (Ptr RawTH3F) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetBinError1" c_th3f_getbinerror1 
+  :: (Ptr RawTH3F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetBinError2" c_th3f_getbinerror2 
+  :: (Ptr RawTH3F) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetBinError3" c_th3f_getbinerror3 
+  :: (Ptr RawTH3F) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetBinLowEdge" c_th3f_getbinlowedge 
+  :: (Ptr RawTH3F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetBinWidth" c_th3f_getbinwidth 
+  :: (Ptr RawTH3F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetCellContent" c_th3f_getcellcontent 
+  :: (Ptr RawTH3F) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetCellError" c_th3f_getcellerror 
+  :: (Ptr RawTH3F) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetEntries" c_th3f_getentries 
+  :: (Ptr RawTH3F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetEffectiveEntries" c_th3f_geteffectiveentries 
+  :: (Ptr RawTH3F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetFunction" c_th3f_getfunction 
+  :: (Ptr RawTH3F) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetDimension" c_th3f_getdimension 
+  :: (Ptr RawTH3F) -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetKurtosis" c_th3f_getkurtosis 
+  :: (Ptr RawTH3F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetLowEdge" c_th3f_getlowedge 
+  :: (Ptr RawTH3F) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_getMaximumTH1" c_th3f_getmaximumth1 
+  :: (Ptr RawTH3F) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetMaximumBin" c_th3f_getmaximumbin 
+  :: (Ptr RawTH3F) -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetMaximumStored" c_th3f_getmaximumstored 
+  :: (Ptr RawTH3F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_getMinimumTH1" c_th3f_getminimumth1 
+  :: (Ptr RawTH3F) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetMinimumBin" c_th3f_getminimumbin 
+  :: (Ptr RawTH3F) -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetMinimumStored" c_th3f_getminimumstored 
+  :: (Ptr RawTH3F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetMean" c_th3f_getmean 
+  :: (Ptr RawTH3F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetMeanError" c_th3f_getmeanerror 
+  :: (Ptr RawTH3F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetNbinsX" c_th3f_getnbinsx 
+  :: (Ptr RawTH3F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetNbinsY" c_th3f_getnbinsy 
+  :: (Ptr RawTH3F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetNbinsZ" c_th3f_getnbinsz 
+  :: (Ptr RawTH3F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_getQuantilesTH1" c_th3f_getquantilesth1 
+  :: (Ptr RawTH3F) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetRandom" c_th3f_getrandom 
+  :: (Ptr RawTH3F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetStats" c_th3f_getstats 
+  :: (Ptr RawTH3F) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetSumOfWeights" c_th3f_getsumofweights 
+  :: (Ptr RawTH3F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetSumw2" c_th3f_getsumw2 
+  :: (Ptr RawTH3F) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetSumw2N" c_th3f_getsumw2n 
+  :: (Ptr RawTH3F) -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetRMS" c_th3f_getrms 
+  :: (Ptr RawTH3F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetRMSError" c_th3f_getrmserror 
+  :: (Ptr RawTH3F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetSkewness" c_th3f_getskewness 
+  :: (Ptr RawTH3F) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_integral1" c_th3f_integral1 
+  :: (Ptr RawTH3F) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_interpolate1" c_th3f_interpolate1 
+  :: (Ptr RawTH3F) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_interpolate2" c_th3f_interpolate2 
+  :: (Ptr RawTH3F) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_interpolate3" c_th3f_interpolate3 
+  :: (Ptr RawTH3F) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_KolmogorovTest" c_th3f_kolmogorovtest 
+  :: (Ptr RawTH3F) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_LabelsDeflate" c_th3f_labelsdeflate 
+  :: (Ptr RawTH3F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_LabelsInflate" c_th3f_labelsinflate 
+  :: (Ptr RawTH3F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_LabelsOption" c_th3f_labelsoption 
+  :: (Ptr RawTH3F) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_multiflyF" c_th3f_multiflyf 
+  :: (Ptr RawTH3F) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_Multiply" c_th3f_multiply 
+  :: (Ptr RawTH3F) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_PutStats" c_th3f_putstats 
+  :: (Ptr RawTH3F) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_Rebin" c_th3f_rebin 
+  :: (Ptr RawTH3F) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3F.h TH3F_RebinAxis" c_th3f_rebinaxis 
+  :: (Ptr RawTH3F) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_Rebuild" c_th3f_rebuild 
+  :: (Ptr RawTH3F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_RecursiveRemove" c_th3f_recursiveremove 
+  :: (Ptr RawTH3F) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_Reset" c_th3f_reset 
+  :: (Ptr RawTH3F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_ResetStats" c_th3f_resetstats 
+  :: (Ptr RawTH3F) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_Scale" c_th3f_scale 
+  :: (Ptr RawTH3F) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_setAxisColorA" c_th3f_setaxiscolora 
+  :: (Ptr RawTH3F) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetAxisRange" c_th3f_setaxisrange 
+  :: (Ptr RawTH3F) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetBarOffset" c_th3f_setbaroffset 
+  :: (Ptr RawTH3F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetBarWidth" c_th3f_setbarwidth 
+  :: (Ptr RawTH3F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_setBinContent1" c_th3f_setbincontent1 
+  :: (Ptr RawTH3F) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_setBinContent2" c_th3f_setbincontent2 
+  :: (Ptr RawTH3F) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_setBinContent3" c_th3f_setbincontent3 
+  :: (Ptr RawTH3F) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_setBinError1" c_th3f_setbinerror1 
+  :: (Ptr RawTH3F) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_setBinError2" c_th3f_setbinerror2 
+  :: (Ptr RawTH3F) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_setBinError3" c_th3f_setbinerror3 
+  :: (Ptr RawTH3F) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_setBins1" c_th3f_setbins1 
+  :: (Ptr RawTH3F) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_setBins2" c_th3f_setbins2 
+  :: (Ptr RawTH3F) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_setBins3" c_th3f_setbins3 
+  :: (Ptr RawTH3F) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetBinsLength" c_th3f_setbinslength 
+  :: (Ptr RawTH3F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetBuffer" c_th3f_setbuffer 
+  :: (Ptr RawTH3F) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetCellContent" c_th3f_setcellcontent 
+  :: (Ptr RawTH3F) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetContent" c_th3f_setcontent 
+  :: (Ptr RawTH3F) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetContour" c_th3f_setcontour 
+  :: (Ptr RawTH3F) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetContourLevel" c_th3f_setcontourlevel 
+  :: (Ptr RawTH3F) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetDirectory" c_th3f_setdirectory 
+  :: (Ptr RawTH3F) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetEntries" c_th3f_setentries 
+  :: (Ptr RawTH3F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetError" c_th3f_seterror 
+  :: (Ptr RawTH3F) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_setLabelColorA" c_th3f_setlabelcolora 
+  :: (Ptr RawTH3F) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_setLabelSizeA" c_th3f_setlabelsizea 
+  :: (Ptr RawTH3F) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_setLabelFontA" c_th3f_setlabelfonta 
+  :: (Ptr RawTH3F) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_setLabelOffsetA" c_th3f_setlabeloffseta 
+  :: (Ptr RawTH3F) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetMaximum" c_th3f_setmaximum 
+  :: (Ptr RawTH3F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetMinimum" c_th3f_setminimum 
+  :: (Ptr RawTH3F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetNormFactor" c_th3f_setnormfactor 
+  :: (Ptr RawTH3F) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetStats" c_th3f_setstats 
+  :: (Ptr RawTH3F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetOption" c_th3f_setoption 
+  :: (Ptr RawTH3F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetXTitle" c_th3f_setxtitle 
+  :: (Ptr RawTH3F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetYTitle" c_th3f_setytitle 
+  :: (Ptr RawTH3F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetZTitle" c_th3f_setztitle 
+  :: (Ptr RawTH3F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_ShowBackground" c_th3f_showbackground 
+  :: (Ptr RawTH3F) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3F.h TH3F_ShowPeaks" c_th3f_showpeaks 
+  :: (Ptr RawTH3F) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_Smooth" c_th3f_smooth 
+  :: (Ptr RawTH3F) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_Sumw2" c_th3f_sumw2 
+  :: (Ptr RawTH3F) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_Draw" c_th3f_draw 
+  :: (Ptr RawTH3F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_FindObject" c_th3f_findobject 
+  :: (Ptr RawTH3F) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetName" c_th3f_getname 
+  :: (Ptr RawTH3F) -> IO CString
+
+foreign import ccall "HROOTHistTH3F.h TH3F_IsA" c_th3f_isa 
+  :: (Ptr RawTH3F) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH3F.h TH3F_Paint" c_th3f_paint 
+  :: (Ptr RawTH3F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_printObj" c_th3f_printobj 
+  :: (Ptr RawTH3F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SaveAs" c_th3f_saveas 
+  :: (Ptr RawTH3F) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_Write" c_th3f_write 
+  :: (Ptr RawTH3F) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetLineColor" c_th3f_getlinecolor 
+  :: (Ptr RawTH3F) -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetLineStyle" c_th3f_getlinestyle 
+  :: (Ptr RawTH3F) -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetLineWidth" c_th3f_getlinewidth 
+  :: (Ptr RawTH3F) -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_ResetAttLine" c_th3f_resetattline 
+  :: (Ptr RawTH3F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetLineAttributes" c_th3f_setlineattributes 
+  :: (Ptr RawTH3F) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetLineColor" c_th3f_setlinecolor 
+  :: (Ptr RawTH3F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetLineStyle" c_th3f_setlinestyle 
+  :: (Ptr RawTH3F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetLineWidth" c_th3f_setlinewidth 
+  :: (Ptr RawTH3F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetFillColor" c_th3f_setfillcolor 
+  :: (Ptr RawTH3F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetFillStyle" c_th3f_setfillstyle 
+  :: (Ptr RawTH3F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetMarkerColor" c_th3f_getmarkercolor 
+  :: (Ptr RawTH3F) -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetMarkerStyle" c_th3f_getmarkerstyle 
+  :: (Ptr RawTH3F) -> IO CInt
+
+foreign import ccall "HROOTHistTH3F.h TH3F_GetMarkerSize" c_th3f_getmarkersize 
+  :: (Ptr RawTH3F) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3F.h TH3F_ResetAttMarker" c_th3f_resetattmarker 
+  :: (Ptr RawTH3F) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetMarkerAttributes" c_th3f_setmarkerattributes 
+  :: (Ptr RawTH3F) -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetMarkerColor" c_th3f_setmarkercolor 
+  :: (Ptr RawTH3F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetMarkerStyle" c_th3f_setmarkerstyle 
+  :: (Ptr RawTH3F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_SetMarkerSize" c_th3f_setmarkersize 
+  :: (Ptr RawTH3F) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3F.h TH3F_delete" c_th3f_delete 
+  :: (Ptr RawTH3F) -> IO ()
+
diff --git a/src/HROOT/Hist/TH3F/Implementation.hs b/src/HROOT/Hist/TH3F/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3F/Implementation.hs
@@ -0,0 +1,440 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH3F.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH3F.RawType
+import HROOT.Hist.TH3F.FFI
+import HROOT.Hist.TH3F.Interface
+import HROOT.Hist.TH3F.Cast
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1D.Cast
+import HROOT.Hist.TH1D.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH3.RawType
+import HROOT.Hist.TH3.Cast
+import HROOT.Hist.TH3.Interface
+import HROOT.Core.TArrayF.RawType
+import HROOT.Core.TArrayF.Cast
+import HROOT.Core.TArrayF.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TAtt3D.RawType
+import HROOT.Core.TAtt3D.Cast
+import HROOT.Core.TAtt3D.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+import HROOT.Core.TArray.RawType
+import HROOT.Core.TArray.Cast
+import HROOT.Core.TArray.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH3F TH3F where
+instance ITH3 TH3F where
+  fill3 = xform3 c_th3f_fill3
+  fill3w = xform4 c_th3f_fill3w
+  fitSlicesZ = xform7 c_th3f_fitslicesz
+  getCorrelationFactor3 = xform2 c_th3f_getcorrelationfactor3
+  getCovariance3 = xform2 c_th3f_getcovariance3
+  rebinX3 = xform2 c_th3f_rebinx3
+  rebinY3 = xform2 c_th3f_rebiny3
+  rebinZ3 = xform2 c_th3f_rebinz3
+  rebin3D = xform4 c_th3f_rebin3d
+instance ITArrayF TH3F where
+instance ITH1 TH3F where
+  add = xform2 c_th3f_add
+  addBinContent = xform2 c_th3f_addbincontent
+  chi2Test = xform3 c_th3f_chi2test
+  computeIntegral = xform0 c_th3f_computeintegral
+  directoryAutoAdd = xform1 c_th3f_directoryautoadd
+  divide = xform5 c_th3f_divide
+  drawCopyTH1 = xform1 c_th3f_drawcopyth1
+  drawNormalized = xform2 c_th3f_drawnormalized
+  drawPanelTH1 = xform0 c_th3f_drawpanelth1
+  bufferEmpty = xform1 c_th3f_bufferempty
+  evalF = xform2 c_th3f_evalf
+  fFT = xform2 c_th3f_fft
+  fill1 = xform1 c_th3f_fill1
+  fill1w = xform2 c_th3f_fill1w
+  fillN1 = xform4 c_th3f_filln1
+  fillRandom = xform2 c_th3f_fillrandom
+  findBin = xform3 c_th3f_findbin
+  findFixBin = xform3 c_th3f_findfixbin
+  findFirstBinAbove = xform2 c_th3f_findfirstbinabove
+  findLastBinAbove = xform2 c_th3f_findlastbinabove
+  fitPanelTH1 = xform0 c_th3f_fitpanelth1
+  getNdivisionA = xform1 c_th3f_getndivisiona
+  getAxisColorA = xform1 c_th3f_getaxiscolora
+  getLabelColorA = xform1 c_th3f_getlabelcolora
+  getLabelFontA = xform1 c_th3f_getlabelfonta
+  getLabelOffsetA = xform1 c_th3f_getlabeloffseta
+  getLabelSizeA = xform1 c_th3f_getlabelsizea
+  getTitleFontA = xform1 c_th3f_gettitlefonta
+  getTitleOffsetA = xform1 c_th3f_gettitleoffseta
+  getTitleSizeA = xform1 c_th3f_gettitlesizea
+  getTickLengthA = xform1 c_th3f_getticklengtha
+  getBarOffset = xform0 c_th3f_getbaroffset
+  getBarWidth = xform0 c_th3f_getbarwidth
+  getContour = xform1 c_th3f_getcontour
+  getContourLevel = xform1 c_th3f_getcontourlevel
+  getContourLevelPad = xform1 c_th3f_getcontourlevelpad
+  getBin = xform3 c_th3f_getbin
+  getBinCenter = xform1 c_th3f_getbincenter
+  getBinContent1 = xform1 c_th3f_getbincontent1
+  getBinContent2 = xform2 c_th3f_getbincontent2
+  getBinContent3 = xform3 c_th3f_getbincontent3
+  getBinError1 = xform1 c_th3f_getbinerror1
+  getBinError2 = xform2 c_th3f_getbinerror2
+  getBinError3 = xform3 c_th3f_getbinerror3
+  getBinLowEdge = xform1 c_th3f_getbinlowedge
+  getBinWidth = xform1 c_th3f_getbinwidth
+  getCellContent = xform2 c_th3f_getcellcontent
+  getCellError = xform2 c_th3f_getcellerror
+  getEntries = xform0 c_th3f_getentries
+  getEffectiveEntries = xform0 c_th3f_geteffectiveentries
+  getFunction = xform1 c_th3f_getfunction
+  getDimension = xform0 c_th3f_getdimension
+  getKurtosis = xform1 c_th3f_getkurtosis
+  getLowEdge = xform1 c_th3f_getlowedge
+  getMaximumTH1 = xform1 c_th3f_getmaximumth1
+  getMaximumBin = xform0 c_th3f_getmaximumbin
+  getMaximumStored = xform0 c_th3f_getmaximumstored
+  getMinimumTH1 = xform1 c_th3f_getminimumth1
+  getMinimumBin = xform0 c_th3f_getminimumbin
+  getMinimumStored = xform0 c_th3f_getminimumstored
+  getMean = xform1 c_th3f_getmean
+  getMeanError = xform1 c_th3f_getmeanerror
+  getNbinsX = xform0 c_th3f_getnbinsx
+  getNbinsY = xform0 c_th3f_getnbinsy
+  getNbinsZ = xform0 c_th3f_getnbinsz
+  getQuantilesTH1 = xform3 c_th3f_getquantilesth1
+  getRandom = xform0 c_th3f_getrandom
+  getStats = xform1 c_th3f_getstats
+  getSumOfWeights = xform0 c_th3f_getsumofweights
+  getSumw2 = xform0 c_th3f_getsumw2
+  getSumw2N = xform0 c_th3f_getsumw2n
+  getRMS = xform1 c_th3f_getrms
+  getRMSError = xform1 c_th3f_getrmserror
+  getSkewness = xform1 c_th3f_getskewness
+  integral1 = xform3 c_th3f_integral1
+  interpolate1 = xform1 c_th3f_interpolate1
+  interpolate2 = xform2 c_th3f_interpolate2
+  interpolate3 = xform3 c_th3f_interpolate3
+  kolmogorovTest = xform2 c_th3f_kolmogorovtest
+  labelsDeflate = xform1 c_th3f_labelsdeflate
+  labelsInflate = xform1 c_th3f_labelsinflate
+  labelsOption = xform2 c_th3f_labelsoption
+  multiflyF = xform2 c_th3f_multiflyf
+  multiply = xform5 c_th3f_multiply
+  putStats = xform1 c_th3f_putstats
+  rebin = xform3 c_th3f_rebin
+  rebinAxis = xform2 c_th3f_rebinaxis
+  rebuild = xform1 c_th3f_rebuild
+  recursiveRemove = xform1 c_th3f_recursiveremove
+  reset = xform1 c_th3f_reset
+  resetStats = xform0 c_th3f_resetstats
+  scale = xform2 c_th3f_scale
+  setAxisColorA = xform2 c_th3f_setaxiscolora
+  setAxisRange = xform3 c_th3f_setaxisrange
+  setBarOffset = xform1 c_th3f_setbaroffset
+  setBarWidth = xform1 c_th3f_setbarwidth
+  setBinContent1 = xform2 c_th3f_setbincontent1
+  setBinContent2 = xform3 c_th3f_setbincontent2
+  setBinContent3 = xform4 c_th3f_setbincontent3
+  setBinError1 = xform2 c_th3f_setbinerror1
+  setBinError2 = xform3 c_th3f_setbinerror2
+  setBinError3 = xform4 c_th3f_setbinerror3
+  setBins1 = xform2 c_th3f_setbins1
+  setBins2 = xform4 c_th3f_setbins2
+  setBins3 = xform6 c_th3f_setbins3
+  setBinsLength = xform1 c_th3f_setbinslength
+  setBuffer = xform2 c_th3f_setbuffer
+  setCellContent = xform3 c_th3f_setcellcontent
+  setContent = xform1 c_th3f_setcontent
+  setContour = xform2 c_th3f_setcontour
+  setContourLevel = xform2 c_th3f_setcontourlevel
+  setDirectory = xform1 c_th3f_setdirectory
+  setEntries = xform1 c_th3f_setentries
+  setError = xform1 c_th3f_seterror
+  setLabelColorA = xform2 c_th3f_setlabelcolora
+  setLabelSizeA = xform2 c_th3f_setlabelsizea
+  setLabelFontA = xform2 c_th3f_setlabelfonta
+  setLabelOffsetA = xform2 c_th3f_setlabeloffseta
+  setMaximum = xform1 c_th3f_setmaximum
+  setMinimum = xform1 c_th3f_setminimum
+  setNormFactor = xform1 c_th3f_setnormfactor
+  setStats = xform1 c_th3f_setstats
+  setOption = xform1 c_th3f_setoption
+  setXTitle = xform1 c_th3f_setxtitle
+  setYTitle = xform1 c_th3f_setytitle
+  setZTitle = xform1 c_th3f_setztitle
+  showBackground = xform2 c_th3f_showbackground
+  showPeaks = xform3 c_th3f_showpeaks
+  smooth = xform2 c_th3f_smooth
+  sumw2 = xform0 c_th3f_sumw2
+instance ITAtt3D TH3F where
+instance ITObject TH3F where
+  draw = xform1 c_th3f_draw
+  findObject = xform1 c_th3f_findobject
+  getName = xform0 c_th3f_getname
+  isA = xform0 c_th3f_isa
+  paint = xform1 c_th3f_paint
+  printObj = xform1 c_th3f_printobj
+  saveAs = xform2 c_th3f_saveas
+  write = xform3 c_th3f_write
+instance ITAttLine TH3F where
+  getLineColor = xform0 c_th3f_getlinecolor
+  getLineStyle = xform0 c_th3f_getlinestyle
+  getLineWidth = xform0 c_th3f_getlinewidth
+  resetAttLine = xform1 c_th3f_resetattline
+  setLineAttributes = xform0 c_th3f_setlineattributes
+  setLineColor = xform1 c_th3f_setlinecolor
+  setLineStyle = xform1 c_th3f_setlinestyle
+  setLineWidth = xform1 c_th3f_setlinewidth
+instance ITAttFill TH3F where
+  setFillColor = xform1 c_th3f_setfillcolor
+  setFillStyle = xform1 c_th3f_setfillstyle
+instance ITAttMarker TH3F where
+  getMarkerColor = xform0 c_th3f_getmarkercolor
+  getMarkerStyle = xform0 c_th3f_getmarkerstyle
+  getMarkerSize = xform0 c_th3f_getmarkersize
+  resetAttMarker = xform1 c_th3f_resetattmarker
+  setMarkerAttributes = xform0 c_th3f_setmarkerattributes
+  setMarkerColor = xform1 c_th3f_setmarkercolor
+  setMarkerStyle = xform1 c_th3f_setmarkerstyle
+  setMarkerSize = xform1 c_th3f_setmarkersize
+instance IDeletable TH3F where
+  delete = xform0 c_th3f_delete
+instance ITArray TH3F where
+
+instance ITH3F (Exist TH3F) where
+
+instance ITH3 (Exist TH3F) where
+  fill3 (ETH3F x) = fill3 x
+  fill3w (ETH3F x) = fill3w x
+  fitSlicesZ (ETH3F x) = fitSlicesZ x
+  getCorrelationFactor3 (ETH3F x) = getCorrelationFactor3 x
+  getCovariance3 (ETH3F x) = getCovariance3 x
+  rebinX3 (ETH3F x) = rebinX3 x
+  rebinY3 (ETH3F x) = rebinY3 x
+  rebinZ3 (ETH3F x) = rebinZ3 x
+  rebin3D (ETH3F x) = rebin3D x
+instance ITArrayF (Exist TH3F) where
+
+instance ITH1 (Exist TH3F) where
+  add (ETH3F x) = add x
+  addBinContent (ETH3F x) = addBinContent x
+  chi2Test (ETH3F x) = chi2Test x
+  computeIntegral (ETH3F x) = computeIntegral x
+  directoryAutoAdd (ETH3F x) = directoryAutoAdd x
+  divide (ETH3F x) = divide x
+  drawCopyTH1 (ETH3F x) a1 = return . ETH3F =<< drawCopyTH1 x a1
+  drawNormalized (ETH3F x) = drawNormalized x
+  drawPanelTH1 (ETH3F x) = drawPanelTH1 x
+  bufferEmpty (ETH3F x) = bufferEmpty x
+  evalF (ETH3F x) = evalF x
+  fFT (ETH3F x) = fFT x
+  fill1 (ETH3F x) = fill1 x
+  fill1w (ETH3F x) = fill1w x
+  fillN1 (ETH3F x) = fillN1 x
+  fillRandom (ETH3F x) = fillRandom x
+  findBin (ETH3F x) = findBin x
+  findFixBin (ETH3F x) = findFixBin x
+  findFirstBinAbove (ETH3F x) = findFirstBinAbove x
+  findLastBinAbove (ETH3F x) = findLastBinAbove x
+  fitPanelTH1 (ETH3F x) = fitPanelTH1 x
+  getNdivisionA (ETH3F x) = getNdivisionA x
+  getAxisColorA (ETH3F x) = getAxisColorA x
+  getLabelColorA (ETH3F x) = getLabelColorA x
+  getLabelFontA (ETH3F x) = getLabelFontA x
+  getLabelOffsetA (ETH3F x) = getLabelOffsetA x
+  getLabelSizeA (ETH3F x) = getLabelSizeA x
+  getTitleFontA (ETH3F x) = getTitleFontA x
+  getTitleOffsetA (ETH3F x) = getTitleOffsetA x
+  getTitleSizeA (ETH3F x) = getTitleSizeA x
+  getTickLengthA (ETH3F x) = getTickLengthA x
+  getBarOffset (ETH3F x) = getBarOffset x
+  getBarWidth (ETH3F x) = getBarWidth x
+  getContour (ETH3F x) = getContour x
+  getContourLevel (ETH3F x) = getContourLevel x
+  getContourLevelPad (ETH3F x) = getContourLevelPad x
+  getBin (ETH3F x) = getBin x
+  getBinCenter (ETH3F x) = getBinCenter x
+  getBinContent1 (ETH3F x) = getBinContent1 x
+  getBinContent2 (ETH3F x) = getBinContent2 x
+  getBinContent3 (ETH3F x) = getBinContent3 x
+  getBinError1 (ETH3F x) = getBinError1 x
+  getBinError2 (ETH3F x) = getBinError2 x
+  getBinError3 (ETH3F x) = getBinError3 x
+  getBinLowEdge (ETH3F x) = getBinLowEdge x
+  getBinWidth (ETH3F x) = getBinWidth x
+  getCellContent (ETH3F x) = getCellContent x
+  getCellError (ETH3F x) = getCellError x
+  getEntries (ETH3F x) = getEntries x
+  getEffectiveEntries (ETH3F x) = getEffectiveEntries x
+  getFunction (ETH3F x) = getFunction x
+  getDimension (ETH3F x) = getDimension x
+  getKurtosis (ETH3F x) = getKurtosis x
+  getLowEdge (ETH3F x) = getLowEdge x
+  getMaximumTH1 (ETH3F x) = getMaximumTH1 x
+  getMaximumBin (ETH3F x) = getMaximumBin x
+  getMaximumStored (ETH3F x) = getMaximumStored x
+  getMinimumTH1 (ETH3F x) = getMinimumTH1 x
+  getMinimumBin (ETH3F x) = getMinimumBin x
+  getMinimumStored (ETH3F x) = getMinimumStored x
+  getMean (ETH3F x) = getMean x
+  getMeanError (ETH3F x) = getMeanError x
+  getNbinsX (ETH3F x) = getNbinsX x
+  getNbinsY (ETH3F x) = getNbinsY x
+  getNbinsZ (ETH3F x) = getNbinsZ x
+  getQuantilesTH1 (ETH3F x) = getQuantilesTH1 x
+  getRandom (ETH3F x) = getRandom x
+  getStats (ETH3F x) = getStats x
+  getSumOfWeights (ETH3F x) = getSumOfWeights x
+  getSumw2 (ETH3F x) = getSumw2 x
+  getSumw2N (ETH3F x) = getSumw2N x
+  getRMS (ETH3F x) = getRMS x
+  getRMSError (ETH3F x) = getRMSError x
+  getSkewness (ETH3F x) = getSkewness x
+  integral1 (ETH3F x) = integral1 x
+  interpolate1 (ETH3F x) = interpolate1 x
+  interpolate2 (ETH3F x) = interpolate2 x
+  interpolate3 (ETH3F x) = interpolate3 x
+  kolmogorovTest (ETH3F x) = kolmogorovTest x
+  labelsDeflate (ETH3F x) = labelsDeflate x
+  labelsInflate (ETH3F x) = labelsInflate x
+  labelsOption (ETH3F x) = labelsOption x
+  multiflyF (ETH3F x) = multiflyF x
+  multiply (ETH3F x) = multiply x
+  putStats (ETH3F x) = putStats x
+  rebin (ETH3F x) = rebin x
+  rebinAxis (ETH3F x) = rebinAxis x
+  rebuild (ETH3F x) = rebuild x
+  recursiveRemove (ETH3F x) = recursiveRemove x
+  reset (ETH3F x) = reset x
+  resetStats (ETH3F x) = resetStats x
+  scale (ETH3F x) = scale x
+  setAxisColorA (ETH3F x) = setAxisColorA x
+  setAxisRange (ETH3F x) = setAxisRange x
+  setBarOffset (ETH3F x) = setBarOffset x
+  setBarWidth (ETH3F x) = setBarWidth x
+  setBinContent1 (ETH3F x) = setBinContent1 x
+  setBinContent2 (ETH3F x) = setBinContent2 x
+  setBinContent3 (ETH3F x) = setBinContent3 x
+  setBinError1 (ETH3F x) = setBinError1 x
+  setBinError2 (ETH3F x) = setBinError2 x
+  setBinError3 (ETH3F x) = setBinError3 x
+  setBins1 (ETH3F x) = setBins1 x
+  setBins2 (ETH3F x) = setBins2 x
+  setBins3 (ETH3F x) = setBins3 x
+  setBinsLength (ETH3F x) = setBinsLength x
+  setBuffer (ETH3F x) = setBuffer x
+  setCellContent (ETH3F x) = setCellContent x
+  setContent (ETH3F x) = setContent x
+  setContour (ETH3F x) = setContour x
+  setContourLevel (ETH3F x) = setContourLevel x
+  setDirectory (ETH3F x) = setDirectory x
+  setEntries (ETH3F x) = setEntries x
+  setError (ETH3F x) = setError x
+  setLabelColorA (ETH3F x) = setLabelColorA x
+  setLabelSizeA (ETH3F x) = setLabelSizeA x
+  setLabelFontA (ETH3F x) = setLabelFontA x
+  setLabelOffsetA (ETH3F x) = setLabelOffsetA x
+  setMaximum (ETH3F x) = setMaximum x
+  setMinimum (ETH3F x) = setMinimum x
+  setNormFactor (ETH3F x) = setNormFactor x
+  setStats (ETH3F x) = setStats x
+  setOption (ETH3F x) = setOption x
+  setXTitle (ETH3F x) = setXTitle x
+  setYTitle (ETH3F x) = setYTitle x
+  setZTitle (ETH3F x) = setZTitle x
+  showBackground (ETH3F x) = showBackground x
+  showPeaks (ETH3F x) = showPeaks x
+  smooth (ETH3F x) = smooth x
+  sumw2 (ETH3F x) = sumw2 x
+instance ITAtt3D (Exist TH3F) where
+
+instance ITObject (Exist TH3F) where
+  draw (ETH3F x) = draw x
+  findObject (ETH3F x) = findObject x
+  getName (ETH3F x) = getName x
+  isA (ETH3F x) = isA x
+  paint (ETH3F x) = paint x
+  printObj (ETH3F x) = printObj x
+  saveAs (ETH3F x) = saveAs x
+  write (ETH3F x) = write x
+instance ITAttLine (Exist TH3F) where
+  getLineColor (ETH3F x) = getLineColor x
+  getLineStyle (ETH3F x) = getLineStyle x
+  getLineWidth (ETH3F x) = getLineWidth x
+  resetAttLine (ETH3F x) = resetAttLine x
+  setLineAttributes (ETH3F x) = setLineAttributes x
+  setLineColor (ETH3F x) = setLineColor x
+  setLineStyle (ETH3F x) = setLineStyle x
+  setLineWidth (ETH3F x) = setLineWidth x
+instance ITAttFill (Exist TH3F) where
+  setFillColor (ETH3F x) = setFillColor x
+  setFillStyle (ETH3F x) = setFillStyle x
+instance ITAttMarker (Exist TH3F) where
+  getMarkerColor (ETH3F x) = getMarkerColor x
+  getMarkerStyle (ETH3F x) = getMarkerStyle x
+  getMarkerSize (ETH3F x) = getMarkerSize x
+  resetAttMarker (ETH3F x) = resetAttMarker x
+  setMarkerAttributes (ETH3F x) = setMarkerAttributes x
+  setMarkerColor (ETH3F x) = setMarkerColor x
+  setMarkerStyle (ETH3F x) = setMarkerStyle x
+  setMarkerSize (ETH3F x) = setMarkerSize x
+instance IDeletable (Exist TH3F) where
+  delete (ETH3F x) = delete x
+instance ITArray (Exist TH3F) where
+
+
+
+
+
+
+
+
+instance FPtr (Exist TH3F) where
+  type Raw (Exist TH3F) = RawTH3F
+  get_fptr (ETH3F obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH3F (cast_fptr_to_obj (fptr :: ForeignPtr RawTH3F) :: TH3F)
diff --git a/src/HROOT/Hist/TH3F/Interface.hs b/src/HROOT/Hist/TH3F/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3F/Interface.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH3F.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH3F.RawType
+
+import HROOT.Hist.TH3.Interface
+import HROOT.Core.TArrayF.Interface
+---- ============ ----
+
+
+
+class (ITH3 a,ITArrayF a) => ITH3F a where
+
+instance Existable TH3F where
+  data Exist TH3F = forall a. (FPtr a, ITH3F a) => ETH3F a
+
+upcastTH3F :: (FPtr a, ITH3F a) => a -> TH3F
+upcastTH3F h = let fh = get_fptr h
+                   fh2 :: ForeignPtr RawTH3F = castForeignPtr fh
+               in cast_fptr_to_obj fh2
+
+downcastTH3F :: (FPtr a, ITH3F a) => TH3F -> a 
+downcastTH3F h = let fh = get_fptr h
+                     fh2 = castForeignPtr fh
+                 in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH3F/RawType.hs b/src/HROOT/Hist/TH3F/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3F/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH3F.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH3F
+newtype TH3F = TH3F (ForeignPtr RawTH3F) deriving (Eq, Ord, Show)
+instance FPtr TH3F where
+   type Raw TH3F = RawTH3F
+   get_fptr (TH3F fptr) = fptr
+   cast_fptr_to_obj = TH3F
diff --git a/src/HROOT/Hist/TH3I.hs b/src/HROOT/Hist/TH3I.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3I.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TH3I
+  (
+    TH3I(..)
+  , ITH3I
+  , upcastTH3I
+  , downcastTH3I
+
+ 
+  ) where
+
+import HROOT.Hist.TH3I.RawType
+import HROOT.Hist.TH3I.Interface
+import HROOT.Hist.TH3I.Implementation
+
+
diff --git a/src/HROOT/Hist/TH3I/Cast.hs b/src/HROOT/Hist/TH3I/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3I/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH3I.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH3I.RawType
+import HROOT.Hist.TH3I.Interface
+
+instance (ITH3I a, FPtr a) => Castable a (Ptr RawTH3I) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH3I (Ptr RawTH3I) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH3I/FFI.hsc b/src/HROOT/Hist/TH3I/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3I/FFI.hsc
@@ -0,0 +1,525 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH3I.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH3I.RawType
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH3.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTH3I.h"
+
+foreign import ccall "HROOTHistTH3I.h TH3I_fill3" c_th3i_fill3 
+  :: (Ptr RawTH3I) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_fill3w" c_th3i_fill3w 
+  :: (Ptr RawTH3I) -> CDouble -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_FitSlicesZ" c_th3i_fitslicesz 
+  :: (Ptr RawTH3I) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CInt -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_getCorrelationFactor3" c_th3i_getcorrelationfactor3 
+  :: (Ptr RawTH3I) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_getCovariance3" c_th3i_getcovariance3 
+  :: (Ptr RawTH3I) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_rebinX3" c_th3i_rebinx3 
+  :: (Ptr RawTH3I) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3I.h TH3I_rebinY3" c_th3i_rebiny3 
+  :: (Ptr RawTH3I) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3I.h TH3I_rebinZ3" c_th3i_rebinz3 
+  :: (Ptr RawTH3I) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3I.h TH3I_Rebin3D" c_th3i_rebin3d 
+  :: (Ptr RawTH3I) -> CInt -> CInt -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3I.h TH3I_Add" c_th3i_add 
+  :: (Ptr RawTH3I) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_AddBinContent" c_th3i_addbincontent 
+  :: (Ptr RawTH3I) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_Chi2Test" c_th3i_chi2test 
+  :: (Ptr RawTH3I) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_ComputeIntegral" c_th3i_computeintegral 
+  :: (Ptr RawTH3I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_DirectoryAutoAdd" c_th3i_directoryautoadd 
+  :: (Ptr RawTH3I) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_Divide" c_th3i_divide 
+  :: (Ptr RawTH3I) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_drawCopyTH1" c_th3i_drawcopyth1 
+  :: (Ptr RawTH3I) -> CString -> IO (Ptr RawTH3I)
+
+foreign import ccall "HROOTHistTH3I.h TH3I_DrawNormalized" c_th3i_drawnormalized 
+  :: (Ptr RawTH3I) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3I.h TH3I_drawPanelTH1" c_th3i_drawpanelth1 
+  :: (Ptr RawTH3I) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_BufferEmpty" c_th3i_bufferempty 
+  :: (Ptr RawTH3I) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_evalF" c_th3i_evalf 
+  :: (Ptr RawTH3I) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_FFT" c_th3i_fft 
+  :: (Ptr RawTH3I) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3I.h TH3I_fill1" c_th3i_fill1 
+  :: (Ptr RawTH3I) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_fill1w" c_th3i_fill1w 
+  :: (Ptr RawTH3I) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_fillN1" c_th3i_filln1 
+  :: (Ptr RawTH3I) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_FillRandom" c_th3i_fillrandom 
+  :: (Ptr RawTH3I) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_FindBin" c_th3i_findbin 
+  :: (Ptr RawTH3I) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_FindFixBin" c_th3i_findfixbin 
+  :: (Ptr RawTH3I) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_FindFirstBinAbove" c_th3i_findfirstbinabove 
+  :: (Ptr RawTH3I) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_FindLastBinAbove" c_th3i_findlastbinabove 
+  :: (Ptr RawTH3I) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_FitPanelTH1" c_th3i_fitpanelth1 
+  :: (Ptr RawTH3I) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_getNdivisionA" c_th3i_getndivisiona 
+  :: (Ptr RawTH3I) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_getAxisColorA" c_th3i_getaxiscolora 
+  :: (Ptr RawTH3I) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_getLabelColorA" c_th3i_getlabelcolora 
+  :: (Ptr RawTH3I) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_getLabelFontA" c_th3i_getlabelfonta 
+  :: (Ptr RawTH3I) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_getLabelOffsetA" c_th3i_getlabeloffseta 
+  :: (Ptr RawTH3I) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_getLabelSizeA" c_th3i_getlabelsizea 
+  :: (Ptr RawTH3I) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_getTitleFontA" c_th3i_gettitlefonta 
+  :: (Ptr RawTH3I) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_getTitleOffsetA" c_th3i_gettitleoffseta 
+  :: (Ptr RawTH3I) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_getTitleSizeA" c_th3i_gettitlesizea 
+  :: (Ptr RawTH3I) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_getTickLengthA" c_th3i_getticklengtha 
+  :: (Ptr RawTH3I) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetBarOffset" c_th3i_getbaroffset 
+  :: (Ptr RawTH3I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetBarWidth" c_th3i_getbarwidth 
+  :: (Ptr RawTH3I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetContour" c_th3i_getcontour 
+  :: (Ptr RawTH3I) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetContourLevel" c_th3i_getcontourlevel 
+  :: (Ptr RawTH3I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetContourLevelPad" c_th3i_getcontourlevelpad 
+  :: (Ptr RawTH3I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetBin" c_th3i_getbin 
+  :: (Ptr RawTH3I) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetBinCenter" c_th3i_getbincenter 
+  :: (Ptr RawTH3I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetBinContent1" c_th3i_getbincontent1 
+  :: (Ptr RawTH3I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetBinContent2" c_th3i_getbincontent2 
+  :: (Ptr RawTH3I) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetBinContent3" c_th3i_getbincontent3 
+  :: (Ptr RawTH3I) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetBinError1" c_th3i_getbinerror1 
+  :: (Ptr RawTH3I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetBinError2" c_th3i_getbinerror2 
+  :: (Ptr RawTH3I) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetBinError3" c_th3i_getbinerror3 
+  :: (Ptr RawTH3I) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetBinLowEdge" c_th3i_getbinlowedge 
+  :: (Ptr RawTH3I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetBinWidth" c_th3i_getbinwidth 
+  :: (Ptr RawTH3I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetCellContent" c_th3i_getcellcontent 
+  :: (Ptr RawTH3I) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetCellError" c_th3i_getcellerror 
+  :: (Ptr RawTH3I) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetEntries" c_th3i_getentries 
+  :: (Ptr RawTH3I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetEffectiveEntries" c_th3i_geteffectiveentries 
+  :: (Ptr RawTH3I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetFunction" c_th3i_getfunction 
+  :: (Ptr RawTH3I) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetDimension" c_th3i_getdimension 
+  :: (Ptr RawTH3I) -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetKurtosis" c_th3i_getkurtosis 
+  :: (Ptr RawTH3I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetLowEdge" c_th3i_getlowedge 
+  :: (Ptr RawTH3I) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_getMaximumTH1" c_th3i_getmaximumth1 
+  :: (Ptr RawTH3I) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetMaximumBin" c_th3i_getmaximumbin 
+  :: (Ptr RawTH3I) -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetMaximumStored" c_th3i_getmaximumstored 
+  :: (Ptr RawTH3I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_getMinimumTH1" c_th3i_getminimumth1 
+  :: (Ptr RawTH3I) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetMinimumBin" c_th3i_getminimumbin 
+  :: (Ptr RawTH3I) -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetMinimumStored" c_th3i_getminimumstored 
+  :: (Ptr RawTH3I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetMean" c_th3i_getmean 
+  :: (Ptr RawTH3I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetMeanError" c_th3i_getmeanerror 
+  :: (Ptr RawTH3I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetNbinsX" c_th3i_getnbinsx 
+  :: (Ptr RawTH3I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetNbinsY" c_th3i_getnbinsy 
+  :: (Ptr RawTH3I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetNbinsZ" c_th3i_getnbinsz 
+  :: (Ptr RawTH3I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_getQuantilesTH1" c_th3i_getquantilesth1 
+  :: (Ptr RawTH3I) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetRandom" c_th3i_getrandom 
+  :: (Ptr RawTH3I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetStats" c_th3i_getstats 
+  :: (Ptr RawTH3I) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetSumOfWeights" c_th3i_getsumofweights 
+  :: (Ptr RawTH3I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetSumw2" c_th3i_getsumw2 
+  :: (Ptr RawTH3I) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetSumw2N" c_th3i_getsumw2n 
+  :: (Ptr RawTH3I) -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetRMS" c_th3i_getrms 
+  :: (Ptr RawTH3I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetRMSError" c_th3i_getrmserror 
+  :: (Ptr RawTH3I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetSkewness" c_th3i_getskewness 
+  :: (Ptr RawTH3I) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_integral1" c_th3i_integral1 
+  :: (Ptr RawTH3I) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_interpolate1" c_th3i_interpolate1 
+  :: (Ptr RawTH3I) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_interpolate2" c_th3i_interpolate2 
+  :: (Ptr RawTH3I) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_interpolate3" c_th3i_interpolate3 
+  :: (Ptr RawTH3I) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_KolmogorovTest" c_th3i_kolmogorovtest 
+  :: (Ptr RawTH3I) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_LabelsDeflate" c_th3i_labelsdeflate 
+  :: (Ptr RawTH3I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_LabelsInflate" c_th3i_labelsinflate 
+  :: (Ptr RawTH3I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_LabelsOption" c_th3i_labelsoption 
+  :: (Ptr RawTH3I) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_multiflyF" c_th3i_multiflyf 
+  :: (Ptr RawTH3I) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_Multiply" c_th3i_multiply 
+  :: (Ptr RawTH3I) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_PutStats" c_th3i_putstats 
+  :: (Ptr RawTH3I) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_Rebin" c_th3i_rebin 
+  :: (Ptr RawTH3I) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3I.h TH3I_RebinAxis" c_th3i_rebinaxis 
+  :: (Ptr RawTH3I) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_Rebuild" c_th3i_rebuild 
+  :: (Ptr RawTH3I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_RecursiveRemove" c_th3i_recursiveremove 
+  :: (Ptr RawTH3I) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_Reset" c_th3i_reset 
+  :: (Ptr RawTH3I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_ResetStats" c_th3i_resetstats 
+  :: (Ptr RawTH3I) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_Scale" c_th3i_scale 
+  :: (Ptr RawTH3I) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_setAxisColorA" c_th3i_setaxiscolora 
+  :: (Ptr RawTH3I) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetAxisRange" c_th3i_setaxisrange 
+  :: (Ptr RawTH3I) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetBarOffset" c_th3i_setbaroffset 
+  :: (Ptr RawTH3I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetBarWidth" c_th3i_setbarwidth 
+  :: (Ptr RawTH3I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_setBinContent1" c_th3i_setbincontent1 
+  :: (Ptr RawTH3I) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_setBinContent2" c_th3i_setbincontent2 
+  :: (Ptr RawTH3I) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_setBinContent3" c_th3i_setbincontent3 
+  :: (Ptr RawTH3I) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_setBinError1" c_th3i_setbinerror1 
+  :: (Ptr RawTH3I) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_setBinError2" c_th3i_setbinerror2 
+  :: (Ptr RawTH3I) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_setBinError3" c_th3i_setbinerror3 
+  :: (Ptr RawTH3I) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_setBins1" c_th3i_setbins1 
+  :: (Ptr RawTH3I) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_setBins2" c_th3i_setbins2 
+  :: (Ptr RawTH3I) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_setBins3" c_th3i_setbins3 
+  :: (Ptr RawTH3I) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetBinsLength" c_th3i_setbinslength 
+  :: (Ptr RawTH3I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetBuffer" c_th3i_setbuffer 
+  :: (Ptr RawTH3I) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetCellContent" c_th3i_setcellcontent 
+  :: (Ptr RawTH3I) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetContent" c_th3i_setcontent 
+  :: (Ptr RawTH3I) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetContour" c_th3i_setcontour 
+  :: (Ptr RawTH3I) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetContourLevel" c_th3i_setcontourlevel 
+  :: (Ptr RawTH3I) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetDirectory" c_th3i_setdirectory 
+  :: (Ptr RawTH3I) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetEntries" c_th3i_setentries 
+  :: (Ptr RawTH3I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetError" c_th3i_seterror 
+  :: (Ptr RawTH3I) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_setLabelColorA" c_th3i_setlabelcolora 
+  :: (Ptr RawTH3I) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_setLabelSizeA" c_th3i_setlabelsizea 
+  :: (Ptr RawTH3I) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_setLabelFontA" c_th3i_setlabelfonta 
+  :: (Ptr RawTH3I) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_setLabelOffsetA" c_th3i_setlabeloffseta 
+  :: (Ptr RawTH3I) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetMaximum" c_th3i_setmaximum 
+  :: (Ptr RawTH3I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetMinimum" c_th3i_setminimum 
+  :: (Ptr RawTH3I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetNormFactor" c_th3i_setnormfactor 
+  :: (Ptr RawTH3I) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetStats" c_th3i_setstats 
+  :: (Ptr RawTH3I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetOption" c_th3i_setoption 
+  :: (Ptr RawTH3I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetXTitle" c_th3i_setxtitle 
+  :: (Ptr RawTH3I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetYTitle" c_th3i_setytitle 
+  :: (Ptr RawTH3I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetZTitle" c_th3i_setztitle 
+  :: (Ptr RawTH3I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_ShowBackground" c_th3i_showbackground 
+  :: (Ptr RawTH3I) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3I.h TH3I_ShowPeaks" c_th3i_showpeaks 
+  :: (Ptr RawTH3I) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_Smooth" c_th3i_smooth 
+  :: (Ptr RawTH3I) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_Sumw2" c_th3i_sumw2 
+  :: (Ptr RawTH3I) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_Draw" c_th3i_draw 
+  :: (Ptr RawTH3I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_FindObject" c_th3i_findobject 
+  :: (Ptr RawTH3I) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetName" c_th3i_getname 
+  :: (Ptr RawTH3I) -> IO CString
+
+foreign import ccall "HROOTHistTH3I.h TH3I_IsA" c_th3i_isa 
+  :: (Ptr RawTH3I) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH3I.h TH3I_Paint" c_th3i_paint 
+  :: (Ptr RawTH3I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_printObj" c_th3i_printobj 
+  :: (Ptr RawTH3I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SaveAs" c_th3i_saveas 
+  :: (Ptr RawTH3I) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_Write" c_th3i_write 
+  :: (Ptr RawTH3I) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetLineColor" c_th3i_getlinecolor 
+  :: (Ptr RawTH3I) -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetLineStyle" c_th3i_getlinestyle 
+  :: (Ptr RawTH3I) -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetLineWidth" c_th3i_getlinewidth 
+  :: (Ptr RawTH3I) -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_ResetAttLine" c_th3i_resetattline 
+  :: (Ptr RawTH3I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetLineAttributes" c_th3i_setlineattributes 
+  :: (Ptr RawTH3I) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetLineColor" c_th3i_setlinecolor 
+  :: (Ptr RawTH3I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetLineStyle" c_th3i_setlinestyle 
+  :: (Ptr RawTH3I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetLineWidth" c_th3i_setlinewidth 
+  :: (Ptr RawTH3I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetFillColor" c_th3i_setfillcolor 
+  :: (Ptr RawTH3I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetFillStyle" c_th3i_setfillstyle 
+  :: (Ptr RawTH3I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetMarkerColor" c_th3i_getmarkercolor 
+  :: (Ptr RawTH3I) -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetMarkerStyle" c_th3i_getmarkerstyle 
+  :: (Ptr RawTH3I) -> IO CInt
+
+foreign import ccall "HROOTHistTH3I.h TH3I_GetMarkerSize" c_th3i_getmarkersize 
+  :: (Ptr RawTH3I) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3I.h TH3I_ResetAttMarker" c_th3i_resetattmarker 
+  :: (Ptr RawTH3I) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetMarkerAttributes" c_th3i_setmarkerattributes 
+  :: (Ptr RawTH3I) -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetMarkerColor" c_th3i_setmarkercolor 
+  :: (Ptr RawTH3I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetMarkerStyle" c_th3i_setmarkerstyle 
+  :: (Ptr RawTH3I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_SetMarkerSize" c_th3i_setmarkersize 
+  :: (Ptr RawTH3I) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3I.h TH3I_delete" c_th3i_delete 
+  :: (Ptr RawTH3I) -> IO ()
+
diff --git a/src/HROOT/Hist/TH3I/Implementation.hs b/src/HROOT/Hist/TH3I/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3I/Implementation.hs
@@ -0,0 +1,440 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH3I.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH3I.RawType
+import HROOT.Hist.TH3I.FFI
+import HROOT.Hist.TH3I.Interface
+import HROOT.Hist.TH3I.Cast
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1D.Cast
+import HROOT.Hist.TH1D.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH3.RawType
+import HROOT.Hist.TH3.Cast
+import HROOT.Hist.TH3.Interface
+import HROOT.Core.TArrayI.RawType
+import HROOT.Core.TArrayI.Cast
+import HROOT.Core.TArrayI.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TAtt3D.RawType
+import HROOT.Core.TAtt3D.Cast
+import HROOT.Core.TAtt3D.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+import HROOT.Core.TArray.RawType
+import HROOT.Core.TArray.Cast
+import HROOT.Core.TArray.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH3I TH3I where
+instance ITH3 TH3I where
+  fill3 = xform3 c_th3i_fill3
+  fill3w = xform4 c_th3i_fill3w
+  fitSlicesZ = xform7 c_th3i_fitslicesz
+  getCorrelationFactor3 = xform2 c_th3i_getcorrelationfactor3
+  getCovariance3 = xform2 c_th3i_getcovariance3
+  rebinX3 = xform2 c_th3i_rebinx3
+  rebinY3 = xform2 c_th3i_rebiny3
+  rebinZ3 = xform2 c_th3i_rebinz3
+  rebin3D = xform4 c_th3i_rebin3d
+instance ITArrayI TH3I where
+instance ITH1 TH3I where
+  add = xform2 c_th3i_add
+  addBinContent = xform2 c_th3i_addbincontent
+  chi2Test = xform3 c_th3i_chi2test
+  computeIntegral = xform0 c_th3i_computeintegral
+  directoryAutoAdd = xform1 c_th3i_directoryautoadd
+  divide = xform5 c_th3i_divide
+  drawCopyTH1 = xform1 c_th3i_drawcopyth1
+  drawNormalized = xform2 c_th3i_drawnormalized
+  drawPanelTH1 = xform0 c_th3i_drawpanelth1
+  bufferEmpty = xform1 c_th3i_bufferempty
+  evalF = xform2 c_th3i_evalf
+  fFT = xform2 c_th3i_fft
+  fill1 = xform1 c_th3i_fill1
+  fill1w = xform2 c_th3i_fill1w
+  fillN1 = xform4 c_th3i_filln1
+  fillRandom = xform2 c_th3i_fillrandom
+  findBin = xform3 c_th3i_findbin
+  findFixBin = xform3 c_th3i_findfixbin
+  findFirstBinAbove = xform2 c_th3i_findfirstbinabove
+  findLastBinAbove = xform2 c_th3i_findlastbinabove
+  fitPanelTH1 = xform0 c_th3i_fitpanelth1
+  getNdivisionA = xform1 c_th3i_getndivisiona
+  getAxisColorA = xform1 c_th3i_getaxiscolora
+  getLabelColorA = xform1 c_th3i_getlabelcolora
+  getLabelFontA = xform1 c_th3i_getlabelfonta
+  getLabelOffsetA = xform1 c_th3i_getlabeloffseta
+  getLabelSizeA = xform1 c_th3i_getlabelsizea
+  getTitleFontA = xform1 c_th3i_gettitlefonta
+  getTitleOffsetA = xform1 c_th3i_gettitleoffseta
+  getTitleSizeA = xform1 c_th3i_gettitlesizea
+  getTickLengthA = xform1 c_th3i_getticklengtha
+  getBarOffset = xform0 c_th3i_getbaroffset
+  getBarWidth = xform0 c_th3i_getbarwidth
+  getContour = xform1 c_th3i_getcontour
+  getContourLevel = xform1 c_th3i_getcontourlevel
+  getContourLevelPad = xform1 c_th3i_getcontourlevelpad
+  getBin = xform3 c_th3i_getbin
+  getBinCenter = xform1 c_th3i_getbincenter
+  getBinContent1 = xform1 c_th3i_getbincontent1
+  getBinContent2 = xform2 c_th3i_getbincontent2
+  getBinContent3 = xform3 c_th3i_getbincontent3
+  getBinError1 = xform1 c_th3i_getbinerror1
+  getBinError2 = xform2 c_th3i_getbinerror2
+  getBinError3 = xform3 c_th3i_getbinerror3
+  getBinLowEdge = xform1 c_th3i_getbinlowedge
+  getBinWidth = xform1 c_th3i_getbinwidth
+  getCellContent = xform2 c_th3i_getcellcontent
+  getCellError = xform2 c_th3i_getcellerror
+  getEntries = xform0 c_th3i_getentries
+  getEffectiveEntries = xform0 c_th3i_geteffectiveentries
+  getFunction = xform1 c_th3i_getfunction
+  getDimension = xform0 c_th3i_getdimension
+  getKurtosis = xform1 c_th3i_getkurtosis
+  getLowEdge = xform1 c_th3i_getlowedge
+  getMaximumTH1 = xform1 c_th3i_getmaximumth1
+  getMaximumBin = xform0 c_th3i_getmaximumbin
+  getMaximumStored = xform0 c_th3i_getmaximumstored
+  getMinimumTH1 = xform1 c_th3i_getminimumth1
+  getMinimumBin = xform0 c_th3i_getminimumbin
+  getMinimumStored = xform0 c_th3i_getminimumstored
+  getMean = xform1 c_th3i_getmean
+  getMeanError = xform1 c_th3i_getmeanerror
+  getNbinsX = xform0 c_th3i_getnbinsx
+  getNbinsY = xform0 c_th3i_getnbinsy
+  getNbinsZ = xform0 c_th3i_getnbinsz
+  getQuantilesTH1 = xform3 c_th3i_getquantilesth1
+  getRandom = xform0 c_th3i_getrandom
+  getStats = xform1 c_th3i_getstats
+  getSumOfWeights = xform0 c_th3i_getsumofweights
+  getSumw2 = xform0 c_th3i_getsumw2
+  getSumw2N = xform0 c_th3i_getsumw2n
+  getRMS = xform1 c_th3i_getrms
+  getRMSError = xform1 c_th3i_getrmserror
+  getSkewness = xform1 c_th3i_getskewness
+  integral1 = xform3 c_th3i_integral1
+  interpolate1 = xform1 c_th3i_interpolate1
+  interpolate2 = xform2 c_th3i_interpolate2
+  interpolate3 = xform3 c_th3i_interpolate3
+  kolmogorovTest = xform2 c_th3i_kolmogorovtest
+  labelsDeflate = xform1 c_th3i_labelsdeflate
+  labelsInflate = xform1 c_th3i_labelsinflate
+  labelsOption = xform2 c_th3i_labelsoption
+  multiflyF = xform2 c_th3i_multiflyf
+  multiply = xform5 c_th3i_multiply
+  putStats = xform1 c_th3i_putstats
+  rebin = xform3 c_th3i_rebin
+  rebinAxis = xform2 c_th3i_rebinaxis
+  rebuild = xform1 c_th3i_rebuild
+  recursiveRemove = xform1 c_th3i_recursiveremove
+  reset = xform1 c_th3i_reset
+  resetStats = xform0 c_th3i_resetstats
+  scale = xform2 c_th3i_scale
+  setAxisColorA = xform2 c_th3i_setaxiscolora
+  setAxisRange = xform3 c_th3i_setaxisrange
+  setBarOffset = xform1 c_th3i_setbaroffset
+  setBarWidth = xform1 c_th3i_setbarwidth
+  setBinContent1 = xform2 c_th3i_setbincontent1
+  setBinContent2 = xform3 c_th3i_setbincontent2
+  setBinContent3 = xform4 c_th3i_setbincontent3
+  setBinError1 = xform2 c_th3i_setbinerror1
+  setBinError2 = xform3 c_th3i_setbinerror2
+  setBinError3 = xform4 c_th3i_setbinerror3
+  setBins1 = xform2 c_th3i_setbins1
+  setBins2 = xform4 c_th3i_setbins2
+  setBins3 = xform6 c_th3i_setbins3
+  setBinsLength = xform1 c_th3i_setbinslength
+  setBuffer = xform2 c_th3i_setbuffer
+  setCellContent = xform3 c_th3i_setcellcontent
+  setContent = xform1 c_th3i_setcontent
+  setContour = xform2 c_th3i_setcontour
+  setContourLevel = xform2 c_th3i_setcontourlevel
+  setDirectory = xform1 c_th3i_setdirectory
+  setEntries = xform1 c_th3i_setentries
+  setError = xform1 c_th3i_seterror
+  setLabelColorA = xform2 c_th3i_setlabelcolora
+  setLabelSizeA = xform2 c_th3i_setlabelsizea
+  setLabelFontA = xform2 c_th3i_setlabelfonta
+  setLabelOffsetA = xform2 c_th3i_setlabeloffseta
+  setMaximum = xform1 c_th3i_setmaximum
+  setMinimum = xform1 c_th3i_setminimum
+  setNormFactor = xform1 c_th3i_setnormfactor
+  setStats = xform1 c_th3i_setstats
+  setOption = xform1 c_th3i_setoption
+  setXTitle = xform1 c_th3i_setxtitle
+  setYTitle = xform1 c_th3i_setytitle
+  setZTitle = xform1 c_th3i_setztitle
+  showBackground = xform2 c_th3i_showbackground
+  showPeaks = xform3 c_th3i_showpeaks
+  smooth = xform2 c_th3i_smooth
+  sumw2 = xform0 c_th3i_sumw2
+instance ITAtt3D TH3I where
+instance ITObject TH3I where
+  draw = xform1 c_th3i_draw
+  findObject = xform1 c_th3i_findobject
+  getName = xform0 c_th3i_getname
+  isA = xform0 c_th3i_isa
+  paint = xform1 c_th3i_paint
+  printObj = xform1 c_th3i_printobj
+  saveAs = xform2 c_th3i_saveas
+  write = xform3 c_th3i_write
+instance ITAttLine TH3I where
+  getLineColor = xform0 c_th3i_getlinecolor
+  getLineStyle = xform0 c_th3i_getlinestyle
+  getLineWidth = xform0 c_th3i_getlinewidth
+  resetAttLine = xform1 c_th3i_resetattline
+  setLineAttributes = xform0 c_th3i_setlineattributes
+  setLineColor = xform1 c_th3i_setlinecolor
+  setLineStyle = xform1 c_th3i_setlinestyle
+  setLineWidth = xform1 c_th3i_setlinewidth
+instance ITAttFill TH3I where
+  setFillColor = xform1 c_th3i_setfillcolor
+  setFillStyle = xform1 c_th3i_setfillstyle
+instance ITAttMarker TH3I where
+  getMarkerColor = xform0 c_th3i_getmarkercolor
+  getMarkerStyle = xform0 c_th3i_getmarkerstyle
+  getMarkerSize = xform0 c_th3i_getmarkersize
+  resetAttMarker = xform1 c_th3i_resetattmarker
+  setMarkerAttributes = xform0 c_th3i_setmarkerattributes
+  setMarkerColor = xform1 c_th3i_setmarkercolor
+  setMarkerStyle = xform1 c_th3i_setmarkerstyle
+  setMarkerSize = xform1 c_th3i_setmarkersize
+instance IDeletable TH3I where
+  delete = xform0 c_th3i_delete
+instance ITArray TH3I where
+
+instance ITH3I (Exist TH3I) where
+
+instance ITH3 (Exist TH3I) where
+  fill3 (ETH3I x) = fill3 x
+  fill3w (ETH3I x) = fill3w x
+  fitSlicesZ (ETH3I x) = fitSlicesZ x
+  getCorrelationFactor3 (ETH3I x) = getCorrelationFactor3 x
+  getCovariance3 (ETH3I x) = getCovariance3 x
+  rebinX3 (ETH3I x) = rebinX3 x
+  rebinY3 (ETH3I x) = rebinY3 x
+  rebinZ3 (ETH3I x) = rebinZ3 x
+  rebin3D (ETH3I x) = rebin3D x
+instance ITArrayI (Exist TH3I) where
+
+instance ITH1 (Exist TH3I) where
+  add (ETH3I x) = add x
+  addBinContent (ETH3I x) = addBinContent x
+  chi2Test (ETH3I x) = chi2Test x
+  computeIntegral (ETH3I x) = computeIntegral x
+  directoryAutoAdd (ETH3I x) = directoryAutoAdd x
+  divide (ETH3I x) = divide x
+  drawCopyTH1 (ETH3I x) a1 = return . ETH3I =<< drawCopyTH1 x a1
+  drawNormalized (ETH3I x) = drawNormalized x
+  drawPanelTH1 (ETH3I x) = drawPanelTH1 x
+  bufferEmpty (ETH3I x) = bufferEmpty x
+  evalF (ETH3I x) = evalF x
+  fFT (ETH3I x) = fFT x
+  fill1 (ETH3I x) = fill1 x
+  fill1w (ETH3I x) = fill1w x
+  fillN1 (ETH3I x) = fillN1 x
+  fillRandom (ETH3I x) = fillRandom x
+  findBin (ETH3I x) = findBin x
+  findFixBin (ETH3I x) = findFixBin x
+  findFirstBinAbove (ETH3I x) = findFirstBinAbove x
+  findLastBinAbove (ETH3I x) = findLastBinAbove x
+  fitPanelTH1 (ETH3I x) = fitPanelTH1 x
+  getNdivisionA (ETH3I x) = getNdivisionA x
+  getAxisColorA (ETH3I x) = getAxisColorA x
+  getLabelColorA (ETH3I x) = getLabelColorA x
+  getLabelFontA (ETH3I x) = getLabelFontA x
+  getLabelOffsetA (ETH3I x) = getLabelOffsetA x
+  getLabelSizeA (ETH3I x) = getLabelSizeA x
+  getTitleFontA (ETH3I x) = getTitleFontA x
+  getTitleOffsetA (ETH3I x) = getTitleOffsetA x
+  getTitleSizeA (ETH3I x) = getTitleSizeA x
+  getTickLengthA (ETH3I x) = getTickLengthA x
+  getBarOffset (ETH3I x) = getBarOffset x
+  getBarWidth (ETH3I x) = getBarWidth x
+  getContour (ETH3I x) = getContour x
+  getContourLevel (ETH3I x) = getContourLevel x
+  getContourLevelPad (ETH3I x) = getContourLevelPad x
+  getBin (ETH3I x) = getBin x
+  getBinCenter (ETH3I x) = getBinCenter x
+  getBinContent1 (ETH3I x) = getBinContent1 x
+  getBinContent2 (ETH3I x) = getBinContent2 x
+  getBinContent3 (ETH3I x) = getBinContent3 x
+  getBinError1 (ETH3I x) = getBinError1 x
+  getBinError2 (ETH3I x) = getBinError2 x
+  getBinError3 (ETH3I x) = getBinError3 x
+  getBinLowEdge (ETH3I x) = getBinLowEdge x
+  getBinWidth (ETH3I x) = getBinWidth x
+  getCellContent (ETH3I x) = getCellContent x
+  getCellError (ETH3I x) = getCellError x
+  getEntries (ETH3I x) = getEntries x
+  getEffectiveEntries (ETH3I x) = getEffectiveEntries x
+  getFunction (ETH3I x) = getFunction x
+  getDimension (ETH3I x) = getDimension x
+  getKurtosis (ETH3I x) = getKurtosis x
+  getLowEdge (ETH3I x) = getLowEdge x
+  getMaximumTH1 (ETH3I x) = getMaximumTH1 x
+  getMaximumBin (ETH3I x) = getMaximumBin x
+  getMaximumStored (ETH3I x) = getMaximumStored x
+  getMinimumTH1 (ETH3I x) = getMinimumTH1 x
+  getMinimumBin (ETH3I x) = getMinimumBin x
+  getMinimumStored (ETH3I x) = getMinimumStored x
+  getMean (ETH3I x) = getMean x
+  getMeanError (ETH3I x) = getMeanError x
+  getNbinsX (ETH3I x) = getNbinsX x
+  getNbinsY (ETH3I x) = getNbinsY x
+  getNbinsZ (ETH3I x) = getNbinsZ x
+  getQuantilesTH1 (ETH3I x) = getQuantilesTH1 x
+  getRandom (ETH3I x) = getRandom x
+  getStats (ETH3I x) = getStats x
+  getSumOfWeights (ETH3I x) = getSumOfWeights x
+  getSumw2 (ETH3I x) = getSumw2 x
+  getSumw2N (ETH3I x) = getSumw2N x
+  getRMS (ETH3I x) = getRMS x
+  getRMSError (ETH3I x) = getRMSError x
+  getSkewness (ETH3I x) = getSkewness x
+  integral1 (ETH3I x) = integral1 x
+  interpolate1 (ETH3I x) = interpolate1 x
+  interpolate2 (ETH3I x) = interpolate2 x
+  interpolate3 (ETH3I x) = interpolate3 x
+  kolmogorovTest (ETH3I x) = kolmogorovTest x
+  labelsDeflate (ETH3I x) = labelsDeflate x
+  labelsInflate (ETH3I x) = labelsInflate x
+  labelsOption (ETH3I x) = labelsOption x
+  multiflyF (ETH3I x) = multiflyF x
+  multiply (ETH3I x) = multiply x
+  putStats (ETH3I x) = putStats x
+  rebin (ETH3I x) = rebin x
+  rebinAxis (ETH3I x) = rebinAxis x
+  rebuild (ETH3I x) = rebuild x
+  recursiveRemove (ETH3I x) = recursiveRemove x
+  reset (ETH3I x) = reset x
+  resetStats (ETH3I x) = resetStats x
+  scale (ETH3I x) = scale x
+  setAxisColorA (ETH3I x) = setAxisColorA x
+  setAxisRange (ETH3I x) = setAxisRange x
+  setBarOffset (ETH3I x) = setBarOffset x
+  setBarWidth (ETH3I x) = setBarWidth x
+  setBinContent1 (ETH3I x) = setBinContent1 x
+  setBinContent2 (ETH3I x) = setBinContent2 x
+  setBinContent3 (ETH3I x) = setBinContent3 x
+  setBinError1 (ETH3I x) = setBinError1 x
+  setBinError2 (ETH3I x) = setBinError2 x
+  setBinError3 (ETH3I x) = setBinError3 x
+  setBins1 (ETH3I x) = setBins1 x
+  setBins2 (ETH3I x) = setBins2 x
+  setBins3 (ETH3I x) = setBins3 x
+  setBinsLength (ETH3I x) = setBinsLength x
+  setBuffer (ETH3I x) = setBuffer x
+  setCellContent (ETH3I x) = setCellContent x
+  setContent (ETH3I x) = setContent x
+  setContour (ETH3I x) = setContour x
+  setContourLevel (ETH3I x) = setContourLevel x
+  setDirectory (ETH3I x) = setDirectory x
+  setEntries (ETH3I x) = setEntries x
+  setError (ETH3I x) = setError x
+  setLabelColorA (ETH3I x) = setLabelColorA x
+  setLabelSizeA (ETH3I x) = setLabelSizeA x
+  setLabelFontA (ETH3I x) = setLabelFontA x
+  setLabelOffsetA (ETH3I x) = setLabelOffsetA x
+  setMaximum (ETH3I x) = setMaximum x
+  setMinimum (ETH3I x) = setMinimum x
+  setNormFactor (ETH3I x) = setNormFactor x
+  setStats (ETH3I x) = setStats x
+  setOption (ETH3I x) = setOption x
+  setXTitle (ETH3I x) = setXTitle x
+  setYTitle (ETH3I x) = setYTitle x
+  setZTitle (ETH3I x) = setZTitle x
+  showBackground (ETH3I x) = showBackground x
+  showPeaks (ETH3I x) = showPeaks x
+  smooth (ETH3I x) = smooth x
+  sumw2 (ETH3I x) = sumw2 x
+instance ITAtt3D (Exist TH3I) where
+
+instance ITObject (Exist TH3I) where
+  draw (ETH3I x) = draw x
+  findObject (ETH3I x) = findObject x
+  getName (ETH3I x) = getName x
+  isA (ETH3I x) = isA x
+  paint (ETH3I x) = paint x
+  printObj (ETH3I x) = printObj x
+  saveAs (ETH3I x) = saveAs x
+  write (ETH3I x) = write x
+instance ITAttLine (Exist TH3I) where
+  getLineColor (ETH3I x) = getLineColor x
+  getLineStyle (ETH3I x) = getLineStyle x
+  getLineWidth (ETH3I x) = getLineWidth x
+  resetAttLine (ETH3I x) = resetAttLine x
+  setLineAttributes (ETH3I x) = setLineAttributes x
+  setLineColor (ETH3I x) = setLineColor x
+  setLineStyle (ETH3I x) = setLineStyle x
+  setLineWidth (ETH3I x) = setLineWidth x
+instance ITAttFill (Exist TH3I) where
+  setFillColor (ETH3I x) = setFillColor x
+  setFillStyle (ETH3I x) = setFillStyle x
+instance ITAttMarker (Exist TH3I) where
+  getMarkerColor (ETH3I x) = getMarkerColor x
+  getMarkerStyle (ETH3I x) = getMarkerStyle x
+  getMarkerSize (ETH3I x) = getMarkerSize x
+  resetAttMarker (ETH3I x) = resetAttMarker x
+  setMarkerAttributes (ETH3I x) = setMarkerAttributes x
+  setMarkerColor (ETH3I x) = setMarkerColor x
+  setMarkerStyle (ETH3I x) = setMarkerStyle x
+  setMarkerSize (ETH3I x) = setMarkerSize x
+instance IDeletable (Exist TH3I) where
+  delete (ETH3I x) = delete x
+instance ITArray (Exist TH3I) where
+
+
+
+
+
+
+
+
+instance FPtr (Exist TH3I) where
+  type Raw (Exist TH3I) = RawTH3I
+  get_fptr (ETH3I obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH3I (cast_fptr_to_obj (fptr :: ForeignPtr RawTH3I) :: TH3I)
diff --git a/src/HROOT/Hist/TH3I/Interface.hs b/src/HROOT/Hist/TH3I/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3I/Interface.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH3I.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH3I.RawType
+
+import HROOT.Hist.TH3.Interface
+import HROOT.Core.TArrayI.Interface
+---- ============ ----
+
+
+
+class (ITH3 a,ITArrayI a) => ITH3I a where
+
+instance Existable TH3I where
+  data Exist TH3I = forall a. (FPtr a, ITH3I a) => ETH3I a
+
+upcastTH3I :: (FPtr a, ITH3I a) => a -> TH3I
+upcastTH3I h = let fh = get_fptr h
+                   fh2 :: ForeignPtr RawTH3I = castForeignPtr fh
+               in cast_fptr_to_obj fh2
+
+downcastTH3I :: (FPtr a, ITH3I a) => TH3I -> a 
+downcastTH3I h = let fh = get_fptr h
+                     fh2 = castForeignPtr fh
+                 in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH3I/RawType.hs b/src/HROOT/Hist/TH3I/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3I/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH3I.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH3I
+newtype TH3I = TH3I (ForeignPtr RawTH3I) deriving (Eq, Ord, Show)
+instance FPtr TH3I where
+   type Raw TH3I = RawTH3I
+   get_fptr (TH3I fptr) = fptr
+   cast_fptr_to_obj = TH3I
diff --git a/src/HROOT/Hist/TH3S.hs b/src/HROOT/Hist/TH3S.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3S.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.TH3S
+  (
+    TH3S(..)
+  , ITH3S
+  , upcastTH3S
+  , downcastTH3S
+
+ 
+  ) where
+
+import HROOT.Hist.TH3S.RawType
+import HROOT.Hist.TH3S.Interface
+import HROOT.Hist.TH3S.Implementation
+
+
diff --git a/src/HROOT/Hist/TH3S/Cast.hs b/src/HROOT/Hist/TH3S/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3S/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH3S.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.TH3S.RawType
+import HROOT.Hist.TH3S.Interface
+
+instance (ITH3S a, FPtr a) => Castable a (Ptr RawTH3S) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable TH3S (Ptr RawTH3S) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/TH3S/FFI.hsc b/src/HROOT/Hist/TH3S/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3S/FFI.hsc
@@ -0,0 +1,525 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.TH3S.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.TH3S.RawType
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH3.RawType
+import HROOT.Hist.TF1.RawType
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TArrayD.RawType
+import HROOT.Hist.TAxis.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTH3S.h"
+
+foreign import ccall "HROOTHistTH3S.h TH3S_fill3" c_th3s_fill3 
+  :: (Ptr RawTH3S) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_fill3w" c_th3s_fill3w 
+  :: (Ptr RawTH3S) -> CDouble -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_FitSlicesZ" c_th3s_fitslicesz 
+  :: (Ptr RawTH3S) -> (Ptr RawTF1) -> CInt -> CInt -> CInt -> CInt -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_getCorrelationFactor3" c_th3s_getcorrelationfactor3 
+  :: (Ptr RawTH3S) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_getCovariance3" c_th3s_getcovariance3 
+  :: (Ptr RawTH3S) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_rebinX3" c_th3s_rebinx3 
+  :: (Ptr RawTH3S) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3S.h TH3S_rebinY3" c_th3s_rebiny3 
+  :: (Ptr RawTH3S) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3S.h TH3S_rebinZ3" c_th3s_rebinz3 
+  :: (Ptr RawTH3S) -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3S.h TH3S_Rebin3D" c_th3s_rebin3d 
+  :: (Ptr RawTH3S) -> CInt -> CInt -> CInt -> CString -> IO (Ptr RawTH3)
+
+foreign import ccall "HROOTHistTH3S.h TH3S_Add" c_th3s_add 
+  :: (Ptr RawTH3S) -> (Ptr RawTH1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_AddBinContent" c_th3s_addbincontent 
+  :: (Ptr RawTH3S) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_Chi2Test" c_th3s_chi2test 
+  :: (Ptr RawTH3S) -> (Ptr RawTH1) -> CString -> (Ptr CDouble) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_ComputeIntegral" c_th3s_computeintegral 
+  :: (Ptr RawTH3S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_DirectoryAutoAdd" c_th3s_directoryautoadd 
+  :: (Ptr RawTH3S) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_Divide" c_th3s_divide 
+  :: (Ptr RawTH3S) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_drawCopyTH1" c_th3s_drawcopyth1 
+  :: (Ptr RawTH3S) -> CString -> IO (Ptr RawTH3S)
+
+foreign import ccall "HROOTHistTH3S.h TH3S_DrawNormalized" c_th3s_drawnormalized 
+  :: (Ptr RawTH3S) -> CString -> CDouble -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3S.h TH3S_drawPanelTH1" c_th3s_drawpanelth1 
+  :: (Ptr RawTH3S) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_BufferEmpty" c_th3s_bufferempty 
+  :: (Ptr RawTH3S) -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_evalF" c_th3s_evalf 
+  :: (Ptr RawTH3S) -> (Ptr RawTF1) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_FFT" c_th3s_fft 
+  :: (Ptr RawTH3S) -> (Ptr RawTH1) -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3S.h TH3S_fill1" c_th3s_fill1 
+  :: (Ptr RawTH3S) -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_fill1w" c_th3s_fill1w 
+  :: (Ptr RawTH3S) -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_fillN1" c_th3s_filln1 
+  :: (Ptr RawTH3S) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_FillRandom" c_th3s_fillrandom 
+  :: (Ptr RawTH3S) -> (Ptr RawTH1) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_FindBin" c_th3s_findbin 
+  :: (Ptr RawTH3S) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_FindFixBin" c_th3s_findfixbin 
+  :: (Ptr RawTH3S) -> CDouble -> CDouble -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_FindFirstBinAbove" c_th3s_findfirstbinabove 
+  :: (Ptr RawTH3S) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_FindLastBinAbove" c_th3s_findlastbinabove 
+  :: (Ptr RawTH3S) -> CDouble -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_FitPanelTH1" c_th3s_fitpanelth1 
+  :: (Ptr RawTH3S) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_getNdivisionA" c_th3s_getndivisiona 
+  :: (Ptr RawTH3S) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_getAxisColorA" c_th3s_getaxiscolora 
+  :: (Ptr RawTH3S) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_getLabelColorA" c_th3s_getlabelcolora 
+  :: (Ptr RawTH3S) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_getLabelFontA" c_th3s_getlabelfonta 
+  :: (Ptr RawTH3S) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_getLabelOffsetA" c_th3s_getlabeloffseta 
+  :: (Ptr RawTH3S) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_getLabelSizeA" c_th3s_getlabelsizea 
+  :: (Ptr RawTH3S) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_getTitleFontA" c_th3s_gettitlefonta 
+  :: (Ptr RawTH3S) -> CString -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_getTitleOffsetA" c_th3s_gettitleoffseta 
+  :: (Ptr RawTH3S) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_getTitleSizeA" c_th3s_gettitlesizea 
+  :: (Ptr RawTH3S) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_getTickLengthA" c_th3s_getticklengtha 
+  :: (Ptr RawTH3S) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetBarOffset" c_th3s_getbaroffset 
+  :: (Ptr RawTH3S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetBarWidth" c_th3s_getbarwidth 
+  :: (Ptr RawTH3S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetContour" c_th3s_getcontour 
+  :: (Ptr RawTH3S) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetContourLevel" c_th3s_getcontourlevel 
+  :: (Ptr RawTH3S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetContourLevelPad" c_th3s_getcontourlevelpad 
+  :: (Ptr RawTH3S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetBin" c_th3s_getbin 
+  :: (Ptr RawTH3S) -> CInt -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetBinCenter" c_th3s_getbincenter 
+  :: (Ptr RawTH3S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetBinContent1" c_th3s_getbincontent1 
+  :: (Ptr RawTH3S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetBinContent2" c_th3s_getbincontent2 
+  :: (Ptr RawTH3S) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetBinContent3" c_th3s_getbincontent3 
+  :: (Ptr RawTH3S) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetBinError1" c_th3s_getbinerror1 
+  :: (Ptr RawTH3S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetBinError2" c_th3s_getbinerror2 
+  :: (Ptr RawTH3S) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetBinError3" c_th3s_getbinerror3 
+  :: (Ptr RawTH3S) -> CInt -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetBinLowEdge" c_th3s_getbinlowedge 
+  :: (Ptr RawTH3S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetBinWidth" c_th3s_getbinwidth 
+  :: (Ptr RawTH3S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetCellContent" c_th3s_getcellcontent 
+  :: (Ptr RawTH3S) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetCellError" c_th3s_getcellerror 
+  :: (Ptr RawTH3S) -> CInt -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetEntries" c_th3s_getentries 
+  :: (Ptr RawTH3S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetEffectiveEntries" c_th3s_geteffectiveentries 
+  :: (Ptr RawTH3S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetFunction" c_th3s_getfunction 
+  :: (Ptr RawTH3S) -> CString -> IO (Ptr RawTF1)
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetDimension" c_th3s_getdimension 
+  :: (Ptr RawTH3S) -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetKurtosis" c_th3s_getkurtosis 
+  :: (Ptr RawTH3S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetLowEdge" c_th3s_getlowedge 
+  :: (Ptr RawTH3S) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_getMaximumTH1" c_th3s_getmaximumth1 
+  :: (Ptr RawTH3S) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetMaximumBin" c_th3s_getmaximumbin 
+  :: (Ptr RawTH3S) -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetMaximumStored" c_th3s_getmaximumstored 
+  :: (Ptr RawTH3S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_getMinimumTH1" c_th3s_getminimumth1 
+  :: (Ptr RawTH3S) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetMinimumBin" c_th3s_getminimumbin 
+  :: (Ptr RawTH3S) -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetMinimumStored" c_th3s_getminimumstored 
+  :: (Ptr RawTH3S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetMean" c_th3s_getmean 
+  :: (Ptr RawTH3S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetMeanError" c_th3s_getmeanerror 
+  :: (Ptr RawTH3S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetNbinsX" c_th3s_getnbinsx 
+  :: (Ptr RawTH3S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetNbinsY" c_th3s_getnbinsy 
+  :: (Ptr RawTH3S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetNbinsZ" c_th3s_getnbinsz 
+  :: (Ptr RawTH3S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_getQuantilesTH1" c_th3s_getquantilesth1 
+  :: (Ptr RawTH3S) -> CInt -> (Ptr CDouble) -> (Ptr CDouble) -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetRandom" c_th3s_getrandom 
+  :: (Ptr RawTH3S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetStats" c_th3s_getstats 
+  :: (Ptr RawTH3S) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetSumOfWeights" c_th3s_getsumofweights 
+  :: (Ptr RawTH3S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetSumw2" c_th3s_getsumw2 
+  :: (Ptr RawTH3S) -> IO (Ptr RawTArrayD)
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetSumw2N" c_th3s_getsumw2n 
+  :: (Ptr RawTH3S) -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetRMS" c_th3s_getrms 
+  :: (Ptr RawTH3S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetRMSError" c_th3s_getrmserror 
+  :: (Ptr RawTH3S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetSkewness" c_th3s_getskewness 
+  :: (Ptr RawTH3S) -> CInt -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_integral1" c_th3s_integral1 
+  :: (Ptr RawTH3S) -> CInt -> CInt -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_interpolate1" c_th3s_interpolate1 
+  :: (Ptr RawTH3S) -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_interpolate2" c_th3s_interpolate2 
+  :: (Ptr RawTH3S) -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_interpolate3" c_th3s_interpolate3 
+  :: (Ptr RawTH3S) -> CDouble -> CDouble -> CDouble -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_KolmogorovTest" c_th3s_kolmogorovtest 
+  :: (Ptr RawTH3S) -> (Ptr RawTH1) -> CString -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_LabelsDeflate" c_th3s_labelsdeflate 
+  :: (Ptr RawTH3S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_LabelsInflate" c_th3s_labelsinflate 
+  :: (Ptr RawTH3S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_LabelsOption" c_th3s_labelsoption 
+  :: (Ptr RawTH3S) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_multiflyF" c_th3s_multiflyf 
+  :: (Ptr RawTH3S) -> (Ptr RawTF1) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_Multiply" c_th3s_multiply 
+  :: (Ptr RawTH3S) -> (Ptr RawTH1) -> (Ptr RawTH1) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_PutStats" c_th3s_putstats 
+  :: (Ptr RawTH3S) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_Rebin" c_th3s_rebin 
+  :: (Ptr RawTH3S) -> CInt -> CString -> (Ptr CDouble) -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3S.h TH3S_RebinAxis" c_th3s_rebinaxis 
+  :: (Ptr RawTH3S) -> CDouble -> (Ptr RawTAxis) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_Rebuild" c_th3s_rebuild 
+  :: (Ptr RawTH3S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_RecursiveRemove" c_th3s_recursiveremove 
+  :: (Ptr RawTH3S) -> (Ptr RawTObject) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_Reset" c_th3s_reset 
+  :: (Ptr RawTH3S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_ResetStats" c_th3s_resetstats 
+  :: (Ptr RawTH3S) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_Scale" c_th3s_scale 
+  :: (Ptr RawTH3S) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_setAxisColorA" c_th3s_setaxiscolora 
+  :: (Ptr RawTH3S) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetAxisRange" c_th3s_setaxisrange 
+  :: (Ptr RawTH3S) -> CDouble -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetBarOffset" c_th3s_setbaroffset 
+  :: (Ptr RawTH3S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetBarWidth" c_th3s_setbarwidth 
+  :: (Ptr RawTH3S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_setBinContent1" c_th3s_setbincontent1 
+  :: (Ptr RawTH3S) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_setBinContent2" c_th3s_setbincontent2 
+  :: (Ptr RawTH3S) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_setBinContent3" c_th3s_setbincontent3 
+  :: (Ptr RawTH3S) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_setBinError1" c_th3s_setbinerror1 
+  :: (Ptr RawTH3S) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_setBinError2" c_th3s_setbinerror2 
+  :: (Ptr RawTH3S) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_setBinError3" c_th3s_setbinerror3 
+  :: (Ptr RawTH3S) -> CInt -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_setBins1" c_th3s_setbins1 
+  :: (Ptr RawTH3S) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_setBins2" c_th3s_setbins2 
+  :: (Ptr RawTH3S) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_setBins3" c_th3s_setbins3 
+  :: (Ptr RawTH3S) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetBinsLength" c_th3s_setbinslength 
+  :: (Ptr RawTH3S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetBuffer" c_th3s_setbuffer 
+  :: (Ptr RawTH3S) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetCellContent" c_th3s_setcellcontent 
+  :: (Ptr RawTH3S) -> CInt -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetContent" c_th3s_setcontent 
+  :: (Ptr RawTH3S) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetContour" c_th3s_setcontour 
+  :: (Ptr RawTH3S) -> CInt -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetContourLevel" c_th3s_setcontourlevel 
+  :: (Ptr RawTH3S) -> CInt -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetDirectory" c_th3s_setdirectory 
+  :: (Ptr RawTH3S) -> (Ptr RawTDirectory) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetEntries" c_th3s_setentries 
+  :: (Ptr RawTH3S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetError" c_th3s_seterror 
+  :: (Ptr RawTH3S) -> (Ptr CDouble) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_setLabelColorA" c_th3s_setlabelcolora 
+  :: (Ptr RawTH3S) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_setLabelSizeA" c_th3s_setlabelsizea 
+  :: (Ptr RawTH3S) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_setLabelFontA" c_th3s_setlabelfonta 
+  :: (Ptr RawTH3S) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_setLabelOffsetA" c_th3s_setlabeloffseta 
+  :: (Ptr RawTH3S) -> CDouble -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetMaximum" c_th3s_setmaximum 
+  :: (Ptr RawTH3S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetMinimum" c_th3s_setminimum 
+  :: (Ptr RawTH3S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetNormFactor" c_th3s_setnormfactor 
+  :: (Ptr RawTH3S) -> CDouble -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetStats" c_th3s_setstats 
+  :: (Ptr RawTH3S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetOption" c_th3s_setoption 
+  :: (Ptr RawTH3S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetXTitle" c_th3s_setxtitle 
+  :: (Ptr RawTH3S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetYTitle" c_th3s_setytitle 
+  :: (Ptr RawTH3S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetZTitle" c_th3s_setztitle 
+  :: (Ptr RawTH3S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_ShowBackground" c_th3s_showbackground 
+  :: (Ptr RawTH3S) -> CInt -> CString -> IO (Ptr RawTH1)
+
+foreign import ccall "HROOTHistTH3S.h TH3S_ShowPeaks" c_th3s_showpeaks 
+  :: (Ptr RawTH3S) -> CDouble -> CString -> CDouble -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_Smooth" c_th3s_smooth 
+  :: (Ptr RawTH3S) -> CInt -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_Sumw2" c_th3s_sumw2 
+  :: (Ptr RawTH3S) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_Draw" c_th3s_draw 
+  :: (Ptr RawTH3S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_FindObject" c_th3s_findobject 
+  :: (Ptr RawTH3S) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetName" c_th3s_getname 
+  :: (Ptr RawTH3S) -> IO CString
+
+foreign import ccall "HROOTHistTH3S.h TH3S_IsA" c_th3s_isa 
+  :: (Ptr RawTH3S) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTH3S.h TH3S_Paint" c_th3s_paint 
+  :: (Ptr RawTH3S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_printObj" c_th3s_printobj 
+  :: (Ptr RawTH3S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SaveAs" c_th3s_saveas 
+  :: (Ptr RawTH3S) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_Write" c_th3s_write 
+  :: (Ptr RawTH3S) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetLineColor" c_th3s_getlinecolor 
+  :: (Ptr RawTH3S) -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetLineStyle" c_th3s_getlinestyle 
+  :: (Ptr RawTH3S) -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetLineWidth" c_th3s_getlinewidth 
+  :: (Ptr RawTH3S) -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_ResetAttLine" c_th3s_resetattline 
+  :: (Ptr RawTH3S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetLineAttributes" c_th3s_setlineattributes 
+  :: (Ptr RawTH3S) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetLineColor" c_th3s_setlinecolor 
+  :: (Ptr RawTH3S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetLineStyle" c_th3s_setlinestyle 
+  :: (Ptr RawTH3S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetLineWidth" c_th3s_setlinewidth 
+  :: (Ptr RawTH3S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetFillColor" c_th3s_setfillcolor 
+  :: (Ptr RawTH3S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetFillStyle" c_th3s_setfillstyle 
+  :: (Ptr RawTH3S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetMarkerColor" c_th3s_getmarkercolor 
+  :: (Ptr RawTH3S) -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetMarkerStyle" c_th3s_getmarkerstyle 
+  :: (Ptr RawTH3S) -> IO CInt
+
+foreign import ccall "HROOTHistTH3S.h TH3S_GetMarkerSize" c_th3s_getmarkersize 
+  :: (Ptr RawTH3S) -> IO CDouble
+
+foreign import ccall "HROOTHistTH3S.h TH3S_ResetAttMarker" c_th3s_resetattmarker 
+  :: (Ptr RawTH3S) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetMarkerAttributes" c_th3s_setmarkerattributes 
+  :: (Ptr RawTH3S) -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetMarkerColor" c_th3s_setmarkercolor 
+  :: (Ptr RawTH3S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetMarkerStyle" c_th3s_setmarkerstyle 
+  :: (Ptr RawTH3S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_SetMarkerSize" c_th3s_setmarkersize 
+  :: (Ptr RawTH3S) -> CInt -> IO ()
+
+foreign import ccall "HROOTHistTH3S.h TH3S_delete" c_th3s_delete 
+  :: (Ptr RawTH3S) -> IO ()
+
diff --git a/src/HROOT/Hist/TH3S/Implementation.hs b/src/HROOT/Hist/TH3S/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3S/Implementation.hs
@@ -0,0 +1,440 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.TH3S.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH3S.RawType
+import HROOT.Hist.TH3S.FFI
+import HROOT.Hist.TH3S.Interface
+import HROOT.Hist.TH3S.Cast
+import HROOT.Hist.TH1D.RawType
+import HROOT.Hist.TH1D.Cast
+import HROOT.Hist.TH1D.Interface
+import HROOT.Hist.TF1.RawType
+import HROOT.Hist.TF1.Cast
+import HROOT.Hist.TF1.Interface
+import HROOT.Core.TDirectory.RawType
+import HROOT.Core.TDirectory.Cast
+import HROOT.Core.TDirectory.Interface
+import HROOT.Core.TArrayD.RawType
+import HROOT.Core.TArrayD.Cast
+import HROOT.Core.TArrayD.Interface
+import HROOT.Hist.TAxis.RawType
+import HROOT.Hist.TAxis.Cast
+import HROOT.Hist.TAxis.Interface
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Hist.TH3.RawType
+import HROOT.Hist.TH3.Cast
+import HROOT.Hist.TH3.Interface
+import HROOT.Core.TArrayS.RawType
+import HROOT.Core.TArrayS.Cast
+import HROOT.Core.TArrayS.Interface
+import HROOT.Hist.TH1.RawType
+import HROOT.Hist.TH1.Cast
+import HROOT.Hist.TH1.Interface
+import HROOT.Core.TAtt3D.RawType
+import HROOT.Core.TAtt3D.Cast
+import HROOT.Core.TAtt3D.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.TAttLine.RawType
+import HROOT.Core.TAttLine.Cast
+import HROOT.Core.TAttLine.Interface
+import HROOT.Core.TAttFill.RawType
+import HROOT.Core.TAttFill.Cast
+import HROOT.Core.TAttFill.Interface
+import HROOT.Core.TAttMarker.RawType
+import HROOT.Core.TAttMarker.Cast
+import HROOT.Core.TAttMarker.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+import HROOT.Core.TArray.RawType
+import HROOT.Core.TArray.Cast
+import HROOT.Core.TArray.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITH3S TH3S where
+instance ITH3 TH3S where
+  fill3 = xform3 c_th3s_fill3
+  fill3w = xform4 c_th3s_fill3w
+  fitSlicesZ = xform7 c_th3s_fitslicesz
+  getCorrelationFactor3 = xform2 c_th3s_getcorrelationfactor3
+  getCovariance3 = xform2 c_th3s_getcovariance3
+  rebinX3 = xform2 c_th3s_rebinx3
+  rebinY3 = xform2 c_th3s_rebiny3
+  rebinZ3 = xform2 c_th3s_rebinz3
+  rebin3D = xform4 c_th3s_rebin3d
+instance ITArrayS TH3S where
+instance ITH1 TH3S where
+  add = xform2 c_th3s_add
+  addBinContent = xform2 c_th3s_addbincontent
+  chi2Test = xform3 c_th3s_chi2test
+  computeIntegral = xform0 c_th3s_computeintegral
+  directoryAutoAdd = xform1 c_th3s_directoryautoadd
+  divide = xform5 c_th3s_divide
+  drawCopyTH1 = xform1 c_th3s_drawcopyth1
+  drawNormalized = xform2 c_th3s_drawnormalized
+  drawPanelTH1 = xform0 c_th3s_drawpanelth1
+  bufferEmpty = xform1 c_th3s_bufferempty
+  evalF = xform2 c_th3s_evalf
+  fFT = xform2 c_th3s_fft
+  fill1 = xform1 c_th3s_fill1
+  fill1w = xform2 c_th3s_fill1w
+  fillN1 = xform4 c_th3s_filln1
+  fillRandom = xform2 c_th3s_fillrandom
+  findBin = xform3 c_th3s_findbin
+  findFixBin = xform3 c_th3s_findfixbin
+  findFirstBinAbove = xform2 c_th3s_findfirstbinabove
+  findLastBinAbove = xform2 c_th3s_findlastbinabove
+  fitPanelTH1 = xform0 c_th3s_fitpanelth1
+  getNdivisionA = xform1 c_th3s_getndivisiona
+  getAxisColorA = xform1 c_th3s_getaxiscolora
+  getLabelColorA = xform1 c_th3s_getlabelcolora
+  getLabelFontA = xform1 c_th3s_getlabelfonta
+  getLabelOffsetA = xform1 c_th3s_getlabeloffseta
+  getLabelSizeA = xform1 c_th3s_getlabelsizea
+  getTitleFontA = xform1 c_th3s_gettitlefonta
+  getTitleOffsetA = xform1 c_th3s_gettitleoffseta
+  getTitleSizeA = xform1 c_th3s_gettitlesizea
+  getTickLengthA = xform1 c_th3s_getticklengtha
+  getBarOffset = xform0 c_th3s_getbaroffset
+  getBarWidth = xform0 c_th3s_getbarwidth
+  getContour = xform1 c_th3s_getcontour
+  getContourLevel = xform1 c_th3s_getcontourlevel
+  getContourLevelPad = xform1 c_th3s_getcontourlevelpad
+  getBin = xform3 c_th3s_getbin
+  getBinCenter = xform1 c_th3s_getbincenter
+  getBinContent1 = xform1 c_th3s_getbincontent1
+  getBinContent2 = xform2 c_th3s_getbincontent2
+  getBinContent3 = xform3 c_th3s_getbincontent3
+  getBinError1 = xform1 c_th3s_getbinerror1
+  getBinError2 = xform2 c_th3s_getbinerror2
+  getBinError3 = xform3 c_th3s_getbinerror3
+  getBinLowEdge = xform1 c_th3s_getbinlowedge
+  getBinWidth = xform1 c_th3s_getbinwidth
+  getCellContent = xform2 c_th3s_getcellcontent
+  getCellError = xform2 c_th3s_getcellerror
+  getEntries = xform0 c_th3s_getentries
+  getEffectiveEntries = xform0 c_th3s_geteffectiveentries
+  getFunction = xform1 c_th3s_getfunction
+  getDimension = xform0 c_th3s_getdimension
+  getKurtosis = xform1 c_th3s_getkurtosis
+  getLowEdge = xform1 c_th3s_getlowedge
+  getMaximumTH1 = xform1 c_th3s_getmaximumth1
+  getMaximumBin = xform0 c_th3s_getmaximumbin
+  getMaximumStored = xform0 c_th3s_getmaximumstored
+  getMinimumTH1 = xform1 c_th3s_getminimumth1
+  getMinimumBin = xform0 c_th3s_getminimumbin
+  getMinimumStored = xform0 c_th3s_getminimumstored
+  getMean = xform1 c_th3s_getmean
+  getMeanError = xform1 c_th3s_getmeanerror
+  getNbinsX = xform0 c_th3s_getnbinsx
+  getNbinsY = xform0 c_th3s_getnbinsy
+  getNbinsZ = xform0 c_th3s_getnbinsz
+  getQuantilesTH1 = xform3 c_th3s_getquantilesth1
+  getRandom = xform0 c_th3s_getrandom
+  getStats = xform1 c_th3s_getstats
+  getSumOfWeights = xform0 c_th3s_getsumofweights
+  getSumw2 = xform0 c_th3s_getsumw2
+  getSumw2N = xform0 c_th3s_getsumw2n
+  getRMS = xform1 c_th3s_getrms
+  getRMSError = xform1 c_th3s_getrmserror
+  getSkewness = xform1 c_th3s_getskewness
+  integral1 = xform3 c_th3s_integral1
+  interpolate1 = xform1 c_th3s_interpolate1
+  interpolate2 = xform2 c_th3s_interpolate2
+  interpolate3 = xform3 c_th3s_interpolate3
+  kolmogorovTest = xform2 c_th3s_kolmogorovtest
+  labelsDeflate = xform1 c_th3s_labelsdeflate
+  labelsInflate = xform1 c_th3s_labelsinflate
+  labelsOption = xform2 c_th3s_labelsoption
+  multiflyF = xform2 c_th3s_multiflyf
+  multiply = xform5 c_th3s_multiply
+  putStats = xform1 c_th3s_putstats
+  rebin = xform3 c_th3s_rebin
+  rebinAxis = xform2 c_th3s_rebinaxis
+  rebuild = xform1 c_th3s_rebuild
+  recursiveRemove = xform1 c_th3s_recursiveremove
+  reset = xform1 c_th3s_reset
+  resetStats = xform0 c_th3s_resetstats
+  scale = xform2 c_th3s_scale
+  setAxisColorA = xform2 c_th3s_setaxiscolora
+  setAxisRange = xform3 c_th3s_setaxisrange
+  setBarOffset = xform1 c_th3s_setbaroffset
+  setBarWidth = xform1 c_th3s_setbarwidth
+  setBinContent1 = xform2 c_th3s_setbincontent1
+  setBinContent2 = xform3 c_th3s_setbincontent2
+  setBinContent3 = xform4 c_th3s_setbincontent3
+  setBinError1 = xform2 c_th3s_setbinerror1
+  setBinError2 = xform3 c_th3s_setbinerror2
+  setBinError3 = xform4 c_th3s_setbinerror3
+  setBins1 = xform2 c_th3s_setbins1
+  setBins2 = xform4 c_th3s_setbins2
+  setBins3 = xform6 c_th3s_setbins3
+  setBinsLength = xform1 c_th3s_setbinslength
+  setBuffer = xform2 c_th3s_setbuffer
+  setCellContent = xform3 c_th3s_setcellcontent
+  setContent = xform1 c_th3s_setcontent
+  setContour = xform2 c_th3s_setcontour
+  setContourLevel = xform2 c_th3s_setcontourlevel
+  setDirectory = xform1 c_th3s_setdirectory
+  setEntries = xform1 c_th3s_setentries
+  setError = xform1 c_th3s_seterror
+  setLabelColorA = xform2 c_th3s_setlabelcolora
+  setLabelSizeA = xform2 c_th3s_setlabelsizea
+  setLabelFontA = xform2 c_th3s_setlabelfonta
+  setLabelOffsetA = xform2 c_th3s_setlabeloffseta
+  setMaximum = xform1 c_th3s_setmaximum
+  setMinimum = xform1 c_th3s_setminimum
+  setNormFactor = xform1 c_th3s_setnormfactor
+  setStats = xform1 c_th3s_setstats
+  setOption = xform1 c_th3s_setoption
+  setXTitle = xform1 c_th3s_setxtitle
+  setYTitle = xform1 c_th3s_setytitle
+  setZTitle = xform1 c_th3s_setztitle
+  showBackground = xform2 c_th3s_showbackground
+  showPeaks = xform3 c_th3s_showpeaks
+  smooth = xform2 c_th3s_smooth
+  sumw2 = xform0 c_th3s_sumw2
+instance ITAtt3D TH3S where
+instance ITObject TH3S where
+  draw = xform1 c_th3s_draw
+  findObject = xform1 c_th3s_findobject
+  getName = xform0 c_th3s_getname
+  isA = xform0 c_th3s_isa
+  paint = xform1 c_th3s_paint
+  printObj = xform1 c_th3s_printobj
+  saveAs = xform2 c_th3s_saveas
+  write = xform3 c_th3s_write
+instance ITAttLine TH3S where
+  getLineColor = xform0 c_th3s_getlinecolor
+  getLineStyle = xform0 c_th3s_getlinestyle
+  getLineWidth = xform0 c_th3s_getlinewidth
+  resetAttLine = xform1 c_th3s_resetattline
+  setLineAttributes = xform0 c_th3s_setlineattributes
+  setLineColor = xform1 c_th3s_setlinecolor
+  setLineStyle = xform1 c_th3s_setlinestyle
+  setLineWidth = xform1 c_th3s_setlinewidth
+instance ITAttFill TH3S where
+  setFillColor = xform1 c_th3s_setfillcolor
+  setFillStyle = xform1 c_th3s_setfillstyle
+instance ITAttMarker TH3S where
+  getMarkerColor = xform0 c_th3s_getmarkercolor
+  getMarkerStyle = xform0 c_th3s_getmarkerstyle
+  getMarkerSize = xform0 c_th3s_getmarkersize
+  resetAttMarker = xform1 c_th3s_resetattmarker
+  setMarkerAttributes = xform0 c_th3s_setmarkerattributes
+  setMarkerColor = xform1 c_th3s_setmarkercolor
+  setMarkerStyle = xform1 c_th3s_setmarkerstyle
+  setMarkerSize = xform1 c_th3s_setmarkersize
+instance IDeletable TH3S where
+  delete = xform0 c_th3s_delete
+instance ITArray TH3S where
+
+instance ITH3S (Exist TH3S) where
+
+instance ITH3 (Exist TH3S) where
+  fill3 (ETH3S x) = fill3 x
+  fill3w (ETH3S x) = fill3w x
+  fitSlicesZ (ETH3S x) = fitSlicesZ x
+  getCorrelationFactor3 (ETH3S x) = getCorrelationFactor3 x
+  getCovariance3 (ETH3S x) = getCovariance3 x
+  rebinX3 (ETH3S x) = rebinX3 x
+  rebinY3 (ETH3S x) = rebinY3 x
+  rebinZ3 (ETH3S x) = rebinZ3 x
+  rebin3D (ETH3S x) = rebin3D x
+instance ITArrayS (Exist TH3S) where
+
+instance ITH1 (Exist TH3S) where
+  add (ETH3S x) = add x
+  addBinContent (ETH3S x) = addBinContent x
+  chi2Test (ETH3S x) = chi2Test x
+  computeIntegral (ETH3S x) = computeIntegral x
+  directoryAutoAdd (ETH3S x) = directoryAutoAdd x
+  divide (ETH3S x) = divide x
+  drawCopyTH1 (ETH3S x) a1 = return . ETH3S =<< drawCopyTH1 x a1
+  drawNormalized (ETH3S x) = drawNormalized x
+  drawPanelTH1 (ETH3S x) = drawPanelTH1 x
+  bufferEmpty (ETH3S x) = bufferEmpty x
+  evalF (ETH3S x) = evalF x
+  fFT (ETH3S x) = fFT x
+  fill1 (ETH3S x) = fill1 x
+  fill1w (ETH3S x) = fill1w x
+  fillN1 (ETH3S x) = fillN1 x
+  fillRandom (ETH3S x) = fillRandom x
+  findBin (ETH3S x) = findBin x
+  findFixBin (ETH3S x) = findFixBin x
+  findFirstBinAbove (ETH3S x) = findFirstBinAbove x
+  findLastBinAbove (ETH3S x) = findLastBinAbove x
+  fitPanelTH1 (ETH3S x) = fitPanelTH1 x
+  getNdivisionA (ETH3S x) = getNdivisionA x
+  getAxisColorA (ETH3S x) = getAxisColorA x
+  getLabelColorA (ETH3S x) = getLabelColorA x
+  getLabelFontA (ETH3S x) = getLabelFontA x
+  getLabelOffsetA (ETH3S x) = getLabelOffsetA x
+  getLabelSizeA (ETH3S x) = getLabelSizeA x
+  getTitleFontA (ETH3S x) = getTitleFontA x
+  getTitleOffsetA (ETH3S x) = getTitleOffsetA x
+  getTitleSizeA (ETH3S x) = getTitleSizeA x
+  getTickLengthA (ETH3S x) = getTickLengthA x
+  getBarOffset (ETH3S x) = getBarOffset x
+  getBarWidth (ETH3S x) = getBarWidth x
+  getContour (ETH3S x) = getContour x
+  getContourLevel (ETH3S x) = getContourLevel x
+  getContourLevelPad (ETH3S x) = getContourLevelPad x
+  getBin (ETH3S x) = getBin x
+  getBinCenter (ETH3S x) = getBinCenter x
+  getBinContent1 (ETH3S x) = getBinContent1 x
+  getBinContent2 (ETH3S x) = getBinContent2 x
+  getBinContent3 (ETH3S x) = getBinContent3 x
+  getBinError1 (ETH3S x) = getBinError1 x
+  getBinError2 (ETH3S x) = getBinError2 x
+  getBinError3 (ETH3S x) = getBinError3 x
+  getBinLowEdge (ETH3S x) = getBinLowEdge x
+  getBinWidth (ETH3S x) = getBinWidth x
+  getCellContent (ETH3S x) = getCellContent x
+  getCellError (ETH3S x) = getCellError x
+  getEntries (ETH3S x) = getEntries x
+  getEffectiveEntries (ETH3S x) = getEffectiveEntries x
+  getFunction (ETH3S x) = getFunction x
+  getDimension (ETH3S x) = getDimension x
+  getKurtosis (ETH3S x) = getKurtosis x
+  getLowEdge (ETH3S x) = getLowEdge x
+  getMaximumTH1 (ETH3S x) = getMaximumTH1 x
+  getMaximumBin (ETH3S x) = getMaximumBin x
+  getMaximumStored (ETH3S x) = getMaximumStored x
+  getMinimumTH1 (ETH3S x) = getMinimumTH1 x
+  getMinimumBin (ETH3S x) = getMinimumBin x
+  getMinimumStored (ETH3S x) = getMinimumStored x
+  getMean (ETH3S x) = getMean x
+  getMeanError (ETH3S x) = getMeanError x
+  getNbinsX (ETH3S x) = getNbinsX x
+  getNbinsY (ETH3S x) = getNbinsY x
+  getNbinsZ (ETH3S x) = getNbinsZ x
+  getQuantilesTH1 (ETH3S x) = getQuantilesTH1 x
+  getRandom (ETH3S x) = getRandom x
+  getStats (ETH3S x) = getStats x
+  getSumOfWeights (ETH3S x) = getSumOfWeights x
+  getSumw2 (ETH3S x) = getSumw2 x
+  getSumw2N (ETH3S x) = getSumw2N x
+  getRMS (ETH3S x) = getRMS x
+  getRMSError (ETH3S x) = getRMSError x
+  getSkewness (ETH3S x) = getSkewness x
+  integral1 (ETH3S x) = integral1 x
+  interpolate1 (ETH3S x) = interpolate1 x
+  interpolate2 (ETH3S x) = interpolate2 x
+  interpolate3 (ETH3S x) = interpolate3 x
+  kolmogorovTest (ETH3S x) = kolmogorovTest x
+  labelsDeflate (ETH3S x) = labelsDeflate x
+  labelsInflate (ETH3S x) = labelsInflate x
+  labelsOption (ETH3S x) = labelsOption x
+  multiflyF (ETH3S x) = multiflyF x
+  multiply (ETH3S x) = multiply x
+  putStats (ETH3S x) = putStats x
+  rebin (ETH3S x) = rebin x
+  rebinAxis (ETH3S x) = rebinAxis x
+  rebuild (ETH3S x) = rebuild x
+  recursiveRemove (ETH3S x) = recursiveRemove x
+  reset (ETH3S x) = reset x
+  resetStats (ETH3S x) = resetStats x
+  scale (ETH3S x) = scale x
+  setAxisColorA (ETH3S x) = setAxisColorA x
+  setAxisRange (ETH3S x) = setAxisRange x
+  setBarOffset (ETH3S x) = setBarOffset x
+  setBarWidth (ETH3S x) = setBarWidth x
+  setBinContent1 (ETH3S x) = setBinContent1 x
+  setBinContent2 (ETH3S x) = setBinContent2 x
+  setBinContent3 (ETH3S x) = setBinContent3 x
+  setBinError1 (ETH3S x) = setBinError1 x
+  setBinError2 (ETH3S x) = setBinError2 x
+  setBinError3 (ETH3S x) = setBinError3 x
+  setBins1 (ETH3S x) = setBins1 x
+  setBins2 (ETH3S x) = setBins2 x
+  setBins3 (ETH3S x) = setBins3 x
+  setBinsLength (ETH3S x) = setBinsLength x
+  setBuffer (ETH3S x) = setBuffer x
+  setCellContent (ETH3S x) = setCellContent x
+  setContent (ETH3S x) = setContent x
+  setContour (ETH3S x) = setContour x
+  setContourLevel (ETH3S x) = setContourLevel x
+  setDirectory (ETH3S x) = setDirectory x
+  setEntries (ETH3S x) = setEntries x
+  setError (ETH3S x) = setError x
+  setLabelColorA (ETH3S x) = setLabelColorA x
+  setLabelSizeA (ETH3S x) = setLabelSizeA x
+  setLabelFontA (ETH3S x) = setLabelFontA x
+  setLabelOffsetA (ETH3S x) = setLabelOffsetA x
+  setMaximum (ETH3S x) = setMaximum x
+  setMinimum (ETH3S x) = setMinimum x
+  setNormFactor (ETH3S x) = setNormFactor x
+  setStats (ETH3S x) = setStats x
+  setOption (ETH3S x) = setOption x
+  setXTitle (ETH3S x) = setXTitle x
+  setYTitle (ETH3S x) = setYTitle x
+  setZTitle (ETH3S x) = setZTitle x
+  showBackground (ETH3S x) = showBackground x
+  showPeaks (ETH3S x) = showPeaks x
+  smooth (ETH3S x) = smooth x
+  sumw2 (ETH3S x) = sumw2 x
+instance ITAtt3D (Exist TH3S) where
+
+instance ITObject (Exist TH3S) where
+  draw (ETH3S x) = draw x
+  findObject (ETH3S x) = findObject x
+  getName (ETH3S x) = getName x
+  isA (ETH3S x) = isA x
+  paint (ETH3S x) = paint x
+  printObj (ETH3S x) = printObj x
+  saveAs (ETH3S x) = saveAs x
+  write (ETH3S x) = write x
+instance ITAttLine (Exist TH3S) where
+  getLineColor (ETH3S x) = getLineColor x
+  getLineStyle (ETH3S x) = getLineStyle x
+  getLineWidth (ETH3S x) = getLineWidth x
+  resetAttLine (ETH3S x) = resetAttLine x
+  setLineAttributes (ETH3S x) = setLineAttributes x
+  setLineColor (ETH3S x) = setLineColor x
+  setLineStyle (ETH3S x) = setLineStyle x
+  setLineWidth (ETH3S x) = setLineWidth x
+instance ITAttFill (Exist TH3S) where
+  setFillColor (ETH3S x) = setFillColor x
+  setFillStyle (ETH3S x) = setFillStyle x
+instance ITAttMarker (Exist TH3S) where
+  getMarkerColor (ETH3S x) = getMarkerColor x
+  getMarkerStyle (ETH3S x) = getMarkerStyle x
+  getMarkerSize (ETH3S x) = getMarkerSize x
+  resetAttMarker (ETH3S x) = resetAttMarker x
+  setMarkerAttributes (ETH3S x) = setMarkerAttributes x
+  setMarkerColor (ETH3S x) = setMarkerColor x
+  setMarkerStyle (ETH3S x) = setMarkerStyle x
+  setMarkerSize (ETH3S x) = setMarkerSize x
+instance IDeletable (Exist TH3S) where
+  delete (ETH3S x) = delete x
+instance ITArray (Exist TH3S) where
+
+
+
+
+
+
+
+
+instance FPtr (Exist TH3S) where
+  type Raw (Exist TH3S) = RawTH3S
+  get_fptr (ETH3S obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETH3S (cast_fptr_to_obj (fptr :: ForeignPtr RawTH3S) :: TH3S)
diff --git a/src/HROOT/Hist/TH3S/Interface.hs b/src/HROOT/Hist/TH3S/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3S/Interface.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.TH3S.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.TH3S.RawType
+
+import HROOT.Hist.TH3.Interface
+import HROOT.Core.TArrayS.Interface
+---- ============ ----
+
+
+
+class (ITH3 a,ITArrayS a) => ITH3S a where
+
+instance Existable TH3S where
+  data Exist TH3S = forall a. (FPtr a, ITH3S a) => ETH3S a
+
+upcastTH3S :: (FPtr a, ITH3S a) => a -> TH3S
+upcastTH3S h = let fh = get_fptr h
+                   fh2 :: ForeignPtr RawTH3S = castForeignPtr fh
+               in cast_fptr_to_obj fh2
+
+downcastTH3S :: (FPtr a, ITH3S a) => TH3S -> a 
+downcastTH3S h = let fh = get_fptr h
+                     fh2 = castForeignPtr fh
+                 in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/TH3S/RawType.hs b/src/HROOT/Hist/TH3S/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/TH3S/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.TH3S.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTH3S
+newtype TH3S = TH3S (ForeignPtr RawTH3S) deriving (Eq, Ord, Show)
+instance FPtr TH3S where
+   type Raw TH3S = RawTH3S
+   get_fptr (TH3S fptr) = fptr
+   cast_fptr_to_obj = TH3S
diff --git a/src/HROOT/Hist/THStack.hs b/src/HROOT/Hist/THStack.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/THStack.hs
@@ -0,0 +1,15 @@
+module HROOT.Hist.THStack
+  (
+    THStack(..)
+  , ITHStack
+  , upcastTHStack
+  , downcastTHStack
+  , newTHStack
+ 
+  ) where
+
+import HROOT.Hist.THStack.RawType
+import HROOT.Hist.THStack.Interface
+import HROOT.Hist.THStack.Implementation
+
+
diff --git a/src/HROOT/Hist/THStack/Cast.hs b/src/HROOT/Hist/THStack/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/THStack/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, 
+             MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.THStack.Cast where
+
+
+import Foreign.Ptr
+import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
+import Foreign.ForeignPtr.Unsafe
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+
+import HROOT.Hist.THStack.RawType
+import HROOT.Hist.THStack.Interface
+
+instance (ITHStack a, FPtr a) => Castable a (Ptr RawTHStack) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
+
+instance Castable THStack (Ptr RawTHStack) where
+  cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
+  uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ 
diff --git a/src/HROOT/Hist/THStack/FFI.hsc b/src/HROOT/Hist/THStack/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/THStack/FFI.hsc
@@ -0,0 +1,59 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- module HROOT.Class.FFI where
+
+module HROOT.Hist.THStack.FFI where
+
+
+import Foreign.C            
+import Foreign.Ptr
+
+-- import HROOT.Class.Interface
+
+-- #include ""
+
+import HROOT.Hist.THStack.RawType
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TClass.RawType
+
+#include "HROOTHistTHStack.h"
+
+foreign import ccall "HROOTHistTHStack.h THStack_SetName" c_thstack_setname 
+  :: (Ptr RawTHStack) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTHStack.h THStack_SetNameTitle" c_thstack_setnametitle 
+  :: (Ptr RawTHStack) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTHStack.h THStack_SetTitle" c_thstack_settitle 
+  :: (Ptr RawTHStack) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTHStack.h THStack_Draw" c_thstack_draw 
+  :: (Ptr RawTHStack) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTHStack.h THStack_FindObject" c_thstack_findobject 
+  :: (Ptr RawTHStack) -> CString -> IO (Ptr RawTObject)
+
+foreign import ccall "HROOTHistTHStack.h THStack_GetName" c_thstack_getname 
+  :: (Ptr RawTHStack) -> IO CString
+
+foreign import ccall "HROOTHistTHStack.h THStack_IsA" c_thstack_isa 
+  :: (Ptr RawTHStack) -> IO (Ptr RawTClass)
+
+foreign import ccall "HROOTHistTHStack.h THStack_Paint" c_thstack_paint 
+  :: (Ptr RawTHStack) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTHStack.h THStack_printObj" c_thstack_printobj 
+  :: (Ptr RawTHStack) -> CString -> IO ()
+
+foreign import ccall "HROOTHistTHStack.h THStack_SaveAs" c_thstack_saveas 
+  :: (Ptr RawTHStack) -> CString -> CString -> IO ()
+
+foreign import ccall "HROOTHistTHStack.h THStack_Write" c_thstack_write 
+  :: (Ptr RawTHStack) -> CString -> CInt -> CInt -> IO CInt
+
+foreign import ccall "HROOTHistTHStack.h THStack_delete" c_thstack_delete 
+  :: (Ptr RawTHStack) -> IO ()
+
+foreign import ccall "HROOTHistTHStack.h THStack_newTHStack" c_thstack_newthstack 
+  :: CString -> CString -> IO (Ptr RawTHStack)
+
diff --git a/src/HROOT/Hist/THStack/Implementation.hs b/src/HROOT/Hist/THStack/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/THStack/Implementation.hs
@@ -0,0 +1,81 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
+             OverlappingInstances, IncoherentInstances #-}
+
+module HROOT.Hist.THStack.Implementation where
+
+
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.THStack.RawType
+import HROOT.Hist.THStack.FFI
+import HROOT.Hist.THStack.Interface
+import HROOT.Hist.THStack.Cast
+import HROOT.Core.TClass.RawType
+import HROOT.Core.TClass.Cast
+import HROOT.Core.TClass.Interface
+import HROOT.Core.TNamed.RawType
+import HROOT.Core.TNamed.Cast
+import HROOT.Core.TNamed.Interface
+import HROOT.Core.TObject.RawType
+import HROOT.Core.TObject.Cast
+import HROOT.Core.TObject.Interface
+import HROOT.Core.Deletable.RawType
+import HROOT.Core.Deletable.Cast
+import HROOT.Core.Deletable.Interface
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr 
+import Foreign.ForeignPtr
+
+import System.IO.Unsafe
+
+
+instance ITHStack THStack where
+instance ITNamed THStack where
+  setName = xform1 c_thstack_setname
+  setNameTitle = xform2 c_thstack_setnametitle
+  setTitle = xform1 c_thstack_settitle
+instance ITObject THStack where
+  draw = xform1 c_thstack_draw
+  findObject = xform1 c_thstack_findobject
+  getName = xform0 c_thstack_getname
+  isA = xform0 c_thstack_isa
+  paint = xform1 c_thstack_paint
+  printObj = xform1 c_thstack_printobj
+  saveAs = xform2 c_thstack_saveas
+  write = xform3 c_thstack_write
+instance IDeletable THStack where
+  delete = xform0 c_thstack_delete
+
+instance ITHStack (Exist THStack) where
+
+instance ITNamed (Exist THStack) where
+  setName (ETHStack x) = setName x
+  setNameTitle (ETHStack x) = setNameTitle x
+  setTitle (ETHStack x) = setTitle x
+instance ITObject (Exist THStack) where
+  draw (ETHStack x) = draw x
+  findObject (ETHStack x) = findObject x
+  getName (ETHStack x) = getName x
+  isA (ETHStack x) = isA x
+  paint (ETHStack x) = paint x
+  printObj (ETHStack x) = printObj x
+  saveAs (ETHStack x) = saveAs x
+  write (ETHStack x) = write x
+instance IDeletable (Exist THStack) where
+  delete (ETHStack x) = delete x
+
+
+newTHStack :: CString -> CString -> IO THStack
+newTHStack = xform1 c_thstack_newthstack
+
+
+
+
+
+instance FPtr (Exist THStack) where
+  type Raw (Exist THStack) = RawTHStack
+  get_fptr (ETHStack obj) = castForeignPtr (get_fptr obj)
+  cast_fptr_to_obj fptr = ETHStack (cast_fptr_to_obj (fptr :: ForeignPtr RawTHStack) :: THStack)
diff --git a/src/HROOT/Hist/THStack/Interface.hs b/src/HROOT/Hist/THStack/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/THStack/Interface.hs
@@ -0,0 +1,36 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+-- module HROOT.Class.Interface where
+
+module HROOT.Hist.THStack.Interface where
+
+
+import Data.Word
+import Foreign.C
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast
+
+import HROOT.Hist.THStack.RawType
+
+import HROOT.Core.TNamed.Interface
+---- ============ ----
+
+
+
+class (ITNamed a) => ITHStack a where
+
+instance Existable THStack where
+  data Exist THStack = forall a. (FPtr a, ITHStack a) => ETHStack a
+
+upcastTHStack :: (FPtr a, ITHStack a) => a -> THStack
+upcastTHStack h = let fh = get_fptr h
+                      fh2 :: ForeignPtr RawTHStack = castForeignPtr fh
+                  in cast_fptr_to_obj fh2
+
+downcastTHStack :: (FPtr a, ITHStack a) => THStack -> a 
+downcastTHStack h = let fh = get_fptr h
+                        fh2 = castForeignPtr fh
+                    in cast_fptr_to_obj fh2
diff --git a/src/HROOT/Hist/THStack/RawType.hs b/src/HROOT/Hist/THStack/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/HROOT/Hist/THStack/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
+             FlexibleInstances, TypeSynonymInstances, 
+             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+
+module HROOT.Hist.THStack.RawType where
+
+
+import Foreign.ForeignPtr
+import FFICXX.Runtime.Cast  
+
+data RawTHStack
+newtype THStack = THStack (ForeignPtr RawTHStack) deriving (Eq, Ord, Show)
+instance FPtr THStack where
+   type Raw THStack = RawTHStack
+   get_fptr (THStack fptr) = fptr
+   cast_fptr_to_obj = THStack
