Re: [ROOT] Problems Defining a Class

From: Chris Hayward (cchaywar@umich.edu)
Date: Mon Jun 30 2003 - 12:14:14 MEST


Hi Rene,
Thanks for the help. I guess I've been using IDL for too long. I've fixed
the array initializations, but I am still having problems. I've tried to
follow the Event.h example. When I type
#include "Chamber.h"
there is only the following warning:
Warning: Interpreted class Chamber derived from precompiled class TObject
FILE:Chamber.h LINE:7
!!!There are some limitations regarding compiled/interpreted class
inheritance

When I try to define a Chamber object, ROOT crashes and I get the lxplus
command line. There are no error messages. I have tried to generate the
dictionary by the command:
rootcint ChamberDict.cxx Chamber.h+
This seems to have worked, so I am not sure if I have left something out,
declared my class wrong, or made some other error. The Chamber.h and
Chamber.cxx files are attached below.

Thank you for your help,
Chris

Chamber.h:

#include <iostream.h>
#include "TObject.h"
#include <string.h>

class TDirectory;    //I've added this because it was in Event.h; is it
                     //necessary?

class Chamber : public TObject {

  public:

    const int maxscans=20;    //const to determine array size

    char chamber_type[10];    //this info read from scan filenames
    char site[6];
    int serial_no;
    char section[maxscans];   //array of maxscans strings to allow for
maxscans
    char orientation[maxscans];
    int scan_no[maxscans];

    int ch_sag_1;      //sag of chamber, wires, and difference for section
1
    int wire_sag_1;
    int sag_diff_1;

    int ch_sag_2;      //sag of chamber, wires, and difference for section
2
    int wire_sag_2;
    int sag_diff_2;

    int tool[maxscans];      //data to be read from each scan
    int side[maxscans];

    int theta_x[maxscans];
    int S_z[maxscans];
    int S_y_corrected[maxscans];
    int S_y_raw[maxscans];
    int S_y_correction[maxscans];
    float rms[maxscans];

    Chamber();

    ClassDef (Chamber, 1);
};





Chamber.cxx:

#include "Chamber.h"
ClassImp (Chamber);

Chamber::Chamber()
{
  chamber_type[0]=site[0]='\0';
  section[0]=orientation[0]='\0';

serial_no=ch_sag_1=wire_sag_1=sag_diff_1=ch_sag_2=wire_sag_2=sag_diff_2=0;
  for (int i=0; i < maxscans; i++) {
    scan_no[i]=tool[i]=side[i]=theta_x[i]=S_z[i]=
      S_y_corrected[i]=S_y_raw[i]=S_y_correction[i]=0;
    rms[i]=0.0;
  };
}



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET