beam test offline code jianchun wang syracuse university 01/17/02 outline status of the code ...

23
Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline Status of the code Function modules Discussion topics

Post on 19-Dec-2015

235 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

Beam Test Offline Code

Jianchun WangSyracuse University

01/17/02

OutlineStatus of the code

Function modules

Discussion topics

Page 2: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 2

Status 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.

Page 3: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 3

General 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

Page 4: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 4

Tasks

tb_control data_in_file data_out_file hbk_file run_id

Raw data event run01234.dat - run01234.hbk -

MC data event mcd01234.dat - mcd01234.hbk -

Raw data + summary summary run01234.dat trk01234.dat run01234.hbk -

MC data + summary summary mcd01234.dat trk01234.dat mcd01234.hbk -

Alignment align trk01234.dat - aln01234.hbk -

MC generation mcgen - mcd01234.dat mcg01234.hbk 1234

• 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

Page 5: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 5

Function 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

Page 6: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 6

Data File FormatA: Header

1. RAWD, SIMU, TRAK2. Length of the block3. Version4. Run ID5. Number of planes 6. Time Tag7. … other comments

B: Data Hits1. Length of data block2. Cell 1 data3. …4. Length of data block

C: MC Track1. Length of the block2. Number of tracks3. Local X for plane 14. Local Y for plane 15. …6. Length of the block

Data format for one cell

1111 pppp 000c cccc rrrr rrrr aaaa aaaa

D: Track Summary1. Length of the block2. Plane ID3. Local X for plane 14. Local Y for plane 15. Error on X for plane 16. Error on Y for plane 17. …8. Length of the block

Raw data from DAQ (RAWD): ABBBBBB…

MC data generated (SIMU): ABCBCBC…

Selected track summary (TRAK): ADDDDDD…

Page 7: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 7

Sample of Data File0000000 554d4953 00000006 00000001 00000384

“SIMU” Block length = 6 Version Run id: 900

0000020 00000006 3c388dd2 00000007 f1000b07

6 planes Time tag Block length = 7

Hit (1, 0, 11, 7)

0000040 f2000b01 f3000b07 f4001105 f4001206

Hit (2, 0, 11, 1) Hit (3, 0, 11, 7) Hit (4, 0, 17, 5) Hit (4, 0, 18, 6)

0000060 00000007 0000000f 00000001 be76a7a4

Block length Block length = 15

Number of tracks

Local coordinate X1

0000100 be5e624d be790583 be7654a5 be76e45d

Y1 X2 Y2 X3

0000120 be69a4e8 be805307 be6b1209 be76f5bd

Y3 X4 Y4 X5

0000140 be761162 be76a882 be6151c2 0000000f

Y5 X6 Y6 Block length

…… With command: od –X mcd00900.dat

Page 8: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 8

Endian 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 )

Page 9: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 9

Geometry 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.

Page 10: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 10

ADC 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.

Page 11: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 11

Pixel Cluster

Testbeam 2000 uses Penny’s 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.

Page 12: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 12

Track 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.

Page 13: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 13

Track 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.

Page 14: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 14

MC 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.

Page 15: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 15

MINUIT 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.

Page 16: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 16

Histogram ID11100 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

Page 17: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 17

Column 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 Rob’s 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

Page 18: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 18

Variables in CWN

Track Blockievt, 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

Page 19: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 19

Name List Variables

$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

$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

$FILES geom_file = 'tb_geometry.dat' data_in_file = ' ' data_out_file = ' ' hbk_out_file = ' ' sixy_adc_file(1) = 'adc_plane1.dat' $END

Page 20: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 20

To Be Discussed

Data format and byte swap CVS and terminology (Rob and Lynn) Do we need to include SSD? Column wised ntuple ???

Page 21: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 21

Analysis Flow1. call read_namelist2. status = open_old_file(data_in_file)3. status = read_data_header(run_tmp, num_tmp, type_tmp)4. call histo_init(hbk_out_file)5. status = read_geometry(0)6. call fill_derived_geom call sixy_geom_hfill(11100)7. call sixy_detector_parameter call sixy_dpar_hfill8. if ( want_summary ) status = open_new_file(data_out_file)9. if ( want_summary ) status = write_data_header(runId, nPlanes,

runType)

10. 10 status = read_event(1)11. if ( status .eq. 0 ) then12. call sixy_adc2q13. call form_clusters call hit_hfill14. call form_tracks15. call fit_tracks call fit_hfill16. call fill_ntuple17. if ( want_summary ) call mn_write_track18. if ( not_enough ) goto 1019. endif

20. call plane_eff21. output histogram

Page 22: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 22

MC Generation Flow1. call read_namelist

2. call histo_init(hbk_out_file)

3. status = read_geometry(0)

4. call fill_derived_geom call sixy_geom_hfill(11100)

5. call sixy_detector_parameter call sixy_dpar_hfill

6. status = open_new_file(data_out_file)

7. status = write_data_header(run_num, n_pix_planes, type_tmp)

8. call ranecu_init

9. call set_beam_properties

10. call sixy_drift_map call sixy_map_hfill

11. call sixy_charge_parameter

12. do evt_num = 1, max_evts

13. call mc_track

14. call mc_signal

15. call mc_write call mc_hfill

16. enddo

17. output histogram

Page 23: Beam Test Offline Code Jianchun Wang Syracuse University 01/17/02 Outline  Status of the code  Function modules  Discussion topics

01/17/02 Jianchun (JC) Wang 23

Alignment Flow

1. call read_namelist

2. status = open_old_file(data_in_file)

3. status = read_data_header(run_tmp, num_tmp, type_tmp)

4. call histo_init(hbk_out_file)

5. status = read_geometry(0)

6. call fill_derived_geom

7. call sixy_geom_hfill(11100)

8. call sixy_detector_parameter

9. call sixy_dpar_hfill

10. call mn_prepare_fit

11. call mn_read_track

12. call mn_fit_geo

13. call sixy_geom_hfill(11200)

14. output histogram