Re: problem with TClonesArray

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Feb 23 1998 - 18:10:44 MET


You forgot to add the lines:
   ClassDef(Track,1)    in track.h
and
   ClassImp(Track)       in track.cpp

See examples in $ROOTSYS/test/Event

Rene Brun


rene Scholte wrote:
> 
> hello,
> 
> I've made my own class Track consisting of a header-file Track.h and its
> implementation code track.cpp.
> 
> this is track.h :
> ------------------------------
> 
> #ifndef TRACK
> #define TRACK
> 
> class Track: public TObject {
> 
> private :
> 
>          UInt_t PulseHeight;
>          UInt_t ChannelNumber;
>          UInt_t DataValid;
>          UInt_t OverPedestal;
> 
> public :
> 
>             Track(ULong_t value);
>                 ~Track() {;}
>         UInt_t GetPulseheight()   {return PulseHeight;}
>         UInt_t GetChannelnumber() {return ChannelNumber;}
>         UInt_t GetDatavalid()     {return DataValid;}
>         UInt_t GetOverpedestal()  {return OverPedestal;}
> };
> 
> #endif
> -----------------------------
> 
> and this is my track.cpp :
> -------------------------------
> #include "track.h"
> 
> void Track::Track(ULong_t value)
> {
>  PulseHeight=(value >> 0 & ~(~0 << 12));
>  ChannelNumber=(value >> 0 & ~(~0 << 23));
>  DataValid=(value >> 0 & ~(~0 << 31));
>  OverPedestal=(value >> 0 & ~(~0 << 32));
> }
> -------------------------------------------
> 
> Then I try to make a TClonesarray in the root interpreter, but the
> TClonesArray  returns an error saying he doesn't find the class :
> --------------------
> 
> D:\rene\reroca>root
>  the current keyboard layout is 437
>   *******************************************
>   *                                         *
>   *        W E L C O M E  to  R O O T       *
>   *                                         *
>   *   Version   1.03/09  16 December 1997   *
>   *                                         *
>   *  You are welcome to visit our Web site  *
>   *          http://root.cern.ch            *
>   *                                         *
>   *******************************************
> 
> CINT/ROOT C/C++ Interpreter version 5.13.36, Nov 30 1997
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> root [0] .L track.cpp
> root [1] a=TClonesArray("Track",10)
> Error in <TClonesArray::TClonesArray>: Track is not a valid class name
> (class TClonesArray)10406072
> root [2]
> -----------------------
> 
> both the track.h and the track.cpp are in the same directory
> 
> I'm running root for under windows NT 4.
> 
> What am i doing wrong here ?
> 
> thanx in advance,
> 
> Rene



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:30 MET