G4NeutronHPCapture Class Reference

#include <G4NeutronHPCapture.hh>

Inheritance diagram for G4NeutronHPCapture:

G4HadronicInteraction

Public Member Functions

 G4NeutronHPCapture ()
 ~G4NeutronHPCapture ()
G4HadFinalStateApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus)
virtual const std::pair< G4double,
G4double
GetFatalEnergyCheckLevels () const

Detailed Description

Definition at line 47 of file G4NeutronHPCapture.hh.


Constructor & Destructor Documentation

G4NeutronHPCapture::G4NeutronHPCapture (  ) 

Definition at line 41 of file G4NeutronHPCapture.cc.

References G4Element::GetElementTable(), G4Element::GetNumberOfElements(), G4HadronicInteraction::SetMaxEnergy(), and G4HadronicInteraction::SetMinEnergy().

00042    :G4HadronicInteraction("NeutronHPCapture")
00043   {
00044     SetMinEnergy( 0.0 );
00045     SetMaxEnergy( 20.*MeV );
00046 //    G4cout << "Capture : start of construction!!!!!!!!"<<G4endl;
00047     if(!getenv("G4NEUTRONHPDATA")) 
00048        throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
00049     dirName = getenv("G4NEUTRONHPDATA");
00050     G4String tString = "/Capture";
00051     dirName = dirName + tString;
00052     numEle = G4Element::GetNumberOfElements();
00053 //    G4cout << "+++++++++++++++++++++++++++++++++++++++++++++++++"<<G4endl;
00054 //    G4cout <<"Disname="<<dirName<<" numEle="<<numEle<<G4endl;
00055     //theCapture = new G4NeutronHPChannel[numEle];
00056 //    G4cout <<"G4NeutronHPChannel constructed"<<G4endl;
00057     G4NeutronHPCaptureFS * theFS = new G4NeutronHPCaptureFS;
00058     //for (G4int i=0; i<numEle; i++)
00059     //{
00060 //  //    G4cout << "initializing theCapture "<<i<<" "<< numEle<<G4endl;
00061     //  theCapture[i].Init((*(G4Element::GetElementTable()))[i], dirName);
00062     //  theCapture[i].Register(theFS);
00063     //}
00064     for ( G4int i = 0 ; i < numEle ; i++ ) 
00065     {
00066        theCapture.push_back( new G4NeutronHPChannel );
00067        (*theCapture[i]).Init((*(G4Element::GetElementTable()))[i], dirName);
00068        (*theCapture[i]).Register(theFS);
00069     }
00070     delete theFS;
00071 //    G4cout << "-------------------------------------------------"<<G4endl;
00072 //    G4cout << "Leaving G4NeutronHPCapture::G4NeutronHPCapture"<<G4endl;
00073   }

G4NeutronHPCapture::~G4NeutronHPCapture (  ) 

Definition at line 75 of file G4NeutronHPCapture.cc.

00076   {
00077     //delete [] theCapture;
00078 //    G4cout << "Leaving G4NeutronHPCapture::~G4NeutronHPCapture"<<G4endl;
00079      for ( std::vector<G4NeutronHPChannel*>::iterator 
00080            ite = theCapture.begin() ; ite != theCapture.end() ; ite++ )
00081      {
00082         delete *ite;
00083      }
00084      theCapture.clear();
00085   }


Member Function Documentation

G4HadFinalState * G4NeutronHPCapture::ApplyYourself ( const G4HadProjectile aTrack,
G4Nucleus aTargetNucleus 
) [virtual]

Implements G4HadronicInteraction.

Definition at line 88 of file G4NeutronHPCapture.cc.

References G4NeutronHPManager::CloseReactionWhiteBoard(), G4cout, G4endl, G4UniformRand, G4Material::GetElement(), G4Element::GetIndex(), G4NeutronHPManager::GetInstance(), G4HadProjectile::GetMaterial(), G4Material::GetNumberOfElements(), G4Element::GetNumberOfElements(), G4Material::GetTemperature(), G4NeutronHPThermalBoost::GetThermalEnergy(), G4Material::GetVecNbOfAtomsPerVolume(), CLHEP::detail::n, G4NeutronHPManager::OpenReactionWhiteBoard(), and G4Nucleus::SetParameters().

00089   {
00090 
00091     if ( numEle < (G4int)G4Element::GetNumberOfElements() ) addChannelForNewElement();
00092 
00093     G4NeutronHPManager::GetInstance()->OpenReactionWhiteBoard();
00094     if(getenv("NeutronHPCapture")) G4cout <<" ####### G4NeutronHPCapture called"<<G4endl;
00095     const G4Material * theMaterial = aTrack.GetMaterial();
00096     G4int n = theMaterial->GetNumberOfElements();
00097     G4int index = theMaterial->GetElement(0)->GetIndex();
00098     if(n!=1)
00099     {
00100       xSec = new G4double[n];
00101       G4double sum=0;
00102       G4int i;
00103       const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
00104       G4double rWeight;    
00105       G4NeutronHPThermalBoost aThermalE;
00106       for (i=0; i<n; i++)
00107       {
00108         index = theMaterial->GetElement(i)->GetIndex();
00109         rWeight = NumAtomsPerVolume[i];
00110         //xSec[i] = theCapture[index].GetXsec(aThermalE.GetThermalEnergy(aTrack,
00111         xSec[i] = (*theCapture[index]).GetXsec(aThermalE.GetThermalEnergy(aTrack,
00112                                                                      theMaterial->GetElement(i),
00113                                                                      theMaterial->GetTemperature()));
00114         xSec[i] *= rWeight;
00115         sum+=xSec[i];
00116       }
00117       G4double random = G4UniformRand();
00118       G4double running = 0;
00119       for (i=0; i<n; i++)
00120       {
00121         running += xSec[i];
00122         index = theMaterial->GetElement(i)->GetIndex();
00123         //if(random<=running/sum) break;
00124         if( sum == 0 || random <= running/sum ) break;
00125       }
00126       if(i==n) i=std::max(0, n-1);
00127       delete [] xSec;
00128     }
00129 
00130     //return theCapture[index].ApplyYourself(aTrack);
00131     //G4HadFinalState* result = theCapture[index].ApplyYourself(aTrack);
00132     G4HadFinalState* result = (*theCapture[index]).ApplyYourself(aTrack);
00133     aNucleus.SetParameters(G4NeutronHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargA(),G4NeutronHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargZ());
00134     G4NeutronHPManager::GetInstance()->CloseReactionWhiteBoard();
00135     return result; 
00136   }

const std::pair< G4double, G4double > G4NeutronHPCapture::GetFatalEnergyCheckLevels (  )  const [virtual]

Reimplemented from G4HadronicInteraction.

Definition at line 138 of file G4NeutronHPCapture.cc.

References DBL_MAX.

00139 {
00140    //return std::pair<G4double, G4double>(10*perCent,10*GeV);
00141    return std::pair<G4double, G4double>(10*perCent,DBL_MAX);
00142 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:52:36 2013 for Geant4 by  doxygen 1.4.7