Physics Background Simulation

Ongoing effort of preparing physics-background samples for developing of e/h discrimination algos for W reconstruction

Existing Framework For FGT Simulations

With the completion of the FGT hardware review, focus must now be made on the creation and implementation of efficient analysis algorithms. To this end a framework for creating simulation files must be established. Here I document the existing framework I created this past summer for a small FGT project.
    The creation of simulation files within STAR is handled in two steps.

  • starsim is called with a PYTHIA kumac, creating a fzd file.
  • The fzd file is converted to a full muDst with the bfc.

The kumac sets all parameters of the underlying physics events, while the bfc handles the fine tuning of the reconstruction of the STAR detector.
    In the following analysis the simulation was split by the underlying physics processes: those producing W bosons and those from QCD 2->2 interactions. Both are produced with the geometry UPGR13 and sqrt(s) = 500 GeV, in accordance with the FGT upgrade. Moreover, each kumac accepts a random number seed to ensure that different jobs are independent of each other.  Specific details are included below,

PYTHIA Settings
  W Hadron
Geometry UPGR13 UPGR13
sqrt(s) 500 GeV 500 GeV
Vertex (mean, variance) 0 cm, 60 cm 0 cm, 60 cm
     
Subprocesses 2, 15, 20, 23, 25, 31 11, 12, 13, 28, 53, 68, 96
CKIN3 10 GeV 10 GeV
CKIN4 None None
Additional Cuts Require electron in the endcap with pT > 15 GeV None
Additional Notes W bosons made explicitly unstable None
     
Events / Job 4000 2000
Cross Section / Job O(103 pb) O(103 pb)
PYTHIA + GSTAR + BFC Running Time / Job O(20 hours) O(16 hours)
PYTHIA  + GSTAR Running Time / Job O(12 hours) O(6 hours)
Memory Used / Job O(1000 MB) O(1500 MB)
Size of Output Files / Job O(2.5 GB) O(2.5 GB)
Once starsim has completed, the files are processed through the bfc with the command

bfc.C\(1,nEvents,"trs ssd upgr13 pixFastSim Idst IAna l0 tpcI fcf Tree logger ITTF Sti StiRnd PixelIT IstIT StiPulls genvtx NoSvtIt SsdIt MakeEvent McEvent geant evoutgeantout IdTruth tags bbcSim emcY2 EEfs big -dstout fzin MiniMcMk McEvOut clearmem","fileName.fzd")

Detailed log files can be found at

/star/institutions/mit/betan/FGT/Logs/

while the existing files are at

/star/institutions/mit/betan/ROOT_Files/FGT/

Attached are the relevant scripts (the _.txt has been added to get around DRUPAL attachment restrictions), although the hardcoded paths are no longer valid.  The master script is submit_simulations.csh, which submits all the others to the RCAS queue star_cas_big.  In particular, W_job.csh and hadron_job.csh are each called with the command line arguments

*_job.csh <em>nEvents fileName randomNumberSeed

The *_job.csh scrips then call the starsim and bfc with the necessary arguments passed as appropriate.

Filtered Simulations For The Development of Electron/Hadron Discrimination Algorithms

Critical to the upcoming flavor physics at STAR is efficient electron identification in the endcap, particularly amongst the dominant charged hadron/meson background.  The development of such discrimination algorithms, however, requires extensive simulations.  To reduce the computational burden of these simulations to a practical level we must modify starsim, reconstructing only those events of interest.

In this case we require electrons and charged hadrons/mesons in the endcap, and by adding a filter to PYTHIA we can ensure that only events matching the this criteria are reconstructed.  Below is a small study showing the significant reduction in computing time gained with this filtering.

The filtered simulations required a charged hadron or meson in the endcap with pT > 15 GeV before GSTAR was allowed to reconstruct the event.  Candidate refers to an event meeting the above requirements in the PYTHIA record, and projected refers to an extrapolation estimate for 80 pb-1.

Hadrons/Mesons Filtered Filtered (Projected) Unfiltered Unfiltered (Projected)
Candidates 10 18,604 10 18,604
Reconstructed GEANT Events 10 18,604 2863 5,326,325
Integrated Luminousity (pb-1) 0.043 80 0.043 80
Starsim Running Time (hours) 0.274 509  7.42  13,817
BFC Running Time (hours) 0.845 1572  24.2  45,023

