make_xml_mcc7.2.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_05_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  if echo $newprj | grep -q prodmarley; then
138  generator=MARLEY
139  fi
140  if echo $newprj | grep -q prodbackground_ar39; then
141  generator=RadioGen
142  fi
143 
144  detector=35t
145  if echo $newprj | grep -q dune10kt; then
146  detector=10kt
147  fi
148  if echo $newprj | grep -q protoDune; then
149  detector=protoDune
150  fi
151 
152  # Make xml file.
153 
154  echo "Making ${newprj}.xml"
155 
156  # Generator
157 
158  genfcl=`basename $fcl`
159 
160  # G4
161 
162  g4fcl=standard_g4_dune35t.fcl
163 
164  # Detsim (optical + tpc).
165 
166  detsimfcl=standard_detsim_dune35t.fcl
167 
168  # Reco 2D
169 
170 # reco2dfcl=standard_reco_uboone_2D.fcl
171 
172  # Reco 3D
173 
174 # reco3dfcl=standard_reco_uboone_3D.fcl
175 
176  # Reco
177  recofcl=standard_reco_dune35t.fcl
178 
179  # Merge/Analysis
180 
181  mergefcl=standard_ana_dune35t.fcl
182 
183  if echo $newprj | grep -q protonpi0; then
184  g4fcl=standard_g4_dune35t_protonpi0.fcl
185  fi
186 
187  if echo $newprj | grep -q countermu; then
188  g4fcl=standard_g4_dune35t_countermu.fcl
189  fi
190 
191 # if echo $newprj | grep -q 'pi0\|gamma'; then
192 # recofcl=reco_dune35t_blur.fcl
193 # mergefcl=ana_energyCalib.fcl
194 # fi
195 
196 # if echo $newprj | grep -q 'piminus'; then
197 # recofcl=emhits.fcl
198 # mergefcl=standard_merge_dune35t.fcl
199 # fi
200 
201  if echo $newprj | grep -q milliblock; then
202  detsimfcl=standard_detsim_dune35t_milliblock.fcl
203  recofcl=standard_reco_dune35t_milliblock.fcl
204  mergefcl=standard_ana_dune35t_milliblock.fcl
205  fi
206 
207  if echo $newprj | grep -q dune10kt; then
208  g4fcl=standard_g4_dune10kt.fcl
209  detsimfcl=standard_detsim_dune10kt.fcl
210  recofcl=standard_reco_dune10kt.fcl
211  mergefcl=standard_ana_dune10kt.fcl
212  fi
213 
214  if echo $newprj | grep -q 'dune10kt_workspace\|dune10kt_r10deg_workspace'; then
215  g4fcl=standard_g4_dune10kt_workspace.fcl
216  detsimfcl=standard_detsim_dune10kt_workspace.fcl
217  recofcl=standard_reco_dune10kt_workspace.fcl
218  mergefcl=standard_ana_dune10kt_workspace.fcl
219  if echo $newprj | grep -q genie; then
220  recofcl=standard_reco_dune10kt_nu_workspace.fcl
221  fi
222  fi
223 
224  if echo $newprj | grep -q dune10kt_3mmpitch_workspace; then
225  g4fcl=standard_g4_dune10kt_3mmpitch_workspace.fcl
226  detsimfcl=standard_detsim_dune10kt_3mmpitch_workspace.fcl
227  recofcl=standard_reco_dune10kt_3mmpitch_workspace.fcl
228  mergefcl=standard_ana_dune10kt_3mmpitch_workspace.fcl
229  if echo $newprj | grep -q genie; then
230  recofcl=standard_reco_dune10kt_3mmpitch_nu_workspace.fcl
231  fi
232  fi
233 
234  if echo $newprj | grep -q dune10kt_45deg_workspace; then
235  g4fcl=standard_g4_dune10kt_45deg_workspace.fcl
236  detsimfcl=standard_detsim_dune10kt_45deg_workspace.fcl
237  recofcl=standard_reco_dune10kt_45deg_workspace.fcl
238  mergefcl=standard_ana_dune10kt_45deg_workspace.fcl
239  if echo $newprj | grep -q genie; then
240  recofcl=standard_reco_dune10kt_45deg_nu_workspace.fcl
241  fi
242  fi
243 
244  if echo $newprj | grep -q 'dune10kt_1x2x6\|dune10kt_r90deg_1x2x6'; then
245  g4fcl=standard_g4_dune10kt_1x2x6.fcl
246  detsimfcl=standard_detsim_dune10kt_1x2x6.fcl
247  recofcl=standard_reco_dune10kt_1x2x6.fcl
248  mergefcl=standard_ana_dune10kt_1x2x6.fcl
249  if echo $newprj | grep -q genie; then
250  recofcl=standard_reco_dune10kt_nu_1x2x6.fcl
251  fi
252  if echo $newprj | grep -q 'supernova\|marley'; then
253  g4fcl=supernova_g4_dune10kt_1x2x6.fcl
254  fi
255  fi
256 
257  if echo $newprj | grep -q dune10kt_3mmpitch_1x2x6; then
258  g4fcl=standard_g4_dune10kt_3mmpitch_1x2x6.fcl
259  detsimfcl=standard_detsim_dune10kt_3mmpitch_1x2x6.fcl
260  recofcl=standard_reco_dune10kt_3mmpitch_1x2x6.fcl
261  mergefcl=standard_ana_dune10kt_3mmpitch_1x2x6.fcl
262  if echo $newprj | grep -q genie; then
263  recofcl=standard_reco_dune10kt_3mmpitch_nu_1x2x6.fcl
264  fi
265  if echo $newprj | grep -q 'supernova\|marley'; then
266  g4fcl=supernova_g4_dune10kt_3mmpitch_1x2x6.fcl
267  fi
268  fi
269 
270  if echo $newprj | grep -q dune10kt_45deg_1x2x6; then
271  g4fcl=standard_g4_dune10kt_45deg_1x2x6.fcl
272  detsimfcl=standard_detsim_dune10kt_45deg_1x2x6.fcl
273  recofcl=standard_reco_dune10kt_45deg_1x2x6.fcl
274  mergefcl=standard_ana_dune10kt_45deg_1x2x6.fcl
275  if echo $newprj | grep -q genie; then
276  recofcl=standard_reco_dune10kt_45deg_nu_1x2x6.fcl
277  fi
278  if echo $newprj | grep -q 'supernova\|marley'; then
279  g4fcl=supernova_g4_dune10kt_45deg_1x2x6.fcl
280  fi
281  fi
282 
283  if echo $newprj | grep -q protoDune; then
284  g4fcl=protoDUNE_g4single.fcl
285  detsimfcl=protoDUNE_detsim_single.fcl
286  recofcl=protoDUNE_reco.fcl
287  mergefcl=protoDUNE_ana.fcl
288  fi
289 
290  if echo $newprj | grep -q dphase; then
291  g4fcl=standard_g4_dune10kt_dp.fcl
292  detsimfcl=standard_detsim_dune10kt_dp.fcl
293  recofcl=standard_reco_dune10ktdphase.fcl
294  mergefcl=standard_ana_dune10kt_dp.fcl
295  fi
296 
297 
298 
299  # Set number of events per job.
300  nevjob=$nevjobarg
301  if [ $nevjob -eq 0 ]; then
302  if [ $newprj = prodcosmics_dune35t_milliblock ]; then
303  nevjob=100
304  elif [ $newprj = prodcosmics_dune35t_onewindow ]; then
305  nevjob=100
306  elif [ $newprj = AntiMuonCutEvents_LSU_dune35t ]; then
307  nevjob=100
308  elif [ $newprj = prodcosmics_dune35t_milliblock_countermu ]; then
309  nevjob=10000
310  elif [ $newprj = prodcosmics_dune35t_milliblock_protonpi0 ]; then
311  nevjob=100
312  else
313  nevjob=100
314  fi
315  fi
316 
317  # Set number of events.
318 
319  nev=$nevarg
320  if [ $nev -eq 0 ]; then
321  if [ $newprj = prodcosmics_dune35t_milliblock ]; then
322  nev=10000
323  elif [ $newprj = prodcosmics_dune35t_onewindow ]; then
324  nev=10000
325  elif [ $newprj = AntiMuonCutEvents_LSU_dune35t ]; then
326  nev=10000
327  elif [ $newprj = prodcosmics_dune35t_milliblock_countermu ]; then
328  nev=10000000
329  elif [ $newprj = prodcosmics_dune35t_milliblock_protonpi0 ]; then
330  nev=100000
331  elif echo $newprj | grep -q dune10kt; then
332  if echo $newprj | grep -q genie; then
333  nev=100000
334  if echo $newprj | grep -q dphase; then
335  nev=10000
336  fi
337  else
338  nev=10000
339  fi
340  elif echo $newprj | grep -q protoDune; then
341  nev=30000
342  else
343  nev=10000
344  fi
345  fi
346 
347  # Calculate the number of worker jobs.
348 
349  njob=$(( $nev / $nevjob ))
350 # echo $newprj, $nev, $nevjob, $njob
351  cat <<EOF > $newxml
352 <?xml version="1.0"?>
353 
354 <!-- Production Project -->
355 
356 <!DOCTYPE project [
357 <!ENTITY release "$rel">
358 <!ENTITY file_type "mc">
359 <!ENTITY run_type "physics">
360 <!ENTITY name "$newprj">
361 <!ENTITY tag "mcc7.2">
362 ]>
363 
364 <project name="&name;">
365 
366  <!-- Group -->
367  <group>dune</group>
368 
369  <!-- Project size -->
370  <numevents>$nev</numevents>
371 
372  <!-- Operating System -->
373  <os>SL6</os>
374 
375  <!-- Batch resources -->
376  <resource>DEDICATED,OPPORTUNISTIC</resource>
377 
378  <!-- Larsoft information -->
379  <larsoft>
380  <tag>&release;</tag>
381  <qual>${qual}:prof</qual>
382 EOF
383  echo "local=$local"
384  if [ x$local != x ]; then
385  echo " <local>${local}</local>" >> $newxml
386  fi
387  cat <<EOF >> $newxml
388  </larsoft>
389 
390  <!-- dune35t metadata parameters -->
391 
392  <parameter name ="MCName">${newprj}</parameter>
393  <parameter name ="MCDetectorType">${detector}</parameter>
394  <parameter name ="MCGenerators">${generator}</parameter>
395 
396  <!-- Project stages -->
397 
398  <stage name="gen">
399  <fcl>$genfcl</fcl>
400 EOF
401  if echo $newprj | grep -q AntiMuonCutEvents_LSU_dune35t; then
402  echo " <inputmode>textfile</inputmode>" >> $newxml
403  echo " <inputlist>/dune/data2/users/jti3/txtfiles/AntiMuonCutEvents_LSU_100.txt</inputlist>" >> $newxml
404  fi
405  cat <<EOF >> $newxml
406  <outdir>/pnfs/dune/scratch/${userdir}/&release;/gen/&name;</outdir>
407  <workdir>/pnfs/dune/scratch/${userdir}/work/&release;/gen/&name;</workdir>
408  <output>${newprj}_\${PROCESS}_%tc_gen.root</output>
409  <numjobs>$njob</numjobs>
410  <datatier>generated</datatier>
411  <defname>&name;_&tag;_gen</defname>
412  </stage>
413 
414  <stage name="g4">
415  <fcl>$g4fcl</fcl>
416  <outdir>/pnfs/dune/scratch/${userdir}/&release;/g4/&name;</outdir>
417  <workdir>/pnfs/dune/scratch/${userdir}/work/&release;/g4/&name;</workdir>
418  <numjobs>$njob</numjobs>
419  <datatier>simulated</datatier>
420  <defname>&name;_&tag;_g4</defname>
421  </stage>
422 
423 EOF
424  if [ x$detsimfcl != x ]; then
425  cat <<EOF >> $newxml
426  <stage name="detsim">
427  <fcl>$detsimfcl</fcl>
428  <outdir>/pnfs/dune/scratch/${userdir}/&release;/detsim/&name;</outdir>
429  <workdir>/pnfs/dune/scratch/${userdir}/work/&release;/detsim/&name;</workdir>
430  <numjobs>$njob</numjobs>
431  <datatier>detector-simulated</datatier>
432  <defname>&name;_&tag;_detsim</defname>
433  </stage>
434 
435 EOF
436  fi
437  cat <<EOF >> $newxml
438  <stage name="reco">
439  <fcl>$recofcl</fcl>
440  <outdir>/pnfs/dune/scratch/${userdir}/&release;/reco/&name;</outdir>
441  <workdir>/pnfs/dune/scratch/${userdir}/work/&release;/reco/&name;</workdir>
442  <numjobs>$njob</numjobs>
443  <datatier>full-reconstructed</datatier>
444  <defname>&name;_&tag;_reco</defname>
445  </stage>
446 
447  <stage name="mergeana">
448  <fcl>$mergefcl</fcl>
449  <outdir>/pnfs/dune/scratch/${userdir}/&release;/mergeana/&name;</outdir>
450  <output>&name;_\${PROCESS}_%tc_merged.root</output>
451  <workdir>/pnfs/dune/scratch/${userdir}/work/&release;/mergeana/&name;</workdir>
452  <numjobs>$njob</numjobs>
453  <targetsize>8000000000</targetsize>
454  <datatier>full-reconstructed</datatier>
455  <defname>&name;_&tag;</defname>
456  </stage>
457 
458  <!-- file type -->
459  <filetype>&file_type;</filetype>
460 
461  <!-- run type -->
462  <runtype>&run_type;</runtype>
463 
464 </project>
465 EOF
466 
467  fi
468 
469 done