Warning, file /geant4/examples/advanced/STCyclotron/src/STCyclotronRunAction.cc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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 #include "STCyclotronRunAction.hh"
0031 #include "STCyclotronRunActionMessenger.hh"
0032 #include "STCyclotronPrimaryGeneratorAction.hh"
0033 #include "STCyclotronSensitiveTarget.hh"
0034 #include "STCyclotronRun.hh"
0035 #include "STCyclotronDetectorConstruction.hh"
0036 #include "G4AnalysisManager.hh"
0037 #include "G4GeneralParticleSource.hh"
0038 #include "G4UserRunAction.hh"
0039 #include "G4Run.hh"
0040 #include "G4RunManager.hh"
0041 #include "G4LogicalVolumeStore.hh"
0042 #include "G4LogicalVolume.hh"
0043 #include "G4UnitsTable.hh"
0044 #include "G4PhysicalConstants.hh"
0045 #include "G4SystemOfUnits.hh"
0046
0047 #include <iomanip>
0048 #include <cmath>
0049
0050
0051 STCyclotronRunAction::STCyclotronRunAction(STCyclotronDetectorConstruction*)
0052 {
0053
0054
0055
0056
0057
0058 fMessenger = new STCyclotronRunActionMessenger(this);
0059 fIrradiationTime = 3.;
0060 fIn = 185;
0061 fOut = 188;
0062
0063
0064
0065
0066
0067 auto analysisManager = G4AnalysisManager::Instance();
0068 analysisManager->SetDefaultFileType("root");
0069 G4cout << "Using " << analysisManager->GetType() << G4endl;
0070 analysisManager->SetVerboseLevel(1);
0071
0072
0073
0074 analysisManager->CreateH1("H10","Energy of the primary particles when reaching the target (MeV)", 500,12.,19.);
0075 analysisManager->CreateH1("H11","Energy of the primary particle when reaching the foil (MeV)",100,12.,19.);
0076 analysisManager->CreateH1("H12","Energy spectrum of primaries going out from the target (MeV)", 100, 0., 19.);
0077 analysisManager->CreateH1("H13","Energy of the primary particle when going out from the foil (MeV)",100,0,19);
0078 analysisManager->CreateH1("H14","Depth of isotope creation in the target (mm)", 300, fIn, fOut);
0079 analysisManager->CreateH1("H15","Energy spectrum of the positrons created in the target by the beam and secondaries (MeV)", 100, 0., 17.);
0080 analysisManager->CreateH1("H16","Energy spectrum of the electrons created in the target by the beam and secondaries (MeV)", 100, 0., 17.);
0081 analysisManager->CreateH1("H17","Energy spectrum of the gammas created in the target by the beam and secondaries (MeV)", 100, 0., 17.);
0082 analysisManager->CreateH1("H18","Energy spectrum of the neutrons created in the target by the beam and secondaries (MeV)", 100, 0., 17.);
0083 analysisManager->CreateH1("H19","Energy spectrum of the positrons created in the target by the decay (MeV)", 100, 0., 17.);
0084 analysisManager->CreateH1("H110","Energy spectrum of the electrons created in the target by the decay (MeV)", 100, 0., 17.);
0085 analysisManager->CreateH1("H111","Energy spectrum of the gammas created in the target (MeV) by the decay", 100, 0., 17.);
0086 analysisManager->CreateH1("H112","Energy spectrum of the neutrons created in the target (MeV) by the decay", 100, 0., 17.);
0087 analysisManager->CreateH1("H113","Energy spectrum of the nu_e created in the target (MeV) by the decay", 100, 0., 17.);
0088 analysisManager->CreateH1("H114","Energy spectrum of the anti_nu_e created in the target (MeV) by the decay", 100, 0., 17.);
0089
0090
0091
0092 analysisManager->CreateH2("H20", "Beam intensity before hiting the target (mm)",100, -7.5 , 7.5, 100, -7.5, 7.5);
0093 analysisManager->CreateH2("H21", "Beam intensity before hiting the foil (mm)",100, -7.5 , 7.5, 100, -7.5, 7.5);
0094 analysisManager->CreateH2("H22", "Radioisotopes produced", 11, 24.5, 35.5, 20, 54.5, 74.5);
0095 analysisManager->CreateH2("H23", "Energy (MeV) = f(depth (mm))", 100, fIn, fOut,100,0.,16.);
0096 analysisManager->CreateH2("H24", "Beam intensity going out from the target (mm)",100, -7.5 , 7.5, 100, -7.5, 7.5);
0097 analysisManager->CreateH2("H25", "Beam intensity going out from the foil (mm)", 100, -7.5 , 7.5, 100, -7.5, 7.5);
0098 }
0099
0100 STCyclotronRunAction::~STCyclotronRunAction()
0101 {
0102 delete fMessenger;
0103 }
0104
0105 G4Run* STCyclotronRunAction::GenerateRun()
0106 {
0107 fRun = new STCyclotronRun();
0108 return fRun;
0109 }
0110
0111 void STCyclotronRunAction::BeginOfRunAction(const G4Run*)
0112 {
0113
0114
0115
0116 G4RunManager::GetRunManager()->SetRandomNumberStore(false);
0117 auto analysisManager = G4AnalysisManager::Instance();
0118 analysisManager->OpenFile("SolidTargetCyclotron");
0119 }
0120
0121 void STCyclotronRunAction::EndOfRunAction(const G4Run*)
0122 {
0123 if(isMaster)fRun->EndOfRun(fIrradiationTime);
0124 auto analysisManager = G4AnalysisManager::Instance();
0125 analysisManager->Write();
0126 analysisManager->CloseFile();
0127
0128 }
0129
0130 void STCyclotronRunAction::SetIrradiationTime(G4double time)
0131 {
0132 if(fIrradiationTime != time){
0133 fIrradiationTime = time;
0134 G4cout << "The time of irradiation is now the following : " << fIrradiationTime << " hour(s)." << G4endl;
0135 }
0136 }