]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TUHKMgen/UHKM/DecayChannel.cxx
d04ce52e12de59f8ffdc4d9935f10d9513ba9f4a
[u/mrichter/AliRoot.git] / TUHKMgen / UHKM / DecayChannel.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 decays lists provided by the                         //
9 //  THERMINATOR (Computer Physics Communications 174 669 (2006)) and                          //
10 //  SHARE (Computer Physics Communications 167 229 (2005)) collaborations.                    //
11 ////////////////////////////////////////////////////////////////////////////////////////////////
12 #include <iostream>
13 using std::cout;
14 using std::endl;
15
16 #include "DecayChannel.h"
17
18 //_______________________________________________________________________________
19 DecayChannel::DecayChannel() :
20   fMotherPDG(kNonsensePDG),
21   fBranchingRatio(0.0),
22   fNDaughters(0)
23 {
24   //
25   //  default constructor
26   //
27   for(Int_t i=0; i<kMaxDaughters; i++)
28     fDaughtersPDG[i] = kNonsensePDG;
29 }
30
31 //_______________________________________________________________________________
32 DecayChannel::DecayChannel(const DecayChannel &copy):
33   fMotherPDG(copy.fMotherPDG),
34   fBranchingRatio(copy.fBranchingRatio),
35   fNDaughters(copy.fNDaughters)
36 {
37   //
38   // copy constructor
39   //
40   for(Int_t i=0; i<fNDaughters; i++)
41     fDaughtersPDG[i] = copy.fDaughtersPDG[i];
42 }
43
44 //_______________________________________________________________________________
45 DecayChannel::DecayChannel(Int_t mother, Double_t branching, Int_t nDaughters, const Int_t *daughters):
46   fMotherPDG(mother),
47   fBranchingRatio(branching),
48   fNDaughters(0)
49 {
50   //
51   // constructor
52   //
53   for(Int_t i=0; i<nDaughters; i++) {
54     if(i >= kMaxDaughters) {
55       cout << "ERROR in DecayChannel explicit constructor: " << endl;
56       cout << "Number of daughters bigger than the maximum allowed one (" << kMaxDaughters << ") !!" << endl;
57     }
58     fDaughtersPDG[fNDaughters++] = *(daughters+i);
59   }
60 }
61
62 //_______________________________________________________________________________
63 void DecayChannel::SetDaughters(const Int_t *daughters, Int_t n) {
64   //
65   // set the daughter PDGs
66   //
67   for(Int_t i=0; i<n; i++) {
68     if(i >= kMaxDaughters) {
69       cout << "ERROR in DecayChannel::SetDaughters() :" << endl;
70       cout << "Number of daughters bigger than the maximum allowed one (" << kMaxDaughters << ") !!" << endl;
71     }
72     fDaughtersPDG[fNDaughters++] = *(daughters+i);
73   }
74 }
75
76 //_______________________________________________________________________________
77 void DecayChannel::AddDaughter(Int_t pdg) {
78   //
79   // add a daughter to this channel
80   //
81   if(fNDaughters >= kMaxDaughters) {
82     cout << "ERROR in DecayChannel::AddDaughter() :" << endl;
83     cout << "Number of daughters is already >= than the maximum allowed one (" << kMaxDaughters << ") !!" << endl;
84   }
85   fDaughtersPDG[fNDaughters++] = pdg;
86 }
87
88
89 //_______________________________________________________________________________
90 Int_t DecayChannel::GetDaughterPDG(Int_t i) {
91   //
92   // get the PDG of the i'th daughter
93   //
94   if((i >= fNDaughters) || (i<0)) {
95     cout << "ERROR in DecayChannel::GetDaughterPDG() :" << endl;
96     cout << "Daughter index required is too big or less than zero!! There are only " << fNDaughters << " secondaries in this channel !!" << endl;
97     return kNonsensePDG;
98   }
99   return fDaughtersPDG[i];
100 }
101