Message: determining batch / interactive mode from within program Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question determining batch / interactive mode from within program 

Forum: (Graphical) User Interfaces
Date: 16 Nov, 2004
From: Dipanjan Ray <>

I was wondering what is the proper way to tell whether one is 
running in batch or interactive mode from within a Geant4 program.

Currently I am using RTTI as follows:

#include <typeinfo>
#include "G4UImanager.hh"
#include "G4UIsession.hh"
#include "G4UIbatch.hh"


   G4UIsession pSession =
   if ( typeid(*pSession) == typeid(G4UIbatch) )  {
      /* batch mode */
   else  {
      /* interactive mode */

This seems to work OK, but I was wondering if there was a better way, 
if this will always work, etc.

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

 Add Message Add Message
to: "determining batch / interactive mode from within program"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]