Giter Club home page Giter Club logo

Comments (10)

eduardo-rodrigues avatar eduardo-rodrigues commented on June 14, 2024

Thanks @admorris for creating this work task / enhancement idea following our chats within LHCb. Thanks also for the links. I was not aware of all of those and this is bound to be interested and relevant.

You know already that I like the idea of the extension since specifications of decays such as B0 -> pi+ pi- make sense and are very much used in Flavour Physics experiments. We should try and provide at least a basis "for everyone", as generic as possible. Once we integrate with the rest then all package functionality can be exploited for free ...

On the spot I would say that it would make sense to draft something say as a descriptor/ submodule under
https://github.com/scikit-hep/decaylanguage/tree/master/src/decaylanguage, in the same way that we have dec/ to deal with .dec decay files and decay to define decay chain classes.

@henryiii, I hope you also like these ideas :-).

We should try and see if Belle-II colleagues could be interested in this. Let me start by pinging usual suspects such as @daritter and @GiacomoXT (feel free to ping other colleagues).

from decaylanguage.

eduardo-rodrigues avatar eduardo-rodrigues commented on June 14, 2024

We can also think about doing matching and substitution (which we also have functionality for in the Ntuple Wizard) but there it's less clear to me how easy it is to support different conventions from different experiments/packages.

This is indeed a bit trickier. Depends on how much can be generic and how much needs to be experiment specific. Else we can have things defined via a sort of "backend", and using for example the "LHCb backend" would bring in some functionality not necessarily available generically. Just thinking out loud here.

from decaylanguage.

eduardo-rodrigues avatar eduardo-rodrigues commented on June 14, 2024

Hi @admorris, shall we try and move forward with this nice addition? Such a module will be super useful also for run-3 DaVinci, hence I'm very keen. Let me know whether you will have a bit of time for this. I'm happy to help.

from decaylanguage.

admorris avatar admorris commented on June 14, 2024

In #331 I add a function that writes "LHCb-style" decay descriptors e.g. D*+ -> (D0 -> K- pi+) pi+

I identify 3 things that could be made configurable:

  • -> arrow (vs =>, --> etc)
  • round braces without internal spaces () for sub-decays (can foresee [], {} ... plus versions with spacing)
  • mother of sub-decay within braces, i.e. (D0 -> K- pi+) vs D0 (-> K- pi+)

from decaylanguage.

admorris avatar admorris commented on June 14, 2024

I guess to allow for the most flexibility, this could be achieved with some kind of global configuration where the user specifies format-strings with named variables:

# LHCb LoKi style
descriptor_config = {
    "decay_pattern": "{mother} -> {daughters}",
    "sub_decay_pattern": "({mother} -> {daughters})",
}
# Belle DecayString style 
descriptor_config = {
    "decay_pattern": "{mother} -> {daughters}",
    "sub_decay_pattern": "[{mother} -> {daughters}]",
}
# Some other style 
descriptor_config = {
    "decay_pattern": "{mother} --> {daughters}",
    "sub_decay_pattern": "{mother} (--> {daughters})",
}

from decaylanguage.

eduardo-rodrigues avatar eduardo-rodrigues commented on June 14, 2024

Yes, sounds simple enough to me. Good idea!

from decaylanguage.

admorris avatar admorris commented on June 14, 2024

The configuration is implemented in abc1bfd

I chose to make a class with __enter__ and __exit__ methods so you can do with statements:

    >>> with DescriptorFormat("{mother} --> {daughters}", "[{mother} --> {daughters}]"): dc.to_string()
    ...
    'D*+ --> [D0 --> [K_S0 --> pi+ pi-] [pi0 --> gamma gamma]] pi+'
    >>> with DescriptorFormat("{mother} => {daughters}", "{mother} (=> {daughters})"): dc.to_string();
    ...
    'D*+ => D0 (=> K_S0 (=> pi+ pi-) pi0 (=> gamma gamma)) pi+'
    >>> dc.to_string()
    'D*+ -> (D0 -> (K_S0 -> pi+ pi-) (pi0 -> gamma gamma)) pi+'

Or call DescriptorFormat.set_config directly (which checks that the provided patterns contain the correct named-wildcards)

from decaylanguage.

eduardo-rodrigues avatar eduardo-rodrigues commented on June 14, 2024

Very nice, thank you!

from decaylanguage.

ryuwd avatar ryuwd commented on June 14, 2024

So, is this completed?

from decaylanguage.

eduardo-rodrigues avatar eduardo-rodrigues commented on June 14, 2024

Hi @ryuwd from across an LHCb-internal discussion where this is relevant ;-).

The work (modulo little enhancements possible) is done in one direction but the reverse-problem implementation is missing.
For an example from a "DecayLanguage" decay chain to a descriptor see https://github.com/scikit-hep/decaylanguage/blob/master/tests/utils/test_utilities.py. What we now miss, handy for LHCb, is that you pick up an arbitrarily complex descriptor and spit out the decaying particle and chains with subdecays. As said, a lot already exists in the LHCb Ntuple Wizard but needs some work to be exported out to everyone.

[As you see I continue developing stuff but have limited bandwidth ;-) @admorris made a significant contribution in these matters 👍 !]

from decaylanguage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.