| 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 | // $Id: G4QMessenger.cc,v 1.1 2009/11/13 18:50:14 mkossov Exp $
|
|---|
| 27 | // GEANT4 tag $Name: geant4-09-03 $
|
|---|
| 28 | //
|
|---|
| 29 | //---------------------------------------------------------------------------
|
|---|
| 30 | //
|
|---|
| 31 | // ClassName: G4QMessenger
|
|---|
| 32 | //
|
|---|
| 33 | // Author: 2009 M. V. Kossov
|
|---|
| 34 | //
|
|---|
| 35 | // Modified:
|
|---|
| 36 | //
|
|---|
| 37 | //----------------------------------------------------------------------------
|
|---|
| 38 | //
|
|---|
| 39 |
|
|---|
| 40 | #include "G4QMessenger.hh"
|
|---|
| 41 | #include "G4QNeutrinoPhysics.hh"
|
|---|
| 42 | #include "G4QPhotoNuclearPhysics.hh"
|
|---|
| 43 |
|
|---|
| 44 | G4QMessenger::G4QMessenger()
|
|---|
| 45 | {
|
|---|
| 46 | rootDir = new G4UIdirectory("/CHIPS_physics/");
|
|---|
| 47 | rootDir->SetGuidance("messenger of the CHIPS processes");
|
|---|
| 48 | weakDir=0;
|
|---|
| 49 | photoDir=0;
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | G4QMessenger::~G4QMessenger()
|
|---|
| 53 | {
|
|---|
| 54 | delete rootDir;
|
|---|
| 55 | if(photoDir)
|
|---|
| 56 | {
|
|---|
| 57 | delete photoDir;
|
|---|
| 58 | delete theSynchR;
|
|---|
| 59 | delete minGamSR;
|
|---|
| 60 | delete theGamN;
|
|---|
| 61 | delete theEleN;
|
|---|
| 62 | delete theMuoN;
|
|---|
| 63 | delete theTauN;
|
|---|
| 64 | delete biasPhotoN;
|
|---|
| 65 | }
|
|---|
| 66 | else if(weakDir)
|
|---|
| 67 | {
|
|---|
| 68 | delete weakDir;
|
|---|
| 69 | delete theNuElN;
|
|---|
| 70 | delete theNuMuN;
|
|---|
| 71 | delete theNuTaN;
|
|---|
| 72 | delete biasNuNuc;
|
|---|
| 73 | }
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|
| 76 | // Returns Pointer to the G4QMessenger class
|
|---|
| 77 | G4QMessenger* G4QMessenger::GetPointer()
|
|---|
| 78 | {
|
|---|
| 79 | static G4QMessenger theMessenger; //**Static body of CHIPS Messenger**
|
|---|
| 80 | return &theMessenger;
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 | void G4QMessenger::Add(G4QNeutrinoPhysics* weak)
|
|---|
| 84 | {
|
|---|
| 85 | theWeak = weak;
|
|---|
| 86 |
|
|---|
| 87 | weakDir = new G4UIdirectory("/CHIPS_physics/neutrino/");
|
|---|
| 88 | weakDir->SetGuidance("weak (neutrino) processes");
|
|---|
| 89 |
|
|---|
| 90 | // commands for neutrino_el-nuclear physics.
|
|---|
| 91 | theNuElN = new G4UIcmdWithAString("/CHIPS_physics/neutrino/NuElNuclear",this);
|
|---|
| 92 | theNuElN->SetGuidance("Switching of nu_el-nuclear physics.");
|
|---|
| 93 | theNuElN->SetParameterName("status","off");
|
|---|
| 94 | theNuElN->SetCandidates("on off");
|
|---|
| 95 | theNuElN->SetDefaultValue("off");
|
|---|
| 96 | theNuElN->AvailableForStates(G4State_PreInit, G4State_Idle);
|
|---|
| 97 |
|
|---|
| 98 | // commands for neutrino_mu-nuclear physics.
|
|---|
| 99 | theNuMuN = new G4UIcmdWithAString("/CHIPS_physics/neutrino/NuMuNuclear",this);
|
|---|
| 100 | theNuMuN->SetGuidance("Switching of nu_mu-nuclear physics.");
|
|---|
| 101 | theNuMuN->SetParameterName("status","off");
|
|---|
| 102 | theNuMuN->SetCandidates("on off");
|
|---|
| 103 | theNuMuN->SetDefaultValue("off");
|
|---|
| 104 | theNuMuN->AvailableForStates(G4State_PreInit, G4State_Idle);
|
|---|
| 105 |
|
|---|
| 106 | // commands for neutrino_tau-nuclear physics.
|
|---|
| 107 | theNuTaN = new G4UIcmdWithAString("/CHIPS_physics/neutrino/NuTauNuclear",this);
|
|---|
| 108 | theNuTaN->SetGuidance("Switching of nu_tau-nuclear physics.");
|
|---|
| 109 | theNuTaN->SetParameterName("status","off");
|
|---|
| 110 | theNuTaN->SetCandidates("on off");
|
|---|
| 111 | theNuTaN->SetDefaultValue("off");
|
|---|
| 112 | theNuTaN->AvailableForStates(G4State_PreInit, G4State_Idle);
|
|---|
| 113 |
|
|---|
| 114 | // command for biasing of neutrino-nuclear reactions
|
|---|
| 115 | biasNuNuc = new G4UIcmdWithADouble("/CHIPS_physics/neutrino/NuNuc_Biasing", this);
|
|---|
| 116 | biasNuNuc->SetGuidance("Set a biasing coefficient for neutrino-nuclear ractions");
|
|---|
| 117 | biasNuNuc->SetParameterName("NuNuc_Biasing", false);
|
|---|
| 118 | biasNuNuc->SetRange("NuNuc_Biasing > 0.");
|
|---|
| 119 | biasNuNuc->SetDefaultValue(1.);
|
|---|
| 120 | biasNuNuc->AvailableForStates(G4State_PreInit, G4State_Idle);
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 | void G4QMessenger::Add(G4QPhotoNuclearPhysics* photo)
|
|---|
| 124 | {
|
|---|
| 125 | thePhoto = photo;
|
|---|
| 126 |
|
|---|
| 127 | weakDir = new G4UIdirectory("/CHIPS_physics/photoNuclear/");
|
|---|
| 128 | weakDir->SetGuidance("weak (neutrino) processes");
|
|---|
| 129 |
|
|---|
| 130 | // use G4UIcmdWithADouble for weighting of processes
|
|---|
| 131 |
|
|---|
| 132 | // command for synchrotron radiation.
|
|---|
| 133 | theSynchR = new G4UIcmdWithAString("/CHIPS_physics/photoNuclear/SynchRadiation",this);
|
|---|
| 134 | theSynchR->SetGuidance("Switching on/off synchrotron radiation.");
|
|---|
| 135 | theSynchR->SetParameterName("status","off");
|
|---|
| 136 | theSynchR->SetCandidates("on off");
|
|---|
| 137 | theSynchR->SetDefaultValue("off");
|
|---|
| 138 | theSynchR->AvailableForStates(G4State_PreInit, G4State_Idle);
|
|---|
| 139 |
|
|---|
| 140 | minGamSR = new G4UIcmdWithADouble("/CHIPS_physics/photoNuclear/MinGamma_SynchRad", this);
|
|---|
| 141 | minGamSR->SetGuidance("Set a minimum gamma for Synchratron Radiation");
|
|---|
| 142 | minGamSR->SetParameterName("MinGamma_SynchRad", false);
|
|---|
| 143 | minGamSR->SetRange("MinGamma_SynchRad >> 1.");
|
|---|
| 144 | minGamSR->SetDefaultValue(227.);
|
|---|
| 145 | minGamSR->AvailableForStates(G4State_PreInit, G4State_Idle);
|
|---|
| 146 |
|
|---|
| 147 | // command for gamma-nuclear physics.
|
|---|
| 148 | theGamN = new G4UIcmdWithAString("/CHIPS_physics/photoNuclear/GammaNuclear",this);
|
|---|
| 149 | theGamN->SetGuidance("Switching of gamma-nuclear physics.");
|
|---|
| 150 | theGamN->SetParameterName("status","off");
|
|---|
| 151 | theGamN->SetCandidates("on off");
|
|---|
| 152 | theGamN->SetDefaultValue("on");
|
|---|
| 153 | theGamN->AvailableForStates(G4State_PreInit, G4State_Idle);
|
|---|
| 154 |
|
|---|
| 155 | // command for electro-nuclear physics.
|
|---|
| 156 | theEleN = new G4UIcmdWithAString("/CHIPS_physics/photoNuclear/ElectroNuclear",this);
|
|---|
| 157 | theEleN->SetGuidance("Switching of electron-nuclear physics.");
|
|---|
| 158 | theEleN->SetParameterName("status","off");
|
|---|
| 159 | theEleN->SetCandidates("on off");
|
|---|
| 160 | theEleN->SetDefaultValue("off");
|
|---|
| 161 | theEleN->AvailableForStates(G4State_PreInit, G4State_Idle);
|
|---|
| 162 |
|
|---|
| 163 | // command for muon-nuclear physics.
|
|---|
| 164 | theMuoN = new G4UIcmdWithAString("/CHIPS_physics/photoNuclear/MuonNuclear",this);
|
|---|
| 165 | theMuoN->SetGuidance("Switching of muon nuclear physics.");
|
|---|
| 166 | theMuoN->SetParameterName("status","off");
|
|---|
| 167 | theMuoN->SetCandidates("on off");
|
|---|
| 168 | theMuoN->SetDefaultValue("off");
|
|---|
| 169 | theMuoN->AvailableForStates(G4State_PreInit, G4State_Idle);
|
|---|
| 170 |
|
|---|
| 171 | // command for tau-nuclear physics.
|
|---|
| 172 | theTauN = new G4UIcmdWithAString("/CHIPS_physics/photoNuclear/TauNuclear",this);
|
|---|
| 173 | theTauN->SetGuidance("Switching of tau nuclear physics.");
|
|---|
| 174 | theTauN->SetParameterName("status","off");
|
|---|
| 175 | theTauN->SetCandidates("on off");
|
|---|
| 176 | theTauN->SetDefaultValue("off");
|
|---|
| 177 | theTauN->AvailableForStates(G4State_PreInit, G4State_Idle);
|
|---|
| 178 |
|
|---|
| 179 |
|
|---|
| 180 | biasPhotoN = new G4UIcmdWithADouble("/CHIPS_physics/photoNuclear/PhotoN_Biasing", this);
|
|---|
| 181 | biasPhotoN->SetGuidance("Set a biasing coefficient for photo-nuclear ractions");
|
|---|
| 182 | biasPhotoN->SetParameterName("PhotoN_Biasing", false);
|
|---|
| 183 | biasPhotoN->SetRange("PhotoN_Biasing > 0.");
|
|---|
| 184 | biasPhotoN->SetDefaultValue(1.);
|
|---|
| 185 | biasPhotoN->AvailableForStates(G4State_PreInit, G4State_Idle);
|
|---|
| 186 | }
|
|---|
| 187 |
|
|---|
| 188 | void G4QMessenger::SetNewValue(G4UIcommand* aComm, G4String aS)
|
|---|
| 189 | {
|
|---|
| 190 | if(photoDir)
|
|---|
| 191 | {
|
|---|
| 192 | if (aComm==theSynchR) thePhoto->SetSynchRadOnOff(aS);
|
|---|
| 193 | else if(aComm==minGamSR) thePhoto->SetMinGammaSR(minGamSR->GetNewDoubleValue(aS));
|
|---|
| 194 | else if(aComm==theGamN) thePhoto->SetGammaNuclearOnOff(aS);
|
|---|
| 195 | else if(aComm==theMuoN) thePhoto->SetElPosNuclearOnOff(aS);
|
|---|
| 196 | else if(aComm==theMuoN) thePhoto->SetMuonNuclearOnOff(aS);
|
|---|
| 197 | else if(aComm==theMuoN) thePhoto->SetTauNuclearOnOff(aS);
|
|---|
| 198 | else if(aComm==biasPhotoN)thePhoto->SetPhotoNucBias(biasPhotoN->GetNewDoubleValue(aS));
|
|---|
| 199 | }
|
|---|
| 200 | else if(weakDir)
|
|---|
| 201 | {
|
|---|
| 202 | if (aComm==theNuElN) theWeak->SetNuElNuclearOnOff(aS);
|
|---|
| 203 | else if(aComm==theNuMuN) theWeak->SetNuMuNuclearOnOff(aS);
|
|---|
| 204 | else if(aComm==theNuTaN) theWeak->SetNuTauNuclearOnOff(aS);
|
|---|
| 205 | else if(aComm==biasNuNuc) theWeak->SetNuNuclearBias(biasNuNuc->GetNewDoubleValue(aS));
|
|---|
| 206 | }
|
|---|
| 207 | }
|
|---|
| 208 |
|
|---|
| 209 | G4String G4QMessenger::GetCurrentValue(G4UIcommand* aComm)
|
|---|
| 210 | {
|
|---|
| 211 | if(photoDir)
|
|---|
| 212 | {
|
|---|
| 213 | if (aComm==theSynchR) return thePhoto->GetSynchRadOnOff();
|
|---|
| 214 | else if(aComm==theGamN) return thePhoto->GetGammaNuclearOnOff();
|
|---|
| 215 | else if(aComm==theEleN) return thePhoto->GetElPosNuclearOnOff();
|
|---|
| 216 | else if(aComm==theMuoN) return thePhoto->GetMuonNuclearOnOff();
|
|---|
| 217 | else if(aComm==theTauN) return thePhoto->GetTauNuclearOnOff();
|
|---|
| 218 | }
|
|---|
| 219 | else if(weakDir)
|
|---|
| 220 | {
|
|---|
| 221 | if (aComm==theNuElN) return theWeak->GetNuElNuclearOnOff();
|
|---|
| 222 | else if(aComm==theNuMuN) return theWeak->GetNuMuNuclearOnOff();
|
|---|
| 223 | else if(aComm==theNuTaN) return theWeak->GetNuTauNuclearOnOff();
|
|---|
| 224 | }
|
|---|
| 225 | return "not_defined";
|
|---|
| 226 | }
|
|---|