source: fact/tools/pyscripts/examples/CalFactFitsTest.py@ 17254

Last change on this file since 17254 was 16991, checked in by kraehenb, 11 years ago
CalFactFitsTest.py: Fixed error on some systems about missing dictionary calfactfits.h: Added possibility to open old DRS files without NROI
File size: 1.9 KB
Line 
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
10datafilename = '/fact/raw/2012/04/17/20120417_004.fits.gz'
11calibfilename = '/fact/raw/2012/04/17/20120417_003.drs.fits.gz'
12
13import numpy as np
14
15from ROOT import gSystem
16gSystem.Load("izstream_h.so") #Not always necessary
17gSystem.Load("factfits_h.so") #Not always necessary
18gSystem.Load("calfactfits_h.so")
19from ROOT import *
20print "Testing object creation: "
21caltest = CalFactFits(datafilename,calibfilename)
22npcalevent = np.empty( caltest.npix * caltest.nroi, np.float64) #.reshape(caltest.npix ,caltest.nroi)
23caltest.SetNpcaldataPtr(npcalevent)
24
25print "Common variables:"
26print "ROI: ", caltest.nroi
27print "#Pix: ", caltest.npix
28print "Number of events: ", caltest.nevents
29print
30
31print "Information per Event:"
32caltest.GetCalEvent()
33print "Calibrated data in numpy array: ", npcalevent
34print "Event ID: ", caltest.event_id
35print "Trigger type: ", caltest.event_triggertype
36print "Uncalibrated data: ", caltest.event_data
37print "Calibrated data: ", caltest.npcaldata
38print "Board times: ", caltest.event_boardtimes
39print "Trigger offsets: ", caltest.event_offset
40print
41
42print "Examples of other information"
43print "Calibfile ROI: ", caltest.calib_nroi
44print "Column size BaselineMean: ", caltest.calibfile.GetN("BaselineMean")
45print "Datafile ROI: ", caltest.data_nroi
46print "Data: ", caltest.datafile.GetN("Data")
47print "StartCellData: ", caltest.datafile.GetN("StartCellData")
48print "Direct datafile access: ", caltest.datafile.GetN("StartCellData")
49print
50print "Columns of the datafile: "
51caltest.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
60del caltest
Note: See TracBrowser for help on using the repository browser.