Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4QIsotope.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//
30// ---------------- G4QIsotope header ----------------
31// by Mikhail Kossov, December 2003.
32// Header of the G4QIsotope class of the CHIPS Simulation Branch in GEANT4
33// ----------------------------------------------------------------------------
34// Short descriptionIt contains information about natural abundances of stable
35// and long living isotopes and a NEW "Element" can be initialised for any
36// isotope set. Randomization of isotopes of the Natural Elements is hardwired and
37// fast randomization of isotopes of the user defined Elements is a bit slower
38// CrossSectionWeighted randomisation of isotopes is slow (same for Nat and New)
39// -------------------------------------------------------------------------------
40// ****************************************************************************************
41// ********* This HEADER is temporary moved from the photolepton_hadron directory *********
42// ******* DO NOT MAKE ANY CHANGE! With time it'll move back to photolepton...(M.K.) ******
43// ****************************************************************************************
44//
45// 1 2 3 4 5 6 7 8 9
46//34567890123456789012345678901234567890123456789012345678901234567890123456789012345678901
47
48#ifndef G4QIsotope_hh
49#define G4QIsotope_hh
50
51#include "globals.hh"
52#include "G4ios.hh"
53#include "Randomize.hh"
54#include <vector>
55
57{
58protected:
59 G4QIsotope(); // ***Singletone*** All natural elements are initialized in the Constructor
60
61public:
62 ~G4QIsotope(); // It's public for compilation purposes on Windows, user must not call it!
63
64 // Create newElement with the Abundancy vector (User must delete elements of the vector)
65 // -----------------------------------------------------------------------------------
66 // Example of initialization of the new Element (not natural abanduncies of isotopes):
67 // -----------------------------------------------------------------------------------
68 //std::vector<std::pair<G4int,G4double> >*a= new std::vector<std::pair<G4int,G4double> >;
69 // a->push_back(std::make_pair(n1,abundancy1));
70 // a->push_back(std::make_pair(n2,abundancy2));
71 // a->push_back(std::make_pair(n3,1.-abundancy1-abundancy2));
72 ////Sum of abundancies must be 1 otherwise worning appears & if less LastAbu is increased
73 // G4int Z=1;
74 // G4int ind=1;
75 //// ind>0, if =<0 then the InitElement member function returns the first free index !!!
76 //// For ind>0 if theIndex "ind" already exists, returns the first free index !!!
77 // G4QIsotope::Get()->InitElement(Z, ind, a); // G4QIsotope class is a Singletone
78 // std::for_each(a->begin(), a->end(), void operator()(std::pair<G4int,G4double> >* P)
79 // {delete P;});
80 //// OR just use the following, which is faser:
81 //// G4int nA=a->size();
82 //// if(nA) for(G4int i=0; i<nA; i++) {delete a->operator[](i);}
83 //
84 G4int InitElement(G4int Z, G4int index, std::vector<std::pair<G4int,G4double>*>* abund);
85
86 // The highest index defined for Element with Z (Index>0 correspondToUserDefinedElements)
87 // -----------------------------------------------------------------------------------
88 G4int GetLastIndex(G4int Z); // Returns the last defined index (if only natural: =0)
89
90 // Indices can have differen numbers (not 1,2,3,...) & in different sequences (9,3,7,...)
91 G4bool IsDefined(G4int Z, G4int Ind); // Returns true if defined, false, if not defined
92
93 // A#ofNeutrons in Element with Z & UseDefIndex. Universal for Nat(index=0) & UserDefElem
94 G4int GetNeutrons(G4int Z, G4int index=0);//If theElement doesn't exist, returns negative
95
96 // #ofProtons in stable isotopes with fixed A=Z+N. Returns length and fils VectOfIsotopes
97 // -----------------------------------------------------------------------------------
98 // Example of printing of isotopes with A=152:
99 // -------------------------------------------
100 // G4int A=152; // A can not be more than 269
101 // std::vector<G4int> isV(4); // At present A with nIso>4 are not known
102 // G4int nIso= G4QIsotope::Get()->GetProtons(A, isV); // isV is cleaned up before filling
103 // if(nIso)for(G4int i,i<nIso,i++)G4cout<<"I#"<<i<<"Z="<<isV[i]<<",N="<<A-isV[i]<<G4endl;
104 G4int GetProtons(G4int A, std::vector<G4int>& isoV);
105
106 // Get a pointer to the vector of pairs(N,CrosS), where N is used to calculate CrosS
107 // -----------------------------------------------------------------------------------
108 // Example of initialization of the Cross Section to randomize weighted isotopes:
109 // -----------------------------------------------------------------------------------
110 // std::vector<std::pair<G4int,G4double>*>* cs= G4QIsotope::Get()->GetCSVector(Z, index);
111 // G4int nIs=cs->size; // A#Of Isotopes in the element
112 // if(nIs) for(G4int i; i<nIs; i++)
113 // {
114 // G4int N=cs->at(i)->first; // A#Of neuterons in the isotope
115 // cs->at(i)->second = CalculateCrossSection(particle,Z,N)// Calc particle+A(Z,N) CrosS
116 // }
117 std::vector<std::pair<G4int,G4double>*>* GetCSVector(G4int Z, G4int index = 0);
118
119 // Get the abundancy vector for calculation of mean cross sections
120 std::vector<std::pair<G4int,G4double>*>* GetAbuVector(G4int Z, G4int index = 0);
121
122 // Get the summed abundancy vector (e.g. for randomization by itself)
123 std::vector<std::pair<G4int,G4double>*>* GetSumAVector(G4int Z, G4int index = 0);
124
125 // Calculates the mean Cross Section for the initialized Element(ind=0 Nat,ind>0 UserDef)
126 G4double GetMeanCrossSection(G4int Z, G4int index = 0); // IsoCS's must init, IfNotRet<0
127
128 // Randomize A#OfNeutrons in the Isotope weighted by theAbubdancies and theCrossSections
129 G4int GetCSNeutrons(G4int Z, G4int index = 0); // IsoCrosSections must init, IfNotRet<0
130
131 static G4QIsotope* Get(); // Get a pointer to the Singletone G4QIsotope
132
133private:
134 G4int RandomizeNeutrons(G4int Z); // Gives a#of neutrons in the Random Isotope for the Z
135
136private:
137 // Initialized in the constructor
138 static std::vector<std::vector<std::pair<G4int,G4double>*>*> natElements; //NaturalElem's
139 static std::vector<std::vector<std::pair<G4int,G4double>*>*> natSumAbund; //NatElemSumA's
140 static std::vector<std::vector<std::pair<G4int,G4double>*>*> natIsoCrosS; //CSOfNatElem's
141 // It is initialized by user, but it is cleaned up in the destructor
142 static std::vector<std::pair<G4int,std::vector<std::pair<G4int,G4double>*>*>*> newElems;
143 static std::vector<std::pair<G4int,std::vector<std::pair<G4int,G4double>*>*>*> newSumAb;
144 static std::vector<std::pair<G4int,std::vector<std::pair<G4int,G4double>*>*>*> newIsoCS;
145};
146#endif
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
G4int GetLastIndex(G4int Z)
Definition: G4QIsotope.cc:1642
G4int GetNeutrons(G4int Z, G4int index=0)
Definition: G4QIsotope.cc:1682
std::vector< std::pair< G4int, G4double > * > * GetCSVector(G4int Z, G4int index=0)
Definition: G4QIsotope.cc:1737
std::vector< std::pair< G4int, G4double > * > * GetAbuVector(G4int Z, G4int index=0)
Definition: G4QIsotope.cc:1772
G4bool IsDefined(G4int Z, G4int Ind)
Definition: G4QIsotope.cc:1660
G4int GetProtons(G4int A, std::vector< G4int > &isoV)
Definition: G4QIsotope.cc:730
G4double GetMeanCrossSection(G4int Z, G4int index=0)
Definition: G4QIsotope.cc:1842
G4int GetCSNeutrons(G4int Z, G4int index=0)
Definition: G4QIsotope.cc:1916
std::vector< std::pair< G4int, G4double > * > * GetSumAVector(G4int Z, G4int index=0)
Definition: G4QIsotope.cc:1807
static G4QIsotope * Get()
Definition: G4QIsotope.cc:720
G4int InitElement(G4int Z, G4int index, std::vector< std::pair< G4int, G4double > * > *abund)
Definition: G4QIsotope.cc:1557