// // ******************************************************************** // * DISCLAIMER * // * * // * The following disclaimer summarizes all the specific disclaimers * // * of contributors to this software. The specific disclaimers,which * // * govern, are listed with their locations in: * // * http://cern.ch/geant4/license * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. * // * * // * This code implementation is the intellectual property of the * // * GEANT4 collaboration. * // * By copying, distributing or modifying the Program (or any work * // * based on the Program) you indicate your acceptance of this * // * statement, and all its terms. * // ******************************************************************** // // neutron_hp -- source file // J.P. Wellisch, Nov-1996 // A prototype of the low energy neutron transport model. // // there is a lot of unused (and undebugged) code in this file. Kept for the moment just in case. @@ #include "G4NeutronHPPhotonDist.hh" #include "G4NeutronHPLegendreStore.hh" #include "G4Electron.hh" #include "G4Poisson.hh" G4bool G4NeutronHPPhotonDist::InitMean(G4std::ifstream & aDataFile) { G4bool result = true; if(aDataFile >> repFlag) { aDataFile >> targetMass; if(repFlag==1) { // multiplicities aDataFile >> nDiscrete; disType = new G4int[nDiscrete]; energy = new G4double[nDiscrete]; actualMult = new G4int[nDiscrete]; theYield = new G4NeutronHPVector[nDiscrete]; for (G4int i=0; i> disType[i]>>energy[i]; energy[i]*=eV; theYield[i].Init(aDataFile, eV); } } else if(repFlag == 2) { aDataFile >> theInternalConversionFlag; aDataFile >> theBaseEnergy; theBaseEnergy*=eV; aDataFile >> theInternalConversionFlag; aDataFile >> nGammaEnergies; theLevelEnergies = new G4double[nGammaEnergies]; theTransitionProbabilities = new G4double[nGammaEnergies]; if(theInternalConversionFlag == 2) thePhotonTransitionFraction = new G4double[nGammaEnergies]; for(G4int ii=0; ii> theLevelEnergies[ii] >> theTransitionProbabilities[ii]; theLevelEnergies[ii]*=eV; } else if(theInternalConversionFlag == 2) { aDataFile >> theLevelEnergies[ii] >> theTransitionProbabilities[ii] >> thePhotonTransitionFraction[ii]; theLevelEnergies[ii]*=eV; } else { G4Exception("G4NeutronHPPhotonDist: Unknown conversion flag"); } } // Note, that this is equivalent to using the 'Gamma' classes. // G4Exception("G4NeutronHPPhotonDist: Transition probability array not sampled for the moment."); } else { G4cout << "Data representation in G4NeutronHPPhotonDist: "<> isoFlag; if (isoFlag != 1) { aDataFile >> tabulationType >> nDiscrete2 >> nIso; theShells = new G4double[nDiscrete2]; theGammas = new G4double[nDiscrete2]; for (i=0; i< nIso; i++) // isotropic photons { aDataFile >> theGammas[i] >> theShells[i]; theGammas[i]*=eV; theShells[i]*=eV; } nNeu = new G4int [nDiscrete2-nIso]; if(tabulationType==1)theLegendre=new G4NeutronHPLegendreTable *[nDiscrete2-nIso]; if(tabulationType==2)theAngular =new G4NeutronHPAngularP *[nDiscrete2-nIso]; for(i=nIso; i< nDiscrete2; i++) { if(tabulationType==1) { aDataFile >> theGammas[i] >> theShells[i] >> nNeu[i-nIso]; theGammas[i]*=eV; theShells[i]*=eV; theLegendre[i-nIso]=new G4NeutronHPLegendreTable[nNeu[i-nIso]]; theLegendreManager.Init(aDataFile); for (ii=0; ii> theGammas[i] >> theShells[i] >> nNeu[i-nIso]; theGammas[i]*=eV; theShells[i]*=eV; theAngular[i-nIso]=new G4NeutronHPAngularP[nNeu[i-nIso]]; for (ii=0; ii> nPartials; distribution = new G4int[nPartials]; probs = new G4NeutronHPVector[nPartials]; partials = new G4NeutronHPPartial * [nPartials]; G4int nen; G4int dummy; for (i=0; i> dummy; probs[i].Init(aDataFile, eV); aDataFile >> nen; partials[i] = new G4NeutronHPPartial(nen); partials[i]->InitInterpolation(aDataFile); partials[i]->Init(aDataFile); } } void G4NeutronHPPhotonDist::InitPartials(G4std::ifstream & aDataFile) { aDataFile >> nDiscrete >> targetMass; if(nDiscrete != 1) { theTotalXsec.Init(aDataFile, eV); } G4int i; theGammas = new G4double[nDiscrete]; theShells = new G4double[nDiscrete]; isPrimary = new G4int[nDiscrete]; disType = new G4int[nDiscrete]; thePartialXsec = new G4NeutronHPVector[nDiscrete]; for(i=0; i>theGammas[i]>>theShells[i]>>isPrimary[i]>>disType[i]; theGammas[i]*=eV; theShells[i]*=eV; thePartialXsec[i].Init(aDataFile, eV); } } G4ReactionProductVector * G4NeutronHPPhotonDist::GetPhotons(G4double anEnergy) { // the partial cross-section case is not in this yet. @@@@ G4int i, ii, iii; G4int nSecondaries = 0; G4ReactionProductVector * thePhotons = new G4ReactionProductVector; if(repFlag==1) { G4double current=0; for(i=0; i(current); if(current<1) { actualMult[i] = 0; if(G4UniformRand()SetDefinition(G4Gamma::Gamma()); thePhotons->push_back(theOne); } G4int count=0; for(i=0; iGetY(anEnergy); //@@@ look at, seems fishy G4double eGamm = temp->Sample(); thePhotons->operator[](count)->SetKineticEnergy(eGamm); delete temp; } else // discrete { thePhotons->operator[](count)->SetKineticEnergy(energy[i]); } count++; if(count > nSecondaries) G4Exception("G4NeutronHPPhotonDist::GetPhotons inconsistancy"); } } // now do the angular distributions... if( isoFlag == 1) { for (i=0; i< nSecondaries; i++) { G4double costheta = 2.*G4UniformRand()-1; G4double theta = acos(costheta); G4double phi = twopi*G4UniformRand(); G4double sinth = sin(theta); G4double en = thePhotons->operator[](i)->GetTotalEnergy(); G4ThreeVector temp(en*sinth*cos(phi), en*sinth*sin(phi), en*cos(theta) ); thePhotons->operator[](i)->SetMomentum( temp ) ; // G4cout << "Isotropic distribution in PhotonDist"<operator[](i)->GetTotalEnergy(); for(ii=0; iioperator[](i)->GetTotalEnergy(); G4ThreeVector tempVector(en*sinth*cos(phi), en*sinth*sin(phi), en*cos(theta) ); thePhotons->operator[](i)->SetMomentum( tempVector ) ; } else if(tabulationType==1) { // legendre polynomials G4int it(0); for (iii=0; iiianEnergy) break; } G4NeutronHPLegendreStore aStore(2); aStore.SetCoeff(1, &(theLegendre[ii-nIso][it])); aStore.SetCoeff(0, &(theLegendre[ii-nIso][it-1])); G4double cosTh = aStore.SampleMax(anEnergy); G4double theta = acos(cosTh); G4double phi = twopi*G4UniformRand(); G4double sinth = sin(theta); G4double en = thePhotons->operator[](i)->GetTotalEnergy(); G4ThreeVector tempVector(en*sinth*cos(phi), en*sinth*sin(phi), en*cos(theta) ); thePhotons->operator[](i)->SetMomentum( tempVector ) ; } else { // tabulation of probabilities. G4int it(0); for (iii=0; iiianEnergy) break; } G4double costh = theAngular[ii-nIso][it].GetCosTh(); // no interpolation yet @@ G4double theta = acos(costh); G4double phi = twopi*G4UniformRand(); G4double sinth = sin(theta); G4double en = thePhotons->operator[](i)->GetTotalEnergy(); G4ThreeVector tmpVector(en*sinth*cos(phi), en*sinth*sin(phi), en*costh ); thePhotons->operator[](i)->SetMomentum( tmpVector ) ; } } } } else if(repFlag == 2) { G4double * running = new G4double[nGammaEnergies]; running[0]=theTransitionProbabilities[0]; G4int i; for(i=1; iSetDefinition(G4Gamma::Gamma()); random = G4UniformRand(); if(theInternalConversionFlag==2 && random>thePhotonTransitionFraction[it]) { theOne->SetDefinition(G4Electron::Electron()); } theOne->SetTotalEnergy(totalEnergy); if( isoFlag == 1) { G4double costheta = 2.*G4UniformRand()-1; G4double theta = acos(costheta); G4double phi = twopi*G4UniformRand(); G4double sinth = sin(theta); G4double en = theOne->GetTotalEnergy(); G4ThreeVector temp(en*sinth*cos(phi), en*sinth*sin(phi), en*cos(theta) ); theOne->SetMomentum( temp ) ; } else { G4double currentEnergy = theOne->GetTotalEnergy(); for(ii=0; iiGetTotalEnergy(); G4ThreeVector tempVector(en*sinth*cos(phi), en*sinth*sin(phi), en*cos(theta) ); theOne->SetMomentum( tempVector ) ; } else if(tabulationType==1) { // legendre polynomials G4int it(0); for (iii=0; iiianEnergy) break; } G4NeutronHPLegendreStore aStore(2); aStore.SetCoeff(1, &(theLegendre[ii-nIso][it])); aStore.SetCoeff(0, &(theLegendre[ii-nIso][it-1])); G4double cosTh = aStore.SampleMax(anEnergy); G4double theta = acos(cosTh); G4double phi = twopi*G4UniformRand(); G4double sinth = sin(theta); G4double en = theOne->GetTotalEnergy(); G4ThreeVector tempVector(en*sinth*cos(phi), en*sinth*sin(phi), en*cos(theta) ); theOne->SetMomentum( tempVector ) ; } else { // tabulation of probabilities. G4int it(0); for (iii=0; iiianEnergy) break; } G4double costh = theAngular[ii-nIso][it].GetCosTh(); // no interpolation yet @@ G4double theta = acos(costh); G4double phi = twopi*G4UniformRand(); G4double sinth = sin(theta); G4double en = theOne->GetTotalEnergy(); G4ThreeVector tmpVector(en*sinth*cos(phi), en*sinth*sin(phi), en*costh ); theOne->SetMomentum( tmpVector ) ; } } thePhotons->push_back(theOne); } else { delete thePhotons; thePhotons = NULL; // no gamma data available; some work needed @@@@@@@ } return thePhotons; }