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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/biasing/importance/src/G4GeometrySampler.cc (Version 11.3.0) and /processes/biasing/importance/src/G4GeometrySampler.cc (Version 6.0.p1)


  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 // G4GeometrySampler                              
 27 // -------------------------------------------    
 28                                                   
 29 #include "G4GeometrySampler.hh"                   
 30                                                   
 31 #include "G4VIStore.hh"                           
 32 #include "G4WeightWindowStore.hh"                 
 33                                                   
 34 #include "G4VPhysicalVolume.hh"                   
 35 #include "G4ImportanceConfigurator.hh"            
 36 #include "G4WeightWindowConfigurator.hh"          
 37 #include "G4WeightCutOffConfigurator.hh"          
 38 #include "G4TransportationManager.hh"             
 39                                                   
 40  G4GeometrySampler::                              
 41  G4GeometrySampler(G4VPhysicalVolume *world, c    
 42   : fParticleName(particlename),                  
 43     fWorld(world)                                 
 44 {                                                 
 45 }                                                 
 46                                                   
 47  G4GeometrySampler::                              
 48  G4GeometrySampler(const G4String& worldName,     
 49   : fParticleName(particlename),                  
 50     fWorldName(worldName)                         
 51 {                                                 
 52   fWorld = G4TransportationManager::GetTranspo    
 53 }                                                 
 54                                                   
 55 G4GeometrySampler::~G4GeometrySampler()           
 56 {                                                 
 57   // ClearSampling();                             
 58 }                                                 
 59                                                   
 60 void G4GeometrySampler::ClearSampling()           
 61 {                                                 
 62   delete fImportanceConfigurator; fImportanceC    
 63   delete fWeightWindowConfigurator; fWeightWin    
 64   delete fWeightCutOffConfigurator; fWeightCut    
 65   fIStore = nullptr;                              
 66   fConfigurators.clear();                         
 67   fIsConfigured = false;                          
 68 }                                                 
 69                                                   
 70 G4bool G4GeometrySampler::IsConfigured() const    
 71 {                                                 
 72   G4bool isconf = false;                          
 73   if (fIsConfigured)                              
 74   {                                               
 75    G4cout << "WARNING - G4GeometrySampler::IsC    
 76           << "          Some initialization ex    
 77           << "          before a new initializ    
 78    isconf = true;                                 
 79   }                                               
 80   return isconf;                                  
 81 }                                                 
 82                                                   
 83 // void G4GeometrySampler::PrepareScoring(G4VS    
 84 // {                                              
 85 //   G4cout << " preparing scoring configurato    
 86 //   G4cout << G4endl;                            
 87 //   G4cout << G4endl;                            
 88 //   G4cout << G4endl;                            
 89 //   G4cout << " new fWorld Name: " << fWorld-    
 90 //   G4cout << G4endl;                            
 91 //   G4cout << G4endl;                            
 92 //   G4cout << G4endl;                            
 93 //   fScoreConfigurator = new G4ScoreConfigura    
 94 //   G4cout << " configured scoring " << G4end    
 95 //   if (!fScoreConfigurator)                     
 96 //   {                                            
 97 //     G4Exception("G4GeometrySampler::Prepare    
 98 //                 "FatalError", FatalExceptio    
 99 //                 "Failed allocation of G4Sco    
100 //   }                                            
101 // }                                              
102                                                   
103 void                                              
104 G4GeometrySampler::PrepareImportanceSampling(G    
105                                            con    
106 {                                                 
107   G4cout << "G4GeometrySampler:: preparing imp    
108   fIStore = istore;                               
109   //  G4cout << "G4GeometrySampler:: creating     
110                                                   
111   fImportanceConfigurator =                       
112     new G4ImportanceConfigurator(&istore->GetW    
113   //    new G4ImportanceConfigurator(fWorld, f    
114   fImportanceConfigurator->SetWorldName(fWorld    
115                                                   
116   if (!fImportanceConfigurator)                   
117   {                                               
118     G4Exception("G4GeometrySampler::PrepareImp    
119                 "FatalError", FatalException,     
120                 "Failed allocation of G4Import    
121   }                                               
122 }                                                 
123                                                   
124 void                                              
125 G4GeometrySampler::PrepareWeightRoulett(G4doub    
126                                         G4doub    
127                                         G4doub    
128 {                                                 
129   //  fGCellFinder = new G4GCellFinder(fWorld)    
130   G4cout << "G4GeometrySampler:: preparing wei    
131   //  fGCellFinder = new G4GCellFinder();         
132 //   if (!fGCellFinder)                           
133 //   {                                            
134 //     G4Exception("G4GeometrySampler::Prepare    
135 //                 "FatalError", FatalExceptio    
136 //                 "Failed allocation of G4GCe    
137 //   }                                            
138                                                   
139   fWeightCutOffConfigurator =                     
140     new G4WeightCutOffConfigurator(fWorld, fPa    
141                                    wsurvive,      
142                                    wlimit,        
143                                    isource,       
144                                    fIStore,       
145            paraflag);                             
146            //*fGCellFinder, paraflag);            
147   if (!fWeightCutOffConfigurator)                 
148   {                                               
149     G4Exception("G4GeometrySampler::PrepareWei    
150                 "FatalError", FatalException,     
151                 "Failed allocation of G4Weight    
152   }                                               
153 }                                                 
154                                                   
155 void                                              
156 G4GeometrySampler::PrepareWeightWindow(G4VWeig    
157                                        G4VWeig    
158                                        G4Place    
159 {                                                 
160                                                   
161   G4cout << "G4GeometrySampler:: preparing wei    
162                                                   
163   fWWStore = wwstore;                             
164                                                   
165   fWeightWindowConfigurator =                     
166     new G4WeightWindowConfigurator(&wwstore->G    
167                                     *fWWStore,    
168                                     wwAlg,        
169                                     placeOfAct    
170 }                                                 
171                                                   
172 void G4GeometrySampler::Configure()               
173 {                                                 
174   if (!IsConfigured())                            
175   {                                               
176     fIsConfigured = true;                         
177                                                   
178     if (fImportanceConfigurator)                  
179     {                                             
180       fConfigurators.push_back(fImportanceConf    
181     }                                             
182     if (fWeightWindowConfigurator)                
183     {                                             
184       fConfigurators.push_back(fWeightWindowCo    
185     }                                             
186   }                                               
187                                                   
188 #ifdef G4MULTITHREADED                            
189   G4cout << " make sure AddProcess() is invoke    
190 #else                                             
191   AddProcess();                                   
192 #endif                                            
193                                                   
194   return;                                         
195 }                                                 
196                                                   
197 void G4GeometrySampler::AddProcess()              
198 {                                                 
199                                                   
200   G4VSamplerConfigurator *preConf = nullptr;      
201   for (auto it = fConfigurators.cbegin();         
202        it != fConfigurators.cend(); ++it)         
203     {                                             
204       G4VSamplerConfigurator *currConf =*it;      
205       currConf->Configure(preConf);               
206       preConf = *it;                              
207     }                                             
208   if (fWeightCutOffConfigurator != nullptr)       
209     {                                             
210       fWeightCutOffConfigurator->Configure(nul    
211     }                                             
212                                                   
213   return;                                         
214 }                                                 
215                                                   
216 void G4GeometrySampler::SetParallel(G4bool par    
217 {                                                 
218   paraflag = para;                                
219 }                                                 
220                                                   
221 void G4GeometrySampler::SetWorld(const G4VPhys    
222 {                                                 
223   fWorld = World;                                 
224 }                                                 
225                                                   
226 void G4GeometrySampler::SetParticle(const G4St    
227 {                                                 
228   fParticleName = particlename;                   
229 }                                                 
230