histogram 绘图option
参考
使用TH1->Draw
时,发现绘制的有errorbar,但是画不出连续的线,在option文档中提到当TH1有error时,默认绘制errorbar,需要使用HIST
关闭这个默认行为。
h->Draw("same PL HIST")
redirection the root output in command line
.> aa.log
.x hello.C()
.>
- 注意环境变量需要设置,每次运行前,可以编辑在~/.bashrc中
rootpy直接install
pip3 install rootpy
ROOT cannot be imported. Is ROOT installed with PyROOT enabled?
在python3中
import ROOT
Python 3.5 ImportError: dynamic module does not define module export function (PyInit_cv2) - Stack Overflow
python - rootpy installation probleme : Is ROOT installed with PyROOT enabled? - Stack Overflow
预编译root文件
ROOT macros and shared libraries - ROOT
下面代码会编译xxx.C
为一个动态链接库xxx_C.so
,其中包含xxx(int t)
函数
root -l
.L xxx.C+
下面可以直接在命令行调用该函数,-e
参数指定运行单引号内命令
root -l -e 'gSystem->Load("./xxx_C.so");xxx(2);'
Fit option
文档
默认使用chisquare计算,误差为bin内的值,为MLS(modified least-squares method)方法。
cppyy.LowLevelView
这种类型可以在python中索引,不能直接被numpy识别,无法利用numpy的一些特性比如切片和reshape,需要进行一次转换,比如对于这种类型的变量arr
,大小是NDATA
,python中类型一般是float64
,当然需要对照自己当前的设置
arr.reshape((NDATA,)) # adjust the llv's size
v = np.frombuffer(arr, dtype=np.float64, count=NDATA)