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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/management/src/G4VBiasingOperator.cc (Version 11.3.0) and /processes/biasing/management/src/G4VBiasingOperator.cc (Version 8.3.p2)


  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 // G4VBiasingOperator                             
 27 // -------------------------------------------    
 28                                                   
 29 #include "G4VBiasingOperator.hh"                  
 30 #include "G4VBiasingOperation.hh"                 
 31 #include "G4VParticleChange.hh"                   
 32                                                   
 33 G4MapCache< const G4LogicalVolume*, G4VBiasing    
 34 G4VectorCache< G4VBiasingOperator* > G4VBiasin    
 35 G4Cache< G4BiasingOperatorStateNotifier* > G4V    
 36                                                   
 37 G4VBiasingOperator::G4VBiasingOperator(const G    
 38   : fName( name )                                 
 39 {                                                 
 40   fOperators.Push_back(this);                     
 41                                                   
 42   if ( fStateNotifier.Get() == nullptr )          
 43     fStateNotifier.Put( new G4BiasingOperatorS    
 44 }                                                 
 45                                                   
 46 void G4VBiasingOperator::AttachTo(const G4Logi    
 47 {                                                 
 48   auto it = fLogicalToSetupMap.Find(logical);     
 49   if ( it == fLogicalToSetupMap.End() )           
 50   {                                               
 51     fLogicalToSetupMap[logical] = this;           
 52   }                                               
 53   else if ( (*it).second != this )                
 54   {                                               
 55     G4ExceptionDescription ed;                    
 56     ed << "Biasing operator `" << GetName()       
 57        << "' can not be attached to Logical vo    
 58        << logical->GetName() << "' which is al    
 59        << G4endl;                                 
 60     G4Exception("G4VBiasingOperator::AttachTo(    
 61                 "BIAS.MNG.01", JustWarning, ed    
 62   }                                               
 63 }                                                 
 64                                                   
 65 const std::vector < G4VBiasingOperator* >&        
 66 G4VBiasingOperator::GetBiasingOperators()         
 67 {                                                 
 68   return fOperators.Get();                        
 69 }                                                 
 70                                                   
 71 G4VBiasingOperator* G4VBiasingOperator::GetBia    
 72 {                                                 
 73   auto it = fLogicalToSetupMap.Find(logical);     
 74   if ( it == fLogicalToSetupMap.End() ) { retu    
 75   else  { return (*it).second; }                  
 76 }                                                 
 77                                                   
 78 G4VBiasingOperation* G4VBiasingOperator::GetPr    
 79 {                                                 
 80   fOccurenceBiasingOperation = ProposeOccurenc    
 81   return fOccurenceBiasingOperation;              
 82 }                                                 
 83                                                   
 84 G4VBiasingOperation* G4VBiasingOperator::GetPr    
 85 {                                                 
 86   fFinalStateBiasingOperation = ProposeFinalSt    
 87   return fFinalStateBiasingOperation;             
 88 }                                                 
 89                                                   
 90 G4VBiasingOperation* G4VBiasingOperator::GetPr    
 91 {                                                 
 92   fNonPhysicsBiasingOperation = ProposeNonPhys    
 93   return fNonPhysicsBiasingOperation;             
 94 }                                                 
 95                                                   
 96 void G4VBiasingOperator::                         
 97 ReportOperationApplied( const G4BiasingProcess    
 98                               G4BiasingApplied    
 99                               G4VBiasingOperat    
100                         const G4VParticleChang    
101 {                                                 
102   fPreviousBiasingAppliedCase = biasingCase;      
103   fPreviousAppliedOccurenceBiasingOperation  =    
104   fPreviousAppliedFinalStateBiasingOperation =    
105   fPreviousAppliedNonPhysicsBiasingOperation =    
106   switch ( biasingCase )                          
107   {                                               
108     case BAC_None:                                
109       break;                                      
110     case BAC_NonPhysics:                          
111       fPreviousAppliedNonPhysicsBiasingOperati    
112       break;                                      
113     case BAC_FinalState:                          
114       fPreviousAppliedFinalStateBiasingOperati    
115       break;                                      
116     case BAC_Occurence:                           
117       G4Exception("G4VBiasingOperator::ReportO    
118                   "BIAS.MNG.02", JustWarning,     
119                   "Internal logic error, pleas    
120       break;                                      
121     default:                                      
122       G4Exception("G4VBiasingOperator::ReportO    
123                   "BIAS.MNG.03", JustWarning,     
124                   "Internal logic error, pleas    
125   }                                               
126   OperationApplied( callingProcess, biasingCas    
127 }                                                 
128                                                   
129 void G4VBiasingOperator::                         
130 ReportOperationApplied( const G4BiasingProcess    
131                               G4BiasingApplied    
132                               G4VBiasingOperat    
133                               G4double weightF    
134                               G4VBiasingOperat    
135                         const G4VParticleChang    
136 {                                                 
137   fPreviousBiasingAppliedCase = biasingCase;      
138   fPreviousAppliedOccurenceBiasingOperation =     
139   fPreviousAppliedFinalStateBiasingOperation =    
140   OperationApplied( callingProcess, biasingCas    
141 }                                                 
142                                                   
143 void G4VBiasingOperator::                         
144 ExitingBiasing( const G4Track* track, const G4    
145 {                                                 
146   ExitBiasing( track, callingProcess );           
147                                                   
148   // -- reset all data members:                   
149   fOccurenceBiasingOperation                      
150   fFinalStateBiasingOperation                     
151   fNonPhysicsBiasingOperation                     
152   fPreviousProposedOccurenceBiasingOperation      
153   fPreviousProposedFinalStateBiasingOperation     
154   fPreviousProposedNonPhysicsBiasingOperation     
155   fPreviousAppliedOccurenceBiasingOperation       
156   fPreviousAppliedFinalStateBiasingOperation      
157   fPreviousAppliedNonPhysicsBiasingOperation      
158   fPreviousBiasingAppliedCase                     
159 }                                                 
160                                                   
161 // -- dummy empty implementations to allow let    
162 // -- but avoiding annoying warning messages a    
163 // -- methods to inform operator that its bias    
164 void G4VBiasingOperator::                         
165 ExitBiasing( const G4Track*, const G4BiasingPr    
166 {}                                                
167 void G4VBiasingOperator::                         
168 OperationApplied( const G4BiasingProcessInterf    
169                   G4VBiasingOperation*, const     
170 {                                                 
171 }                                                 
172 void G4VBiasingOperator::                         
173 OperationApplied( const G4BiasingProcessInterf    
174                   G4VBiasingOperation*, G4doub    
175                   G4VBiasingOperation*, const     
176 {                                                 
177 }                                                 
178                                                   
179 // -------------------------------------------    
180 // -- state machine to get biasing operators m    
181 // -------------------------------------------    
182                                                   
183 G4BiasingOperatorStateNotifier::G4BiasingOpera    
184 : G4VStateDependent()                             
185 {                                                 
186   fPreviousState =  G4State_PreInit;              
187 }                                                 
188                                                   
189 G4bool G4BiasingOperatorStateNotifier::           
190 Notify( G4ApplicationState requestedState )       
191 {                                                 
192   if ( ( fPreviousState == G4State_Idle )         
193     && ( requestedState == G4State_GeomClosed     
194   {                                               
195     for ( auto i = 0; i < (G4int)G4VBiasingOpe    
196     {                                             
197       G4VBiasingOperator::fOperators[i]->Start    
198     }                                             
199   }                                               
200   fPreviousState = requestedState;                
201                                                   
202   return true;                                    
203 }                                                 
204