00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // -------------------------------------------------------------------- 00030 00031 #include "G4StackingMessenger.hh" 00032 #include "G4StackManager.hh" 00033 #include "G4UIdirectory.hh" 00034 #include "G4UIcmdWithoutParameter.hh" 00035 #include "G4UIcmdWithAnInteger.hh" 00036 #include "G4ios.hh" 00037 00038 G4StackingMessenger::G4StackingMessenger(G4StackManager * fCont) 00039 :fContainer(fCont) 00040 { 00041 stackDir = new G4UIdirectory("/event/stack/"); 00042 stackDir->SetGuidance("Stack control commands."); 00043 00044 statusCmd = new G4UIcmdWithoutParameter("/event/stack/status",this); 00045 statusCmd->SetGuidance("List current status of the stack."); 00046 00047 clearCmd = new G4UIcmdWithAnInteger("/event/stack/clear",this); 00048 clearCmd->SetGuidance("Clear stacked tracks."); 00049 clearCmd->SetGuidance(" 2 : clear all tracks in all stacks"); 00050 clearCmd->SetGuidance(" 1 : clear tracks in the urgent and waiting stacks"); 00051 clearCmd->SetGuidance(" 0 : clear tracks in the waiting stack (default)"); 00052 clearCmd->SetGuidance("-1 : clear tracks in the urgent stack"); 00053 clearCmd->SetGuidance("-2 : clear tracks in the postponed stack"); 00054 clearCmd->SetParameterName("level",true); 00055 clearCmd->SetDefaultValue(0); 00056 clearCmd->SetRange("level>=-2&&level<=2"); 00057 clearCmd->AvailableForStates(G4State_GeomClosed,G4State_EventProc); 00058 00059 verboseCmd = new G4UIcmdWithAnInteger("/event/stack/verbose",this); 00060 verboseCmd->SetGuidance("Set verbose level for G4StackManager"); 00061 verboseCmd->SetGuidance(" 0 : Silence (default)"); 00062 verboseCmd->SetGuidance(" 1 : Minimum statistics"); 00063 verboseCmd->SetGuidance(" 2 : Detailed reports"); 00064 verboseCmd->SetGuidance("Note - this value is overwritten by /event/verbose command."); 00065 00066 } 00067 00068 G4StackingMessenger::~G4StackingMessenger() 00069 { 00070 delete statusCmd; 00071 delete clearCmd; 00072 delete verboseCmd; 00073 delete stackDir; 00074 } 00075 00076 void G4StackingMessenger::SetNewValue(G4UIcommand * command,G4String newValues) 00077 { 00078 if( command==statusCmd ) 00079 { 00080 G4cout << "========================== Current status of the stack =====" << G4endl; 00081 G4cout << " Number of tracks in the stack" << G4endl; 00082 G4cout << " Urgent stack : " << fContainer->GetNUrgentTrack() << G4endl; 00083 G4cout << " Waiting stack : " << fContainer->GetNWaitingTrack() << G4endl; 00084 G4cout << " Postponed stack : " << fContainer->GetNPostponedTrack() << G4endl; 00085 } 00086 else if( command==clearCmd ) 00087 { 00088 G4int vc = clearCmd->GetNewIntValue(newValues); 00089 switch (vc) 00090 { 00091 case 2: 00092 fContainer->ClearPostponeStack(); 00093 case 1: 00094 fContainer->ClearUrgentStack(); 00095 case 0: 00096 fContainer->ClearWaitingStack(); 00097 break; 00098 case -1: 00099 fContainer->ClearUrgentStack(); 00100 break; 00101 case -2: 00102 fContainer->ClearPostponeStack(); 00103 break; 00104 } 00105 } 00106 else if( command==verboseCmd ) 00107 { 00108 fContainer->SetVerboseLevel(verboseCmd->GetNewIntValue(newValues)); 00109 } 00110 } 00111