9 echo "MCTest_mixer_gen.fcl"
18 echo "MCTest_mixer_g4_$1.fcl"
21 echo "mixer_g4_$1.xml"
26 function detsimfhicl {
27 echo "MCTest_mixer_detsim.fcl"
30 echo "mixer_detsim_$1.xml"
35 function overlayfhicl {
36 echo "MCTest_mixer_dataoverlay_mcscale$1.fcl"
38 function wrapoverlayfhicl {
39 echo "run_MCTest_mixer_dataoverlay_mcscale$1.fcl"
42 echo "mixer_dataoverlay_$1_mcscale$2.xml"
44 function overlayname {
45 echo "mixer_$1_mcscale$2"
47 function robustfhicl {
48 echo "MCTest_mixer_robust.fcl"
51 echo "mixer_robust_$1_mcscale$2.xml"
54 echo "mixer_$1_mcscale$2"
57 echo "MCTest_mixer_ana_mcscale$1.fcl"
60 echo "mixer_ana_$1_mcscale$2.xml"
63 echo "mixer_$1_mcscale$2"
65 function write_header {
69 <!ENTITY release "${LARVERSION}">
70 <!ENTITY file_type "mc">
71 <!ENTITY run_type "physics">
73 <!ENTITY tag "mthiesse">
75 <project name="&name;">
77 <numevents>100000000</numevents>
79 <resource>DEDICATED,OPPORTUNISTIC</resource>
83 <local>/dune/app/users/mthiesse/larDev/${LARVERSION}.tar</local>
85 <parameter name ="MCName">mixer</parameter>
86 <parameter name ="MCDetectorType">35t</parameter>
87 <parameter name ="MCGenerators">CRY_single</parameter>
90 function write_footer {
92 <filetype>&file_type;</filetype>
93 <runtype>&run_type;</runtype>
98 declare -a gensubmitcommands
99 declare -a gencheckcommands
100 declare -a gencleancommands
101 declare -a genmakeupcommands
102 declare -a g4submitcommands
103 declare -a g4checkcommands
104 declare -a g4cleancommands
105 declare -a g4makeupcommands
106 declare -a detsimsubmitcommands
107 declare -a detsimcheckcommands
108 declare -a detsimcleancommands
109 declare -a detsimmakeupcommands
110 declare -a overlaysubmitcommands
111 declare -a overlaycheckcommands
112 declare -a overlaycleancommands
113 declare -a overlaymakeupcommands
114 declare -a robustsubmitcommands
115 declare -a robustcheckcommands
116 declare -a robustcheckanacommands
117 declare -a robustcleancommands
118 declare -a robustmakeupcommands
119 declare -a robusthaddcommands
120 declare -a anasubmitcommands
121 declare -a anacheckcommands
122 declare -a anacleancommands
123 declare -a anamakeupcommands
124 declare -a anahaddcommands
126 write_header $(genxml) $(genname)
127 cat <<EOF >> $(genxml)
129 <fcl>$(genfhicl)</fcl>
130 <outdir>/pnfs/dune/scratch/users/mthiesse/MC/&release;/gen/&name;</outdir>
131 <workdir>/pnfs/dune/scratch/users/mthiesse/MC/work/&release;/gen/&name;</workdir>
132 <output>MCTest_mixer_\${PROCESS}_%tc_gen.root</output>
133 <numjobs>1000</numjobs>
134 <datatier>generated</datatier>
135 <defname>&name;_&tag;_gen</defname>
138 write_footer $(genxml)
140 gensubmitcommands=(${gensubmitcommands[@]}
141 "echo 'Submitting $(genxml):';project.py --xml $(genxml) --stage gen --submit")
142 gencheckcommands=(${gencheckcommands[@]}
143 "echo 'Checking $(genxml):' > $(genname).out;project.py --xml $(genxml) --stage gen --check >> $(genname).out 2>&1 &")
144 gencleancommands=(${gencleancommands[@]}
145 "echo 'Cleaning $(genxml):';project.py --xml $(genxml) --stage gen --clean")
146 genmakeupcommands=(${genmakeupcommands[@]}
147 "echo 'Makeup $(genxml):';project.py --xml $(genxml) --stage gen --makeup")
149 for item in "1ms" "2ms" "3ms" "5ms" "8ms";
154 write_header $(g4xml $elife) $(g4name $elife)
155 cat <<EOF >> $(g4xml $elife)
157 <fcl>$(pwd)/$(g4fhicl $elife)</fcl>
158 <inputlist>/pnfs/dune/scratch/users/mthiesse/MC/&release;/gen/$(genname)/files.list</inputlist>
159 <outdir>/pnfs/dune/scratch/users/mthiesse/MC/&release;/g4/&name;</outdir>
160 <workdir>/pnfs/dune/scratch/users/mthiesse/MC/work/&release;/g4/&name;</workdir>
161 <output>MCTest_mixer_\${PROCESS}_%tc_g4.root</output>
162 <numjobs>1000</numjobs>
163 <datatier>simulated</datatier>
164 <defname>&name;_&tag;_g4</defname>
167 write_footer $(g4xml $elife)
169 echo '#include "MCTest_mixer_g4.fcl"' > $(g4fhicl $elife)
170 echo 'services.DetectorPropertiesService.Electronlifetime: '${elife:0:1}000 >> $(g4fhicl $elife)
172 g4submitcommands=(${g4submitcommands[@]}
173 "echo 'Submitting $(g4xml $elife):';project.py --xml $(g4xml $elife) --stage g4 --submit")
174 g4checkcommands=(${g4checkcommands[@]}
175 "echo 'Checking $(g4xml $elife):' > $(g4name $elife).out;project.py --xml $(g4xml $elife) --stage g4 --check >> $(g4name $elife).out 2>&1 &")
176 g4cleancommands=(${g4cleancommands[@]}
177 "echo 'Cleaning $(g4xml $elife):';project.py --xml $(g4xml $elife) --stage g4 --clean")
178 g4makeupcommands=(${g4makeupcommands[@]}
179 "echo 'Makeup $(g4xml $elife):';project.py --xml $(g4xml $elife) --stage g4 --makeup")
181 write_header $(detsimxml $elife) $(detsimname $elife)
182 cat <<EOF >> $(detsimxml $elife)
183 <stage name="detsim">
184 <fcl>$(detsimfhicl)</fcl>
185 <inputlist>/pnfs/dune/scratch/users/mthiesse/MC/&release;/g4/$(g4name $elife)/files.list</inputlist>
186 <outdir>/pnfs/dune/scratch/users/mthiesse/MC/&release;/detsim/&name;</outdir>
187 <workdir>/pnfs/dune/scratch/users/mthiesse/MC/work/&release;/detsim/&name;</workdir>
188 <output>MCTest_mixer_\${PROCESS}_%tc_detsim.root</output>
189 <numjobs>1000</numjobs>
190 <datatier>detector-simulated</datatier>
191 <defname>&name;_&tag;_detsim</defname>
194 write_footer $(detsimxml $elife)
196 detsimsubmitcommands=(${detsimsubmitcommands[@]}
197 "echo 'Submitting $(detsimxml $elife):';project.py --xml $(detsimxml $elife) --stage detsim --submit | grep -v Adding")
198 detsimcheckcommands=(${detsimcheckcommands[@]}
199 "echo 'Checking $(detsimxml $elife):' > $(detsimname $elife).out;project.py --xml $(detsimxml $elife) --stage detsim --check >> $(detsimname $elife).out 2>&1 &")
200 detsimcleancommands=(${detsimcleancommands[@]}
201 "echo 'Cleaning $(detsimxml $elife):';project.py --xml $(detsimxml $elife) --stage detsim --clean")
202 detsimmakeupcommands=(${detsimmakeupcommands[@]}
203 "echo 'Makeup $(detsimxml $elife):';project.py --xml $(detsimxml $elife) --stage detsim --makeup")
205 ##for otheritem in "0.5" "1.0" "1.5" "2.0";
206 for otheritem in "0.5" "1.0" "1.5" "2.0" "2.5" "3.0" "3.5" "4.0" "4.5" "5.0" "5.5" "6.0" "7.0" "8.0" "9.0" "10.0";
211 write_header $(overlayxml $elife $scale) $(overlayname $elife $scale)
212 cat <<EOF >> $(overlayxml $elife $scale)
213 <stage name="dataoverlay">
214 <fcl>$(pwd)/$(overlayfhicl $scale)</fcl>
215 <inputlist>/pnfs/dune/scratch/users/mthiesse/MC/&release;/detsim/$(detsimname $elife)/files.list</inputlist>
216 <outdir>/pnfs/dune/scratch/users/mthiesse/MC/&release;/dataoverlay/&name;</outdir>
217 <workdir>/pnfs/dune/scratch/users/mthiesse/MC/work/&release;/detsim/&name;</workdir>
218 <output>MCTest_mixer_\${PROCESS}_%tc_dataoverlay.root</output>
219 <numjobs>1000</numjobs>
220 <datatier>detector-simulated</datatier>
221 <defname>&name;_&tag;_dataoverlay</defname>
224 write_footer $(overlayxml $elife $scale)
226 echo '#include "MCTest_mixer_dataoverlay.fcl"' > $(overlayfhicl $scale)
227 echo 'physics.filters.mixer.detail.DefaultMCRawDigitScale: '$scale >> $(overlayfhicl $scale)
229 overlaysubmitcommands=(${overlaysubmitcommands[@]}
230 "echo 'Submitting $(overlayxml $elife $scale):';
231 DATETIME=\$(date +'%Y-%m-%d_%H-%M-%S');
232 DEFNAME='goodruns_35ton_sliced_mthiesse';
233 PROJECTNAME=mthiesse_\${DEFNAME}_${elife}_mcscale${scale}_\${DATETIME};
234 samweb -e dune -v start-project --defname=\$DEFNAME \$PROJECTNAME;
235 echo 'physics.filters.mixer.detail.SamProject: \"'\$PROJECTNAME'\"' >> $(overlayfhicl $scale);
236 project.py --xml $(overlayxml $elife $scale) --stage dataoverlay --submit")
237 overlaycheckcommands=(${overlaycheckcommands[@]}
238 "echo 'Checking $(overlayxml $elife $scale):' > $(overlayname $elife $scale).out;project.py --xml $(overlayxml $elife $scale) --stage dataoverlay --check >> $(overlayname $elife $scale).out 2>&1 &")
239 overlaycleancommands=(${overlaycleancommands[@]}
240 "echo 'Cleaning $(overlayxml $elife $scale):';project.py --xml $(overlayxml $elife $scale) --stage dataoverlay --clean")
241 overlaymakeupcommands=(${overlaymakeupcommands[@]}
242 "echo 'Makeup $(overlayxml $elife $scale):';project.py --xml $(overlayxml $elife $scale) --stage dataoverlay --makeup")
244 write_header $(robustxml $elife $scale) $(robustname $elife $scale)
245 cat <<EOF >> $(robustxml $elife $scale)
246 <stage name="robust">
247 <fcl>$(robustfhicl)</fcl>
248 <inputlist>/pnfs/dune/scratch/users/mthiesse/MC/&release;/dataoverlay/$(overlayname $elife $scale)/files.list</inputlist>
249 <outdir>/pnfs/dune/scratch/users/mthiesse/MC/&release;/robust/&name;</outdir>
250 <workdir>/pnfs/dune/scratch/users/mthiesse/MC/work/&release;/robust/&name;</workdir>
251 <output>MCTest_mixer_\${PROCESS}_%tc_robust.root</output>
252 <numjobs>1000</numjobs>
253 <datatier>full-reconstructed</datatier>
254 <defname>&name;_&tag;_robust</defname>
257 write_footer $(robustxml $elife $scale)
259 robustsubmitcommands=(${robustsubmitcommands[@]}
260 "echo 'Submitting $(robustxml $elife $scale):';project.py --xml $(robustxml $elife $scale) --stage robust --submit")
261 robustcheckcommands=(${robustcheckcommands[@]}
262 "echo 'Checking $(robustxml $elife $scale):' > $(robustname $elife $scale).out;project.py --xml $(robustxml $elife $scale) --stage robust --check >> $(robustname $elife $scale).out 2>&1 &")
263 robustcheckanacommands=(${robustcheckanacommands[@]}
264 "echo 'Checking $(robustxml $elife $scale) histogram files:' > $(robustname $elife $scale)_hist.out;project.py --xml $(robustxml $elife $scale) --stage robust --checkana >> $(robustname $elife $scale)_hist.out 2>&1 &")
265 robustcleancommands=(${robustcleancommands[@]}
266 "echo 'Cleaning $(robustxml $elife $scale):';project.py --xml $(robustxml $elife $scale) --stage robust --clean")
267 robustmakeupcommands=(${robustmakeupcommands[@]}
268 "echo 'Makeup $(robustxml $elife $scale):';project.py --xml $(robustxml $elife $scale) --stage robust --makeup")
269 robusthaddcommands=(${robusthaddcommands[@]}
270 "hadd -f -k /dune/data/users/mthiesse/robust_$(robustname $elife $scale)_hist.root @/pnfs/dune/scratch/users/mthiesse/MC/${LARVERSION}/robust/$(robustname $elife $scale)/filesana.list")
272 write_header $(anaxml $elife $scale) $(ananame $elife $scale)
273 cat <<EOF >> $(anaxml $elife $scale)
275 <fcl>$(pwd)/$(anafhicl $scale)</fcl>
276 <inputlist>/pnfs/dune/scratch/users/mthiesse/MC/&release;/robust/$(robustname $elife $scale)/files.list</inputlist>
277 <outdir>/pnfs/dune/scratch/users/mthiesse/MC/&release;/ana/&name;</outdir>
278 <workdir>/pnfs/dune/scratch/users/mthiesse/MC/work/&release;/ana/&name;</workdir>
279 <TFileName>MCTest_mixer_\${PROCESS}_%tc_ana_hist.root</TFileName>
280 <numjobs>1000</numjobs>
281 <datatier>full-reconstructed</datatier>
282 <defname>&name;_&tag;_ana</defname>
285 write_footer $(anaxml $elife $scale)
287 echo '#include "MCTest_mixer_ana.fcl"' > $(anafhicl $scale)
288 echo 'physics.analyzers.robustmcana.PreviousMCScale: '$scale >> $(anafhicl $scale)
290 anasubmitcommands=(${anasubmitcommands[@]}
291 "echo 'Submitting $(anaxml $elife $scale):';project.py --xml $(anaxml $elife $scale) --stage ana --submit")
292 anacheckcommands=(${anacheckcommands[@]}
293 "echo 'Checking $(anaxml $elife $scale):' > $(ananame $elife $scale).out;project.py --xml $(anaxml $elife $scale) --stage ana --checkana >> $(ananame $elife $scale).out 2>&1 &")
294 anacleancommands=(${anacleancommands[@]}
295 "echo 'Cleaning $(anaxml $elife $scale):';project.py --xml $(anaxml $elife $scale) --stage ana --clean")
296 anamakeupcommands=(${anamakeupcommands[@]}
297 "echo 'Makeup $(anaxml $elife $scale):';project.py --xml $(anaxml $elife $scale) --stage ana --makeup")
298 anahaddcommands=(${anahaddcommands[@]}
299 "hadd -f -k /dune/data/users/mthiesse/ana_$(ananame $elife $scale)_hist.root @/pnfs/dune/scratch/users/mthiesse/MC/${LARVERSION}/ana/$(ananame $elife $scale)/filesana.list")
304 echo "#!/bin/bash" > $DOITSCRIPT
305 echo "kx509;voms-proxy-init -noregen -rfc -voms dune:/dune/Role=Analysis;" >> $DOITSCRIPT
306 echo "function submit_gen {" >> $DOITSCRIPT
307 for ((i=0; i < ${#gensubmitcommands[@]}; i++)); do
308 echo "${gensubmitcommands[$i]}" >> $DOITSCRIPT
311 function check_gen {" >> $DOITSCRIPT
312 for ((i=0; i < ${#gencheckcommands[@]}; i++)); do
313 echo "${gencheckcommands[$i]}" >> $DOITSCRIPT
316 function clean_gen {" >> $DOITSCRIPT
317 for ((i=0; i < ${#gencleancommands[@]}; i++)); do
318 echo "${gencleancommands[$i]}" >> $DOITSCRIPT
321 function makeup_gen {" >> $DOITSCRIPT
322 for ((i=0; i < ${#genmakeupcommands[@]}; i++)); do
323 echo "${genmakeupcommands[$i]}" >> $DOITSCRIPT
326 function submit_g4 {" >> $DOITSCRIPT
327 for ((i=0; i < ${#g4submitcommands[@]}; i++)); do
328 echo "${g4submitcommands[$i]}" >> $DOITSCRIPT
331 function check_g4 {" >> $DOITSCRIPT
332 for ((i=0; i < ${#g4checkcommands[@]}; i++)); do
333 echo "${g4checkcommands[$i]}" >> $DOITSCRIPT
336 function clean_g4 {" >> $DOITSCRIPT
337 for ((i=0; i < ${#g4cleancommands[@]}; i++)); do
338 echo "${g4cleancommands[$i]}" >> $DOITSCRIPT
341 function makeup_g4 {" >> $DOITSCRIPT
342 for ((i=0; i < ${#g4makeupcommands[@]}; i++)); do
343 echo "${g4makeupcommands[$i]}" >> $DOITSCRIPT
346 function submit_detsim {" >> $DOITSCRIPT
347 for ((i=0; i < ${#detsimsubmitcommands[@]}; i++)); do
348 echo "${detsimsubmitcommands[$i]}" >> $DOITSCRIPT
351 function check_detsim {" >> $DOITSCRIPT
352 for ((i=0; i < ${#detsimcheckcommands[@]}; i++)); do
353 echo "${detsimcheckcommands[$i]}" >> $DOITSCRIPT
356 function clean_detsim {" >> $DOITSCRIPT
357 for ((i=0; i < ${#detsimcleancommands[@]}; i++)); do
358 echo "${detsimcleancommands[$i]}" >> $DOITSCRIPT
361 function makeup_detsim {" >> $DOITSCRIPT
362 for ((i=0; i < ${#detsimmakeupcommands[@]}; i++)); do
363 echo "${detsimmakeupcommands[$i]}" >> $DOITSCRIPT
366 function submit_dataoverlay {" >> $DOITSCRIPT
367 for ((i=0; i < ${#overlaysubmitcommands[@]}; i++)); do
368 echo "${overlaysubmitcommands[$i]}" >> $DOITSCRIPT
371 function check_dataoverlay {" >> $DOITSCRIPT
372 for ((i=0; i < ${#overlaycheckcommands[@]}; i++)); do
373 echo "${overlaycheckcommands[$i]}" >> $DOITSCRIPT
376 function clean_dataoverlay {" >> $DOITSCRIPT
377 for ((i=0; i < ${#overlaycleancommands[@]}; i++)); do
378 echo "${overlaycleancommands[$i]}" >> $DOITSCRIPT
381 function makeup_dataoverlay {" >> $DOITSCRIPT
382 for ((i=0; i < ${#overlaymakeupcommands[@]}; i++)); do
383 echo "${overlaymakeupcommands[$i]}" >> $DOITSCRIPT
386 function submit_robust {" >> $DOITSCRIPT
387 for ((i=0; i < ${#robustsubmitcommands[@]}; i++)); do
388 echo "${robustsubmitcommands[$i]}" >> $DOITSCRIPT
391 function check_robust {" >> $DOITSCRIPT
392 for ((i=0; i < ${#robustcheckcommands[@]}; i++)); do
393 echo "${robustcheckcommands[$i]}" >> $DOITSCRIPT
396 function checkana_robust {" >> $DOITSCRIPT
397 for ((i=0; i < ${#robustcheckanacommands[@]}; i++)); do
398 echo "${robustcheckanacommands[$i]}" >> $DOITSCRIPT
401 function clean_robust {" >> $DOITSCRIPT
402 for ((i=0; i < ${#robustcleancommands[@]}; i++)); do
403 echo "${robustcleancommands[$i]}" >> $DOITSCRIPT
406 function makeup_robust {" >> $DOITSCRIPT
407 for ((i=0; i < ${#robustmakeupcommands[@]}; i++)); do
408 echo "${robustmakeupcommands[$i]}" >> $DOITSCRIPT
411 function hadd_robust {" >> $DOITSCRIPT
412 for ((i=0; i < ${#robusthaddcommands[@]}; i++)); do
413 echo "${robusthaddcommands[$i]}" >> $DOITSCRIPT
416 function submit_ana {" >> $DOITSCRIPT
417 for ((i=0; i < ${#anasubmitcommands[@]}; i++)); do
418 echo "${anasubmitcommands[$i]}" >> $DOITSCRIPT
421 function check_ana {" >> $DOITSCRIPT
422 for ((i=0; i < ${#anacheckcommands[@]}; i++)); do
423 echo "${anacheckcommands[$i]}" >> $DOITSCRIPT
426 function clean_ana {" >> $DOITSCRIPT
427 for ((i=0; i < ${#anacleancommands[@]}; i++)); do
428 echo "${anacleancommands[$i]}" >> $DOITSCRIPT
431 function makeup_ana {" >> $DOITSCRIPT
432 for ((i=0; i < ${#anamakeupcommands[@]}; i++)); do
433 echo "${anamakeupcommands[$i]}" >> $DOITSCRIPT
436 function hadd_ana {" >> $DOITSCRIPT
437 for ((i=0; i < ${#anahaddcommands[@]}; i++)); do
438 echo "${anahaddcommands[$i]}" >> $DOITSCRIPT
440 echo "}" >> $DOITSCRIPT
443 unset gensubmitcommands
444 unset gencheckcommands
445 unset gencleancommands
446 unset genmakeupcommands
447 unset g4submitcommands
448 unset g4checkcommands
449 unset g4cleancommands
450 unset g4makeupcommands
451 unset detsimsubmitcommands
452 unset detsimcheckcommands
453 unset detsimcleancommands
454 unset detsimmakeupcommands
455 unset overlaysubmitcommands
456 unset overlaycheckcommands
457 unset overlaycleancommands
458 unset overlaymakeupcommands
459 unset robustsubmitcommands
460 unset robustcheckcommands
461 unset robustcheckanacommands
462 unset robustcleancommands
463 unset robustmakeupcommands
464 unset robusthaddcommands
465 unset anasubmitcommands
466 unset anacheckcommands
467 unset anacleancommands
468 unset anamakeupcommands
469 unset anahaddcommands