If this is not super performance-critical code, you can use the generic:
std::vector<ROOT::RDF::RResultPtr<double>> means(1088);
std::string branchName = "AnodeCurrent";
for (int i = 0; i < 1088; ++i) {
means[i] = df.Define("x", branchName + "[" + std::to_string(i) + "]")
.Mean("x");
}
for (auto m : means)
std::cout << m.GetValue() << '\n';
And you can have several branch names in a vector<string>
and have an outer loop over those.
If you need a version tweaked for performance we can work that out too, it will just require a bit more characters
Cheers,
Enrico