Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 #include "G4ChannelingOptrChangeCrossSection.h 27 #include "G4BiasingProcessInterface.hh" 28 #include "G4BOptnChangeCrossSection.hh" 29 30 #include "G4ParticleDefinition.hh" 31 #include "G4ParticleTable.hh" 32 #include "G4VProcess.hh" 33 34 #include "Randomize.hh" 35 36 #include "G4InteractionLawPhysical.hh" 37 38 #include "G4ChannelingTrackData.hh" 39 #include "G4EmProcessSubType.hh" 40 #include "G4PhysicsModelCatalog.hh" 41 42 //....oooOO0OOooo........oooOO0OOooo........oo 43 44 G4ChannelingOptrChangeCrossSection::G4Channeli 45 46 :G4VBiasingOperator(name), 47 fChannelingID(G4PhysicsModelCatalog::GetModelI 48 fSetup(true){ 49 fParticleToBias = G4ParticleTable::GetPart 50 51 if ( fParticleToBias == 0 ) 52 { 53 G4ExceptionDescription ed; 54 ed << "Particle `" << particleName << 55 G4Exception("G4ChannelingOptrChangeCro 56 "G4Channeling", 57 JustWarning, 58 ed); 59 } 60 61 fProcessToDensity["channeling"] = fDensity 62 } 63 64 //....oooOO0OOooo........oooOO0OOooo........oo 65 66 G4ChannelingOptrChangeCrossSection::~G4Channel 67 for ( std::map< const G4BiasingProcessInte 68 it = fChangeCrossSectionOperations.be 69 it != fChangeCrossSectionOperations.e 70 it++ ) delete (*it).second; 71 } 72 73 //....oooOO0OOooo........oooOO0OOooo........oo 74 75 void G4ChannelingOptrChangeCrossSection::Start 76 if ( fSetup ){ 77 const G4ProcessManager* processManager 78 const G4BiasingProcessSharedData* shar 79 G4BiasingProcessInterface::GetSharedDa 80 if ( sharedData ){ 81 for ( size_t i = 0 ; i < (sharedDa 82 const G4BiasingProcessInterfac 83 (sharedData->GetPhysicsBiasing 84 const G4String& processName = 85 const G4String& operationName 86 fChangeCrossSectionOperations[ 87 new G4BOptnChangeCrossSection(operationN 88 89 G4ProcessType type = wrapperPr 90 G4int subType = wrapperProcess 91 92 switch (type) { 93 case fNotDefined: 94 fProcessToDensity[proc 95 break; 96 case fTransportation: 97 fProcessToDensity[proc 98 break; 99 case fElectromagnetic: 100 if(subType == fCoulomb 101 subType == fMultipl 102 fProcessToDensity[ 103 } 104 if(subType == fIonisat 105 subType == fPairPro 106 subType == fAnnihil 107 subType == fAnnihil 108 subType == fAnnihil 109 fProcessToDensity[ 110 } 111 if(subType == fBremsst 112 subType == fNuclear 113 fProcessToDensity[ 114 } 115 116 if(subType == fCerenko 117 subType == fScintil 118 subType == fSynchro 119 subType == fTransit 120 fProcessToDensity[ 121 } 122 if(subType == fRayleig 123 subType == fPhotoEl 124 subType == fCompton 125 subType == fGammaCo 126 subType == fGammaCo 127 fProcessToDensity[ 128 } 129 break; 130 case fOptical: 131 fProcessToDensity[proc 132 break; 133 case fHadronic: 134 fProcessToDensity[proc 135 break; 136 case fPhotolepton_hadron: 137 fProcessToDensity[proc 138 break; 139 case fGeneral: 140 fProcessToDensity[proc 141 break; 142 case fDecay: 143 fProcessToDensity[proc 144 break; 145 case fParameterisation: 146 fProcessToDensity[proc 147 break; 148 case fUserDefined: 149 fProcessToDensity[proc 150 break; 151 case fParallel: 152 fProcessToDensity[proc 153 break; 154 case fPhonon: 155 fProcessToDensity[proc 156 break; 157 case fUCN: 158 fProcessToDensity[proc 159 break; 160 default: 161 fProcessToDensity[proc 162 break; 163 } 164 } 165 } 166 fSetup = false; 167 } 168 } 169 170 //....oooOO0OOooo........oooOO0OOooo........oo 171 172 G4VBiasingOperation* 173 G4ChannelingOptrChangeCrossSection::ProposeOcc 174 175 176 { 177 if ( track->GetDefinition() != fParticleTo 178 179 G4double analogInteractionLength = 180 callingProcess->GetWrappedProcess()->GetCu 181 if ( analogInteractionLength > DBL_MAX/10. 182 183 G4double analogXS = 1./analogInteractionLe 184 185 G4ChannelingTrackData* trackdata = 186 (G4ChannelingTrackData*)(track->GetAuxilia 187 if(trackdata==nullptr) return 0; 188 189 G4double XStransformation = 1.; 190 auto search = fProcessToDensity.find(calli 191 if(search != fProcessToDensity.end()) { 192 switch (search->second) { 193 case fDensityRatioNuDElD: 194 XStransformation = trackdata-> 195 break; 196 case fDensityRatioNuD: 197 XStransformation = trackdata-> 198 break; 199 case fDensityRatioElD: 200 XStransformation = trackdata-> 201 break; 202 case fDensityRatioNone: 203 return 0; 204 break; 205 case fDensityRatioNotDefined: 206 return 0; 207 break; 208 default: 209 return 0; 210 break; 211 } 212 } 213 else{ 214 XStransformation = trackdata->GetDensi 215 } 216 217 G4BOptnChangeCrossSection* operation = f 218 G4VBiasingOperation* previousOperation = c 219 220 if ( previousOperation == 0 ){ 221 operation->SetBiasedCrossSection( XStr 222 operation->Sample(); 223 } 224 else{ 225 if ( previousOperation != operation ) 226 G4ExceptionDescription ed; 227 ed << " Logic problem in operation 228 G4Exception("G4ChannelingOptrChang 229 "G4Channeling", 230 JustWarning, 231 ed); 232 return 0; 233 } 234 if ( operation->GetInteractionOccured( 235 operation->SetBiasedCrossSection( 236 operation->Sample(); 237 } 238 else{ 239 operation->UpdateForStep( callingP 240 operation->SetBiasedCrossSection( 241 operation->UpdateForStep( 0.0 ); 242 } 243 } 244 245 return operation; 246 247 } 248 249 //....oooOO0OOooo........oooOO0OOooo........oo 250 251 void G4ChannelingOptrChangeCrossSection:: 252 OperationApplied(const G4BiasingProcessInterfa 253 G4BiasingAppliedCase, 254 G4VBiasingOperation* 255 G4double, 256 G4VBiasingOperation*, 257 const G4VParticleChange* 258 { 259 G4BOptnChangeCrossSection* operation = fCh 260 if ( operation == occurenceOperationAppli 261 } 262 263 //....oooOO0OOooo........oooOO0OOooo........oo 264