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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 /examples/extended/biasing/GB01/src/GB01BOptrChangeCrossSection.cc (Version 11.3.0) and /examples/extended/biasing/GB01/src/GB01BOptrChangeCrossSection.cc (Version 9.4.p3)


  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 /// \file GB01/src/GB01BOptrChangeCrossSection    
 27 /// \brief Implementation of the GB01BOptrChan    
 28 //                                                
 29 #include "GB01BOptrChangeCrossSection.hh"         
 30                                                   
 31 #include "G4BOptnChangeCrossSection.hh"           
 32 #include "G4BiasingProcessInterface.hh"           
 33 #include "G4InteractionLawPhysical.hh"            
 34 #include "G4ParticleDefinition.hh"                
 35 #include "G4ParticleTable.hh"                     
 36 #include "G4VProcess.hh"                          
 37 #include "Randomize.hh"                           
 38                                                   
 39 //....oooOO0OOooo........oooOO0OOooo........oo    
 40                                                   
 41 GB01BOptrChangeCrossSection::GB01BOptrChangeCr    
 42   : G4VBiasingOperator(name), fSetup(true)        
 43 {                                                 
 44   fParticleToBias = G4ParticleTable::GetPartic    
 45                                                   
 46   if (fParticleToBias == 0) {                     
 47     G4ExceptionDescription ed;                    
 48     ed << "Particle `" << particleName << "' n    
 49     G4Exception("GB01BOptrChangeCrossSection(.    
 50   }                                               
 51 }                                                 
 52                                                   
 53 //....oooOO0OOooo........oooOO0OOooo........oo    
 54                                                   
 55 GB01BOptrChangeCrossSection::~GB01BOptrChangeC    
 56 {                                                 
 57   for (std::map<const G4BiasingProcessInterfac    
 58          fChangeCrossSectionOperations.begin()    
 59        it != fChangeCrossSectionOperations.end    
 60     delete (*it).second;                          
 61 }                                                 
 62                                                   
 63 //....oooOO0OOooo........oooOO0OOooo........oo    
 64                                                   
 65 void GB01BOptrChangeCrossSection::StartRun()      
 66 {                                                 
 67   // --------------                               
 68   // -- Setup stage:                              
 69   // ---------------                              
 70   // -- Start by collecting processes under bi    
 71   // -- operations and associate these operati    
 72   if (fSetup) {                                   
 73     const G4ProcessManager* processManager = f    
 74     const G4BiasingProcessSharedData* sharedDa    
 75       G4BiasingProcessInterface::GetSharedData    
 76     if (sharedData)  // -- sharedData tested,     
 77                      // -- volume but without     
 78     {                                             
 79       for (size_t i = 0; i < (sharedData->GetP    
 80         const G4BiasingProcessInterface* wrapp    
 81           (sharedData->GetPhysicsBiasingProces    
 82         G4String operationName =                  
 83           "XSchange-" + wrapperProcess->GetWra    
 84         fChangeCrossSectionOperations[wrapperP    
 85           new G4BOptnChangeCrossSection(operat    
 86       }                                           
 87     }                                             
 88     fSetup = false;                               
 89   }                                               
 90 }                                                 
 91                                                   
 92 //....oooOO0OOooo........oooOO0OOooo........oo    
 93                                                   
 94 G4VBiasingOperation* GB01BOptrChangeCrossSecti    
 95   const G4Track* track, const G4BiasingProcess    
 96 {                                                 
 97   // -----------------------------------------    
 98   // -- Check if current particle type is the     
 99   // -----------------------------------------    
100   if (track->GetDefinition() != fParticleToBia    
101                                                   
102   // -----------------------------------------    
103   // -- select and setup the biasing operation    
104   // -----------------------------------------    
105   // -- Check if the analog cross-section well    
106   // -- process for a gamma below e+e- creatio    
107   // -- length. Nothing is done in this case (    
108   G4double analogInteractionLength =              
109     callingProcess->GetWrappedProcess()->GetCu    
110   if (analogInteractionLength > DBL_MAX / 10.)    
111                                                   
112   // -- Analog cross-section is well-defined:     
113   G4double analogXS = 1. / analogInteractionLe    
114                                                   
115   // -- Choose a constant cross-section bias.     
116   // -- direction dependent, like in the expon    
117   // -- can be chosen differently, depending o    
118   G4double XStransformation = 2.0;                
119                                                   
120   // -- fetch the operation associated to this    
121   G4BOptnChangeCrossSection* operation = fChan    
122   // -- get the operation that was proposed to    
123   G4VBiasingOperation* previousOperation = cal    
124                                                   
125   // -- now setup the operation to be returned    
126   // -- consists in setting the biased cross-s    
127   // -- the operation to sample its exponentia    
128   // -- To do this, to first order, the two li    
129   //        operation->SetBiasedCrossSection(     
130   //        operation->Sample();                  
131   // -- are correct and sufficient.               
132   // -- But, to avoid having to shoot a random    
133   // -- only on the first time the operation i    
134   // -- occured. If the interaction did not oc    
135   // -- we update the number of interaction le    
136   if (previousOperation == 0) {                   
137     operation->SetBiasedCrossSection(XStransfo    
138     operation->Sample();                          
139   }                                               
140   else {                                          
141     if (previousOperation != operation) {         
142       // -- should not happen !                   
143       G4ExceptionDescription ed;                  
144       ed << " Logic problem in operation handl    
145       G4Exception("GB01BOptrChangeCrossSection    
146                   JustWarning, ed);               
147       return 0;                                   
148     }                                             
149     if (operation->GetInteractionOccured()) {     
150       operation->SetBiasedCrossSection(XStrans    
151       operation->Sample();                        
152     }                                             
153     else {                                        
154       // -- update the 'interaction length' an    
155       // -- for past step  (this takes into ac    
156       operation->UpdateForStep(callingProcess-    
157       // -- update the cross-section value:       
158       operation->SetBiasedCrossSection(XStrans    
159       // -- forces recomputation of the 'inter    
160       // -- new cross-section value [tricky :     
161       operation->UpdateForStep(0.0);              
162     }                                             
163   }                                               
164                                                   
165   return operation;                               
166 }                                                 
167                                                   
168 //....oooOO0OOooo........oooOO0OOooo........oo    
169                                                   
170 void GB01BOptrChangeCrossSection::OperationApp    
171                                                   
172                                                   
173                                                   
174                                                   
175 {                                                 
176   G4BOptnChangeCrossSection* operation = fChan    
177   if (operation == occurenceOperationApplied)     
178 }                                                 
179                                                   
180 //....oooOO0OOooo........oooOO0OOooo........oo    
181