Hi Danilo,
thank you so much for your detailed reply, it should be enough for me to solve the problem but I didn’t anticipate the complexity, the situation seems a little bit more complicated. What I really have is not a single TTree variable, but a combination, two leafs from a branche, branch name is pid and the leaf names are day and sec, therefore what I need is a constraint on pid.day+pid.sec/86400. to be within a time window of t - N/2 and t + N/2, and the TTree variable, the leaf that I am filling is pid.var1, will your:
auto filtFunc = [N](double t){ return (t > t - .5 * N) && (t < t + .5 * N);}
can be changed to:
auto filtFunc = [N](int day, int sec){ return (pid.day+pid.sec/86400. > t - .5 * N) && (pid.day+pid.sec/86400. < t + .5 * N);}
Something tells me this won’t work, because of the defining, (int day, int sec), nothing is telling that these are leafs from the branch pid. But somehow, if that gets fixed, then:
auto h = rdf.Filter(filtFunc, {"t"}).Histo1D<Var1_t>({"name","title",nbin, min, max}, "var1");
changed to:
auto h = rdf.Filter(filtFunc, {"pid.day+pid.sec/86400."}).Histo1D<Var1_t>({"name","title",nbin, min, max}, "pid.var1");
Will this work?
Additional part, I am actually going to fill two TH1Fs h1 and h2 and add them to get a third TH1F let’s say H (this I can easily achieve by first defining H with the same binning and size and then successively adding h and h2 to it. h1, h2 will be filled with leafs var1 and var2 from two different branches pid1 and pid2 and constraints on 2 different variables will be used, on pid1.day+pid1.sec/86400. and pid1.day+pid1.sec/86400. ))
Please help me with that filFunc step.
-a