RE: TClonesArray typecasting

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Tue, 14 Nov 2006 13:06:09 -0600


Hi,

You should write:

     ((TH1F *) bigArr[chan])->Fill(j, value);

Cheers,
Philippe

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of George Locke
Sent: Tuesday, November 14, 2006 12:17 PM To: roottalk
Subject: [ROOT] TClonesArray typecasting

Hey all,

This is a simple question. i'm using the latest root (5.13.04) on windows 2000, compiling with visual C++ 2005 (aka msvc 8).

i filled a TClonesArray with TH1F's, and now i want to fill the histograms.

this code returns the error "'Fill' : is not a member of 'TObject'" (TH1F *) bigArr[chan]->Fill(j, value);

what should i write instead?

for context:
i declared the TClones array with this line: TClonesArray bigArr("TH1F", 8);

and i filled it with this line:
new(bigArr[chan]) TH1F(name,title,HIST_SIZE,0,HIST_SIZE);

Thanks for answering such a simple question, George Received on Tue Nov 14 2006 - 20:07:09 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:02 MET