Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:11:34

0001 // ----------------------------------------------------------------------
0002 //
0003 // DefTable.hh
0004 // Author: Lynn Garren
0005 //
0006 // ----------------------------------------------------------------------
0007 #ifndef DEFTABLE_HH
0008 #define DEFTABLE_HH
0009 
0010 #include <string>
0011 #include <map>
0012 
0013 namespace HepPDT {
0014 
0015 //! The DefTable class holds EvtGen definitions
0016 
0017 ///
0018 /// \class DefTable
0019 /// \author Lynn Garren
0020 ///
0021 /// This is temporary information storage used when reading EvtGen input.
0022 ///
0023 class DefTable  {
0024   typedef  std::map<std::string,double>            TempDefMap;
0025 
0026 public:
0027   typedef  TempDefMap::const_iterator  const_iterator;
0028   typedef  TempDefMap::iterator        iterator;
0029 
0030   DefTable( );
0031   ~DefTable()  { ; }
0032 
0033   // --- mutator
0034   //
0035   /// add a definition to the map
0036   void addDefinition( std::string const & def, double val ) { tempDefines[def] = val; }
0037 
0038   // --- boolean
0039   //
0040   /// is this definition already defined?
0041   bool hasDefinition( std::string const & def ) const;
0042 
0043   // --- accessors
0044   //
0045   /// get the size of the definition map
0046   int             size()  const { return tempDefines.size(); }
0047   /// return the definition of this parameter
0048   double          definition( std::string const & def );
0049   /// use for diagnostics
0050   void            writeDefinitions() const; // intended for diagnostic use
0051 
0052   /// begin iterating over the definition map
0053   iterator        begin()       { return tempDefines.begin(); }
0054   /// begin iterating over the definition map
0055   const_iterator  begin() const { return tempDefines.begin(); }
0056 
0057   /// end iterating over the definition map
0058   iterator        end()       { return tempDefines.end(); }
0059   /// end iterating over the definition map
0060   const_iterator  end() const { return tempDefines.end(); }
0061 
0062 private:
0063   TempDefMap           tempDefines; // hold EvtGen "Define" info
0064 
0065   // forbidden copy:
0066   DefTable &  operator = ( DefTable const & );
0067   DefTable( DefTable const & );
0068 
0069 };  // DefTable<>
0070 
0071 }  // namespace HepPDT
0072 
0073 #endif // DEFTABLE_HH