#include #include #include #include #include using namespace RAT; TrackingMessenger::TrackingMessenger( TrackingAction* trackingAction ) : fTrackingAction( trackingAction ) { fTrackingDir = new G4UIdirectory( "/rat/tracking/" ); fTrackingDir->SetGuidance( "Tracking commands" ); fStoreTrackingCmd = new G4UIcmdWithAString( "/rat/tracking/store",this ); fStoreTrackingCmd->SetGuidance( "Choose the tracking level, full, condensed or none." ); fStoreTrackingCmd->SetParameterName( "Tracking Level", false ); fStoreTrackingCmd->AvailableForStates( G4State_PreInit, G4State_Init, G4State_Idle ); fOmitParticleCmd = new G4UIcmdWithAString( "/rat/tracking/omit",this ); fOmitParticleCmd->SetGuidance( "Name a particle to omit from tracking e.g. opticalphoton." ); fOmitParticleCmd->SetParameterName( "Particle Name", false ); fOmitParticleCmd->AvailableForStates( G4State_PreInit, G4State_Init, G4State_Idle ); } TrackingMessenger::~TrackingMessenger() { delete fStoreTrackingCmd; delete fOmitParticleCmd; delete fTrackingDir; } void TrackingMessenger::SetNewValue( G4UIcommand* command, G4String value ) { if( command == fStoreTrackingCmd ) { if( value == "full" ) fTrackingAction->SetTrackingLevel( TrackingAction::eFull ); else if( value == "condensed" ) fTrackingAction->SetTrackingLevel( TrackingAction::eCondensed ); else if( value == "none" ) fTrackingAction->SetTrackingLevel( TrackingAction::eNone ); else Log::Die( "TrackingMessenger::SetNewValue: /rat/tracking/store must be followed by `none`, `full` or `condensed`. Error " + command->GetCommandPath() ); } else if( command == fOmitParticleCmd ) fTrackingAction->OmitParticle( value ); else Log::Die( "TrackingMessenger::SetNewValue: Unknown set command:" + command->GetCommandPath() ); }