source: fact/tools/rootmacros/run.py@ 17973

Last change on this file since 17973 was 12607, checked in by lusterma, 13 years ago
this file is cited as an example in the README and hence I added it here, but its maintained version will be put into another place (I think of tools/python)
File size: 2.6 KB
Line 
1#!/usr/bin/python
2#
3#
4
5import glob
6from os import system
7
8# zipped or unzipped data ?
9zip = '.gz' # set to '' for unzipped data
10
11# path to the raw data: zipped /data00 unzipped /data03 !!!
12path = '/data00/fact-construction/raw/'
13
14# where to store the results and how to tag them
15respath = '../res/' # the path to the store for the results
16restag = 'bsl' # the tag for identifying the type of analysis run on the data
17rmname = 'fbsl.C' # the root macro to run for the analysis
18rmpath = '../rootmacros/' # path to the root macro
19rmacro = rmpath + rmname + '++' # compose the macro name (++ instructs root to compile it first)
20
21# the list of runs which should be processed ( could later be read from a file...)
22# format: ( 'drsfileID = BBB', 'datafileid = AAA', 'DD', 'MM', 'YYYY' )
23# example: 20111109_003.fits = YYYYMMDD_AAA.fits
24# example: 20111109_003.drs.fits = YYYYMMDD_BBB.fits
25
26runlist = []
27
28#runlist.append( ( '003', '003', '09', '11', '2011') )
29#runlist.append( ( '003', '004', '09', '11', '2011') )
30#runlist.append( ( '003', '005', '09', '11', '2011') )
31runlist.append( ( '003', '006', '09', '11', '2011') )
32runlist.append( ( '003', '007', '09', '11', '2011') )
33runlist.append( ( '017', '008', '09', '11', '2011') )
34runlist.append( ( '017', '010', '09', '11', '2011') )
35runlist.append( ( '017', '011', '09', '11', '2011') )
36runlist.append( ( '017', '012', '09', '11', '2011') )
37runlist.append( ( '017', '013', '09', '11', '2011') )
38runlist.append( ( '017', '014', '09', '11', '2011') )
39runlist.append( ( '017', '017', '09', '11', '2011') )
40runlist.append( ( '017', '018', '09', '11', '2011') )
41
42# iterate over the list of runs
43for run in runlist:
44
45 # decompose the run info
46 drs, data, day, month, year = run
47
48 # set the path to the data
49 dpath = path + year +'/' + month + '/' + day + '/'
50 print 'working on datapath: ', dpath
51
52 # generate the input file names (data and drs calibration)
53 dfname = year + month + day + '_' + data
54 drsfname = year + month + day + '_' + drs
55 dfile = dpath + dfname + '.fits' + zip
56 drsfile = dpath + drsfname +'.drs.fits' + zip
57 print 'data file: ', dfile
58 print 'drs file : ', drsfile
59
60 # generate the file names for stroning the results
61 resdfile = respath + dfname + '_' + restag + '.txt'
62 reshfile = respath + dfname + '_' + restag + '.root'
63 print 'result data file: ', resdfile
64 print 'result historgram file: ', reshfile
65
66 # compose the command and run it
67 cmd = 'root -b -q \'' + rmacro + '(\"' + dfile + '\", \"' + drsfile + '\", 0, -1, 0, -1, \"' + resdfile + '\", \"' + reshfile + '\") \' '
68 print 'execution cmd: ', cmd
69 system( cmd )
70
Note: See TracBrowser for help on using the repository browser.