]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TUHKMgen/UHKM/DecayChannel.cxx
updated macros for making PPR plots
[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 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 #ifndef DECAY_CHANNEL
14 #include "DecayChannel.h"
15 #endif
16
17 #include <iostream>
18 using std::cout;
19 using std::endl;
20
21 DecayChannel::DecayChannel() :
22   fMotherPDG(kNonsensePDG),
23   fBranchingRatio(0.0),
24   fNDaughters(0)
25 {
26   for(Int_t i=0; i<kMaxDaughters; i++)
27     fDaughtersPDG[i] = kNonsensePDG;
28 }
29
30 DecayChannel::DecayChannel(const DecayChannel &copy):
31   fMotherPDG(copy.fMotherPDG),
32   fBranchingRatio(copy.fBranchingRatio),
33   fNDaughters(copy.fNDaughters)
34 {
35   for(Int_t i=0; i<fNDaughters; i++)
36     fDaughtersPDG[i] = copy.fDaughtersPDG[i];
37 }
38
39 DecayChannel::DecayChannel(Int_t mother, Double_t branching, Int_t nDaughters, Int_t *daughters):
40   fMotherPDG(mother),
41   fBranchingRatio(branching),
42   fNDaughters(0)
43 {
44   for(Int_t i=0; i<nDaughters; i++) {
45     if(i >= kMaxDaughters) {
46       cout << "ERROR in DecayChannel explicit constructor: " << endl;
47       cout << "Number of daughters bigger than the maximum allowed one (" << kMaxDaughters << ") !!" << endl;
48     }
49     fDaughtersPDG[fNDaughters++] = *(daughters+i);
50   }
51 }
52
53 void DecayChannel::SetDaughters(Int_t *daughters, Int_t n) {
54   for(Int_t i=0; i<n; i++) {
55     if(i >= kMaxDaughters) {
56       cout << "ERROR in DecayChannel::SetDaughters() :" << endl;
57       cout << "Number of daughters bigger than the maximum allowed one (" << kMaxDaughters << ") !!" << endl;
58     }
59     fDaughtersPDG[fNDaughters++] = *(daughters+i);
60   }
61 }
62
63 void DecayChannel::AddDaughter(Int_t pdg) {
64   if(fNDaughters >= kMaxDaughters) {
65     cout << "ERROR in DecayChannel::AddDaughter() :" << endl;
66     cout << "Number of daughters is already >= than the maximum allowed one (" << kMaxDaughters << ") !!" << endl;
67   }
68   fDaughtersPDG[fNDaughters++] = pdg;
69 }
70
71 Int_t DecayChannel::GetDaughterPDG(Int_t i) {
72   if((i >= fNDaughters) || (i<0)) {
73     cout << "ERROR in DecayChannel::GetDaughterPDG() :" << endl;
74     cout << "Daughter index required is too big or less than zero!! There are only " << fNDaughters << " secondaries in this channel !!" << endl;
75     return kNonsensePDG;
76   }
77   return fDaughtersPDG[i];
78 }
79