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 EVTDECAYBASE_HH
0022 #define EVTDECAYBASE_HH
0023 
0024 #include "EvtGenBase/EvtId.hh"
0025 #include "EvtGenBase/EvtPatches.hh"
0026 #include "EvtGenBase/EvtSpinType.hh"
0027 
0028 #include <stdlib.h>
0029 #include <string>
0030 #include <vector>
0031 class EvtParticle;
0032 class EvtSpinType;
0033 
0034 class EvtDecayBase {
0035   public:
0036     //These pure virtual methods has to be implemented
0037     //by any derived class
0038     virtual std::string getName() = 0;
0039     virtual void decay( EvtParticle* p ) = 0;
0040     virtual void makeDecay( EvtParticle* p, bool recursive = true ) = 0;
0041     virtual EvtDecayBase* clone() = 0;
0042 
0043     //These virtual methods can be implemented by the
0044     //derived class to implement nontrivial functionality.
0045     virtual void init();
0046     virtual void initProbMax();
0047     virtual std::string commandName();
0048     virtual void command( std::string cmd );
0049 
0050     virtual std::string getParamName( int i );
0051     virtual std::string getParamDefault( int i );
0052 
0053     double getProbMax( double prob );
0054     double resetProbMax( double prob );
0055 
0056     EvtDecayBase();
0057     virtual ~EvtDecayBase() = default;
0058 
0059     virtual bool matchingDecay( const EvtDecayBase& other ) const;
0060 
0061     EvtId getParentId() const { return _parent; }
0062     double getBranchingFraction() const { return _brfr; }
0063     void disableCheckQ() { _chkCharge = 0; };
0064     void checkQ();
0065     int getNDaug() const { return _ndaug; }
0066     EvtId* getDaugs() { return _daug.data(); }
0067     EvtId getDaug( int i ) const { return _daug[i]; }
0068     int getNArg() const { return _narg; }
0069     int getPHOTOS() const { return _photos; }
0070     void setPHOTOS() { _photos = 1; }
0071     void setVerbose() { _verbose = 1; }
0072     void setSummary() { _summary = 1; }
0073     double* getArgs();
0074     std::string* getArgsStr() { return _args.data(); }
0075     double getArg( unsigned int j );
0076     double getStoredArg( int j ) const { return _storedArgs.at( j ); }
0077     double getNStoredArg() const { return _storedArgs.size(); }
0078     std::string getArgStr( int j ) const { return _args[j]; }
0079     std::string getModelName() const { return _modelname; }
0080     int getDSum() const { return _dsum; }
0081     int summary() const { return _summary; }
0082     int verbose() const { return _verbose; }
0083 
0084     void saveDecayInfo( EvtId ipar, int ndaug, EvtId* daug, int narg,
0085                         std::vector<std::string>& args, std::string name,
0086                         double brfr );
0087     void printSummary() const;
0088     void printInfo() const;
0089 
0090     //Does not really belong here but I don't have a better place.
0091     static void findMasses( EvtParticle* p, int ndaugs, EvtId daugs[10],
0092                             double masses[10] );
0093     static void findMass( EvtParticle* p );
0094     static double findMaxMass( EvtParticle* p );
0095 
0096     //Methods to set the maximum probability.
0097     void setProbMax( double prbmx );
0098     void noProbMax();
0099 
0100     void checkNArg( int a1, int a2 = -1, int a3 = -1, int a4 = -1 );
0101     void checkNDaug( int d1, int d2 = -1 );
0102 
0103     void checkSpinParent( EvtSpinType::spintype sp );
0104     void checkSpinDaughter( int d1, EvtSpinType::spintype sp );
0105 
0106     // lange - some models can take more daughters
0107     // than they really have to fool aliases (VSSBMIX for example)
0108     virtual int nRealDaughters() { return _ndaug; }
0109 
0110   protected:
0111     bool _daugsDecayedByParentModel;
0112     bool daugsDecayedByParentModel() { return _daugsDecayedByParentModel; }
0113 
0114   private:
0115     int _photos;
0116     int _ndaug;
0117     EvtId _parent;
0118     int _narg;
0119     std::vector<double> _storedArgs;
0120     std::vector<EvtId> _daug;
0121     std::vector<double> _argsD;
0122     std::vector<std::string> _args;
0123     std::string _modelname;
0124     double _brfr;
0125     int _dsum;
0126     int _summary;
0127     int _verbose;
0128 
0129     int defaultprobmax;
0130     double probmax;
0131     int ntimes_prob;
0132 
0133     //Should charge conservation be checked when model is
0134     //created? 1=yes 0 no.
0135     int _chkCharge;
0136 
0137     //These are used for gathering statistics.
0138     double sum_prob;
0139     double max_prob;
0140 };
0141 
0142 #endif