make_xml_35tdata.sh
Go to the documentation of this file.
1 #! /bin/bash
2 #----------------------------------------------------------------------
3 #
4 # Name: make_xml_35tdata.sh
5 #
6 # Purpose: Make xml files for 35tdata.
7 #
8 # Usage:
9 #
10 # make_xml_35tdata.sh [-h|--help] --run <run> [-r <release>] [-u|--user <user>] [--local <dir|tar>] [--nev <n>]
11 #
12 # Options:
13 #
14 # -h|--help - Print help.
15 # --run - Specify the run number.
16 # -r <release> - Use the specified larsoft/dunetpc release.
17 # -u|--user <user> - Use users/<user> as working and output directories
18 # (default is to use dunepro).
19 # --local <dir|tar> - Specify larsoft local directory or tarball (xml
20 # tag <local>...</local>).
21 # --nev <n> - Specify number of events for all samples.
22 # Otherwise use hardwired defaults.
23 #
24 #----------------------------------------------------------------------
25 
26 # Parse arguments.
27 
28 run=''
29 rel=v04_34_00
30 userdir=dunepro
31 userbase=$userdir
32 nev=-1
33 local=''
34 
35 while [ $# -gt 0 ]; do
36  case "$1" in
37 
38  # User directory.
39 
40  -h|--help )
41  echo "Usage: make_xml_mcc.sh [-h|--help] --run <run> [-r <release>] [-u|--user <user>] [--local <dir|tar>] [--nev <n>] "
42  exit
43  ;;
44 
45  # Run
46 
47  --run )
48  if [ $# -gt 1 ]; then
49  run=$2
50  shift
51  fi
52  ;;
53 
54 
55  # Release.
56 
57  -r )
58  if [ $# -gt 1 ]; then
59  rel=$2
60  shift
61  fi
62  ;;
63 
64  # User.
65 
66  -u|--user )
67  if [ $# -gt 1 ]; then
68  userdir=users/$2
69  userbase=$2
70  shift
71  fi
72  ;;
73 
74  # Local release.
75 
76  --local )
77  if [ $# -gt 1 ]; then
78  local=$2
79  shift
80  fi
81  ;;
82 
83  # Total number of events.
84 
85  -n|--nev )
86  if [ $# -gt 1 ]; then
87  nev=$2
88  shift
89  fi
90  ;;
91 
92  esac
93  shift
94 done
95 
96 # Get qualifier.
97 
98 qual=e9
99 
100 # Delete existing xml files.
101 
102 #rm -f *.xml
103 newprj=run${run}
104 newxml=run${run}.xml
105 
106 rm -f newxml
107 
108 slicefcl=RunSplitterDefault.fcl
109 
110 kx509
111 echo samweb delete-definition rawdata35t_run_${run}
112 samweb delete-definition rawdata35t_run_${run}
113 echo samweb -e lbne create-definition rawdata35t_run_${run} "run_number=${run} and data_tier=raw and lbne_data.detector_type like %35t%"
114 samweb -e lbne create-definition rawdata35t_run_${run} "run_number=${run} and data_tier=raw and lbne_data.detector_type like %35t%"
115 samweb list-definition-files rawdata35t_run_${run}
116 cat <<EOF > $newxml
117 <?xml version="1.0"?>
118 
119 <!-- Production Project -->
120 
121 <!DOCTYPE project [
122 <!ENTITY release "$rel">
123 <!ENTITY file_type "test-data">
124 <!ENTITY run_type "physics">
125 <!ENTITY name "$newprj">
126 <!ENTITY tag "35tdata">
127 ]>
128 
129 <project name="&name;">
130 
131  <!-- Group -->
132  <group>dune</group>
133 
134  <!-- Project size -->
135  <numevents>$nev</numevents>
136 
137  <!-- Operating System -->
138  <os>SL6</os>
139 
140  <!-- Batch resources -->
141  <resource>DEDICATED,OPPORTUNISTIC</resource>
142 
143  <!-- Larsoft information -->
144  <larsoft>
145  <tag>&release;</tag>
146  <qual>${qual}:prof</qual>
147 EOF
148  echo "local=$local"
149  if [ x$local != x ]; then
150  echo " <local>${local}</local>" >> $newxml
151  fi
152  cat <<EOF >> $newxml
153  </larsoft>
154 
155  <!-- Project stages -->
156 
157  <stage name="slice">
158  <fcl>$slicefcl</fcl>
159  <inputdef>rawdata35t_run_${run}</inputdef>
160  <outdir>/pnfs/dune/scratch/${userdir}/&release;/slice/&name;</outdir>
161  <workdir>/dune/app/users/${userbase}/work/&release;/slice/&name;</workdir>
162  <numjobs>1</numjobs>
163  <datatier>sliced</datatier>
164  <defname>&name;_&tag;_slice</defname>
165  </stage>
166 
167  <!-- file type -->
168  <filetype>&file_type;</filetype>
169 
170  <!-- run type -->
171  <runtype>&run_type;</runtype>
172 
173 </project>
174 
175 EOF
176