## CRMC The program crmc (Cosmic Ray Monte Carlo) is an interface giving access to different cosmic ray and non-cosmic ray event generators by an easy-to-use command line interface. The output can be stored in different formats, i.e. in a ROOT TTree, HepMC event file, or Rivet output directly. Before this installation, make sure that you have has the newest official HERDOS environment. ``` source /cvmfs/herd.ihep.ac.cn/HERDOS/SLC7/Pre-release/ExternalLibs-GCC8.5.0/bashrc.sh ``` ### Installation and use of CRMC Please refer to [crmc](https://gitlab.iap.kit.edu/AirShowerPhysics/crmc) #### CRMC dependencies To install please get the version 2.0.1 and install the following pre-requisites: 1. fastjet download:[fastjet-3.4.0.tar.gz](http://fastjet.fr/repo/fastjet-3.4.0.tar.gz) installation: ``` ./configure –prefix= install_directory --enable-shared make && make install ``` 2. HepMC3 download:[HepMC3-3.2.5.tar.gz](http://hepmc.web.cern.ch/hepmc/releases/HepMC3-3.2.5.tar.gz) installation: ``` cmake .. -DCMAKE_INSTALL_PREFIX=install_directory -DHEPMC3_INSTALL_INTERFACES:BOOL=ON -DHEPMC3_PYTHON_VERSIONS=3.8 -DHEPMC3_Python_SITEARCH38=install_directory/lib/python3.8/site-packages -DHEPMC3_BUILD_STATIC_LIBS:BOOL=OFF -DHEPMC3_ENABLE_ROOTIO:BOOL=OFF make && make install ``` 3. Geant4 download:[v10.5.1.tar.gz](https://github.com/Geant4/geant4/archive/v10.5.1.tar.gz) (1) `geant4-10.5.1/source/processes/electromagnetic/utils/src/G4EmParameters.cc` **Line 143** : Change the maximum kinematic energy of the EM processes from 100 TeV to 10 PeV ``` maxKinEnergy = 10.0*CLHEP::PeV; ``` (2)`geant4-10.5.1/source/processes/hadronic/util/src/G4HadronicParameters.cc` **Line 63** : Change the maximum energy of the hadronic processes from 100 TeV to 10 PeV ``` fMaxEnergy = 10.0*CLHEP::PeV; ``` (3)`geant4-10.5.1/source/processes/electromagnetic/standard/src/G4eCoulombScatteringModel.cc` **Line 207** : Change the cross section of the coulomb scatter process above 100 TeV to that of at 100 TeV, add the followed code : ``` if( kinEnergy >= 100.0 * CLHEP::TeV) { kinEnergy = 100.0 *CLHEP::TeV; } ``` installation: ``` cmake .. -DCMAKE_INSTALL_PREFIX=install_directory -DGEANT4_BUILD_CXXSTD=14 -DGEANT4_USE_GDML=ON -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_RAYTRACER_X11=ON -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_USE_SYSTEM_ZLIB=ON -DGEANT4_USE_QT=ON -DGEANT4_BUILD_TLS_MODEL=global-dynamic -DXERCESC_ROOT_DIR=$HERD_EXTLIB_xercesc_HOME make && make install ``` #### CRMC installation download:[crmc-v2.0.1](https://gitlab.iap.kit.edu/AirShowerPhysics/crmc/-/archive/v2.0.1/crmc-v2.0.1.tar.gz) (1) `crmc-v2.0.1/src/geant4/G4HadronicInelasticModelCRMC.cc` **Line 202, 295 and 407**: Initialize the variable ‘pdef_errorcode’ to zero. `int pdef_errorcode =0;` **Line 412**: Correct the variable ‘gCRMC_data’ to the variable ‘CRMC_data’ `int particle_id = CRMC_data.fPartId[i];` (2) `crmc-v2.0.1/CMakeLists.txt` Comment the **line 468**, ``` TARGET_LINK_LIBRARIES (crmc ${Boost_LIBRARIES}) ``` Add the followed codes here , ``` set(BOOST_LIBRARY_DIR $ENV{HERD_EXTLIB_boost_HOME}/lib) TARGET_LINK_LIBRARIES (crmc ${BOOST_LIBRARY_DIR}/libboost_filesystem.so ${BOOST_LIBRARY_DIR}/libboost_iostreams.so ${BOOST_LIBRARY_DIR}/libboost_system.so ${BOOST_LIBRARY_DIR}/libboost_program_options.so) ``` (3) `crmc-v2.0.1/src/CRMCtrapfpe.c` ( if ARM architecture) Change **line 31** from ``` _FPU_DEFAULT & ~(_FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM); ``` to ``` _FPU_DEFAULT & ~(_FPU_FPCR_MASK_IXE | _FPU_FPCR_MASK_OFE | _FPU_FPCR_MASK_UFE); ``` installation: ``` cmake .. -DCMAKE_INSTALL_PREFIX=install_directory -D__GEANT4__=ON -D__GEANT4PHYS__=ON -DCRMC_QGSJET01=ON -DCRMC_GHEISHA=ON -DCRMC_PYTHIA=ON -DCRMC_HIJING=ON -DCRMC_SIBYLL=ON -DCRMC_PHOJET=ON -DCRMC_DPMJET19=ON -DCRMC_QGSJETII03=ON -DCRMC_QGSJETII04=ON make && make install ``` #### Use of CRMC `offline/Simulation/SimConfig/HERDSim/src/PhysicsList.cc` Add codes in `PhysicsList::ConstructProcess()` ``` // 0 - EPOS LHC 1 - EPOS 1.99 12 - DPMJET3 G4HadronPhysicsCRMC* crmc = new G4HadronPhysicsCRMC(12); crmc ->SetEnergyThreshold(300.*GeV); crmc->ConstructProcess(); ```