12 #include "RConfigure.h" 71 if (*fgInstance !=
nullptr) {
72 Warning(
"TDatabasePDG",
"object already instantiated");
75 gROOT->GetListOfSpecials()->Add(
this);
95 gROOT->GetListOfSpecials()->Remove(
this);
97 *fgInstance =
nullptr;
106 if (*fgInstance ==
nullptr) {
143 const char* ParticleClass,
151 printf(
" *** TDatabasePDG::AddParticle: particle with PDGcode=%d already defined\n",PDGcode);
156 charge, ParticleClass, PDGcode, Anti,
182 printf(
" *** TDatabasePDG::AddAntiParticle: can't redefine parameters\n");
186 Int_t pdg_code = abs(PdgCode);
190 printf(
" *** TDatabasePDG::AddAntiParticle: particle with pdg code %d not known\n", pdg_code);
267 switch(Geant3number) {
270 case 25 :
return -2112;
272 case 26 :
return -3122;
274 case 27 :
return -3222;
276 case 28 :
return -3212;
278 case 29 :
return -3112;
280 case 30 :
return -3322;
282 case 31 :
return -3312;
284 case 32 :
return -3334;
285 case 9 :
return -211;
286 case 33 :
return -15;
287 case 10 :
return 130;
289 case 11 :
return 321;
290 case 35 :
return 411;
291 case 12 :
return -321;
292 case 36 :
return -411;
293 case 13 :
return 2112;
294 case 37 :
return 421;
295 case 14 :
return 2212;
296 case 38 :
return -421;
297 case 15 :
return -2212;
298 case 39 :
return 431;
299 case 16 :
return 310;
300 case 40 :
return -431;
301 case 17 :
return 221;
302 case 41 :
return 4122;
303 case 18 :
return 3122;
305 case 19 :
return 3222;
306 case 43 :
return -24;
307 case 20 :
return 3212;
309 case 21 :
return 3112;
311 case 22 :
return 3322;
313 case 23 :
return 3312;
315 case 24 :
return 3334;
331 case -2112 :
return 25;
333 case -3122 :
return 26;
335 case -3222 :
return 27;
337 case -3212 :
return 28;
339 case -3112 :
return 29;
341 case -3322 :
return 30;
343 case -3312 :
return 31;
345 case -3334 :
return 32;
346 case -211 :
return 9;
347 case -15 :
return 33;
348 case 130 :
return 10;
350 case 321 :
return 11;
351 case 411 :
return 35;
352 case -321 :
return 12;
353 case -411 :
return 36;
354 case 2112 :
return 13;
355 case 421 :
return 37;
356 case 2212 :
return 14;
357 case -421 :
return 38;
358 case -2212 :
return 15;
359 case 431 :
return 39;
360 case 310 :
return 16;
361 case -431 :
return 40;
362 case 221 :
return 17;
363 case 4122 :
return 41;
364 case 3122 :
return 18;
366 case 3222 :
return 19;
367 case -24 :
return 43;
368 case 3212 :
return 20;
370 case 3112 :
return 21;
371 case 3322 :
return 22;
372 case 3312 :
return 23;
373 case 3334 :
return 24;
402 case -80 :
return -24;
404 case 230 :
return 311;
405 case -230 :
return -311;
406 case 330 :
return 331;
408 case -340 :
return 0;
409 case 440 :
return 441;
410 case 111 :
return 113;
411 case 121 :
return 213;
412 case -121 :
return -213;
413 case 221 :
return 223;
414 case 131 :
return 323;
415 case -131 :
return -323;
416 case 231 :
return 313;
417 case -231 :
return -313;
418 case 331 :
return 333;
419 case -140 :
return 421;
420 case 140 :
return -421;
421 case 141 :
return -423;
422 case -141 :
return 423;
423 case -240 :
return -411;
424 case 240 :
return 411;
425 case 241 :
return -413;
426 case -241 :
return 413;
428 case -341 :
return 0;
429 case 441 :
return 443;
432 case 250 :
return 511;
433 case -250 :
return -511;
434 case 150 :
return 521;
435 case -150 :
return -521;
436 case 350 :
return 531;
437 case -350 :
return -531;
438 case 351 :
return 533;
439 case -351 :
return -533;
440 case 450 :
return 541;
441 case -450 :
return -541;
443 case 1140 :
return 4222;
444 case -1140 :
return -4222;
445 case 1240 :
return 4212;
446 case -1240 :
return -4212;
447 case 2140 :
return 4122;
448 case -2140 :
return -4122;
449 case 2240 :
return 4112;
450 case -2240 :
return -4112;
451 case 1340 :
return 0;
452 case -1340 :
return 0;
453 case 3140 :
return 0;
454 case -3140 :
return 0;
455 case 2340 :
return 0;
456 case -2340 :
return 0;
457 case 3240 :
return 0;
458 case -3240 :
return 0;
459 case 3340 :
return 0;
460 case -3340 :
return 0;
461 case 1440 :
return 0;
462 case -1440 :
return 0;
463 case 2440 :
return 0;
464 case -2440 :
return 0;
465 case 3440 :
return 0;
466 case -3440 :
return 0;
467 case 1111 :
return 2224;
468 case -1111 :
return -2224;
469 case 1121 :
return 2214;
470 case -1121 :
return -2214;
471 case 1221 :
return 2114;
472 case -1221 :
return -2114;
473 case 2221 :
return 1114;
474 case -2221 :
return -1114;
475 case 1131 :
return 3224;
476 case -1131 :
return -3224;
477 case 1231 :
return 3214;
478 case -1231 :
return -3214;
479 case 2231 :
return 3114;
480 case -2231 :
return -3114;
481 case 1331 :
return 3324;
482 case -1331 :
return -3324;
483 case 2331 :
return 3314;
484 case -2331 :
return -3314;
485 case 3331 :
return 3334;
486 case -3331 :
return -3334;
487 case 1141 :
return 0;
488 case -1141 :
return 0;
489 case 1241 :
return 0;
490 case -1241 :
return 0;
491 case 2241 :
return 0;
492 case -2241 :
return 0;
493 case 1341 :
return 0;
494 case -1341 :
return 0;
495 case 2341 :
return 0;
496 case -2341 :
return 0;
497 case 3341 :
return 0;
498 case -3341 :
return 0;
499 case 1441 :
return 0;
500 case -1441 :
return 0;
501 case 2441 :
return 0;
502 case -2441 :
return 0;
503 case 3441 :
return 0;
504 case -3441 :
return 0;
505 case 4441 :
return 0;
506 case -4441 :
return 0;
509 case -12 :
return -11;
511 case -14 :
return -13;
513 case -16 :
return -15;
515 case -11 :
return -12;
517 case -13 :
return -14;
519 case -15 :
return -16;
520 case 110 :
return 111;
521 case 120 :
return 211;
522 case -120 :
return -211;
523 case 220 :
return 221;
524 case 130 :
return 321;
525 case -130 :
return -321;
526 case -20 :
return 130;
527 case 20 :
return 310;
530 case 1120 :
return 2212;
531 case -1120 :
return -2212;
532 case 1220 :
return 2112;
533 case -1220 :
return -2112;
534 case 2130 :
return 3122;
535 case -2130 :
return -3122;
536 case 1130 :
return 3222;
537 case -1130 :
return -3222;
538 case 1230 :
return 3212;
539 case -1230 :
return -3212;
540 case 2230 :
return 3112;
541 case -2230 :
return -3112;
542 case 1330 :
return 3322;
543 case -1330 :
return -3322;
544 case 2330 :
return 3312;
545 case -2330 :
return -3312;
567 default_name =
"pdg_table.txt";
574 FILE*
file = fopen(fn,
"r");
576 Error(
"ReadPDGTable",
"Could not open PDG particle file %s",fn);
581 Int_t class_number, anti, isospin, i3, spin, tracking_code;
582 Int_t ich, kf, nch, charge;
583 char name[30], class_name[30];
584 Double_t mass, width, branching_ratio;
587 Int_t idecay, decay_type, flavor, ndau, stable;
590 while ( (input=getc(file)) != EOF) {
596 if (fscanf(file,
"%i",&ich)) {;}
598 if (fscanf(file,
"%s",name )) {;}
600 if (fscanf(file,
"%i",&kf )) {;}
602 if (fscanf(file,
"%i",&anti )) {;}
607 if (fgets(c,200,file)) {;}
610 if (fscanf(file,
"%i",&class_number)) {;}
612 if (fscanf(file,
"%s",class_name)) {;}
614 if (fscanf(file,
"%i",&charge)) {;}
616 if (fscanf(file,
"%le",&mass)) {;}
618 if (fscanf(file,
"%le",&width)) {;}
620 if (fscanf(file,
"%i",&isospin)) {;}
622 if (fscanf(file,
"%i",&i3)) {;}
624 if (fscanf(file,
"%i",&spin)) {;}
626 if (fscanf(file,
"%i",&flavor)) {;}
628 if (fscanf(file,
"%i",&tracking_code)) {;}
630 if (fscanf(file,
"%i",&nch)) {;}
632 if (fgets(c,200,file)) {;}
633 if (width > 1
e-10) stable = 0;
653 while ( ((c_input=getc(file)) != EOF) && (ich <nch)) {
659 if (fscanf(file,
"%i",&idecay)) {;}
661 if (fscanf(file,
"%i",&decay_type)) {;}
663 if (fscanf(file,
"%le",&branching_ratio)) {;}
665 if (fscanf(file,
"%i",&ndau)) {;}
666 for (
int idau=0; idau<ndau; idau++) {
668 if (fscanf(file,
"%i",&dau[idau])) {;}
676 if (fgets(c,200,file)) {;}
682 if (fgets(c,200,file)) {;}
700 for (ich=0; ich<nch; ich++) {
704 for (
int i=0; i<ndau; i++) {
745 Error(
"WritePDGTable",
"Do not have a valid PDG particle list;" 746 " consider loading it with ReadPDGTable first.");
750 FILE *
file = fopen(filename,
"w");
752 Error(
"WritePDGTable",
"Could not open PDG particle file %s",filename);
756 fprintf(file,
"#--------------------------------------------------------------------\n");
757 fprintf(file,
"# i NAME............. KF AP CLASS Q MASS WIDTH 2*I+1 I3 2*S+1 FLVR TrkCod N(dec)\n");
758 fprintf(file,
"#--------------------------------------------------------------------\n");
761 for(
Int_t i=0;i<nparts;++i) {
767 fprintf(file,
"%5i %-20s %- 6i ", ich, p->
GetName(), kf);
771 for(
Int_t j=0;j<nparts;++j) {
778 fprintf(file,
"%i 0\n",anti);
782 fprintf(file,
"%i ",anti);
783 fprintf(file,
"%i ",100);
786 fprintf(file,
"%.5le ",p->
Mass());
787 fprintf(file,
"%.5le ",p->
Width());
789 fprintf(file,
"%i ",(
Int_t)p->
I3());
791 fprintf(file,
"%i ",-1);
794 fprintf(file,
"%i\n",nch);
798 fprintf(file,
"#----------------------------------------------------------------------\n");
799 fprintf(file,
"# decay type(PY6) BR Nd daughters(codes, then names)\n");
800 fprintf(file,
"#----------------------------------------------------------------------\n");
801 for(
Int_t j=0;j<nch;++j) {
804 fprintf(file,
"%9i ",dc->
Number()+1);
808 fprintf(file,
"%3i ",ndau);
809 for (
int idau=0; idau<ndau; idau++) {
812 for (
int idau=0; idau<ndau; idau++) {
815 fprintf(file,
"%-10s ",dummy->
GetName());
817 fprintf(file,
"%-10s ",
"???");
virtual const char * GetName() const
Returns name of object.
void Add(ULong64_t hash, Long64_t key, Long64_t value)
Add an (key,value) pair to the table. The key should be unique.
Description of the decay channel.
TDatabasePDG()
Create PDG database.
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
const char * ParticleClass() const
virtual ~TDatabasePDG()
Cleanup the PDG database.
virtual Int_t GetEntries() const
Int_t NDecayChannels() const
void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
TObject * FindObject(const char *name) const
Find object using its name.
TParticleClassPDG * GetParticleClass(const char *name)
TDecayChannel * DecayChannel(Int_t i)
return pointer to decay channel object at index i
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.
Particle database manager class.
static TDatabasePDG * Instance()
static function
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
The TNamed class is the base class for all named ROOT classes.
virtual TParticlePDG * AddAntiParticle(const char *Name, Int_t PdgCode)
assuming particle has already been defined
TParticlePDG * AntiParticle()
virtual void Print(Option_t *opt="") const
Print the entire information of this kind of particle.
Int_t DaughterPdgCode(Int_t i)
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
Int_t MatrixElementCode()
virtual void Browse(TBrowser *b)
browse data base
virtual Int_t ConvertIsajetToPdg(Int_t isaNumber) const
Converts the ISAJET Particle number into the PDG MC number.
void SetAntiParticle(TParticlePDG *ap)
TObjArray * fListOfClasses
Using a TBrowser one can browse all ROOT objects.
Long64_t GetValue(ULong64_t hash, Long64_t key)
Return the value belonging to specified key and hash value.
R__EXTERN TSystem * gSystem
if object ctor succeeded but object should not be used
THashList * fParticleList
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Description of the static properties of a particle.
Int_t TrackingCode() const
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
void AddParticle(TObject *p)
virtual void ReadPDGTable(const char *filename="")
read list of particles from a file if the particle list does not exist, it is created, otherwise particles are added to the existing list See $ROOTSYS/etc/pdg_table.txt to see the file format
static const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
static RooMathCoreReg dummy
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
void Browse(TBrowser *b)
Browse this collection (called by TBrowser).
virtual Int_t ConvertGeant3ToPdg(Int_t Geant3Number) const
Converts Geant3 particle codes to PDG convention.
TParticlePDG * GetParticle(Int_t pdgCode) const
Get a pointer to the particle object according to the MC code number.
virtual Int_t WritePDGTable(const char *filename)
write contents of the particle DB into a file
TDatabasePDG ** GetInstancePtr()
Static function holding the instance.
void BuildPdgMap() const
Build fPdgMap mapping pdg-code to particle.
virtual void Add(TObject *obj)
Short_t Max(Short_t a, Short_t b)
virtual void Print(Option_t *opt="") const
Print contents of PDG database.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Double_t BranchingRatio()
Utility class used internally by TDatabasePDG.
virtual Int_t ConvertPdgToGeant3(Int_t pdgNumber) const
Converts pdg code to geant3 id.
This class stores a (key,value) pair using an external hash.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Int_t AddDecayChannel(Int_t Type, Double_t BranchingRatio, Int_t NDaughters, Int_t *DaughterPdgCode)
add new decay channel, Particle owns those...
const char * Data() const