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 <map>
0014 #include <set>
0015 #include <string>
0016 
0017 namespace Gaudi::Decays {
0018   namespace CC {
0019     /** @struct CmpCC
0020      *  a bit specific comparison of strings, useful for
0021      *  ordering according to the length as the primary parameter
0022      *  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
0023      */
0024     struct CmpCC {
0025       /** the only one essential method
0026        *  The most long string is "less", otherwise the
0027        *  standard comparison is applicable.
0028        */
0029       inline bool operator()( const std::string& v1, const std::string& v2 ) const {
0030         const std::string::size_type s1 = v1.size();
0031         const std::string::size_type s2 = v2.size();
0032         return s1 < s2 ? false : s2 < s1 ? true : ( v1 < v2 );
0033       }
0034     };
0035     /// the actual type of CC-map
0036     typedef std::map<std::string, std::string, CmpCC> MapCC; // CC-MAP
0037     /// the actual type of CC-set
0038     typedef std::set<std::string, CmpCC> SetCC; // CC-SET
0039 
0040     /** simple function to make charge conjugated inside the original string.
0041      *  All substrings are subsutututed by their charge conjugates
0042      *  @param orig the original sring
0043      *  @param map_ the full map of substitutions
0044      *  @param pos the starting position
0045      *  @return charge-conjugated string
0046      */
0047     std::string cc( const std::string& decay, const MapCC& map_ );
0048 
0049     /** simple function to make charge conjugated inside the original string.
0050      *  All substrings are subsutututed by their charge conjugates
0051      *  @param orig the original sring
0052      *  @param map_ the full map of substitutions
0053      *  @param pos the starting position
0054      *  @return charge-conjugated string
0055      */
0056     std::string cc( const std::string& decay, const std::map<std::string, std::string>& map_ );
0057   } // namespace CC
0058 } // namespace Gaudi::Decays