Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:29

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2023 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, std::string ccsym = "" );
0093 
0094     /** add cc-pair to the internal map
0095      *  @param sym the symbol
0096      *  @param ccsym the symbol for charge conjugation
0097      */
0098     void addCC( std::string sym, std::string ccsym = "" );
0099 
0100     /// static accessor to teh singleton
0101     static Symbols& instance();
0102 
0103   protected:
0104     /// the default constructor is protected:
0105     Symbols();
0106     /// the destructor is protected
0107     virtual ~Symbols() = default;
0108 
0109   private:
0110     /// copy constructor is private
0111     Symbols( const Symbols& );
0112     /// assignment operator is private
0113     Symbols& operator=( const Symbols& );
0114 
0115     typedef GaudiUtils::VectorMap<std::string, Decays::Nodes::_Node> NodeMap;
0116     typedef std::map<std::string, std::string>                       HelpMap;
0117 
0118     /// the actual map of symbols
0119     NodeMap m_nodes;
0120     /// the actual help-map
0121     HelpMap m_help;
0122     /// the map of cc-symbols
0123     CCMap m_cc;
0124   };
0125 } // namespace Gaudi::Decays