Re: TObjArray & Tokenizer

From: Andreas Adelmann <andreas.adelmann_at_psi.ch>
Date: Tue, 22 Nov 2011 15:19:25 +0100


Thanks Axel that was exactly what I was looking for. Andreas
On Nov 22, 2011, at 2:20 PM, Axel Naumann wrote:

> Hi Andreas,
> 
> use:
> Double_t val0 = ((TObjString*)d->At(0))->String().Atof();
> 
> Cheers, Axel.
> 
> 
> Andreas Adelmann wrote on 11/22/2011 02:02 PM:

>> Hello I try to uses the Tokenizer on a TString
>>
>> char line(CHRLEN);
>>
>> .....
>>
>> TString s(line);
>> TObjArray *d = s.Tokenize(TString(" "));
>>
>> s contains floats (0.000034177 0.000074050 0.000136709 0.000233544
>> 0.000267721) with a spaces as delimiter.
>>
>> d->Print() shows me that all my number are no in TObjString, as expected.
>>
>> Collection name='TObjArray', class='TObjArray', size=128
>> TObjString = 0.000034177
>> ......
>>
>> Now my plan was to use the Sting() function of TObjString and finally
>> convert them into Double_t in order to add the values to a histogram.
>>
>> However I could not fin out how to convert d[i] -> TObjString or even
>> better d[i] -> Double_t.
>>
>> Thanks for the help, Andreas
>> ------
>> Dr. sc. math. Andreas (Andy) Adelmann
>> Staff Scientist
>> Paul Scherrer Institut WLGB/132 CH-5232 Villigen PSI
>> Phone Office: xx41 56 310 42 33 Fax: xx41 56 310 31 91
>> Phone Home: xx41 62 891 91 44
>> -------------------------------------------------------
>> Thursdays: ETH CAB H 83.1 +41 44 632 36 72
>> ============================================
>> The more exotic, the more abstract the knowledge,
>> the more profound will be its consequences.
>> Leon Lederman
>> ============================================
>>
>>
>>


Dr. sc. math. Andreas (Andy) Adelmann
Staff Scientist
Paul Scherrer Institut WLGB/132 CH-5232 Villigen PSI Phone Office: xx41 56 310 42 33 Fax: xx41 56 310 31 91 Phone Home: xx41 62 891 91 44

Thursdays: ETH CAB H 83.1 +41 44 632 36 72

The more exotic, the more abstract the knowledge, the more profound will be its consequences. Leon Lederman
Received on Tue Nov 22 2011 - 15:20:05 CET

This archive was generated by hypermail 2.2.0 : Tue Nov 22 2011 - 17:50:01 CET