2 #----------------------------------------------------------------------
4 # Name: make_xml_protodune_mcc8.0.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.
11 # This is for Dorota's samples, so there's a lot of special one-off logic in here.
15 # make_xml_protodune_mcc8.0.sh [-h|--help] [-r <release>] [-u|--user <user>] [--local <dir|tar>] [--nev <n>] [--nevjob <n>] [--nevgjob <n>]
19 # -h|--help - Print help.
20 # -r <release> - Use the specified larsoft/dunetpc release.
21 # -u|--user <user> - Use users/<user> as working and output directories
22 # (default is to use lbnepro).
23 # --local <dir|tar> - Specify larsoft local directory or tarball (xml
24 # tag <local>...</local>).
26 # --nevjob <n> - ignored
27 # --nevgjob <n> - Specify the maximum number of events per gen/g4 job.
29 #----------------------------------------------------------------------
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.
96 # Local simulation release.
105 # Local reconstruction release.
108 if [ $# -gt 1 ]; then
115 if [ $# -gt 1 ]; then
124 if [ $# -gt 1 ]; then
132 # Total number of events.
135 if [ $# -gt 1 ]; then
141 # Number of events per job.
144 if [ $# -gt 1 ]; then
153 if [ $# -gt 1 ]; then
166 ver=`echo $rs | cut -c2-3`
168 if [ $ver -gt 2 ]; then
172 # Delete existing xml files.
176 for topname in beamcosmics singlep
178 find $DUNETPC_DIR/source/fcl/protodune/mcc/mcc8/$topname -name "gen*.fcl" | while read fcl
180 if [ $topname == beamcosmics ]; then
181 if echo $fcl | grep -q -v beam_2GeV; then
186 find $DUNETPC_DIR/source/fcl/protodune/mcc/mcc8/$topname -name "*g4*.fcl" | while read g4fcl_v
189 if echo $g4fcl_v | grep -q 6ms; then
193 # find $DUNETPC_DIR/source/fcl/protodune/mcc/mcc8/$topname -name "*detsim*.fcl" ; find $DUNETPC_DIR/source/fcl/protodune/detsim/protoDUNE_detsim.fcl | while read detsimfcl_v
194 for detsimfcl_v in $(find $DUNETPC_DIR/source/fcl/protodune/mcc/mcc8/$topname -name "*detsim*.fcl" ; find $DUNETPC_DIR/source/fcl/protodune/detsim/protoDUNE_detsim.fcl);
197 if [ $topname == singlep ]; then
198 if echo $detsimfcl_v | grep -q noise; then
202 if echo $detsimfcl_v | grep -q -v noise; then
207 # echo " Looping " $fcl $g4fcl_v $detsimfcl_v $recofcl1_v $mergefcl_v
209 genbasename=`basename $fcl .fcl`
210 g4basename=`basename $g4fcl_v .fcl`
211 detsimbasename=`basename $detsimfcl_v .fcl`
213 detsimtrimname=`echo $detsimbasename | sed -e "s/3ms_//g"`
215 newprj_1=${genbasename}${g4basename}${detsimtrimname}
217 # trim the project name down so it doesn't have extraneous or duplicate information
219 newprj=ProtoDUNE`echo $newprj_1 | sed -e "s/gen_//" | sed -e "s/protoDune//g" | sed -e "s/protoDUNE//g" | sed -e "s/_detsim//g" | sed -e "s/_g4//g" | sed -e "s/_bc//g"`
222 if [ $userbase != dunepro ]; then
223 samprj=${userbase}_$newprj
226 if echo $newprj | grep -q cosmics; then
229 if echo $newprj | grep -q AntiMuonCutEvents; then
230 generator=TextFileGen
232 if echo $newprj | grep -q genie; then
235 if echo $newprj | grep -q MUSUN; then
238 if echo $newprj | grep -q supernova; then
239 generator=SNNueAr40CCGen
241 if echo $newprj | grep -q prodndk; then
244 if echo $newprj | grep -q prodmarley; then
247 if echo $newprj | grep -q prodbackground_ar39; then
256 genfcl=`basename $fcl`
257 if [ $topname == beamcosmics ]; then
258 genfcl=/dune/app/users/tjyang/xml/gen_protoDune_beam_2GeVc_cosmics.fcl
263 g4fcl=`basename $g4fcl_v`
265 # Detsim (optical + tpc).
267 detsimfcl=`basename $detsimfcl_v`
272 if echo $topname | grep -q singlep; then
273 recofcl1=reco_protoDune_3ms.fcl
276 # Set number of events.
279 # Set number of events per job.
282 # default memory limit
286 # special logic for Dorota
288 if [ $topname == beamcosmics ]; then
291 if echo $g4fcl_v | grep -q sce; then
292 if echo $detsimfcl_v | grep -q low; then
293 recofcl1=protoDUNE_reco.fcl
296 elif echo $detsimfcl_v | grep -q med; then
299 elif echo $detsimfcl_v | grep -q high; then
302 echo Ununderstood detsim: $detsimfcl_v
305 if echo $detsimfcl_v | grep -q low; then
306 if echo $g4fcl_v | grep -q 1ms; then
309 elif echo $g4fcl_v | grep -q 3ms; then
310 recofcl1=protoDUNE_reco.fcl
314 echo Unexpected g4 option: $g4fcl_v with low noise no SCE beam cosmics
318 elif echo $detsimfcl_v | grep -q med; then
319 if echo $g4fcl_v | grep -q 1ms; then
322 elif echo $g4fcl_v | grep -q 3ms; then
326 echo Unexpected g4 option: $g4fcl_v with med noise no SCE beam cosmics
330 elif echo $detsimfcl_v | grep -q high; then
331 if echo $g4fcl_v | grep -q 1ms; then
334 elif echo $g4fcl_v | grep -q 3ms; then
338 echo Unexpected g4 option: $g4fcl_v with med noise no SCE beam cosmics
342 echo Unexpected $detsimfcl_v noise option
350 mergefcl=protoDUNE_ana.fcl
353 # Calculate the number of worker jobs.
355 njob=$(( $nev / $nevjob ))
359 echo "Making ${newprj}.xml"
360 # echo " " $fcl $g4fcl $detsimfcl $recofcl1 $mergefcl
362 # echo $newprj, $nev, $nevjob, $njob
365 <?xml version="1.0"?>
367 <!-- Production Project -->
370 <!ENTITY relsim "$rs">
371 <!ENTITY relreco "$rr1">
372 <!ENTITY file_type "mc">
373 <!ENTITY run_type "physics">
374 <!ENTITY name "$samprj">
380 <project name="&name;">
385 <!-- Project size -->
386 <numevents>$nev</numevents>
388 <!-- Operating System -->
391 <!-- Batch resources -->
392 <resource>DEDICATED,OPPORTUNISTIC</resource>
394 <!-- metadata parameters -->
396 <parameter name ="MCName">${samprj}</parameter>
397 <parameter name ="MCDetectorType">${detector}</parameter>
398 <parameter name ="MCGenerators">${generator}</parameter>
400 <!-- Larsoft information -->
403 <qual>${qual}:prof</qual>
405 if [ x$ls != x ]; then
407 echo " <local>${ls}</local>" >> $newxml
412 <stage name="detsim">
415 <fcl>$detsimfcl</fcl>
416 <outdir>/pnfs/dune/persistent/${userdir}/&relsim;/detsim/&name;</outdir>
417 <workdir>/pnfs/dune/scratch/${userdir}/work/&relsim;/detsim/&name;</workdir>
418 <output>${newprj}_\${PROCESS}_%tc_detsim.root</output>
419 <numjobs>$njob</numjobs>
420 <jobsub>--memory=$memlimit</jobsub>
421 <datatier>detector-simulated</datatier>
422 <defname>&name;_&tag;_detsim</defname>
426 if [ x$recofcl1 != x ]; then
431 <outdir>/pnfs/dune/scratch/${userdir}/&relreco;/reco/&name;</outdir>
432 <workdir>/pnfs/dune/scratch/${userdir}/work/&relreco;/reco/&name;</workdir>
433 <numjobs>$njob</numjobs>
434 <datatier>full-reconstructed</datatier>
435 <defname>&name;_&tag;_reco</defname>
436 <jobsub>--memory=$memlimit --expected-lifetime=$recolifetime</jobsub>
439 <stage name="mergeana">
441 <outdir>/pnfs/dune/scratch/${userdir}/&relreco;/mergeana/&name;</outdir>
442 <output>&name;_\${PROCESS}_%tc_merged.root</output>
443 <workdir>/pnfs/dune/scratch/${userdir}/work/&relreco;/mergeana/&name;</workdir>
444 <numjobs>$njob</numjobs>
445 <jobsub>--memory=$memlimit</jobsub>
446 <targetsize>8000000000</targetsize>
447 <datatier>full-reconstructed</datatier>
448 <defname>&name;_&tag;</defname>
449 <jobsub>--expected-lifetime=$recolifetime</jobsub>
455 <filetype>&file_type;</filetype>
456 <runtype>&run_type;</runtype>