Message: UI Crashing Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question UI Crashing 

Forum: Particles
Date: 23 Feb, 2011
From: Sarah Bender <Sarah Bender>

Hello,

I'm new to Geant and I'm trying to model a HPGe gamma ray detector. I'm having problems with the UI that's generating my particles. The problem only occurs for certain isotopes, for instance Cs-137 and Ce-144. Many other isotopes run without issue. My code generates particles, but then an exception happens and the code terminates. The visualization window appears for a few seconds, runs some particles, then disappears and comes back and runs more particles. It repeats this cycle about 6 times before it terminates the run. Has anyone experienced problems like this? I'm using version 4.9.3.

Any advice would be greatly appreciated. Thank you, Sarah

int main(int argc,char** argv)
{
	G4Timer timer;
	timer.Start();

  // random engine
  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);

  // Construct the default run manager
  G4RunManager* runManager = new G4RunManager;

  // Creation of the analysis manager
  // exrdmAnalysisManager* analysis = exrdmAnalysisManager::getInstance();

  // set mandatory initialization classes

  DetectorConstruction* CSS = new DetectorConstruction;
  runManager->SetUserInitialization(CSS);
  exrdmPhysicsList* exrdmPhysicsList1=new exrdmPhysicsList();
  exrdmPhysicsList1->SelectPhysicsList("LowEnergy_EM");
  exrdmPhysicsList1->SetCuts();
  runManager->SetUserInitialization(exrdmPhysicsList1);

  // Initialize G4 kernel
  // do this at run time so the geometry/physics can be changed
  runManager->Initialize();
  //

  // set mandatory user action class
  runManager->SetUserAction(new exrdmPrimaryGeneratorAction);
  //runManager->SetUserAction(new exrdmRunAction);
  //runManager->SetUserAction(new exrdmEventAction);
  //runManager->SetUserAction(new exrdmSteppingAction);

  G4UIsession* session=0;

  if (argc==1)   // Define UI session for interactive mode.
    {
#ifdef G4UI_USE_XM
      session = new G4UIXm(argc,argv);
#else           
#ifdef G4UI_USE_TCSH
      session = new G4UIterminal(new G4UItcsh);      
#else
      session = new G4UIterminal();
#endif
#endif
    }

#ifdef G4VIS_USE
  // visualization manager
	G4VisManager* visManager = new G4VisExecutive;
	visManager -> Initialize();
#endif

  // get the pointer to the User Interface manager 
    G4UImanager* UI = G4UImanager::GetUIpointer();
	UI->ApplyCommand("/vis/open OGLSWin32");
	UI->ApplyCommand("/vis/viewer/set/viewpointThetaPhi 45 0"); //rotate the detector visualization
	// UI->ApplyCommand("/vis/viewer/set/background white");
	UI->ApplyCommand("/vis/drawVolume");
	// UI->ApplyCommand("/vis/viewer/flush");

	UI->ApplyCommand("/vis/scene/add/trajectories");
	UI->ApplyCommand("/vis/modeling/trajectories/create/drawByCharge");
	UI->ApplyCommand("/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true");
	UI->ApplyCommand("/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 4");

	G4String command = "/control/execute ";
	G4String fileName = argv[1];
	UI->ApplyCommand(command+fileName);
	G4int i;

		InputReader reader;
		reader.readInput();  

		while(reader.getNextIsotope()){ 
			Isotope isotope=reader.getIsotope();
			G4double Strength=isotope.getDoubleStrength();

			//if(isotope.getStrength()<1)continue;
			G4cout<<"running  " << isotope.getName() << " "<<(isotope.getStrength()) <<" "<< isotope.getIsotopeText()<< G4endl;
			UI->ApplyCommand(isotope.getIsotopeText());
			G4cout << Strength << G4endl;
			for ( i = 0;  i<Strength;i++){

				UI->ApplyCommand(isotope.getStrength());		

			}
		}      
		timer.Stop();

		G4cout<<"Real time passed: "<< timer.GetUserElapsed() << G4endl;

  // job termination
// #ifdef G4VIS_USE
//  delete visManager;
// #endif
//  delete analysis;
   delete runManager;

  return 0;
}

 Add Message Add Message
to: "UI Crashing"

 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 ]