Macのみで動作確認。
- Makefile
- test.cc
- mainのプログラム
- myclass.hh
- myclass.cc
- myclassLinkDef.hh
- Interacting with Shared Libraries: rootcint | ROOT
- Problems Building a class into a shared library - RootTalk
- https://wiki.gsi.de/foswiki/bin/genpdf/Personalpages/CppErrorMessages
make myclass
でmyclass.so
ができる。
make test
でtest
ができるので、
./test
で実行するとtest.root
ができる。
できあがったROOT fileを見るにはlibmyclass.so
をロードする必要がある。ROOTを起動してから、
.L libmyclass.so;
TFile *f = new TFile("test.root");
tree.Draw("myclass->GetTest1():myclass->GetTest2()");
などとすることでクラスの中身にアクセスできる。
- Adding Your Class to ROOT: ClassDef | ROOT
- ftp://root.cern.ch/root/doc/15AddingaClass.pdf
- ROOTでクラスをTTreeに書き込み・読み込みするとき - HongoWiki
- ROOTのGUIライブラリを利用してイベントをハンドルするときの注意 - HongoWiki
- MyClass [KamonoWiki]
- RootTalk: Re: [ROOT] rootcint options
ググってもちょうど良いものが見つからず苦労した。ライブラリファイルをつくってインクルードしてmakeするのがみそ。-lmyclass
オプションでできるはずだけどよくわからないからそのうち。