[Home] Restricted access for guests. The link to Java source code is disabled
Java source code of 'jhplot.io.FileAida'
/**
* Copyright (C) DataMelt project. The jHPLot package by S.Chekanov and Work.ORG
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program;
* if not, see .
*
* Additional permission under GNU GPL version 3 section 7:
* If you have received this program as a library with written permission from the DataMelt team,
* you can link or combine this library with your non-GPL project to convey the resulting work.
* In this case, this library should be considered as released under the terms of
* GNU Lesser public license (see ),
* provided you include this license notice and a URL through which recipients can access the
* Corresponding Source.
**/
package jhplot.io;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import jhplot.gui.HelpBrowser;
import hep.aida.IAnalysisFactory;
import hep.aida.IManagedObject;
import hep.aida.ITree;
/**
* Open an AIDA file and retrieve objects for plotting.
* Used to read AIDA files
*
* @author S.Chekanov
*
*/
public class FileAida {
private IAnalysisFactory af = null;
private ITree itree = null;
/**
* Create object to read AIDA file. Read only mode.
*
* @param file
* Input AIDA file
*/
public FileAida(String file) {
load(file, true);
}
/**
* Create object to read AIDA file. Read only mode.
*
* @param file
* Input AIDA file
* @param readOnly
*/
public FileAida(String file, boolean readOnly) {
load(file, readOnly);
}
/**
* Create FileAida
*/
public FileAida() {
}
/**
* Load a AIDA file
*
*
* @param f input file
* @param readOnly - only read
*/
public void load(String file, boolean readOnly) {
try {
File f = new File(file);
af = IAnalysisFactory.create();
itree = af.createTreeFactory().create(f.getAbsolutePath(), "xml", readOnly);
} catch (IOException e) {
// e.printStackTrace();
jhplot.utils.Util.ErrorMessage("Error in openning file");
}
}
/**
* Load a AIDA file
*
*
* @param f input file
* @param readOnly - only read
*/
public void load(File f, boolean readOnly) {
try {
af = IAnalysisFactory.create();
itree = af.createTreeFactory().create(f.getAbsolutePath(), "xml", readOnly);
} catch (IOException e) {
// e.printStackTrace();
jhplot.utils.Util.ErrorMessage("Error in openning file");
}
}
/**
* Get object associated with the key name
*
* @param skey
* key name
* @return Object
*/
public Object get(String skey) {
Object ob = itree.find(skey);
return ob;
}
/**
* List name of the objects inside trees
* @return object types
*/
public String[] listObjectNames() {
return itree.listObjectNames();
}
/**
* Get list of all objects
* @param a path
* @return list of all objects
*/
public ArrayList getAllNames(String a) {
ArrayList ar = new ArrayList();
String[] s = itree.listObjectNames();
for (int i=0; i getAllNames() {
ArrayList ar = new ArrayList();
String[] s = itree.listObjectNames();
for (int i=0; i getAllTypes() {
ArrayList ar = new ArrayList();
String[] s = itree.listObjectTypes();
for (int i=0; i getAllTypes(String a) {
ArrayList ar = new ArrayList();
String[] s = itree.listObjectTypes();
for (int i=0; i getAll() {
ArrayList ar = new ArrayList();
String[] s = itree.listObjectNames();
for (int i=0; i