Looking at the tracks in the GEANT record we see that the filtering worked as described.  Here every charged hadron/meson in every reconstructed event is shown, and in the Filtered sample we see a sharp cutoff at 15 GeV exactly as expected. 

The same analysis can be done for the W boson simulations, here instead requiring an electron(positron) from a W decay in the endcap with pT > 15 GeV.

Ws Filtered Filtered (Projected) Unfiltered Unfiltered (Projected)
Candidates 10  672 10  672
Reconstructed GEANT Events 10 10 357  24,020
Integrated Luminousity (pb-1)  1.189 80  1.189 80
Starsim Running Time (hours)  0.0361  2.42  0.822  55.3
BFC Running Time (hours)  0.0882  5.93  2.807  188.8

Again, comparing the two files shows the desired effects

In both cases the computational demands seem impractical, but one has to remember that this extrapolation is based on the use of a single processor.  Real jobs will be run in parallel, significantly reducing the projected times to more reasonable levels.  Despite the reduction, however, it might still be necessary to reduce the desired integrated luminousity slightly.

Filtering PYTHIA Events In Starsim

Within the STAR framework, simulation files are created with the command starsim which runs both PYTHIA and GEANT.  Unfortunately, this means that there is no straightforward way to filter PYTHIA events before the GEANT reconstruction and producing simulation files for rare events can be very time consuming, as most of the CPU is wasted on the GEANT reconstruction of undesired events.

The trick around this is to modify the PYTHIA libraries themselves.  In particular we want to modify the PYEVNT subroutine which is run during the generation of each PYTHIA event.  Begin by

  •     Checking out a copy of the pythia libraries from cvs
  •     Create a back up of pyevnt.F in case anything goes wrong
  •     Open up pyevnt.F in your favorite text editor
  •     Rename SUBROUTINE PYEVNT to SUBROUTINE PYEVNT_ORG
  •     Now create your own subroutine, SUBROUTINE PYEVNT
  •     Copy the variable declarations and commonblocks from the original PYEVNT

The body of this new subroutine will in general go as the following

while(conditions have not been met)

Call the original PYEVNT
Call any necessary auxillery subroutines
Loop over particles
if(not desired characteristic a) continue
if(not desired characteristic b) continue
...
if(not desired characteristic i) continue
Calculate relevant kinematic variables
Check conditions
Call PYLIST

Note that to avoid too many nested if loops we abort when the first test fails.

For example, consider an analysis requiring a high energy electron in the endcap.  The usual PYTHIA settings allow one to require a high energy electron, but there is no way to restrict its location in the detector.  So in the above pseudocode becomes

while(no high pT electron in the endcap)

Call the original PYEVNT
Loop over particles
if(not electron) continue
Calculate pT
Calculate eta
if(pT < 15) continue
if(eta < 1) continue
if(eta > 2) continue
return
Call PYLIST

The main background to the above is charged hadrons/mesons.  In order to filter these we require that the particle has a charge of +/- 1, that is has the PDG ID of a hadron or a meson, that it has not decayed in the PYTHIA record, and fulfills the kinematic requirements.

while(no high pT jet in the endcap)

Call the original PYEVNT
Loop over the jets at the end of the PYTHIA record
if(not stable) continue
if(charge not equal +/- 1) continue
if(not hadron or meson) continue
Calculate pT
Calculate eta
if(pT < 15) continue
if(eta < 1) continue
if(eta > 2) continue
return
Call PYLIST

Once pyevnt.F has been succussfully modified it must be compiled with cons, and the path to the compiled library itself must be explicitly set in the kumac.  For example,

gexec $STAR_LIB/libpythia_6410.so

must be replaced by

gexec /star/u/username/path_to_directory/.slxx_gccxxxx/lib/name_of_new_pythia_library.so

Examples of modified pyevnt.F files for both the electron example and the jet example are attached, as is a kumac for use with the jet example.

List of available M-C event samples (Jan)

.

