## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
dlanci
@dlanci

Dear Zfit developers,

When describing a chain decay in phasespace I may want to leave unspecified the mass of an intermediate state. I read on the Particle() instance docstring that the mass is an optional argument, but when I don't do it I get error.

Moreover I'd like to use the sampled phasespace particles as importance sampler to compute the width for the decay. How do I pass this dataset to the pdf?
Albert Puig
@apuignav
Hey
Because phasespace implements the phasespace integral, the mass of all states needs to be specified
right now it's not possible to define a particle of indefinite mass, because it doesn't make any sense mathematically
however, you could specify a function that generates randomly in a certain range
and that would generate "flat" in q
Jonas Eschle
@mayou36
It was a mistake in the docs, fixing it
dlanci
@dlanci
Albert Puig
@apuignav
@dlanci This would generate B->K* gamma l l
phasespace
dlanci
@dlanci
this is what I need, good
Jonas Eschle
@mayou36
To sample in order to do accept reject, you need to tell the pdf, what your sampler is. Therefore, you first have to build a correct sampler (@apuignav we should from zfit provide a convenient wrapper for that)
Albert Puig
@apuignav
but you want B->K*gamma(->ll) rigt?
dlanci
@dlanci
nope, B->K gamma l l is what I want. We're calculating radiative corrections to the B to K l l
Albert Puig
@apuignav
ah OK
then this is good
Jonas Eschle
@mayou36
For the importance sampling, I am trying to get a snippet
dlanci
@dlanci
Perfect. Then, since we aim to get as an output a tuple of events composed by Particle objects, the output of this phasespace sampling should be the input to the matrix element square pdf to calculate the width. As I understand the most convenient way to do this is with importance sampling
yes
thank you guys ^^
Jonas Eschle
@mayou36
About the calling, what you want in th end is a pdf you can sample from, right? But which internally samples from a phasespace?
dlanci
@dlanci
exactly
Jonas Eschle
@mayou36

So (I have to go, maybe back a little later), what you need to do is to say where the pdf should sample from. Have a look at this unittest, where a custom sampler is created: https://github.com/zfit/zfit/blob/develop/tests/test_sampling.py#L138
and have a look at the docs of accept_reject_sample

The sample you return has to have the same dims as the pdf was meant to be used. E.g. since you generate 4 particles with 4 properties, your pdf should be defined in 16 obs

Write if you have a question, otherwise we can look at it next week, yes
I unfortunately don't have a fully working snippet. It's an implemented, but not well exposed feature yet, we'll for sure improve it