File indexing completed on 2025-02-25 09:22:34
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 #include "GRInitialization.hh"
0044
0045 #include "GRDetectorConstruction.hh"
0046 #include "GRPhysicsList.hh"
0047 #include "GRActionInitialization.hh"
0048 #include "GRPrimGenActionMessenger.hh"
0049 #include "G4GenericMessenger.hh"
0050 #include "GRGeomBiasMessenger.hh"
0051 #include "GRScoreWriter.hh"
0052
0053 #include "G4RunManager.hh"
0054 #include "G4ScoringManager.hh"
0055 #include "G4UIdirectory.hh"
0056 #include "G4UnitsTable.hh"
0057
0058 #include <CLHEP/Units/SystemOfUnits.h>
0059
0060 GRInitialization::GRInitialization(G4int verboseLvl)
0061 : verboseLevel(verboseLvl)
0062 {
0063
0064 new G4UnitDefinition("milligray","mGy","Dose",1.e-3*CLHEP::gray);
0065 new G4UnitDefinition("microgray","muGy","Dose",1.e-6*CLHEP::gray);
0066 new G4UnitDefinition("nanogray","nGy","Dose",1.e-9*CLHEP::gray);
0067
0068 G4ScoringManager::GetScoringManager()->SetScoreWriter(new GRScoreWriter());
0069
0070 messenger = new G4GenericMessenger(this,"/gorad/","GORAD commands");
0071 auto& initCmd = messenger->DeclareMethod("initialize",
0072 &GRInitialization::Initialize,"Initialize Gorad and G4RunManager");
0073 initCmd.SetToBeBroadcasted(false);
0074 initCmd.SetStates(G4State_PreInit);
0075
0076 detector = new GRDetectorConstruction();
0077 physics = new GRPhysicsList();
0078 actionInitialization = new GRActionInitialization();
0079 sourceMessenger = new GRPrimGenActionMessenger();
0080 geomBiasMessenger = new GRGeomBiasMessenger(detector,physics,verboseLvl);
0081 }
0082
0083 GRInitialization::~GRInitialization()
0084 {
0085 delete geomBiasMessenger;
0086 delete sourceMessenger;
0087 delete messenger;
0088 }
0089
0090 void GRInitialization::Initialize()
0091 {
0092 auto runManager = G4RunManager::GetRunManager();
0093 runManager->SetUserInitialization(detector);
0094 runManager->SetUserInitialization(physics);
0095 runManager->SetUserInitialization(actionInitialization);
0096 if(verboseLevel>0) G4cout << "GORAD is initialized.........." << G4endl;
0097 runManager->Initialize();
0098 sourceMessenger->UpdateParticleList();
0099 }
0100
0101 #include "G4UIExecutive.hh"
0102 #ifdef G4UI_USE_QT
0103 #include "G4UIQt.hh"
0104 #endif
0105
0106 void GRInitialization::SetWindowText(G4UIExecutive* ui)
0107 {
0108
0109 if(!(ui->IsGUI())) return;
0110
0111 #ifdef G4UI_USE_QT
0112 G4UIQt* qt = dynamic_cast<G4UIQt*>(ui->GetSession());
0113 if(!qt) return;
0114
0115 qt->SetStartPage(std::string("<table width='100%'><tr><td width='50%'></td><td><div ")+
0116 "style='color: rgb(140, 31, 31); font-size: xx-large; font-family: Garamond, serif; "+
0117 "padding-bottom: 0px; font-weight: normal'>GORAD "+
0118 "</div></td></td></tr></table>"+
0119 "<p> </p>"+
0120 "<div><dl>"+
0121 "<dd><b>Gorad (Geant4 Open-source Radiation Analysis and Design) is meant to be "+
0122 "a turn-key application for radiation analysis and spacecraft design "+
0123 "built on top of Geant4. Simulation geometry should be provided in the form of GDML. "+
0124 "Gorad is developed under the NASA JSC contract NNJ15HK11B."+
0125 "</dd></dl></div>"+
0126 "<p> </p>"+
0127 "<div style='background:#EEEEEE;'><b>Tooltips :</b><ul>"+
0128 "<li><b>Start an interactive run :</b><br />"+
0129 "/control/execute <i>run.mac</i><br />"+
0130 "/run/beamOn <i>number_of_events</i></li></ul></div>"+
0131 "<div style='background:#EEEEEE;'><b>Documentation :</b><ul>"+
0132 "<li><i>"+
0133 "<b>GORAD manual</b> and a sample Orion spacecraft shield geometry can be found at<br />"+
0134 "<a href='https://twiki.cern.ch/twiki/bin/view/Geant4/AdvancedExamplesGorad'>"+
0135 "https://twiki.cern.ch/twiki/bin/view/Geant4/AdvancedExamplesGorad"+
0136 "</a></i></li>"+
0137 "</ul></div>"
0138 );
0139 #endif
0140 }
0141