2 #----------------------------------------------------------------------
4 # Name: make_xml_mcc.sh
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.
14 # make_xml_mcc4.0.sh [-h|--help] [-r <release>] [-u|--user <user>] [--local <dir|tar>] [--nev <n>] [--nevjob <n>] [--nevgjob <n>]
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.
29 #----------------------------------------------------------------------
36 userdir=scratch/dunepro
47 while [ $# -gt 0 ]; do
53 echo "Usage: make_xml_mcc.sh [-h|--help] [-r <release>] [-t|--tag <tag>] [-u|--user <user>] [--local <dir|tar>] [--nev <n>] [--nevjob <n>]"
66 # Reconstruction 1 release.
75 # Reconstruction 1 release.
100 userdir=scratch/users/$2
106 # Local simulation release.
109 if [ $# -gt 1 ]; then
115 # Local reconstruction release.
118 if [ $# -gt 1 ]; then
125 if [ $# -gt 1 ]; then
134 if [ $# -gt 1 ]; then
142 # Total number of events.
145 if [ $# -gt 1 ]; then
151 # Number of events per job.
154 if [ $# -gt 1 ]; then
163 if [ $# -gt 1 ]; then
176 if [[ $rs < 'v06_32_00' ]]; then
181 if [[ $rr1 < 'v06_32_00' ]]; then
186 if [[ $rr2 < 'v06_32_00' ]]; then
190 echo $quals $qualr1 $qualr2
192 # Delete existing xml files.
196 find $DUNETPC_DIR/source/fcl/dune35t/gen $DUNETPC_DIR/source/fcl/dunefd/gen $DUNETPC_DIR/source/fcl/protodune/gen -name \*.fcl | while read fcl
198 if ! echo $fcl | grep -q 'common\|protoDUNE_gensingle'; then
199 newprj=`basename $fcl .fcl`
200 newxml=${newprj}_${tag}.xml
202 if [ $userbase != dunepro ]; then
203 samprj=${userbase}_$newprj
206 if echo $newprj | grep -q cosmics; then
209 if echo $newprj | grep -q AntiMuonCutEvents; then
210 generator=TextFileGen
212 if echo $newprj | grep -q genie; then
215 if echo $newprj | grep -q MUSUN; then
218 if echo $newprj | grep -q supernova; then
219 generator=SNNueAr40CCGen
221 if echo $newprj | grep -q prodndk; then
224 if echo $newprj | grep -q prodmarley; then
227 if echo $newprj | grep -q prodbackground_ar39; then
232 if echo $newprj | grep -q dune10kt; then
235 if echo $newprj | grep -q protoDune; then
241 echo "Making ${newxml}"
245 genfcl=`basename $fcl`
249 g4fcl=standard_g4_dune35t.fcl
251 # Detsim (optical + tpc).
253 detsimfcl=standard_detsim_dune35t.fcl
257 # reco2dfcl=standard_reco_uboone_2D.fcl
261 # reco3dfcl=standard_reco_uboone_3D.fcl
264 recofcl1=standard_reco_dune35tsim.fcl
269 mergefcl=standard_ana_dune35t.fcl
272 if echo $newprj | grep -q protonpi0; then
273 g4fcl=standard_g4_dune35t_protonpi0.fcl
276 if echo $newprj | grep -q countermu; then
277 g4fcl=standard_g4_dune35t_countermu.fcl
280 # if echo $newprj | grep -q 'pi0\|gamma'; then
281 # recofcl1=reco_dune35t_blur.fcl
282 # mergefcl=ana_energyCalib.fcl
285 # if echo $newprj | grep -q 'piminus'; then
286 # recofcl1=emhits.fcl
287 # mergefcl=standard_merge_dune35t.fcl
290 if echo $newprj | grep -q milliblock; then
291 detsimfcl=standard_detsim_dune35t_milliblock.fcl
292 recofcl1=standard_reco_dune35t_milliblock.fcl
293 mergefcl=standard_ana_dune35t_milliblock.fcl
296 if echo $newprj | grep -q dune10kt; then
297 g4fcl=standard_g4_dune10kt.fcl
298 detsimfcl=standard_detsim_dune10kt.fcl
299 recofcl1=standard_reco_dune10kt.fcl
300 mergefcl=standard_ana_dune10kt.fcl
303 if echo $newprj | grep -q 'dune10kt_1x2x6\|dune10kt_r90deg_1x2x6'; then
304 g4fcl=standard_g4_dune10kt_1x2x6.fcl
305 detsimfcl=standard_detsim_dune10kt_1x2x6.fcl
306 recofcl1=standard_reco_dune10kt_1x2x6.fcl
307 mergefcl=standard_ana_dune10kt_1x2x6.fcl
308 if echo $newprj | grep -q 'genie_nu\|genie_anu'; then
309 recofcl1=standard_reco_dune10kt_nu_1x2x6.fcl
310 if [ $splitreco -eq 1 ]; then
311 recofcl1=standard_reco1_dune10kt_nu_1x2x6.fcl
312 recofcl2=standard_reco2_dune10kt_nu_1x2x6.fcl
315 if echo $newprj | grep -q 'supernova\|marley'; then
316 g4fcl=supernova_g4_dune10kt_1x2x6.fcl
318 if echo $newprj | grep -q '_nu'; then
319 caffcl=select_ana_dune10kt_nu.fcl
321 if echo $newprj | grep -q '_anu'; then
322 caffcl=select_ana_dune10kt_anu.fcl
326 if echo $newprj | grep -q dune10kt_3mmpitch_1x2x6; then
327 g4fcl=standard_g4_dune10kt_3mmpitch_1x2x6.fcl
328 detsimfcl=standard_detsim_dune10kt_3mmpitch_1x2x6.fcl
329 recofcl1=standard_reco_dune10kt_3mmpitch_1x2x6.fcl
330 mergefcl=standard_ana_dune10kt_3mmpitch_1x2x6.fcl
331 if echo $newprj | grep -q 'genie_nu\|genie_anu'; then
332 recofcl1=standard_reco_dune10kt_3mmpitch_nu_1x2x6.fcl
333 if [ $splitreco -eq 1 ]; then
334 recofcl1=standard_reco1_dune10kt_3mmpitch_nu_1x2x6.fcl
335 recofcl2=standard_reco2_dune10kt_3mmpitch_nu_1x2x6.fcl
338 if echo $newprj | grep -q 'supernova\|marley'; then
339 g4fcl=supernova_g4_dune10kt_3mmpitch_1x2x6.fcl
343 if echo $newprj | grep -q dune10kt_45deg_1x2x6; then
344 g4fcl=standard_g4_dune10kt_45deg_1x2x6.fcl
345 detsimfcl=standard_detsim_dune10kt_45deg_1x2x6.fcl
346 recofcl1=standard_reco_dune10kt_45deg_1x2x6.fcl
347 mergefcl=standard_ana_dune10kt_45deg_1x2x6.fcl
348 if echo $newprj | grep -q 'genie_nu\|genie_anu'; then
349 recofcl1=standard_reco_dune10kt_45deg_nu_1x2x6.fcl
350 if [ $splitreco -eq 1 ]; then
351 recofcl1=standard_reco1_dune10kt_45deg_nu_1x2x6.fcl
352 recofcl2=standard_reco2_dune10kt_45deg_nu_1x2x6.fcl
355 if echo $newprj | grep -q 'supernova\|marley'; then
356 g4fcl=supernova_g4_dune10kt_45deg_1x2x6.fcl
360 if echo $newprj | grep -q protoDune; then
361 g4fcl=protoDUNE_g4single.fcl
362 detsimfcl=protoDUNE_detsim_single.fcl
363 recofcl1=protoDUNE_reco.fcl
364 mergefcl=protoDUNE_ana.fcl
367 if echo $newprj | grep -q dphase; then
368 g4fcl=standard_g4_dune10kt_dp.fcl
369 detsimfcl=standard_detsim_dune10kt_dp.fcl
370 recofcl1=standard_reco_dune10ktdphase.fcl
371 mergefcl=standard_ana_dune10kt_dp.fcl
376 # Set number of events per job.
378 if [ $nevjob -eq 0 ]; then
379 if [ $newprj = prodcosmics_dune35t_milliblock ]; then
381 elif [ $newprj = prodcosmics_dune35t_onewindow ]; then
383 elif [ $newprj = AntiMuonCutEvents_LSU_dune35t ]; then
385 elif [ $newprj = prodcosmics_dune35t_milliblock_countermu ]; then
387 elif [ $newprj = prodcosmics_dune35t_milliblock_protonpi0 ]; then
394 # Set number of events.
397 if [ $nev -eq 0 ]; then
398 if [ $newprj = prodcosmics_dune35t_milliblock ]; then
400 elif [ $newprj = prodcosmics_dune35t_onewindow ]; then
402 elif [ $newprj = AntiMuonCutEvents_LSU_dune35t ]; then
404 elif [ $newprj = prodcosmics_dune35t_milliblock_countermu ]; then
406 elif [ $newprj = prodcosmics_dune35t_milliblock_protonpi0 ]; then
408 elif echo $newprj | grep -q dune10kt; then
409 if echo $newprj | grep -q 'genie_nu\|genie_anu'; then
411 if echo $newprj | grep -q dphase; then
417 elif echo $newprj | grep -q protoDune; then
424 # Calculate the number of worker jobs.
426 njob=$(( $nev / $nevjob ))
427 # echo $newprj, $nev, $nevjob, $njob
429 <?xml version="1.0"?>
431 <!-- Production Project -->
434 <!ENTITY relsim "$rs">
435 <!ENTITY relreco1 "$rr1">
436 <!ENTITY relreco2 "$rr2">
437 <!ENTITY file_type "mc">
438 <!ENTITY run_type "physics">
439 <!ENTITY name "$samprj">
445 <project name="&name;">
450 <!-- Project size -->
451 <numevents>$nev</numevents>
453 <!-- Operating System -->
456 <!-- Batch resources -->
457 <resource>DEDICATED,OPPORTUNISTIC</resource>
459 <!-- metadata parameters -->
461 <parameter name ="MCName">${samprj}</parameter>
462 <parameter name ="MCDetectorType">${detector}</parameter>
463 <parameter name ="MCGenerators">${generator}</parameter>
465 <!-- Larsoft information -->
468 <qual>${quals}:prof</qual>
470 if [ x$ls != x ]; then
472 echo " <local>${ls}</local>" >> $newxml
477 <!-- Project stages -->
479 <stage name="detsim">
482 <fcl>$detsimfcl</fcl>
484 if echo $newprj | grep -q AntiMuonCutEvents_LSU_dune35t; then
485 echo " <inputmode>textfile</inputmode>" >> $newxml
486 echo " <inputlist>/pnfs/dune/persistent/dunepro/AntiMuonCutEvents_LSU_100.txt</inputlist>" >> $newxml
489 <outdir>/pnfs/dune/${userdir}/&relsim;/detsim/&name;</outdir>
490 <workdir>/pnfs/dune/${userdir}/work/&relsim;/detsim/&name;</workdir>
491 <output>${newprj}_\${PROCESS}_%tc_detsim.root</output>
492 <numjobs>$njob</numjobs>
493 <datatier>detector-simulated</datatier>
494 <defname>&name;_&tag;_detsim</defname>
498 <filetype>&file_type;</filetype>
501 <runtype>&run_type;</runtype>
505 if [ x$recofcl2 == x ]; then
508 <project name="&name;_reco">
510 <!-- Project size -->
511 <numevents>$nev</numevents>
513 <!-- Operating System -->
516 <!-- Batch resources -->
517 <resource>DEDICATED,OPPORTUNISTIC</resource>
519 <!-- metadata parameters -->
521 <parameter name ="MCName">${samprj}</parameter>
522 <parameter name ="MCDetectorType">${detector}</parameter>
523 <parameter name ="MCGenerators">${generator}</parameter>
525 <!-- Larsoft information -->
527 <tag>&relreco1;</tag>
528 <qual>${qualr1}:prof</qual>
530 if [ x$lr1 != x ]; then
532 echo " <local>${lr1}</local>" >> $newxml
537 <!-- Project stages -->
539 <jobsub>--expected-lifetime=24h</jobsub>
541 <outdir>/pnfs/dune/${userdir}/&relreco1;/reco/&name;</outdir>
542 <workdir>/pnfs/dune/${userdir}/work/&relreco1;/reco/&name;</workdir>
543 <numjobs>$njob</numjobs>
544 <datatier>full-reconstructed</datatier>
545 <defname>&name;_&tag;_reco</defname>
548 <stage name="mergeana">
550 if [ x$caffcl != x ]; then
551 echo " <jobsub>--memory=4000 --expected-lifetime=24h</jobsub>" >> $newxml
552 echo " <fcl>$caffcl</fcl>" >> $newxml
556 <outdir>/pnfs/dune/${userdir}/&relreco1;/mergeana/&name;</outdir>
557 <output>&name;_\${PROCESS}_%tc_merged.root</output>
558 <workdir>/pnfs/dune/${userdir}/work/&relreco1;/mergeana/&name;</workdir>
559 <numjobs>$njob</numjobs>
560 <targetsize>8000000000</targetsize>
561 <datatier>full-reconstructed</datatier>
562 <defname>&name;_&tag;</defname>
568 <project name="&name;_reco1">
570 <!-- Project size -->
571 <numevents>$nev</numevents>
573 <!-- Operating System -->
576 <!-- Batch resources -->
577 <resource>DEDICATED,OPPORTUNISTIC</resource>
579 <!-- metadata parameters -->
581 <parameter name ="MCName">${samprj}</parameter>
582 <parameter name ="MCDetectorType">${detector}</parameter>
583 <parameter name ="MCGenerators">${generator}</parameter>
585 <!-- Larsoft information -->
587 <tag>&relreco1;</tag>
588 <qual>${qualr1}:prof</qual>
590 if [ x$lr1 != x ]; then
592 echo " <local>${lr1}</local>" >> $newxml
597 <!-- Project stages -->
600 <outdir>/pnfs/dune/${userdir}/&relreco1;/reco1/&name;</outdir>
601 <workdir>/pnfs/dune/${userdir}/work/&relreco1;/reco1/&name;</workdir>
602 <numjobs>$njob</numjobs>
603 <datatier>hit-reconstructed</datatier>
604 <defname>&name;_&tag;_reco1</defname>
608 <filetype>&file_type;</filetype>
611 <runtype>&run_type;</runtype>
615 <project name="&name;_reco2">
617 <!-- Project size -->
618 <numevents>$nev</numevents>
620 <!-- Operating System -->
623 <!-- Batch resources -->
624 <resource>DEDICATED,OPPORTUNISTIC</resource>
626 <!-- metadata parameters -->
628 <parameter name ="MCName">${samprj}</parameter>
629 <parameter name ="MCDetectorType">${detector}</parameter>
630 <parameter name ="MCGenerators">${generator}</parameter>
632 <!-- Larsoft information -->
634 <tag>&relreco2;</tag>
635 <qual>${qualr2}:prof</qual>
637 if [ x$lr2 != x ]; then
639 echo " <local>${lr2}</local>" >> $newxml
644 <!-- Project stages -->
646 <jobsub>--expected-lifetime=24h</jobsub>
648 <outdir>/pnfs/dune/${userdir}/&relreco2;/reco2/&name;</outdir>
649 <workdir>/pnfs/dune/${userdir}/work/&relreco2;/reco2/&name;</workdir>
650 <numjobs>$njob</numjobs>
651 <datatier>full-reconstructed</datatier>
652 <defname>&name;_&tag;_reco2</defname>
655 <stage name="mergeana">
657 if [ x$caffcl != x ]; then
658 echo " <jobsub>--memory=4000 --expected-lifetime=24h</jobsub>" >> $newxml
659 echo " <fcl>$caffcl</fcl>" >> $newxml
663 <outdir>/pnfs/dune/${userdir}/&relreco2;/mergeana/&name;</outdir>
664 <output>&name;_\${PROCESS}_%tc_merged.root</output>
665 <workdir>/pnfs/dune/${userdir}/work/&relreco2;/mergeana/&name;</workdir>
666 <numjobs>$njob</numjobs>
667 <targetsize>8000000000</targetsize>
668 <datatier>full-reconstructed</datatier>
669 <defname>&name;_&tag;</defname>
677 <filetype>&file_type;</filetype>
680 <runtype>&run_type;</runtype>