28#include "MdcRecoUtil/AstStringMap.h"
29#include "MdcRecoUtil/Pdt.h"
30#include "MdcRecoUtil/PdtEntry.h"
51#define HBARC (197.327*1.e-3*1.e-13)
53PdtEntry* Pdt::_positiveEntries[5]={0,0,0,0,0};
54PdtEntry* Pdt::_negativeEntries[5]={0,0,0,0,0};
55PdtEntry* Pdt::_neutralEntries[5]={0,0,0,0,0};
59Pdt::_entries =
new map<int, PdtEntry*>;
67Pdt::_entriesg =
new map<int, PdtEntry*>;
71Pdt::_entriesl =
new map<int, PdtEntry*>;
77 int i2 = (kf/10) % 10;
78 int i3 = (kf/100) % 10;
79 int i4 = (kf/1000) % 10;
81 if (i2 == i3 && i4 == 0 && kf > 100)
83 else if (kf >= 21 && kf <= 23)
return lundId(kf);
85 else if (kf == 310)
return lundId(130);
86 else if (kf == 130)
return lundId(310);
93 float width,
float cut){
96 (*_entries)[
pdgId(
id)]=nentry;
98 if ( (*_entriesn)[pname] != 0 ) {
102 _entriesn->
insert( pname )=nentry;
104 (*_entriesg)[nentry->
geantId()]=nentry;
107 (*_entriesl)[id]=nentry;
111 _positiveEntries[nentry->
pidId()]=nentry;
113 _negativeEntries[nentry->
pidId()]=nentry;
119 _neutralEntries[nentry->
pidNeutId()]=nentry;
127 float width,
float cut){
131 (*_entries)[
pdgId(
id)]=nentry;
132 if ( (*_entriesn)[pname] != 0 ) {
136 _entriesn->
insert( pname )=nentry;
138 (*_entriesg)[id]=nentry;
141 (*_entriesl)[
lundId(
id)]=nentry;
145 _positiveEntries[nentry->
pidId()]=nentry;
147 _negativeEntries[nentry->
pidId()]=nentry;
154 _neutralEntries[nentry->
pidNeutId()]=nentry;
161 const char* child1,
const char* child2,
const char* child3,
162 const char* child4,
const char* child5){
165 if (primary == 0)
return;
166 const char *children[5] = {child1, child2, child3, child4, child5};
168 vector<PdtEntry*> *kids =
new vector<PdtEntry*>;
171 for(nkids=0; nkids<5 && children[nkids]!=0; nkids++ )
174 if( secondary ==0 )
break;
175 kids->push_back(secondary);
190 if (primary == 0)
return;
193 vector<PdtEntry*> *kids =
new vector<PdtEntry*>;
196 for(nkids=0; nkids<5 && children[nkids]!=0; nkids++ )
199 if( secondary ==0 )
break;
200 kids->push_back(secondary);
208 return (*_entriesn)[name];
213 return (*_entriesl)[id];
218 return (*_entriesg)[id];
223 return (*_entries)[id];
230 if(
charge>0)
return _positiveEntries[id];
231 return _negativeEntries[id];
240 return _neutralEntries[id];
247 cout <<
"Number of particles in tables: "<<endl
248 <<
"By pdt number :" << _entries->size() <<endl
249 <<
"By name :" << _entriesn->
size()<<endl
250 <<
"By geant number :" << _entriesg->size()<<endl
251 <<
"By lund number :" <<_entriesl->size()<<endl;
255 for (i=0;i<72;i++) cout <<
'-';
258 cout <<
" Particle Data Table\n\n";
259 cout <<
" id name mass width spin charge lifetime\n";
260 cout <<
" (GeV) (GeV) (cm) \n";
261 for (i=0; i<72; i++) cout <<
'-';
266 map<int, PdtEntry*>::iterator
iter=_entries->begin();
268 while (
iter != _entries->end()) {
276 for (i=0; i<72; i++) cout <<
'-';
279 map<int, PdtEntry*>::iterator iter1=_entries->begin();
281 while ( iter1 != _entries->end()) {
283 cout <<
"The conjuate of "<< p->
name() <<
" is ";
293 string path = filenm;
295 FILE *ifl = fopen(path.c_str(),
"r");
297 if(0 == ifl) cout<<
" Pdt::readMCppTable: please copy " <<
298 filenm <<
" in to your run directory!"<<
302 while ( fgets(line,512,ifl) )
304 if (strlen(line) >= 511)
306 cerr <<
"Pdt.read : input line is too long\n";
309 istrstream linestr(line);
312 linestr >> opcode >> subcode;
314 if( opcode ==
"end" )
317 else if( opcode ==
"add" )
324 linestr >> classname;
326 if (classname ==
"Collision" )
333 linestr >> name >> type;
338 if (classname !=
"Meson")
355 linestr >>
ptype >> bf >> decayer >> nchild;
357 if (parent == 0)
continue;
359 vector<PdtEntry*> *kids =
new vector<PdtEntry*>;
362 for(i=0; i<nchild; i++ )
367 if( secondary ==0 )
break;
368 kids->push_back(secondary);
379 cerr <<
"Pdt.readMCppTable : unknown subcode '" << subcode
380 <<
"' for operation add\n";
397 map<int, PdtEntry*>::iterator
iter=_entries->begin();
399 while (
iter != _entries->end()) {
548 cerr <<
"error: wrong charge; must be +1 or -1" << endl;
575 cerr <<
"error: wrong charge; must be +1 or -1" << endl;
583 switch ( (
int) pdg ) {
611 switch ( (
int) lund ) {
642unsigned Pdt::PdtNumHash(
const int&
num){
650unsigned Pdt::PdtNameHash(
const string& c){
655 for(i=0;i<(int)c.length();i++){
672 if ( (pdt1==0) || (pdt2==0) )
return false;
673 if ( pdt1->
pdgId() == pdt2->
pdgId() )
return true;
683 if( pdt==0 )
return 0;
694 map<int, PdtEntry*>::iterator
iter=_entries->find(
key);
696 if (
iter!=_entries->end() ) {
698 conjPdt=
iter->second;
string::const_iterator ptype
*************DOUBLE PRECISION m_pi *DOUBLE PRECISION m_HvecTau2 DOUBLE PRECISION m_HvClone2 DOUBLE PRECISION m_gamma1 DOUBLE PRECISION m_gamma2 DOUBLE PRECISION m_thet1 DOUBLE PRECISION m_thet2 INTEGER m_IFPHOT *COMMON c_Taupair $ !Spin Polarimeter vector first Tau $ !Spin Polarimeter vector second Tau $ !Clone Spin Polarimeter vector first Tau $ !Clone Spin Polarimeter vector second Tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !phi of HvecTau1 $ !theta of HvecTau1 $ !phi of HvecTau2 $ !theta of HvecTau2 $ !super key
virtual T *& insert(const std::string &key)
PdtPid::PidNeutralType pidNeutId() const
const PdtEntry * conjugate() const
PdtGeant::GeantType geantId() const
PdtPid::PidType pidId() const
void addDecay(float bf, vector< PdtEntry * > *kids)
PdtPdg::PdgType pdgId() const
const char * name() const
void printOn(std::ostream &str) const
void printBFOn(std::ostream &str) const
static const GeantType _firstGeantId
static const PdtLund::LundType _lundId[52]
static const int _nGeantId
static float lifetime(PdtLund::LundType id)
static float width(PdtLund::LundType id)
static void printOn(std::ostream &)
static PdtLund::LundType antiCode(PdtLund::LundType)
static bool sameOrConj(PdtLund::LundType id1, PdtLund::LundType id2)
static PdtPid::PidType pidId(const PdtLund::LundType)
static void readMCppTable(std::string filenm)
static PdtGeant::GeantType geantId(const PdtLund::LundType)
static PdtPdg::PdgType pdgId(const PdtLund::LundType)
static PdtPid::PidNeutralType pidNeutId(const PdtLund::LundType)
static PdtLund::LundType lundId(const PdtGeant::GeantType)
static PdtEntry * lookup(const std::string &name)
static const PdtEntry * conjugate(const PdtEntry *)
static float spin(PdtLund::LundType id)
static void addParticle(const char *pname, PdtLund::LundType id, float spin, float charge, float mass, float width=0.0, float cut=0.0)
static void addDecay(const char *pname, float bf, const char *child1, const char *child2=0, const char *child3=0, const char *child4=0, const char *child5=0)