Copy histogram in sub-range

Dear expert,

is there an option to “copy” an histogram only in a sub-range?
If I have h1 btw [0, 10] I want h2, an “independent copy” of h1 only on the range [2, 8]. I do not want that h2 has any information on the value outside this range, so a SetLimit(int, int) will not work.
Basically a code were I would read value of h1 btw[0, 10], and fill h2 only when h1 value is btw [2, 8]…

Is there such an option or is there a root macro to do that?


Copy /pasting your question in Google gives:

Dear Couet,

ok, thank you for your answer.