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