Re: LocMax

From: James Jackson <james.jackson_at_cern.ch>
Date: Sat, 13 Jun 2009 12:35:07 +0100


Hi Roger,

Looking at the documentation, the index variable should contain the length of the array (i.e. 3 - otherwise the method does not know how long the array is), and the method will return the index of the maximum, so you should do this:

Double_t tpz[3] = {10.0, 20.0, 30.0};
std::cout << "Max at index " << TMath::LocMax(3, tpz) << std::endl;

Regards,
James.

On 13 Jun 2009, at 12:16, Roger Mason wrote:

>
> Hello,
>
> I trying to use LocMax as follows:
>
> { // max.C
> Double_t tpz[3] = {10.0,20.0,30.0};
> Long64_t index;
> TMath::LocMax(index,tpz);
> cout << " Max z is at " << index << endl;
>
> }
> // ROOT 5.20/00 (trunk_at_24524, May 17 2009, 10:14:00 on linux)
>
> The result is:
>
> root [0] .x max.C
> Max z is at 0
>
> What am I doing wrong?
>
> Thanks,
> Roger
>
Received on Sat Jun 13 2009 - 13:35:17 CEST

This archive was generated by hypermail 2.2.0 : Sat Jun 13 2009 - 17:50:02 CEST