Difference between revisions of "SoLID Software Detector Simulation"

From Hall A Wiki
Jump to: navigation, search
(Note about Polycons)
(hit processing)
Line 103: Line 103:
 
== hit processing ==
 
== hit processing ==
  
All quantity should be in "MeV,mm,ns" units
+
All quantity should be in "MeV,mm,ns" units as geant4 default
  
=== built-in type ===
+
customized hit processing type need 3 things to work togetherL hit process routine in c++ code, bank definition and hit definition
 
+
"header" bank has entries "evn,evn_type,beamPol,var1,var2,var3,var4,var5,var6,var7,var8" where evn is for event number, evn_type=-1 for simulated event, beamPol for beam polarization, and all other variables are 0 from a particle gun as input or customized from an input file.
+
 
+
"generated" bank has entries "pid,px,py,pz,vx,vy,vz"
+
 
+
"flux" bank has entries "hitn, id" which is a builtin hit processing routine, just record hits on a sensitive detector identified by an integer number id
+
 
+
"true info" records all hits (every single track in every single detector as one hit), and it can be turned on for both flux and other customized banks by option like <option name="INTEGRATEDRAW" value="flux,TOF,DC"/>
+
 
+
pid        particle ID
+
mpid        mother particle ID
+
tid        track id
+
mtid        mother track id
+
otid        original track id
+
trackE      track energy
+
totEdep    Total Energy Deposited
+
avg_x      Average global x position
+
avg_y      Average global y position
+
avg_z      Average global z position
+
avg_lx      Average local  x position
+
avg_ly      Average local  y position
+
avg_lz      Average local  z position
+
px     x component of track momentum
+
py     y component of track momentum
+
pz     z component of track momentum
+
vx     x coordinate of primary vertex
+
vy     y coordinate of primary vertex
+
vz     z coordinate of primary vertex
+
mvx     x coordinate of mother vertex
+
mvy     y coordinate of mother vertex
+
mvz     z coordinate of mother vertex
+
avg_t      Average t
+
 
+
=== customized type ===
+
 
+
need 3 things, hit process routine in c++ code, bank definition and hit definition
+
  
 
For bank definition, it should have "hitn" to record the number of hits and give unique "bankId" and "bankname"
 
For bank definition, it should have "hitn" to record the number of hits and give unique "bankId" and "bankname"

Revision as of 00:51, 12 November 2014

"solid_gemc" general info

SoLID detector simulation program "solid_gemc" is based on "GEMC" with additional hit process routine and outputs for all detector systems in SoLID.

It's located SoLID repository https://jlabsvn.jlab.org/svnroot/solid/solid_gemc2 with source codes and detector configuration, field, scripts etc.

You need both the jlab framework and SoLID repository before you have compile and run solid_gemc, refer to the installation section

quick start

setup

All env variables required are setup by source file "set_solid"

make sure you meet the requirement here

The example below demonstrates how to setup in various cases.

on ifarm with official installation of framework and SoLID repository (demonstration)

The fastest way to see what the simulation look like. You don't need to install any thing, but you can't modify anything either.

login into ifarm with your account
source /home/zwzhao/solid/solid_svn/solid/set_solid
follow "compile and run" to run it (skim compiling)

on ifarm with official installation of framework and your SoLID repository (recommended)

You don't need to install the framework, you can modify simulation configuration. This is the best way to run simulation on ifarm and farm nodes. This is recommend way to compare result and produce results.

cd your_choice_of_solid_repo_path
svn co https://jlabsvn.jlab.org/svnroot/solid
cd solid
edit file set_solid by following the instruction within, you only need to change SoLID_GEMC
source set_solid
follow "compile and run" to compile and run it

on any machine with your installation of framework and your SoLID repository (expert)

This gives you maximum freedom to use any version of framework and ability to work on your local machine, And allow you to modify anything. This is the way to run on your local machine.

install the framework by following installation instruction
cd your_choice_of_solid_repo_path
svn co https://jlabsvn.jlab.org/svnroot/solid
cd solid
edit file set_solid by following the instruction within
source set_solid
follow "compile and run" to compile and run it

compile and run

Once you complete the setup procedure, you can now compile "solid_gemc"

