MEMO for me on CDF

No warrant. Use at your own risk.


Dec 11, 2003
MC sample for CDF-J Meeting 2003
[w/ corr] ~/spool/spin/herwig/ana/anac1 >./filedef.sh /data/cdf08/takeuchi/herwig/ee/w_corr/{p100[123456789],p1010}/*_ntuple.root /data/cdf08/takeuchi/herwig/emu/w_corr/{p140[12345679],p1410,p1411}/*_ntuple.root /data/cdf08/takeuchi/herwig/mue/w_corr/{p150[123456789],p1510}/*_ntuple.root /data/cdf08/takeuchi/herwig/mumu/w_corr/{p120[123456789],p1210}/*_ntuple.root

[w/o corr] ~/spool/spin/herwig/ana/anac1 >./filedef.sh /data/cdf08/takeuchi/herwig/ee/wo_corr/{p200[123456789],p2010}/*_ntuple.root /data/cdf08/takeuchi/herwig/emu/wo_corr/{p240[23456789],p2410,p2411}/*_ntuple.root /data/cdf08/takeuchi/herwig/mue/wo_corr/{p250[123456789],p2510}/*_ntuple.root /data/cdf08/takeuchi/herwig/mumu/wo_corr/{p220[123456789],p2210}/*_ntuple.root

Nov 19, 2003
MET object in HighLevelObjects.hh

//----------------------------------
// Missing Et
//----------------------------------
class missingEt : public TObject {
  public:
 
  missingEt();
  ~missingEt() {};

  float Met;
  float Phi;
  float ZV;
  float ESum;
  float EtSum;
  float ExSum;
  float EySum;

  ClassDef(missingEt,1)
};

Summary object in HighLevelObjects.hh
//----------------------------------
// Summary
//----------------------------------

// Default constructor
summary::summary() {
   fTopEventClass = 0;
   fnTightEle = 0;
   fnLooseEle = 0;
   fnTightMuo = 0;
   fnLooseMuo = 0;
   fnTightLepton = 0;
   fnLooseLepton = 0;
   fnTightJet = 0;
   fnLooseJet = 0;
   frawMet = -999.0;
   frawMetPhi = -999.0;
   fvtxMet = -999.0;
   fvtxMetPhi = -999.0;
   fmuoMet = -999.0;
   fmuoMetPhi = -999.0;
   fprimZV = -999.0;
   fjetZV = -999.0;
   fprimZVerr = -999.0;
   fjetZVerr = -999.0;
   fhadSumEt = -999.0;
   fhadSumEt3 = -999.0;
   fhadCentrality = -999.0;
   fhadAplanarity = -999.0;
   fhadSphericity = -999.0;
   fdileptonHT = -999.0;
   flepjetsHT = -999.0;
}



Oct 28, 2003
Make shared library of Jet package to make use of JetCorrection with topntuple in ROOT.
cd ~/spool/spin/herwig/workrel
setenv USESHLIBS 1
gmake JetUser.lib LINK_SHARED_ROOT=yes
cp shlib/Linux2-KCC_4_0/libJetUser_forRoot.so ~/spool/spin/herwig/ana/anac0/shlib/

In anascript.C, add
   gSystem->SetIncludePath("-I./include -I$CDFSOFT2_DIR/include");
   gSystem->Load("./shlib/libJetUser.so");

Oct 06, 2003
Reproduction Mumu sample
cd /data/cdf08/takeuchi/herwig/mumu/w_corr
seqnum.rb -i 01 -f 25 -e '~/spool/spin/herwig/scripts/runtopfind.sh 12%n' > & log.seqnum.topfind.01-25 &
seqnum.rb -i 26 -f 50 -e '~/spool/spin/herwig/scripts/runtopfind.sh 12%n' > & log.seqnum.topfind.26-50 &

cd /data/cdf08/takeuchi/herwig/mumu/wo_corr
seqnum.rb -i 01 -f 25 -e '~/spool/spin/herwig/scripts/runtopfind.sh 22%n' > & log.seqnum.topfind.01-25 &
seqnum.rb -i 26 -f 50 -e '~/spool/spin/herwig/scripts/runtopfind.sh 22%n' > & log.seqnum.topfind.26-50 &

Reproduction Emu sample
cd /data/cdf08/takeuchi/herwig/emu/w_corr
seqnum.rb -i 01 -f 25 -e '~/spool/spin/herwig/scripts/runtopfind.sh 14%n' > & log.seqnum.topfind.01-25 &
seqnum.rb -i 01 -f 25 -e '~/spool/spin/herwig/scripts/runtopfind.sh 24%n' > & log.seqnum.topfind.01-25 &

Oct 03, 2003
Reproduction w/o remake
cd /data/cdf08/takeuchi/herwig/ee/w_corr
( seqnum.rb -i 05 -f 27 -e '~/spool/spin/herwig/scripts/runprod.sh 10%n' > & log.seqnum.prod.05-27 ; seqnum.rb -i 05 -f 27 -e '~/spool/spin/herwig/scripts/runtopfind.sh 10%n' > & log.seqnum.topfind.05-27 ) &
( seqnum.rb -i 28 -f 50 -e '~/spool/spin/herwig/scripts/runprod.sh 10%n' > & log.seqnum.prod.28-50 ; seqnum.rb -i 28 -f 50 -e '~/spool/spin/herwig/scripts/runtopfind.sh 10%n' > & log.seqnum.topfind.28-50 ) &

cd /data/cdf08/takeuchi/herwig/ee/wo_corr
( seqnum.rb -i 01 -f 25 -e '~/spool/spin/herwig/scripts/runprod.sh 20%n' > & log.seqnum.prod.01-25 ; seqnum.rb -i 01 -f 25 -e '~/spool/spin/herwig/scripts/runtopfind.sh 20%n' > & log.seqnum.topfind.01-25 ) &
( seqnum.rb -i 26 -f 50 -e '~/spool/spin/herwig/scripts/runprod.sh 20%n' > & log.seqnum.prod.26-50 ; seqnum.rb -i 26 -f 50 -e '~/spool/spin/herwig/scripts/runtopfind.sh 20%n' > & log.seqnum.topfind.26-50 ) &


Sep 30, 2003
Recompile cdfSim
cd ~/spool/spin/herwig/workrel/generatorMods/src
vi hwbrset.F
cd ..
gmake
cd ../SimulationMods/test
gmake bin

Modify TopRemake
/data/cdf08/takeuchi/herwig/TopAnaRel >addpkg TrackingUserMods

   Release 4.11.1 uses TrackingUserMods version V00-00-56, will check that out
   Adding package "TrackingUserMods" to ".".
   cvs checkout -P-r V00-00-56 TrackingUserMods

/data/cdf08/takeuchi/herwig/TopAnaRel/TrackingUserMods >vi src/TrackRefitModule.cc
gmake nobin
cd ..
gmake
TopMods.bin

CdfTrack class http://cdfkits.fnal.gov/CdfCode/source/TrackingObjects/TrackingObjects/Tracks/CdfTrack.hh

node05.tsukuba.jp.hep.net:/data/cdf08/takeuchi/herwig/TopAnaRel >addpkg TrackingUserHL
Release 4.11.1 uses TrackingUserHL version V00-00-18, will check that out
Adding package "TrackingUserHL" to ".".
cvs checkout -P-r V00-00-18 TrackingUserHL


Sep 25, 2003
Remake for Phoenix
cd /data/cdf08/takeuchi/herwig/ee/w_corr
(seqnum.rb -i 05 -f 27 -e '~/spool/spin/herwig/scripts/runprod.sh 10%n' > & log.seqnum.prod.05-27; \
 seqnum.rb -i 05 -f 27 -e '~/spool/spin/herwig/scripts/runremake.sh 10%n' >& log.seqnum.remake.05-27; \
 seqnum.rb -i 05 -f 27 -e '~/spool/spin/herwig/scripts/runtopfind.sh 10%n' >& log.seqnum.topfind.05-27 ) &
(seqnum.rb -i 28 -f 50 -e '~/spool/spin/herwig/scripts/runprod.sh 10%n' > & log.seqnum.prod.28-50; \
 seqnum.rb -i 28 -f 50 -e '~/spool/spin/herwig/scripts/runremake.sh 10%n' >& log.seqnum.remake.28-50; \
 seqnum.rb -i 28 -f 50 -e '~/spool/spin/herwig/scripts/runtopfind.sh 10%n' >& log.seqnum.topfind.28-50 ) &

cd /data/cdf08/takeuchi/herwig/ee/wo_corr
( seqnum.rb -i 01 -f 25 -e '~/spool/spin/herwig/scripts/runprod.sh 20%n' > & log.seqnum.prod.01-25 ; seqnum.rb -i 01 -f 25 -e '~/spool/spin/herwig/scripts/runremake.sh 20%n' > & log.seqnum.remake.01-25 ; seqnum.rb -i 01 -f 25 -e '~/spool/spin/herwig/scripts/runtopfind.sh 20%n' > & log.seqnum.topfind.01-25 ) &
( seqnum.rb -i 26 -f 50 -e '~/spool/spin/herwig/scripts/runprod.sh 20%n' > & log.seqnum.prod.26-50 ; seqnum.rb -i 26 -f 50 -e '~/spool/spin/herwig/scripts/runremake.sh 20%n' > & log.seqnum.remake.26-50 ; seqnum.rb -i 26 -f 50 -e '~/spool/spin/herwig/scripts/runtopfind.sh 20%n' > & log.seqnum.topfind.26-50 ) &


Sep 23, 2003
PhoenixMods
http://cdfkits.fnal.gov/CdfCode/source/PhoenixMods/  or $CDFSOFT2_DIR/PhoenixMods/src/PhoenixTracking.cc

TrakingVariables::trkZVertex()
http://cdfkits.fnal.gov/CdfCode/source/HighLevelObjects/src/Tracking/TrackingVariables2.cc#027

Modify TopRemake
edit ~/spool/spin/herwig/workrel/PhoenixMods/src/PhoenixTracking.cc
cd ~/spool/spin/herwig/workrel/PhoenixMods; gmake nobin
cd ~/spool/spin/herwig/workrel/TopMods; gmake bin

Sep 20, 2003
Making mue sample
[cdfSim for mue]
cdf2 4.11.1    -> alias cdf2  'unsetenv LD_LIBRARY_PATH; setup cdfsoft2 \!*; source ${SRT_DIST}/rcpdb/scripts/rcp_add_writable.csh'
cd ~/spool/spin/herwig/workrel/generatorMods/src
vi hwbrset.F
    C. eemode-> 3, 8
    *      BRFRAC(3)=1.0

    *      BRFRAC(8)=1.0
    C. mumu mode -> 4, 9
    *      BRFRAC(4)=1.0
    *      BRFRAC(9)=1.0
    C. e+mu- mode -> 3, 9
    *      BRFRAC(3)=1.0
    *      BRFRAC(9)=1.0
    C. mu+e- mode -> 4, 8
          BRFRAC(4)=1.0
          BRFRAC(8)=1.0
cd ..
gmake; cd ../SimulationMods/test; gmake bin

cd /data/cdf08/takeuchi/herwig/mue/w_corr
seqnum.rb -i 01 -f 25 -e '~/spool/spin/herwig/scripts/runsim_hw_w_corr.sh 15%n' > & log.seqnum.sim.01-25 &
cd ../wo_corr
seqnum.rb -i 01 -f 25 -e '~/spool/spin/herwig/scripts/runsim_hw_wo_corr.sh 25%n' > & log.seqnum.sim.01-25 &


Sep 17, 2003
Making emu sample
[sim]
cd /data/cdf08/takeuchi/herwig/emu/w_corr
seqnum.rb -i 01 -f 13 -e '~/spool/spin/herwig/scripts/runsim_hw_w_corr.sh 14%n' > & log.seqnum.sim.01-13 &
cd ../wo_corr
seqnum.rb -i 01 -f 13 -e '~/spool/spin/herwig/scripts/runsim_hw_wo_corr.sh 24%n' > & log.seqnum.sim.01-13 &

cd /data/cdf08/takeuchi/herwig/emu/w_corr
seqnum.rb -i 14 -f 25 -e '~/spool/spin/herwig/scripts/runsim_hw_w_corr.sh 14%n' > & log.seqnum.sim.14-25 &
cd ../wo_corr
seqnum.rb -i 14 -f 25 -e '~/spool/spin/herwig/scripts/runsim_hw_wo_corr.sh 24%n' > & log.seqnum.sim.14-25 &

[prod]
cd /data/cdf08/takeuchi/herwig/emu/w_corr
seqnum.rb -i 01 -f 25 -e '~/spool/spin/herwig/scripts/runprod.sh 14%n' > & log.seqnum.prod.01-25 ; \
seqnum.rb -i 01 -f 25 -e '~/spool/spin/herwig/scripts/runremake.sh 14%n' > & log.seqnum.remake.01-25; \
seqnum.rb -i 01 -f 25 -e '~/spool/spin/herwig/scripts/runtopfind.sh 14%n' > & log.seqnum.topfind.01-25 &

cd /data/cdf08/takeuchi/herwig/emu/wo_corr
seqnum.rb -i 01 -f 25 -e '~/spool/spin/herwig/scripts/runprod.sh 24%n' > & log.seqnum.prod.01-25 ; \
seqnum.rb -i 01 -f 25 -e '~/spool/spin/herwig/scripts/runremake.sh 24%n' > & log.seqnum.remake.01-25; \
seqnum.rb -i 01 -f 25 -e '~/spool/spin/herwig/scripts/runtopfind.sh 24%n' > & log.seqnum.topfind.01-25 &

Aug 24, 2003
http://www-cdf.fnal.gov/internal/people/links/EvelynThomson/TopInstructions_4111.html
You can make one like this:
  rcp_init_personal (do this only once - makes a personal database in ~/rcpdb/personal
  rcp_add_writable (you must do this every time you setup cdfsoft2)
If you're running on the caf, then make a soft link to this database in your caf script area:
  ln -s ~/rcpdb personal_rcp
Do the usual command after setup cdfsoft2 and export this variable to the caf in your script
  rcp_add_writable
 export RCP_FILESYSTEMDB_WRITABLE_DIR=./personal_rcp

Copy toppli ( official mc sample)
seqnum.rb -i 10 -f 29 -e 'rcp fcdfsgi2.fnal.gov:/cdf/data60/top/TopNtuple_4111/mc/ttopli/ttopli_%n.root .'

Jet object in TopNtuple Aug 22, 2003
http://cdfkits.fnal.gov/CdfCode/source/TopMods/TopMods/HighLevelObjects.hh#740

http://www-cdf.fnal.gov/internal/physics/top/topdata/newtopdata.html
4 collections of electrons stored -
    CollType==1 is tight + isolation
    CollType==2 is loose
    CollType==3 is all defEmObjects
    CollType==4 is PhoenixElectrons
4 collections of muons stored -
    ViewType==1 is tight + isolation
    ViewType==2 is loose
    ViewType==3 is all defMuons
    ViewType==4 is all defStublessMuons
Many collections of jets stored -
    CollType==1 is tight (raw ET>15 GeV, |eta|<2.0)
    CollType==2 is loose (raw ET> 8 GeV, |eta|<2.4)
    CollType==3 is all reclustered jets (ET>3GeV is seed threshold)
Summary object contains number of tight isolated leptons, MET corrected for tight isolated muons

Aug 14, 2003
seqnum.rb -i 1007 -f 1045 -e "~/spool/spin/herwig/scripts/runremake.sh %n"

~/spool/spin/herwig/ana/ana04
./filedef.sh /data/cdf08/takeuchi/herwig/w_corr/p104[567]/herwig_ttbar.*.root
root -l -b -q anascript.C

Lshr Aug 13, 2003
CalculateLshr methods

Electron object in TopNtuple Aug 04, 2003
TClonesArray* eleA;    //electrons
eleA = new TClonesArray("electron");   
chain->SetBranchAddress("electron",&eleA);    //   chain = new TChain("TopTree");
chain->SetBranchAddress("numEmObjs",&nele); 
for(int indx = 0; indx<nele; indx++) {
  electron* el = (electron*) eleA->At(indx);
  ...
}

http://cdfkits.fnal.gov/CdfCode/source/TopMods/TopMods/HighLevelObjects.hh#388

http://www-cdf.fnal.gov/internal/physics/top/topdata/newtopdata.html
Brief TopNtuple Glossary
4 collections of electrons stored -
    CollType==1 is tight + isolation
    CollType==2 is loose
    CollType==3 is all defEmObjects
    CollType==4 is PhoenixElectrons
4 collections of muons stored -
    ViewType==1 is tight + isolation
    ViewType==2 is loose
    ViewType==3 is all defMuons
    ViewType==4 is all defStublessMuons
Many collections of jets stored -
    CollType==1 is tight (raw ET>15 GeV, |eta|<2.0)
    CollType==2 is loose (raw ET> 8 GeV, |eta|<2.4)
    CollType==3 is all reclustered jets (ET>3GeV is seed threshold)
Summary object contains number of tight isolated leptons, MET corrected for tight isolated muons

        eleList set WZTightEmObjectView
        eleList add WZLooseEmObjectView
        eleList add defEmObjects
        eleList add PhoenixEmObjectView

TopAlgorithms::correctElectron()
http://cdfkits.fnal.gov/CdfCode/source/Top/src/TopAlgorithms.cc#421

el->Fiducial
http://cdfkits.fnal.gov/CdfCode/source/Electron/Electron/emobj_alg.hh#309
typedef enum { ERRORFID = -1, NONFIDUCIAL = 0, FIDUCIAL_CEM = 1,
               FIDUCIAL_CEMTWR_9 = 2, FIDUCIAL_CHIMNEYTWR_7 = 3,
               FIDUCIAL_CEM_TRACK = 4,
               FIDUCIAL_PEM = 5, FIDUCIAL_PEM_TRACK = 6 } FidEle_Status;


How to fetch Beamline data Aug 01, 2003
> BeamDatabase -nocot -history 19 151435
Reading from ofotl_prd_read range: 151435-151435
Entries   COT: 38984  SVX: 27689
         Svx Beam Position for run 151435 :
Ver: 10  Status: GOOD        History: 19  Algo: 20  Source: 10
x0:  -0.17928  y0:   0.46294  slope x (mr):  0.5235  slope y (mr):  0.1438
beam_z:     2.8262  width_z:   27.8291
subrun  0 x0: -0.17926 y0:  0.46308 slope x (mr):  0.5237 slope y (mr):  0.1490
subrun  1 x0: -0.17942 y0:  0.46267 slope x (mr):  0.5261 slope y (mr):  0.1378

Customize of ana.cc Jul 31, 2003

How to analyze topntuple Jul 30, 2003
copy TopMods/TopMods/HighLevelObjects.hh from the directory used to build TopFind.
copy TopMods/src/HighLevelObjects.cc,TopMods/ana/anascript.C and TopMods/ana/ana.cc as well.
Modify HighLevelObjects.cc:
  #include "TopMods/HighLevelObjects.hh" -> #include "HighLevelObjects.hh"
Modify ana.cc as you want, and
  root -l -q -b anascript.C

### Add the following lines:
using std::cout;
using std::endl;

HighLevelObjects.hh of Ver.4.11.1
//----------------------------------

// HEPG Bank
//----------------------------------
class hepg : public TObject {
  public:
 
  hepg();
  ~hepg() {};
 
  int Ind;
  int ID;
  int IDparent;
  int Stdhep;
  int Mo1; //jmo1hep -1
  int Mo2; //jmo2hep -1
  int Da1; //jda1hep -1
  int Da2; //jda2hep -1
  float Charge;
  float Px;
  float Py;
  float Pz;
  float E;
  float Mass;
 
  ClassDef(hepg,6)
};
ISTHEP Jul 30, 2003
from Pythia 6.2 Manual p.65
=0 null entry
=1 final state
=2 an entry which has decayed or fragmented and is therefore not apperaing in the final state, but is retained for event history information.
=3 a documentation line, defined separately from the event history. This could include the two incoming reacting particles, etc.
=4-10 undefined
=11-200 at the disposal of each model builder for constructs specific to his program, but equivalent to a null line in the context of any other program.
= 201- at the disposal of users, in particular for event tracking in the detector.
Set t-tbar spin correlation off in cdfSim Jul 28, 2003
Add the following lines in the setion of talk herwig:
# spin correlation off
   Vers64
      Syspin set 0
      Threeb set 0
   exit
Replace this use_herwig.tcl instead of the original one.

Make TopFind on cdfsoft2 4.11.1 and execute Jul 28, 2003
Reference web page

http://www-cdf.fnal.gov/internal/people/links/EvelynThomson/instructions_4111.html

+ runtopfind.sh
     - exe=${HOME}/spool/spin/herwig/workrel/bin/Linux2-KCC_4_0/TopFind
     - scriptdir=${Where_your_scripts_are}   # ${HOME}/spool/spin/herwig/scripts
The following support scripts are needed at ${Where_your_scripts_are}:
+ topevent_4111.tcl   ... copied from the reference web page and modified.

To run TopFind manually
  env topfind_input_file=dilepton-ele_484_REMAKE_GI0741.0.roottopfind_output_file=out.root topfind_output_root=hoge.ntuple.root  ~/spool/spin/herwig/workrel/bin/Linux2-KCC_4_0/TopFind ~/spool/spin/herwig/scripts/topevent_4111.tcl

BankDump.sh Jul 28, 2003
BankDump.sh datafile ... Dump Storable banks contained in the datafile.
e.g.
After ProductionExe: dump.prod.txt
After TopRemake: dump.remake.txt

Make TopRemake on cdfsoft2 4.11.1 Jul 26,2003
Reference web page
setup cdfsoft2 4.11.1; newrel -t 4.11.1 workrel; cd workrel/
addpkg Production    -> cvs checkout -P-r V00-00-81 TopMods
cd TopMods/test
gmake tbin    -> TopCheck TopRemake TopFit


http://www-cdf.fnal.gov/internal/people/links/EvelynThomson/instructions_4111.html

To execute TopRemake
+ runremake.sh
     - exe=${HOME}/spool/spin/herwig/workrel/bin/Linux2-KCC_4_0/TopRemake
     - scriptdir=${Where_your_scripts_are}   # ${HOME}/spool/spin/herwig/scripts
The following support scripts are needed at ${Where_your_scripts_are}:
+ remake_4111.tcl   ... copied from the reference web page.
 |-- runCalor_4111.tcl ... same as original at the reference web page.

AC++ scripts to make production from simulation data Jun 24, 2003
+ runprod.sh
     - prod=ProductionExe
     - scriptdir=${Where_your_scripts_are}   # ${HOME}/spool/spin/herwig/scripts
The following support scripts are needed at ${Where_your_scripts_are}:
+ ProductionExe.tcl  ... modified from ${SRT_PUBLIC_CONTEXT}/Production/ProductionExe.tcl
 |-- setup_input_prod.tcl
 |-- setup_path.tcl
 |-- setup_output_prod.tcl

How to make ProductionExe on cdfsoft2 4.11.1 Jul 25,2003
setup cdfsoft2 4.11.1
newrel -t 4.11.1 workrel
cd workrel/
addpkg Production     -> cvs checkout -P-r V00-01-86 Production
cd Production/
gmake bin

AC++ scripts to make ttbar events using herwig Jun 23, 2003
+ runsim_hw.sh  ... The script you execute.
      - cdfsim=cdfSim
      - scriptdir=${Where_your_scripts_are}    # ${HOME}/spool/spin/herwig/scripts
      - nev=2000
      - cdfsoft2ver=4.11.1
At ${Where_your_scripts_are}, you need
gensim_tt_herwig.tcl
  + use_herwig.tcl
  + run_cdfSim_${version_name}.tcl / run_cdfSim.tcl
  + setup_output.tcl

Outputs:
   In directory p[id], you'll obtain the followings:
     CdfRnStat.dat
     HepHist.dat
     fort.88
     herwig_ttbar.[id].sim
     sim.[id].log

How to make cdfSim(modified version for herwig top quark force decay) on cdfsoft2 4.11.1 Jul 23, 2003
setup cdfsoft2 4.11.1
newrel -t 4.11.1 workrel
cd workrel/
addpkg generatorMods       -> cvs checkout -P-r V00-01-23 generatorMods
addpkg SimulationMods    -> cvs checkout -P-r V00-00-95 SimulationMods
cd generatorMods/src
ln -sf ~/spool/cdfsim/hwbrset/hwbrset.F
patch < ~/spool/cdfsim/hwbrset/HerwigModule.cc.diff.490
    patching file HerwigModule.cc
    Hunk #1 succeeded at 87 (offset 22 lines).
    Hunk #2 succeeded at 304 (offset 11 lines).
cd ..
gmake
cd ../SimulationMods/test
gmake bin
   ->  cdfSim cdfGen

 # You can find the following messages from hwbrset in the log output, for example:
 hwbrset: Braching fractions in Herwig are changed.
 hwbrset:  1  0.
 hwbrset:  2  0.
 hwbrset:  3  1.
 hwbrset:  4  0.
 hwbrset:  5  0.
 hwbrset:  6  0.
 hwbrset:  7  0.
 hwbrset:  8  1.
 hwbrset:  9  0.
 hwbrset:  10  0.


How to force decay of W from top quark with Herwig module in cdfSim Feb 10, 2003
setup cdfsoft2 4.9.0
newrel -t 4.9.0 rel490
cd rel490

addpkg -h generatorMods
addpkg -h SimulationMods
cd generatorMods/src
ln -sf ~/spool/cdfsim/hwbrset/hwbrset.F
[ln -sf ~/spool/cdfsim/hwbrset/HerwigModule.cc] or [patch < ~/spool/cdfsim/hwbrset/HerwigModule.cc.diff.490]

cd ..
gmake

cd ../SimulationMods/test
gmake bin

Supplementary) Jul 21, 2003
Definition of branching fraction in herwig source code
herwig6500.f ...
      DATA NDKYS/2263/
      DATA (IDK(I),BRFRAC(I),NME(I),(IDKPRD(J,I),J=1,5),I=   1,  19)/
     &   6,0.334D0,100,  2,  7,  5,  0,  0,
     &   6,0.333D0,100,  4,  9,  5,  0,  0,
     &   6,0.111D0,100,122,127,  5,  0,  0,
     &   6,0.111D0,100,124,129,  5,  0,  0,
     &   6,0.111D0,100,126,131,  5,  0,  0,
     &  12,0.334D0,100,  8,  1, 11,  0,  0,
     &  12,0.333D0,100, 10,  3, 11,  0,  0,
     ...
  Herwig Particle ID:
    1->d, 2->u, 3->s, 4->c, 5->b, 6->t,
    7->dbar, 8->ubar, 9->sbar, 10->cbar, 11->bbar, 12->tbar,
    121->nu_ebar, 122->nu_e, 123->nu_mubar, 124->nu_mu, 125->nu_taubar, 126->nu_tau,
    127->e+, 128->e-, 129->mu+, 130->mu-, 131->tau+, 132->tau-
    ...
 
6,0.334D0,100,  2,  7,  5,  0,  0, -> Br(t->u dbar b)=0.334
    ...
  BRFRAC(1)= Br(t->u dbar b)
  BRFRAC(2)= Br(t->c sbar b)
  BRFRAC(3)= Br(t->nu_e e+ b)
  BRFRAC(4)= Br(t->nu_mu mu+ b)
  BRFRAC(5)= Br(t->mu_tau tau+ b)
  BRFRAC(6)= Br(tbar->ubar d bbar)
  BRFRAC(7)= Br(tbar->cbar s bbar)
  BRFRAC(8)= Br(tbar->nu_ebar e- bbar)
  BRFRAC(9)= Br(tbar->nu_mubar mu- bbar)
  BRFRAC(10)= Br(tbar->mu_taubar tau- bbar)

PYLIST outputs
pylist.11.log, pylist.12.log
Make ntuple for parton level study of ttbar spin correlations
hw_tt_ll_dump.f
link w/ pdflib, ie
g77 -o hw_tt_ll_dump hw_tt_ll_dump.f ~/work/herwig/herwig6500.o -L /cern/2002/lib/ -lpdflib804 -lmathlib -lpacklib
To set spin off, or use another PDF
C      SYSPIN=.true.
C      THREEB=.true.
      SYSPIN=.false.
      THREEB=.false.

      AUTPDF(1)='MRS'
      AUTPDF(2)='MRS'
      MODPDF(1)=41
      MODPDF(2)=41
hw_formn.rb -- ruby script to reformat output from hw_tt_ll_dump.
mkntpl.C -- root script to create ntuple from text.
Use herwig with pdflib Feb 08, 2003
Delete following subroutines in herwig6500.f:
PDFSET
STRUCTM

then,
g77 -o hw_tt_ll_dump hw_tt_ll_dump.f ~/work/herwig/herwig6500.o -L /cern/2002/lib/ -lpdflib804 -lmathlib -lpacklib
t(6) -> W+(24) b(5) -> e+(-11) nu_e(12) b(5)

How to force decay of W from top in Herwig
Herwig controls 3-body decay of top quark with Branching fraction tables.
     Decay table dump: hwiodk_test.f ->  Output: fort.11, fort.12

BRFRAC index
 1 TQRK     0.33400 *** UQRK     DBAR     BQRK
 2 TQRK     0.33300 *** CQRK     SBAR     BQRK
 5 TQRK     0.11100 *** NU_TAU   TAU+     BQRK
 4 TQRK     0.11100 *** NU_MU    MU+      BQRK
 3 TQRK     0.11100 *** NU_E     E+       BQRK
 6 TBAR     0.33400 *** UBAR     DQRK     BBAR
 7 TBAR     0.33300 *** CBAR     SQRK     BBAR
10 TBAR     0.11100 *** NU_TAUBR TAU-     BBAR
 9 TBAR     0.11100 *** NU_MUBAR MU-      BBAR
 8 TBAR     0.11100 *** NU_EBAR  E-       BBAR


How to force w->ud from t(tbar), in main program of herwig after hweini procedure
      CALL HWEINI
C---LOOP OVER EVENTS
C. force
      do iii=1,10
         BRFRAC(iii)=0.0
      enddo
      BRFRAC(1)=1.0
      BRFRAC(6)=1.0

Quick tutorial for Herwig
Herwig original web page is:  http://hepwww.rl.ac.uk/theory/seymour/herwig/
Here, the latest version of herwig source code can be downloaded: herwig6500.f  herwig6500.inc
After obtained above two,
ln -s herwig6500.inc HERWIG65.INC
f77 -c herwig6500.f

Obtain herwig65.tst, then
ln -s herwig65.tst hwtst
f77 -o hwtst hwtst.f herwig6500.o

Tinkering Helicity of W decayed from top quark in Pythia
In pyresd.f, modify as follows:
C...Angular correlation in f -> f' + W -> f' + 2 quarks/leptons.
..
C        WT=(P(I1,4)*P(I2,4)-P(I1,1)*P(I2,1)-P(I1,2)*P(I2,2)-
C     &  P(I1,3)*P(I2,3))*(P(I3,4)*P(I4,4)-P(I3,1)*P(I4,1)-
C     &  P(I3,2)*P(I4,2)-P(I3,3)*P(I4,3))
         call mymat(I1, I2, I3, I4, IREF(IP,1), WT, WTMAX)
mymat.f  ... special matrix element for t-W-b decay
compile modified pyresd.f and mymat.f into pyresd.o mymat.o, then
g77 $(CF) -o main main.o pyresd.o mymat.o -lpythia
Function and subroutine splitter for Pythia source code (make shared library from pythia source code)
pydiv.awk
Usage: (in case of linux)
  Obtain pythia source code at http://www.thep.lu.se/tf2/staff/torbjorn/Pythia.html
  mkdir tmp; cd tmp
  pydiv.awk ../pythiaXXXX.f
  g77 -fPIC -c *.f
  g77 -shared -o libpythia.so *.o
    or
  g77 -c *.f
  ar r libpythia.a *.o

Show compile options
override LDFLAGS +=v   <- Add this line in GNUmakefile

yuji@fnal.gov