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 /// \file hadronic/Hadr00/src/HistoManagerMess 26 /// \file hadronic/Hadr00/src/HistoManagerMessenger.cc 27 /// \brief Implementation of the HistoManagerM 27 /// \brief Implementation of the HistoManagerMessenger class 28 // 28 // 29 // 29 // >> 30 // $Id: HistoManagerMessenger.cc 70747 2013-06-05 11:56:02Z ihrivnac $ 30 // 31 // 31 // 32 // 32 ////////////////////////////////////////////// 33 ///////////////////////////////////////////////////////////////////////// 33 // 34 // 34 // HistoManagerMessenger 35 // HistoManagerMessenger 35 // 36 // 36 // Created: 20.06.08 V.Ivanchenko 37 // Created: 20.06.08 V.Ivanchenko 37 // 38 // 38 // Modified: 39 // Modified: 39 // 40 // 40 ////////////////////////////////////////////// 41 //////////////////////////////////////////////////////////////////////// 41 // 42 // 42 43 43 #include "HistoManagerMessenger.hh" 44 #include "HistoManagerMessenger.hh" 44 45 45 #include "HistoManager.hh" 46 #include "HistoManager.hh" 46 << 47 #include "G4UIdirectory.hh" 47 #include "G4UIcmdWith3Vector.hh" << 48 #include "G4UIcmdWithABool.hh" 48 #include "G4UIcmdWithABool.hh" 49 #include "G4UIcmdWithADoubleAndUnit.hh" << 50 #include "G4UIcmdWithAString.hh" 49 #include "G4UIcmdWithAString.hh" 51 #include "G4UIcmdWithAnInteger.hh" 50 #include "G4UIcmdWithAnInteger.hh" >> 51 #include "G4UIcmdWith3Vector.hh" >> 52 #include "G4UIcmdWithADoubleAndUnit.hh" 52 #include "G4UIcmdWithoutParameter.hh" 53 #include "G4UIcmdWithoutParameter.hh" 53 #include "G4UIdirectory.hh" << 54 #include "HistoManager.hh" 54 55 55 //....oooOO0OOooo........oooOO0OOooo........oo 56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 56 57 57 HistoManagerMessenger::HistoManagerMessenger(H << 58 HistoManagerMessenger::HistoManagerMessenger(HistoManager * p) >> 59 :G4UImessenger(), fHisto(p) 58 { 60 { 59 fbinCmd = new G4UIcmdWithAnInteger("/testhad << 61 fbinCmd = new G4UIcmdWithAnInteger("/testhadr/nBinsE",this); 60 fbinCmd->SetGuidance("Set number of bins for 62 fbinCmd->SetGuidance("Set number of bins for energy"); 61 fbinCmd->SetParameterName("NEbins", false); << 63 fbinCmd->SetParameterName("NEbins",false); 62 fbinCmd->AvailableForStates(G4State_PreInit, << 64 fbinCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 63 65 64 fnOfAbsCmd = new G4UIcmdWithAnInteger("/test << 66 fnOfAbsCmd = new G4UIcmdWithAnInteger("/testhadr/nBinsP",this); 65 fnOfAbsCmd->SetGuidance("Set number of bins 67 fnOfAbsCmd->SetGuidance("Set number of bins for momentum"); 66 fnOfAbsCmd->SetParameterName("NPbins", false << 68 fnOfAbsCmd->SetParameterName("NPbins",false); 67 fnOfAbsCmd->AvailableForStates(G4State_PreIn << 69 fnOfAbsCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 68 70 69 fpartCmd = new G4UIcmdWithAString("/testhadr << 71 fpartCmd = new G4UIcmdWithAString("/testhadr/particle",this); 70 fpartCmd->SetGuidance("Set particle name"); 72 fpartCmd->SetGuidance("Set particle name"); 71 fpartCmd->SetParameterName("Particle", false << 73 fpartCmd->SetParameterName("Particle",false); 72 fpartCmd->AvailableForStates(G4State_PreInit << 74 fpartCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 73 75 74 fcsCmd = new G4UIcmdWithAString("/testhadr/t << 76 fcsCmd = new G4UIcmdWithAString("/testhadr/targetElm",this); 75 fcsCmd->SetGuidance("Set element name"); 77 fcsCmd->SetGuidance("Set element name"); 76 fcsCmd->SetParameterName("Elm", false); << 78 fcsCmd->SetParameterName("Elm",false); 77 fcsCmd->AvailableForStates(G4State_PreInit, << 79 fcsCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 78 80 79 fe1Cmd = new G4UIcmdWithADoubleAndUnit("/tes << 81 fe1Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/minEnergy",this); 80 fe1Cmd->SetGuidance("Set min kinetic energy" 82 fe1Cmd->SetGuidance("Set min kinetic energy"); 81 fe1Cmd->SetParameterName("eMin", false); << 83 fe1Cmd->SetParameterName("eMin",false); 82 fe1Cmd->SetUnitCategory("Energy"); 84 fe1Cmd->SetUnitCategory("Energy"); 83 fe1Cmd->AvailableForStates(G4State_PreInit, << 85 fe1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle); 84 86 85 fe2Cmd = new G4UIcmdWithADoubleAndUnit("/tes << 87 fe2Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/maxEnergy",this); 86 fe2Cmd->SetGuidance("Set max kinetic energy" 88 fe2Cmd->SetGuidance("Set max kinetic energy"); 87 fe2Cmd->SetParameterName("eMax", false); << 89 fe2Cmd->SetParameterName("eMax",false); 88 fe2Cmd->SetUnitCategory("Energy"); 90 fe2Cmd->SetUnitCategory("Energy"); 89 fe2Cmd->AvailableForStates(G4State_PreInit, << 91 fe2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle); 90 92 91 fp1Cmd = new G4UIcmdWithADoubleAndUnit("/tes << 93 fp1Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/minMomentum",this); 92 fp1Cmd->SetGuidance("Set min momentum"); 94 fp1Cmd->SetGuidance("Set min momentum"); 93 fp1Cmd->SetParameterName("pMin", false); << 95 fp1Cmd->SetParameterName("pMin",false); 94 fp1Cmd->SetUnitCategory("Energy"); 96 fp1Cmd->SetUnitCategory("Energy"); 95 fp1Cmd->AvailableForStates(G4State_PreInit, << 97 fp1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle); 96 98 97 fp2Cmd = new G4UIcmdWithADoubleAndUnit("/tes << 99 fp2Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/maxMomentum",this); 98 fp2Cmd->SetGuidance("Set max momentum"); 100 fp2Cmd->SetGuidance("Set max momentum"); 99 fp2Cmd->SetParameterName("pMax", false); << 101 fp2Cmd->SetParameterName("pMax",false); 100 fp2Cmd->SetUnitCategory("Energy"); 102 fp2Cmd->SetUnitCategory("Energy"); 101 fp2Cmd->AvailableForStates(G4State_PreInit, << 103 fp2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle); 102 104 103 fverbCmd = new G4UIcmdWithAnInteger("/testha << 105 fverbCmd = new G4UIcmdWithAnInteger("/testhadr/verbose",this); 104 fverbCmd->SetGuidance("Set verbose for "); 106 fverbCmd->SetGuidance("Set verbose for "); 105 fverbCmd->SetParameterName("verb", false); << 107 fverbCmd->SetParameterName("verb",false); 106 fverbCmd->AvailableForStates(G4State_PreInit << 108 fverbCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 107 109 108 fFCmd = new G4UIcmdWithAString("/testhadr/fi << 110 fFCmd = new G4UIcmdWithAString("/testhadr/fileName",this); 109 fFCmd->SetGuidance("set name for the histogr 111 fFCmd->SetGuidance("set name for the histograms file"); 110 } 112 } 111 113 112 //....oooOO0OOooo........oooOO0OOooo........oo 114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 113 115 114 HistoManagerMessenger::~HistoManagerMessenger( 116 HistoManagerMessenger::~HistoManagerMessenger() 115 { 117 { 116 delete fbinCmd; << 117 delete fnOfAbsCmd; 118 delete fnOfAbsCmd; 118 delete fpartCmd; 119 delete fpartCmd; 119 delete fcsCmd; 120 delete fcsCmd; 120 delete fe1Cmd; 121 delete fe1Cmd; 121 delete fe2Cmd; 122 delete fe2Cmd; 122 delete fp1Cmd; 123 delete fp1Cmd; 123 delete fp2Cmd; 124 delete fp2Cmd; 124 delete fverbCmd; 125 delete fverbCmd; 125 delete fFCmd; 126 delete fFCmd; 126 } 127 } 127 128 128 //....oooOO0OOooo........oooOO0OOooo........oo 129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 129 130 130 void HistoManagerMessenger::SetNewValue(G4UIco 131 void HistoManagerMessenger::SetNewValue(G4UIcommand* command, G4String newValue) 131 { 132 { 132 if (command == fbinCmd) { << 133 if( command == fbinCmd ) { 133 fHisto->SetNumberOfBinsE(fbinCmd->GetNewIn 134 fHisto->SetNumberOfBinsE(fbinCmd->GetNewIntValue(newValue)); 134 } << 135 } else if( command == fnOfAbsCmd ) { 135 else if (command == fnOfAbsCmd) { << 136 fHisto->SetNumberOfBinsP(fnOfAbsCmd->GetNe 136 fHisto->SetNumberOfBinsP(fnOfAbsCmd->GetNewIntValue(newValue)); 137 } << 137 } else if( command == fverbCmd ) { 138 else if (command == fverbCmd) { << 139 fHisto->SetVerbose(fverbCmd->GetNewIntValu 138 fHisto->SetVerbose(fverbCmd->GetNewIntValue(newValue)); 140 } << 139 } else if( command == fpartCmd ) { 141 else if (command == fpartCmd) { << 142 fHisto->SetParticleName(newValue); 140 fHisto->SetParticleName(newValue); 143 } << 141 } else if( command == fcsCmd ) { 144 else if (command == fcsCmd) { << 145 fHisto->SetElementName(newValue); 142 fHisto->SetElementName(newValue); 146 } << 143 } else if( command == fe1Cmd ) { 147 else if (command == fe1Cmd) { << 148 fHisto->SetMinKinEnergy(fe1Cmd->GetNewDoub 144 fHisto->SetMinKinEnergy(fe1Cmd->GetNewDoubleValue(newValue)); 149 } << 145 } else if( command == fe2Cmd ) { 150 else if (command == fe2Cmd) { << 151 fHisto->SetMaxKinEnergy(fe2Cmd->GetNewDoub 146 fHisto->SetMaxKinEnergy(fe2Cmd->GetNewDoubleValue(newValue)); 152 } << 147 } else if( command == fp1Cmd ) { 153 else if (command == fp1Cmd) { << 154 fHisto->SetMinMomentum(fp1Cmd->GetNewDoubl 148 fHisto->SetMinMomentum(fp1Cmd->GetNewDoubleValue(newValue)); 155 } << 149 } else if( command == fp2Cmd ) { 156 else if (command == fp2Cmd) { << 157 fHisto->SetMaxMomentum(fp2Cmd->GetNewDoubl 150 fHisto->SetMaxMomentum(fp2Cmd->GetNewDoubleValue(newValue)); 158 } << 151 } else if( command == fFCmd ) { 159 else if (command == fFCmd) { << 160 fHisto->SetHistoName(newValue); 152 fHisto->SetHistoName(newValue); 161 } 153 } 162 } 154 } 163 155 164 //....oooOO0OOooo........oooOO0OOooo........oo 156 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 157 165 158