[1316] | 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 | #include "G4HadronicEPTestMessenger.hh" |
---|
| 28 | #include "G4UIdirectory.hh" |
---|
| 29 | #include "G4UIcmdWithAnInteger.hh" |
---|
| 30 | #include "G4UIcmdWithADouble.hh" |
---|
| 31 | #include "G4UIcmdWithADoubleAndUnit.hh" |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | G4HadronicEPTestMessenger::G4HadronicEPTestMessenger(G4HadronicProcessStore* theStore) |
---|
| 35 | :theProcessStore(theStore) |
---|
| 36 | { |
---|
| 37 | // Main directory for control of the e/p test |
---|
| 38 | heptstDirectory = new G4UIdirectory("/heptst/"); |
---|
| 39 | heptstDirectory->SetGuidance("Controls for the hadronic energy/momentum test"); |
---|
| 40 | |
---|
| 41 | // Command to set level of detail reported upon e/p non-conservation |
---|
| 42 | reportLvlCmd = new G4UIcmdWithAnInteger("/heptst/reportLevel",this); |
---|
| 43 | reportLvlCmd->SetGuidance("Set level of detail reported upon E/p non-conservation"); |
---|
| 44 | reportLvlCmd->SetGuidance(" 0 - (default) no reporting "); |
---|
| 45 | reportLvlCmd->SetGuidance(" 1 - report only when E/p not conserved "); |
---|
| 46 | reportLvlCmd->SetGuidance(" 2 - report regardless of E/p conservation "); |
---|
| 47 | reportLvlCmd->SetGuidance(" 3 - report only when E/p not conserved, with names, limits "); |
---|
| 48 | reportLvlCmd->SetGuidance(" 4 - report regardless of E/p conservation, with names, limits "); |
---|
| 49 | reportLvlCmd->SetParameterName("ReportLevel",true); |
---|
| 50 | reportLvlCmd->SetDefaultValue(0); |
---|
| 51 | reportLvlCmd->SetRange("ReportLevel >= 0 && ReportLevel < 5"); |
---|
| 52 | |
---|
| 53 | // Set the absolute energy non-conservation level for the process |
---|
| 54 | procAbsLvlCmd = new G4UIcmdWithADoubleAndUnit("/heptst/processAbsLevel",this); |
---|
| 55 | procAbsLvlCmd->SetGuidance("Set absolute energy level (with unit) of allowed energy non-conservation"); |
---|
| 56 | procAbsLvlCmd->SetParameterName("ProcessAbsLevel",true); |
---|
| 57 | procAbsLvlCmd->SetDefaultValue(-1.0); |
---|
| 58 | procAbsLvlCmd->SetUnitCategory("Energy"); |
---|
| 59 | |
---|
| 60 | // Set the relative energy non-conservation level for the process |
---|
| 61 | procRelLvlCmd = new G4UIcmdWithADouble("/heptst/processRelLevel",this); |
---|
| 62 | procRelLvlCmd->SetGuidance("Set relative level of allowed energy non-conservation"); |
---|
| 63 | procRelLvlCmd->SetParameterName("ProcessRelLevel",true); |
---|
| 64 | procRelLvlCmd->SetDefaultValue(-1.0); |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | G4HadronicEPTestMessenger::~G4HadronicEPTestMessenger() |
---|
| 69 | { |
---|
| 70 | delete heptstDirectory; |
---|
| 71 | delete reportLvlCmd; |
---|
| 72 | delete procAbsLvlCmd; |
---|
| 73 | delete procRelLvlCmd; |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | void G4HadronicEPTestMessenger::SetNewValue(G4UIcommand* command, G4String newValue) |
---|
| 78 | { |
---|
| 79 | if (command==reportLvlCmd) { |
---|
| 80 | theProcessStore->SetEpReportLevel(reportLvlCmd->GetNewIntValue(newValue) ); |
---|
| 81 | |
---|
| 82 | } else if(command==procRelLvlCmd) { |
---|
| 83 | // G4double absval = theHadronicProcess->GetEnergyMomentumCheckLevels().second; |
---|
| 84 | theProcessStore->SetProcessRelLevel(procRelLvlCmd->GetNewDoubleValue(newValue) ); |
---|
| 85 | } else if(command==procAbsLvlCmd) { |
---|
| 86 | // G4double relval = theHadronicProcess->GetEnergyMomentumCheckLevels().first; |
---|
| 87 | theProcessStore->SetProcessAbsLevel(procAbsLvlCmd->GetNewDoubleValue(newValue) ); |
---|
| 88 | } |
---|
| 89 | } |
---|