/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/MdcPatRec/TrkBase/TrkBase-00-01-12/src/TrkFitTypeKey.cxx

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: TrkFitTypeKey.cxx,v 1.1.1.1 2005/04/21 06:01:42 zhangy Exp $
00004 //
00005 // Description:
00006 //      Class TrkFitTypeKey
00007 //
00008 // Environment:
00009 //      Software developed for BaBar expirment @ SLAC B-Factory
00010 //
00011 // Author List:
00012 //      Eric A Charles
00013 //
00014 // Copyright Information:
00015 //      Copyright (C) 1998      Univ. Wisconsin-Madison
00016 //
00017 //------------------------------------------------------------------------
00018 
00019 //----------------
00020 // BaBar header
00021 //----------------
00022 //#include "BaBar/BaBar.hh"
00023 
00024 //-----------------------
00025 // This Class's Header --
00026 //-----------------------
00027 #include "TrkBase/TrkFitTypeKey.h"
00028 
00029 //-------------
00030 // C Headers --
00031 //-------------
00032 extern "C" {
00033 }
00034 
00035 //---------------
00036 // C++ Headers --
00037 //---------------
00038 
00039 //-------------------------------
00040 // Collaborating Class Headers --
00041 //-------------------------------
00042 
00043 #include "ProxyDict/IfdStrKey.h"
00044 using std::endl;
00045 using std::ostream;
00046 
00047 //-----------------------------------------------------------------------
00048 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00049 //-----------------------------------------------------------------------
00050 
00051 
00052 
00053 
00054 
00055 //              -----------------------------------------------
00056 //              -- Static Data & Function Member Definitions --
00057 //              -----------------------------------------------
00058 
00059 const int TrkFitTypeKey::_defaultValue(-1);
00060 std::vector<IfdKey*> TrkFitTypeKey::_keys ;
00061 std::vector<PdtPid::PidType> TrkFitTypeKey::_pidTypes ;
00062 
00063 int
00064 TrkFitTypeKey::newFitType( const char* name )
00065 {
00066   if ( name == 0 ) return _defaultValue;
00067   _keys.push_back( new IfdStrKey(name) );
00068   return (currentKey()-1);
00069 }
00070 
00071 void
00072 TrkFitTypeKey::killFitType( const TrkFitTypeKey key )
00073 {
00074   const int i = key.value();
00075   if ( i < 0 || i >= currentKey() ) return;
00076   IfdKey* theKey = _keys[i];
00077   assert(theKey != 0 );
00078   delete theKey;
00079   theKey = 0;
00080 }
00081 
00082 //----------------
00083 // Constructors --
00084 //----------------
00085 
00086 TrkFitTypeKey::TrkFitTypeKey( const char* name,
00087                               const PdtPid::PidType pid )
00088   :_value(newFitType(name))
00089 {
00090     if ( _value >= 0 ) _pidTypes.push_back(pid);
00091 }
00092 
00093 TrkFitTypeKey::TrkFitTypeKey( const TrkFitTypeKey& rhs )
00094   :_value(rhs.value())
00095 {
00096 }
00097 
00098 TrkFitTypeKey::TrkFitTypeKey( const int& val )
00099   :_value(val)
00100 {
00101 }
00102 
00103 //--------------
00104 // Destructor --
00105 //--------------
00106 
00107 TrkFitTypeKey::~TrkFitTypeKey( )
00108 {
00109 }
00110 
00111 
00112 void
00113 TrkFitTypeKey::printAll( ostream& os ) const
00114 {
00115   char* pidName(0);
00116   switch ( pidType() ) {
00117   case PdtPid::electron:
00118     pidName = "Electron";
00119     break;
00120   case PdtPid::muon:
00121     pidName = "Muon";
00122     break;
00123   case PdtPid::pion:
00124     pidName = "Pion";
00125     break;
00126   case PdtPid::kaon:
00127     pidName = "Kaon";
00128     break;
00129   case PdtPid::proton:
00130     pidName = "Proton";
00131     break;
00132   case PdtPid::null:
00133   default:
00134     pidName = "Unknown";
00135     break;
00136   }
00137   os << ifdKey() << ' ' << pidName << " key: " << _value << endl;
00138 }
00139 
00140 ostream&
00141 operator<<(ostream& os, const TrkFitTypeKey& key)
00142 {
00143   key.printAll(os);
00144   return os;
00145 }

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