| 1 | #!/usr/bin/python -tt
|
|---|
| 2 | # ********************************
|
|---|
| 3 | # Test script for the CalFactFits class
|
|---|
| 4 | #
|
|---|
| 5 | # written by Thomas Kraehenbuehl, ETH Zurich
|
|---|
| 6 | # tpk@phys.ethz.ch, +41 44 633 3973
|
|---|
| 7 | # April 2012
|
|---|
| 8 | # ********************************
|
|---|
| 9 |
|
|---|
| 10 | datafilename = '/fact/raw/2012/04/17/20120417_004.fits.gz'
|
|---|
| 11 | calibfilename = '/fact/raw/2012/04/17/20120417_003.drs.fits.gz'
|
|---|
| 12 |
|
|---|
| 13 | import numpy as np
|
|---|
| 14 |
|
|---|
| 15 | from ROOT import gSystem
|
|---|
| 16 | gSystem.Load("izstream_h.so") #Not always necessary
|
|---|
| 17 | gSystem.Load("factfits_h.so") #Not always necessary
|
|---|
| 18 | gSystem.Load("calfactfits_h.so")
|
|---|
| 19 | from ROOT import *
|
|---|
| 20 | print "Testing object creation: "
|
|---|
| 21 | caltest = CalFactFits(datafilename,calibfilename)
|
|---|
| 22 | npcalevent = np.empty( caltest.npix * caltest.nroi, np.float64) #.reshape(caltest.npix ,caltest.nroi)
|
|---|
| 23 | caltest.SetNpcaldataPtr(npcalevent)
|
|---|
| 24 |
|
|---|
| 25 | print "Common variables:"
|
|---|
| 26 | print "ROI: ", caltest.nroi
|
|---|
| 27 | print "#Pix: ", caltest.npix
|
|---|
| 28 | print "Number of events: ", caltest.nevents
|
|---|
| 29 | print
|
|---|
| 30 |
|
|---|
| 31 | print "Information per Event:"
|
|---|
| 32 | caltest.GetCalEvent()
|
|---|
| 33 | print "Calibrated data in numpy array: ", npcalevent
|
|---|
| 34 | print "Event ID: ", caltest.event_id
|
|---|
| 35 | print "Trigger type: ", caltest.event_triggertype
|
|---|
| 36 | print "Uncalibrated data: ", caltest.event_data
|
|---|
| 37 | print "Calibrated data: ", caltest.npcaldata
|
|---|
| 38 | print "Board times: ", caltest.event_boardtimes
|
|---|
| 39 | print "Trigger offsets: ", caltest.event_offset
|
|---|
| 40 | print
|
|---|
| 41 |
|
|---|
| 42 | print "Examples of other information"
|
|---|
| 43 | print "Calibfile ROI: ", caltest.calib_nroi
|
|---|
| 44 | print "Column size BaselineMean: ", caltest.calibfile.GetN("BaselineMean")
|
|---|
| 45 | print "Datafile ROI: ", caltest.data_nroi
|
|---|
| 46 | print "Data: ", caltest.datafile.GetN("Data")
|
|---|
| 47 | print "StartCellData: ", caltest.datafile.GetN("StartCellData")
|
|---|
| 48 | print "Direct datafile access: ", caltest.datafile.GetN("StartCellData")
|
|---|
| 49 | print
|
|---|
| 50 | print "Columns of the datafile: "
|
|---|
| 51 | caltest.datafile.PrintColumns()
|
|---|
| 52 |
|
|---|
| 53 | #while caltest.GetCalEvent():
|
|---|
| 54 | # if caltest.event_id>10:
|
|---|
| 55 | # break
|
|---|
| 56 | # print caltest.event_id, caltest.event_triggertype, caltest.event_caldata[10]
|
|---|
| 57 | # pass
|
|---|
| 58 | #print
|
|---|
| 59 |
|
|---|
| 60 | del caltest
|
|---|