LCOV - code coverage report
Current view: top level - TEvtGen/EvtGen/EvtGenBase - EvtModel.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 32 0.0 %
Date: 2016-06-14 17:26:59 Functions: 0 7 0.0 %

          Line data    Source code
       1             : //--------------------------------------------------------------------------
       2             : //
       3             : // Environment:
       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.
       7             : //
       8             : // Copyright Information: See EvtGen/COPYRIGHT
       9             : //      Copyright (C) 1998      Caltech, UCSB
      10             : //
      11             : // Module: EvtModel.cc
      12             : //
      13             : // Description:
      14             : //
      15             : // Modification history:
      16             : //
      17             : //    RYD     September 25, 1996         Module created
      18             : //
      19             : //------------------------------------------------------------------------
      20             : // 
      21             : #include "EvtGenBase/EvtPatches.hh"
      22             : #include <iostream>
      23             : #include <iomanip>
      24             : #include <fstream>
      25             : #include <ctype.h>
      26             : #include <stdlib.h>
      27             : #include <assert.h>
      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"
      36             : #include <string>
      37             : using std::fstream;
      38             : 
      39             : EvtModel* EvtModel::_instance=0;
      40             : 
      41           0 : EvtModel::EvtModel() {
      42             : 
      43           0 : }
      44             : 
      45             : EvtDecayBase* EvtModel::getFcn(std::string model_name){
      46             : 
      47             :   EvtDecayBase *model=0;
      48           0 :   if ( _modelNameHash.find(model_name)!=_modelNameHash.end() ) {
      49           0 :     model=_modelNameHash[model_name];
      50           0 :   }
      51             : 
      52           0 :   if (model==0){
      53           0 :     report(Severity::Error,"EvtGen") << "Did not find the right model:"
      54           0 :                            <<model_name.c_str()<<"\n";
      55           0 :     return 0;
      56             :   }
      57             : 
      58           0 :   return model->clone();
      59             : 
      60           0 : }
      61             : 
      62             : 
      63             : void EvtModel::registerModel(EvtDecayBase* prototype){
      64             : 
      65           0 :   std::string modelName= prototype->getName();
      66             : 
      67           0 :   _modelNameHash[modelName]=prototype;
      68             : 
      69           0 :   std::string commandName=prototype->commandName();
      70             :   
      71           0 :   if (commandName!=""){
      72             : 
      73           0 :     _commandNameHash[commandName]=prototype;
      74             : 
      75           0 :   }
      76             : 
      77           0 : }
      78             : 
      79             : int EvtModel::isModel(std::string model_name){
      80             : 
      81           0 :   if ( _modelNameHash.find(model_name)!=_modelNameHash.end() ) {
      82           0 :     return 1;
      83             :   }
      84           0 :   return 0;
      85           0 : }
      86             : 
      87             : 
      88             : int EvtModel::isCommand(std::string cmd){
      89             : 
      90           0 :   if ( _commandNameHash.find(cmd)!=_commandNameHash.end() ) {
      91           0 :     return 1;
      92             :   }
      93           0 :   return 0;
      94           0 : }
      95             : 
      96             : void EvtModel::storeCommand(std::string cmd,std::string cnfgstr){
      97             : 
      98             :   EvtDecayBase *model=0;
      99           0 :   if ( _commandNameHash.find(cmd)!=_commandNameHash.end() ) {
     100           0 :     model=_commandNameHash[cmd];
     101           0 :   }
     102             : 
     103           0 :   assert(model!=0);
     104             : 
     105           0 :   model->command(cnfgstr);
     106             : 
     107           0 : }
     108             : 
     109             : 
     110             : 
     111             : 

Generated by: LCOV version 1.11