The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
Gaudi::Decays::Symbols Class Reference

Helper class to obtain the information about the valid symbols for particles, decay descriptors and Nodes. More...

#include </builds/gaudi/Gaudi/GaudiPartProp/include/Gaudi/Decays/Symbols.h>

Collaboration diagram for Gaudi::Decays::Symbols:

Public Types

enum  { InvalidService = 400 , InvalidSymbol , NoParticles , NoSymbols }
 
typedef std::vector< std::string > Names
 the actual type for the list of names
 
typedef std::map< std::string, std::string > CCMap
 

Public Member Functions

const CCMapcc () const
 get CC-map
 
bool valid (std::string sym) const
 valid basic/primitive symbol?
 
const std::string & symbol (std::string sym) const
 help for the basic primitive special symbol
 
StatusCode symbol (std::string sym, Decays::Node &node) const
 get the node by symbol
 
size_t symbols (Names &names) const
 get all known basic primitive special symbols
 
StatusCode particles (const Gaudi::Interfaces::IParticlePropertySvc *svc, Names &parts) const
 get all known particle names
 
bool addSymbol (std::string sym, const Decays::iNode &node, const std::string &help, const std::string &ccsym="")
 add new symbol to the internal structure
 
void addCC (std::string sym, std::string ccsym="")
 add cc-pair to the internal map
 

Static Public Member Functions

static Symbolsinstance ()
 static accessor to teh singleton
 

Protected Member Functions

 Symbols ()
 the default constructor is protected:
 
virtual ~Symbols ()=default
 the destructor is protected
 

Private Types

typedef GaudiUtils::VectorMap< std::string, Decays::Nodes::_NodeNodeMap
 
typedef std::map< std::string, std::string > HelpMap
 

Private Member Functions

 Symbols (const Symbols &)
 copy constructor is private
 
Symbolsoperator= (const Symbols &)
 assignment operator is private
 

Private Attributes

NodeMap m_nodes
 the actual map of symbols
 
HelpMap m_help
 the actual help-map
 
CCMap m_cc
 the map of cc-symbols
 

Detailed Description

Helper class to obtain the information about the valid symbols for particles, decay descriptors and Nodes.

Many thanks to Antonio PELLEGRINO for the kind help with regex expressions

See also
Decays::iNode
Decays::Nodes
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2009-05-07

Definition at line 45 of file Symbols.h.

Member Typedef Documentation

◆ CCMap

typedef std::map<std::string, std::string> Gaudi::Decays::Symbols::CCMap

Definition at line 51 of file Symbols.h.

◆ HelpMap

typedef std::map<std::string, std::string> Gaudi::Decays::Symbols::HelpMap
private

Definition at line 117 of file Symbols.h.

◆ Names

typedef std::vector<std::string> Gaudi::Decays::Symbols::Names

the actual type for the list of names

Definition at line 50 of file Symbols.h.

◆ NodeMap

Definition at line 116 of file Symbols.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
InvalidService 
InvalidSymbol 
NoParticles 
NoSymbols 

Definition at line 47 of file Symbols.h.

Constructor & Destructor Documentation

◆ Symbols() [1/2]

Gaudi::Decays::Symbols::Symbols ( )
protected

the default constructor is protected:

Definition at line 44 of file Symbols.cpp.

