Re: [ROOT] colour "scatter" plots : 3D

From: Valeri Fine (Faine) (fine@bnl.gov)
Date: Tue Feb 20 2001 - 20:09:42 MET


to plot 3D hits/tracks STAR

http://www.star.bnl.gov/afs/rhic/star/doc/www/imagelib/event_images/ROOT/Run1230070Event5256.gif

uses the "3D polymarkers" and "class TColoredAxis"

I think the TColoredAxis  can be useful for the  ROOT users.

See the the piece of the code as example:

Int_t StDefaultFilter::CreatePalette(TTable *obj)
{
   if (!obj) return 0;
   // Create lookup table
   Int_t lookUpSize = sizeof(mDeLookUp);
   mNbins = lookUpSize/sizeof(mDeLookUp[0]);

   Float_t low, high;
   if (mColorAxis) delete mColorAxis;
   TString str = obj->GetType();
   if (mDedx) {
     low  = STFLowEnergy  = 0;
     high = STFHighEnergy = 0.000005;
   } else {
     low  = STFLowEnergy  = 0.1;
     high = STFHighEnergy = 5;
   }
//   mColorAxis = new TColoredAxis(0.9,-0.95,0.9,0.95,low,high);
   mColorAxis = new TColoredAxis(0.9,-0.95,0.9,0.95,low,high,mDeLookUp,mNbins);
   TH1F de("__de__","dedx",mNbins,low,high);

      if (mDedx)
        Distribution((St_dst_dedx *)obj,de);
      else
        Distribution((St_dst_track *)obj,de);

   Double_t  s = de.ComputeIntegral();
   Int_t hSize = mNbins;
   if (s > 0) {
     Double_t *f = de.GetIntegral();
     for (hSize = 0; hSize < mNbins; hSize++) {
       mDeLookUp[hSize] = f[hSize]/s;
       if ( mDeLookUp[hSize] > 0.995) break; // Look for the rightmost non-zero bin
     }
   } else

     TCL::vzero(mDeLookUp,hSize+1);
   }
   // Corect edges
   high = STFHighEnergy = de.GetBinCenter(hSize);
   mColorAxis = new TColoredAxis(0.9,-0.95,0.9,0.95,low,high,mDeLookUp,hSize+1);
   if (mDedx)
     mColorAxis->SetTitle("tracks color = F(de/dx)");
   else
     mColorAxis->SetTitle("tracks color = F(momentum)");

   mlookFactor = 1./de.GetBinWidth(1);
   mColorAxis->SetTitleSize(0.025);
   mColorAxis->SetTextColor(14);
   mColorAxis->SetLabelColor(14);
   mColorAxis->SetLabelSize(0.02);
   mColorAxis->SetLineColor(14);
   mColorAxis->Draw();
   return 0;
}



----- Original Message -----
From: K. Hauschild <karlhaus@hep.saclay.cea.fr>
To: <roottalk@pcroot.cern.ch>
Sent: 20 февраля 2001 г. 13:10
Subject: [ROOT] colour "scatter" plots : 3D


> Dear All,
>
> I have a 3D histogram with the frequency of an event
> occuring in a particular voxel store in x,y,z.
>
> I would like to plot the contents of each x,y,z voxel
> in a colour coded manner much like the 2D "colz" option.
>
> Is this possible ?
>
> Thanks,
>
> Karl
> ==========================================================================
>
> 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 : Tue Jan 01 2002 - 17:50:37 MET