cd $SoLID_GEMC/source
scons OPT=1
you need to recompile every time GEMC gets updated

after compiling, do the following to run it

cd $SoLID_GEMC/script
solid_gemc solid_PVDIS_LD2.gcard or  solid_gemc solid_PVDIS_simple.gcard
solid_gemc solid_SIDIS_He3.gcard or  solid_gemc solid_SIDIS_He3_simple.gcard
solid_gemc solid_SIDIS_NH3.gcard or  solid_gemc solid_SIDIS_NH3_simple.gcard

Details

how to run

run "solid_gemc -help" to see running option

read the tutorials on the main GEMC website here

another tutorialGEMC tuturial on 2014/03/06

Use examples in "study" in the repository here to see how to create geometry, store hit and analysis results

geometry

refer to file " $SoLID_GEMC/geometrychangelog" for details

source your set_solid
cd $SoLID_GEMC/geometry
edit perl files to modify geometry, then run command below to generate new geometry txt files
./solid_PVDIS_simple.pl config_solid_PVDIS_simple.dat
./solid_PVDIS_LD2.pl config_solid_PVDIS_LD2.dat
./solid_SIDIS_He3_simple.pl config_solid_SIDIS_He3_simple.dat
./solid_SIDIS_He3.pl config_solid_SIDIS_He3.dat
./solid_SIDIS_NH3_simple.pl config_solid_SIDIS_NH3_simple.dat
./solid_SIDIS_NH3.pl config_solid_SIDIS_NH3.dat



materials

source your set_solid
cd $SoLID_GEMC/geometry
edit the perl file "solid_material.pl" to modify geometry, then run command below to generate new material txt files
./solid_material.pl config_solid_PVDIS_simple.dat
./solid_material.pl config_solid_PVDIS_LD2.dat
./solid_material.pl config_solid_SIDIS_He3_simple.dat
./solid_material.pl config_solid_SIDIS_He3.dat
./solid_material.pl config_solid_SIDIS_NH3_simple.dat
./solid_material.pl config_solid_SIDIS_NH3.dat

hit processing

All quantity should be in "MeV,mm,ns" units as geant4 default

customized hit processing type need 3 things to work togetherL hit process routine in c++ code, bank definition and hit definition

For bank definition, it should have "hitn" to record the number of hits and give unique "bankId" and "bankname"

see examples under https://jlabsvn.jlab.org/svnroot/solid/solid_gemc2/source/hitprocess/ and https://jlabsvn.jlab.org/svnroot/solid/subsystem/gem/gem_gemc/

input

GEMC take two kinds of input

from a particle gun defined in options, for example

<option name="BEAM_P"   value="e-, 5*GeV, 0*deg, 0*deg"/>
<option name="SPREAD_P" value="0*GeV,0*deg,0*deg"/>
<option name="BEAM_V"   value="(0, 0, 0)m"/>
<option name="SPREAD_V" value="(0.,0)cm"/>

or from an external LUND txt file (format defined by here) pointed by its options

 <option name="INPUT_GEN_FILE" value="LUND, input.dat"/>

output

Direct output are txt or evio which is JLab DAQ data format

use text output to debug

convert evio to xml by

evio2xml output.evio

covert evio to root by

evio2root -INPUTF=output.evio -B=(file storing bank definition) -WRITE_RAWS=("yes" or "no" as default)

see evio2root option by

evio2root -help-all

field map

http://hallaweb.jlab.org/12GeV/SoLID/download/field/gemc2/solenoid_CLEOv8.dat
http://hallaweb.jlab.org/12GeV/SoLID/download/field/gemc2/solenoid_ptarget.dat

simulation for sub-detector systems

"solid_gemc" can be used for the whole detector simulation and individual sub-detector systems at the same time.

Each of sub-detector systems can do simulation independently and ready to merge it back into the whole system simulation.

They are located in the repository at

https://jlabsvn.jlab.org/svnroot/solid/subsystem/ec/ec_solid_gemc
https://jlabsvn.jlab.org/svnroot/solid/subsystem/cc/cc_solid_gemc
https://jlabsvn.jlab.org/svnroot/solid/subsystem/gem/gem_solid_gemc
https://jlabsvn.jlab.org/svnroot/solid/subsystem/mrpc/mrpc_solid_gemc