44 {
45 addSymbol( "X", Decays::Nodes::Any(), "Any particle" );
46 //
47 addSymbol( "Hadron", Decays::Nodes::Hadron(), "Any hadron" );
48 addSymbol( "Meson", Decays::Nodes::Meson(), "Any meson" );
49 addSymbol( "Baryon", Decays::Nodes::Baryon(), "Any baryon" );
50 addSymbol( "Nucleus", Decays::Nodes::Nucleus(), "Any nucleus" );
51 addSymbol( "Lepton", Decays::Nodes::Lepton(), "Any lepton" );
52 addSymbol( "l", Decays::Nodes::Ell(), "Any charged lepton" );
53 addSymbol( "l+", Decays::Nodes::EllPlus(), "Any positive lepton", "l-" );
54 addSymbol( "l-", Decays::Nodes::EllMinus(), "Any negative lepton", "l+" );
55 addSymbol( "Nu", Decays::Nodes::Nu(), "Any neutral lepton" );
56 addSymbol( "Neutrino", Decays::Nodes::Nu(), "Any neutral lepton" );
57 //
58 addSymbol( "X0", Decays::Nodes::Neutral(), "Any neutral particle" );
59 addSymbol( "Xq", Decays::Nodes::Charged(), "Any charged particle" );
60 addSymbol( "X+", Decays::Nodes::Positive(), "Any positive particle", "X-" );
61 addSymbol( "X-", Decays::Nodes::Negative(), "Any negative particle", "X+" );
62 //
63 addSymbol( "ID+", Decays::Nodes::PosID(), "Any particle with positive ID", "ID-" );
64 addSymbol( "ID-", Decays::Nodes::NegID(), "Any particle with negative ID", "ID+" );
65 //
66 addSymbol( "Xd", Decays::Nodes::HasQuark( Gaudi::ParticleID::down ), "Any particle with d-quark" );
67 addSymbol( "Xu", Decays::Nodes::HasQuark( Gaudi::ParticleID::up ), "Any particle with u-quark" );
68 addSymbol( "Xs", Decays::Nodes::HasQuark( Gaudi::ParticleID::strange ), "Any particle with s-quark" );
69 addSymbol( "Xc", Decays::Nodes::HasQuark( Gaudi::ParticleID::charm ), "Any particle with c-quark" );
70 addSymbol( "Xb", Decays::Nodes::HasQuark( Gaudi::ParticleID::bottom ), "Any particle with b-quark" );
71 addSymbol( "Xt", Decays::Nodes::HasQuark( Gaudi::ParticleID::top ), "Any particle with t-quark" );
72 //
73 addSymbol( "Down", Decays::Nodes::HasQuark( Gaudi::ParticleID::down ), "Any particle with d-quark" );
74 addSymbol( "Up", Decays::Nodes::HasQuark( Gaudi::ParticleID::up ), "Any particle with u-quark" );
75 addSymbol( "Strange", Decays::Nodes::HasQuark( Gaudi::ParticleID::strange ), "Any particle with s-quark" );
76 addSymbol( "Charm", Decays::Nodes::HasQuark( Gaudi::ParticleID::charm ), "Any particle with c-quark" );
77 addSymbol( "Bottom", Decays::Nodes::HasQuark( Gaudi::ParticleID::bottom ), "Any particle with b-quark" );
78 addSymbol( "Beauty", Decays::Nodes::HasQuark( Gaudi::ParticleID::bottom ), "Any particle with b-quark" );
79 addSymbol( "Top", Decays::Nodes::HasQuark( Gaudi::ParticleID::top ), "Any particle with t-quark" );
80 //
81 addSymbol( "Scalar", Decays::Nodes::JSpin( 1 ), "Any scalar particle j=0" );
82 addSymbol( "Spinor", Decays::Nodes::JSpin( 2 ), "Any spinor particle j=1/2" );
83 addSymbol( "OneHalf", Decays::Nodes::JSpin( 2 ), "Any spinor particle j=1/2" );
84 addSymbol( "Vector", Decays::Nodes::JSpin( 3 ), "Any vector particle j=1" );
85 addSymbol( "ThreeHalf", Decays::Nodes::JSpin( 4 ), "Any particle with spin j=3/2" );
86 addSymbol( "Tensor", Decays::Nodes::JSpin( 5 ), "Any tensor particle j=2" );
87 addSymbol( "FiveHalf", Decays::Nodes::JSpin( 6 ), "Any particle with spin j=5/2" );
88 //
89 addSymbol( "ShortLived", Decays::Nodes::ShortLived_(), "Any short-ilved particle" );
90 addSymbol( "LongLived", Decays::Nodes::LongLived_(), "Any long-lived particle" );
91 addSymbol( "Stable", Decays::Nodes::Stable(), "Any 'stable' particle" );
92 addSymbol( "StableCharged", Decays::Nodes::StableCharged(), "Any 'trackable' particle: stable & charged" );
93 // special CC-symbols, protect them...
94 addCC( "cc" );
95 addCC( "CC" );
96 addCC( "os" );
97 addCC( "nos" );
98 addCC( "HasQuark" );
99 addCC( "JSpin" );
100 addCC( "LSpin" );
101 addCC( "SSpin" );
102 addCC( "ShortLived" );
103 addCC( "LongLived" );
104 addCC( "ShortLived_" );
105 addCC( "LongLived_" );
106 addCC( "Stable" );
107 addCC( "Light" );
108 addCC( "Heavy" );
109 addCC( "CTau" );
110 addCC( "Mass" );
111 addCC( "up" );
112 addCC( "down" );
113 addCC( "strange" );
114 addCC( "charm" );
115 addCC( "beauty" );
116 addCC( "bottom" );
117 addCC( "top" );
118}
bool addSymbol(std::string sym, const Decays::iNode &node, const std::string &help, const std::string &ccsym="")
add new symbol to the internal structure
Definition Symbols.cpp:129
void addCC(std::string sym, std::string ccsym="")
add cc-pair to the internal map
Definition Symbols.cpp:148

◆ ~Symbols()

virtual Gaudi::Decays::Symbols::~Symbols ( )
protectedvirtualdefault

the destructor is protected

◆ Symbols() [2/2]

Gaudi::Decays::Symbols::Symbols ( const Symbols & )
private

copy constructor is private

Member Function Documentation

◆ addCC()

void Gaudi::Decays::Symbols::addCC ( std::string sym,
std::string ccsym = "" )

add cc-pair to the internal map

Parameters
symthe symbol
ccsymthe symbol for charge conjugation

Definition at line 148 of file Symbols.cpp.

148 {
149 // trim the arguments
150 boost::trim( sym );
151 boost::trim( ccsym );
152 if ( ccsym.empty() ) { ccsym = sym; }
153 m_cc[sym] = ccsym;
154 if ( ccsym != sym ) { m_cc[ccsym] = sym; }
155}
CCMap m_cc
the map of cc-symbols
Definition Symbols.h:124

◆ addSymbol()

bool Gaudi::Decays::Symbols::addSymbol ( std::string sym,
const Decays::iNode & node,
const std::string & help,
const std::string & ccsym = "" )

add new symbol to the internal structure

Parameters
symthe symbol definition
nodethe actual node
helpthe help string
ccsymthe symbol for charge coonjugation
Returns
true if the symbol is added into the storage

Definition at line 129 of file Symbols.cpp.

130 {
131 // trim the arguments
132 boost::trim( sym );
133 auto ifind = m_nodes.find( sym );
134 if ( m_nodes.end() != ifind ) { return false; }
135 // add the node into the map
136 bool inserted = m_nodes.insert( sym, node ).second;
137 if ( !inserted ) { return false; }
138 // add the help-string
139 m_help[sym] = help;
140 // add cc-symbols
141 addCC( sym, ccsym );
142 return true;
143}
HelpMap m_help
the actual help-map
Definition Symbols.h:122
NodeMap m_nodes
the actual map of symbols
Definition Symbols.h:120
void help(const std::string &argv0)

◆ cc()

const Decays::Symbols::CCMap & Gaudi::Decays::Symbols::cc ( ) const

get CC-map

Definition at line 121 of file Symbols.cpp.

121{ return m_cc; }

◆ instance()

Decays::Symbols & Gaudi::Decays::Symbols::instance ( )
static

static accessor to teh singleton

Definition at line 39 of file Symbols.cpp.

39 {
40 static Decays::Symbols s_symbols;
41 return s_symbols;
42}

◆ operator=()

Symbols & Gaudi::Decays::Symbols::operator= ( const Symbols & )
private

