12#include "RConfigure.h"
74 if (*fgInstance !=
nullptr) {
75 Warning(
"TDatabasePDG",
"object already instantiated");
78 gROOT->GetListOfSpecials()->Add(
this);
100 *fgInstance =
nullptr;
110 if (*fgInstance ==
nullptr) {
159 const char* ParticleClass,
167 Warning(
"AddParticle",
"Particle with PDGcode=%d already defined", PDGcode);
172 charge, ParticleClass, PDGcode, Anti,
198 Warning(
"AddAntiParticle",
"Can't redefine parameters");
202 Int_t pdg_code = abs(PdgCode);
206 Warning(
"AddAntiParticle",
"Particle with pdg code %d not known", pdg_code);
291 switch(Geant3number) {
294 case 25 :
return -2112;
296 case 26 :
return -3122;
298 case 27 :
return -3222;
300 case 28 :
return -3212;
302 case 29 :
return -3112;
304 case 30 :
return -3322;
306 case 31 :
return -3312;
308 case 32 :
return -3334;
309 case 9 :
return -211;
310 case 33 :
return -15;
311 case 10 :
return 130;
313 case 11 :
return 321;
314 case 35 :
return 411;
315 case 12 :
return -321;
316 case 36 :
return -411;
317 case 13 :
return 2112;
318 case 37 :
return 421;
319 case 14 :
return 2212;
320 case 38 :
return -421;
321 case 15 :
return -2212;
322 case 39 :
return 431;
323 case 16 :
return 310;
324 case 40 :
return -431;
325 case 17 :
return 221;
326 case 41 :
return 4122;
327 case 18 :
return 3122;
329 case 19 :
return 3222;
330 case 43 :
return -24;
331 case 20 :
return 3212;
333 case 21 :
return 3112;
335 case 22 :
return 3322;
337 case 23 :
return 3312;
339 case 24 :
return 3334;
355 case -2112 :
return 25;
357 case -3122 :
return 26;
359 case -3222 :
return 27;
361 case -3212 :
return 28;
363 case -3112 :
return 29;
365 case -3322 :
return 30;
367 case -3312 :
return 31;
369 case -3334 :
return 32;
370 case -211 :
return 9;
371 case -15 :
return 33;
372 case 130 :
return 10;
374 case 321 :
return 11;
375 case 411 :
return 35;
376 case -321 :
return 12;
377 case -411 :
return 36;
378 case 2112 :
return 13;
379 case 421 :
return 37;
380 case 2212 :
return 14;
381 case -421 :
return 38;
382 case -2212 :
return 15;
383 case 431 :
return 39;
384 case 310 :
return 16;
385 case -431 :
return 40;
386 case 221 :
return 17;
387 case 4122 :
return 41;
388 case 3122 :
return 18;
390 case 3222 :
return 19;
391 case -24 :
return 43;
392 case 3212 :
return 20;
394 case 3112 :
return 21;
395 case 3322 :
return 22;
396 case 3312 :
return 23;
397 case 3334 :
return 24;
426 case -80 :
return -24;
428 case 230 :
return 311;
429 case -230 :
return -311;
430 case 330 :
return 331;
432 case -340 :
return 0;
433 case 440 :
return 441;
434 case 111 :
return 113;
435 case 121 :
return 213;
436 case -121 :
return -213;
437 case 221 :
return 223;
438 case 131 :
return 323;
439 case -131 :
return -323;
440 case 231 :
return 313;
441 case -231 :
return -313;
442 case 331 :
return 333;
443 case -140 :
return 421;
444 case 140 :
return -421;
445 case 141 :
return -423;
446 case -141 :
return 423;
447 case -240 :
return -411;
448 case 240 :
return 411;
449 case 241 :
return -413;
450 case -241 :
return 413;
452 case -341 :
return 0;
453 case 441 :
return 443;
456 case 250 :
return 511;
457 case -250 :
return -511;
458 case 150 :
return 521;
459 case -150 :
return -521;
460 case 350 :
return 531;
461 case -350 :
return -531;
462 case 351 :
return 533;
463 case -351 :
return -533;
464 case 450 :
return 541;
465 case -450 :
return -541;
467 case 1140 :
return 4222;
468 case -1140 :
return -4222;
469 case 1240 :
return 4212;
470 case -1240 :
return -4212;
471 case 2140 :
return 4122;
472 case -2140 :
return -4122;
473 case 2240 :
return 4112;
474 case -2240 :
return -4112;
475 case 1340 :
return 0;
476 case -1340 :
return 0;
477 case 3140 :
return 0;
478 case -3140 :
return 0;
479 case 2340 :
return 0;
480 case -2340 :
return 0;
481 case 3240 :
return 0;
482 case -3240 :
return 0;
483 case 3340 :
return 0;
484 case -3340 :
return 0;
485 case 1440 :
return 0;
486 case -1440 :
return 0;
487 case 2440 :
return 0;
488 case -2440 :
return 0;
489 case 3440 :
return 0;
490 case -3440 :
return 0;
491 case 1111 :
return 2224;
492 case -1111 :
return -2224;
493 case 1121 :
return 2214;
494 case -1121 :
return -2214;
495 case 1221 :
return 2114;
496 case -1221 :
return -2114;
497 case 2221 :
return 1114;
498 case -2221 :
return -1114;
499 case 1131 :
return 3224;
500 case -1131 :
return -3224;
501 case 1231 :
return 3214;
502 case -1231 :
return -3214;
503 case 2231 :
return 3114;
504 case -2231 :
return -3114;
505 case 1331 :
return 3324;
506 case -1331 :
return -3324;
507 case 2331 :
return 3314;
508 case -2331 :
return -3314;
509 case 3331 :
return 3334;
510 case -3331 :
return -3334;
511 case 1141 :
return 0;
512 case -1141 :
return 0;
513 case 1241 :
return 0;
514 case -1241 :
return 0;
515 case 2241 :
return 0;
516 case -2241 :
return 0;
517 case 1341 :
return 0;
518 case -1341 :
return 0;
519 case 2341 :
return 0;
520 case -2341 :
return 0;
521 case 3341 :
return 0;
522 case -3341 :
return 0;
523 case 1441 :
return 0;
524 case -1441 :
return 0;
525 case 2441 :
return 0;
526 case -2441 :
return 0;
527 case 3441 :
return 0;
528 case -3441 :
return 0;
529 case 4441 :
return 0;
530 case -4441 :
return 0;
533 case -12 :
return -11;
535 case -14 :
return -13;
537 case -16 :
return -15;
539 case -11 :
return -12;
541 case -13 :
return -14;
543 case -15 :
return -16;
544 case 110 :
return 111;
545 case 120 :
return 211;
546 case -120 :
return -211;
547 case 220 :
return 221;
548 case 130 :
return 321;
549 case -130 :
return -321;
550 case -20 :
return 130;
551 case 20 :
return 310;
554 case 1120 :
return 2212;
555 case -1120 :
return -2212;
556 case 1220 :
return 2112;
557 case -1220 :
return -2112;
558 case 2130 :
return 3122;
559 case -2130 :
return -3122;
560 case 1130 :
return 3222;
561 case -1130 :
return -3222;
562 case 1230 :
return 3212;
563 case -1230 :
return -3212;
564 case 2230 :
return 3112;
565 case -2230 :
return -3112;
566 case 1330 :
return 3322;
567 case -1330 :
return -3322;
568 case 2330 :
return 3312;
569 case -2330 :
return -3312;
586 if (!isParticleListInitializedWhenInvoking &&
fParticleList) {
599 default_name =
"pdg_table.txt";
606 FILE* file = fopen(fn,
"r");
608 Error(
"ReadPDGTable",
"Could not open PDG particle file %s",fn);
613 Int_t class_number, anti, isospin, i3, spin, tracking_code;
614 Int_t ich, kf, nch, charge;
615 char name[30], class_name[30];
619 Int_t idecay, decay_type, flavor, ndau, stable;
622 while ( (
input=getc(file)) != EOF) {
628 if (fscanf(file,
"%i",&ich)) {;}
630 if (fscanf(file,
"%s",
name )) {;}
632 if (fscanf(file,
"%i",&kf )) {;}
634 if (fscanf(file,
"%i",&anti )) {;}
639 if (fgets(
c,200,file)) {;}
642 if (fscanf(file,
"%i",&class_number)) {;}
644 if (fscanf(file,
"%s",class_name)) {;}
646 if (fscanf(file,
"%i",&charge)) {;}
648 if (fscanf(file,
"%le",&mass)) {;}
650 if (fscanf(file,
"%le",&
width)) {;}
652 if (fscanf(file,
"%i",&isospin)) {;}
654 if (fscanf(file,
"%i",&i3)) {;}
656 if (fscanf(file,
"%i",&spin)) {;}
658 if (fscanf(file,
"%i",&flavor)) {;}
660 if (fscanf(file,
"%i",&tracking_code)) {;}
662 if (fscanf(file,
"%i",&nch)) {;}
664 if (fgets(
c,200,file)) {;}
665 if (
width > 1
e-10) stable = 0;
685 while ( ((c_input=getc(file)) != EOF) && (ich <nch)) {
691 if (fscanf(file,
"%i",&idecay)) {;}
693 if (fscanf(file,
"%i",&decay_type)) {;}
695 if (fscanf(file,
"%le",&branching_ratio)) {;}
697 if (fscanf(file,
"%i",&ndau)) {;}
698 for (
int idau=0; idau<ndau; idau++) {
700 if (fscanf(file,
"%i",&dau[idau])) {;}
708 if (fgets(
c,200,file)) {;}
714 if (fgets(
c,200,file)) {;}
728 if (
p->PdgCode() < 0) {
732 for (ich=0; ich<nch; ich++) {
736 for (
int i=0; i<ndau; i++) {
752 p->SetAntiParticle(ap);
787 Error(
"WritePDGTable",
"Do not have a valid PDG particle list;"
788 " consider loading it with ReadPDGTable first.");
794 Error(
"WritePDGTable",
"Could not open PDG particle file %s",
filename);
798 fprintf(file,
"#--------------------------------------------------------------------\n");
799 fprintf(file,
"# i NAME............. KF AP CLASS Q MASS WIDTH 2*I+1 I3 2*S+1 FLVR TrkCod N(dec)\n");
800 fprintf(file,
"#--------------------------------------------------------------------\n");
803 for(
Int_t i=0;i<nparts;++i) {
809 fprintf(file,
"%5i %-20s %- 6i ", ich,
p->
GetName(), kf);
811 Int_t anti=
p->AntiParticle() ? 1:0;
813 for(
Int_t j=0;j<nparts;++j) {
815 if(dummy==
p->AntiParticle()) {
820 fprintf(file,
"%i 0\n",anti);
824 fprintf(file,
"%i ",anti);
825 fprintf(file,
"%i ",100);
826 fprintf(file,
"%s ",
p->ParticleClass());
827 fprintf(file,
"% i ",(
Int_t)
p->Charge());
828 fprintf(file,
"%.5le ",
p->Mass());
829 fprintf(file,
"%.5le ",
p->Width());
830 fprintf(file,
"%i ",(
Int_t)
p->Isospin());
831 fprintf(file,
"%i ",(
Int_t)
p->I3());
832 fprintf(file,
"%i ",(
Int_t)
p->Spin());
833 fprintf(file,
"%i ",-1);
834 fprintf(file,
"%i ",
p->TrackingCode());
835 Int_t nch=
p->NDecayChannels();
836 fprintf(file,
"%i\n",nch);
840 fprintf(file,
"#----------------------------------------------------------------------\n");
841 fprintf(file,
"# decay type(PY6) BR Nd daughters(codes, then names)\n");
842 fprintf(file,
"#----------------------------------------------------------------------\n");
843 for(
Int_t j=0;j<nch;++j) {
846 fprintf(file,
"%9i ",dc->
Number()+1);
850 fprintf(file,
"%3i ",ndau);
851 for (
int idau=0; idau<ndau; idau++) {
854 for (
int idau=0; idau<ndau; idau++) {
857 fprintf(file,
"%-10s ",dummy->
GetName());
859 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
#define R__WRITE_LOCKGUARD(mutex)
#define R__READ_LOCKGUARD(mutex)
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 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.
~TDatabasePDG() override
Cleanup the PDG database.
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()
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.
R__EXTERN TVirtualRWMutex * gCoreMutex
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.