28#include "MdcRecoUtil/Pdt.h"
29#include "MdcRecoUtil/AstStringMap.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 };
73 int i2 = ( kf / 10 ) % 10;
74 int i3 = ( kf / 100 ) % 10;
75 int i4 = ( kf / 1000 ) % 10;
77 if ( i2 == i3 && i4 == 0 && kf > 100 )
return lundId( kf );
78 else if ( kf >= 21 && kf <= 23 )
return lundId( kf );
80 else if ( kf == 310 )
return lundId( 130 );
81 else if ( kf == 130 )
return lundId( 310 );
90 ( *_entries )[
pdgId(
id )] = nentry;
92 if ( ( *_entriesn )[pname] != 0 )
97 _entriesn->insert( pname ) = nentry;
100 ( *_entriesl )[id] = nentry;
104 if ( nentry->
charge() > 0 ) { _positiveEntries[nentry->
pidId()] = nentry; }
105 else { _negativeEntries[nentry->
pidId()] = nentry; }
110 if ( nentry->
charge() == 0 ) { _neutralEntries[nentry->
pidNeutId()] = nentry; }
119 ( *_entries )[
pdgId(
id )] = nentry;
120 if ( ( *_entriesn )[pname] != 0 )
125 _entriesn->insert( pname ) = nentry;
128 ( *_entriesl )[
lundId(
id )] = nentry;
132 if ( nentry->
charge() > 0 ) { _positiveEntries[nentry->
pidId()] = nentry; }
133 else { _negativeEntries[nentry->
pidId()] = nentry; }
138 if ( nentry->
charge() == 0 ) { _neutralEntries[nentry->
pidNeutId()] = nentry; }
142void Pdt::addDecay(
const char* pname,
float bf,
const char* child1,
const char* child2,
143 const char* child3,
const char* child4,
const char* child5 ) {
146 if ( primary == 0 )
return;
147 const char* children[5] = { child1, child2, child3, child4, child5 };
149 vector<PdtEntry*>* kids =
new vector<PdtEntry*>;
152 for ( nkids = 0; nkids < 5 && children[nkids] != 0; nkids++ )
155 if ( secondary == 0 )
break;
156 kids->push_back( secondary );
167 if ( primary == 0 )
return;
170 vector<PdtEntry*>* kids =
new vector<PdtEntry*>;
173 for ( nkids = 0; nkids < 5 && children[nkids] != 0; nkids++ )
176 if ( secondary == 0 )
break;
177 kids->push_back( secondary );
187 return ( *_entriesl )[id];
192 return ( *_entriesg )[id];
197 return ( *_entries )[id];
204 if (
charge > 0 )
return _positiveEntries[id];
205 return _negativeEntries[id];
213 return _neutralEntries[id];
219 cout <<
"Number of particles in tables: " << endl
220 <<
"By pdt number :" << _entries->size() << endl
221 <<
"By name :" << _entriesn->
size() << endl
222 <<
"By geant number :" << _entriesg->size() << endl
223 <<
"By lund number :" << _entriesl->size() << endl;
227 for ( i = 0; i < 72; i++ ) cout <<
'-';
230 cout <<
" Particle Data Table\n\n";
231 cout <<
" id name mass width spin charge lifetime\n";
232 cout <<
" (GeV) (GeV) (cm) \n";
233 for ( i = 0; i < 72; i++ ) cout <<
'-';
240 while (
iter != _entries->end() )
249 for ( i = 0; i < 72; i++ ) cout <<
'-';
252 map<int, PdtEntry*>::iterator iter1 = _entries->begin();
254 while ( iter1 != _entries->end() )
257 cout <<
"The conjuate of " << p->
name() <<
" is ";
265 string path = filenm;
267 FILE* ifl = fopen( path.c_str(),
"r" );
270 cout <<
" Pdt::readMCppTable: please copy " << filenm <<
" in to your run directory!"
274 while ( fgets( line, 512, ifl ) )
276 if ( strlen( line ) >= 511 )
278 cerr <<
"Pdt.read : input line is too long\n";
281 istrstream linestr( line );
284 linestr >> opcode >> subcode;
286 if ( opcode ==
"end" )
break;
288 else if ( opcode ==
"add" )
294 linestr >> classname;
296 if ( classname ==
"Collision" )
continue;
302 linestr >> name >> type;
307 if ( classname !=
"Meson" )
spin /= 2.0;
321 linestr >>
ptype >> bf >> decayer >> nchild;
323 if ( parent == 0 )
continue;
325 vector<PdtEntry*>* kids =
new vector<PdtEntry*>;
328 for ( i = 0; i < nchild; i++ )
333 if ( secondary == 0 )
break;
334 kids->push_back( secondary );
344 cerr <<
"Pdt.readMCppTable : unknown subcode '" << subcode <<
"' for operation add\n";
362 while (
iter != _entries->end() )
477 cerr <<
"error: wrong charge; must be +1 or -1" << endl;
498 cerr <<
"error: wrong charge; must be +1 or -1" << endl;
565unsigned Pdt::PdtNumHash(
const int&
num ) {
573unsigned Pdt::PdtNameHash(
const string& c ) {
578 for ( i = 0; i < (int)c.length(); i++ ) { hash = ( 153 * hash + (int)c[i] ) %
PdtHashSize; }
592 if ( ( pdt1 == 0 ) || ( pdt2 == 0 ) )
return false;
593 if ( pdt1->
pdgId() == pdt2->
pdgId() )
return true;
599 if ( pdt == 0 )
return 0;
612 if (
iter != _entries->end() )
615 conjPdt =
iter->second;
string::const_iterator ptype
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared cut
*************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
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 float charge(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 float mass(PdtLund::LundType id)
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)