Legend の作成
1 2 3 4 5 |
from ROOT import TLegend def setLegend(leg, entries): if isinstance(entries, (list, tuple)): for ent in entries: leg.AddEntry(ent, ent.GetName()) |
使い方
1 2 |
leg = TLegend(0.65, 0.65, 0.85, 0.85) setLegend(leg, (h1, h2, h3)) |
複数のカットを and で連結する
1 2 3 4 5 6 7 8 |
from ROOT import TCut def andCut(cuts): if isinstance(cuts, (list, tuple)): cutnames = [var.GetTitle() for var in cuts] resCut = TCut( "&&".join(cutnames) ) else: resCut = cuts return resCut |
and(&&)で結んだカットを定義
1 2 3 |
cut1 = TCut("-1<x") cut2 = TCut("x<1") cut12 = TCut( "(%s)&&(%s)" %(cut1.GetTitle(), cut2.GetTitle()) ) |
ROOT の TCut オブジェクトからカットを表現する文字列を得るときは、GetTitle() メソッドを使えば良い。