/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/BesEvtGen/BesEvtGen-00-03-58/src/EvtGen/EvtGenBase/EvtModel.cc

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 //
00003 // Environment:
00004 //      This software is part of the EvtGen package developed jointly
00005 //      for the BaBar and CLEO collaborations.  If you use all or part
00006 //      of it, please give an appropriate acknowledgement.
00007 //
00008 // Copyright Information: See EvtGen/COPYRIGHT
00009 //      Copyright (C) 1998      Caltech, UCSB
00010 //
00011 // Module: EvtModel.cc
00012 //
00013 // Description:
00014 //
00015 // Modification history:
00016 //
00017 //    RYD     September 25, 1996         Module created
00018 //
00019 //------------------------------------------------------------------------
00020 // 
00021 #include "EvtGenBase/EvtPatches.hh"
00022 #include <iostream>
00023 #include <iomanip>
00024 #include <fstream>
00025 #include <ctype.h>
00026 #include <stdlib.h>
00027 #include <assert.h>
00028 #include "EvtGenBase/EvtParticle.hh"
00029 #include "EvtGenBase/EvtRandom.hh"
00030 #include "EvtGenBase/EvtModel.hh"
00031 #include "EvtGenBase/EvtPDL.hh"
00032 #include "EvtGenBase/EvtDecayParm.hh"
00033 #include "EvtGenBase/EvtDecayBase.hh"
00034 #include "EvtGenBase/EvtParticleDecayList.hh"
00035 #include "EvtGenBase/EvtParser.hh"
00036 #include "EvtGenBase/EvtReport.hh"
00037 #include <string>
00038 using std::fstream;
00039 
00040 EvtModel* EvtModel::_instance=0;
00041 
00042 EvtModel::EvtModel() {
00043 
00044 }
00045 
00046 EvtDecayBase* EvtModel::getFcn(std::string model_name){
00047 
00048   EvtDecayBase *model=0;
00049   if ( _modelNameHash.find(model_name)!=_modelNameHash.end() ) {
00050     model=_modelNameHash[model_name];
00051   }
00052 
00053   if (model==0){
00054     report(ERROR,"EvtGen") << "Did not find the right model:"
00055                            <<model_name.c_str()<<"\n";
00056     return 0;
00057   }
00058 
00059   return model->clone();
00060 
00061 }
00062 
00063 
00064 void EvtModel::Register(EvtDecayBase* prototype){
00065 
00066   std::string modelName;
00067   prototype->getName(modelName);
00068 
00069   _modelNameHash[modelName]=prototype;
00070 
00071   std::string commandName=prototype->commandName();
00072   
00073   if (commandName!=""){
00074 
00075     //report(DEBUG,"EvtGen") << "Adding command:"<<commandName<<endl;
00076 
00077     _commandNameHash[commandName]=prototype;
00078 
00079   }
00080 
00081 }
00082 
00083 int EvtModel::isModel(std::string model_name){
00084 
00085   if ( _modelNameHash.find(model_name)!=_modelNameHash.end() ) {
00086     return 1;
00087   }
00088   return 0;
00089 }
00090 
00091 
00092 int EvtModel::isCommand(std::string cmd){
00093 
00094   if ( _commandNameHash.find(cmd)!=_commandNameHash.end() ) {
00095     return 1;
00096   }
00097   return 0;
00098 }
00099 
00100 void EvtModel::storeCommand(std::string cmd,std::string cnfgstr){
00101 
00102   EvtDecayBase *model=0;
00103   if ( _commandNameHash.find(cmd)!=_commandNameHash.end() ) {
00104     model=_commandNameHash[cmd];
00105   }
00106 
00107   assert(model!=0);
00108 
00109   model->command(cnfgstr);
00110 
00111 }
00112 
00113 
00114 
00115 

Generated on Tue Nov 29 23:12:13 2016 for BOSS_7.0.2 by  doxygen 1.4.7