make_xml_sys.sh
Go to the documentation of this file.
1 #! /bin/bash
2 #----------------------------------------------------------------------
3 #
4 # Name: make_xml_mcc.sh
5 #
6 # Purpose: Make xml files for mcc. This script loops over all
7 # generator-level fcl files in the source area of the currently
8 # setup version of dunetpc (that is, under
9 # $DUNETPC_DIR/source/fcl/dune35t/gen), and makes a corresponding xml
10 # project file in the local directory.
11 #
12 # Usage:
13 #
14 # make_xml_mcc4.0.sh [-h|--help] [-r <release>] [-u|--user <user>] [--local <dir|tar>] [--nev <n>] [--nevjob <n>] [--nevgjob <n>]
15 #
16 # Options:
17 #
18 # -h|--help - Print help.
19 # -r <release> - Use the specified larsoft/dunetpc release.
20 # -u|--user <user> - Use users/<user> as working and output directories
21 # (default is to use lbnepro).
22 # --local <dir|tar> - Specify larsoft local directory or tarball (xml
23 # tag <local>...</local>).
24 # --nev <n> - Specify number of events for all samples. Otherwise
25 # use hardwired defaults.
26 # --nevjob <n> - Specify the default number of events per job.
27 # --nevgjob <n> - Specify the maximum number of events per gen/g4 job.
28 #
29 #----------------------------------------------------------------------
30 
31 # Parse arguments.
32 
33 rel=v06_64_00
34 userdir=scratch/dunepro
35 userbase=dunepro
36 nev=100000
37 nevjob=100
38 ls=''
39 #sys=25pcbadchans
40 sys=def
41 tag=mcc10.1
42 
43 while [ $# -gt 0 ]; do
44  case "$1" in
45 
46  # User directory.
47 
48  -h|--help )
49  echo "Usage: make_xml_mcc5.0.sh [-h|--help] [-r <release>] [-u|--user <user>] [--local <dir|tar>] [--nev <n>] [--nevjob <n>] [--sys <sys>]"
50  exit
51  ;;
52 
53  # Release.
54 
55  -r )
56  if [ $# -gt 1 ]; then
57  rel=$2
58  shift
59  fi
60  ;;
61 
62  # User.
63 
64  -u|--user )
65  if [ $# -gt 1 ]; then
66  userdir=scratch/users/$2
67  userbase=$2
68  shift
69  fi
70  ;;
71 
72  # Local release.
73 
74  --local )
75  if [ $# -gt 1 ]; then
76  local=$2
77  shift
78  fi
79  ;;
80 
81  # Total number of events.
82 
83  --nev )
84  if [ $# -gt 1 ]; then
85  nev=$2
86  shift
87  fi
88  ;;
89 
90  # Number of events per job.
91 
92  --nevjob )
93  if [ $# -gt 1 ]; then
94  nevjob=$2
95  shift
96  fi
97  ;;
98 
99  # Name of systematic effect
100 
101  --sys )
102  if [ $# -gt 1 ]; then
103  sys=$2
104  shift
105  fi
106  ;;
107 
108 
109  esac
110  shift
111 done
112 
113 # Get qualifier.
114 
115 quals=e15
116 if [[ $rel < 'v06_32_00' ]]; then
117  quals=e10
118 fi
119 
120 echo $quals
121 
122 # Delete existing xml files.
123 
124 rm -f *.xml
125 
126 find $DUNETPC_DIR/source/fcl/dune35t/gen $DUNETPC_DIR/source/fcl/dunefd/gen $DUNETPC_DIR/source/fcl/protodune/gen -name \*.fcl | while read fcl
127 do
128  if echo $fcl | grep -q 'prodgenie_nu_dune10kt_1x2x6\|prodgenie_nue_dune10kt_1x2x6\|prodgenie_nutau_dune10kt_1x2x6\|prodgenie_anu_dune10kt_1x2x6\|prodgenie_anue_dune10kt_1x2x6\|prodgenie_anutau_dune10kt_1x2x6'; then
129  newprj=`basename $fcl .fcl`_${tag}_${sys}
130  newxml=${newprj}.xml
131  samprj=${newprj}
132  if [ $userbase != dunepro ]; then
133  samprj=${userbase}_$newprj
134  fi
135  generator=GENIE
136 
137  detector=10kt
138  # Make xml file.
139 
140  echo "Making ${newxml}"
141 
142  # Reco
143  recoinputdef=''
144  recofcl=/dune/app/users/tjyang/larsoft_mydev/srcs/dunetpc/fcl/dunefd/reco/syst/standard_reco_dune10kt_nu_1x2x6_${sys}.fcl
145  if [ "$sys" == "def" ]; then
146  recofcl=standard_reco_dune10kt_nu_1x2x6.fcl
147  fi
148  # Merge/Analysis
149 
150  caffcl=''
151 
152  if echo $newprj | grep -q '_nu_'; then
153  recoinputdef=prodgenie_nu_dune10kt_1x2x6_mcc10.0_detsim
154  fi
155  if echo $newprj | grep -q '_nue_'; then
156  recoinputdef=prodgenie_nue_dune10kt_1x2x6_mcc10.0_detsim
157  fi
158  if echo $newprj | grep -q '_nutau_'; then
159  recoinputdef=prodgenie_nutau_dune10kt_1x2x6_mcc10.0_detsim
160  fi
161  if echo $newprj | grep -q '_anu_'; then
162  recoinputdef=prodgenie_anu_dune10kt_1x2x6_mcc10.0_detsim
163  fi
164  if echo $newprj | grep -q '_anue_'; then
165  recoinputdef=prodgenie_anue_dune10kt_1x2x6_mcc10.0_detsim
166  fi
167  if echo $newprj | grep -q '_anutau_'; then
168  recoinputdef=prodgenie_anutau_dune10kt_1x2x6_mcc10.0_detsim
169  fi
170  if echo $newprj | grep -q '_nu'; then
171  caffcl=select_ana_dune10kt_nu.fcl
172  fi
173  if echo $newprj | grep -q '_anu'; then
174  caffcl=select_ana_dune10kt_anu.fcl
175  fi
176 
177 
178  njob=$(( $nev / $nevjob ))
179 # echo $newprj, $nev, $nevjob, $njob
180  cat <<EOF > $newxml
181 <?xml version="1.0"?>
182 
183 <!-- Production Project -->
184 
185 <!DOCTYPE project [
186 <!ENTITY rel "$rel">
187 <!ENTITY file_type "mc">
188 <!ENTITY run_type "physics">
189 <!ENTITY name "$samprj">
190 <!ENTITY tag "${tag}_${sys}">
191 ]>
192 
193 <job>
194 
195 <project name="&name;">
196 
197  <!-- Project size -->
198  <numevents>$nev</numevents>
199 
200  <!-- Operating System -->
201  <os>SL6</os>
202 
203  <!-- Batch resources -->
204  <resource>DEDICATED,OPPORTUNISTIC</resource>
205 
206  <!-- metadata parameters -->
207 
208  <parameter name ="MCName">${samprj}</parameter>
209  <parameter name ="MCDetectorType">${detector}</parameter>
210  <parameter name ="MCGenerators">${generator}</parameter>
211 
212  <!-- Larsoft information -->
213  <larsoft>
214  <tag>&rel;</tag>
215  <qual>${quals}:prof</qual>
216 EOF
217  if [ x$local != x ]; then
218  echo "local=$local"
219  echo " <local>${local}</local>" >> $newxml
220  fi
221  cat <<EOF >> $newxml
222  </larsoft>
223 
224  <check>1</check>
225 
226  <!-- Project stages -->
227  <stage name="reco">
228  <jobsub>--expected-lifetime=24h --subgroup=prod</jobsub>
229  <maxfilesperjob>1</maxfilesperjob>
230  <inputdef>${recoinputdef}</inputdef>
231  <fcl>$recofcl</fcl>
232  <outdir>/pnfs/dune/${userdir}/&rel;/reco/&name;</outdir>
233  <workdir>/pnfs/dune/${userdir}/work/&rel;/reco/&name;</workdir>
234  <numjobs>$njob</numjobs>
235  <datatier>full-reconstructed</datatier>
236  <defname>&name;_reco</defname>
237  </stage>
238 
239  <stage name="mergeana">
240  <jobsub>--memory=4000 --expected-lifetime=24h --subgroup=prod</jobsub>
241  <fcl>$caffcl</fcl>
242  <outdir>/pnfs/dune/${userdir}/&rel;/mergeana/&name;</outdir>
243  <output>&name;_\${PROCESS}_%tc_merged.root</output>
244  <workdir>/pnfs/dune/${userdir}/work/&rel;/mergeana/&name;</workdir>
245  <numjobs>$njob</numjobs>
246  <targetsize>8000000000</targetsize>
247  <datatier>full-reconstructed</datatier>
248  <defname>&name;</defname>
249  </stage>
250 
251  <!-- file type -->
252  <filetype>&file_type;</filetype>
253 
254  <!-- run type -->
255  <runtype>&run_type;</runtype>
256 
257 </project>
258 </job>
259 
260 EOF
261  fi
262 done