Making a data arrays (Cloud) using Jaida and Java
Source code name: "jaida_Cloud.java"
Programming language: Java
Topic: Data arrays/Cloud
DMelt Version 1. Last modified: 08/18/2016. License: Pro
https://datamelt.org/code/cache/jaida_Cloud_6878.java
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.



# create and fill histograms using clouds

import hep.aida.*;
import java.util.Random;

public class jaida_Cloud
{   
   public static void main(String[] argv)
   {
      
      IAnalysisFactory af = IAnalysisFactory.create();
      ITree tree = af.createTreeFactory().create();
      IHistogramFactory hf = af.createHistogramFactory(tree);
      
      ICloud1D cl1D = hf.createCloud1D( "cl1D", "1-Dimensional Cloud", 1500, "" );
      ICloud2D cl2D = hf.createCloud2D( "cl2D", "2-Dimensional Cloud", 1500, "" );
      
      int entries = 20000;
      Random r = new Random();
      
      for ( int i = 0; i < entries; i++ )
      {
         double xval = r.nextGaussian();
         double yval = r.nextGaussian();
         double w    = r.nextDouble();
         
         cl1D.fill( xval, w );
         cl2D.fill( xval, yval, w );
      }
      
      IHistogram1D cl1DHist = cl1D.histogram();
      IHistogram2D cl2DHist = cl2D.histogram();
      
      IPlotter plotter = af.createPlotterFactory().create("Plot");
      plotter.createRegions(1,2,0);
      plotter.region(0).plot(cl1DHist);
      plotter.region(1).plot(cl2D);
      plotter.show();     
   }
}



You see the box below because you did not login.