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 #ifndef G4NeutronHPDeExGammas_h 00030 #define G4NeutronHPDeExGammas_h 1 00031 00032 #include <fstream> 00033 #include <CLHEP/Units/PhysicalConstants.h> 00034 00035 #include "globals.hh" 00036 #include "G4ios.hh" 00037 #include "G4ReactionProductVector.hh" 00038 #include "G4Gamma.hh" 00039 #include "G4NeutronHPLevel.hh" 00040 #include "G4NeutronHPGamma.hh" 00041 #include "G4ReactionProduct.hh" 00042 00043 class G4NeutronHPDeExGammas 00044 { 00045 public: 00046 00047 G4NeutronHPDeExGammas() 00048 { 00049 levelStart = 0; 00050 levelSize = 0; 00051 nLevels = 0; 00052 theLevels = 0; 00053 } 00054 ~G4NeutronHPDeExGammas() 00055 { 00056 if(levelStart!=0) delete [] levelStart; 00057 if(levelSize!=0) delete [] levelSize; 00058 if(theLevels!=0) delete [] theLevels; 00059 } 00060 00061 void Init(std::ifstream & aDataFile); 00062 00063 inline G4ReactionProductVector * GetDecayGammas(G4int aLevel) 00064 { 00065 if(aLevel>nLevels-1 || aLevel<0) return 0; 00066 if(nLevels==0) return new G4ReactionProductVector(); 00067 G4ReactionProductVector * result = new G4ReactionProductVector; 00068 G4DynamicParticleVector * theResult; 00069 00070 theResult = theLevels[aLevel]. GetDecayGammas(); 00071 G4ReactionProduct * theCurrent; 00072 unsigned int i; 00073 for(i=0; i<theResult->size(); i++) 00074 { 00075 theCurrent = new G4ReactionProduct; 00076 *theCurrent = *(theResult->operator[](i)); 00077 delete theResult->operator[](i); 00078 G4double costheta = 2.*G4UniformRand()-1; 00079 G4double theta = std::acos(costheta); 00080 G4double phi = CLHEP::twopi*G4UniformRand(); 00081 G4double sinth = std::sin(theta); 00082 G4double en = theCurrent->GetTotalMomentum(); 00083 G4ThreeVector temp(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*costheta ); 00084 theCurrent->SetMomentum( temp ) ; 00085 result->push_back(theCurrent); 00086 } 00087 delete theResult; 00088 return result; 00089 } 00090 00091 inline G4NeutronHPLevel * GetLevel(G4int i) 00092 { 00093 if(i>nLevels-1) return 0; 00094 return theLevels+i; 00095 } 00096 00097 inline G4int GetNumberOfLevels() { return nLevels; } 00098 00099 inline G4double GetLevelEnergy(G4int aLevel) 00100 { 00101 if(aLevel>nLevels-1 || aLevel<0) return 0; 00102 G4double result = theLevels[aLevel].GetLevelEnergy(); 00103 return result; 00104 } 00105 private: 00106 00107 G4int * levelStart; 00108 G4int * levelSize; 00109 G4int nLevels; 00110 G4NeutronHPLevel * theLevels; 00111 }; 00112 00113 #endif