12#include "RConfigure.h"
73 if (*fgInstance !=
nullptr) {
74 Warning(
"TDatabasePDG",
"object already instantiated");
77 gROOT->GetListOfSpecials()->Add(
this);
97 gROOT->GetListOfSpecials()->Remove(
this);
99 *fgInstance =
nullptr;
109 if (*fgInstance ==
nullptr) {
158 const char* ParticleClass,
166 Warning(
"AddParticle",
"Particle with PDGcode=%d already defined", PDGcode);
171 if (PDGcode < 0 && stable) {
174 stable = nonAntiParticle->Stable();
178 charge, ParticleClass, PDGcode, Anti,
204 Warning(
"AddAntiParticle",
"Can't redefine parameters");
208 Int_t pdg_code = abs(PdgCode);
212 Warning(
"AddAntiParticle",
"Particle with pdg code %d not known", pdg_code);
297 switch(Geant3number) {
300 case 25 :
return -2112;
302 case 26 :
return -3122;
304 case 27 :
return -3222;
306 case 28 :
return -3212;
308 case 29 :
return -3112;
310 case 30 :
return -3322;
312 case 31 :
return -3312;
314 case 32 :
return -3334;
315 case 9 :
return -211;
316 case 33 :
return -15;
317 case 10 :
return 130;
319 case 11 :
return 321;
320 case 35 :
return 411;
321 case 12 :
return -321;
322 case 36 :
return -411;
323 case 13 :
return 2112;
324 case 37 :
return 421;
325 case 14 :
return 2212;
326 case 38 :
return -421;
327 case 15 :
return -2212;
328 case 39 :
return 431;
329 case 16 :
return 310;
330 case 40 :
return -431;
331 case 17 :
return 221;
332 case 41 :
return 4122;
333 case 18 :
return 3122;
335 case 19 :
return 3222;
336 case 43 :
return -24;
337 case 20 :
return 3212;
339 case 21 :
return 3112;
341 case 22 :
return 3322;
343 case 23 :
return 3312;
345 case 24 :
return 3334;
361 case -2112 :
return 25;
363 case -3122 :
return 26;
365 case -3222 :
return 27;
367 case -3212 :
return 28;
369 case -3112 :
return 29;
371 case -3322 :
return 30;
373 case -3312 :
return 31;
375 case -3334 :
return 32;
376 case -211 :
return 9;
377 case -15 :
return 33;
378 case 130 :
return 10;
380 case 321 :
return 11;
381 case 411 :
return 35;
382 case -321 :
return 12;
383 case -411 :
return 36;
384 case 2112 :
return 13;
385 case 421 :
return 37;
386 case 2212 :
return 14;
387 case -421 :
return 38;
388 case -2212 :
return 15;
389 case 431 :
return 39;
390 case 310 :
return 16;
391 case -431 :
return 40;
392 case 221 :
return 17;
393 case 4122 :
return 41;
394 case 3122 :
return 18;
396 case 3222 :
return 19;
397 case -24 :
return 43;
398 case 3212 :
return 20;
400 case 3112 :
return 21;
401 case 3322 :
return 22;
402 case 3312 :
return 23;
403 case 3334 :
return 24;
432 case -80 :
return -24;
434 case 230 :
return 311;
435 case -230 :
return -311;
436 case 330 :
return 331;
438 case -340 :
return 0;
439 case 440 :
return 441;
440 case 111 :
return 113;
441 case 121 :
return 213;
442 case -121 :
return -213;
443 case 221 :
return 223;
444 case 131 :
return 323;
445 case -131 :
return -323;
446 case 231 :
return 313;
447 case -231 :
return -313;
448 case 331 :
return 333;
449 case -140 :
return 421;
450 case 140 :
return -421;
451 case 141 :
return -423;
452 case -141 :
return 423;
453 case -240 :
return -411;
454 case 240 :
return 411;
455 case 241 :
return -413;
456 case -241 :
return 413;
458 case -341 :
return 0;
459 case 441 :
return 443;
462 case 250 :
return 511;
463 case -250 :
return -511;
464 case 150 :
return 521;
465 case -150 :
return -521;
466 case 350 :
return 531;
467 case -350 :
return -531;
468 case 351 :
return 533;
469 case -351 :
return -533;
470 case 450 :
return 541;
471 case -450 :
return -541;
473 case 1140 :
return 4222;
474 case -1140 :
return -4222;
475 case 1240 :
return 4212;
476 case -1240 :
return -4212;
477 case 2140 :
return 4122;
478 case -2140 :
return -4122;
479 case 2240 :
return 4112;
480 case -2240 :
return -4112;
481 case 1340 :
return 0;
482 case -1340 :
return 0;
483 case 3140 :
return 0;
484 case -3140 :
return 0;
485 case 2340 :
return 0;
486 case -2340 :
return 0;
487 case 3240 :
return 0;
488 case -3240 :
return 0;
489 case 3340 :
return 0;
490 case -3340 :
return 0;
491 case 1440 :
return 0;
492 case -1440 :
return 0;
493 case 2440 :
return 0;
494 case -2440 :
return 0;
495 case 3440 :
return 0;
496 case -3440 :
return 0;
497 case 1111 :
return 2224;
498 case -1111 :
return -2224;
499 case 1121 :
return 2214;
500 case -1121 :
return -2214;
501 case 1221 :
return 2114;
502 case -1221 :
return -2114;
503 case 2221 :
return 1114;
504 case -2221 :
return -1114;
505 case 1131 :
return 3224;
506 case -1131 :
return -3224;
507 case 1231 :
return 3214;
508 case -1231 :
return -3214;
509 case 2231 :
return 3114;
510 case -2231 :
return -3114;
511 case 1331 :
return 3324;
512 case -1331 :
return -3324;
513 case 2331 :
return 3314;
514 case -2331 :
return -3314;
515 case 3331 :
return 3334;
516 case -3331 :
return -3334;
517 case 1141 :
return 0;
518 case -1141 :
return 0;
519 case 1241 :
return 0;
520 case -1241 :
return 0;
521 case 2241 :
return 0;
522 case -2241 :
return 0;
523 case 1341 :
return 0;
524 case -1341 :
return 0;
525 case 2341 :
return 0;
526 case -2341 :
return 0;
527 case 3341 :
return 0;
528 case -3341 :
return 0;
529 case 1441 :
return 0;
530 case -1441 :
return 0;
531 case 2441 :
return 0;
532 case -2441 :
return 0;
533 case 3441 :
return 0;
534 case -3441 :
return 0;
535 case 4441 :
return 0;
536 case -4441 :
return 0;
539 case -12 :
return -11;
541 case -14 :
return -13;
543 case -16 :
return -15;
545 case -11 :
return -12;
547 case -13 :
return -14;
549 case -15 :
return -16;
550 case 110 :
return 111;
551 case 120 :
return 211;
552 case -120 :
return -211;
553 case 220 :
return 221;
554 case 130 :
return 321;
555 case -130 :
return -321;
556 case -20 :
return 130;
557 case 20 :
return 310;
560 case 1120 :
return 2212;
561 case -1120 :
return -2212;
562 case 1220 :
return 2112;
563 case -1220 :
return -2112;
564 case 2130 :
return 3122;
565 case -2130 :
return -3122;
566 case 1130 :
return 3222;
567 case -1130 :
return -3222;
568 case 1230 :
return 3212;
569 case -1230 :
return -3212;
570 case 2230 :
return 3112;
571 case -2230 :
return -3112;
572 case 1330 :
return 3322;
573 case -1330 :
return -3322;
574 case 2330 :
return 3312;
575 case -2330 :
return -3312;
592 if (!isParticleListInitializedWhenInvoking &&
fParticleList) {
605 default_name =
"pdg_table.txt";
607 fn =
gEnv->GetValue(
"Root.DatabasePDG", default_name.
Data());
612 FILE* file = fopen(fn,
"r");
614 Error(
"ReadPDGTable",
"Could not open PDG particle file %s",fn);
619 Int_t class_number, anti, isospin, i3, spin, tracking_code;
620 Int_t ich, kf, nch, charge;
621 char name[30], class_name[30];
622 Double_t mass, width, branching_ratio;
625 Int_t idecay, decay_type, flavor, ndau, stable;
628 while ( (input=getc(file)) != EOF) {
634 if (fscanf(file,
"%i",&ich)) {;}
635 if (fscanf(file,
"%29s",
name )) {;}
637 if (fscanf(file,
"%i",&kf )) {;}
639 if (fscanf(file,
"%i",&anti )) {;}
644 if (fgets(
c,200,file)) {;}
647 if (fscanf(file,
"%i",&class_number)) {;}
648 if (fscanf(file,
"%29s",class_name)) {;}
650 if (fscanf(file,
"%i",&charge)) {;}
652 if (fscanf(file,
"%le",&mass)) {;}
654 if (fscanf(file,
"%le",&width)) {;}
656 if (fscanf(file,
"%i",&isospin)) {;}
658 if (fscanf(file,
"%i",&i3)) {;}
660 if (fscanf(file,
"%i",&spin)) {;}
662 if (fscanf(file,
"%i",&flavor)) {;}
664 if (fscanf(file,
"%i",&tracking_code)) {;}
666 if (fscanf(file,
"%i",&nch)) {;}
668 if (fgets(
c,200,file)) {;}
669 if (width > 1
e-10) stable = 0;
689 while ( ((c_input=getc(file)) != EOF) && (ich <nch)) {
695 if (fscanf(file,
"%i",&idecay)) {;}
697 if (fscanf(file,
"%i",&decay_type)) {;}
699 if (fscanf(file,
"%le",&branching_ratio)) {;}
701 if (fscanf(file,
"%i",&ndau)) {;}
702 for (
int idau=0; idau<ndau; idau++) {
704 if (fscanf(file,
"%i",&dau[idau])) {;}
712 if (fgets(
c,200,file)) {;}
718 if (fgets(
c,200,file)) {;}
736 for (ich=0; ich<nch; ich++) {
740 for (
int i=0; i<ndau; i++) {
791 Error(
"WritePDGTable",
"Do not have a valid PDG particle list;"
792 " consider loading it with ReadPDGTable first.");
796 FILE *file = fopen(filename,
"w");
798 Error(
"WritePDGTable",
"Could not open PDG particle file %s",filename);
802 fprintf(file,
"#--------------------------------------------------------------------\n");
803 fprintf(file,
"# i NAME............. KF AP CLASS Q MASS WIDTH 2*I+1 I3 2*S+1 FLVR TrkCod N(dec)\n");
804 fprintf(file,
"#--------------------------------------------------------------------\n");
807 for(
Int_t i=0;i<nparts;++i) {
813 fprintf(file,
"%5i %-20s %- 6i ", ich, p->
GetName(), kf);
817 for(
Int_t j=0;j<nparts;++j) {
824 fprintf(file,
"%i 0\n",anti);
828 fprintf(file,
"%i ",anti);
829 fprintf(file,
"%i ",100);
832 fprintf(file,
"%.5le ",p->
Mass());
833 fprintf(file,
"%.5le ",p->
Width());
835 fprintf(file,
"%i ",(
Int_t)p->
I3());
837 fprintf(file,
"%i ",-1);
840 fprintf(file,
"%i\n",nch);
844 fprintf(file,
"#----------------------------------------------------------------------\n");
845 fprintf(file,
"# decay type(PY6) BR Nd daughters(codes, then names)\n");
846 fprintf(file,
"#----------------------------------------------------------------------\n");
847 for(
Int_t j=0;j<nch;++j) {
850 fprintf(file,
"%9i ",dc->
Number()+1);
854 fprintf(file,
"%3i ",ndau);
855 for (
int idau=0; idau<ndau; idau++) {
858 for (
int idau=0; idau<ndau; idau++) {
861 fprintf(file,
"%-10s ",dummy->
GetName());
863 fprintf(file,
"%-10s ",
"???");
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
long long Long64_t
Portable signed long integer 8 bytes.
const char Option_t
Option string (const char).
TDatabasePDG ** GetInstancePtr()
Static function holding the instance.
#define R__WRITE_LOCKGUARD(mutex)
#define R__READ_LOCKGUARD(mutex)
Using a TBrowser one can browse all ROOT objects.
Particle database manager class.
virtual Int_t WritePDGTable(const char *filename)
write contents of the particle DB into a file
static TDatabasePDG * Instance()
static function
virtual Int_t ConvertGeant3ToPdg(Int_t Geant3Number) const
Converts Geant3 particle codes to PDG convention.
virtual Int_t ConvertPdgToGeant3(Int_t pdgNumber) const
Converts pdg code to geant3 id.
void BuildPdgMap() const
Build fPdgMap mapping pdg-code to particle.
virtual Int_t ConvertIsajetToPdg(Int_t isaNumber) const
Converts the ISAJET Particle number into the PDG MC number.
TParticleClassPDG * GetParticleClass(const char *name)
TParticlePDG * GetParticle(Int_t pdgCode) const
Get a pointer to the particle object according to the MC code number.
TDatabasePDG(const TDatabasePDG &db)
virtual TParticlePDG * AddParticle(const char *Name, const char *Title, Double_t Mass, Bool_t Stable, Double_t DecayWidth, Double_t Charge, const char *ParticleClass, Int_t PdgCode, Int_t Anti=-1, Int_t TrackingCode=0)
Particle definition normal constructor.
TDatabasePDG()
Create PDG database.
~TDatabasePDG() override
Cleanup the PDG database.
TExMap * fPdgMap
!hash-map from pdg-code to particle
void Print(Option_t *opt="") const override
Print contents of PDG database.
virtual TParticlePDG * AddAntiParticle(const char *Name, Int_t PdgCode)
assuming particle has already been defined
THashList * fParticleList
TObjArray * fListOfClasses
virtual void ReadPDGTableImpl(const char *filename, bool isParticleListInitializedWhenInvoking)
void Browse(TBrowser *b) override
browse data base
virtual void ReadPDGTable(const char *filename="")
read list of particles from a file if the particle list does not exist, it is created,...
Description of the decay channel.
Int_t MatrixElementCode()
Int_t DaughterPdgCode(Int_t i)
Double_t BranchingRatio()
This class stores a (key,value) pair using an external hash.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
const char * GetName() const override
Returns name of object.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
@ kInvalidObject
if object ctor succeeded but object should not be used
Utility class used internally by TDatabasePDG.
void AddParticle(TObject *p)
Description of the static properties of a particle.
void Print(Option_t *opt="") const override
Print the entire information of this kind of particle.
const char * ParticleClass() const
TDecayChannel * DecayChannel(Int_t i)
return pointer to decay channel object at index i
Int_t AddDecayChannel(Int_t Type, Double_t BranchingRatio, Int_t NDaughters, Int_t *DaughterPdgCode)
add new decay channel, Particle owns those...
Int_t TrackingCode() const
TParticlePDG * AntiParticle()
Int_t NDecayChannels() const
void SetAntiParticle(TParticlePDG *ap)
static const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
const char * Data() const
externTVirtualRWMutex * gCoreMutex