Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:31:59

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 import hep.aida.*;
0027 import java.util.Random;
0028 import java.io.IOException;
0029 
0030 /*
0031    Small plotter example
0032    compile with (provided aida is in your CLASSPATH variable)
0033       % javac plotResults.java
0034       % java -cp .:$CLASSPATH plotResult
0035 
0036 */
0037 
0038 
0039 public class plotResults 
0040 {
0041    public static void main(String[] argv) throws IOException
0042       {
0043       String fileName="Pol01.aida";
0044       if (argv.length>0) {
0045           fileName=argv[0];
0046           System.out.println("using file name "+fileName);
0047       }
0048 
0049       IAnalysisFactory af = IAnalysisFactory.create();
0050       ITree tree = af.createTreeFactory().create(fileName,"xml");
0051       
0052       IHistogram1D h1 = (IHistogram1D) tree.find("1");
0053       IHistogram1D h2 = (IHistogram1D) tree.find("2");
0054       IHistogram1D h3 = (IHistogram1D) tree.find("3");
0055       IHistogram1D h4 = (IHistogram1D) tree.find("4");
0056 
0057       IPlotterFactory pf  = af.createPlotterFactory();
0058       IPlotter plotterPhoton = pf.create("Photon");
0059       plotterPhoton.createRegions(2,2);
0060       plotterPhoton.region(0).plot(h1);
0061       plotterPhoton.region(1).plot(h2);
0062       plotterPhoton.region(2).plot(h3);
0063       plotterPhoton.region(3).plot(h4);
0064       plotterPhoton.show();
0065 
0066       IHistogram1D h5 = (IHistogram1D) tree.find("5");
0067       IHistogram1D h6 = (IHistogram1D) tree.find("6");
0068       IHistogram1D h7 = (IHistogram1D) tree.find("7");
0069       IHistogram1D h8 = (IHistogram1D) tree.find("8");
0070 
0071       IPlotter plotterElectron = pf.create("Electron");
0072       plotterElectron.createRegions(2,2);
0073       plotterElectron.region(0).plot(h5);
0074       plotterElectron.region(1).plot(h6);
0075       plotterElectron.region(2).plot(h7);
0076       plotterElectron.region(3).plot(h8);
0077       plotterElectron.show();
0078 
0079       IHistogram1D h9 = (IHistogram1D) tree.find("9");
0080       IHistogram1D h10 = (IHistogram1D) tree.find("10");
0081       IHistogram1D h11 = (IHistogram1D) tree.find("11");
0082       IHistogram1D h12 = (IHistogram1D) tree.find("12");
0083 
0084       IPlotter plotterPositron = pf.create("Positron");
0085       plotterPositron.createRegions(2,2);
0086       plotterPositron.region(0).plot(h9);
0087       plotterPositron.region(1).plot(h10);
0088       plotterPositron.region(2).plot(h11);
0089       plotterPositron.region(3).plot(h12);
0090       plotterPositron.show();
0091    }
0092 }