Back to home page

EIC code displayed by LXR

 
 

    


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

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_MULTI_CHANNEL_PARSER
0022 #define EVT_MULTI_CHANNEL_PARSER
0023 
0024 #include "EvtGenBase/EvtComplex.hh"
0025 
0026 #include <string>
0027 #include <vector>
0028 
0029 // Parse decay file tokens from a file or a vector
0030 
0031 class EvtDecayMode;
0032 
0033 enum
0034 {
0035     POLAR_RAD,
0036     POLAR_DEG,
0037     CARTESIAN
0038 };
0039 
0040 class EvtMultiChannelParser {
0041   public:
0042     EvtMultiChannelParser() : _pdfMax( -1. ), _nScan( 0 ), _dm( 0. ) {}
0043     ~EvtMultiChannelParser() {}
0044 
0045     static EvtDecayMode getDecayMode( const char* file );
0046 
0047     void parse( const char* file, const char* model );
0048     void parse( const std::vector<std::string>& v );
0049 
0050     static void parseComplexCoef( size_t& i, const std::vector<std::string>& v,
0051                                   EvtComplex& c, int& format );
0052     static double parseRealCoef( int& i, const std::vector<std::string>& v );
0053     static bool isKeyword( const std::string& s );
0054 
0055     inline double pdfMax() const { return _pdfMax; }
0056     inline int nScan() const { return _nScan; }
0057     inline double dm() const { return _dm; }
0058     inline double mixPhase() const { return _mixPhase; }
0059     inline double mixAmpli() const { return _mixAmpli; }
0060 
0061     inline std::vector<std::string> amp( int i ) const { return _amp[i]; }
0062     inline std::vector<std::string> ampConj( int i ) const
0063     {
0064         return _ampConj[i];
0065     }
0066     inline EvtComplex ampCoef( int i ) const { return _ampCoef[i]; }
0067     inline EvtComplex ampConjCoef( int i ) const { return _ampConjCoef[i]; }
0068 
0069     inline int coefFormat( int i ) const { return _coefFormat[i]; }
0070     inline int coefConjFormat( int i ) const { return _coefConjFormat[i]; }
0071 
0072     inline int getNAmp() const { return _amp.size(); }
0073     inline int getNAmpConj() const { return _ampConj.size(); }
0074 
0075   private:
0076     double _pdfMax;
0077     int _nScan;
0078     double _dm;
0079     double _mixPhase;
0080     double _mixAmpli;
0081 
0082     std::vector<std::vector<std::string>> _amp;
0083     std::vector<std::vector<std::string>> _ampConj;
0084     std::vector<EvtComplex> _ampCoef;
0085     std::vector<int> _coefFormat;
0086     std::vector<EvtComplex> _ampConjCoef;
0087     std::vector<int> _coefConjFormat;
0088 };
0089 
0090 #endif