How to generate and simulate TOPRex events

Generation on LPSC machines

Retrieve the slightly modified TOPRex  package version 423.
Type the following commands :
tar zxvf TOPRex_423.tgz
cd TOPRex_423/

In order to modify the TOPRex cards, edit the file txrun.dat. you'll get all the needed info from the file txman_423.ps
I still don't know why one cannot the number of modifed events in this file...
Instead, one has to modify the source code itself : edit the file all.f and goto line 113320 where you'll fing the line which defines the number of events to be generated :
ntot = 100
After modifying this line, save all.f and exit.

Compile :
gmake
Then start the generator :
./a.out
In case you got a massage complaining about missing shared libraries, edit your ~/.cshrc file and add the following lines :
setenv LD_LIBRARY_PATH   ${ROOTSYS}/lib:./:path_to_your_TOPRex directory/TOPRex_423/lib
setenv DYLD_LIBRARY_PATH ${ROOTSYS}/lib:./:path_to_your_TOPRex directory/TOPRex_423/lib

First lines of the TOPRex screen output :
 TXGIVE: do not recognize input parameter : Ntot 
TXGIVE: do not recognize input parameter : ckin(3)
TXGIVE: do not recognize input parameter : CKIN(4)
TXGIVE: do not recognize input parameter : MSTP(51)
TXGIVE: do not recognize input parameter : W-boson
TXGIVE: do not recognize input parameter : Z-boson
mtop mb mc 175. 4.8 1.5
****************************************************************************
****************************************************************************
** **
** TTTTTTTT OOOOOOO PPPPPPPP RRRRRRRR EEEEEEEEE XX XX **
** TT OO OO PP PP RR RR EE XX XX **
** TT OO OO PP PP RR RR EE XX XX **
** TT OO OO PPPPPPPP RRRRRRRR EEEEE XXX **
** TT OO OO PP RR RR EE XX XX **
** TT OO OO PP RR RR EE XX XX **
** TT OOOOOOO PP RR RR EEEEEEEEE XX XX **
** **
****************************************************************************
* *
* V E R S I O N 4.23 *
* *
* Event generator *
* *
* Author : Sergey Slabospitsky *
* *
* *
****************************************************************************


****************************************************************************

TopReX start to generate
------------------------

P Pbar collision with Ecm = 1960.0 GeV

TopReX process 20 : gg+qq~ -> tt~ Breit-Wig
m(top) - Breit_Wigner(Gamma_tot)
spin correlations is included

TopReX process 25 : gg+qq~ -> t t~ gamma
m(top) - Breit_Wigner(Gamma_tot)
spin correlations is included

...

Top quarks are mainly pair produced (standard model process) but are allowed to decay via FCNC :

TopReX : FCNC couplings and widths
------------------------------------
New Physics scale Lambda = 1000.00 GeV
FCNC: q Z T
Width U 0.000E+00 Width C 0.195E+01
total t-quark FCNC decay width = 0.195E+01 GeV

TopReX : top decays
--------------------
m(top) = 175.00 GeV
channel ON/OFF width(GeV) Branching
t -> d W OFF 4.420E-05 0.129E-04
t -> s W OFF 2.596E-03 0.758E-03
t -> b W T T~ 1.468E+00 0.429E+00
FCNC : t -> C Z T T~ 1.953E+00 0.570E+00
total top width (GeV) = 3.424E+00
branching ratios for top and top_bar quarks
BR(T -> all) = 9.992E-01 BR(Tbar -> all) = 9.992E-01

...

Control of the cross sections :

EVEevent no= 100
1********* PYSTAT: Statistics on Number of Events and Cross-sections *********

==============================================================================
I I I I
I Subprocess I Number of points I Sigma I
I I I I
I----------------------------------I----------------------------I (mb) I
I I I I
I N:o Type I Generated Tried I I
I I I I
==============================================================================
I I I I
I 0 All included subprocesses I 100 100 I 8.233E-09 I
I 4 User process 20 I 63 63 I 5.573E-09 I
I 6 User process 25 I 37 37 I 2.659E-09 I
I I I I
==============================================================================

