Add pdf with different range?

Hi All, I am thinking how to add two pdf with different range? Suppose pdf1 is a pdf function describe observable x in range [0,5], pdf2 is another function describe the same observable x in range [2,7]. Can I use RooAddPdf or something else to add these two pdf together?

I can only think of generate two data sets in each range for each pdf function, then add two data sets together. Like

RooRealVar x("x","x",-10,10) ;
RooGenericPdf pdf1 ("pdf1","pdf1","...","...");
RooGenericPdf pdf2 ("pdf2","pdf2","...","...");
x.setRange[0,5];
Roodataset *data1 = pdf1.generate(x,5000);
x.setRange[2,7];
Roodataset *data2 = pdf2.generate(x,5000);
data1->append(*data2);

But I have no idea how to add the pdf function together if they do not have the same range. Could someone help me out? Thanks a lot

I’m running into a similar issue. Is there a solution for this?

I wonder if this makes sense mathematically. How can you add two functions that are not defined on the same range?
Would something like multiplying with a heavyside function make sense? In that case, both functions could have the same definition range, but they would be zero outside of a range that can be set by the user.

Could you explain a bit more about the use case?