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10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

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