hep.analysis
Class Job

java.lang.Object
  |
  +--hep.analysis.Job

public class Job
extends java.lang.Object

A Job is used as a container for Histograms, Pages, Plots etc. When running in a GUI environment the Job is normally implicitly created for you. When running in standalone (or batch) mode you should create the Job yourself. The Job has methods for

Here is a very simple example:
 import hep.analysis.*;
 import java.util.Random;
 
 public class StandaloneTest
 {
    public static void main(String[] argv)
    {
       Random random = new Random();
       Job job = new Job("Test Job");
       Histogram hist = new Histogram("Gaussian Test");
       for (int i=0; i<10000; i++) hist.fill(random.nextGaussian());
 	
       job.dump();
       job.save("test.javahist");
    }
 }
 


Constructor Summary
Job(java.lang.String name)
          Create a job
 
Method Summary
 void addEventAnalyzer(EventAnalyzer analyzer)
          Add an event analyzer to this job.
 void dump()
          Produces a dump of all the NamedObjects (such as histograms) created during the current job.
 void dump(java.io.PrintWriter out)
          Produces a dump of all the NamedObjects (such as histograms) created during the current job.
 void go()
          Run the Job.
 void go(int n)
          Run the job for a specified maximum number of events.
 void removeAllEventAnalyzers()
          Remove all the event analyzers from this job.
 void removeEventAnalyzer(EventAnalyzer analyzer)
          Remove an event analyzer.
 void rewind()
          Rewind the event source to the beginning and, by default, clear all of the histograms in the job.
 void save()
          Saves all the NamedObjects (such as Histograms) in this job to disk.
 void save(java.io.File file)
          Save all the NamedObjects (such as Histograms) in this job to disk.
 void save(java.io.ObjectOutputStream out)
          Save all the NamedObjects (such as Histograms) in this job.
 void save(java.lang.String fileName)
          Save all the NamedObjects (such as Histograms) in this job to disk.
 void setEventSource(EventSource source)
          Add an event source to this job.
 void step()
          Run the jon for a single event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Job

public Job(java.lang.String name)
Create a job
Parameters:
The - name for the job
Method Detail

setEventSource

public void setEventSource(EventSource source)
Add an event source to this job. Each job can have only one event source at a time. Adding a new event source will replace any existing event source.
Parameters:
The - EventSource to add

addEventAnalyzer

public void addEventAnalyzer(EventAnalyzer analyzer)
Add an event analyzer to this job. Any number of event analyzers can be attached to a job. They will be called in the order they were added.
Parameters:
analyzer - The EventAnalyzer to add

removeEventAnalyzer

public void removeEventAnalyzer(EventAnalyzer analyzer)
Remove an event analyzer.
Parameters:
analyzer - The EventAnalyzer to remove

removeAllEventAnalyzers

public void removeAllEventAnalyzers()
Remove all the event analyzers from this job.

go

public void go()
Run the Job. The job will run until the event source throws an EndOfDataException.

step

public void step()
Run the jon for a single event.

go

public void go(int n)
Run the job for a specified maximum number of events. The job will run until n events have been analyzed, or the event source throws an EndOfDataException.

rewind

public void rewind()
Rewind the event source to the beginning and, by default, clear all of the histograms in the job.
See Also:
Histogram.setClearOnRewind(boolean), HistogramFolder.setClearOnRewind(boolean)

save

public void save()
Saves all the NamedObjects (such as Histograms) in this job to disk. The file will be called .javahist

save

public void save(java.lang.String fileName)
Save all the NamedObjects (such as Histograms) in this job to disk.
Parameters:
fileName - The name of the file to create. By convention the filetype should be .javahist.

save

public void save(java.io.File file)
Save all the NamedObjects (such as Histograms) in this job to disk.
Parameters:
file - The file to create. By convention the filetype should be .javahist.

save

public void save(java.io.ObjectOutputStream out)
          throws java.io.IOException
Save all the NamedObjects (such as Histograms) in this job.
Parameters:
out - An ObjectOutputStream to write the Histograms to.
See Also:
save(File), save(String)

dump

public void dump()
Produces a dump of all the NamedObjects (such as histograms) created during the current job. The dump is send to the default output stream.

dump

public void dump(java.io.PrintWriter out)
Produces a dump of all the NamedObjects (such as histograms) created during the current job.
Parameters:
out - The PrintWriter to write to