M-C Event Samples Available   

  1. General  setup, assumptions
    1. use UPGR13 geometry
    2. run in SL07e
    3. use PPV vertex finder in reco
    4. displace & smear vertex in GEANT in X-Y plane: x0=+1mm, sig=200us, y0=-2mm, sig=200um (except setA)
    5. beam energy sqrt(s)=500 GeV
    6. detectors passed by track thrown at various eta at 3 Z-vertex location of -60, -30 an 0 cm.


  2. setA (produced by Mike @ MIT)
  3. BFC w/ generic vertex finder has ~50% efficiency,

    Vertex distribution: Gauss(Z=0, sigZ=60cm, Z=Y=0, sigX=sigY=0)

     Type of events   total events time per event
     Pythia, minB  400K, 100 jobs  GSTAR: 8.4 sec, BFC ???

    Files location: 80K eve at IUCF disk: /star/institutions/iucf/kocolosk/2008-02-15-fgt-hadron-background

    full sample at MIT ...



     

  4. setB (pilot sample by Jan @ RCF)
  5. Filtering of Pythia events: seed cell =10GeV ET, pair of cells>20 GeV ET,

    particle eta range [0.8,2.2], grid cell size: 0.14 in eta, 9 deg in phi

    BFC w/ PPV vertex finder has ~95% efficiency, SSD, STI not used in tracking

    Vertex distribution: Gauss(Z=-60, sigZ=5cm, Z,Y offset)


    Pythia event generator, 

    BFC chain:" DbV20080310 trs  -ssd upgr13  Idst IAna l0 tpcI fcf -ftpc Tree logger ITTF Sti StiRnd  -IstIT -SvtIt -NoSvtIt SvtCL,svtDb -SsdIt MakeEvent McEvent geant evout geantout IdTruth  bbcSim emcY2 EEfs bigbig -dstout fzin -MiniMcMk McEvOut clearmem -ctbMatchVtx VFPPV eemcDb beamLine"

     Type of events Pythia filter   total events time per event job name file size, MB
      W-events (kumac) 1/6.5  1K, 1 job GSTAR 10 sec, BFC 5.3 sec wElec4 fzd=149, stevent=132, geant=154, McEvent=132, muDst=14
    1:1 , OFF  5K, 1 job - wElec5 -
      QCD-events (kumac) pt=20-30 GeV 1/40  1K, 1 job GSTAR 11 sec, BFC 6.7 sec qcd2 fzd=203, StEvent=157, geant=212, McEvent=172, muDst=17
    1:1, OFF  5K, 1 job - qcd3 -
      QCD-events, scan pt 10...90 GeV varies  100 eve, 1 job - qcd_pt_xx_yy files at ...balewski/2008-FGT-simu/setB-pt-scan/

    Files location:  /star/institutions/iucf/balewski/2008-FGT-simu/setB-pilot/


    Custom code : Pythia, Generic Vertex finder, same location

     

  6.  setC - Pythia macros inspected by Jim: ppQCDprod.kumac & ppWprod.kumac
    Filtering of Pythia events: seed cell =10GeV ET, pair of cells>20 GeV ET,
    particle eta range [0.8,2.2], grid cell size: 0.14 in eta, 9 deg in phi

     
    * setC1: /star/institutions/iucf/balewski/2008-FGT-simu/setC2-pt-0.2inv_pb

    This is LT balanced for 0.2/pb, using your ppQCDprod.kumac

    pt1 pt2 neve
    10    ,15    ,373
    15    ,20    ,1252
    20    ,25    ,2516
    25    ,30    ,3367
    30    ,35    ,2330
    35    ,40    ,1015
    40    ,45    ,705
    45    ,50    ,292
    50    ,55    ,114
    55    ,60    ,67
    60    ,65    ,28
    65    ,70    ,13
    70    ,75    ,8
    75    ,80    ,4
    80    ,85    ,2
    85    ,90    ,1
    90    ,95    ,1
    

     


    * setC2 (only filtered events of various types)

     

     


    * setC3 (filtered vs. not filtered events)

     

     

    * setC4 ( filtered QCD events w/ various partonic PT )

  7. setC5 : QCD events , 3-stage filtering, LT~100/pb

 

evaluation of Pythia Filter for QCD & W events (setC3)

 

Based on setC3 the number of events with reco EM cluster ET>20 GeV is similar for the filtered and unfiltered pythia samples after LT correction - compare yellow & green areas: 

 

------------ From Brian -------

Hi Jan,

I processed the events in setC3 and I put the plots into the
fgt-hn-contributions drupal page. (All plots show unfiltered events on
the left and filtered events on the right).

