Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4QPDGCode.hh
Go to the documentation of this file.
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 //
26 //
27 // $Id$
28 //
29 // ---------------- G4QPDGCode ----------------
30 // by Mikhail Kossov, Sept 1999.
31 // class header for Hadron definition in CHIPS Model
32 // ------------------------------------------------------------
33 // Short description: The PDG Code is made on the basis of the Quark
34 // Content (G4QuarkContent) of the hadronic state (including nuclear
35 // fragments). The PDG code of the ground state (e.g. pi, N, etc.) is
36 // calculated. It includes a complicated algortithm of the G.S. mass
37 // calculation for nuclear fragments (now it is synchronised with the
38 // G4 nuclear massess).
39 // -------------------------------------------------------------------
40 
41 #ifndef G4QPDGCode_h
42 #define G4QPDGCode_h 1
43 
44 #include <iostream>
45 #include "globals.hh"
46 // Geant4 particles for consistency of masses only
47 // Leptons
48 #include "G4MuonPlus.hh"
49 #include "G4MuonMinus.hh"
50 #include "G4TauMinus.hh"
51 #include "G4TauPlus.hh"
52 #include "G4Electron.hh"
53 #include "G4Positron.hh"
54 #include "G4NeutrinoTau.hh"
55 #include "G4AntiNeutrinoTau.hh"
56 #include "G4NeutrinoMu.hh"
57 #include "G4AntiNeutrinoMu.hh"
58 #include "G4NeutrinoE.hh"
59 #include "G4AntiNeutrinoE.hh"
60 // Mesons
61 #include "G4PionPlus.hh"
62 #include "G4PionMinus.hh"
63 #include "G4PionZero.hh"
64 #include "G4Eta.hh"
65 #include "G4EtaPrime.hh"
66 
67 #include "G4KaonPlus.hh"
68 #include "G4KaonMinus.hh"
69 #include "G4KaonZero.hh"
70 #include "G4AntiKaonZero.hh"
71 #include "G4KaonZeroLong.hh"
72 #include "G4KaonZeroShort.hh"
73 
74 #include "G4DMesonPlus.hh"
75 #include "G4DMesonMinus.hh"
76 #include "G4DMesonZero.hh"
77 #include "G4AntiDMesonZero.hh"
78 #include "G4DsMesonPlus.hh"
79 #include "G4DsMesonMinus.hh"
80 #include "G4JPsi.hh"
81 
82 #include "G4BMesonPlus.hh"
83 #include "G4BMesonMinus.hh"
84 #include "G4BMesonZero.hh"
85 #include "G4AntiBMesonZero.hh"
86 #include "G4BsMesonZero.hh"
87 #include "G4AntiBsMesonZero.hh"
88 
89 
90 // Barions
91 #include "G4Proton.hh"
92 #include "G4AntiProton.hh"
93 #include "G4Neutron.hh"
94 #include "G4AntiNeutron.hh"
95 
96 #include "G4Lambda.hh"
97 #include "G4SigmaPlus.hh"
98 #include "G4SigmaZero.hh"
99 #include "G4SigmaMinus.hh"
100 #include "G4XiMinus.hh"
101 #include "G4XiZero.hh"
102 #include "G4OmegaMinus.hh"
103 
104 #include "G4AntiLambda.hh"
105 #include "G4AntiSigmaPlus.hh"
106 #include "G4AntiSigmaZero.hh"
107 #include "G4AntiSigmaMinus.hh"
108 #include "G4AntiXiMinus.hh"
109 #include "G4AntiXiZero.hh"
110 #include "G4AntiOmegaMinus.hh"
111 
112 #include "G4LambdacPlus.hh"
113 #include "G4SigmacPlusPlus.hh"
114 #include "G4SigmacPlus.hh"
115 #include "G4SigmacZero.hh"
116 #include "G4XicPlus.hh"
117 #include "G4XicZero.hh"
118 #include "G4OmegacZero.hh"
119 
120 #include "G4AntiLambdacPlus.hh"
121 #include "G4AntiSigmacPlusPlus.hh"
122 #include "G4AntiSigmacPlus.hh"
123 #include "G4AntiSigmacZero.hh"
124 #include "G4AntiXicPlus.hh"
125 #include "G4AntiXicZero.hh"
126 #include "G4AntiOmegacZero.hh"
127 
128 // Nuclei
129 #include "G4Alpha.hh"
130 #include "G4Deuteron.hh"
131 #include "G4He3.hh"
132 #include "G4Triton.hh"
133 
134 //ions
135 #include "G4GenericIon.hh"
136 #include "G4NucleiProperties.hh"
137 // --- End of consistency headers ---
138 
139 #include "G4QContent.hh"
140 
142 {
143 public:
144  // Constructors
145  G4QPDGCode(G4int PDGCode = 0); // Construction by PDGCode
146  G4QPDGCode(G4bool f, G4int QCode); // Construction by QCode, f-verb
147  G4QPDGCode(G4QContent QCont); // Construction by Quark Content
148  G4QPDGCode(const G4QPDGCode& rhs); // Copy Constructor by value
149  G4QPDGCode(G4QPDGCode* rhs); // Copy Constructor by pointer
150 
151  ~G4QPDGCode(); // Public Destructor
152 
153  // Operators
154  const G4QPDGCode& operator=(const G4QPDGCode& rhs);
155  G4bool operator==(const G4QPDGCode& rhs) const;
156  G4bool operator==(const G4int& rhs) const;
157  G4bool operator!=(const G4QPDGCode& rhs) const;
158  G4bool operator!=(const G4int& rhs) const;
159  G4QPDGCode operator+=(const G4int& rhs);
160  G4QPDGCode operator+=(const G4QPDGCode& rhs);
161  G4QPDGCode operator-=(const G4int& rhs);
162  G4QPDGCode operator-=(const G4QPDGCode& rhs);
163  G4QPDGCode operator*=(const G4int& rhs);
164  G4QPDGCode operator/=(const G4int& rhs);
165 
166  // Selectors
167  G4int GetNQHadr(); // Return # of predefined hadrons
168  G4double GetMass(); // GS Mass for the QHadron
169  G4double GetMass2(); // Squared GS Mass for the QHadron
170  G4double GetWidth(); // Width for the QHadron
171  G4double GetNuclMass(G4int Z, G4int N, G4int S); // Wrapper forNuclearMassCalculation
172  G4double GetNuclMass(G4int PDGCode); // Wrapper forNuclearMassCalculation
173  G4QContent GetQuarkContent() const; // Get QC for the particle
174  G4int GetBaryNum() const; // Get Baryon Number of the Hadron
175  G4int GetSpin() const; // Returns 2s+1 for hadrons, 1 for A
176  G4int GetCharge() const; // Get Charge of the Hadron
177  G4int GetPDGCode() const; // Get PDG code of the Hadron
178  G4int GetQCode() const; // Get Q code of the Hadron
179  G4QContent GetExQContent(G4int i, G4int o) const; // Get Q Content for Quark Exchange
180  G4int GetRelCrossIndex(G4int i, G4int o) const; // Relative Cross Index for q_i->q_o
181  G4int GetNumOfComb(G4int i, G4int o) const; // Get #ofCombinations for q_i->q_o
182  G4int GetTotNumOfComb(G4int i) const; // Get total#ofCombinations for q_i
183 
184  // Modifiers
185  void SetPDGCode(G4int newPDGCode); // Set PDG code of the Hadron
186  void InitByQCont(G4QContent QCont); // Init ExistingQPDG by QuarkContent
187  void InitByQCode(G4int QCode); // Init ExistingQPDG by Q Code
188 
189  // General
191 
192  void NegPDGCode();
193  void ConvertPDGToZNS(G4int PDG, G4int& z, G4int& n, G4int& s);
194  std::pair<G4int,G4int> MakeTwoBaryons(G4int L1, G4int L2, G4int R1, G4int R2);
195 
196 private:
197  // Encapsulated functions
198  G4bool TestRealNeutral(const G4int& PDGCode);
199  G4int MakeQCode(const G4int& PDGCode); // Make Q Code, using PDG Code
200  G4int MakePDGCode(const G4int& QCode); // Make PDG Code, using Q Code
201  G4double CalculateNuclMass(G4int Z, G4int N, G4int S); // Nuclear Mass Calculation
202  G4double QHaM(G4int nQ); // Definition of hadronic masses in Q-order
203 private:
204  // Static parameter
205  //static const G4int nQHM=90;
206  static const G4int nQHM=53; // Reduced CHIPS
207  // the Body
208  G4int thePDGCode;
209  G4int theQCode;
210 };
211 
212 // Not member operators
213 std::ostream& operator<<(std::ostream& lhs, G4QPDGCode& rhs);
214 std::ostream& operator<<(std::ostream& lhs, const G4QPDGCode& rhs);
215 G4int operator+(const G4QPDGCode& lhs, const G4QPDGCode& rhs);
216 G4int operator+(const G4QPDGCode& lhs, const G4int& rhs);
217 G4int operator+(const G4int& lhs, const G4QPDGCode& rhs);
218 G4int operator-(const G4QPDGCode& lhs, const G4QPDGCode& rhs);
219 G4int operator-(const G4QPDGCode& lhs, const G4int& rhs);
220 G4int operator-(const G4int& lhs, const G4QPDGCode& rhs);
221 G4int operator*(const G4QPDGCode& lhs, const G4QPDGCode& rhs);
222 G4int operator*(const G4QPDGCode& lhs, const G4int& rhs);
223 G4int operator*(const G4int& lhs, const G4QPDGCode& rhs);
224 G4int operator/(const G4QPDGCode& lhs, const G4QPDGCode& rhs);
225 G4int operator/(const G4QPDGCode& lhs, const G4int& rhs);
226 G4int operator/(const G4int& lhs, const G4QPDGCode& rhs);
227 G4int operator%(const G4QPDGCode& lhs, const G4int& rhs);
228 // Not member functions
229 //----------------------------------------------------------------------------------------
230 
231 inline G4bool G4QPDGCode::operator==(const G4QPDGCode& rhs) const {return this==&rhs;}
232 inline G4bool G4QPDGCode::operator==(const G4int& rhs) const {return thePDGCode==rhs;}
233 inline G4bool G4QPDGCode::operator!=(const G4QPDGCode& rhs) const {return this!=&rhs;}
234 inline G4bool G4QPDGCode::operator!=(const G4int& rhs) const {return thePDGCode!=rhs;}
235 
236 inline G4int G4QPDGCode::GetNQHadr() {return nQHM;} // Return # of predefined hadrons
237 
239 {
240  thePDGCode+=rhs.GetPDGCode();
241  if(!thePDGCode) theQCode = -2;
242  else theQCode = MakeQCode(thePDGCode);
243  return *this;
244 }
246 {
247  thePDGCode+=rhs;
248  if(!thePDGCode) theQCode = -2;
249  else theQCode = MakeQCode(thePDGCode);
250  return *this;
251 }
253 {
254  thePDGCode-=rhs.GetPDGCode();
255  if(!thePDGCode) theQCode = -2;
256  else theQCode = MakeQCode(thePDGCode);
257  return *this;
258 }
260 {
261  thePDGCode-=rhs;
262  if(!thePDGCode) theQCode = -2;
263  else theQCode = MakeQCode(thePDGCode);
264  return *this;
265 }
267 {
268  thePDGCode*=rhs;
269  if(!thePDGCode) theQCode = -2;
270  else theQCode = MakeQCode(thePDGCode);
271  return *this;
272 }
274 {
275  thePDGCode/=rhs;
276  if(!thePDGCode) theQCode = -2;
277  else theQCode = MakeQCode(thePDGCode);
278  return *this;
279 }
280 
281 inline G4double G4QPDGCode::GetMass2() {G4double mass=GetMass(); return mass*mass;}
283 {
284  if(PDG>80000000)
285  {
286  G4int szn=PDG-90000000;
287  G4int ds=0;
288  G4int dz=0;
289  G4int dn=0;
290  if(szn<-100000)
291  {
292  G4int ns_value=(-szn)/1000000+1;
293  szn+=ns_value*1000000;
294  ds+=ns_value;
295  }
296  else if(szn<-100)
297  {
298  G4int nz=(-szn)/1000+1;
299  szn+=nz*1000;
300  dz+=nz;
301  }
302  else if(szn<0)
303  {
304  G4int nn=-szn;
305  szn=0;
306  dn+=nn;
307  }
308  G4int sz =szn/1000;
309  G4int n =szn%1000;
310  if(n>700)
311  {
312  n-=1000;
313  dz--;
314  }
315  G4int z =sz%1000-dz;
316  if(z>700)
317  {
318  z-=1000;
319  ds--;
320  }
321  G4int s_value =sz/1000-ds;
322  return GetNuclMass(z,n,s_value);
323  }
324  return 0.;
325 }
326 inline G4int G4QPDGCode::GetPDGCode() const {return thePDGCode;}
327 inline G4int G4QPDGCode::GetQCode() const {return theQCode;}
330 inline G4int G4QPDGCode::GetSpin() const
331 {
332  if(thePDGCode<80000000) return thePDGCode%10;
333  else if(GetQuarkContent().GetTot()%2) return 3; // @@ Take into account higher resonances
334  else return 1;
335 }
336 inline void G4QPDGCode::NegPDGCode() {thePDGCode=-thePDGCode;}
338 
339 // Redefinition of the PDG instance
340 inline void G4QPDGCode::SetPDGCode(G4int newPDGCode)
341 {
342  thePDGCode=newPDGCode;
343  if(!thePDGCode) theQCode = -2;
344  else theQCode = MakeQCode(newPDGCode);
345 }
346 
347 // Init existing QPDG by Quark Content
349 {
350  thePDGCode = QCont.GetSPDGCode();
351  if(!thePDGCode) theQCode = -2;
352  else theQCode = MakeQCode(thePDGCode);
353 }
354 
355 // Init existing QPDG by Quark Content
356 inline void G4QPDGCode::InitByQCode(G4int QCode)
357 {
358  theQCode = QCode;
359  thePDGCode = MakePDGCode(QCode);
360 }
361 
362 #endif