Belle II Software development
DecayStringGrammar< Iterator > Struct Template Reference

This class describes the grammar and the syntax elements of decay strings. More...

#include <DecayStringGrammar.h>

Inheritance diagram for DecayStringGrammar< Iterator >:

Public Attributes

boost::spirit::qi::rule< Iteratorreserved
 Reserved characters that are not allowed in particle names or labels.
 
boost::spirit::qi::rule< Iterator, DecayStringParticle(), boost::spirit::unicode::space_type > particle
 Particle in the decay string: 'selector name label'.
 
boost::spirit::qi::rule< Iterator, std::string(), boost::spirit::unicode::space_type > selector
 Particles can be selected by preceding '^' symbol.
 
boost::spirit::qi::rule< Iterator, std::string(), boost::spirit::unicode::space_type > label
 Label that can be attached to a particle name, separated by the '/' symbol.
 
boost::spirit::qi::rule< Iterator, std::string(), boost::spirit::unicode::space_type > arrow
 Allowed arrow types.
 
boost::spirit::qi::rule< Iterator, std::string(), boost::spirit::unicode::space_type > keyword
 Syntax keyword.
 
boost::spirit::qi::rule< Iterator, std::vector< std::string >(), boost::spirit::unicode::space_type > keywordlist
 The list of the keywords.
 
boost::spirit::qi::rule< Iterator, DecayStringDecay(), boost::spirit::unicode::space_type > decay
 Syntax of a decay: 'mother arrow daughters ...'.
 
boost::spirit::qi::rule< Iterator, DecayStringDecay(), boost::spirit::unicode::space_type > daughterdecay
 Syntax of decaying daughter particle.
 
boost::spirit::qi::rule< Iterator, DecayString(), boost::spirit::unicode::space_type > daughter
 A daughter particle which can be either a plain particle or a decaying particle.
 
boost::spirit::qi::rule< Iterator, std::vector< DecayString >(), boost::spirit::unicode::space_type > daughterlist
 The list of the daughters, i.e.
 
boost::spirit::qi::rule< Iterator, DecayString(), boost::spirit::unicode::space_type > start
 The rule where the parser starts.
 

Detailed Description

template<typename Iterator>
struct Belle2::DecayStringGrammar< Iterator >

This class describes the grammar and the syntax elements of decay strings.

It is used to parse a given decay string to C++ structs which are then used to initialise the DecayDescriptor class.

User documentation is located at analysis/doc/DecayDescriptor.rst Please modify it according to introduced changes.

Definition at line 30 of file DecayStringGrammar.h.

Constructor & Destructor Documentation

◆ DecayStringGrammar()

DecayStringGrammar ( )
inline

Definition at line 31 of file DecayStringGrammar.h.

31 : DecayStringGrammar::base_type(start)
32 {
33 using boost::spirit::unicode::char_;
34 using boost::spirit::unicode::string;
35 using boost::spirit::unicode::space;
36 using boost::spirit::qi::lit;
37 using boost::spirit::qi::lexeme;
38 using boost::spirit::repeat;
39
40
41 // Reserved characters for steering - cppcheck doesn't understand the
42 // boost::spirit syntax so we suppress warnings. we can't initialise
43 // these in the initialisation list because we need things from the
44 // namespace
45 //
46 // cppcheck-suppress incorrectCharBooleanError
47 // cppcheck-suppress useInitializationList
48 reserved = space || '^' || '[' || ']' || '>' || ':' || '.' || '?' || '!' || '@';
49
50 // particle composed of selector, particle name, and user label: "^D_s+:label"
51 particle %= *selector >> lexeme[+(char_ - reserved)] >> -label;
52 // cppcheck-suppress useInitializationList
53 selector = string("^") | string("@") | string("(misID)") | string("(decay)");
54 label %= lit(":") >> lexeme[+(char_ - reserved)];
55
56 // Arrow types
57 arrow %= string("->") | string("=direct=>") | string("=norad=>") | string("=exact=>");
58
59 // Keyword for custom MC Matching
60 keyword = string("...") | string("?nu") | string("!nu") | string("?gamma") | string("!gamma") | string("?addbrems");
62
63 // Basic decay: mother -> daughterlist
65 daughterdecay %= lit("[") >> decay >> lit("]");
68
69 // This rule is where the parser starts
70 // The decay string can be either a single decay or a list of decays
71 start %= decay | particle;
72 }
boost::spirit::qi::rule< Iterator, DecayString(), boost::spirit::unicode::space_type > start
The rule where the parser starts.
boost::spirit::qi::rule< Iterator, DecayString(), boost::spirit::unicode::space_type > daughter
A daughter particle which can be either a plain particle or a decaying particle.
boost::spirit::qi::rule< Iterator, std::vector< std::string >(), boost::spirit::unicode::space_type > keywordlist
The list of the keywords.
boost::spirit::qi::rule< Iterator, std::string(), boost::spirit::unicode::space_type > keyword
Syntax keyword.
boost::spirit::qi::rule< Iterator, DecayStringParticle(), boost::spirit::unicode::space_type > particle
Particle in the decay string: 'selector name label'.
boost::spirit::qi::rule< Iterator > reserved
Reserved characters that are not allowed in particle names or labels.
boost::spirit::qi::rule< Iterator, DecayStringDecay(), boost::spirit::unicode::space_type > decay
Syntax of a decay: 'mother arrow daughters ...'.
boost::spirit::qi::rule< Iterator, DecayStringDecay(), boost::spirit::unicode::space_type > daughterdecay
Syntax of decaying daughter particle.
boost::spirit::qi::rule< Iterator, std::string(), boost::spirit::unicode::space_type > selector
Particles can be selected by preceding '^' symbol.
boost::spirit::qi::rule< Iterator, std::vector< DecayString >(), boost::spirit::unicode::space_type > daughterlist
The list of the daughters, i.e.
boost::spirit::qi::rule< Iterator, std::string(), boost::spirit::unicode::space_type > label
Label that can be attached to a particle name, separated by the '/' symbol.
boost::spirit::qi::rule< Iterator, std::string(), boost::spirit::unicode::space_type > arrow
Allowed arrow types.

