Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 /* 27 * =========================================== 28 * 29 * Filename: CexmcHistoManagerMessenger 30 * 31 * Description: commands to list and show 32 * 33 * Version: 1.0 34 * Created: 17.12.2009 21:39:02 35 * Revision: none 36 * Compiler: gcc 37 * 38 * Author: Alexey Radkov (), 39 * Company: PNPI 40 * 41 * =========================================== 42 */ 43 44 #ifdef CEXMC_USE_ROOT 45 46 #include <G4UIcmdWithoutParameter.hh> 47 #include <G4UIcmdWithAnInteger.hh> 48 #include <G4UIcmdWithAString.hh> 49 #include <G4String.hh> 50 #include "CexmcHistoManagerMessenger.hh" 51 #include "CexmcHistoManager.hh" 52 #include "CexmcMessenger.hh" 53 54 55 CexmcHistoManagerMessenger::CexmcHistoManagerM 56 CexmcH 57 histoManager( histoManager_ ), setVerboseL 58 printHisto( NULL ) 59 #ifdef CEXMC_USE_ROOTQT 60 , drawHisto( NULL ), addHistoMenu( NULL ), 61 drawHistoOptions2D( NULL ), drawHistoOptio 62 #endif 63 { 64 setVerboseLevel = new G4UIcmdWithAnInteger 65 ( CexmcMessenger::histoDirName + "verb 66 setVerboseLevel->SetGuidance( "0 - basic s 67 "1 - extra h 68 setVerboseLevel->SetParameterName( "Verbos 69 setVerboseLevel->SetDefaultValue( 0 ); 70 setVerboseLevel->AvailableForStates( G4Sta 71 72 listHistos = new G4UIcmdWithoutParameter( 73 ( CexmcMessenger::histoDirName + "list 74 listHistos->SetGuidance( "List available h 75 listHistos->AvailableForStates( G4State_Pr 76 77 printHisto = new G4UIcmdWithAString( 78 ( CexmcMessenger::histoDirName + "prin 79 printHisto->SetGuidance( "Print specified 80 printHisto->SetParameterName( "PrintHisto" 81 printHisto->AvailableForStates( G4State_Id 82 83 #ifdef CEXMC_USE_ROOTQT 84 drawHisto = new G4UIcmdWithAString( 85 ( CexmcMessenger::histoDirName + "draw 86 drawHisto->SetGuidance( "Draw specified hi 87 " the histogram 88 "options.\n Ava 89 "launched\n in 90 drawHisto->SetParameterName( "DrawHisto", 91 drawHisto->AvailableForStates( G4State_Idl 92 93 addHistoMenu = new G4UIcmdWithAString( 94 ( CexmcMessenger::histoDirName + "addH 95 addHistoMenu->SetGuidance( "Add histogram 96 "parameter is\n 97 "the menu label 98 "or disabled in 99 addHistoMenu->SetParameterName( "AddHistoM 100 addHistoMenu->AvailableForStates( G4State_ 101 102 drawHistoOptions1D = new G4UIcmdWithAStrin 103 ( CexmcMessenger::histoDirName + "draw 104 drawHistoOptions1D->SetGuidance( "Set draw 105 "from the 106 "be chang 107 drawHistoOptions1D->SetParameterName( "Dra 108 drawHistoOptions1D->AvailableForStates( G4 109 110 drawHistoOptions2D = new G4UIcmdWithAStrin 111 ( CexmcMessenger::histoDirName + "draw 112 drawHistoOptions2D->SetGuidance( "Set draw 113 "from the 114 "be chang 115 drawHistoOptions2D->SetParameterName( "Dra 116 drawHistoOptions2D->AvailableForStates( G4 117 118 drawHistoOptions3D = new G4UIcmdWithAStrin 119 ( CexmcMessenger::histoDirName + "draw 120 drawHistoOptions3D->SetGuidance( "Set draw 121 "from the 122 "be chang 123 drawHistoOptions3D->SetParameterName( "Dra 124 drawHistoOptions3D->AvailableForStates( G4 125 #endif 126 } 127 128 129 CexmcHistoManagerMessenger::~CexmcHistoManager 130 { 131 delete setVerboseLevel; 132 delete listHistos; 133 delete printHisto; 134 #ifdef CEXMC_USE_ROOTQT 135 delete drawHisto; 136 delete addHistoMenu; 137 delete drawHistoOptions1D; 138 delete drawHistoOptions2D; 139 delete drawHistoOptions3D; 140 #endif 141 } 142 143 144 void CexmcHistoManagerMessenger::SetNewValue( 145 146 { 147 do 148 { 149 if ( cmd == setVerboseLevel ) 150 { 151 histoManager->SetVerboseLevel( 152 G4UIcmdWithAnI 153 break; 154 } 155 if ( cmd == listHistos ) 156 { 157 histoManager->List(); 158 break; 159 } 160 if ( cmd == printHisto ) 161 { 162 histoManager->Print( value ); 163 break; 164 } 165 #ifdef CEXMC_USE_ROOTQT 166 if ( cmd == drawHisto ) 167 { 168 size_t delimPos( value.find_first 169 size_t delimPosEnd( G4String::npo 170 if ( delimPos != G4String::npos ) 171 delimPosEnd = value.find_first 172 histoManager->Draw( std::string( v 173 delimPosEnd == 174 175 break; 176 } 177 if ( cmd == addHistoMenu ) 178 { 179 size_t delimPos( value.find_first 180 size_t delimPosEnd( G4String::npo 181 if ( delimPos != G4String::npos ) 182 delimPosEnd = value.find_first 183 histoManager->AddHistoMenu( std::s 184 delimP 185 186 break; 187 } 188 if ( cmd == drawHistoOptions1D ) 189 { 190 histoManager->SetDrawOptions1D( va 191 break; 192 } 193 if ( cmd == drawHistoOptions2D ) 194 { 195 histoManager->SetDrawOptions2D( va 196 break; 197 } 198 if ( cmd == drawHistoOptions3D ) 199 { 200 histoManager->SetDrawOptions3D( va 201 break; 202 } 203 #endif 204 } while ( false ); 205 } 206 207 #endif 208 209