********* Total number of errors, excluding junctions = 0 *************
********* Total number of errors, including junctions = 0 *************
********* Total number of warnings = 0 *************
********* Fraction of events that fail fragmentation cuts = 0.00000 *********


final TopReX report
TopReX proc. 20 X-sec(tot) = 5.5739E+00 pb
TopReX proc. 25 X-sec(tot) = 2.6597E+00 pb

The generation process is very fast. You'll get the output file within minutes.
This file contains the HEPEVT common of all generated events in ascii format.
This takes more space but eases the transporation from one machine to another.
The file name has to be changed from fort.87 to input :
mv fort.87 input
If ipar(20)=0, which is the default, the same seed value is used each time the program is run. As a result, the events generated will be exactly identical. If the value is not zero, the seed value will be different each time the code is run. If you want to have a different output file, i.e. different events each time you run a.out, add the following line in the txrun.dat file :
ipar(20)=1
You can check that the output file size changes when ipar(20)=1.

From ascii to Dspack format 

The change of format will be done on clued0, using a fake susygen generator in order to read the previous HEPEVT events and to save them into the Dspack format, that can be used in the mc_runjob framework.

Compilation of the conversion package

cd /work/affe-clued0/user
setup D0RunII p17.09.06
setup d0cvs
newrel -t p17.09.06 pythia_by_hand_p17.09.06
cd pythia_by_hand_p17.09.06
addpkg susygen
addpkg d0_mcpp_gen

Now you need to change the generator by a piece a code that will simply read events from the input file.
Retrieve the file read_ascii_file.f and replace the susygen.f file :

cp read_ascii_file.f susygen/src/susygen.f

Edit the file susygen/bin/OBJECTS and make sure it contains :

