TString and TNtuple

Hi
I need to store a TString object in a TNtuple.
I want to use the TString like a
leaf in a TNtuple.

I’m trying

TFile *f = new TFile(“file.root”,“RECREATE”);
TString alpha;
Float_t beta;
TNtuple *ntuple = new TNtuple(“ntuple”,“title”,“alpha:beta”)
ntuple->Fill(“string”,2.0)

or ntuple->Fill(stringa,2.0)
or
TString string=“stringa”;
ntuple->Fill(string,2.0)

but they don’t work.
How can I pass the TString to my ntuple?

Thanks

Hi,

TNtuple is a specialization of TTree which is designed explicitly to only handle arithmetic value. Use a TTree instead of TNtuple to store strings.

Cheers,
Philippe.