]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TUHKMgen/UHKM/ParticlePDG.cxx
Update master to aliroot
[u/mrichter/AliRoot.git] / TUHKMgen / UHKM / ParticlePDG.cxx
1 //
2 //  Copyright   : The FASTMC and SPHMC Collaboration
3 //  Author      : Ionut Cristian Arsene 
4 //  Affiliation : Oslo University, Norway & Institute for Space Sciences, Bucharest, Romania
5 //  e-mail      : i.c.arsene@fys.uio.no
6 //  Date        : 2007/05/30
7 //
8 //  This class is using the particle and decay lists provided by the 
9 //  THERMINATOR (Computer Physics Communications 174 669 (2006)) and
10 //  SHARE (Computer Physics Communications 167 229 (2005)) collaborations.
11 //
12
13 #include <iostream>
14 #include <string>
15 using namespace std;
16 #include "ParticlePDG.h"
17
18 //________________________________________________________________________
19 ParticlePDG::ParticlePDG() :
20   fPDG(kNonsensePDG),
21   fMass(-1.0),
22   fWidth(0.0),
23   fSpin(0.0),
24   fIsospin(0.0),
25   fIsospinZ(0.0),
26   fLightQuarkNumber(0.0),
27   fAntiLightQuarkNumber(0.0),
28   fStrangeQuarkNumber(0.0),
29   fAntiStrangeQuarkNumber(0.0),
30   fCharmQuarkNumber(0.0),
31   fAntiCharmQuarkNumber(0.0),
32   fNDecayChannels(0),
33   fStable(0.0)
34 {
35 //
36 // default constructor
37 //
38   memset(fName,'a',9);
39   for(Int_t i=0; i<kMaxDecayChannels; i++)
40     fDecayChannels[i] = new DecayChannel();
41 }
42
43 //________________________________________________________________________
44 ParticlePDG::ParticlePDG(const Char_t * const name, Int_t pdg, Double_t mass, Double_t width) :
45   fPDG(pdg),
46   fMass(mass),
47   fWidth(width),
48   fSpin(0.0),
49   fIsospin(0.0),
50   fIsospinZ(0.0),
51   fLightQuarkNumber(0.0),
52   fAntiLightQuarkNumber(0.0),
53   fStrangeQuarkNumber(0.0),
54   fAntiStrangeQuarkNumber(0.0),
55   fCharmQuarkNumber(0.0),
56   fAntiCharmQuarkNumber(0.0),
57   fNDecayChannels(0),
58   fStable(0.0)
59 {
60   //
61   // constructor
62   //
63   for(Int_t i=0; i<9; i++)
64     if(*(name+i) != '\0') fName[i] = *(name+i);
65     else break;
66   for(Int_t i=0; i<kMaxDecayChannels; i++)
67     fDecayChannels[i] = new DecayChannel();
68 }
69
70 //________________________________________________________________________
71 ParticlePDG::~ParticlePDG() {
72   //
73   // destructor
74   //
75   for(Int_t i=0; i<kMaxDecayChannels; i++)
76     delete fDecayChannels[i];
77 }
78
79 //________________________________________________________________________
80 Double_t ParticlePDG::GetFullBranching() {
81   //
82   // calculate the sum of branching ratios from all decay channels (should add up to 1)
83   //
84   Double_t fullBranching = 0.0;
85   for(Int_t i=0; i<fNDecayChannels; i++)
86     fullBranching += fDecayChannels[i]->GetBranching();
87   return fullBranching;
88 }
89
90 //________________________________________________________________________
91 void ParticlePDG::AddChannel(DecayChannel* channel) {
92   //
93   // add a decay channel
94   //
95   if(channel->GetMotherPDG() != fPDG) {
96     cout << "ERROR in ParticlePDG::AddChannel() : You try to add a channel which has a different mother PDG" << endl;
97     return;
98   }
99   fDecayChannels[fNDecayChannels]->SetMotherPDG(channel->GetMotherPDG());
100   fDecayChannels[fNDecayChannels]->SetBranching(channel->GetBranching());
101   fDecayChannels[fNDecayChannels]->SetDaughters(channel->GetDaughters(), channel->GetNDaughters());
102   fNDecayChannels++;
103 }