#include <G4AdjointCSManager.hh>
Definition at line 69 of file G4AdjointCSManager.hh.
G4AdjointCSManager::~G4AdjointCSManager | ( | ) |
void G4AdjointCSManager::BuildCrossSectionMatrices | ( | ) |
Definition at line 180 of file G4AdjointCSManager.cc.
References G4cout, G4endl, G4Element::GetElementTable(), and G4Material::GetMaterialTable().
Referenced by G4VAdjointReverseReaction::BuildPhysicsTable().
00181 { 00182 if (CrossSectionMatrixesAreBuilt) return; 00183 //Tcut, Tmax 00184 //The matrices will be computed probably just once 00185 //When Tcut will change some PhysicsTable will be recomputed 00186 // for each MaterialCutCouple but not all the matrices 00187 //The Tcut defines a lower limit in the energy of the Projectile before the scattering 00188 //In the Projectile to Scattered Projectile case we have 00189 // E_ScatProj<E_Proj-Tcut 00190 //Therefore in the adjoint case we have 00191 // Eproj> E_ScatProj+Tcut 00192 //This implies that when computing the adjoint CS we should integrate over Epro 00193 // from E_ScatProj+Tcut to Emax 00194 //In the Projectile to Secondary case Tcut plays a role only in the fact that 00195 // Esecond should be greater than Tcut to have the possibility to have any adjoint 00196 //process 00197 //To avoid to recompute the matrices for all changes of MaterialCutCouple 00198 //We propose to compute the matrices only once for the minimum possible Tcut and then 00199 //to interpolate the probability for a new Tcut (implemented in G4VAdjointEmModel) 00200 00201 00202 theAdjointCSMatricesForScatProjToProj.clear(); 00203 theAdjointCSMatricesForProdToProj.clear(); 00204 const G4ElementTable* theElementTable = G4Element::GetElementTable(); 00205 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable(); 00206 00207 G4cout<<"========== Computation of cross section matrices for adjoint models =========="<<G4endl; 00208 for (size_t i=0; i<listOfAdjointEMModel.size();i++){ 00209 G4VEmAdjointModel* aModel =listOfAdjointEMModel[i]; 00210 G4cout<<"Build adjoint cross section matrices for "<<aModel->GetName()<<G4endl; 00211 if (aModel->GetUseMatrix()){ 00212 std::vector<G4AdjointCSMatrix*>* aListOfMat1 = new std::vector<G4AdjointCSMatrix*>(); 00213 std::vector<G4AdjointCSMatrix*>* aListOfMat2 = new std::vector<G4AdjointCSMatrix*>(); 00214 aListOfMat1->clear(); 00215 aListOfMat2->clear(); 00216 if (aModel->GetUseMatrixPerElement()){ 00217 if (aModel->GetUseOnlyOneMatrixForAllElements()){ 00218 std::vector<G4AdjointCSMatrix*> 00219 two_matrices=BuildCrossSectionsMatricesForAGivenModelAndElement(aModel,1, 1, 80); 00220 aListOfMat1->push_back(two_matrices[0]); 00221 aListOfMat2->push_back(two_matrices[1]); 00222 } 00223 else { 00224 for (size_t j=0; j<theElementTable->size();j++){ 00225 G4Element* anElement=(*theElementTable)[j]; 00226 G4int Z = int(anElement->GetZ()); 00227 G4int A = int(anElement->GetA()); 00228 std::vector<G4AdjointCSMatrix*> 00229 two_matrices=BuildCrossSectionsMatricesForAGivenModelAndElement(aModel,Z, A, 40); 00230 aListOfMat1->push_back(two_matrices[0]); 00231 aListOfMat2->push_back(two_matrices[1]); 00232 } 00233 } 00234 } 00235 else { //Per material case 00236 for (size_t j=0; j<theMaterialTable->size();j++){ 00237 G4Material* aMaterial=(*theMaterialTable)[j]; 00238 std::vector<G4AdjointCSMatrix*> 00239 two_matrices=BuildCrossSectionsMatricesForAGivenModelAndMaterial(aModel,aMaterial, 40); 00240 aListOfMat1->push_back(two_matrices[0]); 00241 aListOfMat2->push_back(two_matrices[1]); 00242 } 00243 00244 } 00245 theAdjointCSMatricesForProdToProj.push_back(*aListOfMat1); 00246 theAdjointCSMatricesForScatProjToProj.push_back(*aListOfMat2); 00247 aModel->SetCSMatrices(aListOfMat1, aListOfMat2); 00248 } 00249 else { G4cout<<"The model "<<aModel->GetName()<<" does not use cross section matrices"<<G4endl; 00250 std::vector<G4AdjointCSMatrix*> two_empty_matrices; 00251 theAdjointCSMatricesForProdToProj.push_back(two_empty_matrices); 00252 theAdjointCSMatricesForScatProjToProj.push_back(two_empty_matrices); 00253 00254 } 00255 } 00256 G4cout<<" All adjoint cross section matrices are computed!"<<G4endl; 00257 G4cout<<"======================================================================"<<G4endl; 00258 00259 CrossSectionMatrixesAreBuilt = true; 00260 00261 00262 }
void G4AdjointCSManager::BuildTotalSigmaTables | ( | ) |
Definition at line 267 of file G4AdjointCSManager.cc.
References ComputeTotalAdjointCS(), G4VEmModel::GetChargeSquareRatio(), G4PhysicsVector::GetLowEdgeEnergy(), G4ProductionCutsTable::GetMaterialCutsCouple(), G4ProductionCutsTable::GetProductionCutsTable(), G4ProductionCutsTable::GetTableSize(), G4PhysicsVector::GetVectorLength(), and G4PhysicsVector::PutValue().
Referenced by G4VAdjointReverseReaction::BuildPhysicsTable().
00268 { if (TotalSigmaTableAreBuilt) return; 00269 00270 00271 const G4ProductionCutsTable* theCoupleTable= G4ProductionCutsTable::GetProductionCutsTable(); 00272 00273 00274 //Prepare the Sigma table for all AdjointEMModel, will be filled later on 00275 for (size_t i=0; i<listOfAdjointEMModel.size();i++){ 00276 listSigmaTableForAdjointModelScatProjToProj[i]->clearAndDestroy(); 00277 listSigmaTableForAdjointModelProdToProj[i]->clearAndDestroy(); 00278 for (size_t j=0;j<theCoupleTable->GetTableSize();j++){ 00279 listSigmaTableForAdjointModelScatProjToProj[i]->push_back(new G4PhysicsLogVector(Tmin, Tmax, nbins)); 00280 listSigmaTableForAdjointModelProdToProj[i]->push_back(new G4PhysicsLogVector(Tmin, Tmax, nbins)); 00281 } 00282 } 00283 00284 00285 00286 for (size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){ 00287 G4ParticleDefinition* thePartDef = theListOfAdjointParticlesInAction[i]; 00288 DefineCurrentParticle(thePartDef); 00289 theTotalForwardSigmaTableVector[i]->clearAndDestroy(); 00290 theTotalAdjointSigmaTableVector[i]->clearAndDestroy(); 00291 EminForFwdSigmaTables[i].clear(); 00292 EminForAdjSigmaTables[i].clear(); 00293 EkinofFwdSigmaMax[i].clear(); 00294 EkinofAdjSigmaMax[i].clear(); 00295 //G4cout<<thePartDef->GetParticleName(); 00296 00297 for (size_t j=0;j<theCoupleTable->GetTableSize();j++){ 00298 const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(j); 00299 00300 /* 00301 G4String file_name1=couple->GetMaterial()->GetName()+"_"+thePartDef->GetParticleName()+"_adj_totCS.txt"; 00302 G4String file_name2=couple->GetMaterial()->GetName()+"_"+thePartDef->GetParticleName()+"_fwd_totCS.txt"; 00303 00304 std::fstream FileOutputAdjCS(file_name1, std::ios::out); 00305 std::fstream FileOutputFwdCS(file_name2, std::ios::out); 00306 00307 00308 00309 FileOutputAdjCS<<std::setiosflags(std::ios::scientific); 00310 FileOutputAdjCS<<std::setprecision(6); 00311 FileOutputFwdCS<<std::setiosflags(std::ios::scientific); 00312 FileOutputFwdCS<<std::setprecision(6); 00313 */ 00314 00315 00316 //make first the total fwd CS table for FwdProcess 00317 G4PhysicsVector* aVector = new G4PhysicsLogVector(Tmin, Tmax, nbins); 00318 G4bool Emin_found=false; 00319 G4double sigma_max =0.; 00320 G4double e_sigma_max =0.; 00321 for(size_t l=0; l<aVector->GetVectorLength(); l++) { 00322 G4double totCS=0.; 00323 G4double e=aVector->GetLowEdgeEnergy(l); 00324 for (size_t k=0; k<listOfForwardEmProcess[i]->size(); k++){ 00325 totCS+=(*listOfForwardEmProcess[i])[k]->GetLambda(e, couple); 00326 } 00327 for (size_t k=0; k<listOfForwardEnergyLossProcess[i]->size(); k++){ 00328 if (thePartDef == theAdjIon) { // e is considered already as the scaled energy 00329 size_t mat_index = couple->GetIndex(); 00330 G4VEmModel* currentModel = (*listOfForwardEnergyLossProcess[i])[k]->SelectModelForMaterial(e,mat_index); 00331 G4double chargeSqRatio = currentModel->GetChargeSquareRatio(theFwdIon,couple->GetMaterial(),e/massRatio); 00332 (*listOfForwardEnergyLossProcess[i])[k]->SetDynamicMassCharge(massRatio,chargeSqRatio); 00333 } 00334 G4double e1=e/massRatio; 00335 totCS+=(*listOfForwardEnergyLossProcess[i])[k]->GetLambda(e1, couple); 00336 } 00337 aVector->PutValue(l,totCS); 00338 if (totCS>sigma_max){ 00339 sigma_max=totCS; 00340 e_sigma_max = e; 00341 00342 } 00343 //FileOutputFwdCS<<e<<'\t'<<totCS<<G4endl; 00344 00345 if (totCS>0 && !Emin_found) { 00346 EminForFwdSigmaTables[i].push_back(e); 00347 Emin_found=true; 00348 } 00349 00350 00351 } 00352 //FileOutputFwdCS.close(); 00353 00354 EkinofFwdSigmaMax[i].push_back(e_sigma_max); 00355 00356 00357 if(!Emin_found) EminForFwdSigmaTables[i].push_back(Tmax); 00358 00359 theTotalForwardSigmaTableVector[i]->push_back(aVector); 00360 00361 00362 Emin_found=false; 00363 sigma_max=0; 00364 e_sigma_max =0.; 00365 G4PhysicsVector* aVector1 = new G4PhysicsLogVector(Tmin, Tmax, nbins); 00366 for(eindex=0; eindex<aVector->GetVectorLength(); eindex++) { 00367 G4double e=aVector->GetLowEdgeEnergy(eindex); 00368 G4double totCS =ComputeTotalAdjointCS(couple,thePartDef,e*0.9999999/massRatio); //massRatio needed for ions 00369 aVector1->PutValue(eindex,totCS); 00370 if (totCS>sigma_max){ 00371 sigma_max=totCS; 00372 e_sigma_max = e; 00373 00374 } 00375 //FileOutputAdjCS<<e<<'\t'<<totCS<<G4endl; 00376 if (totCS>0 && !Emin_found) { 00377 EminForAdjSigmaTables[i].push_back(e); 00378 Emin_found=true; 00379 } 00380 00381 } 00382 //FileOutputAdjCS.close(); 00383 EkinofAdjSigmaMax[i].push_back(e_sigma_max); 00384 if(!Emin_found) EminForAdjSigmaTables[i].push_back(Tmax); 00385 00386 theTotalAdjointSigmaTableVector[i]->push_back(aVector1); 00387 00388 } 00389 } 00390 TotalSigmaTableAreBuilt =true; 00391 00392 }
G4double G4AdjointCSManager::ComputeAdjointCS | ( | G4Material * | aMaterial, | |
G4VEmAdjointModel * | aModel, | |||
G4double | PrimEnergy, | |||
G4double | Tcut, | |||
G4bool | IsScatProjToProjCase, | |||
std::vector< G4double > & | AdjointCS_for_each_element | |||
) |
Definition at line 532 of file G4AdjointCSManager.cc.
References G4VEmAdjointModel::AdjointCrossSection(), G4VEmAdjointModel::GetApplyCutInRange(), G4Material::GetElement(), G4Material::GetIndex(), G4Element::GetIndex(), G4Material::GetNumberOfElements(), G4VEmAdjointModel::GetSecondAdjEnergyMaxForProdToProjCase(), G4VEmAdjointModel::GetSecondAdjEnergyMaxForScatProjToProjCase(), G4VEmAdjointModel::GetSecondAdjEnergyMinForProdToProjCase(), G4VEmAdjointModel::GetSecondAdjEnergyMinForScatProjToProjCase(), G4VEmAdjointModel::GetUseMatrix(), G4VEmAdjointModel::GetUseMatrixPerElement(), G4VEmAdjointModel::GetUseOnlyOneMatrixForAllElements(), G4Material::GetVecNbOfAtomsPerVolume(), and G4Element::GetZ().
Referenced by G4VEmAdjointModel::AdjointCrossSection(), ComputeTotalAdjointCS(), and SampleElementFromCSMatrices().
00538 { 00539 00540 G4double EminSec=0; 00541 G4double EmaxSec=0; 00542 00543 if (IsScatProjToProjCase){ 00544 EminSec= aModel->GetSecondAdjEnergyMinForScatProjToProjCase(PrimEnergy,Tcut); 00545 EmaxSec= aModel->GetSecondAdjEnergyMaxForScatProjToProjCase(PrimEnergy); 00546 } 00547 else if (PrimEnergy > Tcut || !aModel->GetApplyCutInRange()) { 00548 EminSec= aModel->GetSecondAdjEnergyMinForProdToProjCase(PrimEnergy); 00549 EmaxSec= aModel->GetSecondAdjEnergyMaxForProdToProjCase(PrimEnergy); 00550 } 00551 if (EminSec >= EmaxSec) return 0.; 00552 00553 00554 G4bool need_to_compute=false; 00555 if ( aMaterial!= lastMaterial || PrimEnergy != lastPrimaryEnergy || Tcut != lastTcut){ 00556 lastMaterial =aMaterial; 00557 lastPrimaryEnergy = PrimEnergy; 00558 lastTcut=Tcut; 00559 listOfIndexOfAdjointEMModelInAction.clear(); 00560 listOfIsScatProjToProjCase.clear(); 00561 lastAdjointCSVsModelsAndElements.clear(); 00562 need_to_compute=true; 00563 00564 } 00565 size_t ind=0; 00566 if (!need_to_compute){ 00567 need_to_compute=true; 00568 for (size_t i=0;i<listOfIndexOfAdjointEMModelInAction.size();i++){ 00569 size_t ind1=listOfIndexOfAdjointEMModelInAction[i]; 00570 if (aModel == listOfAdjointEMModel[ind1] && IsScatProjToProjCase == listOfIsScatProjToProjCase[i]){ 00571 need_to_compute=false; 00572 CS_Vs_Element = lastAdjointCSVsModelsAndElements[ind]; 00573 } 00574 ind++; 00575 } 00576 } 00577 00578 if (need_to_compute){ 00579 size_t ind_model=0; 00580 for (size_t i=0;i<listOfAdjointEMModel.size();i++){ 00581 if (aModel == listOfAdjointEMModel[i]){ 00582 ind_model=i; 00583 break; 00584 } 00585 } 00586 G4double Tlow=Tcut; 00587 if (!listOfAdjointEMModel[ind_model]->GetApplyCutInRange()) Tlow =listOfAdjointEMModel[ind_model]->GetLowEnergyLimit(); 00588 listOfIndexOfAdjointEMModelInAction.push_back(ind_model); 00589 listOfIsScatProjToProjCase.push_back(IsScatProjToProjCase); 00590 CS_Vs_Element.clear(); 00591 if (!aModel->GetUseMatrix()){ 00592 CS_Vs_Element.push_back(aModel->AdjointCrossSection(currentCouple,PrimEnergy,IsScatProjToProjCase)); 00593 00594 00595 } 00596 else if (aModel->GetUseMatrixPerElement()){ 00597 size_t n_el = aMaterial->GetNumberOfElements(); 00598 if (aModel->GetUseOnlyOneMatrixForAllElements()){ 00599 G4AdjointCSMatrix* theCSMatrix; 00600 if (IsScatProjToProjCase){ 00601 theCSMatrix=theAdjointCSMatricesForScatProjToProj[ind_model][0]; 00602 } 00603 else theCSMatrix=theAdjointCSMatricesForProdToProj[ind_model][0]; 00604 G4double CS =0.; 00605 if (PrimEnergy > Tlow) 00606 CS = ComputeAdjointCS(PrimEnergy,theCSMatrix,Tlow); 00607 G4double factor=0.; 00608 for (size_t i=0;i<n_el;i++){ //this could be computed only once 00609 //size_t ind_el = aMaterial->GetElement(i)->GetIndex(); 00610 factor+=aMaterial->GetElement(i)->GetZ()*aMaterial->GetVecNbOfAtomsPerVolume()[i]; 00611 } 00612 CS *=factor; 00613 CS_Vs_Element.push_back(CS); 00614 00615 } 00616 else { 00617 for (size_t i=0;i<n_el;i++){ 00618 size_t ind_el = aMaterial->GetElement(i)->GetIndex(); 00619 //G4cout<<aMaterial->GetName()<<G4endl; 00620 G4AdjointCSMatrix* theCSMatrix; 00621 if (IsScatProjToProjCase){ 00622 theCSMatrix=theAdjointCSMatricesForScatProjToProj[ind_model][ind_el]; 00623 } 00624 else theCSMatrix=theAdjointCSMatricesForProdToProj[ind_model][ind_el]; 00625 G4double CS =0.; 00626 if (PrimEnergy > Tlow) 00627 CS = ComputeAdjointCS(PrimEnergy,theCSMatrix,Tlow); 00628 //G4cout<<CS<<G4endl; 00629 CS_Vs_Element.push_back(CS*(aMaterial->GetVecNbOfAtomsPerVolume()[i])); 00630 } 00631 } 00632 00633 } 00634 else { 00635 size_t ind_mat = aMaterial->GetIndex(); 00636 G4AdjointCSMatrix* theCSMatrix; 00637 if (IsScatProjToProjCase){ 00638 theCSMatrix=theAdjointCSMatricesForScatProjToProj[ind_model][ind_mat]; 00639 } 00640 else theCSMatrix=theAdjointCSMatricesForProdToProj[ind_model][ind_mat]; 00641 G4double CS =0.; 00642 if (PrimEnergy > Tlow) 00643 CS = ComputeAdjointCS(PrimEnergy,theCSMatrix,Tlow); 00644 CS_Vs_Element.push_back(CS); 00645 00646 00647 } 00648 lastAdjointCSVsModelsAndElements.push_back(CS_Vs_Element); 00649 00650 } 00651 00652 00653 G4double CS=0; 00654 for (size_t i=0;i<CS_Vs_Element.size();i++){ 00655 CS+=CS_Vs_Element[i]; //We could put the progressive sum of the CS instead of the CS of an element itself 00656 00657 } 00658 return CS; 00659 }
G4double G4AdjointCSManager::ComputeTotalAdjointCS | ( | const G4MaterialCutsCouple * | aMatCutCouple, | |
G4ParticleDefinition * | aPart, | |||
G4double | PrimEnergy | |||
) |
Definition at line 687 of file G4AdjointCSManager.cc.
References ComputeAdjointCS(), G4ProductionCutsTable::GetEnergyCutsVector(), GetForwardParticleEquivalent(), G4MaterialCutsCouple::GetIndex(), G4ParticleDefinition::GetParticleName(), and G4ProductionCutsTable::GetProductionCutsTable().
Referenced by BuildTotalSigmaTables().
00690 { 00691 G4double TotalCS=0.; 00692 00693 DefineCurrentMaterial(aCouple); 00694 00695 00696 std::vector<G4double> CS_Vs_Element; 00697 G4double CS; 00698 for (size_t i=0; i<listOfAdjointEMModel.size();i++){ 00699 00700 G4double Tlow=0; 00701 if (!listOfAdjointEMModel[i]->GetApplyCutInRange()) Tlow =listOfAdjointEMModel[i]->GetLowEnergyLimit(); 00702 else { 00703 G4ParticleDefinition* theDirSecondPartDef = 00704 GetForwardParticleEquivalent(listOfAdjointEMModel[i]->GetAdjointEquivalentOfDirectSecondaryParticleDefinition()); 00705 size_t idx=56; 00706 if (theDirSecondPartDef->GetParticleName() == "gamma") idx = 0; 00707 else if (theDirSecondPartDef->GetParticleName() == "e-") idx = 1; 00708 else if (theDirSecondPartDef->GetParticleName() == "e+") idx = 2; 00709 if (idx <56) { 00710 const std::vector<G4double>* aVec = G4ProductionCutsTable::GetProductionCutsTable()->GetEnergyCutsVector(idx); 00711 Tlow =(*aVec)[aCouple->GetIndex()]; 00712 } 00713 00714 00715 } 00716 if ( Ekin<=listOfAdjointEMModel[i]->GetHighEnergyLimit() && Ekin>=listOfAdjointEMModel[i]->GetLowEnergyLimit()){ 00717 if (aPartDef == listOfAdjointEMModel[i]->GetAdjointEquivalentOfDirectPrimaryParticleDefinition()){ 00718 CS=ComputeAdjointCS(currentMaterial, 00719 listOfAdjointEMModel[i], 00720 Ekin, Tlow,true,CS_Vs_Element); 00721 TotalCS += CS; 00722 (*listSigmaTableForAdjointModelScatProjToProj[i])[currentMatIndex]->PutValue(eindex,CS); 00723 } 00724 if (aPartDef == listOfAdjointEMModel[i]->GetAdjointEquivalentOfDirectSecondaryParticleDefinition()){ 00725 CS = ComputeAdjointCS(currentMaterial, 00726 listOfAdjointEMModel[i], 00727 Ekin, Tlow,false, CS_Vs_Element); 00728 TotalCS += CS; 00729 (*listSigmaTableForAdjointModelProdToProj[i])[currentMatIndex]->PutValue(eindex,CS); 00730 } 00731 00732 } 00733 else { 00734 (*listSigmaTableForAdjointModelScatProjToProj[i])[currentMatIndex]->PutValue(eindex,0.); 00735 (*listSigmaTableForAdjointModelProdToProj[i])[currentMatIndex]->PutValue(eindex,0.); 00736 00737 } 00738 } 00739 return TotalCS; 00740 00741 00742 }
G4AdjointCSManager * G4AdjointCSManager::GetAdjointCSManager | ( | ) | [static] |
Definition at line 61 of file G4AdjointCSManager.cc.
Referenced by G4VEmAdjointModel::AdjointCrossSection(), G4AdjointAlongStepWeightCorrection::AlongStepDoIt(), G4VEmAdjointModel::CorrectPostStepWeight(), G4AdjointPhotoElectricModel::CorrectPostStepWeight(), G4AdjointIonIonisationModel::CorrectPostStepWeight(), G4VAdjointReverseReaction::G4VAdjointReverseReaction(), G4VEmAdjointModel::G4VEmAdjointModel(), G4AdjointhIonisationModel::RapidSampleSecondaries(), G4AdjointComptonModel::RapidSampleSecondaries(), and G4AdjointBremsstrahlungModel::RapidSampleSecondaries().
00062 { if(theInstance == 0) { 00063 static G4AdjointCSManager ins; 00064 theInstance = &ins; 00065 } 00066 return theInstance; 00067 }
G4ParticleDefinition * G4AdjointCSManager::GetAdjointParticleEquivalent | ( | G4ParticleDefinition * | theFwdPartDef | ) |
Definition at line 943 of file G4AdjointCSManager.cc.
References G4AdjointElectron::AdjointElectron(), G4AdjointGamma::AdjointGamma(), G4AdjointProton::AdjointProton(), and G4ParticleDefinition::GetParticleName().
Referenced by RegisterEmProcess(), and RegisterEnergyLossProcess().
00944 { 00945 if (theFwdPartDef->GetParticleName() == "e-") return G4AdjointElectron::AdjointElectron(); 00946 else if (theFwdPartDef->GetParticleName() == "gamma") return G4AdjointGamma::AdjointGamma(); 00947 else if (theFwdPartDef->GetParticleName() == "proton") return G4AdjointProton::AdjointProton(); 00948 else if (theFwdPartDef ==theFwdIon) return theAdjIon; 00949 00950 return 0; 00951 }
G4double G4AdjointCSManager::GetAdjointSigma | ( | G4double | Ekin_nuc, | |
size_t | index_model, | |||
G4bool | is_scat_proj_to_proj, | |||
const G4MaterialCutsCouple * | aCouple | |||
) |
Definition at line 418 of file G4AdjointCSManager.cc.
00420 { DefineCurrentMaterial(aCouple); 00421 G4bool b; 00422 if (is_scat_proj_to_proj) return (((*listSigmaTableForAdjointModelScatProjToProj[index_model])[currentMatIndex])->GetValue(Ekin_nuc, b)); 00423 else return (((*listSigmaTableForAdjointModelProdToProj[index_model])[currentMatIndex])->GetValue(Ekin_nuc, b)); 00424 }
G4double G4AdjointCSManager::GetContinuousWeightCorrection | ( | G4ParticleDefinition * | aPartDef, | |
G4double | PreStepEkin, | |||
G4double | AfterStepEkin, | |||
const G4MaterialCutsCouple * | aCouple, | |||
G4double | step_length | |||
) |
Definition at line 502 of file G4AdjointCSManager.cc.
References GetTotalAdjointCS(), and GetTotalForwardCS().
Referenced by G4AdjointAlongStepWeightCorrection::AlongStepDoIt().
00504 { G4double corr_fac = 1.; 00505 //return corr_fac; 00506 //G4double after_adjCS = GetTotalAdjointCS(aPartDef, AfterStepEkin,aCouple); 00507 G4double after_fwdCS = GetTotalForwardCS(aPartDef, AfterStepEkin,aCouple); 00508 G4double pre_adjCS = GetTotalAdjointCS(aPartDef, PreStepEkin,aCouple); 00509 if (!forward_CS_is_used || pre_adjCS ==0. || after_fwdCS==0.) { 00510 forward_CS_is_used=false; 00511 G4double pre_fwdCS = GetTotalForwardCS(aPartDef, PreStepEkin,aCouple); 00512 corr_fac *=std::exp((pre_adjCS-pre_fwdCS)*step_length); 00513 LastCSCorrectionFactor = 1.; 00514 } 00515 else { 00516 LastCSCorrectionFactor = after_fwdCS/pre_adjCS; 00517 } 00518 00519 00520 00521 return corr_fac; 00522 }
G4double G4AdjointCSManager::GetCrossSectionCorrection | ( | G4ParticleDefinition * | aPartDef, | |
G4double | PreStepEkin, | |||
const G4MaterialCutsCouple * | aCouple, | |||
G4bool & | fwd_is_used, | |||
G4double & | fwd_TotCS | |||
) |
Definition at line 465 of file G4AdjointCSManager.cc.
References GetTotalAdjointCS(), and GetTotalForwardCS().
Referenced by G4VAdjointReverseReaction::GetMeanFreePath().
00467 { G4double corr_fac = 1.; 00468 if (forward_CS_mode) { 00469 fwd_TotCS=PrefwdCS; 00470 if (LastEkinForCS != PreStepEkin || aPartDef != lastPartDefForCS || aCouple!=currentCouple) { 00471 DefineCurrentMaterial(aCouple); 00472 PreadjCS = GetTotalAdjointCS(aPartDef, PreStepEkin,aCouple); 00473 PrefwdCS = GetTotalForwardCS(aPartDef, PreStepEkin,aCouple); 00474 LastEkinForCS = PreStepEkin; 00475 lastPartDefForCS = aPartDef; 00476 if (PrefwdCS >0. && PreadjCS >0.) { 00477 forward_CS_is_used = true; 00478 LastCSCorrectionFactor = PrefwdCS/PreadjCS; 00479 } 00480 else { 00481 forward_CS_is_used = false; 00482 LastCSCorrectionFactor = 1.; 00483 00484 } 00485 00486 } 00487 corr_fac =LastCSCorrectionFactor; 00488 00489 00490 00491 } 00492 else { 00493 forward_CS_is_used = false; 00494 LastCSCorrectionFactor = 1.; 00495 } 00496 fwd_TotCS=PrefwdCS; 00497 fwd_is_used = forward_CS_is_used; 00498 return corr_fac; 00499 }
void G4AdjointCSManager::GetEminForTotalCS | ( | G4ParticleDefinition * | aPartDef, | |
const G4MaterialCutsCouple * | aCouple, | |||
G4double & | emin_adj, | |||
G4double & | emin_fwd | |||
) |
Definition at line 427 of file G4AdjointCSManager.cc.
00429 { DefineCurrentMaterial(aCouple); 00430 DefineCurrentParticle(aPartDef); 00431 emin_adj = EminForAdjSigmaTables[currentParticleIndex][currentMatIndex]/massRatio; 00432 emin_fwd = EminForFwdSigmaTables[currentParticleIndex][currentMatIndex]/massRatio; 00433 00434 00435 00436 }
G4ParticleDefinition * G4AdjointCSManager::GetForwardParticleEquivalent | ( | G4ParticleDefinition * | theAdjPartDef | ) |
Definition at line 954 of file G4AdjointCSManager.cc.
References G4Electron::Electron(), G4Gamma::Gamma(), G4ParticleDefinition::GetParticleName(), and G4Proton::Proton().
Referenced by ComputeTotalAdjointCS().
00955 { 00956 if (theAdjPartDef->GetParticleName() == "adj_e-") return G4Electron::Electron(); 00957 else if (theAdjPartDef->GetParticleName() == "adj_gamma") return G4Gamma::Gamma(); 00958 else if (theAdjPartDef->GetParticleName() == "adj_proton") return G4Proton::Proton(); 00959 else if (theAdjPartDef == theAdjIon) return theFwdIon; 00960 return 0; 00961 }
void G4AdjointCSManager::GetMaxAdjTotalCS | ( | G4ParticleDefinition * | aPartDef, | |
const G4MaterialCutsCouple * | aCouple, | |||
G4double & | e_sigma_max, | |||
G4double & | sigma_max | |||
) |
Definition at line 452 of file G4AdjointCSManager.cc.
00454 { DefineCurrentMaterial(aCouple); 00455 DefineCurrentParticle(aPartDef); 00456 e_sigma_max = EkinofAdjSigmaMax[currentParticleIndex][currentMatIndex]; 00457 G4bool b; 00458 sigma_max =((*theTotalAdjointSigmaTableVector[currentParticleIndex])[currentMatIndex])->GetValue(e_sigma_max, b); 00459 e_sigma_max/=massRatio; 00460 00461 00462 }
void G4AdjointCSManager::GetMaxFwdTotalCS | ( | G4ParticleDefinition * | aPartDef, | |
const G4MaterialCutsCouple * | aCouple, | |||
G4double & | e_sigma_max, | |||
G4double & | sigma_max | |||
) |
Definition at line 439 of file G4AdjointCSManager.cc.
00441 { DefineCurrentMaterial(aCouple); 00442 DefineCurrentParticle(aPartDef); 00443 e_sigma_max = EkinofFwdSigmaMax[currentParticleIndex][currentMatIndex]; 00444 G4bool b; 00445 sigma_max =((*theTotalForwardSigmaTableVector[currentParticleIndex])[currentMatIndex])->GetValue(e_sigma_max, b); 00446 e_sigma_max/=massRatio; 00447 00448 00449 }
G4int G4AdjointCSManager::GetNbProcesses | ( | ) |
G4double G4AdjointCSManager::GetPostStepWeightCorrection | ( | ) |
Definition at line 525 of file G4AdjointCSManager.cc.
Referenced by G4VEmAdjointModel::CorrectPostStepWeight(), G4AdjointPhotoElectricModel::CorrectPostStepWeight(), G4AdjointIonIonisationModel::CorrectPostStepWeight(), G4AdjointhIonisationModel::RapidSampleSecondaries(), G4AdjointComptonModel::RapidSampleSecondaries(), and G4AdjointBremsstrahlungModel::RapidSampleSecondaries().
G4double G4AdjointCSManager::GetTotalAdjointCS | ( | G4ParticleDefinition * | aPartDef, | |
G4double | Ekin, | |||
const G4MaterialCutsCouple * | aCouple | |||
) |
Definition at line 395 of file G4AdjointCSManager.cc.
Referenced by GetContinuousWeightCorrection(), and GetCrossSectionCorrection().
00397 { DefineCurrentMaterial(aCouple); 00398 DefineCurrentParticle(aPartDef); 00399 G4bool b; 00400 return (((*theTotalAdjointSigmaTableVector[currentParticleIndex])[currentMatIndex])->GetValue(Ekin*massRatio, b)); 00401 00402 00403 00404 }
G4double G4AdjointCSManager::GetTotalForwardCS | ( | G4ParticleDefinition * | aPartDef, | |
G4double | Ekin, | |||
const G4MaterialCutsCouple * | aCouple | |||
) |
Definition at line 407 of file G4AdjointCSManager.cc.
Referenced by GetContinuousWeightCorrection(), and GetCrossSectionCorrection().
00409 { DefineCurrentMaterial(aCouple); 00410 DefineCurrentParticle(aPartDef); 00411 G4bool b; 00412 return (((*theTotalForwardSigmaTableVector[currentParticleIndex])[currentMatIndex])->GetValue(Ekin*massRatio, b)); 00413 00414 00415 }
void G4AdjointCSManager::RegisterAdjointParticle | ( | G4ParticleDefinition * | aPartDef | ) |
Definition at line 159 of file G4AdjointCSManager.cc.
References G4ParticleDefinition::GetParticleName().
Referenced by RegisterEmProcess(), and RegisterEnergyLossProcess().
00160 { G4int index=-1; 00161 for (size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){ 00162 if (aPartDef->GetParticleName() == theListOfAdjointParticlesInAction[i]->GetParticleName()) index=i; 00163 } 00164 00165 if (index ==-1){ 00166 listOfForwardEnergyLossProcess.push_back(new std::vector<G4VEnergyLossProcess*>()); 00167 theTotalForwardSigmaTableVector.push_back(new G4PhysicsTable); 00168 theTotalAdjointSigmaTableVector.push_back(new G4PhysicsTable); 00169 listOfForwardEmProcess.push_back(new std::vector<G4VEmProcess*>()); 00170 theListOfAdjointParticlesInAction.push_back(aPartDef); 00171 EminForFwdSigmaTables.push_back(std::vector<G4double> ()); 00172 EminForAdjSigmaTables.push_back(std::vector<G4double> ()); 00173 EkinofFwdSigmaMax.push_back(std::vector<G4double> ()); 00174 EkinofAdjSigmaMax.push_back(std::vector<G4double> ()); 00175 00176 } 00177 }
size_t G4AdjointCSManager::RegisterEmAdjointModel | ( | G4VEmAdjointModel * | ) |
Definition at line 121 of file G4AdjointCSManager.cc.
Referenced by G4VEmAdjointModel::G4VEmAdjointModel().
00122 {listOfAdjointEMModel.push_back(aModel); 00123 listSigmaTableForAdjointModelScatProjToProj.push_back(new G4PhysicsTable); 00124 listSigmaTableForAdjointModelProdToProj.push_back(new G4PhysicsTable); 00125 return listOfAdjointEMModel.size() -1; 00126 00127 }
void G4AdjointCSManager::RegisterEmProcess | ( | G4VEmProcess * | aProcess, | |
G4ParticleDefinition * | aPartDef | |||
) |
Definition at line 130 of file G4AdjointCSManager.cc.
References GetAdjointParticleEquivalent(), and RegisterAdjointParticle().
00131 { 00132 G4ParticleDefinition* anAdjPartDef = GetAdjointParticleEquivalent(aFwdPartDef); 00133 if (anAdjPartDef && aProcess){ 00134 RegisterAdjointParticle(anAdjPartDef); 00135 G4int index=-1; 00136 00137 for (size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){ 00138 if (anAdjPartDef->GetParticleName() == theListOfAdjointParticlesInAction[i]->GetParticleName()) index=i; 00139 } 00140 listOfForwardEmProcess[index]->push_back(aProcess); 00141 } 00142 }
void G4AdjointCSManager::RegisterEnergyLossProcess | ( | G4VEnergyLossProcess * | aProcess, | |
G4ParticleDefinition * | aPartDef | |||
) |
Definition at line 145 of file G4AdjointCSManager.cc.
References GetAdjointParticleEquivalent(), and RegisterAdjointParticle().
00146 { 00147 G4ParticleDefinition* anAdjPartDef = GetAdjointParticleEquivalent(aFwdPartDef); 00148 if (anAdjPartDef && aProcess){ 00149 RegisterAdjointParticle(anAdjPartDef); 00150 G4int index=-1; 00151 for (size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){ 00152 if (anAdjPartDef->GetParticleName() == theListOfAdjointParticlesInAction[i]->GetParticleName()) index=i; 00153 } 00154 listOfForwardEnergyLossProcess[index]->push_back(aProcess); 00155 } 00156 }
G4Element * G4AdjointCSManager::SampleElementFromCSMatrices | ( | G4Material * | aMaterial, | |
G4VEmAdjointModel * | aModel, | |||
G4double | PrimEnergy, | |||
G4double | Tcut, | |||
G4bool | IsScatProjToProjCase | |||
) |
Definition at line 662 of file G4AdjointCSManager.cc.
References ComputeAdjointCS(), G4UniformRand, and G4Material::GetElement().
00667 { std::vector<G4double> CS_Vs_Element; 00668 G4double CS = ComputeAdjointCS(aMaterial,aModel,PrimEnergy,Tcut,IsScatProjToProjCase,CS_Vs_Element); 00669 G4double rand_var= G4UniformRand(); 00670 G4double SumCS=0.; 00671 size_t ind=0; 00672 for (size_t i=0;i<CS_Vs_Element.size();i++){ 00673 SumCS+=CS_Vs_Element[i]; 00674 if (rand_var<=SumCS/CS){ 00675 ind=i; 00676 break; 00677 } 00678 } 00679 00680 return const_cast<G4Element*>(aMaterial->GetElement(ind)); 00681 00682 00683 00684 }
void G4AdjointCSManager::SetFwdCrossSectionMode | ( | G4bool | aBool | ) | [inline] |
void G4AdjointCSManager::SetIon | ( | G4ParticleDefinition * | adjIon, | |
G4ParticleDefinition * | fwdIon | |||
) | [inline] |
void G4AdjointCSManager::SetNbins | ( | G4int | aInt | ) | [inline] |
void G4AdjointCSManager::SetTmax | ( | G4double | aVal | ) | [inline] |
void G4AdjointCSManager::SetTmin | ( | G4double | aVal | ) | [inline] |