00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef PDT_HH
00030 #define PDT_HH
00031
00032 #include "MdcRecoUtil/PdtLund.h"
00033 #include "MdcRecoUtil/PdtGeant.h"
00034 #include "MdcRecoUtil/PdtPid.h"
00035 #include "MdcRecoUtil/PdtEntry.h"
00036 #include <string>
00037 #include <map>
00038
00039
00040
00041 #define PdtHashSize 503
00042
00043
00044
00045 #include <iosfwd>
00046
00047 template < class T > class AstStringMap;
00048
00049 class Pdt {
00050
00051 public:
00052
00053 static PdtEntry* lookup(const std::string& name);
00054 static PdtEntry* lookup(PdtLund::LundType id);
00055 static PdtEntry* lookup(PdtGeant::GeantType id);
00056 static PdtEntry* lookup(PdtPdg::PdgType id);
00057 static PdtEntry* lookup(PdtPid::PidType id, int charge=-1);
00058 static PdtEntry* lookup(PdtPid::PidNeutralType id,int charge=0);
00059
00060
00061
00062
00063
00064
00065
00066
00067 static bool sameOrConj( PdtLund::LundType id1, PdtLund::LundType id2);
00068 static bool sameOrConj( PdtPdg::PdgType id1, PdtPdg::PdgType id2);
00069 static bool sameOrConj( PdtEntry *id1, PdtEntry *id2);
00070
00071
00072 static const PdtEntry* conjugate( const PdtEntry* );
00073
00074
00075 static float mass(PdtLund::LundType id) { return lookup(id)->mass(); }
00076 static float mass(PdtGeant::GeantType id) { return lookup(id)->mass(); }
00077 static float mass(PdtPid::PidType id) { return lookup(id)->mass();}
00078 static float mass(PdtPid::PidNeutralType id) { return lookup(id)->mass();}
00079 static float mass(const char* name) { return lookup(name)->mass(); }
00080
00081
00082 static float width(PdtLund::LundType id) { return lookup(id)->width(); }
00083 static float width(PdtGeant::GeantType id) { return lookup(id)->width(); }
00084 static float width(PdtPid::PidType id) { return lookup(id)->width(); }
00085 static float width(PdtPid::PidNeutralType id) { return lookup(id)->width(); }
00086 static float width(const char* name) { return lookup(name)->width(); }
00087
00088
00089 static float lifetime(PdtLund::LundType id) { return lookup(id)->lifetime(); }
00090 static float lifetime(PdtGeant::GeantType id){ return lookup(id)->lifetime(); }
00091 static float lifetime(PdtPid::PidType id) { return lookup(id)->lifetime(); }
00092 static float lifetime(PdtPid::PidNeutralType id) { return lookup(id)->lifetime(); }
00093 static float lifetime(const char* name) { return lookup(name)->lifetime(); }
00094
00095
00096 static float spin(PdtLund::LundType id) { return lookup(id)->spin(); }
00097 static float spin(PdtGeant::GeantType id) { return lookup(id)->spin(); }
00098 static float spin(PdtPid::PidType id) { return lookup(id)->spin(); }
00099 static float spin(PdtPid::PidNeutralType id) { return lookup(id)->spin(); }
00100 static float spin(const char* name) { return lookup(name)->spin(); }
00101
00102
00103 static float charge(PdtLund::LundType id) { return lookup(id)->charge(); }
00104 static float charge(PdtGeant::GeantType id) { return lookup(id)->charge(); }
00105 static float charge(const char* name) { return lookup(name)->charge(); }
00106
00107
00108 static PdtLund::LundType antiCode(PdtLund::LundType);
00109
00110
00111 static void readMCppTable(std::string filenm);
00112
00113
00114 static void deleteAll();
00115
00116
00117 static void printOn( std::ostream & );
00118
00119
00120 static void addParticle(const char* pname, PdtLund::LundType id,
00121 float spin, float charge, float mass, float width=0.0,
00122 float cut = 0.0
00123 );
00124 static void addParticle(const char* pname, PdtGeant::GeantType id,
00125 float spin, float charge, float mass, float width=0.0,
00126 float cut = 0.0
00127 );
00128
00129 static void addDecay(const char* pname, float bf,
00130 const char* child1, const char* child2=0,
00131 const char* child3=0, const char* child4=0,
00132 const char* child5=0
00133 );
00134
00135 static void addDecay(PdtLund::LundType id, float bf,
00136 PdtLund::LundType child1,
00137 PdtLund::LundType child2=PdtLund::null,
00138 PdtLund::LundType child3=PdtLund::null,
00139 PdtLund::LundType child4=PdtLund::null,
00140 PdtLund::LundType child5=PdtLund::null
00141 );
00142
00143
00144 static PdtLund::LundType lundId (const PdtGeant::GeantType);
00145 static PdtLund::LundType lundId (const PdtPdg::PdgType);
00146 static PdtLund::LundType lundId (const PdtPid::PidType, int charge = -1);
00147 static PdtLund::LundType lundId (const PdtPid::PidNeutralType, int charge = 0);
00148
00149 static PdtPdg::PdgType pdgId (const PdtLund::LundType);
00150 static PdtPdg::PdgType pdgId (const PdtPid::PidType pid, int charge = -1)
00151 { return pdgId(lundId(pid, charge)); }
00152 static PdtPdg::PdgType pdgId (const PdtPid::PidNeutralType pid, int charge = 0)
00153 { return pdgId(lundId(pid, charge)); }
00154 static PdtPdg::PdgType pdgPid (const PdtGeant::GeantType geant)
00155 { return pdgId(lundId(geant)); }
00156
00157 static PdtGeant::GeantType geantId(const PdtLund::LundType);
00158 static PdtGeant::GeantType geantId(const PdtPid::PidType, int charge = -1);
00159 static PdtGeant::GeantType geantId(const PdtPid::PidNeutralType, int charge = 0);
00160 static PdtGeant::GeantType geantId(const PdtPdg::PdgType pdg)
00161 { return geantId(lundId(pdg)); }
00162
00163 static PdtPid::PidType pidId (const PdtLund::LundType);
00164 static PdtPid::PidType pidId (const PdtGeant::GeantType);
00165 static PdtPid::PidType pidId (const PdtPdg::PdgType pdg)
00166 { return pidId(lundId(pdg)); }
00167 static PdtPid::PidNeutralType pidNeutId (const PdtLund::LundType);
00168 static PdtPid::PidNeutralType pidNeutId (const PdtGeant::GeantType);
00169 static PdtPid::PidNeutralType pidNeutId (const PdtPdg::PdgType pdg)
00170 { return pidNeutId(lundId(pdg)); }
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180 static PdtLund::LundType lundId (const int id) { return (PdtLund::LundType) id; };
00181 static PdtGeant::GeantType geantId(const int id) { return (PdtGeant::GeantType) id; };
00182 static PdtPid::PidType pidId (const int id) { return (PdtPid::PidType) id; };
00183 static PdtPid::PidNeutralType pidNeutId (const int id) { return (PdtPid::PidNeutralType) id; };
00184 static PdtPdg::PdgType pdgId (const int id) { return (PdtPdg::PdgType) id; };
00185
00186
00187
00188 private:
00189
00190
00191 static std::map<int,PdtEntry*>* _entries;
00192 static AstStringMap< PdtEntry >* _entriesn;
00193 static std::map<int,PdtEntry*>* _entriesg;
00194 static std::map<int,PdtEntry*>* _entriesl;
00195
00196
00197
00198 static unsigned PdtNumHash(const int& num);
00199 static unsigned PdtNameHash(const std::string& c);
00200
00201
00202 static PdtEntry* _positiveEntries[5];
00203 static PdtEntry* _negativeEntries[5];
00204 static PdtEntry* _neutralEntries[5];
00205
00206 };
00207
00208 #endif
00209
00210
00211
00212