@@ -98,12 +98,15 @@ if ( "$BATCHRUN" != "0" ) then
9898 mkdir -p $OUTDIR /log
9999endif
100100
101- if ( ! -d $RUNNING_DIR ) then
102- mkdir $RUNNING_DIR
103- endif
101+ if ( " $BATCHSYS " == " QSUB" ) then
102+ if ( ! -d $RUNNING_DIR ) then
103+ mkdir $RUNNING_DIR
104+ endif
104105
105106cd $RUNNING_DIR
106107
108+ endif
109+
107110if ( ! -d $RUNNING_DIR /${RUN_NUMBER} _${FILE_NUMBER} ) then
108111 mkdir $RUNNING_DIR /${RUN_NUMBER} _${FILE_NUMBER}
109112endif
@@ -134,7 +137,7 @@ set current_files=`find . -maxdepth 1 -type f`
134137
135138set radthick=" 50.e-6"
136139
137- if ( " $RADIATOR_THICKNESS " ! = " rcdb" || " $VERSION " ! = " mc" ) then
140+ if ( " $RADIATOR_THICKNESS " ! = " rcdb" || ( " $VERSION " ! = " mc" && " $VERSION " ! = " mc_workfest2018 " ) ) then
138141 set radthick=$RADIATOR_THICKNESS
139142else
140143 set words = ` rcnd $RUN_NUMBER radiator_type | sed ' s/ / /g' `
@@ -162,8 +165,10 @@ if ( "$polarization_angle" == "" ) then
162165 set poldir=` rcnd $RUN_NUMBER polarization_direction | awk ' {print $1}' `
163166 if ( " $poldir " == " PARA" ) then
164167 set polarization_angle=" 0.0"
165- else
168+ else if ( " $poldir " == " PERP " ) then
166169 set polarization_angle=" 90.0"
170+ else
171+ set polarization_angle=" -1.0"
167172 endif
168173endif
169174
@@ -182,7 +187,7 @@ set elecE_text="$ccdbelece" #$ccdblist[$#ccdblist]
182187
183188# echo "text: " $elecE_text
184189
185- if ( " $eBEAM_ENERGY " ! = " rcdb" || " $VERSION " ! = " mc" ) then
190+ if ( " $eBEAM_ENERGY " ! = " rcdb" || ( " $VERSION " ! = " mc" && " $VERSION " ! = " mc_workfest2018 " ) ) then
186191 set elecE=$eBEAM_ENERGY
187192else if ( $elecE_text == " Run" ) then
188193 set elecE=12
@@ -195,41 +200,42 @@ endif
195200set copeak = 0
196201set copeak_text = ` rcnd $RUN_NUMBER coherent_peak | awk ' {print $1}' `
197202
198- if ( " $COHERENT_PEAK " ! = " rcdb" || " $VERSION " ! = " mc" ) then
199- set copeak=$COHERENT_PEAK
200- else if ( $copeak_text == " Run" ) then
201- set copeak=9
202- else if ( $copeak_text == " -1.0" ) then
203- set copeak=0.0
203+ if ( " $COHERENT_PEAK " ! = " rcdb" && " $polarization_angle " == " -1.0" ) then
204+ copeak=$COHERENT_PEAK
204205else
205- set copeak = ` echo " $copeak_text / 1000" | /usr/bin/bc -l `
206+
207+ if ( " $COHERENT_PEAK " ! = " rcdb" || ( " $VERSION " ! = " mc" && " $VERSION " ! = " mc_workfest2018" ) ) then
208+ set copeak=$COHERENT_PEAK
209+ else if ( $copeak_text == " Run" ) then
210+ set copeak=9
211+ else if ( $copeak_text == " -1.0" ) then
212+ set copeak=0
213+ else
214+ set copeak = ` echo " $copeak_text / 1000" | /usr/bin/bc -l `
215+ endif
206216endif
207217
208- if ( " $polarization_angle " == " -1.0" ) then
209- # set copeak=`echo "$eBEAM_ENERGY + .5" | /usr/bin/bc `
218+ if ( " $polarization_angle " == " -1.0" && " $COHERENT_PEAK " == " rcdb" ) then
210219 set copeak=0
211- setenv COHERENT_PEAK $copeak
212220endif
213221
222+ setenv COHERENT_PEAK $copeak
223+
214224# echo $copeak
215225# set copeak=`rcnd $RUN_NUMBER coherent_peak | awk '{print $1}' | sed 's/\.//g' #| awk -vFS="" -vOFS="" '{$1=$1"."}1' `
216226
217- setenv COHERENT_PEAK $copeak
218-
219- if ( " $VERSION " ! = " mc" && " $COHERENT_PEAK " == " rcdb" ) then
227+ if ( ( " $VERSION " ! = " mc" && " $VERSION " ! = " mc_workfest2018" ) && " $COHERENT_PEAK " == " rcdb" ) then
220228 echo " error in requesting rcdb for the coherent peak and not using variation=mc"
221229 exit 1
222230endif
223231
224232setenv eBEAM_ENERGY $elecE
225233
226- if ( " $VERSION " ! = " mc" && " $eBEAM_ENERGY " == " rcdb" ) then
234+ if ( ( " $VERSION " ! = " mc" && " $VERSION " ! = " mc_workfest2018 " ) && " $eBEAM_ENERGY " == " rcdb" ) then
227235 echo " error in requesting rcdb for the electron beam energy and not using variation=mc"
228236 exit 1
229237endif
230238
231-
232-
233239set colsize=` rcnd $RUN_NUMBER collimator_diameter | awk ' {print $1}' | sed -r ' s/.{2}$//' | sed -e ' s/\.//g' `
234240
235241if ( " $colsize " == " B" || " $colsize " == " R" || " $JANA_CALIB_CONTEXT " ! = " variation=mc" ) then
@@ -251,7 +257,7 @@ endif
251257
252258set BGRATE_toUse=$BGRATE
253259
254- if ( " $BGRATE " ! = " rcdb" || " $VERSION " ! = " mc" ) then
260+ if ( " $BGRATE " ! = " rcdb" || ( " $VERSION " ! = " mc" && " $VERSION " ! = " mc_workfest2018 " ) ) then
255261 set BGRATE_toUse=$BGRATE
256262else
257263 if ( $BGTAGONLY_OPTION == " 1" || $BKGFOLDSTR == " BeamPhotons" ) then
@@ -401,7 +407,7 @@ if ( "$BKGFOLDSTR" == "DEFAULT" || "$bkgloc_pre" == "loc:" || "$BKGFOLDSTR" == "
401407 if ( " $BATCHSYS " == " OSG" && $BATCHRUN ! = 0 ) then
402408 set bkglocstring=" /srv/run$formatted_runNumber " " _random.hddm"
403409 else
404- set bkglocstring=$rand_bkg_loc " /$RANDBGTAG " " / run$formatted_runNumber " " _random.hddm"
410+ set bkglocstring=$rand_bkg_loc " /run$formatted_runNumber " " _random.hddm"
405411 endif
406412 else
407413 # set bkglocstring="/cache/halld/""$runperiod""/sim/random_triggers/""run$formatted_runNumber""_random.hddm"
@@ -433,9 +439,9 @@ set gen_pre=""
433439if ( " $GENR " ! = " 0" ) then
434440
435441 set gen_pre=` echo $GENERATOR | cut -c1-4`
436- if ( " $gen_pre " ! = " file" && " $GENERATOR " ! = " genr8" && " $GENERATOR " ! = " bggen" && " $GENERATOR " ! = " genEtaRegge" && " $GENERATOR " ! = " gen_2pi_amp" && " $GENERATOR " ! = " gen_pi0" && " $GENERATOR " ! = " gen_2pi_primakoff" && " $GENERATOR " ! = " gen_omega_3pi" && " $GENERATOR " ! = " gen_2k" && " $GENERATOR " ! = " bggen_jpsi" && " $GENERATOR " ! = " gen_ee" && " $GENERATOR " ! = " gen_ee_hb" && " $GENERATOR " ! = " particle_gun" && " $GENERATOR " ! = " bggen_phi_ee" ) then
442+ if ( " $gen_pre " ! = " file" && " $GENERATOR " ! = " genr8" && " $GENERATOR " ! = " bggen" && " $GENERATOR " ! = " genEtaRegge" && " $GENERATOR " ! = " gen_2pi_amp" && " $GENERATOR " ! = " gen_pi0" && " $GENERATOR " ! = " gen_2pi_primakoff" && " $GENERATOR " ! = " gen_omega_3pi" && " $GENERATOR " ! = " gen_2k" && " $GENERATOR " ! = " bggen_jpsi" && " $GENERATOR " ! = " gen_ee" && " $GENERATOR " ! = " gen_ee_hb" && " $GENERATOR " ! = " particle_gun" && " $GENERATOR " ! = " bggen_phi_ee" && " $GENERATOR " ! = " genBH " && " $GENERATOR " ! = " gen_omega_radiative " ) then
437443 echo " NO VALID GENERATOR GIVEN"
438- echo " only [genr8, bggen, genEtaRegge, gen_2pi_amp, gen_pi0, gen_omega_3pi, gen_2k, bggen_jpsi, gen_ee , gen_ee_hb, bggen_phi_ee, particle_gun] are supported"
444+ echo " only [genr8, bggen, genEtaRegge, gen_2pi_amp, gen_pi0, gen_omega_3pi, gen_2k, bggen_jpsi, gen_ee , gen_ee_hb, bggen_phi_ee, particle_gun, genBH, gen_omega_radiative ] are supported"
439445 exit 1
440446 endif
441447
@@ -478,8 +484,17 @@ if ( "$GENR" != "0" ) then
478484 echo $GENERATOR
479485 if ( " $GENERATOR " == " genr8" ) then
480486 echo " configuring genr8"
487+
481488 set STANDARD_NAME=" genr8_" $STANDARD_NAME
482489 cp $CONFIG_FILE ./$STANDARD_NAME .conf
490+ set replacementNum=` grep TEMPCOHERENT ./$STANDARD_NAME .conf | wc -l`
491+
492+ if ( " $polarization_angle " == " -1.0" && " $COHERENT_PEAK " == " 0." && $replacementNum ! = 0 ) then
493+ echo " Running genr8 with an AMO run number without supplying the energy desired to COHERENT_PEAK causes an inifinite loop."
494+ echo " Please specify the desired energy via the COHERENT_PEAK parameter and retry."
495+ exit 1
496+ endif
497+
483498 else if ( " $GENERATOR " == " bggen" ) then
484499 echo " configuring bggen"
485500 set STANDARD_NAME=" bggen_" $STANDARD_NAME
@@ -499,6 +514,10 @@ if ( "$GENR" != "0" ) then
499514 echo " configuring gen_omega_3pi"
500515 set STANDARD_NAME=" gen_omega_3pi_" $STANDARD_NAME
501516 cp $CONFIG_FILE ./$STANDARD_NAME .conf
517+ else if ( " $GENERATOR " == " gen_omega_radiative" ) then
518+ echo " configuring gen_omega_radiative"
519+ set STANDARD_NAME=" gen_omega_radiative_" $STANDARD_NAME
520+ cp $CONFIG_FILE ./$STANDARD_NAME .conf
502521 else if ( " $GENERATOR " == " gen_2pi_primakoff" ) then
503522 echo " configuring gen_2pi_primakoff"
504523 set STANDARD_NAME=" gen_2pi_primakoff_" $STANDARD_NAME
@@ -540,6 +559,9 @@ if ( "$GENR" != "0" ) then
540559 echo " configuring the particle gun"
541560 set STANDARD_NAME=" particle_gun_" $STANDARD_NAME
542561 cp $CONFIG_FILE ./$STANDARD_NAME .conf
562+ else if ( " $GENERATOR " == " genBH" ) then
563+ echo " configuring genBH"
564+ set STANDARD_NAME=" genBH_" $STANDARD_NAME
543565 endif
544566
545567 if ( " $gen_pre " ! = " file" ) then
@@ -550,7 +572,7 @@ if ( "$GENR" != "0" ) then
550572 if ( " $GENERATOR " == " genr8" ) then
551573 echo " RUNNING GENR8"
552574 set RUNNUM=$formatted_runNumber +$formatted_fileNumber
553- sed -i ' s/TEMPMAXE /' $GEN_MAX_ENERGY ' /' $STANDARD_NAME .conf
575+ sed -i ' s/TEMPCOHERENT /' $COHERENT_PEAK ' /' $STANDARD_NAME .conf
554576 # RUN genr8 and convert
555577 genr8 -r$formatted_runNumber -M$EVT_TO_GEN -A$STANDARD_NAME .ascii < $STANDARD_NAME .conf # $config_file_name
556578 set generator_return_code=$status
@@ -615,6 +637,22 @@ if ( "$GENR" != "0" ) then
615637 echo gen_omega_3pi -c $STANDARD_NAME .conf -hd $STANDARD_NAME .hddm -o $STANDARD_NAME .root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY -b $GEN_MAX_ENERGY -m $eBEAM_ENERGY -p $COHERENT_PEAK $optionals_line
616638 gen_omega_3pi -c $STANDARD_NAME .conf -hd $STANDARD_NAME .hddm -o $STANDARD_NAME .root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY -b $GEN_MAX_ENERGY -m $eBEAM_ENERGY -p $COHERENT_PEAK $optionals_line
617639 set generator_return_code=$status
640+ else if ( " $GENERATOR " == " gen_omega_radiative" ) then
641+ echo " RUNNING GEN_OMEGA_radiative"
642+ set optionals_line=` head -n 1 $STANDARD_NAME .conf | sed -r ' s/.//' `
643+
644+ if ( " $polarization_angle " == " -1.0" ) then
645+ sed -i ' s/TEMPPOLFRAC/' 0' /' $STANDARD_NAME .conf
646+ sed -i ' s/TEMPPOLANGLE/' 0' /' $STANDARD_NAME .conf
647+ else
648+ sed -i ' s/TEMPPOLFRAC/' .4' /' $STANDARD_NAME .conf
649+ sed -i ' s/TEMPPOLANGLE/' $polarization_angle ' /' $STANDARD_NAME .conf
650+ endif
651+
652+ echo $optionals_line
653+ echo gen_omega_radiative -c $STANDARD_NAME .conf -hd $STANDARD_NAME .hddm -o $STANDARD_NAME .root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY -b $GEN_MAX_ENERGY -m $eBEAM_ENERGY -p $COHERENT_PEAK $optionals_line
654+ gen_omega_radiative -c $STANDARD_NAME .conf -hd $STANDARD_NAME .hddm -o $STANDARD_NAME .root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY -b $GEN_MAX_ENERGY -m $eBEAM_ENERGY -p $COHERENT_PEAK $optionals_line
655+ set generator_return_code=$status
618656 else if ( " $GENERATOR " == " gen_2pi_primakoff" ) then
619657 echo " RUNNING GEN_2PI_PRIMAKOFF"
620658 set optionals_line=` head -n 1 $STANDARD_NAME .conf | sed -r ' s/.//' `
@@ -684,6 +722,10 @@ if ( "$GENR" != "0" ) then
684722 ee_mc_hb -N$RUN_NUMBER -n$EVT_TO_GEN
685723 set generator_return_code=$status
686724 mv genOut.hddm $STANDARD_NAME .hddm
725+ else if ( " $GENERATOR " == " genBH" ) then
726+ echo genBH -n$EVT_TO_GEN
727+ genBH -n$EVT_TO_GEN -t$NUMTHREADS -E$COHERENT_PEAK -e$GEN_MAX_ENERGY $STANDARD_NAME .hddm
728+ set generator_return_code=$status
687729 endif
688730
689731
@@ -801,24 +843,24 @@ if ( "$GENR" != "0" ) then
801843
802844 if ( " $BKGFOLDSTR " == " BeamPhotons" || " $BKGFOLDSTR " == " None" || " $BKGFOLDSTR " == " TagOnly" ) then
803845 echo " running MCsmear without folding in random background"
804- mcsmear -PTHREAD_TIMEOUT=300 -o$STANDARD_NAME ' _geant' $GEANTVER ' _smeared.hddm' $STANDARD_NAME ' _geant' $GEANTVER ' .hddm'
846+ mcsmear -PTHREAD_TIMEOUT=500 -o$STANDARD_NAME ' _geant' $GEANTVER ' _smeared.hddm' $STANDARD_NAME ' _geant' $GEANTVER ' .hddm'
805847 set mcsmear_return_code=$status
806848 else if ( " $BKGFOLDSTR " == " DEFAULT" || " $BKGFOLDSTR " == " Random" ) then
807849 set fold_skip_num=` echo " $FILE_NUMBER * $PER_FILE " | /usr/bin/bc`
808850 # set bkglocstring="/w/halld-scifs17exp/halld2/home/tbritton/MCwrapper_Development/converted.hddm"
809- echo " mcsmear -PTHREAD_TIMEOUT=300 -o$STANDARD_NAME " \_ " geant$GEANTVER " \_ " smeared.hddm $STANDARD_NAME " \_ " geant$GEANTVER .hddm $bkglocstring " \: " 1" " +" $fold_skip_num
810- mcsmear -PTHREAD_TIMEOUT=300 -o$STANDARD_NAME \_ geant$GEANTVER \_ smeared.hddm $STANDARD_NAME \_ geant$GEANTVER .hddm $bkglocstring \: 1\+ $fold_skip_num
851+ echo " mcsmear -PTHREAD_TIMEOUT=500 -o$STANDARD_NAME " \_ " geant$GEANTVER " \_ " smeared.hddm $STANDARD_NAME " \_ " geant$GEANTVER .hddm $bkglocstring " \: " 1" " +" $fold_skip_num
852+ mcsmear -PTHREAD_TIMEOUT=500 -o$STANDARD_NAME \_ geant$GEANTVER \_ smeared.hddm $STANDARD_NAME \_ geant$GEANTVER .hddm $bkglocstring \: 1\+ $fold_skip_num
811853 set mcsmear_return_code=$status
812854 else if ( " $bkgloc_pre " == " loc:" ) then
813855 set fold_skip_num=` echo " $FILE_NUMBER * $PER_FILE " | /usr/bin/bc`
814856
815- echo " mcsmear -PTHREAD_TIMEOUT=300 -o$STANDARD_NAME " \_ " geant$GEANTVER " \_ " smeared.hddm $STANDARD_NAME " \_ " geant$GEANTVER .hddm $bkglocstring " \: " 1" " +" $fold_skip_num
816- mcsmear -PTHREAD_TIMEOUT=300 -o$STANDARD_NAME \_ geant$GEANTVER \_ smeared.hddm $STANDARD_NAME \_ geant$GEANTVER .hddm $bkglocstring \: 1\+ $fold_skip_num
857+ echo " mcsmear -PTHREAD_TIMEOUT=500 -o$STANDARD_NAME " \_ " geant$GEANTVER " \_ " smeared.hddm $STANDARD_NAME " \_ " geant$GEANTVER .hddm $bkglocstring " \: " 1" " +" $fold_skip_num
858+ mcsmear -PTHREAD_TIMEOUT=500 -o$STANDARD_NAME \_ geant$GEANTVER \_ smeared.hddm $STANDARD_NAME \_ geant$GEANTVER .hddm $bkglocstring \: 1\+ $fold_skip_num
817859 set mcsmear_return_code=$status
818860 else
819861 # trust the user and use their string
820- echo ' mcsmear -PTHREAD_TIMEOUT=300 -o' $STANDARD_NAME ' _geant' $GEANTVER ' _smeared.hddm' ' ' $STANDARD_NAME ' _geant' $GEANTVER ' .hddm' ' ' $BKGFOLDSTR
821- mcsmear -PTHREAD_TIMEOUT=300 -o$STANDARD_NAME ' _geant' $GEANTVER ' _smeared.hddm' $STANDARD_NAME ' _geant' $GEANTVER ' .hddm' $BKGFOLDSTR
862+ echo ' mcsmear -PTHREAD_TIMEOUT=500 -o' $STANDARD_NAME ' _geant' $GEANTVER ' _smeared.hddm' ' ' $STANDARD_NAME ' _geant' $GEANTVER ' .hddm' ' ' $BKGFOLDSTR
863+ mcsmear -PTHREAD_TIMEOUT=500 -o$STANDARD_NAME ' _geant' $GEANTVER ' _smeared.hddm' $STANDARD_NAME ' _geant' $GEANTVER ' .hddm' $BKGFOLDSTR
822864 set mcsmear_return_code=$status
823865 endif
824866
@@ -871,7 +913,7 @@ if ( "$GENR" != "0" ) then
871913 if ( " $recon_pre " == " file" ) then
872914 echo " using config file: " $jana_config_file
873915
874- hd_root ./$STANDARD_NAME ' _geant' $GEANTVER ' _smeared.hddm' --config=jana_config.cfg -PNTHREADS=$NUMTHREADS -PTHREAD_TIMEOUT=300
916+ hd_root ./$STANDARD_NAME ' _geant' $GEANTVER ' _smeared.hddm' --config=jana_config.cfg -PNTHREADS=$NUMTHREADS -PTHREAD_TIMEOUT=500
875917 set hd_root_return_code=$status
876918 # echo "STATUS: " $hd_root_return_code
877919 rm jana_config.cfg
@@ -891,7 +933,7 @@ if ( "$GENR" != "0" ) then
891933 set PluginStr=` echo $PluginStr | sed -r ' s/.{1}$//' `
892934 echo " Running hd_root with:" " $PluginStr "
893935 echo " hd_root " " $STANDARD_NAME " ' _geant' " $GEANTVER " ' _smeared.hddm' " -PPLUGINS=" " $PluginStr " " -PNTHREADS=" " $NUMTHREADS "
894- hd_root ./$STANDARD_NAME ' _geant' $GEANTVER ' _smeared.hddm' -PPLUGINS=$PluginStr -PNTHREADS=$NUMTHREADS -PTHREAD_TIMEOUT=300
936+ hd_root ./$STANDARD_NAME ' _geant' $GEANTVER ' _smeared.hddm' -PPLUGINS=$PluginStr -PNTHREADS=$NUMTHREADS -PTHREAD_TIMEOUT=500
895937 set hd_root_return_code=$status
896938
897939 endif
0 commit comments