Title: Beam Test Offline Code
1Beam Test Offline Code
- Jianchun Wang
- Syracuse University
- 01/17/02
- Outline
- Status of the code
- Function modules
- Discussion topics
2Status
- All main functions are done, but need more
testing and polishing. - The code was tested with Syracuse computers
(Alpha with Linux and OSF1) during development. - The code was submitted to CVS this week, we need
to decide whether keep it as a new release or a
new project (Rob and Lynn will tell us about
CVS). - The code was tested on fnsimu1 and fsgi03.
- GNUmakefile.standalone are used. We need to work
out GNUmakefile. - We need to solve some issues and decide on what
else functions should be included.
3General Description
Data Analysis Read in real data (include MC
track), convert ADC counts into charge, form
cluster and convert into coordinates, form rough
track and perform Kalman filter, write out ntuple
and track summary file for further study MC
Simulation Generate tracks, calculate
intersection points on each plane, simulate
charge collection and convert it into ADC counts,
write out in similar format as real data plus the
track information Auto Alignment Read in track
summary file (local coordinates and resolutions),
go through MINUIT with geometry conversion, for
different geometry calculate chi2 for each track,
minimize the sum of chi2 and write out new
geometry
4Tasks
- Tasks are selected by tb_control and information
inside input data file - Names of output data file and histogram file can
be defined or with default
5Function Modules
- Data encode and decode
- Geometry manipulation
- ADC charge conversion
- Cluster formation and conversion into coordinates
- Track formation
- Track fitting with Kalman filter
- MC Simulation
- MINUIT alignment ( a.k.a. Auto alignment )
- CWN ntuple
- Parameter control through name list read
6Data File Format
- A Header
- RAWD, SIMU, TRAK
- Length of the block
- Version
- Run ID
- Number of planes
- Time Tag
- other comments
- C MC Track
- Length of the block
- Number of tracks
- Local X for plane 1
- Local Y for plane 1
-
- Length of the block
- B Data Hits
- Length of data block
- Cell 1 data
-
- Length of data block
- D Track Summary
- Length of the block
- Plane ID
- Local X for plane 1
- Local Y for plane 1
- Error on X for plane 1
- Error on Y for plane 1
-
- Length of the block
Data format for one cell 1111 pppp 000c cccc rrrr
rrrr aaaa aaaa
- Raw data from DAQ (RAWD) ABBBBBB
- MC data generated (SIMU) ABCBCBC
- Selected track summary (TRAK) ADDDDDD
7Sample of Data File
8Endian on Different Platforms
- Within a given 16- or 32-bit word, bytes at lower
addresses have higher significance (big_endian) - Most processor use big_endian, some use
little_endian, very very few use middle_endian - The machine we used for DAQ, and most of machines
that we are going to use for analysis are
big_endian - In order that the data can be used for both
big_endian and little_endian machine, I add byte
swap in data reading and MC data writing - It was tested standalone, not with real code yet.
And I need to work on GNUmakefile - ( Most functions associated with coding is in
testbeam_dio.c )
9Geometry Manipulation
- The geometry manipulation has very little change.
- Initial geometry information is read in from
geometry file (tb_geometry.dat). - Parameters are derived for easier conversion
between world coordinate (WC), and local
coordinate (LC). - In MINUIT fit, fit parameters are connected with
selected geometry parameters. Each time the fit
parameters changed, the derived parameters
recalculated.
10ADC Charge Conversion
- Testbeam 2000 use curve for FPIX0, and one set of
4 thresholds for all FPIX1 cells. - Testbeam 2002 use calibration for each cell, and
directly use threshold value instead of curves. - Each plane has its own sixy_adc_file name.
- The ADC information is also used in the MC
simulation where charge in pixel cell is
converted to ADC value.
11Pixel Cluster
- Testbeam 2000 uses Pennys cluster formation
initially wrote to work with simulation package
we developed at Syracuse. The eta calculation
using output from her code in 2-column case is
wrong. - Testbeam 2002 imported the one I use for
standalone simulation. - Cluster center of gravity is calculated and
converted into local coordinate where the
orientation of row and column is considered and
can be easily controlled. - World coordination is calculated here so track
formation can use more precise position. In
testbeam 2000, we use local coordinate shift with
the center for track formation.
12Track Formation
- Track formation is kept in same style.
- Use hits in two x seed planes to make a path, for
other planes choose the closest hit (within a
cut). - Y information currently is not used.
13Track Fitting
- Rob had updated Kalman filter code to work with
current version MCFast. - It can treat a pixel hit as two strip hits, and
only fit on hits with good resolution. - It performs fit and derives residual with or with
out the hit, and also provide the chi2 of the
fit. - In MINUIT alignment, strip-equivalent is
enforced. - The interface subroutine is kept in same style,
modification are done mainly associated with
local coordinate.
14MC Simulation
- One or more tracks are generated (with no
multiple scattering at this moment). - Intersection with each plane is calculated.
- Charge generation, noise simulation, ADC
conversion were imported from standalone
simulation with modification. - Hits are encoded and written out.
- The electric field, charge mobility, diffusion,
effects of magnetic field are calculated at
initialization.
15MINUIT Alignment
- This is to determine the real geometry
configuration by minimize the sum of chi2 from
many track fit. - CPU is a big issue here since we need to perform
Kalman filter many many times. - It deals with summary of pre-selected tracks.
- It provides interactive mode although it can also
run in batch mode. - Due to CPU limitation, only small portion of all
geometry parameters can be FREE at a time. This
is controlled in mn_skip.dat file, with very
simple format. - The best geometry is written in mn_geometry.dat
with same format as tb_geometry.dat.
16Histogram ID
- 11100 Geometry parameters
- 11200 Geometry parameters after
alignment - 11300 Global parameters and Detector
parameters - 11400 Simulation parameter maps
- 11500 Charge simulation parameters
- 21000 Simulated track and hits
- 31000 Track summary
- 32000 MINUIT fit
- 41000 Hit information
- 42000 Cluster information
- 43000 Difference of reconstructed hit
position and generated position - 51000 Form track
- 61000 Kalman filter
17Column Wised Ntuple
- CWN has many advantages over RWN especially when
the number of element is uncertain. - With CWN, when we add more pixels or shift to
study other plane, we need only small
modification on index.
Benefit mentioned in Robs message a) does not
waste disk space on information which is absent
for this event  ie you can declare very large
arrays for hits but it only uses disk space for
the ones which are present.b) faster interactive
response if you are only referencing a small
subset of the ntuple variables. This comes
partly from a) but also from a "smarter" layout
of how data is stored on disk.c) much easier
maintenance when you change the number of
detectors
18Variables in CWN
- Track Block
- ievt, ntrks, n_klm_ok, itrk, klm_ok, x_int,
x_slp, y_int, y_slp, - chisq, cl, ndof, fixyslp, yclass, nplanes
- Plane Block
- (ngeom elements except for ngeom)
- ngeom, itype, iort_row, nclus, iclus, npix, nrow,
ncol, rowb, colb, rowq, colq, - eta, sumq, xg, yg, xl, yl, xsig, ysig, xw, yw,
zw, rxi, srxi, spxi, ryi, sryi, spyi, - rxo, srxo, spxo, ryo, sryo, spyo, xf, yf, rhof,
xslp, yslp, infitx, infity - Hit Block
- (nhit elements except for nhit)
- nhit, ipln, icol, irow, iadc, icls, qval
19Name List Variables
DETECTOR sixy_carrier(1) 2
sixy_ort_r(1) 1 sixy_ort_c(1) 1
sixy_ort_z(1) 1 sixy_u_app(1) 140
sixy_u_dep(1) 105 bfield_x(1)
0.0 bfield_y(1) 0.0 bfield_z(1)
0.0 sixy_thick(1) 280
sixy_siz_r(1) 50 sixy_siz_c(1) 400
sixy_noise_val(1) 0.0 sixy_gain_err(1)
0.0 sixy_sig_cpl(1) 0.0
sixy_thr_val(1) 0.0 sixy_thr_dsp(1)
0.0 sixy_thr_err(1) 0.0 END
- CONTROL
- max_evts 10000
- tb_control 'event'
- run_mc 999
- ncycle 1000
- binary_weights 0
- override_seeds 0
- xref1o 1
- xref2o 2
- yref1o 5
- yref2o 6
- dx_cuto 0.06
- y_slp_seed 0.000055
- max_miss_planes 1
- drop_plane(9) 1
- END
FILES geom_file 'tb_geometry.dat'
data_in_file ' ' data_out_file ' '
hbk_out_file ' ' sixy_adc_file(1)
'adc_plane1.dat' END
20To Be Discussed
- Data format and byte swap
- CVS and terminology (Rob and Lynn)
- Do we need to include SSD?
- Column wised ntuple
- ???
21Analysis Flow
- call read_namelist
- status open_old_file(data_in_file)
- status read_data_header(run_tmp,
num_tmp, type_tmp) - call histo_init(hbk_out_file)
- status read_geometry(0)
- call fill_derived_geom
call sixy_geom_hfill(11100) - call sixy_detector_parameter call
sixy_dpar_hfill - if ( want_summary ) status
open_new_file(data_out_file) - if ( want_summary ) status
write_data_header(runId, nPlanes, runType) - 10 status read_event(1)
- if ( status .eq. 0 ) then
- call sixy_adc2q
- call form_clusters
call hit_hfill - call form_tracks
- call fit_tracks
call fit_hfill - call fill_ntuple
- if ( want_summary ) call
mn_write_track - if ( not_enough ) goto 10
- endif
22MC Generation Flow
- call read_namelist
- call histo_init(hbk_out_file)
- status read_geometry(0)
- call fill_derived_geom
call sixy_geom_hfill(11100) - call sixy_detector_parameter call
sixy_dpar_hfill - status open_new_file(data_out_file)
- status write_data_header(run_num,
n_pix_planes, type_tmp) - call ranecu_init
- call set_beam_properties
- call sixy_drift_map
call sixy_map_hfill - call sixy_charge_parameter
- do evt_num 1, max_evts
- call mc_track
- call mc_signal
- call mc_write
call mc_hfill - enddo
- output histogram
23Alignment Flow
- call read_namelist
- status open_old_file(data_in_file)
- status read_data_header(run_tmp, num_tmp,
type_tmp) - call histo_init(hbk_out_file)
- status read_geometry(0)
- call fill_derived_geom
- call sixy_geom_hfill(11100)
- call sixy_detector_parameter
- call sixy_dpar_hfill
- call mn_prepare_fit
- call mn_read_track
- call mn_fit_geo
- call sixy_geom_hfill(11200)
- output histogram