Coding conventions (Ionut)
[u/mrichter/AliRoot.git] / TUHKMgen / UHKM / ParticlePDG.cxx
CommitLineData
03896fc4 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//
b1c2e580 12
13#include <iostream>
14using std::cout;
15using std::endl;
03896fc4 16#include "ParticlePDG.h"
b1c2e580 17
03896fc4 18//________________________________________________________________________
7b7936e9 19ParticlePDG::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{
03896fc4 35//
36// default constructor
37//
b1c2e580 38 for(Int_t i=0; i<kMaxDecayChannels; i++)
39 fDecayChannels[i] = new DecayChannel();
40}
41
03896fc4 42//________________________________________________________________________
8bf1c965 43ParticlePDG::ParticlePDG(const Char_t * const name, Int_t pdg, Double_t mass, Double_t width) :
7b7936e9 44 fPDG(pdg),
45 fMass(mass),
46 fWidth(width),
47 fSpin(0.0),
48 fIsospin(0.0),
49 fIsospinZ(0.0),
50 fLightQuarkNumber(0.0),
51 fAntiLightQuarkNumber(0.0),
52 fStrangeQuarkNumber(0.0),
53 fAntiStrangeQuarkNumber(0.0),
54 fCharmQuarkNumber(0.0),
55 fAntiCharmQuarkNumber(0.0),
56 fNDecayChannels(0),
57 fStable(0.0)
58{
03896fc4 59 //
60 // constructor
61 //
b1c2e580 62 for(Int_t i=0; i<9; i++)
63 if(*(name+i) != '\0') fName[i] = *(name+i);
64 else break;
b1c2e580 65 for(Int_t i=0; i<kMaxDecayChannels; i++)
66 fDecayChannels[i] = new DecayChannel();
67}
68
03896fc4 69//________________________________________________________________________
b1c2e580 70ParticlePDG::~ParticlePDG() {
03896fc4 71 //
72 // destructor
73 //
b1c2e580 74 for(Int_t i=0; i<kMaxDecayChannels; i++)
75 delete fDecayChannels[i];
76}
77
03896fc4 78//________________________________________________________________________
b1c2e580 79Double_t ParticlePDG::GetFullBranching() {
03896fc4 80 //
81 // calculate the sum of branching ratios from all decay channels (should add up to 1)
82 //
b1c2e580 83 Double_t fullBranching = 0.0;
84 for(Int_t i=0; i<fNDecayChannels; i++)
85 fullBranching += fDecayChannels[i]->GetBranching();
86 return fullBranching;
87}
88
03896fc4 89//________________________________________________________________________
b1c2e580 90void ParticlePDG::AddChannel(DecayChannel* channel) {
03896fc4 91 //
92 // add a decay channel
93 //
b1c2e580 94 if(channel->GetMotherPDG() != fPDG) {
95 cout << "ERROR in ParticlePDG::AddChannel() : You try to add a channel which has a different mother PDG" << endl;
96 return;
97 }
98 fDecayChannels[fNDecayChannels]->SetMotherPDG(channel->GetMotherPDG());
99 fDecayChannels[fNDecayChannels]->SetBranching(channel->GetBranching());
100 fDecayChannels[fNDecayChannels]->SetDaughters(channel->GetDaughters(), channel->GetNDaughters());
101 fNDecayChannels++;
102}