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.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/solidstate/channeling/src/G4ChannelingOptrChangeCrossSection.cc (Version 11.3.0) and /processes/solidstate/channeling/src/G4ChannelingOptrChangeCrossSection.cc (Version 10.7.p3)


  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 #include "G4ChannelingOptrChangeCrossSection.h     26 #include "G4ChannelingOptrChangeCrossSection.hh"
 27 #include "G4BiasingProcessInterface.hh"            27 #include "G4BiasingProcessInterface.hh"
 28 #include "G4BOptnChangeCrossSection.hh"            28 #include "G4BOptnChangeCrossSection.hh"
 29                                                    29 
 30 #include "G4ParticleDefinition.hh"                 30 #include "G4ParticleDefinition.hh"
 31 #include "G4ParticleTable.hh"                      31 #include "G4ParticleTable.hh"
 32 #include "G4VProcess.hh"                           32 #include "G4VProcess.hh"
 33                                                    33 
 34 #include "Randomize.hh"                            34 #include "Randomize.hh"
 35                                                    35 
 36 #include "G4InteractionLawPhysical.hh"             36 #include "G4InteractionLawPhysical.hh"
 37                                                    37 
 38 #include "G4ChannelingTrackData.hh"                38 #include "G4ChannelingTrackData.hh"
 39 #include "G4EmProcessSubType.hh"                   39 #include "G4EmProcessSubType.hh"
 40 #include "G4PhysicsModelCatalog.hh"            << 
 41                                                    40 
 42 //....oooOO0OOooo........oooOO0OOooo........oo     41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 43                                                    42 
 44 G4ChannelingOptrChangeCrossSection::G4Channeli <<  43 G4ChannelingOptrChangeCrossSection::G4ChannelingOptrChangeCrossSection(G4String particleName,
 45                                                <<  44                                                                        G4String         name)
 46   :G4VBiasingOperator(name),                   <<  45 :G4VBiasingOperator(name),
 47 fChannelingID(G4PhysicsModelCatalog::GetModelI <<  46 fChannelingID(-1),
 48 fSetup(true){                                      47 fSetup(true){
 49     fParticleToBias = G4ParticleTable::GetPart     48     fParticleToBias = G4ParticleTable::GetParticleTable()->FindParticle(particleName);
 50                                                    49     
 51     if ( fParticleToBias == 0 )                    50     if ( fParticleToBias == 0 )
 52     {                                              51     {
 53         G4ExceptionDescription ed;                 52         G4ExceptionDescription ed;
 54         ed << "Particle `" << particleName <<      53         ed << "Particle `" << particleName << "' not found !" << G4endl;
 55         G4Exception("G4ChannelingOptrChangeCro     54         G4Exception("G4ChannelingOptrChangeCrossSection(...)",
 56                     "G4Channeling",                55                     "G4Channeling",
 57                     JustWarning,                   56                     JustWarning,
 58                     ed);                           57                     ed);
 59     }                                              58     }
 60                                                    59     
 61     fProcessToDensity["channeling"] = fDensity     60     fProcessToDensity["channeling"] = fDensityRatioNone;
 62 }                                                  61 }
 63                                                    62 
 64 //....oooOO0OOooo........oooOO0OOooo........oo     63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 65                                                    64 
 66 G4ChannelingOptrChangeCrossSection::~G4Channel     65 G4ChannelingOptrChangeCrossSection::~G4ChannelingOptrChangeCrossSection(){
 67     for ( std::map< const G4BiasingProcessInte     66     for ( std::map< const G4BiasingProcessInterface*, G4BOptnChangeCrossSection* >::iterator
 68          it = fChangeCrossSectionOperations.be     67          it = fChangeCrossSectionOperations.begin() ;
 69          it != fChangeCrossSectionOperations.e     68          it != fChangeCrossSectionOperations.end() ;
 70          it++ ) delete (*it).second;               69          it++ ) delete (*it).second;
 71 }                                                  70 }
 72                                                    71 
 73 //....oooOO0OOooo........oooOO0OOooo........oo     72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 74                                                    73 
 75 void G4ChannelingOptrChangeCrossSection::Start     74 void G4ChannelingOptrChangeCrossSection::StartRun(){
 76     if ( fSetup ){                                 75     if ( fSetup ){
 77         const G4ProcessManager* processManager     76         const G4ProcessManager* processManager = fParticleToBias->GetProcessManager();
 78         const G4BiasingProcessSharedData* shar     77         const G4BiasingProcessSharedData* sharedData =
 79         G4BiasingProcessInterface::GetSharedDa     78         G4BiasingProcessInterface::GetSharedData( processManager );
 80         if ( sharedData ){                         79         if ( sharedData ){
 81             for ( size_t i = 0 ; i < (sharedDa     80             for ( size_t i = 0 ; i < (sharedData->GetPhysicsBiasingProcessInterfaces()).size(); i++ ){
 82                 const G4BiasingProcessInterfac     81                 const G4BiasingProcessInterface* wrapperProcess =
 83                 (sharedData->GetPhysicsBiasing     82                 (sharedData->GetPhysicsBiasingProcessInterfaces())[i];
 84                 const G4String& processName =  <<  83                 G4String processName = wrapperProcess->GetWrappedProcess()->GetProcessName();
 85                 const G4String& operationName  <<  84                 G4String operationName = "channelingChangeXS-" + processName;
 86                 fChangeCrossSectionOperations[     85                 fChangeCrossSectionOperations[wrapperProcess] =
 87       new G4BOptnChangeCrossSection(operationN <<  86                 new G4BOptnChangeCrossSection(operationName);
 88                                                    87                 
 89                 G4ProcessType type = wrapperPr     88                 G4ProcessType type = wrapperProcess->GetWrappedProcess()->GetProcessType();
 90                 G4int subType = wrapperProcess     89                 G4int subType = wrapperProcess->GetWrappedProcess()->GetProcessSubType();
 91                                                    90 
 92                 switch (type) {                    91                 switch (type) {
 93                     case fNotDefined:              92                     case fNotDefined:
 94                         fProcessToDensity[proc     93                         fProcessToDensity[processName] = fDensityRatioNotDefined;
 95                         break;                     94                         break;
 96                     case fTransportation:          95                     case fTransportation:
 97                         fProcessToDensity[proc     96                         fProcessToDensity[processName] = fDensityRatioNone;
 98                         break;                     97                         break;
 99                     case fElectromagnetic:         98                     case fElectromagnetic:
100                         if(subType == fCoulomb     99                         if(subType == fCoulombScattering ||
101                            subType == fMultipl    100                            subType == fMultipleScattering){
102                             fProcessToDensity[    101                             fProcessToDensity[processName] = fDensityRatioNuD;
103                         }                         102                         }
104                         if(subType == fIonisat    103                         if(subType == fIonisation ||
105                            subType == fPairPro    104                            subType == fPairProdByCharged ||
106                            subType == fAnnihil    105                            subType == fAnnihilation ||
107                            subType == fAnnihil    106                            subType == fAnnihilationToMuMu ||
108                            subType == fAnnihil    107                            subType == fAnnihilationToHadrons){
109                             fProcessToDensity[    108                             fProcessToDensity[processName] = fDensityRatioElD;
110                         }                         109                         }
111                         if(subType == fBremsst    110                         if(subType == fBremsstrahlung ||
112                            subType == fNuclear    111                            subType == fNuclearStopping){
113                             fProcessToDensity[    112                             fProcessToDensity[processName] = fDensityRatioNuDElD;
114                         }                         113                         }
115                                                   114                         
116                         if(subType == fCerenko    115                         if(subType == fCerenkov ||
117                            subType == fScintil    116                            subType == fScintillation ||
118                            subType == fSynchro    117                            subType == fSynchrotronRadiation ||
119                            subType == fTransit    118                            subType == fTransitionRadiation){
120                             fProcessToDensity[    119                             fProcessToDensity[processName] = fDensityRatioNone;
121                         }                         120                         }
122                         if(subType == fRayleig    121                         if(subType == fRayleigh ||
123                            subType == fPhotoEl    122                            subType == fPhotoElectricEffect ||
124                            subType == fCompton    123                            subType == fComptonScattering ||
125                            subType == fGammaCo    124                            subType == fGammaConversion ||
126                            subType == fGammaCo    125                            subType == fGammaConversionToMuMu){
127                             fProcessToDensity[    126                             fProcessToDensity[processName] = fDensityRatioNone;
128                         }                         127                         }
129                         break;                    128                         break;
130                     case fOptical:                129                     case fOptical:
131                         fProcessToDensity[proc    130                         fProcessToDensity[processName] = fDensityRatioNone;
132                         break;                    131                         break;
133                     case fHadronic:               132                     case fHadronic:
134                         fProcessToDensity[proc    133                         fProcessToDensity[processName] = fDensityRatioNuD;
135                         break;                    134                         break;
136                     case fPhotolepton_hadron:     135                     case fPhotolepton_hadron:
137                         fProcessToDensity[proc    136                         fProcessToDensity[processName] = fDensityRatioNuD;
138                         break;                    137                         break;
139                     case fGeneral:                138                     case fGeneral:
140                         fProcessToDensity[proc    139                         fProcessToDensity[processName] = fDensityRatioNone;
141                         break;                    140                         break;
142                     case fDecay:                  141                     case fDecay:
143                         fProcessToDensity[proc    142                         fProcessToDensity[processName] = fDensityRatioNone;
144                         break;                    143                         break;
145                     case fParameterisation:       144                     case fParameterisation:
146                         fProcessToDensity[proc    145                         fProcessToDensity[processName] = fDensityRatioNone;
147                         break;                    146                         break;
148                     case fUserDefined:            147                     case fUserDefined:
149                         fProcessToDensity[proc    148                         fProcessToDensity[processName] = fDensityRatioNone;
150                         break;                    149                         break;
151                     case fParallel:               150                     case fParallel:
152                         fProcessToDensity[proc    151                         fProcessToDensity[processName] = fDensityRatioNone;
153                         break;                    152                         break;
154                     case fPhonon:                 153                     case fPhonon:
155                         fProcessToDensity[proc    154                         fProcessToDensity[processName] = fDensityRatioNone;
156                         break;                    155                         break;
157                     case fUCN:                    156                     case fUCN:
158                         fProcessToDensity[proc    157                         fProcessToDensity[processName] = fDensityRatioNone;
159                         break;                    158                         break;
160                     default:                      159                     default:
161                         fProcessToDensity[proc    160                         fProcessToDensity[processName] = fDensityRatioNone;
162                         break;                    161                         break;
163                 }                                 162                 }
164             }                                     163             }
165         }                                         164         }
166         fSetup = false;                           165         fSetup = false;
167     }                                             166     }
168 }                                                 167 }
169                                                   168 
170 //....oooOO0OOooo........oooOO0OOooo........oo    169 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
171                                                   170 
172 G4VBiasingOperation*                              171 G4VBiasingOperation*
173 G4ChannelingOptrChangeCrossSection::ProposeOcc    172 G4ChannelingOptrChangeCrossSection::ProposeOccurenceBiasingOperation(const G4Track*            track,
174                                                   173                                                                      const G4BiasingProcessInterface*
175                                                   174                                                                      callingProcess)
176 {                                                 175 {
177     if ( track->GetDefinition() != fParticleTo    176     if ( track->GetDefinition() != fParticleToBias ) return 0;
178                                                   177     
179     G4double analogInteractionLength =            178     G4double analogInteractionLength =
180     callingProcess->GetWrappedProcess()->GetCu    179     callingProcess->GetWrappedProcess()->GetCurrentInteractionLength();
181     if ( analogInteractionLength > DBL_MAX/10.    180     if ( analogInteractionLength > DBL_MAX/10. ) return 0;
182                                                   181     
183     G4double analogXS = 1./analogInteractionLe    182     G4double analogXS = 1./analogInteractionLength;
184                                                   183     
                                                   >> 184     if(fChannelingID==-1){
                                                   >> 185         fChannelingID = G4PhysicsModelCatalog::GetIndex("channeling");
                                                   >> 186     }
185     G4ChannelingTrackData* trackdata =            187     G4ChannelingTrackData* trackdata =
186     (G4ChannelingTrackData*)(track->GetAuxilia    188     (G4ChannelingTrackData*)(track->GetAuxiliaryTrackInformation(fChannelingID));
187     if(trackdata==nullptr) return 0;              189     if(trackdata==nullptr) return 0;
188                                                   190     
189     G4double XStransformation = 1.;               191     G4double XStransformation = 1.;
190     auto search = fProcessToDensity.find(calli    192     auto search = fProcessToDensity.find(callingProcess->GetWrappedProcess()->GetProcessName());
191     if(search != fProcessToDensity.end()) {       193     if(search != fProcessToDensity.end()) {
192         switch (search->second) {                 194         switch (search->second) {
193             case fDensityRatioNuDElD:             195             case fDensityRatioNuDElD:
194                 XStransformation = trackdata->    196                 XStransformation = trackdata->GetDensity();
195                 break;                            197                 break;
196             case fDensityRatioNuD:                198             case fDensityRatioNuD:
197                 XStransformation = trackdata->    199                 XStransformation = trackdata->GetNuD();
198                 break;                            200                 break;
199             case fDensityRatioElD:                201             case fDensityRatioElD:
200                 XStransformation = trackdata->    202                 XStransformation = trackdata->GetElD();
201                 break;                            203                 break;
202             case fDensityRatioNone:               204             case fDensityRatioNone:
203                 return 0;                         205                 return 0;
204                 break;                            206                 break;
205             case fDensityRatioNotDefined:         207             case fDensityRatioNotDefined:
206                 return 0;                         208                 return 0;
207                 break;                            209                 break;
208             default:                              210             default:
209                 return 0;                         211                 return 0;
210                 break;                            212                 break;
211         }                                         213         }
212     }                                             214     }
213     else{                                         215     else{
214         XStransformation = trackdata->GetDensi    216         XStransformation = trackdata->GetDensity();
215     }                                             217     }
216                                                   218 
217     G4BOptnChangeCrossSection*   operation = f    219     G4BOptnChangeCrossSection*   operation = fChangeCrossSectionOperations[callingProcess];
218     G4VBiasingOperation* previousOperation = c    220     G4VBiasingOperation* previousOperation = callingProcess->GetPreviousOccurenceBiasingOperation();
219                                                   221     
220     if ( previousOperation == 0 ){                222     if ( previousOperation == 0 ){
221         operation->SetBiasedCrossSection( XStr    223         operation->SetBiasedCrossSection( XStransformation * analogXS );
222         operation->Sample();                      224         operation->Sample();
223     }                                             225     }
224     else{                                         226     else{
225         if (  previousOperation != operation )    227         if (  previousOperation != operation ){
226             G4ExceptionDescription ed;            228             G4ExceptionDescription ed;
227             ed << " Logic problem in operation    229             ed << " Logic problem in operation handling !" << G4endl;
228             G4Exception("G4ChannelingOptrChang    230             G4Exception("G4ChannelingOptrChangeCrossSection::ProposeOccurenceBiasingOperation(...)",
229                         "G4Channeling",           231                         "G4Channeling",
230                         JustWarning,              232                         JustWarning,
231                         ed);                      233                         ed);
232             return 0;                             234             return 0;
233         }                                         235         }
234         if ( operation->GetInteractionOccured(    236         if ( operation->GetInteractionOccured() ){
235             operation->SetBiasedCrossSection(     237             operation->SetBiasedCrossSection( XStransformation * analogXS );
236             operation->Sample();                  238             operation->Sample();
237         }                                         239         }
238         else{                                     240         else{
239             operation->UpdateForStep( callingP    241             operation->UpdateForStep( callingProcess->GetPreviousStepSize() );
240             operation->SetBiasedCrossSection(     242             operation->SetBiasedCrossSection( XStransformation * analogXS );
241             operation->UpdateForStep( 0.0 );      243             operation->UpdateForStep( 0.0 );
242         }                                         244         }
243     }                                             245     }
244                                                   246     
245     return operation;                             247     return operation;
246                                                   248     
247 }                                                 249 }
248                                                   250 
249 //....oooOO0OOooo........oooOO0OOooo........oo    251 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
250                                                   252 
251 void G4ChannelingOptrChangeCrossSection::         253 void G4ChannelingOptrChangeCrossSection::
252 OperationApplied(const G4BiasingProcessInterfa    254 OperationApplied(const G4BiasingProcessInterface*           callingProcess,
253                  G4BiasingAppliedCase,            255                  G4BiasingAppliedCase,
254                  G4VBiasingOperation*             256                  G4VBiasingOperation*             occurenceOperationApplied,
255                  G4double,                        257                  G4double,
256                  G4VBiasingOperation*,            258                  G4VBiasingOperation*,
257                  const G4VParticleChange*         259                  const G4VParticleChange*                                  )
258 {                                                 260 {
259     G4BOptnChangeCrossSection* operation = fCh    261     G4BOptnChangeCrossSection* operation = fChangeCrossSectionOperations[callingProcess];
260     if ( operation ==  occurenceOperationAppli    262     if ( operation ==  occurenceOperationApplied ) operation->SetInteractionOccured();
261 }                                                 263 }
262                                                   264 
263 //....oooOO0OOooo........oooOO0OOooo........oo    265 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
264                                                   266