Problem in using scorer to fill histogram defined by G4Analysis


I was trying to follow the official manual: https:/// to use a scorer to fill a 1D histogram defined by G4Analysis. But I got the following error message:

-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : Analysis_W011
      issued by : G4THnManager::GetH1
      histogram 1 does not exist.
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------

when I run

$ G4RUN_MANAGER_TYPE=Serial ./build/tiny detector.txt radiate.txt

where tiny is the executable compiled from attached to this post, detector.txt defines a germanium detector, radiate.txt is the mac file, where I used the following macros trying to realize what was intended:

/score/create/realWorldLogVol HPGe(S)
/score/quantity/energyDeposit hE keV

/analysis/h1/create hE "energy deposition" 300 0 3000  keV
/score/fill1D 1 HPGe(S) hE

CMakeLists.txt is also attached if you need to compile the file.

Your help is appreciated.

Thanks, Jing

I am sorry that I had to break the syntax (the leading [) for the following links because a new user can only post with two links inside. (3.4 KB)
CMakeLists.txt (326 Bytes)
detector.txt|attachment](upload://gR0pMsCVmhj27TWbDqTf2DeuHhy.txt) (767 Bytes)
radiate.txt|attachment](upload://nhrGLd7gTC8KazrGcE80g6AMAdA.txt) (717 Bytes)

To repeat the problem, run

$ cd /path/to/tiny
$ mkdir build
$ cd build
$ ccmake ..
$ make
$ cd ..
$ G4RUN_MANAGER_TYPE=Serial ./build/tiny detector.txt radiate.txt

I found the problem. It had nothing to do with the scorer. I did not know that the analysis histogram index starts with 0 instead of 1. Changing from

/score/fill1D 1 HPGe(S) hE


/score/fill1D 0 HPGe(S) hE

solved the problem.

The example macros listed in the document, Command-based scoring — Book For Application Developers 10.7 documentation, are misleading. Shouldn’t the last two lines be changed from

/score/fill1D 1 Probes volFlux
/score/fill1D 2 Probes protonFlux


/score/fill1D 0 Probes volFlux
/score/fill1D 1 Probes protonFlux