storing histogramms

From: Florian Schopper (fls@mpe.mpg.de)
Date: Wed Jan 27 1999 - 12:14:41 MET


Dear Rooters,

we encountered a probably simple problem, which we couldn't find in
the roottalk list, though.

When we allocate Histogramms with new in the constructor of MChip,
and store the MChip class into a root-file,
we get a segmentation violation error when accessing the restored 
histogramms.

Is it necessary to write a default constructor for MChip which allocates
the histogramms again?

            thanks,
                  Florian


class  MChip : public TObject
{
private:

TH1F   *CommonModeHist;
TH1F   *NHitHist;

public:
  MChip(){}
 
  MChip(Int_t nChannel, TString Appelation );

ClassDef(MChip,1)
} ;



The Constructor looks something like that:

MChip::MChip(Int_t N, TString Appelation)
{
CommonModeHist  = new TH1F("CommonMode","CommonMode",50,-25.0,25.0); 
 CommonModeHist->SetDirectory(0);
 NHitHist        = new TH1F("NHits","Number of Hits",10,0,10);
 HitHist->SetDirectory(0);
 
}




----------------------------------------------------------------------
Florian Schopper                     office: Max-Plank-Institut fuer
                                             extraterrestrische physik
Ludwig-Merk str. 3                           Postfach 1603
80805 Muenchen                               Giessenbachstr.
phone: 49/89/3226157                         Garching bei Muenchen

                                             phone: 49/89/3299 3625
                                               fax: 49/89/3299 3569
                                            e-mail: fls@mpe-garching.mpg.de
                                              http://home.cern.ch/~fschoppe
----------------------------------------------------------------------
-----------------------------------------------------------------------
                                   
          



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