Diego,
TH1 is the base class for all histogram classes. You cannot make
an instance of this class directly. Use TH1F, etc.
If you want to create an array of pointers to histograms, use
something like
TH1F *hlist = new TH1F*[number_of_histograms]
> but I get an error:
>
> cxx: Error: AMSTOFHist.cxx, line 667: In this statement, the referenced
> type of the pointer value
> "new TH1 ...((TH1 ...)gAMSDisplay->GetRootFile()->Get(string))" is
> "pointer to TH1", which is not compatible with "TH1".
> histvec[max%12][i]=new
> TH1*((TH1*)gAMSDisplay->GetRootFile()->Get(string));
> ----^
>
> Another question.
> If I understand, each TH1 object has a unique string identifier.
> I create with "new" many TH1 objects, within different calls of a static
> function. I guess that if I create an object of TH1 with the same name
> (string) as an existing one, I will not allocate additional space with
> "new" but I will overwrite the existing one. At least I hope... if not my
> application will use more and more memory...
>
When an histogram is created with the name of an already existing
histogram, the old histogram is replaced by the new definition
and a WARNING message is printed. This only in the case of
histograms in the same directory. You can have histograms
with the same name in different directories.
Rene Brun