Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Gaudi/Decays/Symbols.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #pragma once
0012 
0013 #include <Gaudi/Decays/Nodes.h>
0014 #include <GaudiKernel/Kernel.h>
0015 #include <GaudiKernel/VectorMap.h>
0016 #include <map>
0017 #include <string>
0018 #include <vector>
0019 
0020 namespace Gaudi {
0021   class IParticlePropertySvc;
0022 }
0023 
0024 /** @file Kernel/Symbols.h
0025  *  Helper file with the definition of symbols, used for particles/nodes/decays
0026  *  @see Gaudi::Interfaces::IParticlePropertySvc
0027  *  @see Gaudi::ParticleProperty
0028  *  @see Gaudi::ParticleID
0029  *  Many thanks to Antonio PELLEGRINO for the kind help with regex expressions
0030  *  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
0031  *  @date 2009-05-07
0032  */
0033 namespace Gaudi::Decays {
0034   /** @class Symbols
0035    *  Helper class to obtain the information about the valid
0036    *  symbols for particles, decay descriptors and Nodes.
0037    *
0038    *  Many thanks to Antonio PELLEGRINO for the kind help with regex expressions
0039    *
0040    *  @see Decays::iNode
0041    *  @see Decays::Nodes
0042    *  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
0043    *  @date 2009-05-07
0044    */
0045   class GAUDI_API Symbols {
0046   public:
0047     enum { InvalidService = 400, InvalidSymbol, NoParticles, NoSymbols };
0048 
0049     /// the actual type for the list of names
0050     typedef std::vector<std::string>           Names;
0051     typedef std::map<std::string, std::string> CCMap;
0052 
0053     /// get CC-map
0054     const CCMap& cc() const;
0055 
0056     /** valid basic/primitive symbol?
0057      *  @param sym the symbol
0058      *  @return true if it is vaild special symbol
0059      */
0060     bool valid( std::string sym ) const;
0061     /** help for the basic primitive special symbol
0062      *  @param sym the symbol
0063      *  @return the help string
0064      */
0065     const std::string& symbol( std::string sym ) const;
0066     /** get the node by symbol
0067      *  @param (INPUT)  sym the symbol name
0068      *  @param (OUTPUT) the symbol
0069      *  @return status code
0070      */
0071     StatusCode symbol( std::string sym, Decays::Node& node ) const;
0072 
0073     /** get all known basic primitive special symbols
0074      *  @param names (OUTOUT) vector of all known special symbols
0075      *  @return size of the vector
0076      */
0077     size_t symbols( Names& names ) const;
0078     /** get all known particle names
0079      *  @param svc   (INPUT) particle property service
0080      *  @param parts (OUTPUT) vector of particle names
0081      *  @return status code
0082      */
0083     StatusCode particles( const Gaudi::Interfaces::IParticlePropertySvc* svc, Names& parts ) const;
0084 
0085     /** add new symbol to the internal structure
0086      *  @param sym    the symbol definition
0087      *  @param node   the actual node
0088      *  @param help   the help string
0089      *  @param ccsym  the symbol for charge coonjugation
0090      *  @return true if the symbol is added into the storage
0091      */
0092     bool addSymbol( std::string sym, const Decays::iNode& node, const std::string& help,
0093                     const std::string& ccsym = "" );
0094 
0095     /** add cc-pair to the internal map
0096      *  @param sym the symbol
0097      *  @param ccsym the symbol for charge conjugation
0098      */
0099     void addCC( std::string sym, std::string ccsym = "" );
0100 
0101     /// static accessor to teh singleton
0102     static Symbols& instance();
0103 
0104   protected:
0105     /// the default constructor is protected:
0106     Symbols();
0107     /// the destructor is protected
0108     virtual ~Symbols() = default;
0109 
0110   private:
0111     /// copy constructor is private
0112     Symbols( const Symbols& );
0113     /// assignment operator is private
0114     Symbols& operator=( const Symbols& );
0115 
0116     typedef GaudiUtils::VectorMap<std::string, Decays::Nodes::_Node> NodeMap;
0117     typedef std::map<std::string, std::string>                       HelpMap;
0118 
0119     /// the actual map of symbols
0120     NodeMap m_nodes;
0121     /// the actual help-map
0122     HelpMap m_help;
0123     /// the map of cc-symbols
0124     CCMap m_cc;
0125   };
0126 } // namespace Gaudi::Decays