1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * License and Disclaimer * |
---|
4 | // * * |
---|
5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
7 | // * conditions of the Geant4 Software License, included in the file * |
---|
8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
9 | // * include a list of copyright holders. * |
---|
10 | // * * |
---|
11 | // * Neither the authors of this software system, nor their employing * |
---|
12 | // * institutes,nor the agencies providing financial support for this * |
---|
13 | // * work make any representation or warranty, express or implied, * |
---|
14 | // * regarding this software system or assume any liability for its * |
---|
15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
16 | // * for the full disclaimer and the limitation of liability. * |
---|
17 | // * * |
---|
18 | // * This code implementation is the result of the scientific and * |
---|
19 | // * technical work of the GEANT4 collaboration. * |
---|
20 | // * By using, copying, modifying or distributing the software (or * |
---|
21 | // * any work based on the software) you agree to acknowledge its * |
---|
22 | // * use in resulting scientific publications, and indicate your * |
---|
23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
24 | // ******************************************************************** |
---|
25 | // $Id: G4CascadeChannel.cc,v 1.7 2010/05/15 04:25:17 mkelsey Exp $ |
---|
26 | // GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $ |
---|
27 | // |
---|
28 | // 20100514 M. Kelsey -- All functionality removed except quantum-number |
---|
29 | // validation functions. |
---|
30 | |
---|
31 | #include "G4CascadeChannel.hh" |
---|
32 | #include "G4ParticleDefinition.hh" |
---|
33 | #include <vector> |
---|
34 | |
---|
35 | |
---|
36 | std::vector<G4int> G4CascadeChannel::getQnums(G4int type) { |
---|
37 | G4int bary=0, str=0, ch=0; |
---|
38 | std::vector<G4int> Qnums(3); |
---|
39 | |
---|
40 | switch(type) { |
---|
41 | case 1: // proton |
---|
42 | bary = 1; |
---|
43 | str = 0; |
---|
44 | ch = 1; |
---|
45 | break; |
---|
46 | case 2: // neutron |
---|
47 | bary = 1; |
---|
48 | str = 0; |
---|
49 | ch = 0; |
---|
50 | break; |
---|
51 | case 3: // pi+ |
---|
52 | bary = 0; |
---|
53 | str = 0; |
---|
54 | ch = 1; |
---|
55 | break; |
---|
56 | case 5: // pi- |
---|
57 | bary = 0; |
---|
58 | str = 0; |
---|
59 | ch = -1; |
---|
60 | break; |
---|
61 | case 7: // pi0 |
---|
62 | bary = 0; |
---|
63 | str = 0; |
---|
64 | ch = 0; |
---|
65 | break; |
---|
66 | case 11: // k+ |
---|
67 | bary = 0; |
---|
68 | str = 1; |
---|
69 | ch = 1; |
---|
70 | break; |
---|
71 | case 13: // k- |
---|
72 | bary = 0; |
---|
73 | str = -1; |
---|
74 | ch = -1; |
---|
75 | break; |
---|
76 | case 15: // k0 |
---|
77 | bary = 0; |
---|
78 | str = 1; |
---|
79 | ch = 0; |
---|
80 | break; |
---|
81 | case 17: // k0bar |
---|
82 | bary = 0; |
---|
83 | str = -1; |
---|
84 | ch = 0; |
---|
85 | break; |
---|
86 | case 21: // lambda |
---|
87 | bary = 1; |
---|
88 | str = -1; |
---|
89 | ch = 0; |
---|
90 | break; |
---|
91 | case 23: // sigma+ |
---|
92 | bary = 1; |
---|
93 | str = -1; |
---|
94 | ch = 1; |
---|
95 | break; |
---|
96 | case 25: // sigma0 |
---|
97 | bary = 1; |
---|
98 | str = -1; |
---|
99 | ch = 0; |
---|
100 | break; |
---|
101 | case 27: // sigma- |
---|
102 | bary = 1; |
---|
103 | str = -1; |
---|
104 | ch = -1; |
---|
105 | break; |
---|
106 | case 29: // xi0 |
---|
107 | bary = 1; |
---|
108 | str = -2; |
---|
109 | ch = 0; |
---|
110 | break; |
---|
111 | case 31: // xi- |
---|
112 | bary = 1; |
---|
113 | str = -2; |
---|
114 | ch = -1; |
---|
115 | break; |
---|
116 | default: |
---|
117 | G4cout << " Unknown particle type " << type << G4endl; |
---|
118 | }; |
---|
119 | |
---|
120 | Qnums[0] = bary; |
---|
121 | Qnums[1] = str; |
---|
122 | Qnums[2] = ch; |
---|
123 | return Qnums; |
---|
124 | } |
---|
125 | |
---|
126 | void |
---|
127 | G4CascadeChannel::CheckQnums(const G4FastVector<G4ReactionProduct,256> &vec, |
---|
128 | G4int &vecLen, |
---|
129 | G4ReactionProduct ¤tParticle, |
---|
130 | G4ReactionProduct &targetParticle, |
---|
131 | G4double Q, G4double B, G4double S) { |
---|
132 | G4ParticleDefinition* projDef = currentParticle.GetDefinition(); |
---|
133 | G4ParticleDefinition* targDef = targetParticle.GetDefinition(); |
---|
134 | G4double chargeSum = projDef->GetPDGCharge() + targDef->GetPDGCharge(); |
---|
135 | G4double baryonSum = projDef->GetBaryonNumber() + targDef->GetBaryonNumber(); |
---|
136 | G4double strangenessSum = projDef->GetQuarkContent(3) - |
---|
137 | projDef->GetAntiQuarkContent(3) + |
---|
138 | targDef->GetQuarkContent(3) - |
---|
139 | targDef->GetAntiQuarkContent(3); |
---|
140 | |
---|
141 | G4ParticleDefinition* secDef = 0; |
---|
142 | for (G4int i = 0; i < vecLen; i++) { |
---|
143 | secDef = vec[i]->GetDefinition(); |
---|
144 | chargeSum += secDef->GetPDGCharge(); |
---|
145 | baryonSum += secDef->GetBaryonNumber(); |
---|
146 | strangenessSum += secDef->GetQuarkContent(3) |
---|
147 | - secDef->GetAntiQuarkContent(3); |
---|
148 | } |
---|
149 | |
---|
150 | G4bool OK = true; |
---|
151 | if (chargeSum != Q) { |
---|
152 | G4cout << " Charge not conserved " << G4endl; |
---|
153 | OK = false; |
---|
154 | } |
---|
155 | if (baryonSum != B) { |
---|
156 | G4cout << " Baryon number not conserved " << G4endl; |
---|
157 | OK = false; |
---|
158 | } |
---|
159 | if (strangenessSum != S) { |
---|
160 | G4cout << " Strangeness not conserved " << G4endl; |
---|
161 | OK = false; |
---|
162 | } |
---|
163 | |
---|
164 | if (!OK) { |
---|
165 | G4cout << " projectile: " << projDef->GetParticleName() |
---|
166 | << " target: " << targDef->GetParticleName() << G4endl; |
---|
167 | for (G4int i = 0; i < vecLen; i++) { |
---|
168 | secDef = vec[i]->GetDefinition(); |
---|
169 | G4cout << secDef->GetParticleName() << " " ; |
---|
170 | } |
---|
171 | G4cout << G4endl; |
---|
172 | } |
---|
173 | } |
---|