zfit / phasespace

Phase space generation implemented in TensorFlow
https://phasespace.rtfd.io
BSD 3-Clause "New" or "Revised" License
24 stars 9 forks source link

Encance decaychain constructor #68

Closed jonas-eschle closed 2 years ago

jonas-eschle commented 2 years ago

Improvement of the constructor: In practice I would always define the zfit parameter via something like this example I posted at some point in this review:

from decaylanguage import DecayMode, DecayChain
dm1 = DecayMode(1, 'K- pi+ pi+ pi0', model='PHSP', zfit="rel-BW")
dm2 = DecayMode(1, 'gamma gamma')
dc = DecayChain('D+', {'D+':dm1, 'pi0':dm2})

(It is not the same as your example but the point I want to make is obvious.)

This makes me think that it may be rather relevant to enhance this constructor to provide the ability to specify a map between particle and model. In your case I could simply have an argument of the kind particle_model_map={"D0":"gauss"} and the step above would be done internally, which is so much better for the user. Of course this would imply that all D0 get the same model, and one would need to define aliases if wanting to differentiate 2 D0's, but that's no different to what decay files do, so not an issue at all,

You may want to delay this to a follow-up MR. Dunno, up to you.

_Originally posted by @eduardo-rodrigues in https://github.com/zfit/phasespace/pull/63#discussion_r744602497_

eduardo-rodrigues commented 2 years ago

Hi @simonthor, can I ask you whether you would be interested to work on this enhancement? Otherwise I will try and work on this in the last week before Xmas (after LHCb week as @jonas-eschle would probably guess ;-)).

simonthor commented 2 years ago

Currently I unfortunately have quite a lot to work on at my university but I might have some time in mid- to late December, i.e., at roughly the same time that you planned to work on it.

eduardo-rodrigues commented 2 years ago

Not a problem. Thanks for the reply.

eduardo-rodrigues commented 2 years ago

Closing given the work merged in via PR https://github.com/zfit/phasespace/pull/71.