Hi @lishuwei ,
in your snippet above RDataFrame runs a different event loop every time you call GetValue() (so RDF is forced to run the event loop to produce the result). Different event loop means different realizations of the random number sequence produced by gRandom, so the Filter filters different numbers of events.
For that particular snippet you would get the same Count() value if you wrote it like this (but of course this is a bit contrived):
auto dfAfterFilter = dataFrame->Filter(filterFun, {"incidentEnergy"});
auto r1 = dfAfterFilter.Count();
auto r2 = dfAfterFilter.Count();
auto r3 = dfAfterFilter.Count();
cout<< "counts: "<< r1.GetValue()<<endl;
cout<< "counts: "<< r2.GetValue()<<endl;
cout<< "counts: "<< r3.GetValue()<<endl;
Hi @lishuwei ,
I am not sure I understand this latest question. Do you want to not apply the filter when you evaluate the mean? In that case you can just call dataframe.Mean instead of dfAfterFilter.Mean.