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)
Line 85: Line 85:
  
 
=== Running generated events through a CLASS GEANT-3 simulation ===
 
=== Running generated events through a CLASS GEANT-3 simulation ===
 +
==== running GSIM with the generated events ====
  
 
* port the events file to the shared directory  
 
* port the events file to the shared directory  
Line 99: Line 100:
 
(the result: 2 bos + 1 txt files , '''gsimtest.txt''', '''gsimtest.bos''', '''gpp_test.bos''' and the output file '''outfile1''' )
 
(the result: 2 bos + 1 txt files , '''gsimtest.txt''', '''gsimtest.bos''', '''gpp_test.bos''' and the output file '''outfile1''' )
  
=== running GSIM with the generated events ===
+
* '''gsimtest.bos''' contains the data 'collected' by CLASS (ADC/TDC)
  
 +
* '''gpp_test.bos''' incorporates preprocessing to add smearing of the data
 +
 +
* '''outfile1'''  is the physical data after REConstruction SYStem analyzed it
  
=== Preprocessing to add smearing of the data ===
 
  
 +
==== Look at the output files ====
  
=== Look at the output files ===
+
* using COUNTBS one could count the number of events, e.g.
  
 +
  ./countbs gsimtest.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 gsimtest.bos
 +
  ./bosdump gpp_test.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''')
  
=== Converting the GSIM output file to root ===
 
  
 
=== Observing the output ROOT TTree  ===
 
=== 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.
  
  
  
 
[[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]]

Revision as of 18:03, 2 March 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)


Running GSIM

Setting an Event Generator and create events file

  • PYTHIA is used as the base-line event generator (EG) for GSIM
  • The existing EG is a fortran script located under $GSIM/Documents/ directory.


Setting Event Generator

  • The EG should be modified for the specific solid target. An example for 12C can be found at
 $GSIM/Documents/EventGenerator/src/qp1C.f
  • To build the event generator use the build compilation command, e.g.
 cd  $GSIM/Documents/
 build_EG_cs

(the result: an executable event generator e.g. EventGenerator_exe/EG_C.exe)


Generate the Events

  • Generate the events by executing the EG, e.g.
 ./EG_C.exe > test.dat

(the result: a data file EventGenerator_exe/test.dat)



Look at the generated distributions

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

(the result: a different (just numbers) data file LeptoRoot/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 test.dat) to the converters utility and convert it to txt format.

For example, a file from the 2H target would be converted by

 cp $GSIM/Documents/EventGenerator_exe/test.dat $GSIM/converters
 ./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)
 mv convert_output.dat  ../Lepto64
 cd ../Lepto64
 ./txt2part -m -omctk.evt < convert_output.dat 

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


Running generated events through a CLASS GEANT-3 simulation

running GSIM with the generated events

  • port the events file to the shared directory
 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
  • then source the shell script that runs GSIM
 ./gsim_test.csh

(the result: 2 bos + 1 txt files , gsimtest.txt, gsimtest.bos, gpp_test.bos and the output file outfile1 )

  • gsimtest.bos contains the data 'collected' by CLASS (ADC/TDC)
  • gpp_test.bos incorporates preprocessing to add smearing of the data
  • outfile1 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 gsimtest.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 gsimtest.bos
 ./bosdump gpp_test.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)


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.


[back to Tel Aviv University SRC Group]