#include "TDecayChannel.h"
#include "TParticlePDG.h"
#include "TDatabasePDG.h"
ClassImp(TParticlePDG)
TParticlePDG::TParticlePDG()
{
fPdgCode = 0;
fMass = 0;
fCharge = 0;
fLifetime = 0;
fWidth = 0;
fParity = 0;
fSpin = 0;
fIsospin = 0;
fI3 = 0;
fStrangeness = 0;
fCharm = 0;
fBeauty = 0;
fTop = 0;
fY = 0;
fX = 0;
fStable = 0;
fDecayList = 0;
fTrackingCode = 0;
fAntiParticle = 0;
}
TParticlePDG::TParticlePDG(const char* Name, const char* Title, Double_t aMass,
Bool_t aStable, Double_t aWidth, Double_t aCharge,
const char* aParticleClass, Int_t aPdgCode, Int_t Anti,
Int_t aTrackingCode)
: TNamed(Name,Title)
{
fLifetime = 0;
fParity = 0;
fSpin = 0;
fIsospin = 0;
fI3 = 0;
fStrangeness = 0;
fCharm = 0;
fBeauty = 0;
fTop = 0;
fY = 0;
fX = 0;
fStable = 0;
fMass = aMass;
fStable = aStable;
fWidth = aWidth;
fCharge = aCharge;
fParticleClass = aParticleClass;
fPdgCode = aPdgCode;
fTrackingCode = aTrackingCode;
fDecayList = NULL;
if (Anti) fAntiParticle = this;
else fAntiParticle = 0;
const Double_t kHbar = 6.58211889e-25;
if (fWidth != 0.) fLifetime = kHbar / fWidth;
}
TParticlePDG::TParticlePDG(const TParticlePDG& pdg) :
TNamed(pdg),
fPdgCode(pdg.fPdgCode),
fMass(pdg.fMass),
fCharge(pdg.fCharge),
fLifetime(pdg.fLifetime),
fWidth(pdg.fWidth),
fParity(pdg.fParity),
fSpin(pdg.fSpin),
fIsospin(pdg.fIsospin),
fI3(pdg.fI3),
fStrangeness(pdg.fStrangeness),
fCharm(pdg.fCharm),
fBeauty(pdg.fBeauty),
fTop(pdg.fTop),
fY(pdg.fY),
fX(pdg.fX),
fStable(pdg.fStable),
fDecayList(pdg.fDecayList),
fParticleClass(pdg.fParticleClass),
fTrackingCode(pdg.fTrackingCode),
fAntiParticle(pdg.fAntiParticle)
{
}
TParticlePDG& TParticlePDG::operator=(const TParticlePDG& pdg)
{
if(this!=&pdg) {
TNamed::operator=(pdg);
fPdgCode=pdg.fPdgCode;
fMass=pdg.fMass;
fCharge=pdg.fCharge;
fLifetime=pdg.fLifetime;
fWidth=pdg.fWidth;
fParity=pdg.fParity;
fSpin=pdg.fSpin;
fIsospin=pdg.fIsospin;
fI3=pdg.fI3;
fStrangeness=pdg.fStrangeness;
fCharm=pdg.fCharm;
fBeauty=pdg.fBeauty;
fTop=pdg.fTop;
fY=pdg.fY;
fX=pdg.fX;
fStable=pdg.fStable;
fDecayList=pdg.fDecayList;
fParticleClass=pdg.fParticleClass;
fTrackingCode=pdg.fTrackingCode;
fAntiParticle=pdg.fAntiParticle;
}
return *this;
}
TParticlePDG::~TParticlePDG() {
if (fDecayList) {
fDecayList->Delete();
delete fDecayList;
}
}
Int_t TParticlePDG::AddDecayChannel(Int_t Type,
Double_t BranchingRatio,
Int_t NDaughters,
Int_t* DaughterPdgCode)
{
Int_t n = NDecayChannels();
if (NDecayChannels() == 0) {
fDecayList = new TObjArray(5);
}
TDecayChannel* dc = new TDecayChannel(n,Type,BranchingRatio,NDaughters,
DaughterPdgCode);
fDecayList->Add(dc);
return 0;
}
TDecayChannel* TParticlePDG::DecayChannel(Int_t i)
{
return (TDecayChannel*) fDecayList->At(i);
}
void TParticlePDG::PrintDecayChannel(TDecayChannel* dc, Option_t* option) const
{
if (strstr(option,"banner")) {
printf(" Channel Code BranchingRatio Nd ");
printf(" ...................Daughters.................... \n");
}
if (strstr(option,"data")) {
TDatabasePDG* db = TDatabasePDG::Instance();
printf("%7i %5i %12.5e %5i ",
dc->Number(),
dc->MatrixElementCode(),
dc->BranchingRatio(),
dc->NDaughters());
for (int i=0; i<dc->NDaughters(); i++) {
int ic = dc->DaughterPdgCode(i);
TParticlePDG* p = db->GetParticle(ic);
printf(" %15s(%8i)",p->GetName(),ic);
}
printf("\n");
}
}
void TParticlePDG::Print(Option_t *) const
{
printf("%-20s %6d\t",GetName(),fPdgCode);
if (!fStable) {
printf("Mass:%9.4f Width (GeV):%11.4e\tCharge: %5.1f\n",
fMass, fWidth, fCharge);
} else {
printf("Mass:%9.4f Width (GeV): Stable\tCharge: %5.1f\n",
fMass, fCharge);
}
if (fDecayList) {
int banner_printed = 0;
TIter next(fDecayList);
TDecayChannel* dc;
while ((dc = (TDecayChannel*)next())) {
if (! banner_printed) {
PrintDecayChannel(dc,"banner");
banner_printed = 1;
}
PrintDecayChannel(dc,"data");
}
}
}