Hi Bob, Hopefully the following explanation answers your questions.
 
1) The histogram(name) method in EventAnalyzer returns a histogram. You can do anything with that histogram that you would do with a histogram created using new Histogram(name). E.g.
 
        histogram("xyz").fill(10);
        double mean = histogram("xyz").getMean();
        Histogram xyz = histogram("xyz");
 
As you know a convenient feature of the histogram method is that you can dynamically create the title as part of your analysis, e.g.
 
        PDGID id = particle.getType().getPDGID();
        histogram("Energy-"+id).fill(particle.getEnergy());
       
2)  To extract information from a Histogram you have to first fetch the partition which is the subcomponent of the histogram that actually keeps track of the data. Use Histogram.getPartition(). There are many different types of partition, and if you didnt specify a particular type the histogram will choose one for you based on which fill method you used. (A corollary is that you should not call getPartition() until after you have filled the histogram).  Assuming you used the 1D fill methods, then the partition will be a subclass of Abstract1DPartition. Abstract1DPartition contains many methods for accessing information about the histogram (note that it is package hep.analysis.partition). Some of the information is hidden inside the getStatistics() method (see attached example).
 
There is another gotcha, teh default Partitions do not do any binning until you display the histogram. Therefore any attempt to extract information which depends on the binning will fail unless you first call Abstract1DPartition.setBinning(). IE
 
       Histogram xyz = histogram("xyz");
       Abstract1DPartition p = (Abstract1DPartition ) xyz.getPartition(); 
       p.setBinning(100,0,1);
       double[] bins = p.getBins();
       for (int i=0; i<bins.length; i++) out.println("bin["+i+"]="+bins[i]);
 
3) Since 2 is rather complicated, Histogram1D exists as a simpler alternative. It extends Histogram and adds methods for accessing information without explicitly knowing about the partition, however as you discovered you must explicitly create the Histogram1D using new Histogram1D("title"), which is not as convenient as simply using the histogram("title") method, espcially if you want to dynamically set the histogram title.
 
4) You can rename histograms with the rename method, but you must catch the RenameException, since some histograms may not support being renamed. In this instance you probably don't really want to use renaming.
 
I've attached an example which illustrates all of this.
 
Tony
-----Original Message-----
From: Robert J. Wilson [mailto:[log in to unmask]]
Sent: Friday, November 17, 2000 5:30 PM
To: lcd-sim
Subject: Extracting information from histograms.

 
Does anyone have an example of how to extract histogram information from histograms created with the EventAnalyzer histogram method. I found the information on Histogram sub-classes (Histogram1D etc.) that provides the methods I want, but I cannot get them to work (I won't bore or amuse you with my numerous attempts).  My analysis code is structured something like this:

public class MCGenAnal01 extends AbstractProcessor
{
   LCDEvent _data = null;

   public void process(LCDEvent event)
   {
       final LCDEvent data = (LCDEvent) event;
       _data = (LCDEvent) event;
     // Call the first analysis module
       MCGenAnal();

     // ... other stuff
        ......
   } // process

 void MCGenAnal()
 {
     ........
    if (something_really_interesting)
    {
     // Make lots of histograms
        histogram("Momentum of "+pname).fill(ptot);
     // Extract information like mean, and bin-by-bin entries
        ??????
    }
    .......
 }
}

Thanks.
Bob

-- 
Robert J. Wilson
Professor of Physics
Department of Physics
Colorado State University
Fort Collins, CO 80523
Phone:   (970) 491 5033
Fax:     (970) 491 7947
Email: [log in to unmask]

August 2000 - July 2001:
========================
Institut de Fisica d'Altes Energies
Universitat Autonoma de Barcelona
E-08193 Bellaterra (Barcelona)
SPAIN
Phone: (011 34) 93 581.33.22
Fax:   (011 34) 93 581.19.38
Email: [log in to unmask]
========================