Skip to content

peckalec/fcal_sim

 
 

Repository files navigation

CLAS12 FCAL README

--------------------------------------------------

Before running the simulation, one must install GEMC, following Maurizio's instructions on http://gemc.jlab.org


Set the environmental variable $GEMC to point to the location where the GEMC resources are located.

If you're on MacOS, add the following lines to your ~/.bash_profile (replacing 2.6 with whatever version you have)

export GEMC=/Applications/gemc-2.6.app/gemc.app/Contents/Resources/
export GEMC_DATA_DIR=$GEMC
alias gemc='$GEMC/../MacOS/gemc.command' #MacOS only

Similarly, on Linux, add the first two of the lines above ~/.bashrc file, with $GEMC pointing to the installation directory.  You will then need to put the directory containing the gemc executable in the $PATH.  

You'll need the magnetic fields in order to run the simulations
wget http://clasweb.jlab.org/12gev/field_maps/clas12SolenoidFieldMap.dat $GEMC_DATA_DIR
wget http://clasweb.jlab.org/12gev/field_maps/clas12TorusOriginalMap.dat $GEMC_DATA_DIR

You will also need to soft-link the "experiments" directory to the one in the GEMC installation in order to get the rest of clas12 into the simulation.  Run this in the same directory where the fcal.gcard is located:

ln -s $GEMC_DATA_DIR/experiments experiments

To build the geometry, banks, hit defs and materials for the fcal, run the following command

perl ./fcal.pl config.dat

Then, to recompile GEMC with the fcal hit process, run the following script
./mod_and_recompile_gemc.sh

To run the simulation with the fcal + the rest of the CLAS12:

gemc fcal.gcard

To run the simulation with only the fcal:
gemc fcal_only.gcard

You can override the settings of a gcard by adding additional arguments, for instance, "gemc fcal_only.gcard -USE_GUI=0" will disable the graphical user interface.  You can learn more about GEMC settings by doing

gemc -help


To run gemc on docker,

docker pull jeffersonlab/gemc:2.9

#Basic example of running docker
docker run -it --rm jeffersonlab/gemc:2.9

#Example with addtional arguments to mount a directory and run this in a browser.  
docker run -it --rm -v /Users/spaul/fcal_sim/:/fcal/  -p 127.0.0.1:6080:6080 jeffersonlab/gemc:2.9

#similar example for Windows:
docker run -it --rm -v c:/fcal_sim/:/fcal/  -p 127.0.0.1:6080:6080 jeffersonlab/gemc:2.9

After opening the docker container, make sure to recompile gemc with the fcal hitprocess, by running the following script inside the docker container, before running gemc in the docker container.

cd /fcal;; ./mod_and_recompile_gemc.sh

To convert the output to root: (do this inside the docker container.  this must be done in the same directory where the fcal__bank.txt file resides.  In the example below, the input file is out.ev, and the resulting output file is out.root)

evio2root -INPUTF=out.ev -B=fcal -R=fcal

The -B=fcal indicates that the fcal__bank.txt will be read to determine which digitization variables to use.  The -R=fcal indicates that the raw output for the fcal will be included, not just digitized output.  

About

Alec's fork

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 94.8%
  • C++ 3.5%
  • Other 1.7%