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