1 | #!/usr/bin/python
|
---|
2 | #
|
---|
3 | #
|
---|
4 |
|
---|
5 | import glob
|
---|
6 | from os import system
|
---|
7 |
|
---|
8 | # zipped or unzipped data ?
|
---|
9 | zip = '.gz' # set to '' for unzipped data
|
---|
10 |
|
---|
11 | # path to the raw data: zipped /data00 unzipped /data03 !!!
|
---|
12 | path = '/data00/fact-construction/raw/'
|
---|
13 |
|
---|
14 | # where to store the results and how to tag them
|
---|
15 | respath = '../res/' # the path to the store for the results
|
---|
16 | restag = 'bsl' # the tag for identifying the type of analysis run on the data
|
---|
17 | rmname = 'fbsl.C' # the root macro to run for the analysis
|
---|
18 | rmpath = '../rootmacros/' # path to the root macro
|
---|
19 | rmacro = 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 |
|
---|
26 | runlist = []
|
---|
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') )
|
---|
31 | runlist.append( ( '003', '006', '09', '11', '2011') )
|
---|
32 | runlist.append( ( '003', '007', '09', '11', '2011') )
|
---|
33 | runlist.append( ( '017', '008', '09', '11', '2011') )
|
---|
34 | runlist.append( ( '017', '010', '09', '11', '2011') )
|
---|
35 | runlist.append( ( '017', '011', '09', '11', '2011') )
|
---|
36 | runlist.append( ( '017', '012', '09', '11', '2011') )
|
---|
37 | runlist.append( ( '017', '013', '09', '11', '2011') )
|
---|
38 | runlist.append( ( '017', '014', '09', '11', '2011') )
|
---|
39 | runlist.append( ( '017', '017', '09', '11', '2011') )
|
---|
40 | runlist.append( ( '017', '018', '09', '11', '2011') )
|
---|
41 |
|
---|
42 | # iterate over the list of runs
|
---|
43 | for 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 |
|
---|