1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * License and Disclaimer * |
---|
4 | // * * |
---|
5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
7 | // * conditions of the Geant4 Software License, included in the file * |
---|
8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
9 | // * include a list of copyright holders. * |
---|
10 | // * * |
---|
11 | // * Neither the authors of this software system, nor their employing * |
---|
12 | // * institutes,nor the agencies providing financial support for this * |
---|
13 | // * work make any representation or warranty, express or implied, * |
---|
14 | // * regarding this software system or assume any liability for its * |
---|
15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
16 | // * for the full disclaimer and the limitation of liability. * |
---|
17 | // * * |
---|
18 | // * This code implementation is the result of the scientific and * |
---|
19 | // * technical work of the GEANT4 collaboration. * |
---|
20 | // * By using, copying, modifying or distributing the software (or * |
---|
21 | // * any work based on the software) you agree to acknowledge its * |
---|
22 | // * use in resulting scientific publications, and indicate your * |
---|
23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
24 | // ******************************************************************** |
---|
25 | // |
---|
26 | // $Id: plotResults.java,v 1.3 2006/12/13 15:42:42 gunter Exp $ |
---|
27 | import hep.aida.*; |
---|
28 | import java.util.Random; |
---|
29 | import java.io.IOException; |
---|
30 | |
---|
31 | /* |
---|
32 | Small plotter example |
---|
33 | compile with (provided aida is in your CLASSPATH variable) |
---|
34 | % javac plotResults.java |
---|
35 | % java -cp .:$CLASSPATH plotResult |
---|
36 | |
---|
37 | */ |
---|
38 | |
---|
39 | |
---|
40 | public class plotResults |
---|
41 | { |
---|
42 | public static void main(String[] argv) throws IOException |
---|
43 | { |
---|
44 | String fileName="pol01.aida"; |
---|
45 | if (argv.length>0) { |
---|
46 | fileName=argv[0]; |
---|
47 | System.out.println("using file name "+fileName); |
---|
48 | } |
---|
49 | |
---|
50 | IAnalysisFactory af = IAnalysisFactory.create(); |
---|
51 | ITree tree = af.createTreeFactory().create(fileName,"xml"); |
---|
52 | |
---|
53 | IHistogram1D h1 = (IHistogram1D) tree.find("1"); |
---|
54 | IHistogram1D h2 = (IHistogram1D) tree.find("2"); |
---|
55 | IHistogram1D h3 = (IHistogram1D) tree.find("3"); |
---|
56 | IHistogram1D h4 = (IHistogram1D) tree.find("4"); |
---|
57 | |
---|
58 | IPlotterFactory pf = af.createPlotterFactory(); |
---|
59 | IPlotter plotterPhoton = pf.create("Photon"); |
---|
60 | plotterPhoton.createRegions(2,2); |
---|
61 | plotterPhoton.region(0).plot(h1); |
---|
62 | plotterPhoton.region(1).plot(h2); |
---|
63 | plotterPhoton.region(2).plot(h3); |
---|
64 | plotterPhoton.region(3).plot(h4); |
---|
65 | plotterPhoton.show(); |
---|
66 | |
---|
67 | IHistogram1D h5 = (IHistogram1D) tree.find("5"); |
---|
68 | IHistogram1D h6 = (IHistogram1D) tree.find("6"); |
---|
69 | IHistogram1D h7 = (IHistogram1D) tree.find("7"); |
---|
70 | IHistogram1D h8 = (IHistogram1D) tree.find("8"); |
---|
71 | |
---|
72 | IPlotter plotterElectron = pf.create("Electron"); |
---|
73 | plotterElectron.createRegions(2,2); |
---|
74 | plotterElectron.region(0).plot(h5); |
---|
75 | plotterElectron.region(1).plot(h6); |
---|
76 | plotterElectron.region(2).plot(h7); |
---|
77 | plotterElectron.region(3).plot(h8); |
---|
78 | plotterElectron.show(); |
---|
79 | |
---|
80 | IHistogram1D h9 = (IHistogram1D) tree.find("9"); |
---|
81 | IHistogram1D h10 = (IHistogram1D) tree.find("10"); |
---|
82 | IHistogram1D h11 = (IHistogram1D) tree.find("11"); |
---|
83 | IHistogram1D h12 = (IHistogram1D) tree.find("12"); |
---|
84 | |
---|
85 | IPlotter plotterPositron = pf.create("Positron"); |
---|
86 | plotterPositron.createRegions(2,2); |
---|
87 | plotterPositron.region(0).plot(h9); |
---|
88 | plotterPositron.region(1).plot(h10); |
---|
89 | plotterPositron.region(2).plot(h11); |
---|
90 | plotterPositron.region(3).plot(h12); |
---|
91 | plotterPositron.show(); |
---|
92 | } |
---|
93 | } |
---|