Member Data Documentation

◆ arrow

boost::spirit::qi::rule<Iterator, std::string(), boost::spirit::unicode::space_type> arrow

Allowed arrow types.

Definition at line 82 of file DecayStringGrammar.h.

◆ daughter

boost::spirit::qi::rule<Iterator, DecayString(), boost::spirit::unicode::space_type> daughter

A daughter particle which can be either a plain particle or a decaying particle.

Definition at line 92 of file DecayStringGrammar.h.

◆ daughterdecay

boost::spirit::qi::rule<Iterator, DecayStringDecay(), boost::spirit::unicode::space_type> daughterdecay

Syntax of decaying daughter particle.

Daughter decays have to be in brackets '[ ]'.

Definition at line 90 of file DecayStringGrammar.h.

◆ daughterlist

boost::spirit::qi::rule<Iterator, std::vector<DecayString>(), boost::spirit::unicode::space_type> daughterlist

The list of the daughters, i.e.

what is on the right side of the arrow.

Definition at line 94 of file DecayStringGrammar.h.

◆ decay

boost::spirit::qi::rule<Iterator, DecayStringDecay(), boost::spirit::unicode::space_type> decay

Syntax of a decay: 'mother arrow daughters ...'.

Definition at line 88 of file DecayStringGrammar.h.

◆ keyword

boost::spirit::qi::rule<Iterator, std::string(), boost::spirit::unicode::space_type> keyword

Syntax keyword.

Definition at line 84 of file DecayStringGrammar.h.

◆ keywordlist

boost::spirit::qi::rule<Iterator, std::vector<std::string>(), boost::spirit::unicode::space_type> keywordlist

The list of the keywords.

Definition at line 86 of file DecayStringGrammar.h.

◆ label

boost::spirit::qi::rule<Iterator, std::string(), boost::spirit::unicode::space_type> label

Label that can be attached to a particle name, separated by the '/' symbol.

Definition at line 80 of file DecayStringGrammar.h.

◆ particle

boost::spirit::qi::rule<Iterator, DecayStringParticle(), boost::spirit::unicode::space_type> particle

Particle in the decay string: 'selector name label'.

Definition at line 76 of file DecayStringGrammar.h.

◆ reserved

boost::spirit::qi::rule<Iterator> reserved

Reserved characters that are not allowed in particle names or labels.

Definition at line 74 of file DecayStringGrammar.h.

◆ selector

boost::spirit::qi::rule<Iterator, std::string(), boost::spirit::unicode::space_type> selector

Particles can be selected by preceding '^' symbol.

Definition at line 78 of file DecayStringGrammar.h.

◆ start

boost::spirit::qi::rule<Iterator, DecayString(), boost::spirit::unicode::space_type> start

The rule where the parser starts.

This corresponds to the full decay string.

Definition at line 96 of file DecayStringGrammar.h.


The documentation for this struct was generated from the following file: