1 #-------------------------------------------------------------------------------------------
5 # % perl fconv.pl <options>
8 # --rmin : Minimum run number
9 # --rmax : Maximum run number
10 # --prefix : File prefix
11 # --suffix : File suffix
12 # --dirname : File location [default: ./]
13 # --convcmd : Conversion command
16 # Input: JNUBEAM HBOOK files nu.sk_horn250ka.RUNNU.hbk (where RUNNU=1,...,100)
17 # Located at: /opt/data/t2k_flux/10a/sk/
18 # Task: Convert to ROOT format
20 # % perl fconv.pl --rmin 1 --rmax 100 --prefix nu.sk_horn250ka. --suffix .hbk \
21 # --dirname /opt/data/t2k_flux/10a/sk/ --convcmd 'h2root'
24 # Input: GENIE GHEP event files gntp.ghep.RUNNU.root (where RUNNU=1000,...,1010)
25 # Located at: /opt/ghepfiles/
26 # Task: Convert first 10k events of each file in the GENIE summary ntuple format (GST)
28 # % perl fconv.pl --rmin 100 --rmax 1010 --prefix gntp. --suffix .ghep.root \
29 # --dirname /opt/ghepfiles/ --convcmd 'gntpc -f gst -n 10000 -i '
31 # Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
32 # STFC, Rutherford Appleton Lab
33 #-------------------------------------------------------------------------------------------
41 if($_ eq '--prefix') { $file_prfx = $ARGV[$iarg+1]; }
42 if($_ eq '--suffix') { $file_sufx = $ARGV[$iarg+1]; }
43 if($_ eq '--rmin') { $run_min = $ARGV[$iarg+1]; }
44 if($_ eq '--rmax') { $run_max = $ARGV[$iarg+1]; }
45 if($_ eq '--convcmd') { $convcmd = $ARGV[$iarg+1]; }
46 if($_ eq '--dirname') { $dirname = $ARGV[$iarg+1]; }
49 die("** Aborting [You need to specify a minimum run number using the --rmin option]")
50 unless defined $run_min;
51 die("** Aborting [You need to specify a maximum run number using the --rmax option]")
52 unless defined $run_max;
53 die("** Aborting [You need to specify a file prefix using the --prefix option]")
54 unless defined $file_prfx;
55 die("** Aborting [You need to specify a file suffix using the --suffix option]")
56 unless defined $file_sufx;
57 die("** Aborting [You need to specify the conversion command using the --convcmd option]")
58 unless defined $convcmd;
61 for($i=$run_min; $i<=$run_max; $i++) {
62 $filename = $dirname."/".$file_prfx.$i.$file_sufx;
64 $cmd = $convcmd." ".$filename;
65 print "Running: $cmd \n";