#include "LGPhysicsListMessenger.hh" #include "LGPhysicsList.hh" #include "G4UIdirectory.hh" #include "G4UIcmdWithAnInteger.hh" LGPhysicsListMessenger::LGPhysicsListMessenger(LGPhysicsList* phys_List) : physics_List(phys_List) { phys_Dir = new G4UIdirectory("/phys/"); phys_Dir->SetGuidance("PhysicsList control"); verbose_Cmd = new G4UIcmdWithAnInteger("/phys/verbose", this); verbose_Cmd->SetGuidance("set verbose for physics processes"); verbose_Cmd->SetParameterName("verbose", true); verbose_Cmd->SetDefaultValue(1); verbose_Cmd->SetRange("verbose>=0"); verbose_Cmd->AvailableForStates(G4State_PreInit,G4State_Idle); // refer to G4ApplicationState.hh for getting the meaning of each argumet cerenkov_Cmd = new G4UIcmdWithAnInteger("/phys/cerenkovMaxPhotons", this); cerenkov_Cmd->SetGuidance("set maximum number of photons per step"); cerenkov_Cmd->SetParameterName("MaxNumber", false); cerenkov_Cmd->SetRange("MaxNumber>=0"); cerenkov_Cmd->AvailableForStates(G4State_Idle); } LGPhysicsListMessenger::~LGPhysicsListMessenger() // Destruct all the objects generated except for the object, Physics_List { delete verbose_Cmd; delete cerenkov_Cmd; delete phys_Dir; } void LGPhysicsListMessenger::SetNewValue(G4UIcommand* command, G4String new_Value) { if (command == verbose_Cmd) { physics_List->SetVerbose(verbose_Cmd->GetNewIntValue(new_Value)); // The actual process is fulfilled by SetVerboseLevel() method in the class, G4VProcess } if (command == cerenkov_Cmd) { physics_List->SetNbOfPhotonsCerenkov(cerenkov_Cmd->GetNewIntValue(new_Value)); // In reality, the method, SetMaxNumPhotonsPerStep() works according to the newValue } }