Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // >> 26 26 ////////////////////////////////////////////// 27 //////////////////////////////////////////////////////////////////////////////// 27 // << 28 // // 28 // GEANT4 Class source file << 29 // File: G4RadioactiveDecayMessenger.cc // 29 // << 30 // Author: D.H. Wright (SLAC) // 30 // G4RadioactiveDecayMessenger << 31 // Date: 29 August 2017 // 31 // Author: D.H. Wright (SLAC) << 32 // Description: messenger class for the non-biased version of // 32 // Date: 29 August 2017 << 33 // G4RadioactiveDecay. Based on the code of F. Lei and // 33 // << 34 // P.R. Truscott. // 34 // Based on the code of F. Lei and P.R. Trusc << 35 // // 35 // << 36 ////////////////////////////////////////////// 36 //////////////////////////////////////////////////////////////////////////////// 37 37 38 #include "G4RadioactiveDecayMessenger.hh" 38 #include "G4RadioactiveDecayMessenger.hh" 39 #include "G4NuclearLevelData.hh" 39 #include "G4NuclearLevelData.hh" 40 #include "G4VRadioactiveDecay.hh" << 41 << 42 #include <sstream> 40 #include <sstream> 43 #include "G4HadronicException.hh" 41 #include "G4HadronicException.hh" 44 42 45 43 46 G4RadioactiveDecayMessenger::G4RadioactiveDeca << 44 G4RadioactiveDecayMessenger::G4RadioactiveDecayMessenger 47 :theRadDecay(ptr) << 45 (G4RadioactiveDecay* theRadioactiveDecayContainer1) >> 46 :theRadioactiveDecayContainer(theRadioactiveDecayContainer1) 48 { 47 { 49 rdmDirectory = new G4UIdirectory("/process/h 48 rdmDirectory = new G4UIdirectory("/process/had/rdm/"); 50 rdmDirectory->SetGuidance("Controls for the 49 rdmDirectory->SetGuidance("Controls for the Radioactive Decay Module."); 51 50 52 // Command to define the limits on nucleus t 51 // Command to define the limits on nucleus the RDM will treat. 53 nucleuslimitsCmd = new G4UIcmdWithNucleusLim 52 nucleuslimitsCmd = new G4UIcmdWithNucleusLimits("/process/had/rdm/nucleusLimits",this); 54 nucleuslimitsCmd->SetGuidance("Set the atomi 53 nucleuslimitsCmd->SetGuidance("Set the atomic weight and number limits for the RDM."); 55 nucleuslimitsCmd->SetParameterName("AMin","A 54 nucleuslimitsCmd->SetParameterName("AMin","AMax","ZMin","ZMax",true); 56 55 57 // Select a logical volume for RDM 56 // Select a logical volume for RDM 58 avolumeCmd = new G4UIcmdWithAString("/proces 57 avolumeCmd = new G4UIcmdWithAString("/process/had/rdm/selectVolume",this); 59 avolumeCmd->SetGuidance("Supply a logical vo 58 avolumeCmd->SetGuidance("Supply a logical volumes name to add it to the RDM apply list"); 60 avolumeCmd->SetParameterName("AVolume",false 59 avolumeCmd->SetParameterName("AVolume",false); 61 60 62 // De-select a logical volume for RDM 61 // De-select a logical volume for RDM 63 deavolumeCmd = new G4UIcmdWithAString("/proc 62 deavolumeCmd = new G4UIcmdWithAString("/process/had/rdm/deselectVolume",this); 64 deavolumeCmd->SetGuidance("Supply a logical 63 deavolumeCmd->SetGuidance("Supply a logical volumes name to remove it from the RDM apply list"); 65 deavolumeCmd->SetParameterName("AVolume",fal 64 deavolumeCmd->SetParameterName("AVolume",false); 66 65 67 // Select all logical volumes for RDM 66 // Select all logical volumes for RDM 68 allvolumesCmd = new G4UIcmdWithoutParameter( 67 allvolumesCmd = new G4UIcmdWithoutParameter("/process/had/rdm/allVolumes",this); 69 allvolumesCmd->SetGuidance(" apply RDM to al 68 allvolumesCmd->SetGuidance(" apply RDM to all logical volumes. No parameter required."); 70 // allvolumeCmd->SetParameterName("AddAVolu 69 // allvolumeCmd->SetParameterName("AddAVolume",true); 71 70 72 // De-select all logical volumes for RDM 71 // De-select all logical volumes for RDM 73 deallvolumesCmd = new G4UIcmdWithoutParamete 72 deallvolumesCmd = new G4UIcmdWithoutParameter("/process/had/rdm/noVolumes",this); 74 deallvolumesCmd->SetGuidance(" RDM is not ap 73 deallvolumesCmd->SetGuidance(" RDM is not applied to any logical volumes"); 75 // deallvolumesCmd->SetParameterName("Remov 74 // deallvolumesCmd->SetParameterName("RemoveAVolume",true); 76 75 77 // Command to invoke atomic relaxation or no 76 // Command to invoke atomic relaxation or not 78 armCmd = new G4UIcmdWithABool("/process/had/ 77 armCmd = new G4UIcmdWithABool("/process/had/rdm/applyARM",this); 79 armCmd->SetGuidance("True: ARM is applied; f 78 armCmd->SetGuidance("True: ARM is applied; false: no"); 80 armCmd->SetParameterName("ApplyARM",true); 79 armCmd->SetParameterName("ApplyARM",true); 81 armCmd->SetDefaultValue(true); 80 armCmd->SetDefaultValue(true); 82 //armCmd->AvailableForStates(G4State_PreInit 81 //armCmd->AvailableForStates(G4State_PreInit); 83 82 84 // Command to set the directional bias (coll 83 // Command to set the directional bias (collimation) vector 85 colldirCmd = new G4UIcmdWith3Vector("/proces 84 colldirCmd = new G4UIcmdWith3Vector("/process/had/rdm/decayDirection",this); 86 colldirCmd->SetGuidance("Supply the directio 85 colldirCmd->SetGuidance("Supply the direction vector for decay products"); 87 colldirCmd->SetParameterName("X","Y","Z",fal 86 colldirCmd->SetParameterName("X","Y","Z",false); 88 87 89 // Command to set the directional bias (coll 88 // Command to set the directional bias (collimation) half angle ("cone") 90 collangleCmd = new G4UIcmdWithADoubleAndUnit 89 collangleCmd = new G4UIcmdWithADoubleAndUnit("/process/had/rdm/decayHalfAngle",this); 91 collangleCmd->SetGuidance("Supply maximum an 90 collangleCmd->SetGuidance("Supply maximum angle from direction vector for decay products"); 92 collangleCmd->SetParameterName("HalfAngle",f 91 collangleCmd->SetParameterName("HalfAngle",false); 93 collangleCmd->SetUnitCategory("Angle"); 92 collangleCmd->SetUnitCategory("Angle"); 94 93 95 // This command setup the verbose level of r 94 // This command setup the verbose level of radioactive decay 96 verboseCmd = new G4UIcmdWithAnInteger("/proc 95 verboseCmd = new G4UIcmdWithAnInteger("/process/had/rdm/verbose",this); 97 verboseCmd->SetGuidance("Set verbose level: 96 verboseCmd->SetGuidance("Set verbose level: 0, 1, 2 or 3"); 98 verboseCmd->SetParameterName("VerboseLevel", 97 verboseCmd->SetParameterName("VerboseLevel",true); 99 verboseCmd->SetDefaultValue(1); 98 verboseCmd->SetDefaultValue(1); 100 verboseCmd->SetRange("VerboseLevel>=0"); 99 verboseCmd->SetRange("VerboseLevel>=0"); 101 100 102 // Use a user-defined decay datafile for a g 101 // Use a user-defined decay datafile for a given isotope 103 userDecayDataCmd = new G4UIcommand("/process 102 userDecayDataCmd = new G4UIcommand("/process/had/rdm/setRadioactiveDecayFile",this); 104 userDecayDataCmd->SetGuidance("Supply user-d 103 userDecayDataCmd->SetGuidance("Supply user-defined radioactive decay data file"); 105 G4UIparameter* Z_para= new G4UIparameter("Z_ 104 G4UIparameter* Z_para= new G4UIparameter("Z_isotope",'i',true); 106 Z_para->SetParameterRange("Z_isotope > 0"); 105 Z_para->SetParameterRange("Z_isotope > 0"); 107 Z_para->SetGuidance("Z: Charge number of iso 106 Z_para->SetGuidance("Z: Charge number of isotope"); 108 G4UIparameter* A_para= new G4UIparameter("A_ 107 G4UIparameter* A_para= new G4UIparameter("A_isotope",'i',true); 109 A_para->SetParameterRange("A_isotope > 1"); 108 A_para->SetParameterRange("A_isotope > 1"); 110 A_para->SetGuidance("A: mass number of isoto 109 A_para->SetGuidance("A: mass number of isotope"); 111 G4UIparameter* FileName_para= new G4UIparame 110 G4UIparameter* FileName_para= new G4UIparameter("file_name",'s',true); 112 FileName_para->SetGuidance("Name of the user 111 FileName_para->SetGuidance("Name of the user data file"); 113 userDecayDataCmd->SetParameter(Z_para); 112 userDecayDataCmd->SetParameter(Z_para); 114 userDecayDataCmd->SetParameter(A_para); 113 userDecayDataCmd->SetParameter(A_para); 115 userDecayDataCmd->SetParameter(FileName_para 114 userDecayDataCmd->SetParameter(FileName_para); 116 115 117 // Use a user-defined evaporation data file 116 // Use a user-defined evaporation data file for a given isotope 118 userEvaporationDataCmd = new G4UIcommand("/p 117 userEvaporationDataCmd = new G4UIcommand("/process/had/rdm/setPhotoEvaporationFile",this); 119 userEvaporationDataCmd->SetGuidance("Supply 118 userEvaporationDataCmd->SetGuidance("Supply user-defined photon evaporation data file"); 120 G4UIparameter* Zpara= new G4UIparameter("Z_i 119 G4UIparameter* Zpara= new G4UIparameter("Z_isotope",'i',true); 121 Zpara->SetParameterRange("Z_isotope > 0"); 120 Zpara->SetParameterRange("Z_isotope > 0"); 122 Zpara->SetGuidance("Z: Charge number of isot 121 Zpara->SetGuidance("Z: Charge number of isotope"); 123 G4UIparameter* Apara= new G4UIparameter("A_i 122 G4UIparameter* Apara= new G4UIparameter("A_isotope",'i',true); 124 Apara->SetParameterRange("A_isotope > 1"); 123 Apara->SetParameterRange("A_isotope > 1"); 125 Apara->SetGuidance("A: mass number of isotop 124 Apara->SetGuidance("A: mass number of isotope"); 126 G4UIparameter* FileNamepara= new G4UIparamet 125 G4UIparameter* FileNamepara= new G4UIparameter("file_name",'s',true); 127 FileNamepara->SetGuidance("Name of the user 126 FileNamepara->SetGuidance("Name of the user data file"); 128 userEvaporationDataCmd->SetParameter(Zpara); 127 userEvaporationDataCmd->SetParameter(Zpara); 129 userEvaporationDataCmd->SetParameter(Apara); 128 userEvaporationDataCmd->SetParameter(Apara); 130 userEvaporationDataCmd->SetParameter(FileNam 129 userEvaporationDataCmd->SetParameter(FileNamepara); 131 130 132 // Command to set the threshold for very lon 131 // Command to set the threshold for very long decay time (i.e. radioactive 133 // decays of nuclides at rest happening late 132 // decays of nuclides at rest happening later than this threshold are ignored) 134 thresholdForVeryLongDecayTimeCmd = new G4UIc 133 thresholdForVeryLongDecayTimeCmd = new G4UIcmdWithADoubleAndUnit("/process/had/rdm/thresholdForVeryLongDecayTime",this); 135 thresholdForVeryLongDecayTimeCmd->SetGuidanc 134 thresholdForVeryLongDecayTimeCmd->SetGuidance("Ignore decays at rest of nuclides happening after this time threshold"); 136 thresholdForVeryLongDecayTimeCmd->SetParamet 135 thresholdForVeryLongDecayTimeCmd->SetParameterName("ThresholdForVeryLongDecayTime",false); 137 thresholdForVeryLongDecayTimeCmd->SetUnitCat 136 thresholdForVeryLongDecayTimeCmd->SetUnitCategory("Time"); 138 } 137 } 139 138 140 139 141 G4RadioactiveDecayMessenger::~G4RadioactiveDec 140 G4RadioactiveDecayMessenger::~G4RadioactiveDecayMessenger () 142 { 141 { 143 delete rdmDirectory; 142 delete rdmDirectory; 144 delete nucleuslimitsCmd; 143 delete nucleuslimitsCmd; 145 delete verboseCmd; 144 delete verboseCmd; 146 delete avolumeCmd; 145 delete avolumeCmd; 147 delete deavolumeCmd; 146 delete deavolumeCmd; 148 delete allvolumesCmd; 147 delete allvolumesCmd; 149 delete deallvolumesCmd; 148 delete deallvolumesCmd; 150 delete armCmd; 149 delete armCmd; 151 delete userDecayDataCmd; 150 delete userDecayDataCmd; 152 delete userEvaporationDataCmd; 151 delete userEvaporationDataCmd; 153 delete colldirCmd; 152 delete colldirCmd; 154 delete collangleCmd; 153 delete collangleCmd; 155 delete thresholdForVeryLongDecayTimeCmd; 154 delete thresholdForVeryLongDecayTimeCmd; 156 } 155 } 157 156 158 157 159 void 158 void 160 G4RadioactiveDecayMessenger::SetNewValue(G4UIc 159 G4RadioactiveDecayMessenger::SetNewValue(G4UIcommand *command, G4String newValues) 161 { 160 { 162 if ( command == nucleuslimitsCmd ) { 161 if ( command == nucleuslimitsCmd ) { 163 theRadDecay-> << 162 theRadioactiveDecayContainer-> 164 SetNucleusLimits( nucleuslimitsCmd->GetNew 163 SetNucleusLimits( nucleuslimitsCmd->GetNewNucleusLimitsValue( newValues ) ); 165 } else if ( command == avolumeCmd ) { 164 } else if ( command == avolumeCmd ) { 166 theRadDecay->SelectAVolume( newValues ); << 165 theRadioactiveDecayContainer->SelectAVolume( newValues ); 167 } else if ( command == deavolumeCmd ) { 166 } else if ( command == deavolumeCmd ) { 168 theRadDecay->DeselectAVolume( newValues ); << 167 theRadioactiveDecayContainer->DeselectAVolume( newValues ); 169 } else if ( command == allvolumesCmd ) { 168 } else if ( command == allvolumesCmd ) { 170 theRadDecay->SelectAllVolumes(); << 169 theRadioactiveDecayContainer->SelectAllVolumes(); 171 } else if ( command == deallvolumesCmd ) { 170 } else if ( command == deallvolumesCmd ) { 172 theRadDecay->DeselectAllVolumes(); << 171 theRadioactiveDecayContainer->DeselectAllVolumes(); 173 } else if (command == verboseCmd) { 172 } else if (command == verboseCmd) { 174 theRadDecay->SetVerboseLevel(verboseCmd->G << 173 theRadioactiveDecayContainer->SetVerboseLevel(verboseCmd->GetNewIntValue(newValues) ); 175 } else if (command == armCmd) { 174 } else if (command == armCmd) { 176 theRadDecay->SetARM(armCmd->GetNewBoolValu << 175 theRadioactiveDecayContainer->SetARM(armCmd->GetNewBoolValue(newValues) ); 177 } else if ( command == userDecayDataCmd ) { 176 } else if ( command == userDecayDataCmd ) { 178 G4int Z,A; 177 G4int Z,A; 179 G4String file_name; 178 G4String file_name; 180 const char* nv = (const char*)newValues; 179 const char* nv = (const char*)newValues; 181 std::istringstream is(nv); 180 std::istringstream is(nv); 182 is >> Z >> A >> file_name; 181 is >> Z >> A >> file_name; 183 theRadDecay->AddUserDecayDataFile(Z,A,file << 182 theRadioactiveDecayContainer->AddUserDecayDataFile(Z,A,file_name); 184 } else if ( command == userEvaporationDataCm 183 } else if ( command == userEvaporationDataCmd ) { 185 G4int Z,A; 184 G4int Z,A; 186 G4String file_name; 185 G4String file_name; 187 const char* nv = (const char*)newValues; 186 const char* nv = (const char*)newValues; 188 std::istringstream is(nv); 187 std::istringstream is(nv); 189 is >> Z >> A >> file_name; 188 is >> Z >> A >> file_name; 190 G4NuclearLevelData::GetInstance()->AddPriv 189 G4NuclearLevelData::GetInstance()->AddPrivateData(Z,A,file_name); 191 } else if ( command == colldirCmd ) { 190 } else if ( command == colldirCmd ) { 192 theRadDecay->SetDecayDirection( colldirCmd << 191 theRadioactiveDecayContainer->SetDecayDirection( colldirCmd->GetNew3VectorValue( newValues ) ); 193 } else if ( command == collangleCmd ) { 192 } else if ( command == collangleCmd ) { 194 theRadDecay->SetDecayHalfAngle( collangleC << 193 theRadioactiveDecayContainer->SetDecayHalfAngle( collangleCmd->GetNewDoubleValue( newValues ) ); 195 } else if (command == thresholdForVeryLongDe 194 } else if (command == thresholdForVeryLongDecayTimeCmd) { 196 theRadDecay->SetThresholdForVeryLongDecayT << 195 theRadioactiveDecayContainer->SetThresholdForVeryLongDecayTime(thresholdForVeryLongDecayTimeCmd->GetNewDoubleValue(newValues) ); 197 } 196 } 198 } 197 } 199 198 200 199