Ejemplo n.º 1
0
from hippo import Display, Cut

#
# Create a 1D histogram
#
hist = Display ( "Histogram", events, ('GLON', ) )
canvas.addDisplay ( hist )

#
# First create cuts individually 
#
from hippo import Cut
cut1 = Cut ( events, ( 'zenith_angle', ) )
canvas.addDisplay ( cut1 )
cut1.setCutRange (  80., 100., 'x' )

#
# Create a another cut and set its range
#
cut2 = Cut ( events, ( 'energy', ) )
canvas.addDisplay ( cut2 )
cut2.setCutRange ( 1e3, 1e4, 'x' )
cut2.setLog ( 'x', True )
cut2.setLog ( 'y', True )

cuts = ( cut1, cut2 )
#
# Add the list of cuts to display
#
datarep = hist.getDataRep()
Ejemplo n.º 2
0
# Now we do in order to view the data.
app = HDApp()
canvas = app.canvas()
canvas.addDisplay ( hist )

# Set the Y axis on log scale of better viewing
hist.setLog ( 'y', True )

# Add a cut from data in another column
from hippo import Cut
hits_cut = Cut ( ntuple, ('TkrTotalHits',) )
canvas.addDisplay ( hits_cut )
hits_cut.setLog ( 'y', True )

hits_cut.addTarget ( hist )
hits_cut.setCutRange ( 4, 110, 'x' )

# Change the range of the displayed data
hist.setRange ( 'x', 40, 700 )

# fit a function to the histogram
from hippo import Function
datarep = hist.getDataRep ()

exp1 = Function ( "Exponential", datarep )
exp1.addTo ( hist )

exp1.fit ()

# Print the results of the fit
pnames = exp1.parmNames ()