Difference between revisions of "Running GSIM CLAS simulation"

From Hall A Wiki
Jump to: navigation, search
(Running generated events through a CLASS GEANT-3 simulation)
(Look at the output files)
 
(29 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== GSIM Inventory ==
 
== GSIM Inventory ==
 +
 +
* [http://nuclear.unh.edu/~maurik/gsim_info.shtml GSIM HomePage]
  
 
* GSIM directory is to be located on the farm, at a large enough work disk. An example of the simulation inventory can be found at
 
* GSIM directory is to be located on the farm, at a large enough work disk. An example of the simulation inventory can be found at
  
   /work/halla/e07006/disk1/Erez/GSIM (will be used for the remainder of the documentation as $GSIM)
+
   /work/halla/e07006/disk1/Erez/gsim (will be used for the remainder of the documentation as $GSIM)
  
 +
* To get directly to the GSIM location an alias was set, so simply type
  
 +
  GoGSIM
  
 
== Running GSIM ==  
 
== Running GSIM ==  
Line 11: Line 15:
 
=== Setting an Event Generator and create events file ===
 
=== Setting an Event Generator and create events file ===
  
* PYTHIA is used as the base-line event generator (EG) for GSIM
+
* The simple kinematic event generator we use at TAU is based on actual data:
 +
e-e'p events in which 1 proton was detect serve as baseline to generation of a second proton, using the c.m. kinematics calculation
  
* The existing EG is a ''fortran''  script located under '''$GSIM/Documents/''' directory.  
+
* For jets/showers, PYTHIA and Lepto64 are used as the base-line event generator for GSIM
 +
 
 +
* The existing EG is a ''ROOT''  macro located under '''$GSIM/EventGenerator/''' directory.  
  
  
Line 20: Line 27:
 
* The EG should be modified for the specific solid target. An example for 12C can be found at
 
* The EG should be modified for the specific solid target. An example for 12C can be found at
  
   $GSIM/Documents/EventGenerator/src/qp1C.f
+
   $GSIM/EventGenerator/eep_EG.C
 +
 
 +
==== Generate the Events ====
  
 
* To build the event generator use the build compilation command, e.g.
 
* To build the event generator use the build compilation command, e.g.
  
   cd $GSIM/Documents/
+
   root -l eep_EG.C
  build_EG_cs
+
  
(the result: an executable event generator e.g. '''EventGenerator_exe/EG_C.exe''')
+
(the result: an executable event generator e.g. '''lepto_exe/LeptoC.exe''')
  
 +
==== Look at the generated distributions ====
  
 +
* A utility for observing the generated data exist in the main EG directory '''$GSIM/EventGenerator/LeptoRoot'''
  
==== Generate the Events ====
+
* Port the data file into the utility directory ('''cp''' the file to the right location)
  
* Generate the events by executing the EG, e.g.
+
* A perl script is used to write it in the right format
  
   ./EG_C.exe > test.dat
+
  rm data.dat
 +
   ./leptoroot.pl < C.dat > data.dat  
  
(the result: a data file '''EventGenerator_exe/test.dat''')
+
(the result: a different (just numbers) data file '''data.dat''')
  
 +
* An executable is then used to write the data into a ROOT TTree
  
 +
  ./leptoroot
  
 +
(the result: a ROOT file '''LeptoRoot/data.root''' that will enable you to observe the generated distributions)
  
==== Look at the generated distributions ====
+
=== Converting generated data files to GEANT-3 format input ===
  
* A utility for observing the generated data exist in the main EG directory '''$GSIM/Documents/EventGenerator/LeptoRoot'''
+
* port the generated-events data file (in this example '''C.txt''') to the converter utility and convert it. e.g.
  
* Port the data file into the utility directory
+
  ./txt2part -m -o12_100GeV.evt < 12_100GeV.txt
  
  cp $GSIM/Documents/EventGenerator_exe/test.dat $GSIM/Documents/LeptoRoot/
+
(the result: a part file '''mctk.evt''' suitable for GSIM)
  
* A perl script is used to write it in the right format
+
=== Running generated events through a CLASS GEANT-3 simulation ===
 +
==== running GSIM with the generated events ====
  
  ./leptoroot.pl < test.dat > data.dat
+
* to run the first XXXX events through the simulation, modify the '''ffread.in''' file so that it triggers XXXX events
  
(the result: a different (just numbers) data file '''LeptoRoot/data.dat''')
+
* then execute the shell script that runs GSIM with e.g. '''12_100GeV.evt'''
  
* An executable is then used to write the data into a ROOT TTree
+
  ./gsim_Batch.csh 12_100GeV
  
  ./leptoroot
+
* or simply use the run command
  
(the result: a ROOT file '''LeptoRoot/data.root''' that will enable you to observe the generated distributions)
+
  RunGSIM 12_100GeV
  
 +
* '''gsim_*.bos''' contains the data 'collected' by CLASS (ADC/TDC)
  
 +
* '''gpp_*.bos''' incorporates preprocessing to add smearing of the data
 +
 +
* '''outfile_*'''  is the physical data after REConstruction SYStem analyzed it
  
 +
==== Look at the output files ====
  
=== Converting generated data files to GEANT-3 format input ===
+
* using COUNTBS one could count the number of events, e.g.
  
* port the generated-events data file (in this example '''test.dat''') to the converters utility and convert it to txt format.  
+
  ./countbs gsim_*.bos
For example, a file from the 2H target would be converted by
+
  
  cp $GSIM/Documents/EventGenerator_exe/test.dat $GSIM/converters
+
(Note the first additional two events are header and are not to be accounted)
  ./convert_deut < test.dat > convert_output.dat
+
+
(the result: a txt file '''/converters/convert_output.dat''' )
+
  
* port and convert the txt file to a G3 part format corresponding to the MCTK bank (works better than particle bank in G3)
+
* using BOSDUMP code, one can look at the data from the terminal, e.g.
  
   mv convert_output.dat  ../Lepto64
+
   ./bosdump gsim_*.bos
  cd ../Lepto64
+
   ./bosdump gpp_*.bos
   ./txt2part -m -omctk.evt < convert_output.dat
+
  
(the result: a part file '''/Lepto64/mctk.evt''' suitable for GSIM)
+
=== Converting the GSIM output file to ROOT ===
  
 +
* this is the easy part now. For an output file named '''outfile1''' e.g., use
  
=== Running generated events through a CLASS GEANT-3 simulation ===
+
  ./WriteRootDst -o output.root -GSIM outfile1
  
* port the events file to the shared directory
+
(the result: a root file '''/output.root''')
  
  mv mctk.evt share
 
  cd share
 
  
* to run the first XXXX events through the simulation, modify the '''ffread''' file so that it triggers XXXX events
+
=== Writing the physical tree  ===
  
* then source the shell script that runs GSIM
+
* The same way used to write the data file (utilizing write_tree.cxx) an executable is generated from write_simulation.cxx
  
  ./gsim_test.csh
+
* write_simulation.cxx, apart from writing the EVNT bank data, also writes GSIM data
  
(the result: 2 bos + 1 txt files , '''gsimtest.txt''', '''gsimtest.bos''', '''gpp_test.bos''' and the output file '''outfile1''' )
+
* An example can be found at '''/u/home/cohen/Clas/WriteTreeEG2'''
  
=== running GSIM with the generated events ===
+
* A soft link is generated at '''/w/halla-scifs2/e07006/Erez/gsim/simulate/WriteTree''' so the only thing ones has to type is
  
 +
  write_simulation
  
=== Preprocessing to add smearing of the data ===
 
  
 +
=== Observing the output ROOT TTree  ===
  
=== Look at the output files ===
+
* The ROOT TTree is called
  
 +
  CLASEVENT
  
=== Converting the GSIM output file to root ===
+
* To look at the data use e.g.
  
=== Observing the output ROOT TTree  ===
+
  CLASEVENT -> StartViewer()
 +
 
 +
* The 'collected data' is stored in '''EVNT.XXXX''' variables, while the generated data is stored in '''GSIM.XXXX''' variables.
 +
 
 +
 
 +
 
 +
=== Running GSIM in interactive mode ===
 +
 
 +
* follow the steps up to ''./gsim_test.csh'' (without executing the shell script!)
 +
 
 +
* source the necessary environmental set-ups
 +
 
 +
  source /group/clas/builds/environment.csh
 +
 
 +
* run GSIM
 +
 
 +
  gsim_int -ffread ffread.in -mcin XXXX.evt
 +
 
 +
(where XXXX.evt is the event file, e.g. mctk.evt)
 +
 
 +
* inside GSIM you will be prompted to answer a question. disregard it (type ''' \return''')
 +
 
 +
* execute the following commands
  
 +
  switch 1 2
 +
  dcut clas 2 0 10 10 0.015 0.015
 +
  trig 1
  
  
  
 
[[https://hallaweb.jlab.org/wiki/index.php/Tel_Aviv_University_SRC_group back to Tel Aviv University SRC Group]]
 
[[https://hallaweb.jlab.org/wiki/index.php/Tel_Aviv_University_SRC_group back to Tel Aviv University SRC Group]]

Latest revision as of 10:47, 12 April 2015

GSIM Inventory

  • GSIM directory is to be located on the farm, at a large enough work disk. An example of the simulation inventory can be found at
 /work/halla/e07006/disk1/Erez/gsim  (will be used for the remainder of the documentation as $GSIM)
  • To get directly to the GSIM location an alias was set, so simply type
 GoGSIM

Running GSIM

Setting an Event Generator and create events file

  • The simple kinematic event generator we use at TAU is based on actual data:

e-e'p events in which 1 proton was detect serve as baseline to generation of a second proton, using the c.m. kinematics calculation

  • For jets/showers, PYTHIA and Lepto64 are used as the base-line event generator for GSIM
  • The existing EG is a ROOT macro located under $GSIM/EventGenerator/ directory.


Setting Event Generator

  • The EG should be modified for the specific solid target. An example for 12C can be found at
 $GSIM/EventGenerator/eep_EG.C

Generate the Events

  • To build the event generator use the build compilation command, e.g.
 root -l  eep_EG.C

(the result: an executable event generator e.g. lepto_exe/LeptoC.exe)

Look at the generated distributions

  • A utility for observing the generated data exist in the main EG directory $GSIM/EventGenerator/LeptoRoot
  • Port the data file into the utility directory (cp the file to the right location)
  • A perl script is used to write it in the right format
 rm data.dat
 ./leptoroot.pl < C.dat > data.dat 

(the result: a different (just numbers) data file data.dat)

  • An executable is then used to write the data into a ROOT TTree
 ./leptoroot 

(the result: a ROOT file LeptoRoot/data.root that will enable you to observe the generated distributions)

Converting generated data files to GEANT-3 format input

  • port the generated-events data file (in this example C.txt) to the converter utility and convert it. e.g.
 ./txt2part -m -o12_100GeV.evt < 12_100GeV.txt 

(the result: a part file mctk.evt suitable for GSIM)

Running generated events through a CLASS GEANT-3 simulation

running GSIM with the generated events

  • to run the first XXXX events through the simulation, modify the ffread.in file so that it triggers XXXX events
  • then execute the shell script that runs GSIM with e.g. 12_100GeV.evt
 ./gsim_Batch.csh 12_100GeV
  • or simply use the run command
 RunGSIM 12_100GeV
  • gsim_*.bos contains the data 'collected' by CLASS (ADC/TDC)
  • gpp_*.bos incorporates preprocessing to add smearing of the data
  • outfile_* is the physical data after REConstruction SYStem analyzed it

Look at the output files

  • using COUNTBS one could count the number of events, e.g.
 ./countbs gsim_*.bos

(Note the first additional two events are header and are not to be accounted)

  • using BOSDUMP code, one can look at the data from the terminal, e.g.
 ./bosdump gsim_*.bos
 ./bosdump gpp_*.bos

Converting the GSIM output file to ROOT

  • this is the easy part now. For an output file named outfile1 e.g., use
 ./WriteRootDst -o output.root -GSIM outfile1

(the result: a root file /output.root)


Writing the physical tree

  • The same way used to write the data file (utilizing write_tree.cxx) an executable is generated from write_simulation.cxx
  • write_simulation.cxx, apart from writing the EVNT bank data, also writes GSIM data
  • An example can be found at /u/home/cohen/Clas/WriteTreeEG2
  • A soft link is generated at /w/halla-scifs2/e07006/Erez/gsim/simulate/WriteTree so the only thing ones has to type is
 write_simulation


Observing the output ROOT TTree

  • The ROOT TTree is called
 CLASEVENT
  • To look at the data use e.g.
 CLASEVENT -> StartViewer()
  • The 'collected data' is stored in EVNT.XXXX variables, while the generated data is stored in GSIM.XXXX variables.


Running GSIM in interactive mode

  • follow the steps up to ./gsim_test.csh (without executing the shell script!)
  • source the necessary environmental set-ups
 source /group/clas/builds/environment.csh
  • run GSIM
 gsim_int -ffread ffread.in -mcin XXXX.evt

(where XXXX.evt is the event file, e.g. mctk.evt)

  • inside GSIM you will be prompted to answer a question. disregard it (type \return)
  • execute the following commands
 switch 1 2 
 dcut clas 2 0 10 10 0.015 0.015
 trig 1


[back to Tel Aviv University SRC Group]