Re: [ROOT] CalssDef, ClassImp

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Thu Oct 19 2000 - 18:57:27 MEST


Hi Peter,

  have a look at: http://root.cern.ch/root/Using.html and the link
at the bottom of that page. In short you have to run rootcint to generate
the dictionary and the missing functions.

Cheers, Fons.


Peter H Fisher wrote:
> 
> Hi,
> 
> Where are the usages of ClassImp and ClassDef documented?  I am trying to
> use my own class and I have included ClassDef and ClassImp as shown in the
> Event.cxx and Event.h examples, but I keep getting
> 
> MyEvent::ShowMembers(TMemberInspector&, char*)
> MyEvent::Streamer(TBuffer&)
> MyEvent::Class_Name(void)
> make: *** [treefill] Error 1
> 
> My .C and .h files are appended below.
> 
> Peter
> 
> MyEvent.h:
> 
> #ifndef ROOT_MyEvent
> #define ROOT_MyEvent
> 
> #include "TObject.h"
> #include "TClonesArray.h"
> #include "TH1.h"
> #include "TMath.h"
> 
> #include <iostream.h>
> 
> class TDirectory;
> 
> class MyEvent : public TObject {
> 
> public:
>   MyEvent();          // Create
>   MyEvent(Int_t run, Int_t event, Int_t nhit); // Load header
>   Int_t Run();
>   Int_t Event();
>   Int_t Nhit();
>   void Dump();
> 
>   ClassDef(MyEvent,0)
> 
> private:
>   Int_t the_run;
>   Int_t the_event;
>   Int_t the_nhit;
> };
> #endif
> 
> MyEvent.C:
> 
> //
> // Mthods for MyEvent
> //
> #include "TROOT.h"
> #include "TFile.h"
> #include "TH1.h"
> #include "TH2.h"
> #include <iostream.h>
> #include "MyEvent.h"
> 
> ClassImp(MyEvent)
> 
> MyEvent::MyEvent(){
> }
> 
> MyEvent::MyEvent(Int_t run, Int_t event, Int_t nhit){
>   the_run=run;
>   the_event=event;
>   the_nhit=nhit;
> }
> 
> Int_t MyEvent::Run(){
>   return the_run;
> }
> 
> Int_t MyEvent::Event(){
>   return the_event;
> }
> 
> Int_t MyEvent::Nhit(){
>   return the_nhit;
> }
> 
> void MyEvent::Dump(){
>   printf("Dump of this event\n");
>   printf("Run %d Event %d\n",the_run,the_event);
>   printf("Tracker hits %d\n",the_nhit);
> }
> 
> Peter Fisher                                   Office 617-253-8561
> Associate Professor of Physics                 Fax    617-253-4100
> 44-118 MIT                                     email  fisherp@mit.edu
> Cambridge, MA, 02139

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



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