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