[1199] | 1 | global tree, hf |
---|
| 2 | |
---|
| 3 | tree = tf.create("comptonhisto.hbook",1,1,"hbook") |
---|
| 4 | tree.thisown=1 |
---|
| 5 | hf = af.createHistogramFactory(tree) |
---|
| 6 | |
---|
| 7 | # ... and load them into memory: |
---|
| 8 | hEKin = tree.findH1D("10") |
---|
| 9 | hP = tree.findH1D("20") |
---|
| 10 | hNSec = tree.findH1D("30") |
---|
| 11 | hDeposit = tree.findH1D("40") |
---|
| 12 | hTheta = tree.findH1D("50") |
---|
| 13 | hPhi = tree.findH1D("60") |
---|
| 14 | |
---|
| 15 | # set plotter to 3*2 zones |
---|
| 16 | pl.createRegions(3,2) |
---|
| 17 | |
---|
| 18 | # ... and plot the histograms |
---|
| 19 | pl.plot(hEKin ) ; pl.show() ; pl.next() |
---|
| 20 | pl.plot(hP ) ; pl.show() ; pl.next() |
---|
| 21 | pl.plot(hNSec ) ; pl.show() ; pl.next() |
---|
| 22 | pl.plot(hDeposit) ; pl.show() ; pl.next() |
---|
| 23 | pl.plot(hTheta ) ; pl.show() ; pl.next() |
---|
| 24 | pl.plot(hPhi ) ; pl.show() ; pl.next() |
---|
| 25 | |
---|
| 26 | wait() |
---|
| 27 | |
---|
| 28 | # reset number of zones |
---|
| 29 | pl.createRegions(2,1) |
---|
| 30 | |
---|
| 31 | # helper function |
---|
| 32 | def nplot(tup, col, cut, xmin, xmax, nbins=100): |
---|
| 33 | global hf |
---|
| 34 | h1 = hf.create1D("1000000","temp hist", nbins, xmin, xmax) |
---|
| 35 | colId = tup.findColumn(col) |
---|
| 36 | bNextRow=tup.start() # Looping over the tuple entries |
---|
| 37 | while bNextRow: |
---|
| 38 | h1.fill(tup.getFloat(colId)) |
---|
| 39 | bNextRow=tup.next() # Retrieving the subsequent row |
---|
| 40 | pl.plot(h1) ; pl.show() ; pl.next() |
---|
| 41 | tree.rm("1000000") |
---|
| 42 | return |
---|
| 43 | |
---|
| 44 | # get the primary ntuple from the NtupleManager |
---|
| 45 | nt1 = tree.findTuple("1" ) |
---|
| 46 | |
---|
| 47 | # plot a few quantities using the shortcut |
---|
| 48 | nplot(nt1,"initen" ,"",0,20) |
---|
| 49 | nplot(nt1,"dedx" ,"",0.,100) |
---|
| 50 | |
---|
| 51 | # prompt user for <return> |
---|
| 52 | wait() |
---|
| 53 | |
---|
| 54 | # get the secondaries ntuple and plot a few attributes from it |
---|
| 55 | nt2 = tree.findTuple("2" ) |
---|
| 56 | nplot(nt2, "parttyp", "", 0., 42) |
---|
| 57 | nplot(nt2, "e" , "", 0., 100.) |
---|
| 58 | |
---|
| 59 | pl.write("secondaries.ps", "ps") |
---|
| 60 | |
---|
| 61 | tree.commit() |
---|
| 62 | tree.close() |
---|
| 63 | del tree |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | |
---|