| 1 | # $Id: readBremLPM.py,v 1.2 2008/08/22 08:16:17 schaelic Exp $
|
|---|
| 2 | # GEANT4 tag $Name: geant4-09-03-cand-01 $
|
|---|
| 3 | #
|
|---|
| 4 | # works together with BremLPMTest.cc
|
|---|
| 5 | #
|
|---|
| 6 | from ROOT import gROOT, gApplication, TFile, TCanvas
|
|---|
| 7 |
|
|---|
| 8 | # set nice style
|
|---|
| 9 | gROOT.SetStyle("Plain")
|
|---|
| 10 |
|
|---|
| 11 | # create 6 pads
|
|---|
| 12 | c1 = TCanvas('c1','CrossSection')
|
|---|
| 13 | c1.Divide(3,2)
|
|---|
| 14 |
|
|---|
| 15 | c2 = TCanvas('c2','DEDX')
|
|---|
| 16 | c2.Divide(3,2)
|
|---|
| 17 |
|
|---|
| 18 | #open root file
|
|---|
| 19 | f=TFile('eBremRel01.root')
|
|---|
| 20 | t=f.Get('info')
|
|---|
| 21 | zlink=t.GetLeaf('Z')
|
|---|
| 22 | t.Scan()
|
|---|
| 23 |
|
|---|
| 24 | #plot cross section histograms
|
|---|
| 25 | for i in range(t.GetEntries()):
|
|---|
| 26 | t.GetEntry(i)
|
|---|
| 27 | Z=int(zlink.GetValue())
|
|---|
| 28 | c1.cd(i+1)
|
|---|
| 29 | c1.GetPad(i+1).SetLogx()
|
|---|
| 30 |
|
|---|
| 31 | gR=f.Get('modelR;'+str(i+1))
|
|---|
| 32 | gR.GetHistogram().SetTitle('Z='+str(Z))
|
|---|
| 33 | gR.Draw('Alp');
|
|---|
| 34 | minR=gR.GetHistogram().GetMinimum()
|
|---|
| 35 | maxR=gR.GetHistogram().GetMaximum()
|
|---|
| 36 |
|
|---|
| 37 | g1=f.Get('model1;'+str(i+1))
|
|---|
| 38 | g1.Draw('lp');
|
|---|
| 39 | min1=g1.GetHistogram().GetMinimum()
|
|---|
| 40 | max1=g1.GetHistogram().GetMaximum()
|
|---|
| 41 |
|
|---|
| 42 | gR.SetMaximum(1.1*max(max1,maxR))
|
|---|
| 43 | gR.SetMinimum(0.9*min(min1,minR))
|
|---|
| 44 | print Z
|
|---|
| 45 |
|
|---|
| 46 | #plot dEdx histograms
|
|---|
| 47 | for i in range(t.GetEntries()):
|
|---|
| 48 | t.GetEntry(i)
|
|---|
| 49 | Z=int(zlink.GetValue())
|
|---|
| 50 | c2.cd(i+1)
|
|---|
| 51 | c2.GetPad(i+1).SetLogx()
|
|---|
| 52 | c2.GetPad(i+1).SetLogy()
|
|---|
| 53 |
|
|---|
| 54 | gR=f.Get('xDEDXR;'+str(i+1))
|
|---|
| 55 | gR.GetHistogram().SetTitle('Z='+str(Z))
|
|---|
| 56 | gR.Draw('Alp');
|
|---|
| 57 | minR=gR.GetHistogram().GetMinimum()
|
|---|
| 58 | maxR=gR.GetHistogram().GetMaximum()
|
|---|
| 59 |
|
|---|
| 60 | g1=f.Get('xDEDX1;'+str(i+1))
|
|---|
| 61 | g1.Draw('lp');
|
|---|
| 62 | min1=g1.GetHistogram().GetMinimum()
|
|---|
| 63 | max1=g1.GetHistogram().GetMaximum()
|
|---|
| 64 |
|
|---|
| 65 | # gR.SetMaximum(1.e-3)
|
|---|
| 66 | gR.SetMinimum(1.e-6*max(max1,maxR))
|
|---|
| 67 | print Z
|
|---|
| 68 |
|
|---|
| 69 | #done
|
|---|
| 70 | gApplication.Run()
|
|---|