24from ROOT
import gRandom, gPad, gROOT, gVirtualX
25from ROOT
import kTRUE, kRed
26from ROOT
import TCanvas, TH2, TH2F
73 self._cX =
TCanvas(
'c2',
'Projection Canvas in X', 730, 10, 700, 500 )
75 self._DestroyPrimitive(
'X' )
78 self._cY =
TCanvas(
'c3',
'Projection Canvas in Y', 10, 550, 700, 500 )
80 self._DestroyPrimitive(
'Y' )
82 self.DrawSlice( h, y,
'Y' )
83 self.DrawSlice( h, x,
'X' )
88 proj =
getattr( self,
'_c'+xy ).GetPrimitive(
'Projection '+xy )
92 def DrawSlice( self, histo, value, xy ):
93 yx = xy ==
'X' and 'Y' or 'X'
96 canvas =
getattr( self,
'_c'+xy )
100 bin =
getattr( histo,
'Get%saxis' % xy )().FindBin( value )
101 hp =
getattr( histo,
'Projection' + yx )(
'', bin, bin )
111if __name__ ==
'__main__':
113 c1 =
TCanvas(
'c1',
'Dynamic Slice Example', 10, 10, 700, 500 )
118 hpxpy =
TH2F(
'hpxpy',
'py vs px', 40, -4, 4, 40, -4, 4 )
121 for i
in range( 50000 ):
130 c1.AddExec(
'dynamic',
'TPython::Exec( "slicer()" );' )
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t SetLineWidth
Option_t Option_t SetLineColor
2-D histogram with a float per channel (see TH1 documentation)