CMS 3D CMS Logo

DecayChannel.cc
Go to the documentation of this file.
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
15 #endif
16 #include <iostream>
17 
18 using namespace std;
19 
21  fMotherPDG = kNonsensePDG;
22  fBranchingRatio = 0.0;
23  fNDaughters = 0;
24  for (int i = 0; i < kMaxDaughters; i++)
25  fDaughtersPDG[i] = kNonsensePDG;
26 }
27 
29  fMotherPDG = copy.fMotherPDG;
30  fBranchingRatio = copy.fBranchingRatio;
31  fNDaughters = copy.fNDaughters;
32  for (int i = 0; i < fNDaughters; i++)
33  fDaughtersPDG[i] = copy.fDaughtersPDG[i];
34 }
35 
36 DecayChannel::DecayChannel(int mother, double branching, int nDaughters, int *daughters) {
37  fMotherPDG = mother;
38  fBranchingRatio = branching;
39  fNDaughters = 0;
40  for (int i = 0; i < nDaughters; i++) {
41  if (i >= kMaxDaughters) {
42  edm::LogError("DecayChannel")
43  << "From explicit constructor: Number of daughters bigger than the maximum allowed one (" << kMaxDaughters
44  << ") !!";
45  }
46  fDaughtersPDG[fNDaughters++] = *(daughters + i);
47  }
48 }
49 
51  for (int i = 0; i < n; i++) {
52  if (i >= kMaxDaughters) {
53  edm::LogError("DecayChannel") << "From SetDaughters(): Number of daughters bigger than the maximum allowed one ("
54  << kMaxDaughters << ") !!";
55  }
56  fDaughtersPDG[fNDaughters++] = *(daughters + i);
57  }
58 }
59 
61  if (fNDaughters >= kMaxDaughters) {
62  edm::LogError("DecayChannel")
63  << "From AddDaughter(): Number of daughters is already >= than the maximum allowed one (" << kMaxDaughters
64  << ") !!";
65  }
66  fDaughtersPDG[fNDaughters++] = pdg;
67 }
68 
70  if ((i >= fNDaughters) || (i < 0)) {
71  edm::LogError("DecayChannel")
72  << "From GetDaughterPDG(): Daughter index required is too big or less than zero!! There are only "
73  << fNDaughters << " secondaries in this channel !!";
74  return kNonsensePDG;
75  }
76  return fDaughtersPDG[i];
77 }
int fDaughtersPDG[kMaxDaughters]
Definition: DecayChannel.h:27
int fNDaughters
Definition: Particle.h:35
int GetDaughterPDG(int i)
Definition: DecayChannel.cc:69
void SetDaughters(int *values, int n)
Definition: DecayChannel.cc:50
const int kMaxDaughters
Definition: DecayChannel.h:19
void AddDaughter(int pdg)
Definition: DecayChannel.cc:60
double fBranchingRatio
Definition: DecayChannel.h:25
const int kNonsensePDG
Definition: DecayChannel.h:20