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")<<"From explicit constructor: Number of daughters bigger than the maximum allowed one (" << kMaxDaughters << ") !!";
43  }
44  fDaughtersPDG[fNDaughters++] = *(daughters+i);
45  }
46 }
47 
49  for(int i=0; i<n; i++) {
50  if(i >= kMaxDaughters) {
51  edm::LogError("DecayChannel")<<"From SetDaughters(): Number of daughters bigger than the maximum allowed one (" << kMaxDaughters << ") !!";
52  }
53  fDaughtersPDG[fNDaughters++] = *(daughters+i);
54  }
55 }
56 
58  if(fNDaughters >= kMaxDaughters) {
59  edm::LogError("DecayChannel")<<"From AddDaughter(): Number of daughters is already >= than the maximum allowed one (" << kMaxDaughters << ") !!";
60  }
61  fDaughtersPDG[fNDaughters++] = pdg;
62 }
63 
65  if((i >= fNDaughters) || (i<0)) {
66  edm::LogError("DecayChannel")<<"From GetDaughterPDG(): Daughter index required is too big or less than zero!! There are only " << fNDaughters << " secondaries in this channel !!";
67  return kNonsensePDG;
68  }
69  return fDaughtersPDG[i];
70 }
71 
int fDaughtersPDG[kMaxDaughters]
Definition: DecayChannel.h:27
int fNDaughters
Definition: Particle.h:35
int GetDaughterPDG(int i)
Definition: DecayChannel.cc:64
void SetDaughters(int *values, int n)
Definition: DecayChannel.cc:48
const int kMaxDaughters
Definition: DecayChannel.h:19
void AddDaughter(int pdg)
Definition: DecayChannel.cc:57
double fBranchingRatio
Definition: DecayChannel.h:25
const int kNonsensePDG
Definition: DecayChannel.h:20