00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // 00030 // ---------------- G4QIsotope header ---------------- 00031 // by Mikhail Kossov, December 2003. 00032 // Header of the G4QIsotope class of the CHIPS Simulation Branch in GEANT4 00033 // ---------------------------------------------------------------------------- 00034 // Short descriptionIt contains information about natural abundances of stable 00035 // and long living isotopes and a NEW "Element" can be initialised for any 00036 // isotope set. Randomization of isotopes of the Natural Elements is hardwired and 00037 // fast randomization of isotopes of the user defined Elements is a bit slower 00038 // CrossSectionWeighted randomisation of isotopes is slow (same for Nat and New) 00039 // ------------------------------------------------------------------------------- 00040 // **************************************************************************************** 00041 // ********* This HEADER is temporary moved from the photolepton_hadron directory ********* 00042 // ******* DO NOT MAKE ANY CHANGE! With time it'll move back to photolepton...(M.K.) ****** 00043 // **************************************************************************************** 00044 // 00045 // 1 2 3 4 5 6 7 8 9 00046 //34567890123456789012345678901234567890123456789012345678901234567890123456789012345678901 00047 00048 #ifndef G4QIsotope_hh 00049 #define G4QIsotope_hh 00050 00051 #include "globals.hh" 00052 #include "G4ios.hh" 00053 #include "Randomize.hh" 00054 #include <vector> 00055 00056 class G4QIsotope 00057 { 00058 protected: 00059 G4QIsotope(); // ***Singletone*** All natural elements are initialized in the Constructor 00060 00061 public: 00062 ~G4QIsotope(); // It's public for compilation purposes on Windows, user must not call it! 00063 00064 // Create newElement with the Abundancy vector (User must delete elements of the vector) 00065 // ----------------------------------------------------------------------------------- 00066 // Example of initialization of the new Element (not natural abanduncies of isotopes): 00067 // ----------------------------------------------------------------------------------- 00068 //std::vector<std::pair<G4int,G4double> >*a= new std::vector<std::pair<G4int,G4double> >; 00069 // a->push_back(std::make_pair(n1,abundancy1)); 00070 // a->push_back(std::make_pair(n2,abundancy2)); 00071 // a->push_back(std::make_pair(n3,1.-abundancy1-abundancy2)); 00073 // G4int Z=1; 00074 // G4int ind=1; 00077 // G4QIsotope::Get()->InitElement(Z, ind, a); // G4QIsotope class is a Singletone 00078 // std::for_each(a->begin(), a->end(), void operator()(std::pair<G4int,G4double> >* P) 00079 // {delete P;}); 00083 // 00084 G4int InitElement(G4int Z, G4int index, std::vector<std::pair<G4int,G4double>*>* abund); 00085 00086 // The highest index defined for Element with Z (Index>0 correspondToUserDefinedElements) 00087 // ----------------------------------------------------------------------------------- 00088 G4int GetLastIndex(G4int Z); // Returns the last defined index (if only natural: =0) 00089 00090 // Indices can have differen numbers (not 1,2,3,...) & in different sequences (9,3,7,...) 00091 G4bool IsDefined(G4int Z, G4int Ind); // Returns true if defined, false, if not defined 00092 00093 // A#ofNeutrons in Element with Z & UseDefIndex. Universal for Nat(index=0) & UserDefElem 00094 G4int GetNeutrons(G4int Z, G4int index=0);//If theElement doesn't exist, returns negative 00095 00096 // #ofProtons in stable isotopes with fixed A=Z+N. Returns length and fils VectOfIsotopes 00097 // ----------------------------------------------------------------------------------- 00098 // Example of printing of isotopes with A=152: 00099 // ------------------------------------------- 00100 // G4int A=152; // A can not be more than 269 00101 // std::vector<G4int> isV(4); // At present A with nIso>4 are not known 00102 // G4int nIso= G4QIsotope::Get()->GetProtons(A, isV); // isV is cleaned up before filling 00103 // if(nIso)for(G4int i,i<nIso,i++)G4cout<<"I#"<<i<<"Z="<<isV[i]<<",N="<<A-isV[i]<<G4endl; 00104 G4int GetProtons(G4int A, std::vector<G4int>& isoV); 00105 00106 // Get a pointer to the vector of pairs(N,CrosS), where N is used to calculate CrosS 00107 // ----------------------------------------------------------------------------------- 00108 // Example of initialization of the Cross Section to randomize weighted isotopes: 00109 // ----------------------------------------------------------------------------------- 00110 // std::vector<std::pair<G4int,G4double>*>* cs= G4QIsotope::Get()->GetCSVector(Z, index); 00111 // G4int nIs=cs->size; // A#Of Isotopes in the element 00112 // if(nIs) for(G4int i; i<nIs; i++) 00113 // { 00114 // G4int N=cs->at(i)->first; // A#Of neuterons in the isotope 00115 // cs->at(i)->second = CalculateCrossSection(particle,Z,N)// Calc particle+A(Z,N) CrosS 00116 // } 00117 std::vector<std::pair<G4int,G4double>*>* GetCSVector(G4int Z, G4int index = 0); 00118 00119 // Get the abundancy vector for calculation of mean cross sections 00120 std::vector<std::pair<G4int,G4double>*>* GetAbuVector(G4int Z, G4int index = 0); 00121 00122 // Get the summed abundancy vector (e.g. for randomization by itself) 00123 std::vector<std::pair<G4int,G4double>*>* GetSumAVector(G4int Z, G4int index = 0); 00124 00125 // Calculates the mean Cross Section for the initialized Element(ind=0 Nat,ind>0 UserDef) 00126 G4double GetMeanCrossSection(G4int Z, G4int index = 0); // IsoCS's must init, IfNotRet<0 00127 00128 // Randomize A#OfNeutrons in the Isotope weighted by theAbubdancies and theCrossSections 00129 G4int GetCSNeutrons(G4int Z, G4int index = 0); // IsoCrosSections must init, IfNotRet<0 00130 00131 static G4QIsotope* Get(); // Get a pointer to the Singletone G4QIsotope 00132 00133 private: 00134 G4int RandomizeNeutrons(G4int Z); // Gives a#of neutrons in the Random Isotope for the Z 00135 00136 private: 00137 // Initialized in the constructor 00138 static std::vector<std::vector<std::pair<G4int,G4double>*>*> natElements; //NaturalElem's 00139 static std::vector<std::vector<std::pair<G4int,G4double>*>*> natSumAbund; //NatElemSumA's 00140 static std::vector<std::vector<std::pair<G4int,G4double>*>*> natIsoCrosS; //CSOfNatElem's 00141 // It is initialized by user, but it is cleaned up in the destructor 00142 static std::vector<std::pair<G4int,std::vector<std::pair<G4int,G4double>*>*>*> newElems; 00143 static std::vector<std::pair<G4int,std::vector<std::pair<G4int,G4double>*>*>*> newSumAb; 00144 static std::vector<std::pair<G4int,std::vector<std::pair<G4int,G4double>*>*>*> newIsoCS; 00145 }; 00146 #endif