[ROOT] Multiple histos/matrices

From: Karl Hauschild (karlhaus@hep.saclay.cea.fr)
Date: Tue Mar 27 2001 - 19:08:30 MEST


Hi,

I want to increment histograms and matrices (2D histograms)
for NDET similar detectors.

A simple, but tedious,  solution would be

switch( Id ) {
case 1 :
  hTime_Det1->Fill(Time[1]);
  hEnergy_v_Pos_Det1->Fill(Energy[1],Position[1]);
  break;
case 2 :
  hTime_Det2->Fill(Time[2]);
  hEnergy_v_Pos_Det2->Fill(Energy[2],Position[2]);
  break;
 :
 :
default : break;
}


In other analysis packages I use one can increment 2D histograms
based on the detector id in the following way

for(i = 1; i <= NDetHit; i++) {
  Id = Det_Id[i];
  inc_Time(Id, Time[Id]);
  inc_Energy_v_Pos(Id, Energy[Id], Position[Id]);
}

Is something simialr available in ROOT ?

This would also apply to the histogram definitions :

eg definitions like :

HISTO Time           1D NHISTS=NDET XLEN=4096
HISTO Energy_v_Pos   2D NHISTS=NDET XLEN=XXXX YLEN=YYYY

How does one do this with ROOT ? I would not want to define
more than a few histograms in the following way :

TH2S *hEnergy_v_Pos_Det1 = new TH2S("Energy_v_Pos_Det1"......)
TH2S *hEnergy_v_Pos_Det2 = new TH2S("Energy_v_Pos_Det2"......)

Many thanks,

Karl Hauschild
==========================================================================

CEA Saclay, DAPNIA/SPhN                Phone  : (33) 01 69 08 7553
Bat 703 - l'Orme des Merisiers         Fax    : (33) 01 69 08 7584
F-91191 Gif-sur-Yvette                 E-mail :  khauschild@cea.fr
France                                           karl_hauschild@yahoo.co.uk
                                       WWW: http://www-dapnia.cea.fr/Sphn



This archive was generated by hypermail 2b29 : Fri Jun 08 2001 - 11:51:21 MEST