Geant4 Cross Reference |
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 // 26 // 27 // ------------------------------------------- 27 // ------------------------------------------------------------ 28 // GEANT 4 class implementation file << 28 // GEANT 4 class implementation file 29 // ------------------------------------------- 29 // ------------------------------------------------------------ 30 // 30 // 31 31 32 #include "G4ErrorPropagatorManager.hh" 32 #include "G4ErrorPropagatorManager.hh" 33 33 34 #include "G4SystemOfUnits.hh" 34 #include "G4SystemOfUnits.hh" 35 #include "G4MagIntegratorStepper.hh" 35 #include "G4MagIntegratorStepper.hh" 36 #include "G4Mag_UsualEqRhs.hh" 36 #include "G4Mag_UsualEqRhs.hh" 37 #include "G4Mag_EqRhs.hh" 37 #include "G4Mag_EqRhs.hh" 38 #include "G4MagIntegratorDriver.hh" 38 #include "G4MagIntegratorDriver.hh" 39 39 40 #include "G4ClassicalRK4.hh" 40 #include "G4ClassicalRK4.hh" 41 #include "G4ExactHelixStepper.hh" 41 #include "G4ExactHelixStepper.hh" 42 #include "G4HelixExplicitEuler.hh" 42 #include "G4HelixExplicitEuler.hh" 43 43 44 #include "G4EventManager.hh" 44 #include "G4EventManager.hh" 45 #include "G4ErrorRunManagerHelper.hh" 45 #include "G4ErrorRunManagerHelper.hh" 46 #include "G4ErrorPropagator.hh" 46 #include "G4ErrorPropagator.hh" 47 #include "G4ErrorMag_UsualEqRhs.hh" 47 #include "G4ErrorMag_UsualEqRhs.hh" 48 48 49 #include "G4VParticleChange.hh" 49 #include "G4VParticleChange.hh" 50 #include "G4ParticleChangeForMSC.hh" 50 #include "G4ParticleChangeForMSC.hh" 51 #include "G4ParticleChange.hh" 51 #include "G4ParticleChange.hh" 52 #include "G4Track.hh" 52 #include "G4Track.hh" 53 #include "G4TransportationManager.hh" 53 #include "G4TransportationManager.hh" 54 #include "G4ErrorPropagationNavigator.hh" 54 #include "G4ErrorPropagationNavigator.hh" 55 #include "G4GeometryManager.hh" 55 #include "G4GeometryManager.hh" 56 #include "G4StateManager.hh" 56 #include "G4StateManager.hh" 57 #include "G4ChordFinder.hh" 57 #include "G4ChordFinder.hh" 58 #include "G4EquationOfMotion.hh" 58 #include "G4EquationOfMotion.hh" 59 #include "G4FieldManager.hh" 59 #include "G4FieldManager.hh" 60 #include "G4PropagatorInField.hh" 60 #include "G4PropagatorInField.hh" 61 #include "G4RunManager.hh" 61 #include "G4RunManager.hh" 62 #include "G4VParticleChange.hh" 62 #include "G4VParticleChange.hh" 63 63 64 G4ThreadLocal G4ErrorPropagatorManager* 64 G4ThreadLocal G4ErrorPropagatorManager* 65 G4ErrorPropagatorManager::theG4ErrorPropagat << 65 G4ErrorPropagatorManager::theG4ErrorPropagatorManager = 0; 66 66 67 //-------------------------------------------- 67 //----------------------------------------------------------------------- 68 G4ErrorPropagatorManager* G4ErrorPropagatorMan 68 G4ErrorPropagatorManager* G4ErrorPropagatorManager::GetErrorPropagatorManager() 69 { 69 { 70 if(theG4ErrorPropagatorManager == NULL) << 70 if( theG4ErrorPropagatorManager == NULL ) { 71 { << 72 theG4ErrorPropagatorManager = new G4ErrorP 71 theG4ErrorPropagatorManager = new G4ErrorPropagatorManager; 73 } 72 } 74 73 75 return theG4ErrorPropagatorManager; 74 return theG4ErrorPropagatorManager; 76 } 75 } 77 76 >> 77 78 //-------------------------------------------- 78 //----------------------------------------------------------------------- 79 G4ErrorPropagatorManager::G4ErrorPropagatorMan 79 G4ErrorPropagatorManager::G4ErrorPropagatorManager() 80 { 80 { 81 //----- Initialize a few things 81 //----- Initialize a few things 82 // o theG4ErrorPropagatorManager = this; << 82 //o theG4ErrorPropagatorManager = this; 83 83 84 char* g4emverb = std::getenv("G4EVERBOSE"); 84 char* g4emverb = std::getenv("G4EVERBOSE"); 85 if(!g4emverb) << 85 if( !g4emverb ) { 86 { << 86 G4ErrorPropagatorData::GetErrorPropagatorData()->SetVerbose( 0 ); 87 G4ErrorPropagatorData::GetErrorPropagatorD << 87 } else { 88 } << 88 G4ErrorPropagatorData::GetErrorPropagatorData()->SetVerbose( atoi( g4emverb ) ); 89 else << 90 { << 91 G4ErrorPropagatorData::GetErrorPropagatorD << 92 } 89 } 93 90 94 thePropagator = 0; 91 thePropagator = 0; 95 92 96 theEquationOfMotion = 0; 93 theEquationOfMotion = 0; 97 94 98 StartG4ErrorRunManagerHelper(); << 95 StartG4ErrorRunManagerHelper(); 99 << 96 100 G4ErrorPropagatorData::GetErrorPropagatorDat << 97 G4ErrorPropagatorData::GetErrorPropagatorData()->SetState( G4ErrorState_PreInit ); 101 G4ErrorState_PreInit); << 102 98 103 theG4ErrorPropagationNavigator = 0; 99 theG4ErrorPropagationNavigator = 0; 104 100 105 StartNavigator(); // navigator has to be in << 101 StartNavigator(); //navigator has to be initialized at the beggining !?!?! >> 102 >> 103 106 } 104 } 107 105 >> 106 108 //-------------------------------------------- 107 //----------------------------------------------------------------------- 109 G4ErrorPropagatorManager::~G4ErrorPropagatorMa 108 G4ErrorPropagatorManager::~G4ErrorPropagatorManager() 110 { 109 { 111 delete theEquationOfMotion; 110 delete theEquationOfMotion; 112 delete theG4ErrorPropagationNavigator; 111 delete theG4ErrorPropagationNavigator; 113 delete thePropagator; 112 delete thePropagator; 114 delete theG4ErrorRunManagerHelper; 113 delete theG4ErrorRunManagerHelper; 115 delete theG4ErrorPropagatorManager; 114 delete theG4ErrorPropagatorManager; 116 } 115 } 117 116 >> 117 118 //-------------------------------------------- 118 //----------------------------------------------------------------------- 119 void G4ErrorPropagatorManager::StartG4ErrorRun 119 void G4ErrorPropagatorManager::StartG4ErrorRunManagerHelper() 120 { 120 { 121 //----- Initialize G4ErrorRunManagerHelper 121 //----- Initialize G4ErrorRunManagerHelper 122 theG4ErrorRunManagerHelper = G4ErrorRunManag 122 theG4ErrorRunManagerHelper = G4ErrorRunManagerHelper::GetRunManagerKernel(); 123 123 124 if(theG4ErrorRunManagerHelper == 0) << 124 if( theG4ErrorRunManagerHelper == 0 ) { 125 { << 126 theG4ErrorRunManagerHelper = new G4ErrorRu 125 theG4ErrorRunManagerHelper = new G4ErrorRunManagerHelper(); 127 } 126 } 128 127 129 //----- User Initialization classes << 128 //----- User Initialization classes 130 //--- GEANT4e PhysicsList 129 //--- GEANT4e PhysicsList 131 if(G4ErrorPropagatorData::verbose() >= 4) << 130 if( G4ErrorPropagatorData::verbose() >= 4 ) G4cout << " G4ErrorPropagatorManager::StartG4eRunManager() done " << theG4ErrorRunManagerHelper << G4endl; 132 G4cout << " G4ErrorPropagatorManager::Star << 133 << theG4ErrorRunManagerHelper << G4 << 134 //- theG4eRunManager->SetUserInitialization 131 //- theG4eRunManager->SetUserInitialization(new G4ErrorPhysicsList); >> 132 135 } 133 } 136 134 >> 135 137 //-------------------------------------------- 136 //----------------------------------------------------------------------- 138 void G4ErrorPropagatorManager::StartNavigator( 137 void G4ErrorPropagatorManager::StartNavigator() 139 { 138 { 140 if(theG4ErrorPropagationNavigator == 0) << 139 if( theG4ErrorPropagationNavigator == 0 ) { 141 { << 140 G4TransportationManager*transportationManager = G4TransportationManager::GetTransportationManager(); 142 G4TransportationManager* transportationMan << 141 143 G4TransportationManager::GetTransportati << 144 << 145 G4Navigator* g4navi = transportationManage 142 G4Navigator* g4navi = transportationManager->GetNavigatorForTracking(); 146 << 143 147 G4VPhysicalVolume* world = g4navi->GetWorl 144 G4VPhysicalVolume* world = g4navi->GetWorldVolume(); 148 G4int verb = g4navi->GetVerb << 145 G4int verb = g4navi->GetVerboseLevel(); 149 delete g4navi; 146 delete g4navi; 150 147 151 theG4ErrorPropagationNavigator = new G4Err 148 theG4ErrorPropagationNavigator = new G4ErrorPropagationNavigator(); 152 149 153 if(world != 0) << 150 if( world != 0 ) { 154 { << 151 theG4ErrorPropagationNavigator->SetWorldVolume( world ); 155 theG4ErrorPropagationNavigator->SetWorld << 156 } 152 } 157 theG4ErrorPropagationNavigator->SetVerbose << 153 theG4ErrorPropagationNavigator->SetVerboseLevel( verb ); 158 << 154 159 transportationManager->SetNavigatorForTrac << 155 transportationManager->SetNavigatorForTracking(theG4ErrorPropagationNavigator); 160 theG4ErrorPropagationNavigator); << 156 transportationManager->GetPropagatorInField()->GetIntersectionLocator() 161 transportationManager->GetPropagatorInFiel << 157 ->SetNavigatorFor(theG4ErrorPropagationNavigator); 162 ->GetIntersectionLocator() << 158 G4EventManager::GetEventManager()->GetTrackingManager()->GetSteppingManager() 163 ->SetNavigatorFor(theG4ErrorPropagationN << 159 ->SetNavigator(theG4ErrorPropagationNavigator); 164 G4EventManager::GetEventManager() << 165 ->GetTrackingManager() << 166 ->GetSteppingManager() << 167 ->SetNavigator(theG4ErrorPropagationNavi << 168 // G4ThreeVector center(0,0,0); 160 // G4ThreeVector center(0,0,0); 169 // theG4ErrorPropagationNavigator->Locate 161 // theG4ErrorPropagationNavigator->LocateGlobalPointAndSetup(center,0,false); >> 162 170 } 163 } 171 164 172 if(G4ErrorPropagatorData::verbose() >= 2) << 165 if( G4ErrorPropagatorData::verbose() >= 2 ) G4cout << " theState at StartNavigator " << PrintG4ErrorState() << G4endl; 173 G4cout << " theState at StartNavigator " < << 166 174 } 167 } >> 168 175 169 176 //-------------------------------------------- 170 //----------------------------------------------------------------------- 177 void G4ErrorPropagatorManager::InitGeant4e() 171 void G4ErrorPropagatorManager::InitGeant4e() 178 { 172 { 179 if(G4ErrorPropagatorData::verbose() >= 1) << 173 if( G4ErrorPropagatorData::verbose() >= 1 ) G4cout << "InitGeant4e GEANT4e State= " << PrintG4ErrorState() << " GEANT4 State= " << PrintG4State() << G4endl; 180 G4cout << "InitGeant4e GEANT4e State= " << << 174 G4ApplicationState currentState = G4StateManager::GetStateManager()->GetCurrentState(); 181 << " GEANT4 State= " << PrintG4Stat << 182 G4ApplicationState currentState = << 183 G4StateManager::GetStateManager()->GetCurr << 184 //----- Initialize run 175 //----- Initialize run 185 // if( G4StateManager::GetStateManager()->G << 176 // if( G4StateManager::GetStateManager()->GetCurrentState() == G4State_PreInit) { 186 // G4State_PreInit) { << 177 187 << 178 if( G4ErrorPropagatorData::GetErrorPropagatorData()->GetState() == G4ErrorState_PreInit ) { 188 if(G4ErrorPropagatorData::GetErrorPropagator << 179 if ( currentState == G4State_PreInit || currentState == G4State_Idle) { 189 G4ErrorState_PreInit) << 190 { << 191 if(currentState == G4State_PreInit || curr << 192 { << 193 // G4eRunManager::GetRunManager()->In 180 // G4eRunManager::GetRunManager()->Initialize(); 194 theG4ErrorRunManagerHelper->InitializeGe 181 theG4ErrorRunManagerHelper->InitializeGeometry(); 195 theG4ErrorRunManagerHelper->InitializePh 182 theG4ErrorRunManagerHelper->InitializePhysics(); 196 } 183 } 197 << 184 198 InitFieldForBackwards(); 185 InitFieldForBackwards(); 199 << 186 200 //- G4StateManager::GetStateManager()-> 187 //- G4StateManager::GetStateManager()->SetNewState(G4State_Idle); 201 << 188 202 if(G4ErrorPropagatorData::verbose() >= 4) << 189 if( G4ErrorPropagatorData::verbose() >= 4 ) G4cout << " bef theG4ErrorPropagatorManager->RunInitialization() " << G4StateManager::GetStateManager()->GetCurrentState() << G4endl; 203 G4cout << " bef theG4ErrorPropagatorMan << 204 << G4StateManager::GetStateManage << 205 theG4ErrorRunManagerHelper->RunInitializat 190 theG4ErrorRunManagerHelper->RunInitialization(); 206 if(G4ErrorPropagatorData::verbose() >= 4) << 191 if( G4ErrorPropagatorData::verbose() >= 4 ) G4cout << " aft theG4ErrorPropagatorManager->RunInitialization() " << G4StateManager::GetStateManager()->GetCurrentState() << G4endl; 207 G4cout << " aft theG4ErrorPropagatorMan << 192 208 << G4StateManager::GetStateManage << 193 if( !thePropagator ) thePropagator = new G4ErrorPropagator(); // currently the only propagator possible 209 << 194 210 if(!thePropagator) << 211 thePropagator = << 212 new G4ErrorPropagator(); // currently << 213 << 214 InitTrackPropagation(); 195 InitTrackPropagation(); 215 } << 196 } else { 216 else << 217 { << 218 std::ostringstream message; 197 std::ostringstream message; 219 message << "Illegal GEANT4e State= " << Pr 198 message << "Illegal GEANT4e State= " << PrintG4ErrorState(); 220 G4Exception("G4ErrorPropagatorManager::Ini << 199 G4Exception("G4ErrorPropagatorManager::InitGeant4e()", 221 JustWarning, message); << 200 "IllegalState", JustWarning, message); 222 } 201 } 223 << 202 224 //----- Set the tracking geometry for this p 203 //----- Set the tracking geometry for this propagation 225 // t SetTrackingGeometry(); << 204 //t SetTrackingGeometry(); 226 //----- Set the physics list for this propag 205 //----- Set the physics list for this propagation 227 // t SetPhysicsList(); << 206 //t SetPhysicsList(); 228 //----- Set the field propagation parameters 207 //----- Set the field propagation parameters for this propagation 229 // t SetFieldPropagationParameters(); << 208 //t SetFieldPropagationParameters(); 230 G4ErrorPropagatorData::GetErrorPropagatorDat << 209 G4ErrorPropagatorData::GetErrorPropagatorData()->SetState( G4ErrorState_Init ); >> 210 >> 211 if( G4ErrorPropagatorData::verbose() >= 2 ) G4cout << "End InitGeant4e GEANT4e State= " << PrintG4ErrorState() << " GEANT4 State= " << PrintG4State() << G4endl; >> 212 231 213 232 if(G4ErrorPropagatorData::verbose() >= 2) << 233 G4cout << "End InitGeant4e GEANT4e State= << 234 << " GEANT4 State= " << PrintG4Stat << 235 } 214 } 236 215 >> 216 237 //-------------------------------------------- 217 //----------------------------------------------------------------------- 238 void G4ErrorPropagatorManager::InitTrackPropag 218 void G4ErrorPropagatorManager::InitTrackPropagation() 239 { 219 { 240 thePropagator->SetStepN(0); << 220 thePropagator->SetStepN( 0 ); >> 221 >> 222 G4ErrorPropagatorData::GetErrorPropagatorData()->SetState( G4ErrorState_Propagating ); 241 223 242 G4ErrorPropagatorData::GetErrorPropagatorDat << 243 G4ErrorState_Propagating); << 244 } 224 } 245 225 >> 226 246 //-------------------------------------------- 227 //----------------------------------------------------------------------- 247 G4bool G4ErrorPropagatorManager::InitFieldForB 228 G4bool G4ErrorPropagatorManager::InitFieldForBackwards() 248 { 229 { 249 if(G4ErrorPropagatorData::verbose() >= 4) << 230 250 G4cout << " G4ErrorPropagatorManager::Init << 231 if( G4ErrorPropagatorData::verbose() >= 4 ) G4cout << " G4ErrorPropagatorManager::InitFieldForBackwards() " << G4endl; 251 //----- Gets the current equation of motion 232 //----- Gets the current equation of motion 252 G4FieldManager* fieldMgr = << 233 G4FieldManager* fieldMgr= G4TransportationManager::GetTransportationManager()->GetFieldManager(); 253 G4TransportationManager::GetTransportation << 254 // G4cout << " fieldMgr " << fieldMgr << G4 234 // G4cout << " fieldMgr " << fieldMgr << G4endl; 255 if(!fieldMgr) << 235 if( !fieldMgr ) return 0; 256 return 0; << 257 236 258 // G4Field* myfield = fieldMgr->GetDetector 237 // G4Field* myfield = fieldMgr->GetDetectorField(); 259 G4ChordFinder* cf = fieldMgr->GetChordFinder << 238 G4ChordFinder* cf = fieldMgr ->GetChordFinder(); 260 if(!cf) << 239 if( !cf ) return 0; 261 return 0; << 262 auto driver = cf->GetIntegrationDriver(); 240 auto driver = cf->GetIntegrationDriver(); 263 if(!driver) << 241 if( !driver ) return 0; 264 return 0; << 265 auto equation = driver->GetEquationOfMotion( 242 auto equation = driver->GetEquationOfMotion(); 266 243 267 //----- Replaces the equation by a G4ErrorMa << 244 //----- Replaces the equation by a G4ErrorMag_UsualEqRhs to handle backwards tracking 268 //tracking << 245 if ( !dynamic_cast<G4ErrorMag_UsualEqRhs*>(equation) ) { 269 if(!dynamic_cast<G4ErrorMag_UsualEqRhs*>(equ << 270 { << 271 G4MagneticField* myfield = (G4MagneticFiel << 272 << 273 // G4Mag_UsualEqRhs* fEquation_usual = << 274 // dynamic_cast<G4Mag_UsualEqRhs*>(equa << 275 if(theEquationOfMotion == 0) << 276 theEquationOfMotion = new G4ErrorMag_Usu << 277 246 >> 247 G4MagneticField* myfield = (G4MagneticField*)fieldMgr->GetDetectorField(); >> 248 >> 249 // G4Mag_UsualEqRhs* fEquation_usual = dynamic_cast<G4Mag_UsualEqRhs*>(equation); >> 250 if( theEquationOfMotion == 0 ) theEquationOfMotion = new G4ErrorMag_UsualEqRhs(myfield); >> 251 278 //---- Pass the equation of motion to the 252 //---- Pass the equation of motion to the G4MagIntegratorStepper 279 driver->SetEquationOfMotion(theEquationOfM << 253 driver->SetEquationOfMotion( theEquationOfMotion ); 280 254 281 //--- change stepper for speed tests 255 //--- change stepper for speed tests 282 G4MagIntegratorStepper* g4eStepper = << 256 G4MagIntegratorStepper* g4eStepper = new G4ClassicalRK4(theEquationOfMotion); 283 new G4ClassicalRK4(theEquationOfMotion); << 257 // G4MagIntegratorStepper* g4eStepper = new G4ExactHelixStepper(theEquationOfMotion); 284 // G4MagIntegratorStepper* g4eStepper = ne << 258 285 // G4ExactHelixStepper(theEquationOfMotion << 259 //---- 286 << 260 G4MagneticField* field = static_cast<G4MagneticField*>(const_cast<G4Field*>(fieldMgr->GetDetectorField())); 287 //---- << 261 G4ChordFinder* pChordFinder = new G4ChordFinder(field, 1.0e-2*mm, g4eStepper); 288 G4MagneticField* field = static_cast<G4Mag << 289 const_cast<G4Field*>(fieldMgr->GetDetect << 290 G4ChordFinder* pChordFinder = << 291 new G4ChordFinder(field, 1.0e-2 * mm, g4 << 292 262 293 fieldMgr->SetChordFinder(pChordFinder); 263 fieldMgr->SetChordFinder(pChordFinder); >> 264 294 } 265 } 295 266 296 return 1; 267 return 1; 297 } 268 } 298 269 >> 270 299 //-------------------------------------------- 271 //----------------------------------------------------------------------- 300 G4int G4ErrorPropagatorManager::Propagate(G4Er << 272 G4int G4ErrorPropagatorManager::Propagate( G4ErrorTrajState* currentTS, const G4ErrorTarget* target, G4ErrorMode mode ) 301 cons << 273 { 302 G4Er << 274 G4ErrorPropagatorData::GetErrorPropagatorData()->SetMode( mode ); 303 { << 275 if( !thePropagator ) thePropagator = new G4ErrorPropagator(); // currently the only propagator possible 304 G4ErrorPropagatorData::GetErrorPropagatorDat << 305 if(!thePropagator) << 306 thePropagator = << 307 new G4ErrorPropagator(); // currently t << 308 276 309 SetSteppingManagerVerboseLevel(); 277 SetSteppingManagerVerboseLevel(); 310 InitTrackPropagation(); 278 InitTrackPropagation(); 311 279 312 G4int ierr = thePropagator->Propagate(curren << 280 G4int ierr = thePropagator->Propagate( currentTS, target, mode ); 313 281 314 EventTermination(); 282 EventTermination(); 315 283 316 return ierr; 284 return ierr; 317 } 285 } 318 286 >> 287 319 //-------------------------------------------- 288 //----------------------------------------------------------------------- 320 G4int G4ErrorPropagatorManager::PropagateOneSt << 289 G4int G4ErrorPropagatorManager::PropagateOneStep( G4ErrorTrajState* currentTS, G4ErrorMode mode ) 321 << 322 { 290 { 323 G4ErrorPropagatorData::GetErrorPropagatorDat << 291 G4ErrorPropagatorData::GetErrorPropagatorData()->SetMode( mode ); 324 292 325 if(!thePropagator) << 293 if( !thePropagator ) thePropagator = new G4ErrorPropagator(); // currently the only propagator possible 326 thePropagator = << 327 new G4ErrorPropagator(); // currently t << 328 294 329 SetSteppingManagerVerboseLevel(); 295 SetSteppingManagerVerboseLevel(); 330 296 331 return thePropagator->PropagateOneStep(curre << 297 return thePropagator->PropagateOneStep( currentTS ); 332 } 298 } 333 299 >> 300 334 //-------------------------------------------- 301 //----------------------------------------------------------------------- 335 G4bool G4ErrorPropagatorManager::CloseGeometry 302 G4bool G4ErrorPropagatorManager::CloseGeometry() 336 { 303 { 337 G4GeometryManager* geomManager = G4GeometryM 304 G4GeometryManager* geomManager = G4GeometryManager::GetInstance(); 338 geomManager->OpenGeometry(); 305 geomManager->OpenGeometry(); 339 if(G4StateManager::GetStateManager()->GetCur << 306 if( G4StateManager::GetStateManager()->GetCurrentState() != G4State_GeomClosed) { 340 { << 341 G4StateManager::GetStateManager()->SetNewS 307 G4StateManager::GetStateManager()->SetNewState(G4State_Quit); 342 } 308 } 343 309 344 return TRUE; 310 return TRUE; 345 } 311 } 346 312 >> 313 347 //-------------------------------------------- 314 //--------------------------------------------------------------------------- 348 void G4ErrorPropagatorManager::SetUserInitiali << 315 void G4ErrorPropagatorManager::SetUserInitialization(G4VUserDetectorConstruction* userInit) 349 G4VUserDetectorConstruction* userInit) << 350 { 316 { 351 theG4ErrorRunManagerHelper->SetUserInitializ << 317 theG4ErrorRunManagerHelper->SetUserInitialization( userInit); 352 } 318 } 353 319 >> 320 354 //-------------------------------------------- 321 //--------------------------------------------------------------------------- 355 void G4ErrorPropagatorManager::SetUserInitiali << 322 void G4ErrorPropagatorManager::SetUserInitialization(G4VPhysicalVolume* userInit) 356 G4VPhysicalVolume* userInit) << 323 { 357 { << 324 theG4ErrorRunManagerHelper->SetUserInitialization( userInit); 358 theG4ErrorRunManagerHelper->SetUserInitializ << 359 } 325 } >> 326 360 327 361 //-------------------------------------------- 328 //--------------------------------------------------------------------------- 362 void G4ErrorPropagatorManager::SetUserInitiali << 329 void G4ErrorPropagatorManager::SetUserInitialization(G4VUserPhysicsList* userInit) 363 G4VUserPhysicsList* userInit) << 330 { 364 { << 331 theG4ErrorRunManagerHelper->SetUserInitialization( userInit); 365 theG4ErrorRunManagerHelper->SetUserInitializ << 366 } 332 } 367 333 >> 334 368 //-------------------------------------------- 335 //--------------------------------------------------------------------------- 369 void G4ErrorPropagatorManager::SetUserAction(G 336 void G4ErrorPropagatorManager::SetUserAction(G4UserTrackingAction* userAction) 370 { 337 { 371 G4EventManager::GetEventManager()->SetUserAc << 338 G4EventManager::GetEventManager()->SetUserAction( userAction ); 372 } 339 } 373 340 >> 341 374 //-------------------------------------------- 342 //--------------------------------------------------------------------------- 375 void G4ErrorPropagatorManager::SetUserAction(G 343 void G4ErrorPropagatorManager::SetUserAction(G4UserSteppingAction* userAction) 376 { 344 { 377 G4EventManager::GetEventManager()->SetUserAc << 345 G4EventManager::GetEventManager()->SetUserAction( userAction ); 378 } 346 } 379 347 >> 348 380 //-------------------------------------------- 349 //--------------------------------------------------------------------------- 381 void G4ErrorPropagatorManager::SetSteppingMana 350 void G4ErrorPropagatorManager::SetSteppingManagerVerboseLevel() 382 { 351 { 383 G4TrackingManager* trkmgr = << 352 G4TrackingManager* trkmgr = G4EventManager::GetEventManager()->GetTrackingManager(); 384 G4EventManager::GetEventManager()->GetTrac << 353 trkmgr->GetSteppingManager()->SetVerboseLevel( trkmgr->GetVerboseLevel() ); 385 trkmgr->GetSteppingManager()->SetVerboseLeve << 386 } 354 } 387 355 >> 356 388 //-------------------------------------------- 357 //--------------------------------------------------------------------------- 389 void G4ErrorPropagatorManager::EventTerminatio 358 void G4ErrorPropagatorManager::EventTermination() 390 { 359 { 391 G4ErrorPropagatorData::GetErrorPropagatorDat << 360 G4ErrorPropagatorData::GetErrorPropagatorData()->SetState( G4ErrorState_Init ); 392 } 361 } 393 362 >> 363 394 //-------------------------------------------- 364 //--------------------------------------------------------------------------- 395 void G4ErrorPropagatorManager::RunTermination( 365 void G4ErrorPropagatorManager::RunTermination() 396 { 366 { 397 G4ErrorPropagatorData::GetErrorPropagatorDat << 367 G4ErrorPropagatorData::GetErrorPropagatorData()->SetState( G4ErrorState_PreInit ); 398 G4ErrorState_PreInit); << 368 theG4ErrorRunManagerHelper->RunTermination(); 399 theG4ErrorRunManagerHelper->RunTermination() << 400 } 369 } 401 370 >> 371 402 //-------------------------------------------- 372 //--------------------------------------------------------------------------- 403 G4String G4ErrorPropagatorManager::PrintG4Erro << 373 G4String G4ErrorPropagatorManager::PrintG4ErrorState() 404 { 374 { 405 return PrintG4ErrorState( << 375 return PrintG4ErrorState( G4ErrorPropagatorData::GetErrorPropagatorData()->GetState() ); 406 G4ErrorPropagatorData::GetErrorPropagatorD << 407 } 376 } 408 377 >> 378 409 //-------------------------------------------- 379 //--------------------------------------------------------------------------- 410 G4String G4ErrorPropagatorManager::PrintG4Erro << 380 G4String G4ErrorPropagatorManager::PrintG4ErrorState( G4ErrorState state ) 411 { 381 { 412 G4String nam = ""; 382 G4String nam = ""; 413 switch(state) << 383 switch (state){ 414 { << 384 case G4ErrorState_PreInit: 415 case G4ErrorState_PreInit: << 385 nam = "G4ErrorState_PreInit"; 416 nam = "G4ErrorState_PreInit"; << 386 break; 417 break; << 387 case G4ErrorState_Init: 418 case G4ErrorState_Init: << 388 nam = "G4ErrorState_Init"; 419 nam = "G4ErrorState_Init"; << 389 break; 420 break; << 390 case G4ErrorState_Propagating: 421 case G4ErrorState_Propagating: << 391 nam = "G4ErrorState_Propagating"; 422 nam = "G4ErrorState_Propagating"; << 392 break; 423 break; << 393 case G4ErrorState_TargetCloserThanBoundary: 424 case G4ErrorState_TargetCloserThanBoundary << 394 nam = "G4ErrorState_TargetCloserThanBoundary"; 425 nam = "G4ErrorState_TargetCloserThanBoun << 395 break; 426 break; << 396 case G4ErrorState_StoppedAtTarget: 427 case G4ErrorState_StoppedAtTarget: << 397 nam = "G4ErrorState_StoppedAtTarget"; 428 nam = "G4ErrorState_StoppedAtTarget"; << 398 break; 429 break; << 430 } 399 } 431 400 432 return nam; 401 return nam; 433 } 402 } 434 403 >> 404 435 //-------------------------------------------- 405 //--------------------------------------------------------------------------- 436 G4String G4ErrorPropagatorManager::PrintG4Stat 406 G4String G4ErrorPropagatorManager::PrintG4State() 437 { 407 { 438 return PrintG4State(G4StateManager::GetState 408 return PrintG4State(G4StateManager::GetStateManager()->GetCurrentState()); 439 } 409 } 440 410 >> 411 441 //-------------------------------------------- 412 //--------------------------------------------------------------------------- 442 G4String G4ErrorPropagatorManager::PrintG4Stat << 413 G4String G4ErrorPropagatorManager::PrintG4State( G4ApplicationState state ) 443 { 414 { 444 G4String nam = ""; 415 G4String nam = ""; 445 switch(state) << 416 switch ( state ){ 446 { << 417 case G4State_PreInit: 447 case G4State_PreInit: << 418 nam = "G4State_PreInit"; 448 nam = "G4State_PreInit"; << 419 break; 449 break; << 420 case G4State_Init: 450 case G4State_Init: << 421 nam = "G4State_Init"; 451 nam = "G4State_Init"; << 422 break; 452 break; << 423 case G4State_Idle: 453 case G4State_Idle: << 424 nam = "G4State_Idle"; 454 nam = "G4State_Idle"; << 425 break; 455 break; << 426 case G4State_GeomClosed: 456 case G4State_GeomClosed: << 427 nam = "G4State_GeomClosed"; 457 nam = "G4State_GeomClosed"; << 428 break; 458 break; << 429 case G4State_EventProc: 459 case G4State_EventProc: << 430 nam = "G4State_EventProc"; 460 nam = "G4State_EventProc"; << 431 break; 461 break; << 432 case G4State_Quit: 462 case G4State_Quit: << 433 nam = "G4State_Quit"; 463 nam = "G4State_Quit"; << 434 break; 464 break; << 435 case G4State_Abort: 465 case G4State_Abort: << 436 nam = "G4State_Abort"; 466 nam = "G4State_Abort"; << 437 break; 467 break; << 468 } 438 } 469 << 439 470 return nam; 440 return nam; >> 441 471 } 442 } 472 443