45 G4cout <<
"Define regions for VMC cuts per materials." << G4endl;
51 auto g4RegionStore = G4RegionStore::GetInstance();
55 auto worldLV = worldPV->GetLogicalVolume();
56 auto worldMaterial = worldLV->GetMaterial();
59 auto defaultProductionCuts
60 = G4ProductionCutsTable::GetProductionCutsTable()->GetDefaultProductionCuts();
64 auto lvStore = G4LogicalVolumeStore::GetInstance();
66 for (std::size_t i = 0; i < lvStore->size(); ++i) {
68 auto lv = (*lvStore)[i];
69 auto materialName = lv->GetMaterial()->GetName();
72 G4cout <<
"-- Volume = " << i <<
" " << lv->GetName()
73 <<
" material = " << materialName << G4endl;
79 G4cout <<
" " <<
"skipping worldVolume" << G4endl;
85 if (lv->GetRegion() !=
nullptr &&
86 lv->GetRegion()->GetName() == materialName) {
91 <<
"has already region set, skipping" << G4endl;
98 auto regionName = materialName;
99 auto region = g4RegionStore->GetRegion(regionName,
false);
100 if (region !=
nullptr) {
101 if (lv->GetRegion() != region) {
106 <<
"adding volume in region = " << regionName << G4endl;
108 region->AddRootLogicalVolume(lv);
116 <<
"creating new region = " << regionName << G4endl;
118 region =
new G4Region(regionName);
119 region->AddRootLogicalVolume(lv);
120 region->UsedInMassGeometry(
true);
121 region->SetProductionCuts(defaultProductionCuts);
128 g4RegionStore->UpdateMaterialList(worldPV);
135 G4cout <<
"Number of added regions: " << counter << G4endl;
145 G4cout <<
"Update G4 production cuts table" << G4endl;
149 auto g4ProductionCutsTable = G4ProductionCutsTable::GetProductionCutsTable();
157 std::vector<G4double> gamCuts;
158 std::vector<G4double> eleCuts;
159 std::vector<G4double> hadCuts;
165 g4ProductionCutsTable->CreateCoupleTables();
168#if G4VERSION_NUMBER <= 1130
170 for (std::size_t i = 0; i < g4ProductionCutsTable->GetTableSize(); ++i) {
171 auto couple =
const_cast<G4MaterialCutsCouple*
>(g4ProductionCutsTable->GetMaterialCutsCouple(i));
172 auto material = couple->GetMaterial();
173 couple->SetMaterial(material);
177 for (std::size_t i = 0; i < g4ProductionCutsTable->GetTableSize(); ++i) {
178 auto couple = g4ProductionCutsTable->GetMaterialCutsCouple(i);
179 auto material = couple->GetMaterial();
180 auto medium = mediumMap->GetMedium(material);
182 auto limits = (
TG4Limits*)medium->GetLimits();
187 gamCuts.push_back(cutGam);
188 eleCuts.push_back(cutEle);
189 hadCuts.push_back(cutHad);
193 g4ProductionCutsTable->SetEnergyCutVector(gamCuts, 0);
195 G4cout <<
"... table updated for Gamma with CUTGAM values" << G4endl;
200 g4ProductionCutsTable->SetEnergyCutVector(eleCuts, 1);
202 G4cout <<
"... table updated for Electron with CUTELE values" << G4endl;
207 g4ProductionCutsTable->SetEnergyCutVector(eleCuts, 2);
209 G4cout <<
"... table updated for Positron with CUTELE values" << G4endl;
214 g4ProductionCutsTable->SetEnergyCutVector(hadCuts, 3);
216 G4cout <<
"... table updated for proton with HADR values" << G4endl;