Transverse energy spectrum for the QCD events:
http://drupal.star.bnl.gov/STAR/system/files/ETspectrumQCD.png

Number of events passing ET>20GeV and ET>20GeV + Eta < 1.7 for QCD
events: http://drupal.star.bnl.gov/STAR/system/files/OPcountsQCD.png

Transverse energy spectrum for the W events:
http://drupal.star.bnl.gov/STAR/system/files/ETspectrumW.png

Number of events passing ET>20GeV and ET>20GeV + Eta < 1.7 for W events:
http://drupal.star.bnl.gov/STAR/system/files/OPcountsW.png

Brian

 

PT scan of Pythia-filter rejection for QCD events ( Jan)

Pythia Filer: cell>10 GeV ET, cluster >20 GeV ET , grid covers Endcap Pythia events

Note, 'live' spreadsheet is attached at the bottom

 

Examples of event filtering for some choices partonic PT ranges:

pt range event counter and pt spectra eta-phi distributions, all pythia tracks and seed distribution

partonic PT 15-20 GeV

Filter=1/760

 

 

partonic PT 40-45 GeV

Filter=1/3.6

 

 

 

partonic PT 75-80 GeV

Filter=1/4.6

 

 

 

 

Practical Pythia Event Filter (Jan)

Filtering of Pythia events preserving those which may fire HT trigger in the Endcap.

Motivation
In order to develop efficient e/h discrimination algo for reco of electrons from Ws it is necessary to generate sizable sample of QCD physics background events with 1e5 or more events triggering Endcap HT >10 GeV. The brute force approach (run PYTHIA+GSTAR+BFC long enough) is investigated by my not succeed due to low yield of events of interests.

Therefore, we are working on the in-fly Pythia events filtering. It must be more complex than accepting events with a single Pythia track above certain threshold because multiple tracks from jet (also hadrons) may deposit in a single tower cumulative energy exceeding the HT threshold even if all tracks have energy below this threshold.

The tricky part is to decide if EEMC response may be large before GSTAR does very time consuming simulation of EM & hadronic showers for the whole event.


Proposed Method (2-stage Pythia filtering)

  • Define : eta range [0.9,2.1], partonPTthres of 5 GeV, jetPTthres of 5 GeV (to be tuned later)
  • Inspect lines 7 & 8 of Pythia record (counting from 1) and drop event if none of partons is within eta range and above parton PT threshold.
    For survived events
  • Define 2D eta-phi grid covering eta [0.9,2.1] and 2pi in phi. Divide it in to cells of size 0.1x0.1. Clear grid for every event.
  • Loop over Pythia record 9..max and drop: partons, gluons, unstable particles, neutrino, muons.
    Retain all stable hadrons, e+, e- within eta range, project particle ET in to the eta-phi grid.
  • find seeds all cells with ET above 1/2 of jetThreshold.
  • for every seed from 8 pairs using every of its neighbors. If any pair ET sum is above jetThreshold event will be accepted and passed to GSTAR and eventually to BFC.

Additional comments:
* for Barrel eta range should be [-0.2,1.2] and cell size 0.05x0.05 in eta x phi.
* the code should be written in F77.
* at any step priority should be given to processing speed vs. program size. E.g. use lookup tables when reasonable.
* provide few QA histos generated with Pythia using HBOOK + kumac to display them


Content of Pythia record

1 proton 1
2 proton 2
3 parton from proton1
4 parton from proton2
5 parton from proton 1 after intial state radiation
6 parton from proton 2 after intial state radiation
7 parton 1 after scatter
8 parton 2 after scatter
9 ... intermediate and final partons/particles
....

 

evaluation of Bates minB sample (Jan)

Evaluation of minB events ample produced by Mike at Bates in January of 2008.

Events characteristic: Pythia MinB events, sqrt(s)=500 GeV, vertex Gauss(0,60cm)

Below you see detectors acquired by e+/e- surrogate :  

  1st pi-,pi+ with pT>2.0 GeV and eta>0.7

FGT disks are located at Z of 70,80,...,110 cm - our best guess location.

3 events samples were chosen based on Geant vertex location of -60, 30, and 0 cm, with margin of +/-10 cm, what leads to smeared FGT disks.