[ROOT] TArrayD in Classes

From: Andre Holzner (Andre.Holzner@cern.ch)
Date: Sun Nov 26 2000 - 15:46:23 MET


Hello,

maybe this is a trivial question. I'm using root 2.26/00 of 7 November
2000
on Linux.

I have a file ClDrawer.C:

#include <TArrayD.h>

class ClDrawer
{
public:
  ClDrawer();
  
  int num_events;               // number of selected events

  TArrayD *mass_values;      // mass points

  
};

//----------------------------------------------------------------------

ClDrawer::ClDrawer()
{
  num_events = 20;

  mass_values = new TArrayD(num_events);
  mass_values->Set(num_events);

  printf("filling in %d events\n",num_events);

  int i;
  for (i=0; i<num_events; ++i)
    {
      printf("  Event %d\n",i);
      (*mass_values)[i] = 0;
    }

  printf("done filling\n");
}


After starting root, I run

root [0]  .L ClDrawer.C
root [1]  ClDrawer *cldrawer = new ClDrawer;
filling in 20 events
  Event 0
  Event 1
done filling
root [2] 

i.e. the loop stops after the second event instead of filling in all 20.

If I comment out the line
 (*mass_values)[i] = 0;


I get the output up to Event 19.


What am I doing wrong ?



thanks,


Andre


-- 
------------------+----------------------------------
Andre Holzner     | +41 22 76 76750 
Bureau 32 2-C13   | Building 32     
CERN              | Office 2-C13    
CH-1211 Geneve 23 | http://wwweth.cern.ch/~holzner/



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:38 MET