12#include "RConfigure.h"
74 if (*fgInstance !=
nullptr) {
75 Warning(
"TDatabasePDG",
"object already instantiated");
78 gROOT->GetListOfSpecials()->Add(
this);
100 *fgInstance =
nullptr;
109 if (*fgInstance ==
nullptr) {
146 const char* ParticleClass,
154 printf(
" *** TDatabasePDG::AddParticle: particle with PDGcode=%d already defined\n",PDGcode);
159 charge, ParticleClass, PDGcode, Anti,
185 printf(
" *** TDatabasePDG::AddAntiParticle: can't redefine parameters\n");
189 Int_t pdg_code = abs(PdgCode);
193 printf(
" *** TDatabasePDG::AddAntiParticle: particle with pdg code %d not known\n", pdg_code);
270 switch(Geant3number) {
273 case 25 :
return -2112;
275 case 26 :
return -3122;
277 case 27 :
return -3222;
279 case 28 :
return -3212;
281 case 29 :
return -3112;
283 case 30 :
return -3322;
285 case 31 :
return -3312;
287 case 32 :
return -3334;
288 case 9 :
return -211;
289 case 33 :
return -15;
290 case 10 :
return 130;
292 case 11 :
return 321;
293 case 35 :
return 411;
294 case 12 :
return -321;
295 case 36 :
return -411;
296 case 13 :
return 2112;
297 case 37 :
return 421;
298 case 14 :
return 2212;
299 case 38 :
return -421;
300 case 15 :
return -2212;
301 case 39 :
return 431;
302 case 16 :
return 310;
303 case 40 :
return -431;
304 case 17 :
return 221;
305 case 41 :
return 4122;
306 case 18 :
return 3122;
308 case 19 :
return 3222;
309 case 43 :
return -24;
310 case 20 :
return 3212;
312 case 21 :
return 3112;
314 case 22 :
return 3322;
316 case 23 :
return 3312;
318 case 24 :
return 3334;
334 case -2112 :
return 25;
336 case -3122 :
return 26;
338 case -3222 :
return 27;
340 case -3212 :
return 28;
342 case -3112 :
return 29;
344 case -3322 :
return 30;
346 case -3312 :
return 31;
348 case -3334 :
return 32;
349 case -211 :
return 9;
350 case -15 :
return 33;
351 case 130 :
return 10;
353 case 321 :
return 11;
354 case 411 :
return 35;
355 case -321 :
return 12;
356 case -411 :
return 36;
357 case 2112 :
return 13;
358 case 421 :
return 37;
359 case 2212 :
return 14;
360 case -421 :
return 38;
361 case -2212 :
return 15;
362 case 431 :
return 39;
363 case 310 :
return 16;
364 case -431 :
return 40;
365 case 221 :
return 17;
366 case 4122 :
return 41;
367 case 3122 :
return 18;
369 case 3222 :
return 19;
370 case -24 :
return 43;
371 case 3212 :
return 20;
373 case 3112 :
return 21;
374 case 3322 :
return 22;
375 case 3312 :
return 23;
376 case 3334 :
return 24;
405 case -80 :
return -24;
407 case 230 :
return 311;
408 case -230 :
return -311;
409 case 330 :
return 331;
411 case -340 :
return 0;
412 case 440 :
return 441;
413 case 111 :
return 113;
414 case 121 :
return 213;
415 case -121 :
return -213;
416 case 221 :
return 223;
417 case 131 :
return 323;
418 case -131 :
return -323;
419 case 231 :
return 313;
420 case -231 :
return -313;
421 case 331 :
return 333;
422 case -140 :
return 421;
423 case 140 :
return -421;
424 case 141 :
return -423;
425 case -141 :
return 423;
426 case -240 :
return -411;
427 case 240 :
return 411;
428 case 241 :
return -413;
429 case -241 :
return 413;
431 case -341 :
return 0;
432 case 441 :
return 443;
435 case 250 :
return 511;
436 case -250 :
return -511;
437 case 150 :
return 521;
438 case -150 :
return -521;
439 case 350 :
return 531;
440 case -350 :
return -531;
441 case 351 :
return 533;
442 case -351 :
return -533;
443 case 450 :
return 541;
444 case -450 :
return -541;
446 case 1140 :
return 4222;
447 case -1140 :
return -4222;
448 case 1240 :
return 4212;
449 case -1240 :
return -4212;
450 case 2140 :
return 4122;
451 case -2140 :
return -4122;
452 case 2240 :
return 4112;
453 case -2240 :
return -4112;
454 case 1340 :
return 0;
455 case -1340 :
return 0;
456 case 3140 :
return 0;
457 case -3140 :
return 0;
458 case 2340 :
return 0;
459 case -2340 :
return 0;
460 case 3240 :
return 0;
461 case -3240 :
return 0;
462 case 3340 :
return 0;
463 case -3340 :
return 0;
464 case 1440 :
return 0;
465 case -1440 :
return 0;
466 case 2440 :
return 0;
467 case -2440 :
return 0;
468 case 3440 :
return 0;
469 case -3440 :
return 0;
470 case 1111 :
return 2224;
471 case -1111 :
return -2224;
472 case 1121 :
return 2214;
473 case -1121 :
return -2214;
474 case 1221 :
return 2114;
475 case -1221 :
return -2114;
476 case 2221 :
return 1114;
477 case -2221 :
return -1114;
478 case 1131 :
return 3224;
479 case -1131 :
return -3224;
480 case 1231 :
return 3214;
481 case -1231 :
return -3214;
482 case 2231 :
return 3114;
483 case -2231 :
return -3114;
484 case 1331 :
return 3324;
485 case -1331 :
return -3324;
486 case 2331 :
return 3314;
487 case -2331 :
return -3314;
488 case 3331 :
return 3334;
489 case -3331 :
return -3334;
490 case 1141 :
return 0;
491 case -1141 :
return 0;
492 case 1241 :
return 0;
493 case -1241 :
return 0;
494 case 2241 :
return 0;
495 case -2241 :
return 0;
496 case 1341 :
return 0;
497 case -1341 :
return 0;
498 case 2341 :
return 0;
499 case -2341 :
return 0;
500 case 3341 :
return 0;
501 case -3341 :
return 0;
502 case 1441 :
return 0;
503 case -1441 :
return 0;
504 case 2441 :
return 0;
505 case -2441 :
return 0;
506 case 3441 :
return 0;
507 case -3441 :
return 0;
508 case 4441 :
return 0;
509 case -4441 :
return 0;
512 case -12 :
return -11;
514 case -14 :
return -13;
516 case -16 :
return -15;
518 case -11 :
return -12;
520 case -13 :
return -14;
522 case -15 :
return -16;
523 case 110 :
return 111;
524 case 120 :
return 211;
525 case -120 :
return -211;
526 case 220 :
return 221;
527 case 130 :
return 321;
528 case -130 :
return -321;
529 case -20 :
return 130;
530 case 20 :
return 310;
533 case 1120 :
return 2212;
534 case -1120 :
return -2212;
535 case 1220 :
return 2112;
536 case -1220 :
return -2112;
537 case 2130 :
return 3122;
538 case -2130 :
return -3122;
539 case 1130 :
return 3222;
540 case -1130 :
return -3222;
541 case 1230 :
return 3212;
542 case -1230 :
return -3212;
543 case 2230 :
return 3112;
544 case -2230 :
return -3112;
545 case 1330 :
return 3322;
546 case -1330 :
return -3322;
547 case 2330 :
return 3312;
548 case -2330 :
return -3312;
570 default_name =
"pdg_table.txt";
577 FILE*
file = fopen(fn,
"r");
579 Error(
"ReadPDGTable",
"Could not open PDG particle file %s",fn);
584 Int_t class_number, anti, isospin, i3, spin, tracking_code;
585 Int_t ich, kf, nch, charge;
586 char name[30], class_name[30];
590 Int_t idecay, decay_type, flavor, ndau, stable;
599 if (fscanf(
file,
"%i",&ich)) {;}
603 if (fscanf(
file,
"%i",&kf )) {;}
605 if (fscanf(
file,
"%i",&anti )) {;}
610 if (fgets(
c,200,
file)) {;}
613 if (fscanf(
file,
"%i",&class_number)) {;}
615 if (fscanf(
file,
"%s",class_name)) {;}
617 if (fscanf(
file,
"%i",&charge)) {;}
619 if (fscanf(
file,
"%le",&mass)) {;}
623 if (fscanf(
file,
"%i",&isospin)) {;}
625 if (fscanf(
file,
"%i",&i3)) {;}
627 if (fscanf(
file,
"%i",&spin)) {;}
629 if (fscanf(
file,
"%i",&flavor)) {;}
631 if (fscanf(
file,
"%i",&tracking_code)) {;}
633 if (fscanf(
file,
"%i",&nch)) {;}
635 if (fgets(
c,200,
file)) {;}
636 if (
width > 1
e-10) stable = 0;
656 while ( ((c_input=getc(
file)) != EOF) && (ich <nch)) {
662 if (fscanf(
file,
"%i",&idecay)) {;}
664 if (fscanf(
file,
"%i",&decay_type)) {;}
666 if (fscanf(
file,
"%le",&branching_ratio)) {;}
668 if (fscanf(
file,
"%i",&ndau)) {;}
669 for (
int idau=0; idau<ndau; idau++) {
671 if (fscanf(
file,
"%i",&dau[idau])) {;}
679 if (fgets(
c,200,
file)) {;}
685 if (fgets(
c,200,
file)) {;}
699 if (
p->PdgCode() < 0) {
703 for (ich=0; ich<nch; ich++) {
707 for (
int i=0; i<ndau; i++) {
723 p->SetAntiParticle(ap);
748 Error(
"WritePDGTable",
"Do not have a valid PDG particle list;"
749 " consider loading it with ReadPDGTable first.");
755 Error(
"WritePDGTable",
"Could not open PDG particle file %s",
filename);
759 fprintf(
file,
"#--------------------------------------------------------------------\n");
760 fprintf(
file,
"# i NAME............. KF AP CLASS Q MASS WIDTH 2*I+1 I3 2*S+1 FLVR TrkCod N(dec)\n");
761 fprintf(
file,
"#--------------------------------------------------------------------\n");
764 for(
Int_t i=0;i<nparts;++i) {
770 fprintf(
file,
"%5i %-20s %- 6i ", ich,
p->
GetName(), kf);
772 Int_t anti=
p->AntiParticle() ? 1:0;
774 for(
Int_t j=0;j<nparts;++j) {
776 if(dummy==
p->AntiParticle()) {
781 fprintf(
file,
"%i 0\n",anti);
785 fprintf(
file,
"%i ",anti);
786 fprintf(
file,
"%i ",100);
787 fprintf(
file,
"%s ",
p->ParticleClass());
789 fprintf(
file,
"%.5le ",
p->Mass());
790 fprintf(
file,
"%.5le ",
p->Width());
794 fprintf(
file,
"%i ",-1);
795 fprintf(
file,
"%i ",
p->TrackingCode());
796 Int_t nch=
p->NDecayChannels();
797 fprintf(
file,
"%i\n",nch);
801 fprintf(
file,
"#----------------------------------------------------------------------\n");
802 fprintf(
file,
"# decay type(PY6) BR Nd daughters(codes, then names)\n");
803 fprintf(
file,
"#----------------------------------------------------------------------\n");
804 for(
Int_t j=0;j<nch;++j) {
811 fprintf(
file,
"%3i ",ndau);
812 for (
int idau=0; idau<ndau; idau++) {
815 for (
int idau=0; idau<ndau; idau++) {
820 fprintf(
file,
"%-10s ",
"???");
TDatabasePDG ** GetInstancePtr()
Static function holding the instance.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
R__EXTERN TSystem * gSystem
Using a TBrowser one can browse all ROOT objects.
virtual Int_t GetEntries() const
void Browse(TBrowser *b) override
Browse this collection (called by TBrowser).
Particle database manager class.
virtual void Browse(TBrowser *b)
browse data base
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.
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.
virtual TParticlePDG * AddAntiParticle(const char *Name, Int_t PdgCode)
assuming particle has already been defined
THashList * fParticleList
TObjArray * fListOfClasses
virtual ~TDatabasePDG()
Cleanup the PDG database.
virtual void ReadPDGTable(const char *filename="")
read list of particles from a file if the particle list does not exist, it is created,...
virtual void Print(Option_t *opt="") const
Print contents of PDG database.
Description of the decay channel.
Int_t MatrixElementCode()
Int_t DaughterPdgCode(Int_t i)
Double_t BranchingRatio()
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
This class stores a (key,value) pair using an external hash.
void Add(ULong64_t hash, Long64_t key, Long64_t value)
Add an (key,value) pair to the table. The key should be unique.
Long64_t GetValue(ULong64_t hash, Long64_t key)
Return the value belonging to specified key and hash value.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
TObject * FindObject(const char *name) const override
Find object using its name.
void Add(TObject *obj) override
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
void Delete(Option_t *option="") override
Remove all objects from the array AND delete all heap based objects.
TObject * Remove(TObject *obj) override
Remove object from array.
void Add(TObject *obj) override
virtual const char * GetName() const
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.
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
@ 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.
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...
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
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.