Including none-TObjects

From: Rutger van der Eijk (r36@nikhef.nl)
Date: Fri Mar 20 1998 - 16:58:07 MET


Hi All,

I'm having problems including some none-TObjects into a (root)shared
library.

I have a simple Event class (MTRawEvent) declared as follows:
(some members not shown for clarity):

---- MTRawEvent.H ----
#ifndef _MTRawEvent_H_
#define _MTRawEvent_H_

#include "TObject.h"
#include "MTRawHit.H"


class MTRawEvent: public TObject {
public:
  MTRawEvent(); // create uninitialized

  void SetRawHit(MTRawHit rawHit); // temp set hit as long as not array...
  MTRawHit GetRawHit() const; // temp get the single raw hit

  virtual ~MTRawEvent();                  // destroy Event-object

  ClassDef(MTRawEvent, 1) // RawEvent class
private:
  MTRawHit fRawHit; // raw hit
};


#endif // _MTRawEvent_H_
---- ----

It contains a MTRawHit object as datamember, which is NOT a TObject:

---- MTRawHit.H ----
#ifndef _MTRawHit_H_
#define _MTRawHit_H_

#include "MTChannelId.H"


class MTRawHit {
public:
  MTRawHit(MTChannelId channelId = 0, Int_t tdcValue = 0);
  
  MTChannelId GetChannelId() const; // get channel id
  Int_t GetTDCValue() const;   // get TDC value
  
  ~MTRawHit();                      // destroy Hit-object
  
private:
  MTChannelId fChannelId; // channel Id
  Int_t fTDCValue; // TDC value
};

#endif // _MTRawHit_H_
---- ----

It contains as datamembers a Int_t and another none-TObject class
MTChannelId.

My problem:

The MTRawEvent I (ofcourse) want to somewhere put in a TTree and a TFile.
With rootcint I can then create the appropriate Streamer methods for
classes inheriting from TObject. From reading the ROOT tutorial and
'course' and browsing the web-pages it doesn't become completely clear
to me what the best procedure is to handle none-TObject classes. 

My questions:

- Should I (manually) write Streamer (and ShowMember) member functions for
the none-TObjects (MTRawHit and MTChannelId) or should I only modify the
TObject MTRawEvent?
- If I write (or modify) a Streamer member function definition should I
also put the declaration in the class declaration? Actually I don't
understand why this seems NOT to be necesarry for TObjects...
- Should I include classes of the none-TObjects in the linkdef.h file
(with #pragma link C++ class MTChannelId-; (or with also '!' ?))

I would appriciate any help and/or simple-example ,

Rutger van der Eijk



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