]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TUHKMgen/UHKM/DecayChannel.cxx
Flag for In/Out of Plane Analysis
[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<kMaxDaughters; 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<kMaxDaughters; i++) {
54     if(i<nDaughters)
55       fDaughtersPDG[fNDaughters++] = *(daughters+i);
56     else
57       fDaughtersPDG[i] = kNonsensePDG;
58   }
59 }
60
61 //_______________________________________________________________________________
62 void DecayChannel::SetDaughters(const Int_t *daughters, Int_t n) {
63   //
64   // set the daughter PDGs
65   //
66   for(Int_t i=0; i<n; i++) {
67     if(i >= kMaxDaughters) {
68       cout << "ERROR in DecayChannel::SetDaughters() :" << endl;
69       cout << "Number of daughters bigger than the maximum allowed one (" << kMaxDaughters << ") !!" << endl;
70     }
71     fDaughtersPDG[fNDaughters++] = *(daughters+i);
72   }
73 }
74
75 //_______________________________________________________________________________
76 void DecayChannel::AddDaughter(Int_t pdg) {
77   //
78   // add a daughter to this channel
79   //
80   if(fNDaughters >= kMaxDaughters) {
81     cout << "ERROR in DecayChannel::AddDaughter() :" << endl;
82     cout << "Number of daughters is already >= than the maximum allowed one (" << kMaxDaughters << ") !!" << endl;
83   }
84   fDaughtersPDG[fNDaughters++] = pdg;
85 }
86
87
88 //_______________________________________________________________________________
89 Int_t DecayChannel::GetDaughterPDG(Int_t i) {
90   //
91   // get the PDG of the i'th daughter
92   //
93   if((i >= fNDaughters) || (i<0)) {
94     cout << "ERROR in DecayChannel::GetDaughterPDG() :" << endl;
95     cout << "Daughter index required is too big or less than zero!! There are only " << fNDaughters << " secondaries in this channel !!" << endl;
96     return kNonsensePDG;
97   }
98   return fDaughtersPDG[i];
99 }
100