Skip to content

mahmoudali2/IDEADetectorSIM

 
 

Repository files navigation

CHANGE LOG

On 2021-12-05, restored compatibility with latest key4hep stack
On 2022-05-06, Developed a full cmake configuration.
On 2021-12-05, rome moved from tagged branch to master branch
On 2021-12-03, genfit2 installationon on the stack is used (before it was locally installed)
On 2021-12-01 I forced the key4hep stack to be used to 2021-09-01 as with the latest version it does not work
On 2021-05, since the master analyzer does not compile I moved to Gianfranco's version of the code

RECOMMENDED use of the package

Instructions:

Building the package using cmake directly

Use this repository as any other git repositories

  • Fork and clone the repository. Check out the branch of interest. Say the repository is in /my/dir/
  • Prepare your environment.
  • cd /my/dir/IDEADetectorSIM                                                                                
    source key4hep_setup.sh                                                                                          
    source env.sh                                                                                                    
    
  • Make a build directory at the same level as the repository and cd into it.
  •    mkdir /my/dir/build                                                                                           
       cd /my/dir/build                                                                                              
    
  • Configure and compile:
  •    cmake -DCMAKE_INSTALL_PREFIX=/my/dir/build/instal_dir -DCMAKE_CXX_FLAGS="-DMT_OFF" ../IDEADetectorSIM  
       make -j10                                                                                                 
       make install                                                                                                  
    
  • Sit back and enjoy a coffee. Assuming everything goes well, the compilation time is easily in the tens of m inutes.
  • Now there is a file env.sh in the build directory
  • source env.sh                                                                                                    
    
  • You should be ready to run.
  • Using the package (once it is built)

  • Every time you log in again, you should do:
  • cd /my/dir/IDEADetectorSIM                                                                                
    source key4hep_setup.sh                                                                                          
    cd ../build                                                                                                      
    source env.sh                                                                                                    
    

    Note that the env.sh to be used is the one in the build directory.

    Building the package using the install_standalone script

    • Create an empty directory, say called mydir. cd into it and clone the repository.
    • Clone the package and checkout the master branch
    • Copy the install_standalone.sh script in mydir
    • Edit it and set STANDALONE_INSTALL_DIR to the directory where you want to install everything
    • Execute it with: source ./install_standalone.sh

    Go take a coffee. The code should compile and be ready to be used. If you do not have access to afs, you will seee an error related to copy a gdml file, you will have to copy that by hand.

    Every time you log in, you will have to source simulation/env.sh and analyzer/envGMC.sh.

Run the simulation

You may find useful to define SIM_INSTAL_DIR as the simulation installation directory. This is done automatically with the install_standalone script. The simulation is installed directly in the build directory if you build teh packahe directly using cmake. Another useful variable to define (automatic with the install_standalone script) is SIM_OUTPUT_DIR (where the output of the simulation will be written).

IMPORTANT: run this in directory $SIM_INSTAL_DIR

cd $SIM_INSTAL_DIR
mkdir -p $SIM_OUTPUT_DIR
./bin/g4GMC ./g4mac/runPFix-1.mac geom_IDEA.txt 1 $SIM_OUTPUT_DIR

The parameter 1 above is just the runnumber. It can be any number, we assume it is 1 in teh followin. If everything goes smooth, there shoudl be two files in teh $SIM_OUTPUT_DIR directory, one (big) called hits00001.root containing the inner detector hits, and one called simhits_podio00001.root.

Producing a podio file containing tracks and sigitised calorimeter hits

If you have built the package with cmake, you can simply go to your build directory and do

source ./scripts/commonRecoIDEAFile.sh $SIM_OUTPUT_DIR/hits00001.root $SIM_OUTPUT_DIR/simhits_podio00001.root [EDM_OUTPUT_FILE]

where [EDM_OUTPUT_FILE] can be anything. If everything runs smooth, you should end up having a file called [EDM_OUTPUT_FILE] in the build directory.

If you used the install_standalone script

Conversion from G4 based hit to ROME readable hit

The readHits executable will be in the converter directory.

./readHits $SIM_OUTPUT_DIR/<inout_file.root>

(the output file is named form MCData00001.root)

Run the ROME reconstruction

IMPORTANT: run all this in directory analyzer/GMC

copy the output file from previous step, of the form MCData00001.root, from converter/ to analyzer/GMC

copy the xml/gdml files from /afs/cern.ch/work/l/llavezzi/public/geometry to analyzer/GMC and change the path in the two xml files (gdml is good as it is)

run:

./LaunchAnalyzer.sh 1 1 geant4MC-IDEA.xml hits
./LaunchAnalyzer.sh 1 1 geant4MC-IDEA-fit.xml reco

Converter from GMCRecoTrack to Track

IMPORTANT: run this in directory converter/

copy the output file from previous step, of the form RecoData00001.root, analyzer/GMC to $SIM_OUTPUT_DIR

./convertTracks $SIM_OUTPUT_DIR/<reco_data_file.root>

Converter G4hits to EDM

will be ported to directory converter/

it is contained in the file convertHits.cc, compiled together with the rest.
!!!FOR NOW!!! (to be done):

  • the binary file is inside build/bin, it is not moved to the right place
  • the output file is not int the $SIM_OUTPUT_DIR but it is put in the dir where you run the conversion

to run

./convertHits $SIM_OUTPUT_DIR/<inout_file.root>

Everything is working with these versions

  • key4hep-stack/2021-11-26:
  • gcc8.3.0
  • geant4-10.7.2
  • clhep-2.4.4.0
  • root-6.24.06
  • genfit/02-00-00 (on the stack)
  • rome master

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 72.6%
  • C 18.8%
  • Shell 3.1%
  • Makefile 3.0%
  • CMake 1.4%
  • Python 1.0%
  • M4 0.1%