1 //--------------------------------------------------------------------------
4 // This software is part of the EvtGen package developed jointly
5 // for the BaBar and CLEO collaborations. If you use all or part
6 // of it, please give an appropriate acknowledgement.
8 // Copyright Information: See EvtGen/COPYRIGHT
9 // Copyright (C) 1998 Caltech, UCSB
11 // Module: EvtModel.cc
15 // Modification history:
17 // RYD September 25, 1996 Module created
19 //------------------------------------------------------------------------
21 #include "EvtGenBase/EvtPatches.hh"
28 #include "EvtGenBase/EvtParticle.hh"
29 #include "EvtGenBase/EvtRandom.hh"
30 #include "EvtGenBase/EvtModel.hh"
31 #include "EvtGenBase/EvtPDL.hh"
32 #include "EvtGenBase/EvtDecayBase.hh"
33 #include "EvtGenBase/EvtParticleDecayList.hh"
34 #include "EvtGenBase/EvtParser.hh"
35 #include "EvtGenBase/EvtReport.hh"
39 EvtModel* EvtModel::_instance=0;
41 EvtModel::EvtModel() {
45 EvtDecayBase* EvtModel::getFcn(std::string model_name){
47 EvtDecayBase *model=0;
48 if ( _modelNameHash.find(model_name)!=_modelNameHash.end() ) {
49 model=_modelNameHash[model_name];
53 report(ERROR,"EvtGen") << "Did not find the right model:"
54 <<model_name.c_str()<<"\n";
58 return model->clone();
63 void EvtModel::registerModel(EvtDecayBase* prototype){
65 std::string modelName= prototype->getName();
67 _modelNameHash[modelName]=prototype;
69 std::string commandName=prototype->commandName();
73 _commandNameHash[commandName]=prototype;
79 int EvtModel::isModel(std::string model_name){
81 if ( _modelNameHash.find(model_name)!=_modelNameHash.end() ) {
88 int EvtModel::isCommand(std::string cmd){
90 if ( _commandNameHash.find(cmd)!=_commandNameHash.end() ) {
96 void EvtModel::storeCommand(std::string cmd,std::string cnfgstr){
98 EvtDecayBase *model=0;
99 if ( _commandNameHash.find(cmd)!=_commandNameHash.end() ) {
100 model=_commandNameHash[cmd];
105 model->command(cnfgstr);