Content

Code

Detector specific code is located in packages:

For calibration and algorithms other psana packages are used, so all examples will run in standard psana environment.

Data pre-processing CLI

Data pre-processing script reads xtc file, process waveforms using CFD algorithm, and saves arrays of times for each for each channel in the "small data" HDF5 file. Example of the command and description of parameters:

hex_data_preproc -h

Calibration CLI

Detector calibration works with two calibration types

  • hex_config
  • hex_table

e.g. /reg/d/psdm/xpp/xpptut15/calib/Acqiris::CalibV1/AmoETOF.0:Acqiris.0/hex_table/0-end.data

Calibration is running on pre-processed HDF5 file (or xtc but slow). Procedure is explained in the help message of the command

hex_calib -h

Data processing example

Hexanode data processing in psana using MPIDataSource:

expmon/examples/ex-hex-mpidatasource.py
import psana
from expmon.HexDataIOExt import HexDataIOExt  # Line 0 - import
# Parameters: data set name, data source, channels, number of events, CFD etc.
kwargs = {'command'  : 1,
          'srcchs'   : {'AmoETOF.0:Acqiris.0':(6,7,8,9,10,11),'AmoITOF.0:Acqiris.0':(0,)},
          'numchs'   : 7,
          'numhits'  : 16,
          'dsname'   : 'exp=xpptut15:run=390:smd',
          'evskip'   : 0,
          'events'   : 500,
          'ofprefix' : './',
          'verbose'  : False,
          'cfd_base'        :  0.  ,        
          'cfd_thr'         : -0.04,         
          'cfd_cfr'         :  0.9 ,         
          'cfd_deadtime'    :  5.0 ,    
          'cfd_leadingedge' :  True, 
          'cfd_ioffsetbeg'  :  0   ,  
          'cfd_ioffsetend'  :  1000, 
         }
ds = psana.MPIDataSource(kwargs['dsname'])    # Open psana dataset using mpi
o = HexDataIOExt(ds, **kwargs)                # Line 1 - object initialization
print 'MPI size: %2d rank: %2d' % (ds.size, ds.rank)

for evt in ds.events() :
    nevent = ds.event_number()
    #print 'XXX event %4d rank %2d' % (nevent, ds.rank)
                 
    if o.skip_event(evt, nevent)   : continue # Line 2 - loop control method passes evt to the object
    if nevent > o.EVENTS           : break
    #x, y, t = o.hits_xyt()                   # Line 3 - get arrays x, y, t of hits' coordinates and time
    o.print_hits()                            # Line 3 alternative - prints x, y, time for all hits in the event

#if ds.master :
print 'MPI rank %2d summary:' % (ds.rank)
o.print_summary()                         # print number of events, processing time total, instant and frequency

MPIDataSource object provides in ds.events() subset of events for particular MPI rank. Method  ds.event_number() retrieves total event number in entire dataset.

Other example versions in expmon/examples:

  • ex-hex-proc-datasource.py -  hexanode data processing in psana DataSource with MPI,
  • ex-hex-data-proc-:2.py - hexanode data processing in psana using DataSource created inside HexDataIO object.

References

  • No labels