The Gaudi Framework  master (594c33fa)
Gaudi::Decays::Symbols Class Reference

#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::stringNames
 the actual type for the list of names More...
 
typedef std::map< std::string, std::stringCCMap
 

Public Member Functions

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

Static Public Member Functions

static Symbolsinstance ()
 static accessor to teh singleton More...
 

Protected Member Functions

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

Private Types

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

Private Member Functions

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

Private Attributes

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

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

◆ HelpMap

Definition at line 116 of file Symbols.h.

◆ Names

the actual type for the list of names

Definition at line 50 of file Symbols.h.

◆ NodeMap

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 }

◆ ~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 }

◆ addSymbol()

bool Gaudi::Decays::Symbols::addSymbol ( std::string  sym,
const Decays::iNode node,
const std::string help,
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 }

◆ 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 }

◆ 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 123 of file Symbols.h.

◆ m_help

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

the actual help-map

Definition at line 121 of file Symbols.h.

◆ m_nodes

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

the actual map of symbols

Definition at line 119 of file Symbols.h.


The documentation for this class was generated from the following files:
Gaudi::Decays::Symbols::m_help
HelpMap m_help
the actual help-map
Definition: Symbols.h:121
GaudiPartProp.Nodes.EllPlus
EllPlus
Definition: Nodes.py:255
GaudiPartProp.Nodes.LongLived_
LongLived_
Definition: Nodes.py:304
GaudiPartProp.Nodes.Ell
Ell
Definition: Nodes.py:254
Gaudi::Decays::Symbols::InvalidSymbol
@ InvalidSymbol
Definition: Symbols.h:47
std::map::find
T find(T... args)
GaudiPartProp.Nodes.EllMinus
EllMinus
Definition: Nodes.py:256
Gaudi::ParticleID::bottom
@ bottom
Definition: ParticleID.h:48
GaudiPartProp.Nodes.Baryon
Baryon
Definition: Nodes.py:259
Gaudi::Decays::Symbols::NoParticles
@ NoParticles
Definition: Symbols.h:47
Gaudi::ParticleID::up
@ up
Definition: ParticleID.h:48
help
void help(std::string argv0)
Definition: listcomponents.cpp:29
EventStatus::Invalid
@ Invalid
Definition: IAlgExecStateSvc.h:73
GaudiUtils::VectorMap::begin
iterator begin() const
"begin" iterator for sequential access (const-only version!)
Definition: VectorMap.h:196
GaudiUtils::VectorMap< std::string, Decays::Nodes::_Node >::const_iterator
_vector::const_iterator const_iterator
visible const_iterator (exported)
Definition: VectorMap.h:152
GaudiPartProp.Nodes.JSpin
JSpin
Definition: Nodes.py:265
GaudiPartProp.Nodes.ShortLived_
ShortLived_
Definition: Nodes.py:306
Gaudi::Decays::Symbols::NoSymbols
@ NoSymbols
Definition: Symbols.h:47
StatusCode
Definition: StatusCode.h:65
GaudiPartProp.Nodes.Hadron
Hadron
Definition: Nodes.py:257
CLHEP::begin
double * begin(CLHEP::HepVector &v)
Definition: TupleAlg.cpp:45
GaudiPartProp.Nodes.Negative
Negative
Definition: Nodes.py:262
Gaudi::Decays::Symbols::m_cc
CCMap m_cc
the map of cc-symbols
Definition: Symbols.h:123
Gaudi::Decays::Symbols::addSymbol
bool addSymbol(std::string sym, const Decays::iNode &node, const std::string &help, std::string ccsym="")
add new symbol to the internal structure
Definition: Symbols.cpp:129
Gaudi::ParticleID::down
@ down
Definition: ParticleID.h:48
GaudiUtils::VectorMap::end
iterator end() const
"end" iterator for sequential access (const-only version!)
Definition: VectorMap.h:198
Gaudi::ParticleID::strange
@ strange
Definition: ParticleID.h:48
Gaudi::Decays::Symbols
Definition: Symbols.h:45
Gaudi::ParticleProperty
Definition: ParticleProperty.h:37
GaudiPartProp.Nodes.Nu
Nu
Definition: Nodes.py:253
GaudiPartProp.Nodes.Meson
Meson
Definition: Nodes.py:258
GaudiPartProp.Nodes.Positive
Positive
Definition: Nodes.py:261
GaudiPartProp.Nodes.Nucleus
Nucleus
Definition: Nodes.py:268
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
GaudiPartProp.Nodes.Any
Any
Definition: Nodes.py:249
GaudiPartProp.Nodes.StableCharged
StableCharged
Definition: Nodes.py:309
Gaudi::Decays::Symbols::InvalidService
@ InvalidService
Definition: Symbols.h:47
GaudiPartProp.Nodes.HasQuark
HasQuark
Definition: Nodes.py:264
Gaudi::ParticleID::charm
@ charm
Definition: ParticleID.h:48
GaudiUtils::VectorMap::insert
result_type insert(const key_type &key, const mapped_type &mapped)
insert the (key,value) pair into the container
Definition: VectorMap.h:312
GaudiPartProp.Nodes.Neutral
Neutral
Definition: Nodes.py:263
std::string::empty
T empty(T... args)
Gaudi::Decays::Symbols::addCC
void addCC(std::string sym, std::string ccsym="")
add cc-pair to the internal map
Definition: Symbols.cpp:148
GaudiPartProp.Nodes.Lepton
Lepton
Definition: Nodes.py:252
std::map::end
T end(T... args)
IOTest.end
end
Definition: IOTest.py:125
compareOutputFiles.pp
pp
Definition: compareOutputFiles.py:507
std::stable_sort
T stable_sort(T... args)
GaudiPartProp.Nodes.Charged
Charged
Definition: Nodes.py:260
Gaudi::ParticleID::top
@ top
Definition: ParticleID.h:48
GaudiUtils::VectorMap::find
iterator find(const key_type &key) const
find the element by key
Definition: VectorMap.h:440
GaudiPartProp.Nodes.Stable
Stable
Definition: Nodes.py:308
Gaudi::Decays::Symbols::m_nodes
NodeMap m_nodes
the actual map of symbols
Definition: Symbols.h:119