Message: Outputting the contents of a Geant4 cout to a text file. Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Outputting the contents of a Geant4 cout to a text file. 

Forum: Analysis
Date: Apr 24, 23:20
From: John <John>

Hello all,

I'm looking to print the contents of a Geant4 program in a text document. I'm on a Windows operating system, and am currently attempting to simply run the program from the terminal and output the contents of the terminal using the ">" function, like so:

C:\Users\user\Desktop\Workstation\B1Program\bin>start exampleB1 run1.mac > output.txt

The above command successfully creates a text file in the desired location, but its contents are blank. I can confirm that the contents are printed correctly in the terminal, but are not being written to the text document. Within the Geant4 source file RunAction.cc, I have the following code to print in the terminal.

G4cout  
     << G4endl     
     << "A. Number of runaway electrons injected: " << nofEvents
     << G4endl
     << "B. Initial energy of runaway electrons: " << particleEnergy/keV << " keV"
     << G4endl

Any help getting all the above information in a text document would be greatly appreciated. Thank you.

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

1 None: Re: Outputting the contents of a Geant4 cout to a text file.   (Tim Fulcher - May 07, 09:52) newer
(_ None: Re: Outputting the contents of a Geant4 cout to a text file.   (Tim Fulcher - May 07, 11:40) newer
 Add Message Add Message
to: "Outputting the contents of a Geant4 cout to a text file."

 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 ]