HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Simulation

Simulation

The simulation takes input files containint a list of events, each containing one or several particles with their PDG ID, origin point and 4-momentum. The format is like this:

BEGIN EVENT
NEW TRACK 1
$PID $X0 $Y0 $Z0 $T0 $PX $PY $PZ $E
NEW TRACK 2
...
END EVENT
BEGIN EVENT
...
END EVENT

The output file name is defined in the configuration file:

sed -e "s;output2.txt;$OUTPUTIONISATION;" simbase/Geant4-build/runHarpo.mac > runTmp.mac

The Geant4 macro test2 generates a file describing the ionisation along the tracks. You run it with:

simbase/Geant4-build/test2 runTmp.mac $INPUTTRACKS

You can then use this to run a simulation of the drift, amplification and digitisation in HARPO.

First, you define the input file in the configuration file sim.cfg with:

# file sim.cfg
Sim:
{
  IonisationType = 2;
  IonisationFile = "$OUTPUTIONISATION";
};

You can then generate a ROOT file compatible with the HARPO analysis:

harpoanalysis -a HarpoAnalyseWriter --sim -c sim.cfg -o sim_raw.root -n $Nevents

The script runSim.sh allows to run a complete simulation and reconstruction from an track distribution file.

 /home/philippe/harpo/Code/Analysis//trunk/scripts/runSim.sh [options] 
   -h,--help           : show this help
   -v                  : verbose
   -x                  : test. Only show commands, don't run. Creates config files
   -c                  : cosmics simulation (default: beam)
   -i, --iso           : isotropic photons
   -f, --root-file <>  : input ROOT file (Denis)
   -F, --txt-file <>   : input TXT file (Philippe)
   -C <>               : Configuration for HARPO simulation (default $HARPO_SCRIPT_DIR/sim.cfg)
   -d, --input-dir <>  : Input directory
   -D, --output-dir <> : Output directory
   -o, --output-file<> : Output files root (no extension). Outputs will be ..._ion.txt, ..._raw.root, ..._reco.root, ..._hist.root
   -n <>               : Number of events
   -g, --gain <>       : gain (default 600)
   -V, --vdrift        : drift velocity (default 31.3 mm/us)
   -r <>               : run number (>10000)
   -a <>               : rotation angle
   -p <>               : pressure (mbar)
   -t <>               : temperature (C)
   -A <>               : analysis list. Default: reconstruction
   -R <>               : reprocessing level (0: ana only, 1:+reco, 2:+simTPC, 3+simG4)
   --suffix <>         : add suffix to output files
   --slope <> <>       : alignment angles in X and Y direction (default 0.04 -0.04)

The script simPola.sh allows to simulate a set of TPC configuration (4 rotations) for a beam. Uses runSim.sh.