[ROOT] Problems Defining a Class

From: Chris Hayward (cchaywar@umich.edu)
Date: Fri Jun 27 2003 - 18:58:38 MEST


I am trying to define a class called Chamber. Right now it is simply all
public variables and the constructor. However, I have been getting a lot
of errors. I am running ROOT 3.05/05 on lxplus. I type into the command
line:

#include "Chamber.h"
Chamber *chamber = new Chamber();

I get errors of the following type for all the variables I define:
Error: Incorrect assignment to site, wrong type 'char' FILE:Chamber.h
LINE:35
Error: Incorrect assignment to chamber_type, wrong type 'char'
FILE:Chamber.h LINE:35

This occurs for the Int_t and Float_t variables also. I believe that I
have defined my class as in the user guide, but it does not work. Please
tell me what I should do. The interface and implementation files are
below.

Thanks,
Chris

Chamber.h

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

class Chamber : public TObject {

  public:

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

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

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

    Int_t tool[20];      //data to be read from each scan
    Int_t side[20];

    Int_t theta_x[20];
    Int_t S_z[20];
    Int_t S_y_corrected[20];
    Int_t S_y_raw[20];
    Int_t S_y_correction[20];
    Float_t rms[20];

    Chamber(){
      chamber_type=site='';
      section=orientation='';

serial_no=ch_sag_1=wire_sag_1=sag_diff_1=ch_sag_2=wire_sag_2=sag_diff_2=0;
scan_no=tool=side=theta_x=S_z=S_y_corrected=S_y_raw=S_y_correction=0;
      rms=0.0;
    };

    ClassDef (Chamber, 1);
};



Chamber.cxx

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



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