make_xml_mcc7.0.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_02_00
34 userdir=dunepro
35 userbase=$userdir
36 nevarg=0
37 nevjob=0
38 nevjobarg=0
39 local=''
40 
41 while [ $# -gt 0 ]; do
42  case "$1" in
43 
44  # User directory.
45 
46  -h|--help )
47  echo "Usage: make_xml_mcc.sh [-h|--help] [-r <release>] [-u|--user <user>] [--local <dir|tar>] [--nev <n>] [--nevjob <n>]"
48  exit
49  ;;
50 
51  # Release.
52 
53  -r )
54  if [ $# -gt 1 ]; then
55  rel=$2
56  shift
57  fi
58  ;;
59 
60  # User.
61 
62  -u|--user )
63  if [ $# -gt 1 ]; then
64  userdir=users/$2
65  userbase=$2
66  shift
67  fi
68  ;;
69 
70  # Local release.
71 
72  --local )
73  if [ $# -gt 1 ]; then
74  local=$2
75  shift
76  fi
77  ;;
78 
79  # Total number of events.
80 
81  --nev )
82  if [ $# -gt 1 ]; then
83  nevarg=$2
84  shift
85  fi
86  ;;
87 
88  # Number of events per job.
89 
90  --nevjob )
91  if [ $# -gt 1 ]; then
92  nevjobarg=$2
93  shift
94  fi
95  ;;
96 
97  esac
98  shift
99 done
100 
101 # Get qualifier.
102 
103 qual=e10
104 ver=`echo $rel | cut -c2-3`
105 if [ $ver -gt 2 ]; then
106  qual=e10
107 fi
108 
109 # Delete existing xml files.
110 
111 rm -f *.xml
112 
113 find $DUNETPC_DIR/source/fcl/dune35t/gen $DUNETPC_DIR/source/fcl/dunefd/gen $DUNETPC_DIR/source/fcl/protodune/gen -name \*.fcl | while read fcl
114 do
115  if ! echo $fcl | grep -q 'common\|protoDUNE_gensingle'; then
116  newprj=`basename $fcl .fcl`
117  newxml=${newprj}.xml
118  generator=SingleGen
119  if echo $newprj | grep -q cosmics; then
120  generator=CRY
121  fi
122  if echo $newprj | grep -q AntiMuonCutEvents; then
123  generator=TextFileGen
124  fi
125  if echo $newprj | grep -q genie; then
126  generator=GENIE
127  fi
128  if echo $newprj | grep -q MUSUN; then
129  generator=MUSUN
130  fi
131  if echo $newprj | grep -q supernova; then
132  generator=SNNueAr40CCGen
133  fi
134  if echo $newprj | grep -q prodndk; then
135  generator=NDKGen
136  fi
137 
138  detector=35t
139  if echo $newprj | grep -q dune10kt; then
140  detector=10kt
141  fi
142  if echo $newprj | grep -q protoDune; then
143  detector=protoDune
144  fi
145 
146  # Make xml file.
147 
148  echo "Making ${newprj}.xml"
149 
150  # Generator
151 
152  genfcl=`basename $fcl`
153 
154  # G4
155 
156  g4fcl=standard_g4_dune35t.fcl
157 
158  # Detsim (optical + tpc).
159 
160  detsimfcl=standard_detsim_dune35t.fcl
161 
162  # Reco 2D
163 
164 # reco2dfcl=standard_reco_uboone_2D.fcl
165 
166  # Reco 3D
167 
168 # reco3dfcl=standard_reco_uboone_3D.fcl
169 
170  # Reco
171  recofcl=standard_reco_dune35t.fcl
172 
173  # Merge/Analysis
174 
175  mergefcl=standard_ana_dune35t.fcl
176 
177  if echo $newprj | grep -q protonpi0; then
178  g4fcl=standard_g4_dune35t_protonpi0.fcl
179  fi
180 
181  if echo $newprj | grep -q countermu; then
182  g4fcl=standard_g4_dune35t_countermu.fcl
183  fi
184 
185 # if echo $newprj | grep -q 'pi0\|gamma'; then
186 # recofcl=reco_dune35t_blur.fcl
187 # mergefcl=ana_energyCalib.fcl
188 # fi
189 
190 # if echo $newprj | grep -q 'piminus'; then
191 # recofcl=emhits.fcl
192 # mergefcl=standard_merge_dune35t.fcl
193 # fi
194 
195  if echo $newprj | grep -q milliblock; then
196  detsimfcl=standard_detsim_dune35t_milliblock.fcl
197  recofcl=standard_reco_dune35t_milliblock.fcl
198  mergefcl=standard_ana_dune35t_milliblock.fcl
199  fi
200 
201  if echo $newprj | grep -q dune10kt; then
202  g4fcl=standard_g4_dune10kt.fcl
203  detsimfcl=standard_detsim_dune10kt.fcl
204  recofcl=standard_reco_dune10kt.fcl
205  mergefcl=standard_ana_dune10kt.fcl
206  fi
207 
208  if echo $newprj | grep -q 'dune10kt_workspace\|dune10kt_r10deg_workspace'; then
209  g4fcl=standard_g4_dune10kt_workspace.fcl
210  detsimfcl=standard_detsim_dune10kt_workspace.fcl
211  recofcl=standard_reco_dune10kt_workspace.fcl
212  mergefcl=standard_ana_dune10kt_workspace.fcl
213  if echo $newprj | grep -q genie; then
214  recofcl=standard_reco_dune10kt_nu_workspace.fcl
215  fi
216  fi
217 
218  if echo $newprj | grep -q dune10kt_3mmpitch_workspace; then
219  g4fcl=standard_g4_dune10kt_3mmpitch_workspace.fcl
220  detsimfcl=standard_detsim_dune10kt_3mmpitch_workspace.fcl
221  recofcl=standard_reco_dune10kt_3mmpitch_workspace.fcl
222  mergefcl=standard_ana_dune10kt_3mmpitch_workspace.fcl
223  if echo $newprj | grep -q genie; then
224  recofcl=standard_reco_dune10kt_3mmpitch_nu_workspace.fcl
225  fi
226  fi
227 
228  if echo $newprj | grep -q dune10kt_45deg_workspace; then
229  g4fcl=standard_g4_dune10kt_45deg_workspace.fcl
230  detsimfcl=standard_detsim_dune10kt_45deg_workspace.fcl
231  recofcl=standard_reco_dune10kt_45deg_workspace.fcl
232  mergefcl=standard_ana_dune10kt_45deg_workspace.fcl
233  if echo $newprj | grep -q genie; then
234  recofcl=standard_reco_dune10kt_45deg_nu_workspace.fcl
235  fi
236  fi
237 
238  if echo $newprj | grep -q 'dune10kt_1x2x6\|dune10kt_r90deg_1x2x6'; then
239  g4fcl=standard_g4_dune10kt_1x2x6.fcl
240  detsimfcl=standard_detsim_dune10kt_1x2x6.fcl
241  recofcl=standard_reco_dune10kt_1x2x6.fcl
242  mergefcl=standard_ana_dune10kt_1x2x6.fcl
243  if echo $newprj | grep -q genie; then
244  recofcl=standard_reco_dune10kt_nu_1x2x6.fcl
245  fi
246  fi
247 
248  if echo $newprj | grep -q dune10kt_3mmpitch_1x2x6; then
249  g4fcl=standard_g4_dune10kt_3mmpitch_1x2x6.fcl
250  detsimfcl=standard_detsim_dune10kt_3mmpitch_1x2x6.fcl
251  recofcl=standard_reco_dune10kt_3mmpitch_1x2x6.fcl
252  mergefcl=standard_ana_dune10kt_3mmpitch_1x2x6.fcl
253  if echo $newprj | grep -q genie; then
254  recofcl=standard_reco_dune10kt_3mmpitch_nu_1x2x6.fcl
255  fi
256  fi
257 
258  if echo $newprj | grep -q dune10kt_45deg_1x2x6; then
259  g4fcl=standard_g4_dune10kt_45deg_1x2x6.fcl
260  detsimfcl=standard_detsim_dune10kt_45deg_1x2x6.fcl
261  recofcl=standard_reco_dune10kt_45deg_1x2x6.fcl
262  mergefcl=standard_ana_dune10kt_45deg_1x2x6.fcl
263  if echo $newprj | grep -q genie; then
264  recofcl=standard_reco_dune10kt_45deg_nu_1x2x6.fcl
265  fi
266  fi
267 
268  if echo $newprj | grep -q protoDune; then
269  g4fcl=protoDUNE_g4single.fcl
270  detsimfcl=protoDUNE_detsim_single.fcl
271  recofcl=protoDUNE_reco.fcl
272  mergefcl=protoDUNE_ana.fcl
273  fi
274 
275 
276  # Set number of events per job.
277  nevjob=$nevjobarg
278  if [ $nevjob -eq 0 ]; then
279  if [ $newprj = prodcosmics_dune35t_milliblock ]; then
280  nevjob=100
281  elif [ $newprj = prodcosmics_dune35t_onewindow ]; then
282  nevjob=100
283  elif [ $newprj = AntiMuonCutEvents_LSU_dune35t ]; then
284  nevjob=100
285  elif [ $newprj = prodcosmics_dune35t_milliblock_countermu ]; then
286  nevjob=10000
287  elif [ $newprj = prodcosmics_dune35t_milliblock_protonpi0 ]; then
288  nevjob=100
289  else
290  nevjob=100
291  fi
292  fi
293 
294  # Set number of events.
295 
296  nev=$nevarg
297  if [ $nev -eq 0 ]; then
298  if [ $newprj = prodcosmics_dune35t_milliblock ]; then
299  nev=10000
300  elif [ $newprj = prodcosmics_dune35t_onewindow ]; then
301  nev=10000
302  elif [ $newprj = AntiMuonCutEvents_LSU_dune35t ]; then
303  nev=10000
304  elif [ $newprj = prodcosmics_dune35t_milliblock_countermu ]; then
305  nev=10000000
306  elif [ $newprj = prodcosmics_dune35t_milliblock_protonpi0 ]; then
307  nev=100000
308  elif echo $newprj | grep -q dune10kt; then
309  if echo $newprj | grep -q genie; then
310  nev=100000
311  else
312  nev=10000
313  fi
314  elif echo $newprj | grep -q protoDune; then
315  nev=30000
316  else
317  nev=10000
318  fi
319  fi
320 
321  # Calculate the number of worker jobs.
322 
323  njob=$(( $nev / $nevjob ))
324 # echo $newprj, $nev, $nevjob, $njob
325  cat <<EOF > $newxml
326 <?xml version="1.0"?>
327 
328 <!-- Production Project -->
329 
330 <!DOCTYPE project [
331 <!ENTITY release "$rel">
332 <!ENTITY file_type "mc">
333 <!ENTITY run_type "physics">
334 <!ENTITY name "$newprj">
335 <!ENTITY tag "mcc7.0">
336 ]>
337 
338 <project name="&name;">
339 
340  <!-- Group -->
341  <group>dune</group>
342 
343  <!-- Project size -->
344  <numevents>$nev</numevents>
345 
346  <!-- Operating System -->
347  <os>SL6</os>
348 
349  <!-- Batch resources -->
350  <resource>DEDICATED,OPPORTUNISTIC</resource>
351 
352  <!-- Larsoft information -->
353  <larsoft>
354  <tag>&release;</tag>
355  <qual>${qual}:prof</qual>
356 EOF
357  echo "local=$local"
358  if [ x$local != x ]; then
359  echo " <local>${local}</local>" >> $newxml
360  fi
361  cat <<EOF >> $newxml
362  </larsoft>
363 
364  <!-- dune35t metadata parameters -->
365 
366  <parameter name ="MCName">${newprj}</parameter>
367  <parameter name ="MCDetectorType">${detector}</parameter>
368  <parameter name ="MCGenerators">${generator}</parameter>
369 
370  <!-- Project stages -->
371 
372  <stage name="gen">
373  <fcl>$genfcl</fcl>
374 EOF
375  if echo $newprj | grep -q AntiMuonCutEvents_LSU_dune35t; then
376  echo " <inputmode>textfile</inputmode>" >> $newxml
377  echo " <inputlist>/dune/data2/users/jti3/txtfiles/AntiMuonCutEvents_LSU_100.txt</inputlist>" >> $newxml
378  fi
379  cat <<EOF >> $newxml
380  <outdir>/pnfs/dune/scratch/${userdir}/&release;/gen/&name;</outdir>
381  <workdir>/dune/app/users/${userbase}/work/&release;/gen/&name;</workdir>
382  <output>${newprj}_\${PROCESS}_%tc_gen.root</output>
383  <numjobs>$njob</numjobs>
384  <datatier>generated</datatier>
385  <defname>&name;_&tag;_gen</defname>
386  </stage>
387 
388  <stage name="g4">
389  <fcl>$g4fcl</fcl>
390  <outdir>/pnfs/dune/scratch/${userdir}/&release;/g4/&name;</outdir>
391  <workdir>/dune/app/users/${userbase}/work/&release;/g4/&name;</workdir>
392  <numjobs>$njob</numjobs>
393  <datatier>simulated</datatier>
394  <defname>&name;_&tag;_g4</defname>
395  </stage>
396 
397 EOF
398  if [ x$detsimfcl != x ]; then
399  cat <<EOF >> $newxml
400  <stage name="detsim">
401  <fcl>$detsimfcl</fcl>
402  <outdir>/pnfs/dune/scratch/${userdir}/&release;/detsim/&name;</outdir>
403  <workdir>/dune/app/users/${userbase}/work/&release;/detsim/&name;</workdir>
404  <numjobs>$njob</numjobs>
405  <datatier>detector-simulated</datatier>
406  <defname>&name;_&tag;_detsim</defname>
407  </stage>
408 
409 EOF
410  fi
411  cat <<EOF >> $newxml
412  <stage name="reco">
413  <fcl>$recofcl</fcl>
414  <outdir>/pnfs/dune/scratch/${userdir}/&release;/reco/&name;</outdir>
415  <workdir>/dune/app/users/${userbase}/work/&release;/reco/&name;</workdir>
416  <numjobs>$njob</numjobs>
417  <datatier>full-reconstructed</datatier>
418  <defname>&name;_&tag;_reco</defname>
419  </stage>
420 
421  <stage name="mergeana">
422  <fcl>$mergefcl</fcl>
423  <outdir>/pnfs/dune/scratch/${userdir}/&release;/mergeana/&name;</outdir>
424  <output>&name;_\${PROCESS}_%tc_merged.root</output>
425  <workdir>/dune/app/users/${userbase}/work/&release;/mergeana/&name;</workdir>
426  <numjobs>$njob</numjobs>
427  <targetsize>8000000000</targetsize>
428  <datatier>full-reconstructed</datatier>
429  <defname>&name;_&tag;</defname>
430  </stage>
431 
432  <!-- file type -->
433  <filetype>&file_type;</filetype>
434 
435  <!-- run type -->
436  <runtype>&run_type;</runtype>
437 
438 </project>
439 EOF
440 
441  fi
442 
443 done