ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plotResults.java
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file plotResults.java
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 import hep.aida.*;
27 import java.util.Random;
28 import java.io.IOException;
29 
30 /*
31  Small plotter example
32  compile with (provided aida is in your CLASSPATH variable)
33  % javac plotResults.java
34  % java -cp .:$CLASSPATH plotResult
35 
36 */
37 
38 
39 public class plotResults
40 {
41  public static void main(String[] argv) throws IOException
42  {
43  String fileName="Pol01.aida";
44  if (argv.length>0) {
45  fileName=argv[0];
46  System.out.println("using file name "+fileName);
47  }
48 
49  IAnalysisFactory af = IAnalysisFactory.create();
50  ITree tree = af.createTreeFactory().create(fileName,"xml");
51 
52  IHistogram1D h1 = (IHistogram1D) tree.find("1");
53  IHistogram1D h2 = (IHistogram1D) tree.find("2");
54  IHistogram1D h3 = (IHistogram1D) tree.find("3");
55  IHistogram1D h4 = (IHistogram1D) tree.find("4");
56 
57  IPlotterFactory pf = af.createPlotterFactory();
58  IPlotter plotterPhoton = pf.create("Photon");
59  plotterPhoton.createRegions(2,2);
60  plotterPhoton.region(0).plot(h1);
61  plotterPhoton.region(1).plot(h2);
62  plotterPhoton.region(2).plot(h3);
63  plotterPhoton.region(3).plot(h4);
64  plotterPhoton.show();
65 
66  IHistogram1D h5 = (IHistogram1D) tree.find("5");
67  IHistogram1D h6 = (IHistogram1D) tree.find("6");
68  IHistogram1D h7 = (IHistogram1D) tree.find("7");
69  IHistogram1D h8 = (IHistogram1D) tree.find("8");
70 
71  IPlotter plotterElectron = pf.create("Electron");
72  plotterElectron.createRegions(2,2);
73  plotterElectron.region(0).plot(h5);
74  plotterElectron.region(1).plot(h6);
75  plotterElectron.region(2).plot(h7);
76  plotterElectron.region(3).plot(h8);
77  plotterElectron.show();
78 
79  IHistogram1D h9 = (IHistogram1D) tree.find("9");
80  IHistogram1D h10 = (IHistogram1D) tree.find("10");
81  IHistogram1D h11 = (IHistogram1D) tree.find("11");
82  IHistogram1D h12 = (IHistogram1D) tree.find("12");
83 
84  IPlotter plotterPositron = pf.create("Positron");
85  plotterPositron.createRegions(2,2);
86  plotterPositron.region(0).plot(h9);
87  plotterPositron.region(1).plot(h10);
88  plotterPositron.region(2).plot(h11);
89  plotterPositron.region(3).plot(h12);
90  plotterPositron.show();
91  }
92 }