assignment operator is private

◆ particles()

StatusCode Gaudi::Decays::Symbols::particles ( const Gaudi::Interfaces::IParticlePropertySvc * svc,
Names & parts ) const

get all known particle names

Parameters
svc(INPUT) particle property service
parts(OUTPUT) vector of particle names
Returns
status code

Definition at line 202 of file Symbols.cpp.

203 {
204 // clear the output
205 parts.clear();
206 // check the service
207 if ( 0 == service ) { return StatusCode( InvalidService ); }
208
209 auto begin = service->begin();
210 auto end = service->end();
211 for ( ; end != begin; ++begin ) {
212 const Gaudi::ParticleProperty* pp = *begin;
213 if ( !pp ) { continue; }
214 parts.push_back( pp->particle() );
215 }
216 // sort it according to CC-criteria ATTENTION!
217 std::stable_sort( parts.begin(), parts.end(), Decays::CC::CmpCC() );
218
219 return StatusCode::SUCCESS;
220}
constexpr static const auto SUCCESS
Definition StatusCode.h:99
AttribStringParser::Iterator begin(const AttribStringParser &parser)

◆ symbol() [1/2]

const std::string & Gaudi::Decays::Symbols::symbol ( std::string sym) const

help for the basic primitive special symbol

Parameters
symthe symbol
Returns
the help string

Definition at line 163 of file Symbols.cpp.

163 {
164 // trim the argument
165 boost::trim( sym );
166 NodeMap::const_iterator ifind = m_nodes.find( sym );
167 if ( m_nodes.end() == ifind ) { return s_EMPTY; }
168 HelpMap::const_iterator ihelp = m_help.find( sym );
169 if ( m_help.end() == ihelp ) { return s_EMPTY; }
170 return ihelp->second;
171}

◆ symbol() [2/2]

StatusCode Gaudi::Decays::Symbols::symbol ( std::string sym,
Decays::Node & node ) const

get the node by symbol

Parameters
(INPUT)sym the symbol name
(OUTPUT)the symbol
Returns
status code

Definition at line 177 of file Symbols.cpp.

177 {
178 // trim the argument
179 boost::trim( sym );
180 auto ifind = m_nodes.find( sym );
181 if ( m_nodes.end() != ifind ) {
182 node = ifind->second;
183 return StatusCode::SUCCESS;
184 }
185 node = Decays::Nodes::Invalid();
186 return StatusCode( InvalidSymbol );
187}

◆ symbols()

size_t Gaudi::Decays::Symbols::symbols ( Names & names) const

get all known basic primitive special symbols

Parameters
names(OUTOUT) vector of all known special symbols
Returns
size of the vector

Definition at line 189 of file Symbols.cpp.

189 {
190 // clear names ;
191 names.clear();
192 for ( auto inode = m_nodes.begin(); m_nodes.end() != inode; ++inode ) { names.push_back( inode->first ); }
193 // sort it according to CC-criteria ATTENTION!
194 std::stable_sort( names.begin(), names.end(), Decays::CC::CmpCC() );
195 return names.size();
196}

◆ valid()

bool Gaudi::Decays::Symbols::valid ( std::string sym) const

valid basic/primitive symbol?

Parameters
symthe symbol
Returns
true if it is vaild special symbol

Definition at line 157 of file Symbols.cpp.

157 {
158 // trim the argument
159 boost::trim( sym );
160 return m_nodes.end() != m_nodes.find( sym );
161}

Member Data Documentation

◆ m_cc

CCMap Gaudi::Decays::Symbols::m_cc
private

the map of cc-symbols

Definition at line 124 of file Symbols.h.

◆ m_help

HelpMap Gaudi::Decays::Symbols::m_help
private

the actual help-map

Definition at line 122 of file Symbols.h.

◆ m_nodes

NodeMap Gaudi::Decays::Symbols::m_nodes
private

the actual map of symbols

Definition at line 120 of file Symbols.h.


The documentation for this class was generated from the following files: