Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // G4AdjointPrimaryGeneratorAction implementat << 26 // $Id: G4AdjointPrimaryGeneratorAction.cc 76245 2013-11-08 11:14:32Z gcosmo $ 27 // 27 // 28 // ------------------------------------------- << 28 ///////////////////////////////////////////////////////////////////////////// 29 // Class Name: G4AdjointPrimaryGeneratorAc << 29 // Class Name: G4AdjointPrimaryGeneratorAction 30 // Author: L. Desorgher, 2007-2009 << 30 // Author: L. Desorgher 31 // Organisation: SpaceIT GmbH << 31 // Organisation: SpaceIT GmbH 32 // Contract: ESA contract 21435/08/NL/AT << 32 // Contract: ESA contract 21435/08/NL/AT 33 // Customer: ESA/ESTEC << 33 // Customer: ESA/ESTEC 34 // ------------------------------------------- << 34 ///////////////////////////////////////////////////////////////////////////// 35 35 36 #include "G4AdjointPrimaryGeneratorAction.hh" 36 #include "G4AdjointPrimaryGeneratorAction.hh" 37 37 38 #include "G4AdjointPrimaryGenerator.hh" << 38 #include "G4PhysicalConstants.hh" 39 #include "G4AdjointSimManager.hh" << 40 #include "G4Event.hh" 39 #include "G4Event.hh" 41 #include "G4Gamma.hh" << 42 #include "G4ParticleDefinition.hh" << 43 #include "G4ParticleTable.hh" 40 #include "G4ParticleTable.hh" 44 #include "G4PhysicalConstants.hh" << 41 #include "G4ParticleDefinition.hh" 45 << 42 #include "G4ParticleTable.hh" 46 // ------------------------------------------- << 43 #include "G4AdjointSimManager.hh" >> 44 #include "G4AdjointPrimaryGenerator.hh" >> 45 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 47 // 46 // 48 G4AdjointPrimaryGeneratorAction::G4AdjointPrim 47 G4AdjointPrimaryGeneratorAction::G4AdjointPrimaryGeneratorAction() 49 { << 48 : Emin(0.), Emax(0.), EminIon(0.), EmaxIon(0.), 50 theAdjointPrimaryGenerator = new G4AdjointPr << 49 index_particle(100000), 51 << 50 radius_spherical_source(0.), fwd_ion(0), adj_ion(0), 52 PrimariesConsideredInAdjointSim[G4String("e- << 51 ion_name("not_defined") 53 PrimariesConsideredInAdjointSim[G4String("ga << 52 { 54 PrimariesConsideredInAdjointSim[G4String("pr << 53 theAdjointPrimaryGenerator= new G4AdjointPrimaryGenerator(); 55 PrimariesConsideredInAdjointSim[G4String("io << 54 >> 55 PrimariesConsideredInAdjointSim[G4String("e-")]=false; >> 56 PrimariesConsideredInAdjointSim[G4String("gamma")]=false; >> 57 PrimariesConsideredInAdjointSim[G4String("proton")]=false; >> 58 PrimariesConsideredInAdjointSim[G4String("ion")]=false; 56 59 57 ListOfPrimaryFwdParticles.clear(); 60 ListOfPrimaryFwdParticles.clear(); 58 ListOfPrimaryAdjParticles.clear(); 61 ListOfPrimaryAdjParticles.clear(); 59 } 62 } 60 << 63 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 61 // ------------------------------------------- << 62 // 64 // 63 G4AdjointPrimaryGeneratorAction::~G4AdjointPri 65 G4AdjointPrimaryGeneratorAction::~G4AdjointPrimaryGeneratorAction() 64 { 66 { 65 delete theAdjointPrimaryGenerator; 67 delete theAdjointPrimaryGenerator; 66 } 68 } 67 << 69 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 68 // ------------------------------------------- << 69 // 70 // 70 void G4AdjointPrimaryGeneratorAction::Generate 71 void G4AdjointPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) 71 { << 72 { G4int evt_id=anEvent->GetEventID(); 72 G4int evt_id = anEvent->GetEventID(); << 73 size_t n=ListOfPrimaryAdjParticles.size(); 73 std::size_t n = ListOfPrimaryAdjParticles.si << 74 index_particle=size_t(evt_id)-n*(size_t(evt_id)/n); 74 index_particle = std::size_t(evt_id) - n * ( << 75 75 << 76 76 G4double E1 = Emin; << 77 G4double E1=Emin; 77 G4double E2 = Emax; << 78 G4double E2=Emax; 78 if (ListOfPrimaryAdjParticles[index_particle << 79 if (!ListOfPrimaryAdjParticles[index_particle]) UpdateListOfPrimaryParticles();//ion has not been created yet 79 UpdateListOfPrimaryParticles(); // ion ha << 80 80 << 81 if (ListOfPrimaryAdjParticles[index_particle]->GetParticleName() == "adj_proton") { 81 if (ListOfPrimaryAdjParticles[index_particle << 82 E1=EminIon; 82 E1 = EminIon; << 83 E2=EmaxIon; 83 E2 = EmaxIon; << 84 } 84 } << 85 if (ListOfPrimaryAdjParticles[index_particle]->GetParticleType() == "adjoint_nucleus") { 85 if (ListOfPrimaryAdjParticles[index_particle << 86 G4int A= ListOfPrimaryAdjParticles[index_particle]->GetAtomicMass(); 86 G4int A = ListOfPrimaryAdjParticles[index_ << 87 E1=EminIon*A; 87 E1 = EminIon * A; << 88 E2=EmaxIon*A; 88 E2 = EmaxIon * A; << 89 } 89 } << 90 theAdjointPrimaryGenerator->GenerateFwdPrimaryVertex(anEvent,ListOfPrimaryFwdParticles[index_particle],E1,E2); 90 // Generate first the forwrad primaries << 91 G4PrimaryVertex* fwdPrimVertex = anEvent->GetPrimaryVertex(); 91 theAdjointPrimaryGenerator->GenerateFwdPrima << 92 92 anEvent, ListOfPrimaryFwdParticles[index_p << 93 p=fwdPrimVertex->GetPrimary()->GetMomentum(); 93 G4PrimaryVertex* fwdPrimVertex = anEvent->Ge << 94 pos=fwdPrimVertex->GetPosition(); 94 << 95 G4double pmag=p.mag(); 95 p = fwdPrimVertex->GetPrimary()->GetMomentum << 96 96 pos = fwdPrimVertex->GetPosition(); << 97 97 G4double pmag = p.mag(); << 98 G4double m0=ListOfPrimaryFwdParticles[index_particle]->GetPDGMass(); 98 G4double m0 = ListOfPrimaryFwdParticles[inde << 99 G4double ekin=std::sqrt( m0*m0 + pmag*pmag) -m0; 99 G4double ekin = std::sqrt(m0 * m0 + pmag * p << 100 100 << 101 G4PrimaryVertex* adjPrimVertex = new G4PrimaryVertex(); 101 G4double weight_correction = 1.; << 102 adjPrimVertex->SetPosition(pos.x(),pos.y(),pos.z()); 102 // For gamma generate the particle along the << 103 adjPrimVertex->SetT0(0.); 103 G4ThreeVector dir = -p / p.mag(); << 104 G4PrimaryParticle* aPrimParticle = new G4PrimaryParticle(ListOfPrimaryAdjParticles[index_particle], 104 << 105 -p.x(),-p.y(),-p.z()); 105 weight_correction = 1.; << 106 106 << 107 adjPrimVertex->SetPrimary(aPrimParticle); 107 if (ListOfPrimaryFwdParticles[index_particle << 108 anEvent->AddPrimaryVertex(adjPrimVertex); 108 { << 109 109 G4double weight = (1. / nb_fwd_gammas_per_ << 110 //The factor pi is to normalise the weight to the directional flux 110 fwdPrimVertex->SetWeight(weight); << 111 G4double adjoint_source_area = G4AdjointSimManager::GetInstance()->GetAdjointSourceArea(); 111 for (G4int i = 0; i < nb_fwd_gammas_per_ev << 112 G4double adjoint_weight = ComputeEnergyDistWeight(ekin,E1,E2)*adjoint_source_area*pi; 112 auto newFwdPrimVertex = new G4PrimaryVer << 113 adjPrimVertex->SetWeight(adjoint_weight); 113 newFwdPrimVertex->SetPosition(pos.x(), p << 114 114 newFwdPrimVertex->SetT0(0.); << 115 115 auto aPrimParticle = << 116 116 new G4PrimaryParticle(ListOfPrimaryFwd << 117 G4AdjointSimManager::GetInstance()->SetAdjointTrackingMode(true); 117 newFwdPrimVertex->SetPrimary(aPrimPartic << 118 118 newFwdPrimVertex->SetWeight(weight); << 119 119 anEvent->AddPrimaryVertex(newFwdPrimVert << 120 120 } << 121 /* if ( !last_generated_part_was_adjoint ) { 121 } << 122 122 << 123 index_particle++; 123 // Now generate the adjoint primaries << 124 if (index_particle >= ListOfPrimaryAdjParticles.size()) index_particle =0; 124 auto adjPrimVertex = new G4PrimaryVertex(); << 125 125 adjPrimVertex->SetPosition(pos.x(), pos.y(), << 126 126 adjPrimVertex->SetT0(0.); << 127 G4double E1=Emin; 127 auto aPrimParticle = << 128 G4double E2=Emax; 128 new G4PrimaryParticle(ListOfPrimaryAdjPart << 129 if (!ListOfPrimaryAdjParticles[index_particle]) UpdateListOfPrimaryParticles();//ion has not been created yet 129 << 130 130 adjPrimVertex->SetPrimary(aPrimParticle); << 131 if (ListOfPrimaryAdjParticles[index_particle]->GetParticleName() == "adj_proton") { 131 anEvent->AddPrimaryVertex(adjPrimVertex); << 132 E1=EminIon; 132 << 133 E2=EmaxIon; 133 // The factor pi is to normalise the weight << 134 } 134 G4double adjoint_source_area = G4AdjointSimM << 135 if (ListOfPrimaryAdjParticles[index_particle]->GetParticleType() == "adjoint_nucleus") { 135 G4double adjoint_weight = << 136 G4int A= ListOfPrimaryAdjParticles[index_particle]->GetAtomicMass(); 136 weight_correction * ComputeEnergyDistWeigh << 137 E1=EminIon*A; 137 if (ListOfPrimaryAdjParticles[index_particle << 138 E2=EmaxIon*A; 138 // The weight will be corrected at the end << 139 } 139 // are used << 140 theAdjointPrimaryGenerator->GenerateAdjointPrimaryVertex(anEvent, 140 adjoint_weight = adjoint_weight / nb_adj_p << 141 ListOfPrimaryAdjParticles[index_particle], 141 for (G4int i = 0; i < nb_adj_primary_gamma << 142 E1,E2); 142 auto newAdjPrimVertex = new G4PrimaryVer << 143 G4PrimaryVertex* aPrimVertex = anEvent->GetPrimaryVertex(); 143 newAdjPrimVertex->SetPosition(pos.x(), p << 144 144 newAdjPrimVertex->SetT0(0.); << 145 145 aPrimParticle = << 146 p=aPrimVertex->GetPrimary()->GetMomentum(); 146 new G4PrimaryParticle(ListOfPrimaryAdj << 147 pos=aPrimVertex->GetPosition(); 147 newAdjPrimVertex->SetPrimary(aPrimPartic << 148 G4double pmag=p.mag(); 148 newAdjPrimVertex->SetWeight(adjoint_weig << 149 149 anEvent->AddPrimaryVertex(newAdjPrimVert << 150 G4double m0=ListOfPrimaryAdjParticles[index_particle]->GetPDGMass(); 150 } << 151 G4double ekin=std::sqrt( m0*m0 + pmag*pmag) -m0; 151 } << 152 152 else if (ListOfPrimaryAdjParticles[index_par << 153 153 // The weight will be corrected at the end << 154 //The factor pi is to normalise the weight to the directional flux 154 // are used << 155 G4double adjoint_source_area = G4AdjointSimManager::GetInstance()->GetAdjointSourceArea(); 155 adjoint_weight = adjoint_weight / nb_adj_p << 156 G4double adjoint_weight = ComputeEnergyDistWeight(ekin,E1,E2)*adjoint_source_area*pi; 156 for (G4int i = 0; i < nb_adj_primary_elect << 157 157 auto newAdjPrimVertex = new G4PrimaryVer << 158 aPrimVertex->SetWeight(adjoint_weight); 158 newAdjPrimVertex->SetPosition(pos.x(), p << 159 159 newAdjPrimVertex->SetT0(0.); << 160 last_generated_part_was_adjoint =true; 160 aPrimParticle = << 161 G4AdjointSimManager::GetInstance()->SetAdjointTrackingMode(true); 161 new G4PrimaryParticle(ListOfPrimaryAdj << 162 G4AdjointSimManager::GetInstance()->RegisterAdjointPrimaryWeight(adjoint_weight); 162 newAdjPrimVertex->SetPrimary(aPrimPartic << 163 } 163 newAdjPrimVertex->SetWeight(adjoint_weig << 164 else { 164 anEvent->AddPrimaryVertex(newAdjPrimVert << 165 //fwd particle equivalent to the last generated adjoint particle ios generated 165 } << 166 G4PrimaryVertex* aPrimVertex = new G4PrimaryVertex(); 166 } << 167 aPrimVertex->SetPosition(pos.x(),pos.y(),pos.z()); 167 adjPrimVertex->SetWeight(adjoint_weight); << 168 aPrimVertex->SetT0(0.); >> 169 G4PrimaryParticle* aPrimParticle = new G4PrimaryParticle(ListOfPrimaryFwdParticles[index_particle], >> 170 -p.x(),-p.y(),-p.z()); >> 171 >> 172 aPrimVertex->SetPrimary(aPrimParticle); >> 173 anEvent->AddPrimaryVertex(aPrimVertex); >> 174 last_generated_part_was_adjoint =false; >> 175 G4AdjointSimManager::GetInstance()->SetAdjointTrackingMode(false); >> 176 */ 168 177 169 // Call some methods of G4AdjointSimManager << 170 G4AdjointSimManager::GetInstance()->SetAdjoi << 171 G4AdjointSimManager::GetInstance()->ClearEnd << 172 G4AdjointSimManager::GetInstance()->ResetDid << 173 } 178 } 174 << 179 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 175 // ------------------------------------------- << 176 // 180 // 177 void G4AdjointPrimaryGeneratorAction::SetEmin( 181 void G4AdjointPrimaryGeneratorAction::SetEmin(G4double val) 178 { 182 { 179 Emin = val; << 183 Emin=val; 180 EminIon = val; << 184 EminIon=val; 181 } 185 } 182 << 186 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 183 // ------------------------------------------- << 184 // 187 // 185 void G4AdjointPrimaryGeneratorAction::SetEmax( 188 void G4AdjointPrimaryGeneratorAction::SetEmax(G4double val) 186 { 189 { 187 Emax = val; << 190 Emax=val; 188 EmaxIon = val; << 191 EmaxIon=val; 189 } 192 } 190 << 193 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 191 // ------------------------------------------- << 192 // 194 // 193 void G4AdjointPrimaryGeneratorAction::SetEminI 195 void G4AdjointPrimaryGeneratorAction::SetEminIon(G4double val) 194 { 196 { 195 EminIon = val; << 197 EminIon=val; 196 } 198 } 197 << 199 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 198 // ------------------------------------------- << 199 // 200 // 200 void G4AdjointPrimaryGeneratorAction::SetEmaxI 201 void G4AdjointPrimaryGeneratorAction::SetEmaxIon(G4double val) 201 { 202 { 202 EmaxIon = val; << 203 EmaxIon=val; 203 } 204 } 204 << 205 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 205 // ------------------------------------------- << 206 // 206 // 207 G4double G4AdjointPrimaryGeneratorAction::Comp << 207 G4double G4AdjointPrimaryGeneratorAction::ComputeEnergyDistWeight(G4double E ,G4double E1, G4double E2) 208 << 209 { 208 { 210 // We generate N numbers of primaries with << 209 // We generate N numbers of primaries with a 1/E energy law distribution. 211 // We have therefore an energy distribution << 210 // We have therefore an energy distribution function 212 // f(E)=C/E (1) << 211 // f(E)=C/E (1) 213 // with C a constant that is such that << 212 // with C a constant that is such that 214 // N=Integral(f(E),E1,E2)=C.std::log(E2/E1 << 213 // N=Integral(f(E),E1,E2)=C.std::log(E2/E1) (2) 215 // Therefore from (2) we get << 214 // Therefore from (2) we get 216 // C=N/ std::log(E2/E1) (3) << 215 // C=N/ std::log(E2/E1) (3) 217 // and << 216 // and 218 // f(E)=N/ std::log(E2/E1)/E (4) << 217 // f(E)=N/ std::log(E2/E1)/E (4) 219 // For the adjoint simulation we need a ener << 218 //For the adjoint simulation we need a energy distribution f'(E)=1.. 220 // To get that we need therefore to apply a << 219 //To get that we need therefore to apply a weight to the primary 221 // W=1/f(E)=E*std::log(E2/E1)/N << 220 // W=1/f(E)=E*std::log(E2/E1)/N 222 // << 221 // 223 return std::log(E2 / E1) * E / G4AdjointSimM << 222 return std::log(E2/E1)*E/G4AdjointSimManager::GetInstance()->GetNbEvtOfLastRun(); >> 223 224 } 224 } 225 << 225 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 226 // ------------------------------------------- << 227 // 226 // 228 void G4AdjointPrimaryGeneratorAction::SetSpher << 227 void G4AdjointPrimaryGeneratorAction::SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector center_pos) 229 << 228 { 230 { << 231 radius_spherical_source = radius; 229 radius_spherical_source = radius; 232 center_spherical_source = center_pos; 230 center_spherical_source = center_pos; 233 type_of_adjoint_source = "Spherical"; << 231 type_of_adjoint_source ="Spherical"; 234 theAdjointPrimaryGenerator->SetSphericalAdjo << 232 theAdjointPrimaryGenerator->SetSphericalAdjointPrimarySource(radius,center_pos); 235 } 233 } 236 << 234 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 237 // ------------------------------------------- << 238 // 235 // 239 void G4AdjointPrimaryGeneratorAction::SetAdjoi << 236 void G4AdjointPrimaryGeneratorAction::SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String& volume_name) 240 const G4String& volume_name) << 241 { 237 { 242 type_of_adjoint_source = "ExternalSurfaceOfA << 238 type_of_adjoint_source ="ExternalSurfaceOfAVolume"; 243 theAdjointPrimaryGenerator->SetAdjointPrimar 239 theAdjointPrimaryGenerator->SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(volume_name); 244 } 240 } 245 << 241 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 246 // ------------------------------------------- << 247 // 242 // 248 void G4AdjointPrimaryGeneratorAction::Consider 243 void G4AdjointPrimaryGeneratorAction::ConsiderParticleAsPrimary(const G4String& particle_name) 249 { 244 { 250 if (PrimariesConsideredInAdjointSim.find(par << 245 if (PrimariesConsideredInAdjointSim.find(particle_name) != PrimariesConsideredInAdjointSim.end()){ 251 { << 246 PrimariesConsideredInAdjointSim[particle_name]=true; 252 PrimariesConsideredInAdjointSim[particle_n << 253 } 247 } 254 UpdateListOfPrimaryParticles(); 248 UpdateListOfPrimaryParticles(); 255 } 249 } 256 << 250 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 257 // ------------------------------------------- << 258 // 251 // 259 void G4AdjointPrimaryGeneratorAction::NeglectP 252 void G4AdjointPrimaryGeneratorAction::NeglectParticleAsPrimary(const G4String& particle_name) 260 { 253 { 261 if (PrimariesConsideredInAdjointSim.find(par << 254 if (PrimariesConsideredInAdjointSim.find(particle_name) != PrimariesConsideredInAdjointSim.end()){ 262 { << 255 PrimariesConsideredInAdjointSim[particle_name]= false; 263 PrimariesConsideredInAdjointSim[particle_n << 264 } 256 } 265 UpdateListOfPrimaryParticles(); 257 UpdateListOfPrimaryParticles(); 266 } 258 } 267 << 259 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 268 // ------------------------------------------- << 269 // 260 // 270 void G4AdjointPrimaryGeneratorAction::UpdateLi 261 void G4AdjointPrimaryGeneratorAction::UpdateListOfPrimaryParticles() 271 { 262 { 272 G4ParticleTable* theParticleTable = G4Partic << 263 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable(); 273 ListOfPrimaryFwdParticles.clear(); << 264 ListOfPrimaryFwdParticles.clear(); 274 ListOfPrimaryAdjParticles.clear(); << 265 ListOfPrimaryAdjParticles.clear(); 275 for (const auto& iter : PrimariesConsideredI << 266 std::map<G4String, G4bool>::iterator iter; 276 if (iter.second) { << 267 for( iter = PrimariesConsideredInAdjointSim.begin(); iter != PrimariesConsideredInAdjointSim.end(); ++iter ) { 277 G4String fwd_particle_name = iter.first; << 268 if(iter->second) { 278 if (fwd_particle_name != "ion") { << 269 G4String fwd_particle_name = iter->first; 279 G4String adj_particle_name = G4String( << 270 if ( fwd_particle_name != "ion") { 280 ListOfPrimaryFwdParticles.push_back(th << 271 G4String adj_particle_name = G4String("adj_") + fwd_particle_name; 281 ListOfPrimaryAdjParticles.push_back(th << 272 ListOfPrimaryFwdParticles.push_back(theParticleTable->FindParticle(fwd_particle_name)); 282 } << 273 ListOfPrimaryAdjParticles.push_back(theParticleTable->FindParticle(adj_particle_name)); 283 else { << 274 } 284 if (fwd_ion != nullptr) { << 275 else { 285 ion_name = fwd_ion->GetParticleName( << 276 if (fwd_ion ){ 286 G4String adj_ion_name = G4String("ad << 277 ion_name=fwd_ion->GetParticleName(); 287 ListOfPrimaryFwdParticles.push_back( << 278 G4String adj_ion_name=G4String("adj_") +ion_name; 288 ListOfPrimaryAdjParticles.push_back( << 279 ListOfPrimaryFwdParticles.push_back(fwd_ion); 289 } << 280 ListOfPrimaryAdjParticles.push_back(adj_ion); 290 else { << 281 } 291 ListOfPrimaryFwdParticles.push_back( << 282 else { 292 ListOfPrimaryAdjParticles.push_back( << 283 ListOfPrimaryFwdParticles.push_back(0); 293 } << 284 ListOfPrimaryAdjParticles.push_back(0); 294 } << 285 295 } << 286 } 296 } << 287 } >> 288 } >> 289 } 297 } 290 } 298 << 291 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 299 // ------------------------------------------- << 300 // 292 // 301 void G4AdjointPrimaryGeneratorAction::SetPrima << 293 void G4AdjointPrimaryGeneratorAction::SetPrimaryIon(G4ParticleDefinition* adjointIon, G4ParticleDefinition* fwdIon) 302 << 303 { 294 { 304 fwd_ion = fwdIon; 295 fwd_ion = fwdIon; 305 adj_ion = adjointIon; 296 adj_ion = adjointIon; 306 UpdateListOfPrimaryParticles(); 297 UpdateListOfPrimaryParticles(); 307 } 298 } >> 299 308 300