STCyclotron root Plot.C syntax error

I have been exploring the STCyclotron advanced example, and I am having problems when running the Plot.C root macro. After running a simulation with /run/beamOn 1, I run root Plot.C and I get the following errors:

$ root Plot.C
   ------------------------------------------------------------------
  | Welcome to ROOT 6.28/04                        https://root.cern |
  | (c) 1995-2022, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for win64 on May 08 2023, 02:44:07                         |
  | From tags/v6-28-04@v6-28-04                                      |
  | With MSVC 19.32.31332.0                                          |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q'  |
   ------------------------------------------------------------------


Processing Plot.C...
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
ERROR in TPDF::Open: Cannot open file:./Results/BeamData/BeamEnergyInTarget.pdf
Error in <TASImage::WriteImage>: error writing file ./Results/BeamData/BeamIntensityTarget.jpg
ERROR in TPDF::Open: Cannot open file:./Results/BeamData/BeamEnergyOutTarget.pdf
ERROR in TPDF::Open: Cannot open file:./Results/BeamData/BeamEnergyInFoil.pdf
...

Followed by many more errors. There’s something going wrong that’s causing the error, “The syntax of the command is incorrect” but I’m not sure what is going on.

I suspected it might be an issue with my system. I know that this example was designed for Linux. I am running this example on Windows, simulating Linux commands using Git Bash. This workaround method has worked for me in the past, but there may be something I don’t know. Any ideas of how to get this working on windows? Thank you.

Geant4 Version: 11.1.2
Operating System: Windows 11
Compiler/Version:
CMake Version:


It’s possible that that Plot.C macro from the example was written for an older version of ROOT. You’re using the recent ROOT 6.28, which is excellent. If you can focus on a specific issue within that Plot.C file, you may find it useful to post a question to the ROOT forums, https://root-forum.cern.ch/.

1 Like

@john9francis
I tested on G4 10.7 v and root 6.20.
Without any issue the script generated following graphs.
Some of them are below;

macro used run.mac

VRS

Thank you. I’ll try with root v6.20. Did you try the Plot.C root macro or just the run.mac file?

run.mac is i/p,
plot.C [Script] is for data Analysis.

I figured it out, it only works on linux. For this specific example, the Plot.C macro can’t be run on windows, at least with my root installation. I tried opening up the directory in a docker container running root’s official docker image (FROM rootproject/root) and then running root Plot.C. This method produces the PDF’s as expected.

If anyone can figure out how to run it on windows without using a linux docker container, I would be interested in knowing.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.