How can I know that I am using a certain environment variable related to a certain data-set?

Ok Doctor, thanks for your reply. I have two more doubts. I hope you can help me. Regarding the information in the link(the Windows section in this chapter of the Application Developers Guide), do I have to install Geant4 again(in such a way that the following is done: C:\Users\myUsername\Geant4-install)?. Where else could I include the relevant code to check whether a certain environment variable exists or not in the simulation(using the basic example B1)?

Maybe Iā€™m not interpreting your question correctly, but it seems like youā€™re missing something.

You are guaranteed, from the Geant4 documentation, that the simulation will use the value of a specific environment variable for a specific process. For example, G4RadioactiveDecay will use (no questions or alternatives) whatever directory of files is pointed to by the value of $G4RADIOACTIVEDATA.

If you want the source code to print messages to that effect for your own edification, thatā€™s your problem. The code doesnā€™t do that.

To find out the value of the envvars that are being used, that is not something you do ā€œin the simulation.ā€ That is something you do yourself, in your terminal environment. If youā€™re in Unix, you would do, for example

    $ echo $G4RADIOACTIVEDATA
    $ echo $G4LEVELGAMMADATA

and so on. I presume thereā€™s something similar in Windows, but I donā€™t know the exact command.

1 Like

Ok Doctor, thank you very much for your reply.

Sorry Doctor Michael Kelsey, I unchecked the solution box because I still have some questions about this topic. However, the information you provided in your last reply has been useful. Thank you

My doubts are the following, based on the latest answers to this topic, could it be concluded that I cannot check that a certain specific environment variable is being used in the simulation despite using the Visual Studio Developer Terminal?; Do I have to install Geant4 again if I use the Visual Studio Developer Terminal?. On the other hand, today I was reading the ā€œGeant4 Book For Application Developersā€ and I found the following: I read that the basic examples B1, B2, B4 and B5 must use 5 data-sets (G4LEDATA, G4LEVELGAMMADATA, G4NEUTRONXSDATA, G4SAIDXSDATA, G4ENSDFSTATEDATA); So, what I think is that, given that these data-sets (and therefore environment variables) must be used in the simulation, and given that these basic examples show simulation results on the screen (such as the dose per run), would this imply that if I do not use these data-sets in the simulation, the simulation will give wrong results, right?; Would be this an indirect way to check if a specific environment variable (or data-set) is being used in the simulation?; Would this indirect check would be the only way to know that I am using a specific data-set (or environment variable) in the simulation?. Thanks in advance. I hope you can help me.

In both cases, no.

No, @mkelsey answered this already in his post:

Your simulation simply will not run (it will print an error message and exit) if any needed dataset is not found, or has any missing file.

Iā€™m now confused as to the purpose of your question as there seem to be two separate and orthogonal topics:

  1. Do you just want to know where on disk Geant4 is taking data from for, e.g. radioactive decay data.
  2. Do you want to know if Geant4 is using a specific dataset in the application.
1 Like

Thank you very much for answering. So, one could conclude that it is possible to check that I am using a certain environment variable using the Visual Studio Developer Terminal, right?. What would be the steps to do this?; What happens is that after reading the information that is in the link that you mentioned (the Windows section in this chapter of the Application Developers Guide [you mentioned this link in post 20 of this topic]), in the ā€œBuilding Example B1 with CMake on Windows with Visual Studioā€ Section, I donā€™t know what to do because the following is mentioned: ā€œLetā€™s assume that you have already installed Geant4 in your home area under, for illustration only, C:\Users\YourUsername\ Geant4-installā€. On the other hand, I have installed Geant4 in such a way that the path for geant4-v11.2.1-install is C:\geant4-v11.2.1\geant4-v11.2.1-install
So, what do I have to do to generate the executable file of the basic example B1 using the Visual Studio Developer Terminal if I have installed Geant4 in such a way that the path for geant4-v11.2.1-install is C:\geant4-v11.2.1\geant4-v11.2.1-install?.
Regarding the questions:
1.- Do you just want to know where on disk Geant4 is taking data from for, e.g. radioactive decay data.
Reply = In my case, the path of the datasets is C:\geant4-v11.2.1\geant4-v11.2.1-install\share\Geant4\data
2.- Do you want to know if Geant4 is using a specific dataset in the application.
Reply = I think this could be done either by using the Visual Studio Developer Terminal or by opening the applicationā€™s executable file and observing if it opens without problems (that is, observing if it does not present an error message and exit); ĀæIs this correct?