Convolutions and problems at the edges of the intervals

Dear All,

I am doing an angular analysis using RooFit and I need to make several convolutions in my code, with different kinds of variables (cyclic and not-cyclic) and functions. As I have some doubts of how to use the convolutions in a proper way, I wanted to find advice from you.


First, I need to convolute a function representing the proper time t (exp(-t/tau)) with a resolution model (Gaussian). In an example I got, the gaussian is defined as a RooGaussModel and the .convolution method is used to obtain the convolution :

t = RooRealVar(“t”, “time”, -0.15, 10. )
mean = RooRealVar(“mean”, “mean(t resol)”, 0., -0.05, 0.05)
sigma = RooRealVar(“sigma”, “sigma(t resol)”, 0.039, 0.01, 0.1 )
tres = RooGaussModel(“tres”,“prop time resolution”, t, mean, sigma)

and then (in an .src file written in C++) :
RooFormulaVar decay = new RooFormulaVar(decay,
“exp(-@0/@1)”,
RooArgList(t,tau));
RooAbsReal
Conv = tres.convolution(decay,&t);

With this method, I am not sure how the values of the proper time t close to zero are treated. Because of the convolution, there will be some values becoming negative and I don’t know if I should consider this as relevant given the sigma of the gaussian (how to know?)? [ I see that t is defined from -0.15 and I was also wondering if it is how the problem of the negative convoluted values is tackled ? At the same time, I would avoid negative times in my fit, which are not physical…] Or, should I care about these values and do something else to re-include them in the physical range ?

*******************************************************************************************************"
Then, I need to convolute my total pdf (called “mypdf” below) containing angular functions (phi, cos(theta), cos(psi) ) with their resolution functions (Gaussians). I wanted to use the RooFFTConvPdf method, for example in the case of phi :

phi = RooRealVar(“phi”, “#phi”, -pi , pi )
mean_phi = RooRealVar(“mean_phi”,“mean_phi”,0)
sigma_phi = RooRealVar(“sigma_phi”,“sigma_phi”,0.027)
resol_phi = RooGaussian(“resol_phi”,“phi resolution”,phi,mean_phi,sigma_phi)
mypdfconv= RooFFTConvPdf(“mypdfconv”,“mypdfconv”,phi,mypdf,resol_phi)

I have the same question as previously concerning the values close to +/- pi, which can go outside of the interval when being convoluted. However, I think the RooFFTConvPdf method takes care of such problems with cyclic variables (as in the case of phi above), please correct me if I am wrong. However, I need to convolute also on cos(theta) and cos(psi), defined in the range [-1,1] :

ctheta = RooRealVar(“ctheta”,“cos(#theta)”, -1.0, 1.0)
cpsi = RooRealVar(“cpsi”, “cos(#psi)”, -1.0, 1.0)

How is the problem treated with RooFFTConvPdf in this case (as they are non cyclic)? Is the problem also solved somehow ? Or should I use some other methods for it?

Another question I wanted to address is that, for example in the phi case mentioned above, the interval is very big (-pi pi) compared to the sigma of the Gaussian (0.027) I’m using. In principle, I do not define bins when convoluting and apparently, everything is fine in the sense that I don’t receive any error message when convoluting and creating my final pdf. I was however wondering if such a convolution was correctly done or if I should for some physical reason restrict my interval for the convolution ?


Thank you very much in advance for your help,
Best Greetings,

Géraldine

Hi Géraldine,
For the proper time convolution, you should use RooDecay, or RooBDecay, that handles this business for you. There is no problem for negative t events as those are useful in determining the properties of the gaussian.

For your second problem, I cannot help.

Cheers.

Hi,

Concerning the second problem.

  1. Write your p.d.f. as M(psi) (x) R(psi) and then apply a coordinate transformation
    psi->cos(psi).

    While this is trivial for most RooFit p.d.f.s it is not for a RooFFTConvPdf because
    it insists on a RooRealVar as input rather than a RooAbsReal for the convolution
    observable (for good reasons). I am working a solution for this right now.
    I note that RooHistPdf and RooKeysPdf suffer from the same issue for
    the same reasons and will be adjusted at the same time.

  2. I think the solution can be the following. If you look at the tranformation
    psi->cos(psi) you see that if you ‘revolve’ F(psi) over the domain boundary what
    happens in the cos(psi) coordinate frame is that it is mirrored as cos(pi+alpha) =
    cos(pi - alpha), so the correct solution might be to use the ‘mirror’ buffer strategy
    option in RooFFTConvPdf

      RooFFTConvPdf::setBufferStrategy(RooFFTConvPdf::Mirror) ;
    

    I have not thoroughly checked the math of this, so you should do so yourself before
    trying this idea. If you are interested in using this feature you will need to check out
    the dev/roostats branch of ROOT
    (svn co root.cern.ch/svn/root/branches/dev/roostats)
    and compile that as this is recent feature that will only be in the next release of
    ROOT.

I will get back to you on the first issue in a couple of days.

Wouter

Hi,

I have committed a new version of RooFFTConvPdf to the dev/roostats branch that allows to perform a coordinate transformation after the convolution.

This allows you to write your angular p.d.f. as convolution of a p.d.f. in psi with a resolution in psi and then transform it to observable cos(psi). In this way the circular convolution is performed correctly in terms of the angle psi, but the final p.d.f. is expressed in cos(psi).

The resulting plots show you the unsmeared p.d.f T expressed in cos(psi) as the blue line. In red is the pdf M expressed in cos(psi) – that is T smeared by R in the angle psi – and was fitted to the data.

Wouter

// Define angle psi
RooRealVar psi(“psi”,“psi”,0,3.14159268) ;

// Define physics p.d.f T(psi)
RooGenericPdf T(“T”,“1+sin(2*@0)”,psi) ;

// Define resolution R(psi)
RooRealVar gbias(“gbias”,“gbias”,0.2,0.,1) ;
RooRealVar greso(“greso”,“greso”,0.3,0.1,1.0) ;
RooGaussian R(“R”,“R”,psi,gbias,greso) ;

// Define cos(psi) and function psif that calculates psi from cos(psi)
RooRealVar cpsi(“cpsi”,“cos(psi)”,-1,1) ;
RooFormulaVar psif(“psif”,“acos(cpsi)”,cpsi) ;

// Define physics p.d.f. as function of cos(psi): T(psif(cpsi)) = T(cpsi) ;
RooGenericPdf Tf(“T”,“1+sin(2*@0)”,psif) ;

// Define convoluted p.d.f. as function of cos(psi): M=T(x)R = M(cpsi)
RooFFTConvPdf Mf(“Mf”,“Mf”,psif,psi,T,R) ;
Mf.setBufferFraction(0) ;

// Generate some events
RooDataSet* dataf = Mf.generate(cpsi,10000) ;

// Fit convoluted model as function of cos(psi)
Mf.fitTo(*dataf) ;

// Plot cos(psi) frame with T(cpsi) and M(cpsi)
RooPlot* cframe = cpsi.frame() ;
dataf->plotOn(cframe) ;
Tf.plotOn(cframe) ;
Mf.plotOn(cframe,LineColor(kRed)) ;

cframe->Draw() ;