49 #include <G4String.hh> 
   55 CexmcHistoManagerMessenger::CexmcHistoManagerMessenger(
 
   56                                         CexmcHistoManager *  histoManager ) :
 
   57     histoManager( histoManager ), setVerboseLevel( NULL ), listHistos( NULL ),
 
   59 #ifdef CEXMC_USE_ROOTQT
 
   64         ( CexmcMessenger::histoDirName + 
"verbose" ).c_str(), 
this );
 
   65     setVerboseLevel->SetGuidance( 
"0 - basic set of histograms created, " 
   66                                   "1 - extra histograms created" );
 
   67     setVerboseLevel->SetParameterName( 
"Verbose", 
true );
 
   68     setVerboseLevel->SetDefaultValue( 0 );
 
   72         ( CexmcMessenger::histoDirName + 
"list" ).c_str(), 
this );
 
   73     listHistos->SetGuidance( 
"List available histograms" );
 
   77         ( CexmcMessenger::histoDirName + 
"print" ).c_str(), 
this );
 
   78     printHisto->SetGuidance( 
"Print specified histogram" );
 
   79     printHisto->SetParameterName( 
"PrintHisto", 
false );
 
   82 #ifdef CEXMC_USE_ROOTQT 
   84         ( CexmcMessenger::histoDirName + 
"draw" ).c_str(), 
this );
 
   85     drawHisto->SetGuidance( 
"Draw specified histogram. The first parameter is\n" 
   86                             "    the histogram name, the second is draw " 
   87                             "options.\n    Available only if the program was " 
   88                             "launched\n    in graphical mode" );
 
   89     drawHisto->SetParameterName( 
"DrawHisto", 
false );
 
   95 CexmcHistoManagerMessenger::~CexmcHistoManagerMessenger()
 
   97     delete setVerboseLevel;
 
  100 #ifdef CEXMC_USE_ROOTQT 
  106 void  CexmcHistoManagerMessenger::SetNewValue( 
G4UIcommand *  cmd,
 
  111         if ( cmd == setVerboseLevel )
 
  113             histoManager->SetVerboseLevel(
 
  117         if ( cmd == listHistos )
 
  119             histoManager->List();
 
  122         if ( cmd == printHisto )
 
  124             histoManager->Print( value );
 
  127 #ifdef CEXMC_USE_ROOTQT 
  128         if ( cmd == drawHisto )
 
  130             size_t  delimPos( value.find_first_of( 
" \t" ) );
 
  131             size_t  delimPosEnd( G4String::npos );
 
  132             if ( delimPos != G4String::npos )
 
  133                 delimPosEnd = value.find_first_not_of( 
" \t", delimPos );
 
  134             histoManager->Draw( std::string( value, 0, delimPos ),
 
  135                                 delimPosEnd == G4String::npos ? 
"" :
 
  136                                                 value.c_str() + delimPosEnd );