Re: Inspect custom classes, TClass::BuildRealData

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sun Aug 01 1999 - 08:41:02 MEST


Hi Norbert,
Is your MTanalysis class interpreted or compiled?
Remember than interpreted classes cannot derive from compiled
classes (in your case TNamed). You can derive from compiled classes
provided you do not call interactively functions of this class.

Rene Brun

On Fri, 1 Mar 1940, Norbert Danneberg wrote:

> Hi ,
> 
> we use a custom class wich is a extended version of the TTree::MakeClass
> output as a basic analysis class.
> In this class the BranchAddresses are set and the leafs declared. In a
> custom analysis class, derived from
> this basic class one has only to set the BranchStatus of the desired
> branches and implement the ::Evaluate
> function.
> 
> Somehow the TObject::Inspect Function produces a segmentation vioaltion
> in CINT. I traced down the
> problem to the TClass::BuildRealData Function which seams to have
> problems with some of the leaves in
> MTAnalysis. I do not have an clue why. Only the variables indicated
> below (STREAMED) are persistent.
> But even if I do not stream any of those variables the TObject::Inspect
> does not work, although it should
> print at least the persistent variables of TNamed.
> 
> Besides this "Inspect" problem the class works as expected.
> 
> Any help is welcome
> 
> Norbert
> 
> 
> class MTAnalysis: public TNamed{
> public:
>   TList* Histograms;   // List of Histograms in this class   STREAMED
>   TTree* Events;      //! Pointer to the analyzed Tree
>   MTDetector* MuPTDetector; //!
>   Float_t FoilZ;// STREAMED
>   Float_t BgoWallZ;// STREAMED
>   Int_t ActEventNumber; //! Actual EventNumber;
> 
>   //Declaration of leaves types
>   Int_t           EventNumber;//!
>   UShort_t        TypeOfEvent;//!
>   Float_t         TotalEnergy;//!
>   Float_t         CenterEnergyX;//!
>   Float_t         CenterEnergyY;//!
>   Float_t         PhiWall34;//!
>   Float_t         AlphaWall134;//!
> 
> ..
> 
> public:
>   MTAnalysis();
>   MTAnalysis(Text_t* Name, Text_t* Title, TTree* Events);
>   ~MTAnalysis();
>   virtual void Init(){;}
>   virtual void SetBranchAddresses();
>   virtual void EnableBranches();
>   Int_t GetEvent(Int_t event);
>   void SetBgoWallZPos(Float_t z) {BgoWallZ = z;}
>   virtual void CreateHistos();
>   void CreateHistoList();
>   virtual void StartAnalysis();
>   virtual void Analysis(Int_t nentries);
>   virtual Bool_t Evaluate(){return TRUE;}
>   virtual Int_t Loop(Int_t nentries);
>   virtual void FillHistos(){;}
>   virtual void EndAnalysis();
>   //virtual void Draw();
>   virtual void Browse(TBrowser *b);
>   virtual TList* GetHistograms(){return Histograms;}
>   virtual TTree* GetTree(){return Events;}
>   virtual void Show(Int_t event);
>   ClassDef(MTAnalysis,1) //Base class for other analysis classes
> };
> 
> 
> Default Constructor:
> 
> MTAnalysis::MTAnalysis(){
>   Events=NULL;
>   Histograms=NULL;
>   MuPTDetector=gExperiment->GetDetector();
>   FoilZ = gExperiment->GetDetector()->GetFoilZPos();
>   BgoWallZ = gExperiment->GetDetector()->GetBgoWallZPos();
>   ActEventNumber =0;
>   this->SetName("MTAnalysis");
>   this->SetTitle("MTAnalysis");
> }
> 
> --
> 
> Norbert Danneberg
> 
> ETH Zurich - Institute for Particle Physics
>   Laboratory for Nuclear Physics          Phone.: +41-1-633-2034
>   Hoenggerberg                            Fax.:   +41-1-633-1067
>   CH-8093 Zurich
> 
> 
> ETH Zurich - Institute for Particle Physics
>   Paul Scherrer Institute                 Phone.: +41-56-310-3284
>   CH-5232 Villigen PSI                    Fax.:   +41-56-310-4362
> 
> email: Norbert.Danneberg@psi.ch
> 
> 



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