Error message when Write()ing a vector<TH1*>

Hello,

I have a class that contains a vector<TH1*>. When I Write() the class to a file and read it back, it appears to work but I also get messages of:
Error in TClass::New: cannot create object of class TH1

Is there something I can do to remove these messages? I’ve attached a simple compiled macro that reproduces the error message. Thanks!
test_vector_hist.C (621 Bytes)

Oops, that was using ROOT 5.24b on OS X 10.6.1, although I also saw the error on ROOT 5.17 on Scientific Linux 4.x.

Hi,

Thank for reporting this issue.
To work around it, use a vector of TH1F*.

Cheers,
Philippe.

Hi,

This problem is fixed by revision 30890 of the trunk,

Cheers,
Philippe.

Do you mean only put TH1Fs into the vector? Unfortunately, the file I’m reading into the vector has both TH1Fs and TH1Ds. Or do you mean use a TH1F* even for the TH1Ds? Does this even work, since it is not the base class of TH1D?

Is there an easy way to construct a TH1D from a TH1F (same internals, just copy the floats to doubles)? That would present an easier solution when reading in the file.

Thanks for fixing it in future versions though! :smiley:

[quote]Do you mean only put TH1Fs into the vector? Unfortunately, the file I’m reading into the vector has both TH1Fs and TH1Ds.[/quote]Humm, no. If you have both then your option are only either to ignore the message or to upgrade to the head of the trunk (or to patch your download of ROOT with the patch I made in revision 30890).

Cheers,
Philippe.