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 >> 76 // Command to invoke internal conversion or not >> 77 icmCmd = new G4UIcmdWithABool("/process/had/rdm/applyICM",this); >> 78 icmCmd->SetGuidance("Command not active; kept for backward compatibility."); >> 79 icmCmd->SetGuidance("Internal conversion is always turned on."); >> 80 icmCmd->SetParameterName("ApplyICM",true); >> 81 icmCmd->SetDefaultValue(true); >> 82 77 // Command to invoke atomic relaxation or no 83 // Command to invoke atomic relaxation or not 78 armCmd = new G4UIcmdWithABool("/process/had/ 84 armCmd = new G4UIcmdWithABool("/process/had/rdm/applyARM",this); 79 armCmd->SetGuidance("True: ARM is applied; f 85 armCmd->SetGuidance("True: ARM is applied; false: no"); 80 armCmd->SetParameterName("ApplyARM",true); 86 armCmd->SetParameterName("ApplyARM",true); 81 armCmd->SetDefaultValue(true); 87 armCmd->SetDefaultValue(true); 82 //armCmd->AvailableForStates(G4State_PreInit 88 //armCmd->AvailableForStates(G4State_PreInit); 83 89 84 // Command to set the directional bias (coll 90 // Command to set the directional bias (collimation) vector 85 colldirCmd = new G4UIcmdWith3Vector("/proces 91 colldirCmd = new G4UIcmdWith3Vector("/process/had/rdm/decayDirection",this); 86 colldirCmd->SetGuidance("Supply the directio 92 colldirCmd->SetGuidance("Supply the direction vector for decay products"); 87 colldirCmd->SetParameterName("X","Y","Z",fal 93 colldirCmd->SetParameterName("X","Y","Z",false); 88 94 89 // Command to set the directional bias (coll 95 // Command to set the directional bias (collimation) half angle ("cone") 90 collangleCmd = new G4UIcmdWithADoubleAndUnit 96 collangleCmd = new G4UIcmdWithADoubleAndUnit("/process/had/rdm/decayHalfAngle",this); 91 collangleCmd->SetGuidance("Supply maximum an 97 collangleCmd->SetGuidance("Supply maximum angle from direction vector for decay products"); 92 collangleCmd->SetParameterName("HalfAngle",f 98 collangleCmd->SetParameterName("HalfAngle",false); 93 collangleCmd->SetUnitCategory("Angle"); 99 collangleCmd->SetUnitCategory("Angle"); 94 100 95 // This command setup the verbose level of r 101 // This command setup the verbose level of radioactive decay 96 verboseCmd = new G4UIcmdWithAnInteger("/proc 102 verboseCmd = new G4UIcmdWithAnInteger("/process/had/rdm/verbose",this); 97 verboseCmd->SetGuidance("Set verbose level: 103 verboseCmd->SetGuidance("Set verbose level: 0, 1, 2 or 3"); 98 verboseCmd->SetParameterName("VerboseLevel", 104 verboseCmd->SetParameterName("VerboseLevel",true); 99 verboseCmd->SetDefaultValue(1); 105 verboseCmd->SetDefaultValue(1); 100 verboseCmd->SetRange("VerboseLevel>=0"); 106 verboseCmd->SetRange("VerboseLevel>=0"); 101 107 102 // Use a user-defined decay datafile for a g 108 // Use a user-defined decay datafile for a given isotope 103 userDecayDataCmd = new G4UIcommand("/process 109 userDecayDataCmd = new G4UIcommand("/process/had/rdm/setRadioactiveDecayFile",this); 104 userDecayDataCmd->SetGuidance("Supply user-d 110 userDecayDataCmd->SetGuidance("Supply user-defined radioactive decay data file"); 105 G4UIparameter* Z_para= new G4UIparameter("Z_ 111 G4UIparameter* Z_para= new G4UIparameter("Z_isotope",'i',true); 106 Z_para->SetParameterRange("Z_isotope > 0"); 112 Z_para->SetParameterRange("Z_isotope > 0"); 107 Z_para->SetGuidance("Z: Charge number of iso 113 Z_para->SetGuidance("Z: Charge number of isotope"); 108 G4UIparameter* A_para= new G4UIparameter("A_ 114 G4UIparameter* A_para= new G4UIparameter("A_isotope",'i',true); 109 A_para->SetParameterRange("A_isotope > 1"); 115 A_para->SetParameterRange("A_isotope > 1"); 110 A_para->SetGuidance("A: mass number of isoto 116 A_para->SetGuidance("A: mass number of isotope"); 111 G4UIparameter* FileName_para= new G4UIparame 117 G4UIparameter* FileName_para= new G4UIparameter("file_name",'s',true); 112 FileName_para->SetGuidance("Name of the user 118 FileName_para->SetGuidance("Name of the user data file"); 113 userDecayDataCmd->SetParameter(Z_para); 119 userDecayDataCmd->SetParameter(Z_para); 114 userDecayDataCmd->SetParameter(A_para); 120 userDecayDataCmd->SetParameter(A_para); 115 userDecayDataCmd->SetParameter(FileName_para 121 userDecayDataCmd->SetParameter(FileName_para); 116 122 117 // Use a user-defined evaporation data file 123 // Use a user-defined evaporation data file for a given isotope 118 userEvaporationDataCmd = new G4UIcommand("/p 124 userEvaporationDataCmd = new G4UIcommand("/process/had/rdm/setPhotoEvaporationFile",this); 119 userEvaporationDataCmd->SetGuidance("Supply 125 userEvaporationDataCmd->SetGuidance("Supply user-defined photon evaporation data file"); 120 G4UIparameter* Zpara= new G4UIparameter("Z_i 126 G4UIparameter* Zpara= new G4UIparameter("Z_isotope",'i',true); 121 Zpara->SetParameterRange("Z_isotope > 0"); 127 Zpara->SetParameterRange("Z_isotope > 0"); 122 Zpara->SetGuidance("Z: Charge number of isot 128 Zpara->SetGuidance("Z: Charge number of isotope"); 123 G4UIparameter* Apara= new G4UIparameter("A_i 129 G4UIparameter* Apara= new G4UIparameter("A_isotope",'i',true); 124 Apara->SetParameterRange("A_isotope > 1"); 130 Apara->SetParameterRange("A_isotope > 1"); 125 Apara->SetGuidance("A: mass number of isotop 131 Apara->SetGuidance("A: mass number of isotope"); 126 G4UIparameter* FileNamepara= new G4UIparamet 132 G4UIparameter* FileNamepara= new G4UIparameter("file_name",'s',true); 127 FileNamepara->SetGuidance("Name of the user 133 FileNamepara->SetGuidance("Name of the user data file"); 128 userEvaporationDataCmd->SetParameter(Zpara); 134 userEvaporationDataCmd->SetParameter(Zpara); 129 userEvaporationDataCmd->SetParameter(Apara); 135 userEvaporationDataCmd->SetParameter(Apara); 130 userEvaporationDataCmd->SetParameter(FileNam 136 userEvaporationDataCmd->SetParameter(FileNamepara); 131 137 132 // Command to set the threshold for very lon 138 // Command to set the threshold for very long decay time (i.e. radioactive 133 // decays of nuclides at rest happening late 139 // decays of nuclides at rest happening later than this threshold are ignored) 134 thresholdForVeryLongDecayTimeCmd = new G4UIc 140 thresholdForVeryLongDecayTimeCmd = new G4UIcmdWithADoubleAndUnit("/process/had/rdm/thresholdForVeryLongDecayTime",this); 135 thresholdForVeryLongDecayTimeCmd->SetGuidanc 141 thresholdForVeryLongDecayTimeCmd->SetGuidance("Ignore decays at rest of nuclides happening after this time threshold"); 136 thresholdForVeryLongDecayTimeCmd->SetParamet 142 thresholdForVeryLongDecayTimeCmd->SetParameterName("ThresholdForVeryLongDecayTime",false); 137 thresholdForVeryLongDecayTimeCmd->SetUnitCat 143 thresholdForVeryLongDecayTimeCmd->SetUnitCategory("Time"); 138 } 144 } 139 145 140 146 141 G4RadioactiveDecayMessenger::~G4RadioactiveDec 147 G4RadioactiveDecayMessenger::~G4RadioactiveDecayMessenger () 142 { 148 { 143 delete rdmDirectory; 149 delete rdmDirectory; 144 delete nucleuslimitsCmd; 150 delete nucleuslimitsCmd; 145 delete verboseCmd; 151 delete verboseCmd; 146 delete avolumeCmd; 152 delete avolumeCmd; 147 delete deavolumeCmd; 153 delete deavolumeCmd; 148 delete allvolumesCmd; 154 delete allvolumesCmd; 149 delete deallvolumesCmd; 155 delete deallvolumesCmd; >> 156 delete icmCmd; 150 delete armCmd; 157 delete armCmd; 151 delete userDecayDataCmd; 158 delete userDecayDataCmd; 152 delete userEvaporationDataCmd; 159 delete userEvaporationDataCmd; 153 delete colldirCmd; 160 delete colldirCmd; 154 delete collangleCmd; 161 delete collangleCmd; 155 delete thresholdForVeryLongDecayTimeCmd; 162 delete thresholdForVeryLongDecayTimeCmd; 156 } 163 } 157 164 158 165 159 void 166 void 160 G4RadioactiveDecayMessenger::SetNewValue(G4UIc 167 G4RadioactiveDecayMessenger::SetNewValue(G4UIcommand *command, G4String newValues) 161 { 168 { 162 if ( command == nucleuslimitsCmd ) { 169 if ( command == nucleuslimitsCmd ) { 163 theRadDecay-> << 170 theRadioactiveDecayContainer-> 164 SetNucleusLimits( nucleuslimitsCmd->GetNew 171 SetNucleusLimits( nucleuslimitsCmd->GetNewNucleusLimitsValue( newValues ) ); 165 } else if ( command == avolumeCmd ) { 172 } else if ( command == avolumeCmd ) { 166 theRadDecay->SelectAVolume( newValues ); << 173 theRadioactiveDecayContainer->SelectAVolume( newValues ); 167 } else if ( command == deavolumeCmd ) { 174 } else if ( command == deavolumeCmd ) { 168 theRadDecay->DeselectAVolume( newValues ); << 175 theRadioactiveDecayContainer->DeselectAVolume( newValues ); 169 } else if ( command == allvolumesCmd ) { 176 } else if ( command == allvolumesCmd ) { 170 theRadDecay->SelectAllVolumes(); << 177 theRadioactiveDecayContainer->SelectAllVolumes(); 171 } else if ( command == deallvolumesCmd ) { 178 } else if ( command == deallvolumesCmd ) { 172 theRadDecay->DeselectAllVolumes(); << 179 theRadioactiveDecayContainer->DeselectAllVolumes(); 173 } else if (command == verboseCmd) { << 180 } else if ( command == verboseCmd ) { 174 theRadDecay->SetVerboseLevel(verboseCmd->G << 181 theRadioactiveDecayContainer->SetVerboseLevel( verboseCmd->GetNewIntValue( newValues ) ); 175 } else if (command == armCmd) { << 182 } else if ( command == icmCmd ) { 176 theRadDecay->SetARM(armCmd->GetNewBoolValu << 183 theRadioactiveDecayContainer->SetICM( icmCmd->GetNewBoolValue( newValues ) ); >> 184 } else if ( command == armCmd ) { >> 185 theRadioactiveDecayContainer->SetARM( armCmd->GetNewBoolValue( newValues ) ); 177 } else if ( command == userDecayDataCmd ) { 186 } else if ( command == userDecayDataCmd ) { 178 G4int Z,A; 187 G4int Z,A; 179 G4String file_name; 188 G4String file_name; 180 const char* nv = (const char*)newValues; 189 const char* nv = (const char*)newValues; 181 std::istringstream is(nv); 190 std::istringstream is(nv); 182 is >> Z >> A >> file_name; 191 is >> Z >> A >> file_name; 183 theRadDecay->AddUserDecayDataFile(Z,A,file << 192 theRadioactiveDecayContainer->AddUserDecayDataFile(Z,A,file_name); 184 } else if ( command == userEvaporationDataCm 193 } else if ( command == userEvaporationDataCmd ) { 185 G4int Z,A; 194 G4int Z,A; 186 G4String file_name; 195 G4String file_name; 187 const char* nv = (const char*)newValues; 196 const char* nv = (const char*)newValues; 188 std::istringstream is(nv); 197 std::istringstream is(nv); 189 is >> Z >> A >> file_name; 198 is >> Z >> A >> file_name; 190 G4NuclearLevelData::GetInstance()->AddPriv 199 G4NuclearLevelData::GetInstance()->AddPrivateData(Z,A,file_name); 191 } else if ( command == colldirCmd ) { 200 } else if ( command == colldirCmd ) { 192 theRadDecay->SetDecayDirection( colldirCmd << 201 theRadioactiveDecayContainer->SetDecayDirection( colldirCmd->GetNew3VectorValue( newValues ) ); 193 } else if ( command == collangleCmd ) { 202 } else if ( command == collangleCmd ) { 194 theRadDecay->SetDecayHalfAngle( collangleC << 203 theRadioactiveDecayContainer->SetDecayHalfAngle( collangleCmd->GetNewDoubleValue( newValues ) ); 195 } else if (command == thresholdForVeryLongDe << 204 } else if ( command == thresholdForVeryLongDecayTimeCmd ) { 196 theRadDecay->SetThresholdForVeryLongDecayT << 205 theRadioactiveDecayContainer->SetThresholdForVeryLongDecayTime( thresholdForVeryLongDecayTimeCmd->GetNewDoubleValue( newValues ) ); 197 } 206 } 198 } 207 } 199 208 200 209