hwaend
upinit
upevnt
upveto
alphas2
feynhiggs_dummy
RegHistoryPkg
RegMCsusygen
RegD0Mess
DumpEvent
NewEvent
WriteEvent
LoadDSPACK
framework
The compilation can be started :
d0setwa
srt_setup SRT_QUAL=maxopt
gmake susygen.all
You should end up with some warning messages :
ERROR: multiply defined symbol: ranf_ ['libisajet.a', 'libpacklib.so']
ERROR: multiply defined symbol: vzero_ ['libpacklib.so', 'libLHAPDF.a']
ERROR: multiply defined symbol: vzero_ ['libpacklib.so', 'libLHAPDF.a']
ERROR: multiply defined symbol: lenocc_ ['libpacklib.so', 'libLHAPDF.a']
ERROR: multiply defined symbol: ranf_ ['libisajet.a', 'libpacklib.so']
ERROR: multiply defined symbol: timex_ ['libpacklib.so', 'libLHAPDF.a']
ERROR: multiply defined symbol: vzero_ ['libpacklib.so', 'libLHAPDF.a']
ERROR: multiply defined symbol: lenocc_ ['libpacklib.so', 'libLHAPDF.a']
ERROR: multiply defined symbol: vzero_ ['libpacklib.so', 'libLHAPDF.a']
<--> Compiling binary MCsusygen.x.
<--> Linking binary MCsusygen.x.
/d0usr/products/ld/Linux-2-4/v2_15_dzero/bin/ld: Warning: size of symbol `sugnu_' changed from 72 in /d0usr/products/pythia/Linux-2-4-2-2-4/v6_323-GCC3_4_3/lib/libpythia.a(pysugi.o) to 84 in /d0usr/products/pythia/Linux-2-4-2-2-4/v6_323-GCC3_4_3/lib/libpythia.a(pysugi.o)
/d0usr/products/ld/Linux-2-4/v2_15_dzero/bin/ld: Warning: size of symbol `qcdpar_' changed from 52 in /prj_root/1181/d0_cdist/releases/p17.09.06/lib/Linux2.4-GCC_3_4-maxopt/libcomphep.a(upevent_comphep.o) to 16 in /prj_root/1181/d0_cdist/releases/p17.09.06/lib/Linux2.4-GCC_3_4-maxopt/libcomphep.a(upevent_comphep.o)
/d0usr/products/ld/Linux-2-4/v2_15_dzero/bin/ld: Warning: size of symbol `sugpas_' changed from 132 in /d0usr/products/pythia/Linux-2-4-2-2-4/v6_323-GCC3_4_3/lib/libpythia.a(pysugi.o) to 160 in /d0usr/products/pythia/Linux-2-4-2-2-4/v6_323-GCC3_4_3/lib/libpythia.a(pysugi.o)

The executable file should be build :
affe-clued0[23] ls -lartF ./bin/Linux2.4-GCC_3_4-maxopt/
total 22808
drwxr-xr-x 3 arnoud D0 4096 May 3 02:46 ../
drwxr-xr-x 2 arnoud D0 4096 May 3 02:47 ./
-rwxr-xr-x 1 arnoud D0 23318176 May 3 02:47 MCsusygen.x*

File conversion 

It's now time to fetch the ascii input file :
affe-clued0[26] sftp lpsc0026x.in2p3.fr
Connecting to lpsc0026x.in2p3.fr...
arnoud@lpsc0026x.in2p3.fr's password:
sftp> cd /D0/arnoud/TOPRex_423
sftp> get input
Fetching /D0/arnoud/TOPRex_423/input to input
sftp> exit
100 events have been generated. the converter has to set to this value.
edit the file d0_mcpp_gen/rcp/MCNewEvent.rcp and modify the last line, such that it will contain the same number of events as generated.
 int EventsPerRun = 100
Copy the susygen rcp control file to the top directory :
 cp ./susygen/rcp/runMCsusygen.rcp .
and run the converter :
./bin/Linux2.4-GCC_3_4-maxopt/MCsusygen.x -rcp runMCsusygen.rcp 


It is very likely that you get the foolowing message :
        official wz_gen MCNewEvent p12.01.00 1028753026_0
official wz_gen MCNewEvent p12.00.00 1025757413_0
You cannot assign this parameter set a new name
You may refer to it by one of these other names

Framework 03-May-2007 03:05:04 CDT -:- -
%ERLOG-A init: Framework constructor: RCP problem
Framework 03-May-2007 03:05:04 CDT -:- -
Framework exception occurred:
Information: Framework constructor: RCP problem

Troubleshouting : 

To cure this, edit the file d0_mcpp_gen/rcp/MCNewEvent.rcp and add a dummy line, for instance :

string PackageName = "NewEvent"
int FirstRun = 1
int Runs = 1
int EventsPerRun = 100
int PythiaVersion = 6.49

such that the number of arguments / lines will differ from the
original MCNewEvent.rcp file. (thanks to Laurent Duflot for this).

Within a few seconds, you should get your Dspack events :
affe-clued0[33] ./bin/Linux2.4-GCC_3_4-maxopt/MCsusygen.x -rcp runMCsusygen.rcp

=======================================================

Error Log established
03-May-2007 03:08:05 CDT

=======================================================

Initializing NewEvent package for run 1, 1 runs, 100 events per run
Initializing MCsusygen package
Initializing DumpEvent package
Dump period: 1
Dump number: 1
Initializing WriteEvent package
Output file: d0StreamName, initial wildcard(s) = MCevents.dat, current file MCevents.dat

Maximum Events Per File: 0
Output format: DSPACK
No output filter
Write event tags: *
Veto event tags:
Write chunk tags: *
----------------------------------
Looking for input file...
>>> init completed
WriteEvent: Opening MCevents.dat
100 events generated in 1 runs
WriteEvent: Closing MCevents.dat
First event written: Run number: 1, Event Number: 1
Last event written: Run number: 1, Event Number: 100
Events written: 100
Total events written: 100
TerminationSummary

type message id Examples: run/evt run/evt run/evt
---- -------------------- ---------------- ---------------- ----------------

Severity # Occurrences Total Occurrences
-------- ------------- -----------------
affe-clued0[34]

Two new files are present :

-rw-r--r--   1 arnoud D0 1843200 May  3 03:08 MCevents.dat
-rw-r--r-- 1 arnoud D0 48145 May 3 03:08 MCevent.dump

mc_runjob on ccali

Go to /sps/d0/your_user_name :
cd /sps/d0/arnoud
copy and untar the following file : mc_runjob_ccali.tgz
ccali26[113] pwd
/sps/d0/arnoud
ccali26[114] tar zxvf mc_runjob_ccali.tgz
mc_runjob/
mc_runjob/top_FCNC/
mc_runjob/top_FCNC/d0gstar_output/
mc_runjob/top_FCNC/d0sim_output/
mc_runjob/top_FCNC/d0reco_output/
mc_runjob/top_FCNC/generator/
mc_runjob/top_FCNC/generator/Dspack/
mc_runjob/top_FCNC/generator/Dspack/MCevents.dat
mc_runjob/top_FCNC/tmbanalyze_output/
mc_runjob/top_FCNC/sr.macro
mc_runjob/top_FCNC/CCin2p3_Endrun.py
mc_runjob/top_FCNC/lancerBatch
mc_runjob/top_FCNC/t_tbar_FCNC_TOPRex_423_job_1.sh
ccali26[115] cd mc_runjob
ccali26[117] cd top_FCNC/
ccali26[118] ls -lartF
total 288
drwxr-xr-x 3 arnoud d0 32768 Apr 26 13:12 generator/
-rw-r--r-- 1 arnoud d0 5378 Apr 26 13:27 sr.macro
-rwxr-xr-x 1 arnoud d0 4585 Apr 26 13:27 CCin2p3_Endrun.py*
-rwxr-xr-x 1 arnoud d0 7168 May 4 12:46 t_tbar_FCNC_TOPRex_423_job_1.sh*
-rw-r--r-- 1 arnoud d0 317 May 10 17:40 lancerBatch
drwxr-xr-x 2 arnoud d0 32768 May 10 17:41 d0gstar_output/
drwxr-xr-x 2 arnoud d0 32768 May 10 17:41 d0reco_output/
drwxr-xr-x 2 arnoud d0 32768 May 10 17:41 d0sim_output/
drwxr-xr-x 2 arnoud d0 32768 May 10 17:42 tmbanalyze_output/
ftp your MCevents.dat file from clued0 to ccali, in the generator/Dspack directory :
affe-clued0[12] sftp ccali.in2p3.fr
Connecting to ccali.in2p3.fr...
arnoud@ccali.in2p3.fr's password:
sftp> cd /sps/d0/arnoud/mc_runjob/top_FCNC/generator/Dspack
sftp> put MCevents.dat
Uploading MCevents.dat to /sps/d0/arnoud/mc_runjob/top_FCNC/generator/Dspack/MCevents.dat
sftp> exit
affe-clued0[13]

Then submit your job :

ccali26[122] qsub -l platform=LINUX,T=500000 -l u_users_d0,M=2GB,scratch=20GB -o t_tbar_FCNC_TOPRex_423_job_1.eo -N t_tbar_FCNC_job_1 t_tbar_FCNC_TOPRex_423_job_1.sh
job t_tbar_FCNC_TOPRex_423_job_1 submitted to anastasie cluster with submit time = 05/10/2007-18:00:48

ccali26[123] qjob
user jobname status time worker cputime prio
--------------------------------------------------------------------------
arnoud t_tba.._1 QUEUED 05/10-18:00 T@LINUX /500000 1010

...

ccali26[125] qjob
user jobname status time worker cputime prio
--------------------------------------------------------------------------
arnoud t_tba.._1 RUNNING 05/10-18:02 T.ccwl0151 1188/500000 1010


Running mc_runjob (d0gstar, d0sim, d0reco and tmbanalyze) on ccali on 100 events takes using the following command takes 70 "normalized" hours ot the 150 max allowed :
***************************************************************
* Elapsed time:            4:43:30                            *
* CPU total real:          3:12:24                            *
*     total normalized:    70:32:48 (time limit: 138:53:20)   *
*     system real:         0:00:35                            *
* SPOOL (stdout&err):      336 KB                             *
* SCRATCH:                 343 MB                             *
* VIRTUAL STORAGE:         493 MB                             *
* XTAGED:                  0 MB                               *
* CPU Rate Raw (CPU/elaps):67 %                               *
*          Corrected:      96 %                               *
* IO Rate (xtage/CPU):     0 KB/second                        *
***************************************************************