package hep.aida.ref.histogram;

import hep.aida.ICloud1D;
import hep.aida.ICloud2D;
import hep.aida.ICloud3D;
import hep.aida.IHistogram1D;
import hep.aida.IHistogram2D;
import hep.aida.IHistogram3D;
import hep.aida.IManagedObject;

/**
 *
 * @author The FreeHEP team @ SLAC.
 *
 */
public abstract class HistUtils {
    
    private static double defaultLowerEdge = -1;
    private static double defaultUpperEdge = 1;
    
    /**
     * Create an IHistogram1D and fill it from an ICloud1D.
     *
     */
    public static IHistogram1D toShowableHistogram(ICloud1D cloud, int nBins, double lowerEdge, double upperEdge) {
        String name = "";
        if ( cloud instanceof IManagedObject )
            name = ( (IManagedObject) cloud ).name();
        if ( Double.isNaN(lowerEdge) )
            lowerEdge = defaultLowerEdge;
        if ( Double.isNaN(upperEdge) )
            upperEdge = defaultUpperEdge;
        
        if ( upperEdge == lowerEdge )
            upperEdge = lowerEdge + 1;
        
        IHistogram1D hist = new Histogram1D(name,cloud.title(),new FixedAxis(nBins,lowerEdge,upperEdge));
        
        for(int i=0; i 

Ads help maintain this website.