CPPsim

From GlueXWiki
Jump to: navigation, search

Introduction

CPPsim is a GEANT4 simulation used for the Charged Pion Polarizability experiment in Hall-D. It is maintained as a separate project from the standard Hall-D simulation packages hdgeant and HDGeant4. It does, however, depend on the same [HDDS https://github.com/JeffersonLab/hdds] package for specifying the geometry in Hall-D as well as the sim-recon software suite for things such as the magnetic field map, Lorentz deflections tables, and HDDM I/O.

Quick Start

  1. Get a working version of sim-recon and make sure your environment is setup to use it
  2. Make sure your ROOT version has gdml support enabled.
    • This is technically not needed if you have a cpproot.gdml available (check if $HDDS_HOME/$BMS_OSNAME/src/cpproot.gdml exists since if it is, then you're good to go)
    • If cpproot.gdml is not in the $HDDS_HOME/$BMS_OSNAME/src then you'll have to find a copy or recompile ROOT to generate one from the HDDS xml source. Configure ROOT using the "-enable-gdml" flag before reconpiling. Then you'll have to go back to step 1.
  3. Get a working version of GEANT4 10.03p01fixed or greater and set your environment up to use it.
    • The "fixed" on the above is my own addition, not something distributed by the HDGeant4 authors. This version (available at following link) contains a number of bug fixes to the GEANT4 code base. These fixes were copied from the HDGeant4 source used for GlueX in Hall-D. The HDGeant4 paradigm is to include those fixes in the source code for HDGeant4 itself and make sure the versions compiled into hdgeant4 are used instead of the ones in the installed G4 libraries. For CPPsim, we do not carry these fixes with the source and instead patch the Geant4 source itself. (tomato, tomato).
    • Download geant4.10.03.p01fixed.tgz
    • Here are the lines used on my MBP:
    • > setenv G4 /usr/local/geant4/geant4.10.03.p01fixed.QT.Darwin_macosx10.11-x86_64-llvm8.0.0
    • > source $G4/bin/geant4.csh $G4/bin
    • > source $G4/share/Geant4-10.*/geant4make/geant4make.csh $G4/share/Geant4-10.*/geant4make/
  4. Checkout CPPsim from subversion and build it via:
    > svn co https://halldsvn.jlab.org/repos/trunk/Experiments/PionPolarizability/src/CPPsim
    > mkdir CPPsim-build
    > cd CPPsim-build
    > ../CPPsim/run_cmake
    > make -j8
    n.b. GEANT4 requires a recent version of cmake. (e.g. for Mac OS X I downloaded and installed 3.4.1 and used the command line executable in /Applications/CMake 3.4.1.app/Contents/bin/cmake)
  5. Copy the control.in file from the CPPsim source directory to your working directory and modify to suit your job. This is a well commented file that should guide you through the options.
  6. Run CPPsim that was left in the CPPsim-build directory with the "-h" option to see what options are available. No options will just run it using options from the control.in file.
    • n.b. CPPsim will automatically try running any file named "vis.mac" in the current working directory so if you don't want this, make sure that file is not there or use the -nv option when running CPPsim