G4TrackingMessenger.cc

Go to the documentation of this file.
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: G4TrackingMessenger.cc 67009 2013-01-29 16:00:21Z gcosmo $
00028 //
00029 //---------------------------------------------------------------
00030 //
00031 // G4TrackingMessenger.cc
00032 //
00033 // Description:
00034 //   This is a messenger class to interface to exchange information
00035 //   between tracking and stepping managers and UI.
00036 //
00037 // Contact:
00038 //   Questions and comments to this code should be sent to
00039 //     Katsuya Amako  (e-mail: Katsuya.Amako@kek.jp)
00040 //     Makoto  Asai   (e-mail: asai@kekvax.kek.jp)
00041 //     Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
00042 //
00043 //---------------------------------------------------------------
00044 
00045 #include "G4TrackingMessenger.hh"
00046 #include "G4UIdirectory.hh"
00047 #include "G4UIcmdWithoutParameter.hh"
00048 #include "G4UIcmdWithAnInteger.hh"
00049 #include "G4UImanager.hh"
00050 #include "globals.hh"
00051 #include "G4TrackingManager.hh"
00052 #include "G4SteppingManager.hh"
00053 #include "G4TrackStatus.hh"
00054 #include "G4ios.hh"
00055 
00057 G4TrackingMessenger::G4TrackingMessenger(G4TrackingManager * trMan)
00059 : trackingManager(trMan)
00060 {
00061   steppingManager = trackingManager->GetSteppingManager();
00062 
00063   TrackingDirectory = new G4UIdirectory("/tracking/");
00064   TrackingDirectory->SetGuidance("TrackingManager and SteppingManager control commands.");
00065 
00066   AbortCmd = new G4UIcmdWithoutParameter("/tracking/abort",this);
00067   AbortCmd->SetGuidance("Abort current G4Track processing.");
00068 
00069 
00070   ResumeCmd = new G4UIcmdWithoutParameter("/tracking/resume",this);
00071   ResumeCmd->SetGuidance("Resume current G4Track processing.");
00072 
00073   StoreTrajectoryCmd = new G4UIcmdWithAnInteger("/tracking/storeTrajectory",this);
00074   StoreTrajectoryCmd->SetGuidance("Store trajectories or not.");
00075   StoreTrajectoryCmd->SetGuidance(" 0 : Don't Store trajectories.");
00076   StoreTrajectoryCmd->SetGuidance(" !=0 : Store trajectories.");
00077   StoreTrajectoryCmd->SetGuidance(" 1 : Choose G4Trajectory as default.");
00078   StoreTrajectoryCmd->SetGuidance(" 2 : Choose G4SmoothTrajectory as default.");
00079   StoreTrajectoryCmd->SetGuidance(" 3 : Choose G4RichTrajectory as default.");
00080   StoreTrajectoryCmd->SetParameterName("Store",true);
00081   StoreTrajectoryCmd->SetDefaultValue(0);
00082   StoreTrajectoryCmd->SetRange("Store >=0 && Store <= 3"); 
00083 
00084 
00085   VerboseCmd = new G4UIcmdWithAnInteger("/tracking/verbose",this);
00086 #ifdef G4VERBOSE
00087   VerboseCmd->SetGuidance("Set Verbose level of tracking category.");
00088   VerboseCmd->SetGuidance(" -1 : Silent.");
00089   VerboseCmd->SetGuidance(" 0 : Silent.");
00090   VerboseCmd->SetGuidance(" 1 : Minium information of each Step.");
00091   VerboseCmd->SetGuidance(" 2 : Addition to Level=1, info of secondary particles.");
00092   VerboseCmd->SetGuidance(" 3 : Addition to Level=1, pre/postStepoint information");
00093   VerboseCmd->SetGuidance("     after all AlongStep/PostStep process executions.");
00094   VerboseCmd->SetGuidance(" 4 : Addition to Level=3, pre/postStepoint information");
00095   VerboseCmd->SetGuidance("     at each AlongStepPostStep process execuation."); 
00096   VerboseCmd->SetGuidance(" 5 : Addition to Level=4, proposed Step length information");
00097   VerboseCmd->SetGuidance("     from each AlongStepPostStep process."); 
00098   VerboseCmd->SetParameterName("verbose_level",true);
00099   VerboseCmd->SetDefaultValue(0);
00100   VerboseCmd->SetRange("verbose_level >=-1  ");
00101 #else 
00102   VerboseCmd->SetGuidance("You need to recompile the tracking category defining G4VERBOSE ");  
00103 #endif
00104 }
00105 
00107 G4TrackingMessenger::~G4TrackingMessenger()
00109 {
00110   delete TrackingDirectory;
00111   delete AbortCmd;
00112   delete ResumeCmd;
00113   delete StoreTrajectoryCmd;
00114   delete VerboseCmd;
00115 }
00116 
00118 void G4TrackingMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
00120 {
00121   if( command == VerboseCmd ){
00122     trackingManager->SetVerboseLevel(VerboseCmd->ConvertToInt(newValues));
00123   }
00124 
00125   if( command  == AbortCmd ){
00126     steppingManager->GetTrack()->SetTrackStatus(fStopAndKill);
00127     G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
00128   }
00129 
00130   if( command  == ResumeCmd ){
00131         G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
00132   }
00133 
00134   if( command == StoreTrajectoryCmd ){
00135     trackingManager->SetStoreTrajectory(StoreTrajectoryCmd->ConvertToInt(newValues));
00136   }
00137 }
00138 
00139 
00141 G4String G4TrackingMessenger::GetCurrentValue(G4UIcommand * command)
00143 {
00144   if( command == VerboseCmd ){
00145     return VerboseCmd->ConvertToString(trackingManager->GetVerboseLevel());
00146   }
00147   else if( command == StoreTrajectoryCmd ){
00148     return StoreTrajectoryCmd->ConvertToString(trackingManager->GetStoreTrajectory());
00149   }
00150   return G4String('\0');
00151 }
00152 
00153 
00154 
00155 
00156 
00157 
00158 
00159 
00160 
00161 
00162 
00163 
00164 

Generated on Mon May 27 17:50:01 2013 for Geant4 by  doxygen 1.4.7