Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:20:01

0001 
0002 /***********************************************************************
0003 * Copyright 1998-2020 CERN for the benefit of the EvtGen authors       *
0004 *                                                                      *
0005 * This file is part of EvtGen.                                         *
0006 *                                                                      *
0007 * EvtGen is free software: you can redistribute it and/or modify       *
0008 * it under the terms of the GNU General Public License as published by *
0009 * the Free Software Foundation, either version 3 of the License, or    *
0010 * (at your option) any later version.                                  *
0011 *                                                                      *
0012 * EvtGen is distributed in the hope that it will be useful,            *
0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
0015 * GNU General Public License for more details.                         *
0016 *                                                                      *
0017 * You should have received a copy of the GNU General Public License    *
0018 * along with EvtGen.  If not, see <https://www.gnu.org/licenses/>.     *
0019 ***********************************************************************/
0020 
0021 #ifndef EVT_CYCLIC3_HH
0022 #define EVT_CYCLIC3_HH
0023 
0024 #include <iosfwd>
0025 
0026 // Cyclic permutations of three indices A,B,C and their parings
0027 
0028 namespace EvtCyclic3 {
0029 
0030     enum Index
0031     {
0032         A = 0,
0033         B = 1,
0034         C = 2
0035     };
0036     enum Pair
0037     {
0038         BC = 0,
0039         CB = BC,
0040         CA = 1,
0041         AC = CA,
0042         AB = 2,
0043         BA = AB
0044     };
0045     enum Perm
0046     {
0047         ABC = 0,
0048         BCA = 1,
0049         CAB = 2,
0050         CBA = 3,
0051         BAC = 4,
0052         ACB = 5
0053     };
0054 
0055     // Permutations (multiplication is not transitive)
0056 
0057     Index permute( Index i, Perm p );
0058     Perm permutation( Index i1, Index i2, Index i3 );
0059     Perm permute( Perm i, Perm p );
0060     Pair permute( Pair i, Perm p );
0061 
0062     Pair i2pair( int i );
0063 
0064     // Index-to-index
0065 
0066     Index prev( Index i );
0067     Index next( Index i );
0068     Index other( Index i, Index j );
0069 
0070     // Index-to-pair
0071 
0072     Pair other( Index i );
0073     Pair combine( Index i, Index j );
0074 
0075     // Pair-to-pair conversions
0076 
0077     Pair prev( Pair i );
0078     Pair next( Pair i );
0079     Pair other( Pair i, Pair j );
0080 
0081     // Pair-to-index conversions
0082 
0083     Index first( Pair i );
0084     Index second( Pair i );
0085     Index other( Pair i );
0086     Index common( Pair i, Pair j );
0087 
0088     // String to Index, Pair
0089 
0090     Index strToIndex( const char* str );
0091     Pair strToPair( const char* str );
0092 
0093     // To string conversions
0094 
0095     const char* c_str( Index i );
0096     const char* c_str( Pair i );
0097     const char* c_str( Perm i );
0098 
0099     // Useful name strings
0100 
0101     char* append( const char* str, EvtCyclic3::Index i );
0102     char* append( const char* str, EvtCyclic3::Pair i );
0103 
0104 }    // namespace EvtCyclic3
0105 
0106 //where should these go?
0107 //ostream& operator<<(ostream&, EvtCyclic3::Index);
0108 //ostream& operator<<(ostream&, EvtCyclic3::Pair);
0109 
0110 #endif