00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef PDGTOQQTABLE_HH
00011 #define PDGTOQQTABLE_HH
00012
00013 #include "CLHEP/config/CLHEP.h"
00014 #include <assert.h>
00015 #include <vector>
00016 #include <map>
00017
00018 #include "CLHEP/config/sstream.h"
00019 #include "CLHEP/HepPDT/QQDecayTable.hh"
00020
00021 #define QQTOPDTARRAYSIZE 520
00022
00023 namespace HepPDT {
00024
00029 class PDGtoQQTable {
00030 typedef std::map<int,int> PDTtoQQMap;
00031
00032 public:
00033 typedef PDTtoQQMap::const_iterator const_iterator;
00034 typedef PDTtoQQMap::iterator iterator;
00035
00036
00037 static PDGtoQQTable* instance();
00038
00039
00040
00041 void addPDTDefinition( int const & def, int val );
00042 void addQQDefinition( int const & def, int val );
00043 void buildTable( QQDecayTable & qd );
00044
00045
00046
00047 bool hasDefinition( int const & def ) const;
00048
00049
00050
00051 int QQnumber( int const & def ) const;
00052 int PDTnumber( int const & def ) const;
00053 void writeTranslations( std::ostream & os ) const;
00054
00055 int size() const { return itsPDTtoQQmap.size(); }
00056 iterator begin() { return itsPDTtoQQmap.begin(); }
00057 const_iterator begin() const { return itsPDTtoQQmap.begin(); }
00058 iterator end() { return itsPDTtoQQmap.end(); }
00059 const_iterator end() const { return itsPDTtoQQmap.end(); }
00060
00061 private:
00062 PDTtoQQMap itsPDTtoQQmap;
00063 std::vector<int> itsQQtoPDTarray;
00064
00065
00066 PDGtoQQTable(): itsPDTtoQQmap(), itsQQtoPDTarray(QQTOPDTARRAYSIZE,0) { ; }
00067 ~PDGtoQQTable();
00068
00069 PDGtoQQTable(const PDGtoQQTable&);
00070 PDGtoQQTable& operator=(const PDGtoQQTable&);
00071
00072 static PDGtoQQTable* _inst;
00073 static void destroy_and_clear();
00074
00075 struct Cleaner;
00076 friend struct Cleaner;
00077 struct Cleaner { ~Cleaner() { PDGtoQQTable::destroy_and_clear(); } };
00078
00079 };
00080
00081 }
00082
00083 #endif // PDGTOQQTABLE_HH