Skip to content
/ IDEA Public
forked from lopezzot/IDEA

Geant4 simulation of the IDEA Detector

Notifications You must be signed in to change notification settings

elfontan/IDEA

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 

Repository files navigation

IDEA

Geant4 simulation of the IDEA Detector


TRACKER - Drift chamber + vertex detector

(DIRECTORY = DriftChamberPlusVertex)

  • Enter in simulation/ and edit envG4GMC.sh to change PRJBASE; then move in analyzer/ and edit envGMC.sh to change PRJBASE

  • To compile the simulation part:

    cd simulation
    source envG4GMC.sh
    cd g4GMC; make clean_all; make all	
    
  • To compile the analyzer:

    cd analyzer
    source envGMC.sh
    cd GMC
    source envMidasDAQ.sh
    make clean
    $ROMESYS/bin/romebuilder.exe -i GMC.xml
    make all
    
  • To compile readHits (which converts the hits.root file in a suitable format for GMCAnalyzer):

    cd ../simulation/g4GMC
    make readHits
    

    N.B. The previous compilation of the analyzer part is needed because of some dependencies required.

  • If everything works correctly, two executables are created in simulation/g4GMC/bin/Linux-g++: g4GMC and readHits.
    Now, before running the simulation, the IDEA geometry has to be initialized and exported in a gdml format. Edit the geometry configuration file:

    simulation/g4GMC/geom_IDEA.txt	
    

    setting TRUE the boolean variable writeGDML and choosing the gdml file name (e.g. g4-IDEA.gdml).

    After that, create an output directory for your work under in your IDEA directory (at the same level of DriftChamberPLUSVertex, e.g. IdeaTracker_TEST). To run the simulation step and generate events (from g4GMC):

    ./bin/Linux-g++/g4GMC g4mac/runPFix-1.mac geom_IDEA.txt 1 pathTo/IdeaTracker_TEST
    

    where the arguments are: 1) Geant4 card to handle the simulation parameters, 2) geometry configuration, 3) number given to the simulation, 4) output directory.

    Then type the following command to convert the file hits#.root generated by g4GMC in a suitable format for the analyzer (MCData#.root => move it in IdeaTracker_TEST):

    ./bin/Linux-g++/readHits   pathTo/IdeaTracker_TEST/hits#.root
    

N.B. It is also possible to launch the simulation in a parallelized way:

./LaunchSims.sh  $1  $2  g4mac/runPFix-1.mac geom_IDEA.txt  pathTo/IdeaTracker_TEST
./ConvertHits.sh $1  $2  pathTo/IdeaTracker_TEST

where the arguments $1 and $2 correspond to nRuns and firstRun, respectively. Here MCData#.root are automatically moved to IdeaTracker_TEST.

  • Finally, modify the generated gdml file to make the simulation faster and set FALSE the boolean variable writeGDML:

    sed -e '/copynumber.*tubeFD_/,+4d' -e '/copynumber.*tubeSD_/,+4d' g4-IDEA.gdml > pathTo/IdeaTracker_TEST/g4-IDEA_reco.gdml
    

    and move geant4MC-IDEA.xml and geant4MC-IDEA-fit.xml in IdeaTracker_TEST from the analyzer/GMC directory.

  • At the end, in order to run the analyzer and the reconstruction, launch (from IdeaTracker_TEST):

    ${PRJBASE}/analyzer/GMC/gmcanalyzer.exe -i geant4MC-IDEA.xml -r 1 -e 1-$nEvents
    ${PRJBASE}/analyzer/GMC/gmcanalyzer.exe -i geant4MC-IDEA-fit.xml -r 1 -e 1-$nEvents
    

    or

    ${PRJBASE}/analyzer/GMC/LaunchAnalyzer.sh $1 $2 geant4MC-IDEA.xml hits
    ${PRJBASE}/analyzer/GMC/LaunchAnalyzer.sh $1 $2 geant4MC-IDEA-fit.xml reco
    

    All data information are stored in MCHits#.root and the reconstructed data are stored in RecoData#.root, respectively. RecoData.root contains only the branch related to the reconstructed tracks. (The branches for hits in drift chamber and pixel detector are not active.)

About

Geant4 simulation of the IDEA Detector

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 63.6%
  • C 27.1%
  • Makefile 4.9%
  • Shell 4.2%
  • M4 0.1%
  • CMake 0.1%