if __name__ == '__main__': from ROOT import TTree, TRandom3 from array import array from plotting.Variable import Variable, Binning from AtlasStyle import redLine, blueLine, greenLine # create some dummy tree rndm = TRandom3() size = array( 'f', [0] ) energy = array( 'f', [0] ) t = TTree( 'tree', 'My Tree' ) t.Branch( 'size', size, 'size/F' ) t.Branch( 'energy', energy, 'energy/F' ) for entry in xrange( 10000 ): size[0] = rndm.Poisson( 3 ) energy[0] = rndm.Landau( size[0]*2.5, size[0] ) t.Fill() # define a variable object for each branch sizeVar = Variable( 'size', title='Cluster Size', binning=Binning(10, 1, 11, range(1,11)) ) energyVar = Variable( 'energy', title='Hit Energy', unit='MeV', binning=Binning(50, 0, 100) ) p = BasicPlot( 'test', sizeVar, Variable( 'RMS(E)', unit = 'MeV' ) ) measure = HalfWidth() measure.selection = Truncate( 0.68 ) g = p.addGraph( resolutionGraph( t, sizeVar, energyVar, '', measure ) ) p.draw() g.Draw() raw_input( 'Continue?' )
from plotting.BasicPlot import BasicPlot var = Variable( 'ditau_tau0_decay_mode', 'ditau_tau0_decay_mode', 'Decay Mode (#tau_{0})', '', Binning(6, 0, 6, ['1p0n', '1p1n', '1pXn', '3p0n', '3pXn', 'Other'])) h = var.createHistogram('h_test') h.Fill(2) h.Fill(3) h.Fill(2) h.Fill(0) h.Fill(2) g = histToGraph(h, 'g_test') g.SetLineColor(2) #g = addGraphs( g, g, True ) p = BasicPlot('test', var) p.addHistogram(h) p.addGraph(g, '0') p.draw() interrupt() import time for i in xrange(35): progressBarInt(i + 1, 35, 'index: %d' % i) time.sleep(0.01)