All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SubmitCommand.pl
Go to the documentation of this file.
1 #!/usr/bin/perl
2 # M. Toups
3 # 12/1/14
4 #
5 # Short script to submit optical library generation with
6 # project.py.
7 #
8 use strict;
9 use warnings;
10 use File::Basename qw(fileparse);
11 use Cwd qw(abs_path);
12 
13 my ($xml, $fcl, $workdir, $check, $merge) = @ARGV;
14 
15 if(!(defined($xml) || defined($fcl) || defined($workdir))) {
16  print "Usage: perl SubmitCommand.pl <project.py xml file> <fcl file> <work dir> [<checkana?>] [<merge?>]\n";
17  exit(1);
18 }
19 
20 if(!(-e "${workdir}/buildopticallibrary")) {
21  mkdir "${workdir}/buildopticallibrary", 0775;
22 }
23 
24 if(!(-e "${workdir}/buildopticallibrary/xml")) {
25  mkdir "${workdir}/buildopticallibrary/xml", 0775;
26 }
27 
28 if(!(-e "${workdir}/buildopticallibrary)/fcl")) {
29  mkdir "${workdir}/buildopticallibrary/fcl", 0775;
30 }
31 
34 my $NJobs = 9375;
36 
37 for(my $i=$StartJob; $i<$StartJob+$NJobs; $i++) {
38 
39  my ($fcl_filename, $fcl_directories, $fcl_suffix) = fileparse($fcl,".fcl");
40  my ($xml_filename, $xml_directories, $xml_suffix) = fileparse($xml,".xml");
41 
42  if(!(-e "${workdir}/buildopticallibrary/fcl/${fcl_filename}_${i}${fcl_suffix}")) {
43 
44  open IN, "${fcl}" or die $!;
45  open OUT, ">${workdir}/buildopticallibrary/fcl/${fcl_filename}_${i}${fcl_suffix}" or die $!;
46 
47  while(<IN>) {
48  if(/physics.producers.generator.FirstVoxel/) {
49  print OUT "physics.producers.generator.FirstVoxel: " . $NVoxelsPerJob*$i . "\n";
50  }
51  elsif(/physics.producers.generator.LastVoxel/) {
52  print OUT "physics.producers.generator.LastVoxel: " . ($NVoxelsPerJob*($i+1)-1) . "\n";
53  }
54  elsif(/physics.producers.generator.N/) {
55  print OUT "physics.producers.generator.N: ${NPhotonsPerVoxel}\n";
56  }
57  else {
58  print OUT "$_";
59  }
60  }
61  close IN or die $!;
62  close OUT or die $!;
63  }
64 
65  if(!(-e ">${workdir}/buildopticallibrary/xml/${xml_filename}_${i}${xml_suffix}")) {
66 
67  open IN, "${xml}" or die $!;
68  open OUT, ">${workdir}/buildopticallibrary/xml/${xml_filename}_${i}${xml_suffix}" or die $!;
69 
70  while(<IN>) {
71  if(/ENTITY name/) {
72  print OUT '<!ENTITY name "gen_photon_ball_' . $i . '">' . "\n";
73  }
74  elsif(/\<fcl\>(.*)\<\/fcl\>/) {
75  print OUT " <fcl>" . abs_path(${workdir}) . "\/buildopticallibrary\/fcl\/${fcl_filename}_${i}${fcl_suffix}<\/fcl>\n";
76  }
77  else {
78  print OUT "$_";
79  }
80  }
81 
82  close IN or die $!;
83  close OUT or die $!;
84  }
85 
86  if(!defined($check)) {
87  if(!defined($merge)) {
88  system qq|project.py --xml ${workdir}/buildopticallibrary/xml/${xml_filename}_${i}${xml_suffix} --submit|;
89  sleep 1;
90  } else {
91  system qq|project.py --xml ${workdir}/buildopticallibrary/xml/${xml_filename}_${i}${xml_suffix} --merge|;
92  }
93  } else {
94  system qq|project.py --xml ${workdir}/buildopticallibrary/xml/${xml_filename}_${i}${xml_suffix} --checkana|;
95  }
96 
97 }
98 
99 
process_name standard_reco_uboone fcl
my $NPhotonsPerVoxel
use File::Basename qw(fileparse)
process_name can override from command line with o or output proton mvapid_weights muon_all_BDT weights xml
Definition: runPID.fcl:28
process_name drop raw::OpDetWaveforms_DataApr2016RecoStage1_saturation_ * physics
use warnings
Definition: SubmitCommand.pl:9
do one_file $F done echo for F in find $TOP name CMakeLists txt print
my $StartJob
my($xml, $fcl, $workdir, $check, $merge)
use strict
Definition: SubmitCommand.pl:8
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker see the discussion of warn common echo in *Note Linker such as a global int variable echo as opposed to a large global array echo echo I echo The symbol is an indirect reference to another symbol This echo is a GNU extension to the a out object file format which is echo rarely used echo echo N echo The symbol is a debugging symbol echo echo R echo The symbol is in a read only data section echo echo S echo The symbol is in an uninitialized data section for small echo objects echo echo T echo The symbol is in the the normal defined echo symbol is used with no error When a weak undefined symbol echo is linked and the symbol is not defined
my $NVoxelsPerJob
do i e
do echo $i
Definition: TrainMVA.sh:30
then echo fcl name
my $NJobs
print OUTPUT<< EOF;< setup name="Default"version="1.0">< worldref="volWorld"/></setup ></gdml > EOF close(OUTPUT)
open(RACETRACK) or die("Could not open file $RACETRACK for writing")