Hi, ROOT experts,
I want to divide a whole array into parts and find the average value for each part by using TMath::Mean, and then save them as the elements of a vector.
I am referring to this part of the code:
vector<double> divideArrayIntoParts( const int numPoint, const int nParts, const double *array )
{
int partLength = numPoint / nParts;
vector<double> vParameter;
for (int iPart = 0; iPart < nParts; iPart++)
{
int partStart = iPart * partLength;
vParameter.push_back( TMath::Mean(partLength, array + partStart) );
}
return vParameter;
}
I don’t understand why the second argument in TMath::Mean looks like this:
TMath::Mean( partLength, array + partStart )
Why is it array + partStart
?
Is this correct or is there a more straightforward way where I can use TMath::Mean for that purpose?
Best Regards,
Jackhammer