From 7c8714d22e265a91cb9425613bdea6792a9fed62 Mon Sep 17 00:00:00 2001 From: tbritton Date: Tue, 31 Oct 2017 13:30:29 -0400 Subject: [PATCH 01/20] cleaner backgrounds...Now you can do Random+TagOnly or TagOnly. Better cleanup and a warning in case of failed moves --- MCwrapper/Gcontrol.in | 4 ++-- MCwrapper/MakeMC.csh | 20 ++++++++++++++++++-- MCwrapper/MakeMC.sh | 21 ++++++++++++++++++--- MCwrapper/gluex_MC.py | 26 ++++++++++++++++++-------- 4 files changed, 56 insertions(+), 15 deletions(-) diff --git a/MCwrapper/Gcontrol.in b/MCwrapper/Gcontrol.in index 9698e261..cb2ed607 100644 --- a/MCwrapper/Gcontrol.in +++ b/MCwrapper/Gcontrol.in @@ -176,7 +176,7 @@ c now ready to go. If you ever change anything in the beamline geometry c eg. the collimator diameter, the coherent edge position, or the value c of beamEmin, do not forget to come back and change your BGRATE. BGGATE -200. 200. -BGRATE 4.80 +BGRATE 0.1273 c The above cards BGRATE, BGGATE normally cause the simulation to add c accidental tagger hits to the simulated output record, in addition to @@ -192,7 +192,7 @@ c if you are only interested in the region of the coherent peak. This c minimum is the third field of the BEAM card above. Remember that if c you change beamEmin, you also need to change BGRATE to match, as c described above. -BGTAGONLY 0 +BGTAGONLY TEMPBGTAGONLY c The following line controls the uncertainty of the event time reference c relative to the RF structure of the beam. The event time reference is diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index 8d3a94c2..a40f84ad 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -74,6 +74,8 @@ shift setenv RUNNING_DIR $1 shift setenv SQLITEPATH $1 +shift +setenv BGTAGONLY_OPTION $1 echo "" echo "" @@ -286,7 +288,7 @@ endif set bkglocstring="" set bkgloc_pre=`echo $BKGFOLDSTR | cut -c 1-4` -if ( "$BKGFOLDSTR" == "DEFAULT" || "$bkgloc_pre" == "loc:" ) then +if ( "$BKGFOLDSTR" == "DEFAULT" || "$bkgloc_pre" == "loc:" || "$BKGFOLDSTR" == "Random" ) then #find file and run:1 echo "Finding the right file to fold in during MCsmear step" set runperiod="RunPeriod-2017-01" @@ -485,6 +487,7 @@ if ( "$GENR" != "0" ) then sed -i 's/TEMPTRIG/'$EVT_TO_GEN'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPCOLD/'0.00$colsize'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPRADTHICK/'"$radthick"'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/TEMPBGTAGONLY/'$BGTAGONLY_OPTION'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in if ( "$gen_pre" == "file" ) then @ skip_num = $FILE_NUMBER * $PER_FILE @@ -500,6 +503,10 @@ if ( "$GENR" != "0" ) then sed -i 's/TEMPMINE/'$GEN_MIN_ENERGY'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in else if ( "$BKGFOLDSTR" == "BeamPhotons" ) then sed -i 's/TEMPMINE/0.0012/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + else if ( "$BKGFOLDSTR" == "DEFAULT" || "$BKGFOLDSTR" == "Random" && "$BGTAGONLY_OPTION" == "0") then + sed -i 's/BGRATE/cBGRATE/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/BGGATE/cBGGATE/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/TEMPMINE/'$GEN_MIN_ENERGY'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in else sed -i 's/TEMPMINE/'$GEN_MIN_ENERGY'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in endif @@ -530,7 +537,7 @@ if ( "$GENR" != "0" ) then if ( "$BKGFOLDSTR" == "BeamPhotons" || "$BKGFOLDSTR" == "None" ) then echo "running MCsmear without folding in random background" mcsmear -PTHREAD_TIMEOUT=300 -o$STANDARD_NAME'_geant'$GEANTVER'_smeared.hddm' $STANDARD_NAME'_geant'$GEANTVER'.hddm' - else if ( "$BKGFOLDSTR" == "DEFAULT" ) then + else if ( "$BKGFOLDSTR" == "DEFAULT" || "$BKGFOLDSTR" == "Random" ) then echo "mcsmear -PTHREAD_TIMEOUT=300 -o$STANDARD_NAME"\_"geant$GEANTVER"\_"smeared.hddm $STANDARD_NAME"\_"geant$GEANTVER.hddm $bkglocstring"\:"1" mcsmear -PTHREAD_TIMEOUT=300 -o$STANDARD_NAME\_geant$GEANTVER\_smeared.hddm $STANDARD_NAME\_geant$GEANTVER.hddm $bkglocstring\:1 else if ( "$bkgloc_pre" == "loc:" ) then @@ -645,5 +652,14 @@ if ( "$hddmfiles" != "" ) then end endif +cd .. + +if ( `ls $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER} | wc -l` == 0 ) then + rm -rf $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER} +else + echo "MOVING AND/OR CLEANUP FAILED" + echo `ls $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER}` +endif + # mv $PWD/*.root $OUTDIR/root/ #just in case echo `date` diff --git a/MCwrapper/MakeMC.sh b/MCwrapper/MakeMC.sh index 12da4883..86296b59 100755 --- a/MCwrapper/MakeMC.sh +++ b/MCwrapper/MakeMC.sh @@ -74,6 +74,8 @@ shift export RUNNING_DIR=$1 shift export SQLITEPATH=$1 +shift +export BGTAGONLY_OPTION=$1 echo "" echo "" @@ -279,7 +281,7 @@ fi bkglocstring="" bkgloc_pre=`echo $BKGFOLDSTR | cut -c 1-4` -if [[ "$BKGFOLDSTR" == "DEFAULT" || "$bkgloc_pre" == "loc:" ]]; then +if [[ "$BKGFOLDSTR" == "DEFAULT" || "$bkgloc_pre" == "loc:" || "$BKGFOLDSTR" == "Random" ]]; then #find file and run:1 echo "Finding the right file to fold in during MCsmear step" runperiod="RunPeriod-2017-01" @@ -477,6 +479,7 @@ if [[ "$GENR" != "0" ]]; then sed -i 's/TEMPTRIG/'$EVT_TO_GEN'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPCOLD/'0.00$colsize'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPRADTHICK/'"$radthick"'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/TEMPBGTAGONLY/'$BGTAGONLY_OPTION'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in if [[ "$gen_pre" == "file" ]]; then skip_num=$((FILE_NUMBER * PER_FILE)) @@ -492,8 +495,12 @@ if [[ "$GENR" != "0" ]]; then sed -i 's/TEMPMINE/'$GEN_MIN_ENERGY'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in elif [[ "$BKGFOLDSTR" == "BeamPhotons" ]]; then sed -i 's/TEMPMINE/0.0012/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + elif [[ "$BKGFOLDSTR" == "DEFAULT" || "$BKGFOLDSTR" == "Random" && "$BGTAGONLY_OPTION" == "0" ]]; then + sed -i 's/BGRATE/cBGRATE/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/BGGATE/cBGGATE/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/TEMPMINE/'$GEN_MIN_ENERGY'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in else - sed -i 's/TEMPMINE/0.0012/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/TEMPMINE/'$GEN_MIN_ENERGY'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in fi cp $PWD/control'_'$formatted_runNumber'_'$formatted_fileNumber.in $OUTDIR/configurations/geant/ @@ -519,7 +526,7 @@ if [[ "$GENR" != "0" ]]; then if [[ "$BKGFOLDSTR" == "BeamPhotons" || "$BKGFOLDSTR" == "None" ]]; then echo "running MCsmear without folding in random background" mcsmear -PTHREAD_TIMEOUT=300 -o$STANDARD_NAME'_geant'$GEANTVER'_smeared.hddm' $STANDARD_NAME'_geant'$GEANTVER'.hddm' - elif [[ "$BKGFOLDSTR" == "DEFAULT" ]]; then + elif [[ "$BKGFOLDSTR" == "DEFAULT" || "$BKGFOLDSTR" == "Random" ]]; then echo "mcsmear -PTHREAD_TIMEOUT=300 -o$STANDARD_NAME"\_"geant$GEANTVER"\_"smeared.hddm $STANDARD_NAME"\_"geant$GEANTVER.hddm $bkglocstring"\:"1" mcsmear -PTHREAD_TIMEOUT=300 -o$STANDARD_NAME\_geant$GEANTVER\_smeared.hddm $STANDARD_NAME\_geant$GEANTVER.hddm $bkglocstring\:1 elif [[ "$bkgloc_pre" == "loc:" ]]; then @@ -628,4 +635,12 @@ if [[ "$hddmfiles" != "" ]]; then fi done fi + +if [[ `ls $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER} | wc -l` == 0 ]]; then + rm -rf $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER} +else + echo "MOVING AND/OR CLEANUP FAILED" + echo `ls $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER}` +fi + #mv $PWD/*.root $OUTDIR/root/ #just in case diff --git a/MCwrapper/gluex_MC.py b/MCwrapper/gluex_MC.py index db3b98c6..009b0522 100755 --- a/MCwrapper/gluex_MC.py +++ b/MCwrapper/gluex_MC.py @@ -195,8 +195,8 @@ def main(argv): #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! print "*********************************" - print "Welcome to v1.9 of the MCwrapper" - print "Thomas Britton 10/24/17" + print "Welcome to v1.9.1 of the MCwrapper" + print "Thomas Britton 10/31/17" print "*********************************" #load all argument passed in and set default options @@ -214,8 +214,9 @@ def main(argv): eBEAM_ENERGY="rcdb" COHERENT_PEAK="rcdb" - MIN_GEN_ENERGY="4" + MIN_GEN_ENERGY="3" MAX_GEN_ENERGY="12" + BGTAGONLY="0" RUNNING_DIR="./" SQLITEPATH="no_sqlite" @@ -314,7 +315,7 @@ def main(argv): GEANTVER=rm_comments[0].strip() elif str(parts[0]).upper()=="WORKFLOW_NAME" : WORKFLOW=rm_comments[0].strip() - if WORKFLOW.find(';')!=-1 or WORKFLOW.find('&')!=-1 :#THIS CHECK HELPS PROTEXT AGAINST A POTENTIAL HACK IN WORKFLOW NAMES + if WORKFLOW.find(';')!=-1 or WORKFLOW.find('&')!=-1 :#THIS CHECK HELPS PROTECT AGAINST A POTENTIAL HACK IN WORKFLOW NAMES print "Nice try.....you cannot use ; or & in the name" exit(1) elif str(parts[0]).upper()=="GENERATOR_CONFIG" : @@ -324,7 +325,16 @@ def main(argv): elif str(parts[0]).upper()=="CUSTOM_GCONTROL" : CUSTOM_GCONTROL=rm_comments[0].strip() elif str(parts[0]).upper()=="BKG" : - BGFOLD=rm_comments[0].strip() + bkg_parts=rm_comments[0].strip().split("+") + if len(bkg_parts)>1: + BGFOLD=bkg_parts[0] + BGTAGONLY=1 + else: + if bkg_parts[0].upper()=="TAGONLY" : + BGFOLD="None" + BGTAGONLY=1 + else: + BGFOLD=bkg_parts[0] elif str(parts[0]).upper()=="EBEAM_ENERGY" : eBEAM_ENERGY=rm_comments[0].strip() elif str(parts[0]).upper()=="COHERENT_PEAK" : @@ -344,7 +354,7 @@ def main(argv): QUEUENAME=batch_sys_parts[1] elif str(parts[0]).upper()=="RUNNING_DIRECTORY" : RUNNING_DIR=rm_comments[0].strip() - elif str(parts[0]).upper()=="VARIATION" : + elif str(parts[0]).upper()=="VARIATION": if ( len(parts)>2 ) : VERSION=str(parts[1]).split("calibtime")[0].split("#")[0].strip() CALIBTIME=str(parts[2]).split("#")[0].strip() @@ -546,7 +556,7 @@ def main(argv): if num_this_file == 0: continue - COMMAND=str(BATCHRUN)+" "+ENVFILE+" "+GENCONFIG+" "+str(outdir)+" "+str(runs[0])+" "+str(BASEFILENUM+FILENUM_this_run+-1)+" "+str(num_this_file)+" "+str(VERSION)+" "+str(CALIBTIME)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(BATCHSYS)+" "+str(NCORES).split(':')[-1]+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY)+" "+str(TAGSTR)+" "+str(CUSTOM_PLUGINS)+" "+str(PERFILE)+" "+str(RUNNING_DIR)+" "+str(SQLITEPATH) + COMMAND=str(BATCHRUN)+" "+ENVFILE+" "+GENCONFIG+" "+str(outdir)+" "+str(runs[0])+" "+str(BASEFILENUM+FILENUM_this_run+-1)+" "+str(num_this_file)+" "+str(VERSION)+" "+str(CALIBTIME)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(BATCHSYS)+" "+str(NCORES).split(':')[-1]+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY)+" "+str(TAGSTR)+" "+str(CUSTOM_PLUGINS)+" "+str(PERFILE)+" "+str(RUNNING_DIR)+" "+str(SQLITEPATH)+" "+str(BGTAGONLY) if BATCHRUN == 0 or BATCHSYS=="NULL": #print str(runs[0])+" "+str(BASEFILENUM+FILENUM_this_run+-1)+" "+str(num_this_file) os.system(str(indir)+" "+COMMAND) @@ -569,7 +579,7 @@ def main(argv): if num == 0: continue - COMMAND=str(BATCHRUN)+" "+ENVFILE+" "+GENCONFIG+" "+str(outdir)+" "+str(RUNNUM)+" "+str(BASEFILENUM+FILENUM+-1)+" "+str(num)+" "+str(VERSION)+" "+str(CALIBTIME)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(BATCHSYS)+" "+str(NCORES).split(':')[-1]+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY)+" "+str(TAGSTR)+" "+str(CUSTOM_PLUGINS)+" "+str(PERFILE)+" "+str(RUNNING_DIR)+" "+str(SQLITEPATH) + COMMAND=str(BATCHRUN)+" "+ENVFILE+" "+GENCONFIG+" "+str(outdir)+" "+str(RUNNUM)+" "+str(BASEFILENUM+FILENUM+-1)+" "+str(num)+" "+str(VERSION)+" "+str(CALIBTIME)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(BATCHSYS)+" "+str(NCORES).split(':')[-1]+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY)+" "+str(TAGSTR)+" "+str(CUSTOM_PLUGINS)+" "+str(PERFILE)+" "+str(RUNNING_DIR)+" "+str(SQLITEPATH)+" "+str(BGTAGONLY) #print COMMAND #either call MakeMC.csh or add a job depending on swif flag From 97b6d91778847459803ee7b9256d39592ae8e1b1 Mon Sep 17 00:00:00 2001 From: tbritton Date: Tue, 7 Nov 2017 09:36:52 -0500 Subject: [PATCH 02/20] many small tweaks. Set up to handle better BGRATE settings. Added radiator thickness through whole chain (genEtaRegge) --- .../Generators/genEtaRegge/examples/eta548.in | 2 +- .../Generators/genEtaRegge/examples/eta958.in | 2 +- MCwrapper/MakeMC.csh | 28 ++++++++++++------- MCwrapper/MakeMC.sh | 28 ++++++++++++------- MCwrapper/gluex_MC.py | 9 ++++-- 5 files changed, 44 insertions(+), 25 deletions(-) diff --git a/MCwrapper/Generators/genEtaRegge/examples/eta548.in b/MCwrapper/Generators/genEtaRegge/examples/eta548.in index 7c31d868..da33b5f4 100644 --- a/MCwrapper/Generators/genEtaRegge/examples/eta548.in +++ b/MCwrapper/Generators/genEtaRegge/examples/eta548.in @@ -1,7 +1,7 @@ #Emin Emax (photon energy range) TEMPMINGENE TEMPMAXGENE #Electron beam energy [GeV], coherent peak [GeV] and collimator diameter [m] -TEMPELECE TEMPCOHERENT TEMPCOLD +TEMPELECE TEMPCOHERENT TEMPCOLD TEMPRADTHICK #mass[GeV] width[GeV] 0.547853 0.000 #g_eta_gamma_gamma g_rho_eta_gamma g_omega_eta_gamma g_phi_eta_gamma diff --git a/MCwrapper/Generators/genEtaRegge/examples/eta958.in b/MCwrapper/Generators/genEtaRegge/examples/eta958.in index fb897821..c073292e 100644 --- a/MCwrapper/Generators/genEtaRegge/examples/eta958.in +++ b/MCwrapper/Generators/genEtaRegge/examples/eta958.in @@ -1,7 +1,7 @@ #Emin Emax (photon energy range) TEMPMINGENE TEMPMAXGENE #Electron beam energy [GeV], coherent peak [GeV] and collimator diameter [m] -TEMPELECE TEMPCOHERENT TEMPCOLD +TEMPELECE TEMPCOHERENT TEMPCOLD TEMPRADTHICK #mass[GeV] width[GeV] 0.95766 0.000205 #g_eta_gamma_gamma g_rho_eta_gamma g_omega_eta_gamma g_phi_eta_gamma diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index a40f84ad..97509c12 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -76,6 +76,8 @@ shift setenv SQLITEPATH $1 shift setenv BGTAGONLY_OPTION $1 +shift +setenv RADIATOR_THICKNESS $1 echo "" echo "" @@ -83,20 +85,24 @@ echo "Detected c-shell" set radthick="50.e-6" -set words = `rcnd $RUN_NUMBER radiator_type | sed 's/ / /g' ` -foreach word ($words:q) - if ( $word != "number" ) then +if ( "$RADIATOR_THICKNESS" != "rcdb" || "$VERSION" != "mc" ) then + set radthick=$RADIATOR_THICKNESS +else + + set words = `rcnd $RUN_NUMBER radiator_type | sed 's/ / /g' ` + foreach word ($words:q) + + if ( $word != "number" ) then - set removedum = `echo $word:q | sed 's/um/ /g'` + set removedum = `echo $word:q | sed 's/um/ /g'` - if ( $removedum != $word:q ) then - #set radthick=$removedum.e-6 - set radthick = `echo $removedum.e-6 | tr -d '[:space:]'` + if ( $removedum != $word:q ) then + set radthick = `echo $removedum.e-6 | tr -d '[:space:]'` + endif endif - endif - -end + end +endif set polarization_angle = `rcnd $RUN_NUMBER polarization_angle | awk '{print $1}'` echo polarization angle: $polarization_angle @@ -162,6 +168,7 @@ echo "Environment file: " $ENVIRONMENT echo "Context: "$JANA_CALIB_CONTEXT echo "Run Number: "$RUN_NUMBER echo "Electron beam energy to use: "$eBEAM_ENERGY" GeV" +echo "Radiator Thickness to use: "$radthick" m" echo "Photon Energy between "$GEN_MIN_ENERGY" and "$GEN_MAX_ENERGY" GeV" echo "Coherent Peak position: "$COHERENT_PEAK echo "----------------------------------------------" @@ -425,6 +432,7 @@ if ( "$GENR" != "0" ) then sed -i 's/TEMPCOLD/'0.00$colsize'/' $STANDARD_NAME.conf sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' $STANDARD_NAME.conf sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' $STANDARD_NAME.conf + sed -i 's/TEMPRADTHICK/'"$radthick"'/' $STANDARD_NAME.conf sed -i 's/TEMPMINGENE/'$GEN_MIN_ENERGY'/' $STANDARD_NAME.conf sed -i 's/TEMPMAXGENE/'$GEN_MAX_ENERGY'/' $STANDARD_NAME.conf genEtaRegge -N$EVT_TO_GEN -O$STANDARD_NAME.hddm -I$STANDARD_NAME.conf diff --git a/MCwrapper/MakeMC.sh b/MCwrapper/MakeMC.sh index 86296b59..f43fba02 100755 --- a/MCwrapper/MakeMC.sh +++ b/MCwrapper/MakeMC.sh @@ -76,6 +76,8 @@ shift export SQLITEPATH=$1 shift export BGTAGONLY_OPTION=$1 +shift +export RADIATOR_THICKNESS=$1 echo "" echo "" @@ -83,17 +85,21 @@ echo "Detected bash shell" radthick="50.e-6" exponentialu=".e-6" -words=`rcnd $RUN_NUMBER radiator_type | sed 's/ / /g' ` -for word in $words; -do - if [[ "$word" != "number" ]]; then - - removedum=`echo $word | sed 's/um/ /g'` - if [[ $removedum != $word ]]; then - radthick=`echo "$removedum.e-6" | tr -d '[:space:]'` + +if [[ "$RADIATOR_THICKNESS" != "rcdb" || "$VERSION" != "mc" ]]; then + radthick=$RADIATOR_THICKNESS +else + words=`rcnd $RUN_NUMBER radiator_type | sed 's/ / /g' ` + for word in $words; + do + if [[ "$word" != "number" ]]; then + removedum=`echo $word | sed 's/um/ /g'` + if [[ $removedum != $word ]]; then + radthick=`echo "$removedum.e-6" | tr -d '[:space:]'` + fi fi - fi -done + done +fi polarization_angle=`rcnd $RUN_NUMBER polarization_angle | awk '{print $1}'` echo polarization angle: $polarization_angle @@ -157,6 +163,7 @@ echo "Environment file: " $ENVIRONMENT echo "Context: "$JANA_CALIB_CONTEXT echo "Run Number: "$RUN_NUMBER echo "Electron beam energy to use: "$eBEAM_ENERGY" GeV" +echo "Radiator Thickness to use: "$radthick" m" echo "Photon Energy between "$GEN_MIN_ENERGY" and "$GEN_MAX_ENERGY" GeV" echo "Coherent Peak position: "$COHERENT_PEAK echo "----------------------------------------------" @@ -421,6 +428,7 @@ if [[ "$GENR" != "0" ]]; then sed -i 's/TEMPCOLD/'0.00$colsize'/' $STANDARD_NAME.conf sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' $STANDARD_NAME.conf sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' $STANDARD_NAME.conf + sed -i 's/TEMPRADTHICK/'"$radthick"'/' $STANDARD_NAME.conf sed -i 's/TEMPMINGENE/'$GEN_MIN_ENERGY'/' $STANDARD_NAME.conf sed -i 's/TEMPMAXGENE/'$GEN_MAX_ENERGY'/' $STANDARD_NAME.conf genEtaRegge -N$EVT_TO_GEN -O$STANDARD_NAME.hddm -I$STANDARD_NAME.conf diff --git a/MCwrapper/gluex_MC.py b/MCwrapper/gluex_MC.py index 009b0522..2e7d941b 100755 --- a/MCwrapper/gluex_MC.py +++ b/MCwrapper/gluex_MC.py @@ -196,7 +196,7 @@ def main(argv): print "*********************************" print "Welcome to v1.9.1 of the MCwrapper" - print "Thomas Britton 10/31/17" + print "Thomas Britton 11/07/17" print "*********************************" #load all argument passed in and set default options @@ -216,6 +216,7 @@ def main(argv): COHERENT_PEAK="rcdb" MIN_GEN_ENERGY="3" MAX_GEN_ENERGY="12" + RADIATOR_THICKNESS="rcdb" BGTAGONLY="0" RUNNING_DIR="./" SQLITEPATH="no_sqlite" @@ -339,6 +340,8 @@ def main(argv): eBEAM_ENERGY=rm_comments[0].strip() elif str(parts[0]).upper()=="COHERENT_PEAK" : COHERENT_PEAK=rm_comments[0].strip() + elif str(parts[0]).upper()=="RADIATOR_THICKNESS" : + RADIATOR_THICKNESS=rm_comments[0].strip() elif str(parts[0]).upper()=="GEN_MIN_ENERGY" : MIN_GEN_ENERGY=rm_comments[0].strip() elif str(parts[0]).upper()=="GEN_MAX_ENERGY" : @@ -556,7 +559,7 @@ def main(argv): if num_this_file == 0: continue - COMMAND=str(BATCHRUN)+" "+ENVFILE+" "+GENCONFIG+" "+str(outdir)+" "+str(runs[0])+" "+str(BASEFILENUM+FILENUM_this_run+-1)+" "+str(num_this_file)+" "+str(VERSION)+" "+str(CALIBTIME)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(BATCHSYS)+" "+str(NCORES).split(':')[-1]+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY)+" "+str(TAGSTR)+" "+str(CUSTOM_PLUGINS)+" "+str(PERFILE)+" "+str(RUNNING_DIR)+" "+str(SQLITEPATH)+" "+str(BGTAGONLY) + COMMAND=str(BATCHRUN)+" "+ENVFILE+" "+GENCONFIG+" "+str(outdir)+" "+str(runs[0])+" "+str(BASEFILENUM+FILENUM_this_run+-1)+" "+str(num_this_file)+" "+str(VERSION)+" "+str(CALIBTIME)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(BATCHSYS)+" "+str(NCORES).split(':')[-1]+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY)+" "+str(TAGSTR)+" "+str(CUSTOM_PLUGINS)+" "+str(PERFILE)+" "+str(RUNNING_DIR)+" "+str(SQLITEPATH)+" "+str(BGTAGONLY)+" "+str(RADIATOR_THICKNESS) if BATCHRUN == 0 or BATCHSYS=="NULL": #print str(runs[0])+" "+str(BASEFILENUM+FILENUM_this_run+-1)+" "+str(num_this_file) os.system(str(indir)+" "+COMMAND) @@ -579,7 +582,7 @@ def main(argv): if num == 0: continue - COMMAND=str(BATCHRUN)+" "+ENVFILE+" "+GENCONFIG+" "+str(outdir)+" "+str(RUNNUM)+" "+str(BASEFILENUM+FILENUM+-1)+" "+str(num)+" "+str(VERSION)+" "+str(CALIBTIME)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(BATCHSYS)+" "+str(NCORES).split(':')[-1]+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY)+" "+str(TAGSTR)+" "+str(CUSTOM_PLUGINS)+" "+str(PERFILE)+" "+str(RUNNING_DIR)+" "+str(SQLITEPATH)+" "+str(BGTAGONLY) + COMMAND=str(BATCHRUN)+" "+ENVFILE+" "+GENCONFIG+" "+str(outdir)+" "+str(RUNNUM)+" "+str(BASEFILENUM+FILENUM+-1)+" "+str(num)+" "+str(VERSION)+" "+str(CALIBTIME)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(BATCHSYS)+" "+str(NCORES).split(':')[-1]+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY)+" "+str(TAGSTR)+" "+str(CUSTOM_PLUGINS)+" "+str(PERFILE)+" "+str(RUNNING_DIR)+" "+str(SQLITEPATH)+" "+str(BGTAGONLY)+" "+str(RADIATOR_THICKNESS) #print COMMAND #either call MakeMC.csh or add a job depending on swif flag From dfa93da05272c1922cf19ba667acd4ab7fedab9f Mon Sep 17 00:00:00 2001 From: tbritton Date: Tue, 7 Nov 2017 09:48:07 -0500 Subject: [PATCH 03/20] update in example MC.config --- MCwrapper/examples/MC.config | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MCwrapper/examples/MC.config b/MCwrapper/examples/MC.config index aff2a2b8..580444ab 100755 --- a/MCwrapper/examples/MC.config +++ b/MCwrapper/examples/MC.config @@ -19,8 +19,9 @@ GENERATOR=generator-to-use #or you may specifile file:/.../file-to-use GENERATOR_CONFIG=config file for generator #common parameters for generators -#eBEAM_ENERGY=12 #either use =rcdb or do not set to pull the run number from the rcdb -#COHERENT_PEAK=9 #either use =rcdb or do not set to pull the run number from the rcdb +#eBEAM_ENERGY=12 #either use =rcdb or do not set to pull the value for the chosen run number from the rcdb +#RADIATOR_THICKNESS=50.e-06#either use =rcdb or do not set to pull the value for the chosen run number from the rcdb +#COHERENT_PEAK=9 #either use =rcdb or do not set to pull the value for the chosen run number from the rcdb #GEN_MIN_ENERGY=4 #GEN_MAX_ENERGY=12 From af67d45ca59335c81d0db770b4c34da9d06cacfc Mon Sep 17 00:00:00 2001 From: tbritton Date: Tue, 7 Nov 2017 11:05:58 -0500 Subject: [PATCH 04/20] fixed an issue with decimals in radiator thickness --- MCwrapper/MakeMC.csh | 4 ++-- MCwrapper/MakeMC.sh | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index 97509c12..e1bfc638 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -98,7 +98,7 @@ else set removedum = `echo $word:q | sed 's/um/ /g'` if ( $removedum != $word:q ) then - set radthick = `echo $removedum.e-6 | tr -d '[:space:]'` + set radthick = `echo $removedum\e-6 | tr -d '[:space:]'` endif endif end @@ -511,7 +511,7 @@ if ( "$GENR" != "0" ) then sed -i 's/TEMPMINE/'$GEN_MIN_ENERGY'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in else if ( "$BKGFOLDSTR" == "BeamPhotons" ) then sed -i 's/TEMPMINE/0.0012/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in - else if ( "$BKGFOLDSTR" == "DEFAULT" || "$BKGFOLDSTR" == "Random" && "$BGTAGONLY_OPTION" == "0") then + else if ( ("$BKGFOLDSTR" == "DEFAULT" || "$BKGFOLDSTR" == "Random") && "$BGTAGONLY_OPTION" == "0") then sed -i 's/BGRATE/cBGRATE/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/BGGATE/cBGGATE/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPMINE/'$GEN_MIN_ENERGY'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in diff --git a/MCwrapper/MakeMC.sh b/MCwrapper/MakeMC.sh index f43fba02..6e4ece97 100755 --- a/MCwrapper/MakeMC.sh +++ b/MCwrapper/MakeMC.sh @@ -95,7 +95,7 @@ else if [[ "$word" != "number" ]]; then removedum=`echo $word | sed 's/um/ /g'` if [[ $removedum != $word ]]; then - radthick=`echo "$removedum.e-6" | tr -d '[:space:]'` + radthick=`echo "$removedum\e-6" | tr -d '[:space:]'` fi fi done @@ -294,8 +294,7 @@ if [[ "$BKGFOLDSTR" == "DEFAULT" || "$bkgloc_pre" == "loc:" || "$BKGFOLDSTR" == runperiod="RunPeriod-2017-01" if [[ $RUN_NUMBER > 40000 ]]; then - echo - #set runperiod="RunPeriod-2017-10" + set runperiod="RunPeriod-2018-01" fi if [[ $RUN_NUMBER < 30000 ]]; then From b22fd77651c6da97e295313057f87b02eb0d7456 Mon Sep 17 00:00:00 2001 From: tbritton Date: Wed, 8 Nov 2017 09:02:03 -0500 Subject: [PATCH 05/20] BGRATE pass through while waiting for a better scheme and automation --- MCwrapper/MakeMC.csh | 6 ++++++ MCwrapper/MakeMC.sh | 9 ++++++++- MCwrapper/gluex_MC.py | 9 ++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index e1bfc638..d0360b58 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -78,12 +78,16 @@ shift setenv BGTAGONLY_OPTION $1 shift setenv RADIATOR_THICKNESS $1 +shift +setenv BGRATE $1 echo "" echo "" echo "Detected c-shell" +set BGRATE_toUse=$BGRATE + set radthick="50.e-6" if ( "$RADIATOR_THICKNESS" != "rcdb" || "$VERSION" != "mc" ) then @@ -179,6 +183,7 @@ echo "Run geant step? "$GEANT" Will be cleaned?" $CLEANGEANT echo "Using geant"$GEANTVER echo "Custom Gcontrol?" "$CUSTOM_GCONTROL" echo "Background to use: "$BKGFOLDSTR +echo "BGRATE will be set to: "$BGRATE_toUse" GHz (if applicable)" echo "Run mcsmear ? "$SMEAR" Will be cleaned?" $CLEANSMEAR echo "----------------------------------------------" echo "Run reconstruction? "$RECON" Will be cleaned?" $CLEANRECON @@ -496,6 +501,7 @@ if ( "$GENR" != "0" ) then sed -i 's/TEMPCOLD/'0.00$colsize'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPRADTHICK/'"$radthick"'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPBGTAGONLY/'$BGTAGONLY_OPTION'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/TEMPBGRATE/'$BGRATE_toUse'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in if ( "$gen_pre" == "file" ) then @ skip_num = $FILE_NUMBER * $PER_FILE diff --git a/MCwrapper/MakeMC.sh b/MCwrapper/MakeMC.sh index 6e4ece97..f8c95d7c 100755 --- a/MCwrapper/MakeMC.sh +++ b/MCwrapper/MakeMC.sh @@ -78,13 +78,16 @@ shift export BGTAGONLY_OPTION=$1 shift export RADIATOR_THICKNESS=$1 +shift +export BGRATE=$1 echo "" echo "" echo "Detected bash shell" +BGRATE_toUse=$BGRATE + radthick="50.e-6" -exponentialu=".e-6" if [[ "$RADIATOR_THICKNESS" != "rcdb" || "$VERSION" != "mc" ]]; then radthick=$RADIATOR_THICKNESS @@ -155,6 +158,7 @@ fi # PRINT INPUTS echo "Job started: " `date` +echo "sqlite path: " $SQLITEPATH echo "Producing file number: "$FILE_NUMBER echo "Containing: " $EVT_TO_GEN"/""$PER_FILE"" events" echo "Running location:" $RUNNING_DIR @@ -172,7 +176,9 @@ echo "Using "$GENERATOR" with config: "$CONFIG_FILE echo "----------------------------------------------" echo "Run geant step? "$GEANT" Will be cleaned?" $CLEANGEANT echo "Using geant"$GEANTVER +echo "Custom Gcontrol?" "$CUSTOM_GCONTROL" echo "Background to use: "$BKGFOLDSTR +echo "BGRATE will be set to: "$BGRATE_toUse" GHz (if applicable)" echo "Run mcsmear ? "$SMEAR" Will be cleaned?" $CLEANSMEAR echo "----------------------------------------------" echo "Run reconstruction? "$RECON" Will be cleaned?" $CLEANRECON @@ -487,6 +493,7 @@ if [[ "$GENR" != "0" ]]; then sed -i 's/TEMPCOLD/'0.00$colsize'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPRADTHICK/'"$radthick"'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPBGTAGONLY/'$BGTAGONLY_OPTION'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/TEMPBGRATE/'$BGRATE_toUse'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in if [[ "$gen_pre" == "file" ]]; then skip_num=$((FILE_NUMBER * PER_FILE)) diff --git a/MCwrapper/gluex_MC.py b/MCwrapper/gluex_MC.py index 2e7d941b..a05ebae6 100755 --- a/MCwrapper/gluex_MC.py +++ b/MCwrapper/gluex_MC.py @@ -196,7 +196,7 @@ def main(argv): print "*********************************" print "Welcome to v1.9.1 of the MCwrapper" - print "Thomas Britton 11/07/17" + print "Thomas Britton 11/08/17" print "*********************************" #load all argument passed in and set default options @@ -217,6 +217,7 @@ def main(argv): MIN_GEN_ENERGY="3" MAX_GEN_ENERGY="12" RADIATOR_THICKNESS="rcdb" + BGRATE=".15" #GHz BGTAGONLY="0" RUNNING_DIR="./" SQLITEPATH="no_sqlite" @@ -338,6 +339,8 @@ def main(argv): BGFOLD=bkg_parts[0] elif str(parts[0]).upper()=="EBEAM_ENERGY" : eBEAM_ENERGY=rm_comments[0].strip() + elif str(parts[0]).upper()=="BGRATE" : + BGRATE=rm_comments[0].strip() elif str(parts[0]).upper()=="COHERENT_PEAK" : COHERENT_PEAK=rm_comments[0].strip() elif str(parts[0]).upper()=="RADIATOR_THICKNESS" : @@ -559,7 +562,7 @@ def main(argv): if num_this_file == 0: continue - COMMAND=str(BATCHRUN)+" "+ENVFILE+" "+GENCONFIG+" "+str(outdir)+" "+str(runs[0])+" "+str(BASEFILENUM+FILENUM_this_run+-1)+" "+str(num_this_file)+" "+str(VERSION)+" "+str(CALIBTIME)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(BATCHSYS)+" "+str(NCORES).split(':')[-1]+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY)+" "+str(TAGSTR)+" "+str(CUSTOM_PLUGINS)+" "+str(PERFILE)+" "+str(RUNNING_DIR)+" "+str(SQLITEPATH)+" "+str(BGTAGONLY)+" "+str(RADIATOR_THICKNESS) + COMMAND=str(BATCHRUN)+" "+ENVFILE+" "+GENCONFIG+" "+str(outdir)+" "+str(runs[0])+" "+str(BASEFILENUM+FILENUM_this_run+-1)+" "+str(num_this_file)+" "+str(VERSION)+" "+str(CALIBTIME)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(BATCHSYS)+" "+str(NCORES).split(':')[-1]+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY)+" "+str(TAGSTR)+" "+str(CUSTOM_PLUGINS)+" "+str(PERFILE)+" "+str(RUNNING_DIR)+" "+str(SQLITEPATH)+" "+str(BGTAGONLY)+" "+str(RADIATOR_THICKNESS)+" "+str(BGRATE) if BATCHRUN == 0 or BATCHSYS=="NULL": #print str(runs[0])+" "+str(BASEFILENUM+FILENUM_this_run+-1)+" "+str(num_this_file) os.system(str(indir)+" "+COMMAND) @@ -582,7 +585,7 @@ def main(argv): if num == 0: continue - COMMAND=str(BATCHRUN)+" "+ENVFILE+" "+GENCONFIG+" "+str(outdir)+" "+str(RUNNUM)+" "+str(BASEFILENUM+FILENUM+-1)+" "+str(num)+" "+str(VERSION)+" "+str(CALIBTIME)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(BATCHSYS)+" "+str(NCORES).split(':')[-1]+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY)+" "+str(TAGSTR)+" "+str(CUSTOM_PLUGINS)+" "+str(PERFILE)+" "+str(RUNNING_DIR)+" "+str(SQLITEPATH)+" "+str(BGTAGONLY)+" "+str(RADIATOR_THICKNESS) + COMMAND=str(BATCHRUN)+" "+ENVFILE+" "+GENCONFIG+" "+str(outdir)+" "+str(RUNNUM)+" "+str(BASEFILENUM+FILENUM+-1)+" "+str(num)+" "+str(VERSION)+" "+str(CALIBTIME)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(BATCHSYS)+" "+str(NCORES).split(':')[-1]+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY)+" "+str(TAGSTR)+" "+str(CUSTOM_PLUGINS)+" "+str(PERFILE)+" "+str(RUNNING_DIR)+" "+str(SQLITEPATH)+" "+str(BGTAGONLY)+" "+str(RADIATOR_THICKNESS)+" "+str(BGRATE) #print COMMAND #either call MakeMC.csh or add a job depending on swif flag From 5623634fecc520cc40b3d5333f9ae52019d816cd Mon Sep 17 00:00:00 2001 From: tbritton Date: Wed, 8 Nov 2017 11:04:30 -0500 Subject: [PATCH 06/20] now supports BKG in-line BGRATE setting and sets the groundwork for automation --- MCwrapper/examples/MC.config | 2 +- MCwrapper/gluex_MC.py | 27 +++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/MCwrapper/examples/MC.config b/MCwrapper/examples/MC.config index 580444ab..eb0cca30 100755 --- a/MCwrapper/examples/MC.config +++ b/MCwrapper/examples/MC.config @@ -26,7 +26,7 @@ GENERATOR_CONFIG=config file for generator #GEN_MAX_ENERGY=12 GEANT_VERSION=3 -BKG=None #[None, BeamPhotons, DEFAULT, custom e.g bg.hddm:1.8] +BKG=None #[None, BeamPhotons, TagOnly, custom e.g bg.hddm:1.8] Can be stacked eg Random+TagOnly:.123 where the :[num] defines BGRATE #optional additional plugins that will be run along side danarest and hd_root. This should be a comma separated list (e.g. plugin1,plugin2) #CUSTOM_PLUGINS= #or file:/.../file-to-use which is a configuration file for jana/hd_root diff --git a/MCwrapper/gluex_MC.py b/MCwrapper/gluex_MC.py index a05ebae6..0221e2b2 100755 --- a/MCwrapper/gluex_MC.py +++ b/MCwrapper/gluex_MC.py @@ -328,6 +328,31 @@ def main(argv): CUSTOM_GCONTROL=rm_comments[0].strip() elif str(parts[0]).upper()=="BKG" : bkg_parts=rm_comments[0].strip().split("+") + #print bkg_parts + for part in bkg_parts: + subparts=part.split(":") + if len(subparts)>2: + print "Error in BKG Parsing: "+part + return + if subparts[0].upper() == "TAGONLY": + BGTAGONLY=1 + if len(subparts)==2: + BGRATE=subparts[1] + + elif subparts[0].upper() == "BEAMPHOTONS": + BGFOLD=subparts[0] + if len(subparts)==2: + BGRATE=subparts[1] + elif subparts[0].upper() == "RANDOM" or subparts[0].upper() == "DEFAULT": + BGFOLD=subparts[0] + else: + BGFOLD=part + + #IF BEAMPHOTONS OR TAGONLY IS IN THE LIST AND A BGRATE IS NOT SPECIFIED AND WE ARE TALKING VARIATION=mc THEN SET IT PROPERLY + #print BGFOLD + #print BGTAGONLY + #print BGRATE + #return if len(bkg_parts)>1: BGFOLD=bkg_parts[0] BGTAGONLY=1 @@ -339,8 +364,6 @@ def main(argv): BGFOLD=bkg_parts[0] elif str(parts[0]).upper()=="EBEAM_ENERGY" : eBEAM_ENERGY=rm_comments[0].strip() - elif str(parts[0]).upper()=="BGRATE" : - BGRATE=rm_comments[0].strip() elif str(parts[0]).upper()=="COHERENT_PEAK" : COHERENT_PEAK=rm_comments[0].strip() elif str(parts[0]).upper()=="RADIATOR_THICKNESS" : From 4b3a735c134740495bfd960e6c00e271f3c24fcc Mon Sep 17 00:00:00 2001 From: tbritton Date: Thu, 9 Nov 2017 10:10:02 -0500 Subject: [PATCH 07/20] fixed a bug when BeamPhotons is used with a :BGRATE --- MCwrapper/gluex_MC.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/MCwrapper/gluex_MC.py b/MCwrapper/gluex_MC.py index 0221e2b2..2dfeec25 100755 --- a/MCwrapper/gluex_MC.py +++ b/MCwrapper/gluex_MC.py @@ -196,7 +196,7 @@ def main(argv): print "*********************************" print "Welcome to v1.9.1 of the MCwrapper" - print "Thomas Britton 11/08/17" + print "Thomas Britton 11/09/17" print "*********************************" #load all argument passed in and set default options @@ -340,6 +340,7 @@ def main(argv): BGRATE=subparts[1] elif subparts[0].upper() == "BEAMPHOTONS": + #print subparts BGFOLD=subparts[0] if len(subparts)==2: BGRATE=subparts[1] @@ -353,15 +354,7 @@ def main(argv): #print BGTAGONLY #print BGRATE #return - if len(bkg_parts)>1: - BGFOLD=bkg_parts[0] - BGTAGONLY=1 - else: - if bkg_parts[0].upper()=="TAGONLY" : - BGFOLD="None" - BGTAGONLY=1 - else: - BGFOLD=bkg_parts[0] + elif str(parts[0]).upper()=="EBEAM_ENERGY" : eBEAM_ENERGY=rm_comments[0].strip() elif str(parts[0]).upper()=="COHERENT_PEAK" : From 7f3f75037cc89d6fd346f822008839f03dfdefae Mon Sep 17 00:00:00 2001 From: tbritton Date: Fri, 10 Nov 2017 09:01:25 -0500 Subject: [PATCH 08/20] Fix for bggen because of damnable fortran --- MCwrapper/MakeMC.csh | 8 +++++--- MCwrapper/MakeMC.sh | 8 +++++--- MCwrapper/gluex_MC.py | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index d0360b58..29402d6a 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -419,13 +419,15 @@ if ( "$GENR" != "0" ) then genr8_2_hddm $STANDARD_NAME.ascii else if ( "$GENERATOR" == "bggen" ) then set RANDOMnum=`bash -c 'echo $RANDOM'` - echo $RANDOMnum + echo Random Number used: $RANDOMnum sed -i 's/TEMPTRIG/'$EVT_TO_GEN'/' $STANDARD_NAME.conf sed -i 's/TEMPRUNNO/'$RUN_NUMBER'/' $STANDARD_NAME.conf sed -i 's/TEMPCOLD/'0.00$colsize'/' $STANDARD_NAME.conf sed -i 's/TEMPRAND/'$RANDOMnum'/' $STANDARD_NAME.conf - sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' $STANDARD_NAME.conf - sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' $STANDARD_NAME.conf + set Fortran_eBEAM_ENRGY=`echo $eBEAM_ENERGY | cut -c -7` + sed -i 's/TEMPELECE/'$Fortran_eBEAM_ENRGY'/' $STANDARD_NAME.conf + set Fortran_COHERENT_PEAK=`echo $COHERENT_PEAK | cut -c -7` + sed -i 's/TEMPCOHERENT/'$Fortran_COHERENT_PEAK'/' $STANDARD_NAME.conf sed -i 's/TEMPMINGENE/'$GEN_MIN_ENERGY'/' $STANDARD_NAME.conf sed -i 's/TEMPMAXGENE/'$GEN_MAX_ENERGY'/' $STANDARD_NAME.conf diff --git a/MCwrapper/MakeMC.sh b/MCwrapper/MakeMC.sh index f8c95d7c..8e69360f 100755 --- a/MCwrapper/MakeMC.sh +++ b/MCwrapper/MakeMC.sh @@ -414,13 +414,15 @@ if [[ "$GENR" != "0" ]]; then genr8_2_hddm $STANDARD_NAME.ascii elif [[ "$GENERATOR" == "bggen" ]]; then RANDOMnum=`bash -c 'echo $RANDOM'` - echo $RANDOMnum + echo "Random number used: "$RANDOMnum sed -i 's/TEMPTRIG/'$EVT_TO_GEN'/' $STANDARD_NAME.conf sed -i 's/TEMPRUNNO/'$RUN_NUMBER'/' $STANDARD_NAME.conf sed -i 's/TEMPCOLD/'0.00$colsize'/' $STANDARD_NAME.conf sed -i 's/TEMPRAND/'$RANDOMnum'/' $STANDARD_NAME.conf - sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' $STANDARD_NAME.conf - sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' $STANDARD_NAME.conf + Fortran_eBEAM_ENRGY=`echo $eBEAM_ENERGY | cut -c -7` + sed -i 's/TEMPELECE/'$Fortran_eBEAM_ENRGY'/' $STANDARD_NAME.conf + Fortran_COHERENT_PEAK=`echo $COHERENT_PEAK | cut -c -7` + sed -i 's/TEMPCOHERENT/'$Fortran_COHERENT_PEAK'/' $STANDARD_NAME.conf sed -i 's/TEMPMINGENE/'$GEN_MIN_ENERGY'/' $STANDARD_NAME.conf sed -i 's/TEMPMAXGENE/'$GEN_MAX_ENERGY'/' $STANDARD_NAME.conf diff --git a/MCwrapper/gluex_MC.py b/MCwrapper/gluex_MC.py index 2dfeec25..07b02084 100755 --- a/MCwrapper/gluex_MC.py +++ b/MCwrapper/gluex_MC.py @@ -196,7 +196,7 @@ def main(argv): print "*********************************" print "Welcome to v1.9.1 of the MCwrapper" - print "Thomas Britton 11/09/17" + print "Thomas Britton 11/10/17" print "*********************************" #load all argument passed in and set default options From 143a4ead3e500c2e719085ede480eeb44c29d7be Mon Sep 17 00:00:00 2001 From: tbritton Date: Fri, 10 Nov 2017 10:09:29 -0500 Subject: [PATCH 09/20] added some exit code errors to halt production in case expected files aren't produced --- MCwrapper/MakeMC.csh | 21 +++++++++++++++------ MCwrapper/MakeMC.sh | 14 ++++++++++++++ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index 29402d6a..d8f59c67 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -476,8 +476,11 @@ if ( "$GENR" != "0" ) then gen_2k -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 $optionals_line endif - set RETURN_CODE=$? - #echo "Return Code = " $RETURN_CODE + if ( ! -f ./$STANDARD_NAME.hddm ) then + echo "An hddm file was not found after generation step. Terminating MC production. Please consult logs to diagnose" + exit 11 + endif + #GEANT/smearing @@ -544,8 +547,11 @@ if ( "$GENR" != "0" ) then echo "INVALID GEANT VERSION" exit endif - set RETURN_CODE=$? - #echo "Return Code = " $RETURN_CODE + + if ( ! -f ./$STANDARD_NAME'_geant'$GEANTVER'.hddm' ) then + echo "An hddm file was not created by Geant. Terminating MC production. Please consult logs to diagnose" + exit 12 + endif if ( "$SMEAR" != "0" ) then echo "RUNNING MCSMEAR" @@ -573,13 +579,16 @@ if ( "$GENR" != "0" ) then rm particle.dat rm pythia.dat rm pythia-geant.map + rm bggen.his unlink fort.15 endif rm $STANDARD_NAME.hddm endif - set RETURN_CODE=$? - #echo "Return Code = " $RETURN_CODE + if ( ! -f ./$STANDARD_NAME'_geant'$GEANTVER'_smeared.hddm' ) then + echo "An hddm file was not created by mcsmear. Terminating MC production. Please consult logs to diagnose" + exit 13 + endif if ( "$RECON" != "0" ) then echo "RUNNING RECONSTRUCTION" diff --git a/MCwrapper/MakeMC.sh b/MCwrapper/MakeMC.sh index 8e69360f..e070e193 100755 --- a/MCwrapper/MakeMC.sh +++ b/MCwrapper/MakeMC.sh @@ -472,6 +472,10 @@ if [[ "$GENR" != "0" ]]; then gen_2k -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 -p $COHERENT_PEAK -m $eBEAM_ENERGY $optionals_line fi + if [[ ! -f ./$STANDARD_NAME.hddm ]]; then + echo "An hddm file was not found after generation step. Terminating MC production. Please consult logs to diagnose" + exit 11 + fi #GEANT/smearing if [[ "$GEANT" != "0" ]]; then @@ -536,6 +540,11 @@ if [[ "$GENR" != "0" ]]; then exit fi + if [[ ! -f ./$STANDARD_NAME'_geant'$GEANTVER'.hddm' ]]; then + echo "An hddm file was not created by Geant. Terminating MC production. Please consult logs to diagnose" + exit 12 + fi + if [[ "$SMEAR" != "0" ]]; then echo "RUNNING MCSMEAR" @@ -568,6 +577,11 @@ if [[ "$GENR" != "0" ]]; then rm $STANDARD_NAME.hddm fi + if [[ ! -f ./$STANDARD_NAME'_geant'$GEANTVER'_smeared.hddm' ]]; then + echo "An hddm file was not created by mcsmear. Terminating MC production. Please consult logs to diagnose" + exit 13 + fi + if [[ "$RECON" != "0" ]]; then echo "RUNNING RECONSTRUCTION" From e0c26145192d7ab4b399757d76f7a82ea4087f45 Mon Sep 17 00:00:00 2001 From: tbritton Date: Fri, 10 Nov 2017 11:50:15 -0500 Subject: [PATCH 10/20] added error codes for simple production errors --- MCwrapper/MakeMC.csh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index d8f59c67..08d1454b 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -616,8 +616,7 @@ if ( "$GENR" != "0" ) then endif - set RETURN_CODE=$? - #echo "Return Code = " $RETURN_CODE + if ( -f dana_rest.hddm ) then mv dana_rest.hddm dana_rest_$STANDARD_NAME.hddm endif From fdfd7f8869ad305525e1223ceb7014725e04991a Mon Sep 17 00:00:00 2001 From: tbritton Date: Mon, 13 Nov 2017 13:08:57 -0500 Subject: [PATCH 11/20] random number seed for geant --- MCwrapper/Gcontrol.in | 4 ++-- MCwrapper/MakeMC.csh | 2 ++ MCwrapper/MakeMC.sh | 2 ++ MCwrapper/gluex_MC.py | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/MCwrapper/Gcontrol.in b/MCwrapper/Gcontrol.in index cb2ed607..4eac49ad 100644 --- a/MCwrapper/Gcontrol.in +++ b/MCwrapper/Gcontrol.in @@ -176,7 +176,7 @@ c now ready to go. If you ever change anything in the beamline geometry c eg. the collimator diameter, the coherent edge position, or the value c of beamEmin, do not forget to come back and change your BGRATE. BGGATE -200. 200. -BGRATE 0.1273 +BGRATE TEMPBGRATE c The above cards BGRATE, BGGATE normally cause the simulation to add c accidental tagger hits to the simulated output record, in addition to @@ -228,7 +228,7 @@ c seeds. The seeds are written to the output HDDM file though so if one c uses the output file for input to another invocation of hdgeant(++) c then the same seeds will be used. You may check for seeds in the input c file using hddm-xml file.hddm | grep random . -RNDM 3 +RNDM TEMPRANDOM c The following line controls the cutoffs for tracking of particles. c CUTS cutgam cutele cutneu cuthad cutmuo bcute bcutm dcute dcutm ppcutm tofmax diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index 08d1454b..8cc934a4 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -497,6 +497,8 @@ if ( "$GENR" != "0" ) then cp temp_Gcontrol.in $PWD/control'_'$formatted_runNumber'_'$formatted_fileNumber.in chmod 777 $PWD/control'_'$formatted_runNumber'_'$formatted_fileNumber.in + set RANDOMnumGeant=`bash -c 'echo $RANDOM'` + sed -i 's/TEMPRANDOM/'$RANDOMnumGeant'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPIN/'$STANDARD_NAME.hddm'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in diff --git a/MCwrapper/MakeMC.sh b/MCwrapper/MakeMC.sh index e070e193..7d5e6960 100755 --- a/MCwrapper/MakeMC.sh +++ b/MCwrapper/MakeMC.sh @@ -490,6 +490,8 @@ if [[ "$GENR" != "0" ]]; then cp temp_Gcontrol.in $PWD/control'_'$formatted_runNumber'_'$formatted_fileNumber.in chmod 777 $PWD/control'_'$formatted_runNumber'_'$formatted_fileNumber.in + RANDOMnumGeant=`bash -c 'echo $RANDOM'` + sed -i 's/TEMPRANDOM/'$RANDOMnumGeant'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPIN/'$STANDARD_NAME.hddm'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in diff --git a/MCwrapper/gluex_MC.py b/MCwrapper/gluex_MC.py index 07b02084..7d56cea9 100755 --- a/MCwrapper/gluex_MC.py +++ b/MCwrapper/gluex_MC.py @@ -196,7 +196,7 @@ def main(argv): print "*********************************" print "Welcome to v1.9.1 of the MCwrapper" - print "Thomas Britton 11/10/17" + print "Thomas Britton 11/13/17" print "*********************************" #load all argument passed in and set default options From 4a947d95705d68d56e10d0e502885f125a1d72c2 Mon Sep 17 00:00:00 2001 From: tbritton Date: Mon, 13 Nov 2017 13:33:28 -0500 Subject: [PATCH 12/20] geant random in proper range --- MCwrapper/MakeMC.csh | 2 +- MCwrapper/MakeMC.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index 8cc934a4..31062eba 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -497,7 +497,7 @@ if ( "$GENR" != "0" ) then cp temp_Gcontrol.in $PWD/control'_'$formatted_runNumber'_'$formatted_fileNumber.in chmod 777 $PWD/control'_'$formatted_runNumber'_'$formatted_fileNumber.in - set RANDOMnumGeant=`bash -c 'echo $RANDOM'` + set RANDOMnumGeant=`shuf -i1-215 -n1` sed -i 's/TEMPRANDOM/'$RANDOMnumGeant'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in diff --git a/MCwrapper/MakeMC.sh b/MCwrapper/MakeMC.sh index 7d5e6960..5333df1f 100755 --- a/MCwrapper/MakeMC.sh +++ b/MCwrapper/MakeMC.sh @@ -490,7 +490,7 @@ if [[ "$GENR" != "0" ]]; then cp temp_Gcontrol.in $PWD/control'_'$formatted_runNumber'_'$formatted_fileNumber.in chmod 777 $PWD/control'_'$formatted_runNumber'_'$formatted_fileNumber.in - RANDOMnumGeant=`bash -c 'echo $RANDOM'` + RANDOMnumGeant=`shuf -i1-215 -n1` sed -i 's/TEMPRANDOM/'$RANDOMnumGeant'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in From fb1c844ece2edac5e3839a40261008d7b731afb5 Mon Sep 17 00:00:00 2001 From: tbritton Date: Mon, 13 Nov 2017 16:27:30 -0500 Subject: [PATCH 13/20] better SQLITE integration for ccdb --- MCwrapper/MakeMC.csh | 2 +- MCwrapper/MakeMC.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index 31062eba..bce613ec 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -212,7 +212,7 @@ if ( "$BATCHRUN" != "0" ) then echo $ENVIRONMENT if ( "$SQLITEPATH" != "no_sqlite" ) then - cp $SQLITEPATH . + cp $SQLITEPATH ./ccdb.sqlite setenv CCDB_CONNECTION sqlite:///$RUNNING_DIR/ccdb.sqlite setenv JANA_CALIB_URL ${CCDB_CONNECTION} endif diff --git a/MCwrapper/MakeMC.sh b/MCwrapper/MakeMC.sh index 5333df1f..5fd71cb1 100755 --- a/MCwrapper/MakeMC.sh +++ b/MCwrapper/MakeMC.sh @@ -209,7 +209,7 @@ if [[ "$BATCHRUN" != "0" ]]; then fi if [[ "$SQLITEPATH" != "no_sqlite" ]]; then - cp $SQLITEPATH . + cp $SQLITEPATH ./ccdb.sqlite export CCDB_CONNECTION sqlite:///$RUNNING_DIR/ccdb.sqlite export JANA_CALIB_URL $CCDB_CONNECTION fi From 8956456e21f9b959db0aacc70d307e10ac18e52b Mon Sep 17 00:00:00 2001 From: tbritton Date: Tue, 14 Nov 2017 10:01:32 -0500 Subject: [PATCH 14/20] switched electron beam energy to ccdb enpoint energy. Fixed a tiny typo in rad thickness --- MCwrapper/MakeMC.csh | 15 ++++++++++++--- MCwrapper/MakeMC.sh | 18 +++++++++++++++--- MCwrapper/gluex_MC.py | 2 +- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index bce613ec..6f6e7c82 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -102,7 +102,7 @@ else set removedum = `echo $word:q | sed 's/um/ /g'` if ( $removedum != $word:q ) then - set radthick = `echo $removedum\e-6 | tr -d '[:space:]'` + set radthick = `echo $removedum e-6 | tr -d '[:space:]'` endif endif end @@ -112,7 +112,16 @@ set polarization_angle = `rcnd $RUN_NUMBER polarization_angle | awk '{print $1}' echo polarization angle: $polarization_angle set elecE = 0 -set elecE_text = `rcnd $RUN_NUMBER beam_energy | awk '{print $1}'` +set variation= $VERSION +if ( $CALIBTIME != "notime" ) then +set variation=$variation+":"+$CALIBTIME +endif + +set ccdbelece=`ccdb dump PHOTON_BEAM/endpoint_energy:${RUN_NUMBER}:${variation}` + +set ccdblist=($ccdbelece:as/ / /) +set elecE_text=$ccdblist[$#ccdblist] +#set elecE_text = `rcnd $RUN_NUMBER beam_energy | awk '{print $1}'` #echo "text: " $elecE_text @@ -123,7 +132,7 @@ else if ( $elecE_text == "Run" ) then else if ( $elecE_text == "-1.0" ) then set elecE=12 #Should never happen else - set elecE = `echo "$elecE_text / 1000" | bc -l ` + set elecE=`echo $elecE_text` #set elecE = `echo "$elecE_text / 1000" | bc -l ` #rcdb method endif set copeak = 0 diff --git a/MCwrapper/MakeMC.sh b/MCwrapper/MakeMC.sh index 5fd71cb1..dba1a57f 100755 --- a/MCwrapper/MakeMC.sh +++ b/MCwrapper/MakeMC.sh @@ -98,7 +98,7 @@ else if [[ "$word" != "number" ]]; then removedum=`echo $word | sed 's/um/ /g'` if [[ $removedum != $word ]]; then - radthick=`echo "$removedum\e-6" | tr -d '[:space:]'` + radthick=`echo "$removedum e-6" | tr -d '[:space:]'` fi fi done @@ -108,7 +108,18 @@ polarization_angle=`rcnd $RUN_NUMBER polarization_angle | awk '{print $1}'` echo polarization angle: $polarization_angle elecE=0 -elecE_text=`rcnd $RUN_NUMBER beam_energy | awk '{print $1}'` + +variation=$VERSION +if [[ $CALIBTIME != "notime" ]]; then + variation=$variation+":"+$CALIBTIME +fi + +ccdbelece="`ccdb dump PHOTON_BEAM/endpoint_energy:${RUN_NUMBER}:${variation}`" + +ccdblist=(`echo ${ccdbelece}`) #(${ccdbelece:/\ /\ /}) +ccdblist_length=${#ccdblist[@]} +elecE_text=`echo ${ccdblist[$(($ccdblist_length-1))]}` +#elecE_text=`rcnd $RUN_NUMBER beam_energy | awk '{print $1}'` if [[ "$eBEAM_ENERGY" != "rcdb" || "$VERSION" != "mc" ]]; then elecE=$eBEAM_ENERGY @@ -117,7 +128,8 @@ elif [[ $elecE_text == "Run" ]]; then elif [[ $elecE_text == "-1.0" ]]; then elecE=12 #Should never happen else - elecE=`echo "$elecE_text / 1000" | bc -l ` + elecE=`echo $elecE_text` + #elecE=`echo "$elecE_text / 1000" | bc -l ` fi copeak=0 diff --git a/MCwrapper/gluex_MC.py b/MCwrapper/gluex_MC.py index 7d56cea9..b8648a85 100755 --- a/MCwrapper/gluex_MC.py +++ b/MCwrapper/gluex_MC.py @@ -196,7 +196,7 @@ def main(argv): print "*********************************" print "Welcome to v1.9.1 of the MCwrapper" - print "Thomas Britton 11/13/17" + print "Thomas Britton 11/14/17" print "*********************************" #load all argument passed in and set default options From ef51ce297075c73429c54202ac54f313deab89c0 Mon Sep 17 00:00:00 2001 From: tbritton Date: Thu, 16 Nov 2017 13:49:43 -0500 Subject: [PATCH 15/20] added bggen_jpsi --- .../examples/bggen_jpsi_config.template | 78 +++++++++++++++++++ MCwrapper/Generators/bggen_jpsi/particle.dat | 21 +++++ .../Generators/bggen_jpsi/pythia-geant.map | 40 ++++++++++ MCwrapper/Generators/bggen_jpsi/pythia.dat | 53 +++++++++++++ MCwrapper/MakeMC.csh | 29 ++++++- MCwrapper/MakeMC.sh | 33 +++++++- 6 files changed, 249 insertions(+), 5 deletions(-) create mode 100644 MCwrapper/Generators/bggen_jpsi/examples/bggen_jpsi_config.template create mode 100644 MCwrapper/Generators/bggen_jpsi/particle.dat create mode 100644 MCwrapper/Generators/bggen_jpsi/pythia-geant.map create mode 100644 MCwrapper/Generators/bggen_jpsi/pythia.dat diff --git a/MCwrapper/Generators/bggen_jpsi/examples/bggen_jpsi_config.template b/MCwrapper/Generators/bggen_jpsi/examples/bggen_jpsi_config.template new file mode 100644 index 00000000..ad84d7f1 --- /dev/null +++ b/MCwrapper/Generators/bggen_jpsi/examples/bggen_jpsi_config.template @@ -0,0 +1,78 @@ +LIST +C +C === INPUT file for BGGEN +C +SIMUL 1 +C =0 - BG, =1 - J/psi +C +TRIG TEMPTRIG number of events to simulate +C TRIG 395000 number of events to simulate +C We expect 395kHz of hadronic rate at high luminosity +C -- writing out events +C HDDM simple ntuple +WROUT 1 0 1 + +NPRIEV 10 number of events to print +EPHLIM TEMPMINGENE TEMPMAXGENE energy range in GeV + +RNDMSEQ TEMPRAND random number sequence integer values + +EELEC TEMPELECE electron beam energy +EPEAK TEMPCOHERENT coherent peak energy +ZCOLLIM 7600. distance to the collimator in cm + +EPYTHMIN 3. minimal energy for PYTHIA simulation + +PARTINIT 1 14 GEANT types of the initial particles +C reac - J/psi: gamma p -> p J/psi tslope e1 e2 np cross section in nb +REACPAR 14 83 1.0 8.2300 13.0000 478 + 0.4296E-07 0.3736E-06 0.1191E-05 0.2656E-05 0.4915E-05 0.8112E-05 0.1239E-04 0.1787E-04 0.2472E-04 0.3306E-04 + 0.4303E-04 0.5477E-04 0.6843E-04 0.8414E-04 0.1020E-03 0.1223E-03 0.1450E-03 0.1704E-03 0.1985E-03 0.2295E-03 + 0.2635E-03 0.3008E-03 0.3414E-03 0.3855E-03 0.4332E-03 0.4847E-03 0.5401E-03 0.5996E-03 0.6633E-03 0.7313E-03 + 0.8038E-03 0.8810E-03 0.9629E-03 0.1050E-02 0.1142E-02 0.1239E-02 0.1341E-02 0.1449E-02 0.1563E-02 0.1682E-02 + 0.1807E-02 0.1938E-02 0.2076E-02 0.2219E-02 0.2370E-02 0.2526E-02 0.2690E-02 0.2860E-02 0.3037E-02 0.3221E-02 + 0.3413E-02 0.3612E-02 0.3818E-02 0.4032E-02 0.4254E-02 0.4483E-02 0.4721E-02 0.4966E-02 0.5220E-02 0.5482E-02 + 0.5753E-02 0.6032E-02 0.6320E-02 0.6616E-02 0.6922E-02 0.7236E-02 0.7560E-02 0.7893E-02 0.8235E-02 0.8587E-02 + 0.8948E-02 0.9319E-02 0.9699E-02 0.1009E-01 0.1049E-01 0.1090E-01 0.1132E-01 0.1175E-01 0.1219E-01 0.1265E-01 + 0.1311E-01 0.1358E-01 0.1406E-01 0.1456E-01 0.1506E-01 0.1558E-01 0.1611E-01 0.1665E-01 0.1720E-01 0.1776E-01 + 0.1833E-01 0.1891E-01 0.1951E-01 0.2011E-01 0.2073E-01 0.2136E-01 0.2201E-01 0.2266E-01 0.2333E-01 0.2401E-01 + 0.2470E-01 0.2540E-01 0.2611E-01 0.2684E-01 0.2758E-01 0.2833E-01 0.2910E-01 0.2987E-01 0.3066E-01 0.3146E-01 + 0.3228E-01 0.3311E-01 0.3395E-01 0.3480E-01 0.3567E-01 0.3655E-01 0.3744E-01 0.3834E-01 0.3926E-01 0.4019E-01 + 0.4114E-01 0.4210E-01 0.4307E-01 0.4405E-01 0.4505E-01 0.4606E-01 0.4709E-01 0.4813E-01 0.4918E-01 0.5024E-01 + 0.5132E-01 0.5241E-01 0.5352E-01 0.5464E-01 0.5577E-01 0.5692E-01 0.5808E-01 0.5926E-01 0.6045E-01 0.6165E-01 + 0.6286E-01 0.6409E-01 0.6534E-01 0.6660E-01 0.6787E-01 0.6916E-01 0.7046E-01 0.7177E-01 0.7310E-01 0.7444E-01 + 0.7580E-01 0.7717E-01 0.7855E-01 0.7995E-01 0.8136E-01 0.8279E-01 0.8423E-01 0.8568E-01 0.8715E-01 0.8863E-01 + 0.9013E-01 0.9164E-01 0.9317E-01 0.9471E-01 0.9626E-01 0.9783E-01 0.9941E-01 0.1010E+00 0.1026E+00 0.1042E+00 + 0.1059E+00 0.1075E+00 0.1092E+00 0.1109E+00 0.1126E+00 0.1143E+00 0.1160E+00 0.1178E+00 0.1195E+00 0.1213E+00 + 0.1231E+00 0.1248E+00 0.1267E+00 0.1285E+00 0.1303E+00 0.1322E+00 0.1340E+00 0.1359E+00 0.1378E+00 0.1397E+00 + 0.1416E+00 0.1436E+00 0.1455E+00 0.1475E+00 0.1495E+00 0.1514E+00 0.1535E+00 0.1555E+00 0.1575E+00 0.1596E+00 + 0.1616E+00 0.1637E+00 0.1658E+00 0.1679E+00 0.1700E+00 0.1721E+00 0.1743E+00 0.1764E+00 0.1786E+00 0.1808E+00 + 0.1830E+00 0.1852E+00 0.1874E+00 0.1897E+00 0.1919E+00 0.1942E+00 0.1965E+00 0.1987E+00 0.2011E+00 0.2034E+00 + 0.2057E+00 0.2081E+00 0.2104E+00 0.2128E+00 0.2152E+00 0.2176E+00 0.2200E+00 0.2224E+00 0.2249E+00 0.2273E+00 + 0.2298E+00 0.2323E+00 0.2348E+00 0.2373E+00 0.2398E+00 0.2423E+00 0.2449E+00 0.2474E+00 0.2500E+00 0.2526E+00 + 0.2552E+00 0.2578E+00 0.2604E+00 0.2630E+00 0.2657E+00 0.2683E+00 0.2710E+00 0.2737E+00 0.2764E+00 0.2791E+00 + 0.2818E+00 0.2846E+00 0.2873E+00 0.2901E+00 0.2929E+00 0.2956E+00 0.2984E+00 0.3013E+00 0.3041E+00 0.3069E+00 + 0.3098E+00 0.3126E+00 0.3155E+00 0.3184E+00 0.3213E+00 0.3242E+00 0.3271E+00 0.3300E+00 0.3330E+00 0.3359E+00 + 0.3389E+00 0.3419E+00 0.3449E+00 0.3479E+00 0.3509E+00 0.3539E+00 0.3570E+00 0.3600E+00 0.3631E+00 0.3661E+00 + 0.3692E+00 0.3723E+00 0.3754E+00 0.3785E+00 0.3817E+00 0.3848E+00 0.3880E+00 0.3911E+00 0.3943E+00 0.3975E+00 + 0.4007E+00 0.4039E+00 0.4071E+00 0.4103E+00 0.4136E+00 0.4168E+00 0.4201E+00 0.4234E+00 0.4266E+00 0.4299E+00 + 0.4332E+00 0.4366E+00 0.4399E+00 0.4432E+00 0.4466E+00 0.4499E+00 0.4533E+00 0.4567E+00 0.4601E+00 0.4635E+00 + 0.4669E+00 0.4703E+00 0.4737E+00 0.4772E+00 0.4806E+00 0.4841E+00 0.4875E+00 0.4910E+00 0.4945E+00 0.4980E+00 + 0.5015E+00 0.5050E+00 0.5086E+00 0.5121E+00 0.5156E+00 0.5192E+00 0.5228E+00 0.5264E+00 0.5299E+00 0.5335E+00 + 0.5371E+00 0.5408E+00 0.5444E+00 0.5480E+00 0.5517E+00 0.5553E+00 0.5590E+00 0.5627E+00 0.5663E+00 0.5700E+00 + 0.5737E+00 0.5774E+00 0.5812E+00 0.5849E+00 0.5886E+00 0.5924E+00 0.5961E+00 0.5999E+00 0.6036E+00 0.6074E+00 + 0.6112E+00 0.6150E+00 0.6188E+00 0.6226E+00 0.6264E+00 0.6303E+00 0.6341E+00 0.6380E+00 0.6418E+00 0.6457E+00 + 0.6496E+00 0.6534E+00 0.6573E+00 0.6612E+00 0.6651E+00 0.6690E+00 0.6730E+00 0.6769E+00 0.6808E+00 0.6848E+00 + 0.6887E+00 0.6927E+00 0.6967E+00 0.7006E+00 0.7046E+00 0.7086E+00 0.7126E+00 0.7166E+00 0.7206E+00 0.7247E+00 + 0.7287E+00 0.7327E+00 0.7368E+00 0.7408E+00 0.7449E+00 0.7490E+00 0.7530E+00 0.7571E+00 0.7612E+00 0.7653E+00 + 0.7694E+00 0.7735E+00 0.7776E+00 0.7818E+00 0.7859E+00 0.7900E+00 0.7942E+00 0.7983E+00 0.8025E+00 0.8067E+00 + 0.8108E+00 0.8150E+00 0.8192E+00 0.8234E+00 0.8276E+00 0.8318E+00 0.8360E+00 0.8402E+00 0.8445E+00 0.8487E+00 + 0.8529E+00 0.8572E+00 0.8614E+00 0.8657E+00 0.8700E+00 0.8742E+00 0.8785E+00 0.8828E+00 0.8871E+00 0.8914E+00 + 0.8957E+00 0.9000E+00 0.9043E+00 0.9086E+00 0.9129E+00 0.9173E+00 0.9216E+00 0.9259E+00 0.9303E+00 0.9347E+00 + 0.9390E+00 0.9434E+00 0.9478E+00 0.9521E+00 0.9565E+00 0.9609E+00 0.9653E+00 0.9697E+00 0.9741E+00 0.9785E+00 + 0.9829E+00 0.9874E+00 0.9918E+00 0.9962E+00 0.1001E+01 0.1005E+01 0.1010E+01 0.1014E+01 0.1018E+01 0.1023E+01 + 0.1027E+01 0.1032E+01 0.1036E+01 0.1041E+01 0.1045E+01 0.1050E+01 0.1054E+01 0.1059E+01 0.1063E+01 0.1068E+01 + 0.1072E+01 0.1077E+01 0.1081E+01 0.1086E+01 0.1090E+01 0.1095E+01 0.1100E+01 0.1104E+01 0.1109E+01 0.1113E+01 + 0.1118E+01 0.1122E+01 0.1127E+01 0.1131E+01 0.1136E+01 0.1141E+01 0.1145E+01 0.1150E+01 + +STOP \ No newline at end of file diff --git a/MCwrapper/Generators/bggen_jpsi/particle.dat b/MCwrapper/Generators/bggen_jpsi/particle.dat new file mode 100644 index 00000000..309fc4b5 --- /dev/null +++ b/MCwrapper/Generators/bggen_jpsi/particle.dat @@ -0,0 +1,21 @@ +* # mass width decay prod decay angle + 1 0.0 0. 0 0 0 0 + 2 0.000511 0. 0 0 0 0 + 3 0.000511 0. 0 0 0 0 + 4 0.0 0. 0 0 0 0 + 5 0.1057 0. 0 0 0 0 + 6 0.1057 0. 0 0 0 0 + 7 0.1350 0. 0 0 0 0 + 8 0.1396 0. 0 0 0 0 + 9 0.1396 0. 0 0 0 0 + 13 0.9396 0. 0 0 0 0 + 14 0.9383 0. 0 0 0 0 + 17 0.5475 0. 0 0 0 0 + 33 0.782 0. 0 0 0 0 + 34 1.0194 0. 0 0 0 0 + 35 0.9578 0. 0 0 0 0 + 42 0.7755 0. 0 0 0 0 + 43 0.7755 0. 0 0 0 0 + 44 0.7755 0. 0 0 0 0 + 80 0.7755 0.151 9 8 0 1 + 82 1.232 0.118 14 8 0 0 diff --git a/MCwrapper/Generators/bggen_jpsi/pythia-geant.map b/MCwrapper/Generators/bggen_jpsi/pythia-geant.map new file mode 100644 index 00000000..f59e599a --- /dev/null +++ b/MCwrapper/Generators/bggen_jpsi/pythia-geant.map @@ -0,0 +1,40 @@ +! GEANT --> PYTHIA map +! GEANT type= id >0 (regular) - PYTHIA decays are forbidden +! type=-id PYTHIA decays are allowed +! GEANT PYTHIA Comment +! type KF + 1 22 ! gamma + 2 -11 ! e+ + 3 11 ! e- + 4 12 ! neutrino + 5 -13 ! mu+ + 6 13 ! mu- + 7 111 ! pi0 + 8 211 ! pi+ + 9 -211 ! pi- + 10 130 ! K0L + 11 321 ! K+ + 12 -321 ! K- + 13 2112 ! neutron + 14 2212 ! proton + 15 -2212 ! antiproton + 16 310 ! K0S + 17 221 ! eta + 18 3122 ! Lambda0 + 19 3222 ! Sigma+ + 20 3212 ! Sigma0 + 21 3112 ! Sigma- + 22 3322 ! Xi0 + 23 3312 ! Xi- + 24 3334 ! Omega- + 25 -2112 ! antineutron + 26 -3122 ! antiLambda0 + 27 -3112 ! antiSigma- + 28 -3212 ! antiSigma0 + 29 -3222 ! antiSigma+ + 30 -3322 ! antiXi0 + 31 -3312 ! antiXi+ + 32 -3334 ! antiOmega+ +-80 113 ! rho 0 +-81 223 ! omega0 +-82 2224 ! Delta++ diff --git a/MCwrapper/Generators/bggen_jpsi/pythia.dat b/MCwrapper/Generators/bggen_jpsi/pythia.dat new file mode 100644 index 00000000..cc236976 --- /dev/null +++ b/MCwrapper/Generators/bggen_jpsi/pythia.dat @@ -0,0 +1,53 @@ +! below follows commands sent to PYGIVE +msel=2 +MSTP(13)=2 +! MSTP(17)=6 +! MSTP(20)=4 +MSTP(20)=0 +! MSTP(38)=4 +! MSTP(51)=11 ! if pdflib is linked than non pythia-pdfs are available, +! like MSTP(51)=4046 +MSTP(58)=4 +! MSTP(61)=0 +! MSTP(71)=0 +! MSTP(81)=0 +! MSTP(82)=1 +MSTP(92)=4 +MSTP(101)=1 +MSTP(121)=1 +! ----------- Now all the PARPs ----------- +! PARP(2)=3.5 ! ecm, E_gamma =6.06 GeV +PARP(2)=2.54739 ! ecm, E_gamma =3.00 GeV +PARP(18)=0.17 +PARP(89)=1000 +PARP(91)=0.40 +PARP(93)=2. +PARP(99)=0.40 +PARP(102)=0.5 +PARP(103)=0.5 +PARP(104)=0.3 +PARP(111)=0. +PARP(121)=2. +PARP(161)=3.00 +PARP(162)=24.6 +PARP(165)=0.47679 +PARP(166)=0.67597 +! ----------- Now come all the switches for Jetset ----------- +PARJ(1)=0.029 +PARJ(2)=0.283 +PARJ(3)=1.20 +PARJ(21)= 0.40 +PARJ(23)=0.03 +PARJ(41)= 1.94 +PARJ(42)= 0.544 +PARJ(45 )= 1.05 +!---------------------------------------------------------------------- +MSTJ(12)=1 +MSTJ(45)=4 +MSTU(112)=4 +MSTU(113)=4 +MSTU(114)=4 +! ----------- Now all the CKINs for pythia ----------- +CKIN(1)=1. +CKIN(66)=100.0 ! Max for Q^2 + diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index 6f6e7c82..f58f1578 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -350,7 +350,7 @@ set gen_pre="" if ( "$GENR" != "0" ) then set gen_pre=`echo $GENERATOR | cut -c1-4` - 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" ) then + 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" ) then echo "NO VALID GENERATOR GIVEN" echo "only [genr8, bggen, genEtaRegge, gen_2pi_amp, gen_pi0, gen_omega_3pi, gen_2k] are supported" exit @@ -412,6 +412,13 @@ if ( "$GENR" != "0" ) then echo "configuring gen_2k" set STANDARD_NAME="gen_2k_"$STANDARD_NAME cp $CONFIG_FILE ./$STANDARD_NAME.conf + else if ( "$GENERATOR" == "bggen_jpsi" ) then + echo "configuring bggen_jpsi" + set STANDARD_NAME="bggen_jpsi_"$STANDARD_NAME + cp $MCWRAPPER_CENTRAL/Generators/bggen_jpsi/particle.dat ./ + cp $MCWRAPPER_CENTRAL/Generators/bggen_jpsi/pythia.dat ./ + cp $MCWRAPPER_CENTRAL/Generators/bggen_jpsi/pythia-geant.map ./ + cp $CONFIG_FILE ./$STANDARD_NAME.conf endif if ( "$gen_pre" != "file" ) then @@ -483,6 +490,23 @@ if ( "$GENR" != "0" ) then echo $optionals_line echo gen_2k -c $STANDARD_NAME.conf -o $STANDARD_NAME.hddm -hd $STANDARD_NAME.root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY -b $GEN_MAX_ENERGY -m $eBEAM_ENERGY $optionals_line gen_2k -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 $optionals_line + else if ( "$GENERATOR" == "bggen_jpsi" ) then + set RANDOMnum=`bash -c 'echo $RANDOM'` + echo Random Number used: $RANDOMnum + sed -i 's/TEMPTRIG/'$EVT_TO_GEN'/' $STANDARD_NAME.conf + sed -i 's/TEMPRUNNO/'$RUN_NUMBER'/' $STANDARD_NAME.conf + sed -i 's/TEMPCOLD/'0.00$colsize'/' $STANDARD_NAME.conf + sed -i 's/TEMPRAND/'$RANDOMnum'/' $STANDARD_NAME.conf + set Fortran_eBEAM_ENRGY=`echo $eBEAM_ENERGY | cut -c -7` + sed -i 's/TEMPELECE/'$Fortran_eBEAM_ENRGY'/' $STANDARD_NAME.conf + set Fortran_COHERENT_PEAK=`echo $COHERENT_PEAK | cut -c -7` + sed -i 's/TEMPCOHERENT/'$Fortran_COHERENT_PEAK'/' $STANDARD_NAME.conf + sed -i 's/TEMPMINGENE/'$GEN_MIN_ENERGY'/' $STANDARD_NAME.conf + sed -i 's/TEMPMAXGENE/'$GEN_MAX_ENERGY'/' $STANDARD_NAME.conf + + ln -s $STANDARD_NAME.conf fort.15 + bggen_jpsi + mv bggen.hddm $STANDARD_NAME.hddm endif if ( ! -f ./$STANDARD_NAME.hddm ) then @@ -586,11 +610,12 @@ if ( "$GENR" != "0" ) then if ( "$CLEANGENR" == "1" ) then if ( "$GENERATOR" == "genr8" ) then rm *.ascii - else if ( "$GENERATOR" == "bggen" ) then + else if ( "$GENERATOR" == "bggen" || "$GENERATOR" == "bggen_jpsi" ) then rm particle.dat rm pythia.dat rm pythia-geant.map rm bggen.his + rm -f bggen.nt unlink fort.15 endif rm $STANDARD_NAME.hddm diff --git a/MCwrapper/MakeMC.sh b/MCwrapper/MakeMC.sh index dba1a57f..357a409b 100755 --- a/MCwrapper/MakeMC.sh +++ b/MCwrapper/MakeMC.sh @@ -347,7 +347,7 @@ gen_pre="" if [[ "$GENR" != "0" ]]; then gen_pre=`echo $GENERATOR | cut -c1-4` - 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" ]]; then + 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" ]]; then echo "NO VALID GENERATOR GIVEN" echo "only [genr8, bggen, genEtaRegge, gen_2pi_amp, gen_pi0, gen_omega_3pi, gen_2k] are supported" exit @@ -410,6 +410,13 @@ if [[ "$GENR" != "0" ]]; then echo "configuring gen_2k" set STANDARD_NAME="gen_2k_"$STANDARD_NAME cp $CONFIG_FILE ./$STANDARD_NAME.conf + elif [[ "$GENERATOR" == "bggen_jpsi" ]]; then + echo "configuring bggen_jpsi" + set STANDARD_NAME="bggen_jpsi_"$STANDARD_NAME + cp $MCWRAPPER_CENTRAL/Generators/bggen_jpsi/particle.dat ./ + cp $MCWRAPPER_CENTRAL/Generators/bggen_jpsi/pythia.dat ./ + cp $MCWRAPPER_CENTRAL/Generators/bggen_jpsi/pythia-geant.map ./ + cp $CONFIG_FILE ./$STANDARD_NAME.conf fi if [[ "$gen_pre" != "file" ]]; then @@ -417,6 +424,8 @@ if [[ "$GENR" != "0" ]]; then echo $config_file_name fi + #RANDOMnum_forGeneration=`bash -c 'echo $RANDOM'` + if [[ "$GENERATOR" == "genr8" ]]; then echo "RUNNING GENR8" RUNNUM=$formatted_runNumber+$formatted_fileNumber @@ -455,7 +464,7 @@ if [[ "$GENR" != "0" ]]; then echo "RUNNING GEN_2PI_AMP" optionals_line=`head -n 1 $STANDARD_NAME.conf | sed -r 's/.//'` echo $optionals_line - #RANDOMnum=`bash -c 'echo $RANDOM'` + echo gen_2pi_amp -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 -p $COHERENT_PEAK -m $eBEAM_ENERGY $optionals_line gen_2pi_amp -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 -p $COHERENT_PEAK -m $eBEAM_ENERGY $optionals_line elif [[ "$GENERATOR" == "gen_omega_3pi" ]]; then @@ -482,6 +491,23 @@ if [[ "$GENR" != "0" ]]; then echo $optionals_line echo gen_2k -c $STANDARD_NAME.conf -o $STANDARD_NAME.hddm -hd $STANDARD_NAME.root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY -b $GEN_MAX_ENERGY -p $COHERENT_PEAK -m $eBEAM_ENERGY $optionals_line gen_2k -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 -p $COHERENT_PEAK -m $eBEAM_ENERGY $optionals_line + elif [[ "$GENERATOR" == "bggen" ]]; then + RANDOMnum=`bash -c 'echo $RANDOM'` + echo "Random number used: "$RANDOMnum + sed -i 's/TEMPTRIG/'$EVT_TO_GEN'/' $STANDARD_NAME.conf + sed -i 's/TEMPRUNNO/'$RUN_NUMBER'/' $STANDARD_NAME.conf + sed -i 's/TEMPCOLD/'0.00$colsize'/' $STANDARD_NAME.conf + sed -i 's/TEMPRAND/'$RANDOMnum'/' $STANDARD_NAME.conf + Fortran_eBEAM_ENRGY=`echo $eBEAM_ENERGY | cut -c -7` + sed -i 's/TEMPELECE/'$Fortran_eBEAM_ENRGY'/' $STANDARD_NAME.conf + Fortran_COHERENT_PEAK=`echo $COHERENT_PEAK | cut -c -7` + sed -i 's/TEMPCOHERENT/'$Fortran_COHERENT_PEAK'/' $STANDARD_NAME.conf + sed -i 's/TEMPMINGENE/'$GEN_MIN_ENERGY'/' $STANDARD_NAME.conf + sed -i 's/TEMPMAXGENE/'$GEN_MAX_ENERGY'/' $STANDARD_NAME.conf + + ln -s $STANDARD_NAME.conf fort.15 + bggen_jpsi + mv bggen_jpsi.hddm $STANDARD_NAME.hddm fi if [[ ! -f ./$STANDARD_NAME.hddm ]]; then @@ -581,10 +607,11 @@ if [[ "$GENR" != "0" ]]; then if [[ "$CLEANGENR" == "1" ]]; then if [[ "$GENERATOR" == "genr8" ]]; then rm *.ascii - elif [[ "$GENERATOR" == "bggen" ]]; then + elif [[ "$GENERATOR" == "bggen" || "$GENERATOR" == "bggen" ]]; then rm particle.dat rm pythia.dat rm pythia-geant.map + rm -f bggen.nt unlink fort.15 fi From 308a6961497426c6bc72dd4e3853836d2937bf05 Mon Sep 17 00:00:00 2001 From: tbritton Date: Thu, 16 Nov 2017 15:20:58 -0500 Subject: [PATCH 16/20] added in a non working gen_ee. both new gens untested on bash atm --- .../examples/bggen_jpsi_config.template | 4 ++++ MCwrapper/MakeMC.csh | 16 ++++++++++++++-- MCwrapper/MakeMC.sh | 15 +++++++++++++-- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/MCwrapper/Generators/bggen_jpsi/examples/bggen_jpsi_config.template b/MCwrapper/Generators/bggen_jpsi/examples/bggen_jpsi_config.template index ad84d7f1..1f476c70 100644 --- a/MCwrapper/Generators/bggen_jpsi/examples/bggen_jpsi_config.template +++ b/MCwrapper/Generators/bggen_jpsi/examples/bggen_jpsi_config.template @@ -8,6 +8,9 @@ C TRIG TEMPTRIG number of events to simulate C TRIG 395000 number of events to simulate C We expect 395kHz of hadronic rate at high luminosity +C +C +RUNNO TEMPRUNNO run number of generated events, default is two C -- writing out events C HDDM simple ntuple WROUT 1 0 1 @@ -20,6 +23,7 @@ RNDMSEQ TEMPRAND random number sequence integer values EELEC TEMPELECE electron beam energy EPEAK TEMPCOHERENT coherent peak energy ZCOLLIM 7600. distance to the collimator in cm +DCOLLIM TEMPCOLD collimator diameter in m EPYTHMIN 3. minimal energy for PYTHIA simulation diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index f58f1578..1a791228 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -350,9 +350,9 @@ set gen_pre="" if ( "$GENR" != "0" ) then set gen_pre=`echo $GENERATOR | cut -c1-4` - 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" ) then + 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" ) then echo "NO VALID GENERATOR GIVEN" - echo "only [genr8, bggen, genEtaRegge, gen_2pi_amp, gen_pi0, gen_omega_3pi, gen_2k] are supported" + echo "only [genr8, bggen, genEtaRegge, gen_2pi_amp, gen_pi0, gen_omega_3pi, gen_2k, bggen_jpsi, gen_ee] are supported" exit endif @@ -370,6 +370,8 @@ if ( "$GENR" != "0" ) then else if ( -f $CONFIG_FILE ) then echo "input file found" + else if( "$GENERATOR" == "gen_ee" ) then + echo "Config file not applicable" else echo $CONFIG_FILE" does not exist" exit @@ -419,6 +421,10 @@ if ( "$GENR" != "0" ) then cp $MCWRAPPER_CENTRAL/Generators/bggen_jpsi/pythia.dat ./ cp $MCWRAPPER_CENTRAL/Generators/bggen_jpsi/pythia-geant.map ./ cp $CONFIG_FILE ./$STANDARD_NAME.conf + else if ( "$GENERATOR" == "gen_ee" ) then + echo "configuring gen_ee" + set STANDARD_NAME="gen_ee_"$STANDARD_NAME + echo "note: this generator is run completely from command line, thus no config file will be made and/or modified" endif if ( "$gen_pre" != "file" ) then @@ -507,6 +513,12 @@ if ( "$GENR" != "0" ) then ln -s $STANDARD_NAME.conf fort.15 bggen_jpsi mv bggen.hddm $STANDARD_NAME.hddm + else if ( "$GENERATOR" == "gen_ee" ) then + set RANDOMnum=`bash -c 'echo $RANDOM'` + echo "Random number used: "$RANDOMnum + echo ee_mc -n$EVT_TO_GEN -R2 -b2 -l$GEN_MIN_ENERGY -u$GEN_MAX_ENERGY -t2 -r$RANDOMnum -omc_ee.hddm + ee_mc -n$EVT_TO_GEN -R2 -b2 -l$GEN_MIN_ENERGY -u$GEN_MAX_ENERGY -t2 -r$RANDOMnum -omc_ee.hddm + mv mc_ee.hddm $STANDARD_NAME.hddm endif if ( ! -f ./$STANDARD_NAME.hddm ) then diff --git a/MCwrapper/MakeMC.sh b/MCwrapper/MakeMC.sh index 357a409b..3282d9a4 100755 --- a/MCwrapper/MakeMC.sh +++ b/MCwrapper/MakeMC.sh @@ -347,9 +347,9 @@ gen_pre="" if [[ "$GENR" != "0" ]]; then gen_pre=`echo $GENERATOR | cut -c1-4` - 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" ]]; then + 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" ]]; then echo "NO VALID GENERATOR GIVEN" - echo "only [genr8, bggen, genEtaRegge, gen_2pi_amp, gen_pi0, gen_omega_3pi, gen_2k] are supported" + echo "only [genr8, bggen, genEtaRegge, gen_2pi_amp, gen_pi0, gen_omega_3pi, gen_2k, bggen_jpsi, gen_ee] are supported" exit fi @@ -367,6 +367,8 @@ if [[ "$GENR" != "0" ]]; then else if [[ -f $CONFIG_FILE ]]; then echo "input file found" + elif [[ "$GENERATOR" == "gen_ee" ]] + echo "Config file not applicable" else echo $CONFIG_FILE" does not exist" exit @@ -417,6 +419,10 @@ if [[ "$GENR" != "0" ]]; then cp $MCWRAPPER_CENTRAL/Generators/bggen_jpsi/pythia.dat ./ cp $MCWRAPPER_CENTRAL/Generators/bggen_jpsi/pythia-geant.map ./ cp $CONFIG_FILE ./$STANDARD_NAME.conf + elif [[ "$GENERATOR" == "gen_ee" ]]; then + echo "configuring gen_ee" + set STANDARD_NAME="gen_ee_"$STANDARD_NAME + echo "note: this generator is run completely from command line, thus no config file will be made and/or modified" fi if [[ "$gen_pre" != "file" ]]; then @@ -508,6 +514,11 @@ if [[ "$GENR" != "0" ]]; then ln -s $STANDARD_NAME.conf fort.15 bggen_jpsi mv bggen_jpsi.hddm $STANDARD_NAME.hddm + elif [[ "$GENERATOR" == "gen_ee" ]]; then + set RANDOMnum=`bash -c 'echo $RANDOM'` + echo "Random number used: "$RANDOMnum + ee_mc -n$EVT_TO_GEN -R2 -b2 -l$GEN_MIN_ENERGY -u$GEN_MAX_ENERGY -t2 -r$RANDOMnum -omc_ee.hddm + mv mc_ee.hddm $STANDARD_NAME.hddm fi if [[ ! -f ./$STANDARD_NAME.hddm ]]; then From 976cf78caacb365dff983402a96157e45f3866ab Mon Sep 17 00:00:00 2001 From: tbritton Date: Mon, 20 Nov 2017 15:09:08 -0500 Subject: [PATCH 17/20] initial bgrate hooks --- MCwrapper/MakeMC.csh | 46 ++++++++++++++++++++++++++++++++++--------- MCwrapper/MakeMC.sh | 34 ++++++++++++++++++++++++++------ MCwrapper/gluex_MC.py | 6 +++--- 3 files changed, 68 insertions(+), 18 deletions(-) diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index 1a791228..f33a9024 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -86,7 +86,8 @@ echo "" echo "Detected c-shell" -set BGRATE_toUse=$BGRATE + + set radthick="50.e-6" @@ -111,8 +112,8 @@ endif set polarization_angle = `rcnd $RUN_NUMBER polarization_angle | awk '{print $1}'` echo polarization angle: $polarization_angle -set elecE = 0 -set variation= $VERSION +set elecE=0 +set variation=$VERSION if ( $CALIBTIME != "notime" ) then set variation=$variation+":"+$CALIBTIME endif @@ -120,6 +121,7 @@ endif set ccdbelece=`ccdb dump PHOTON_BEAM/endpoint_energy:${RUN_NUMBER}:${variation}` set ccdblist=($ccdbelece:as/ / /) + set elecE_text=$ccdblist[$#ccdblist] #set elecE_text = `rcnd $RUN_NUMBER beam_energy | awk '{print $1}'` @@ -166,10 +168,40 @@ if ( "$VERSION" != "mc" && "$eBEAM_ENERGY" == "rcdb" ) then endif if ( "$polarization_angle" == "-1.0" ) then - set copeak=`echo "$eBEAM_ENERGY + .5" | bc` + set copeak=`echo "$eBEAM_ENERGY + .5" | bc ` setenv COHERENT_PEAK $copeak endif +set colsize=`rcnd $RUN_NUMBER collimator_diameter | awk '{print $1}' | sed -r 's/.{2}$//'| sed -e 's/\.//g'` + +if ( "$colsize" == "B" || "$colsize" == "R" || "$JANA_CALIB_CONTEXT" != "variation=mc" ) then + set colsize="50" +endif + +set beam_on_current=`rcnd $RUN_NUMBER beam_on_current | awk '{print $1}'` + +if ( $beam_on_current != "" ) then +set beam_on_current=`echo "$beam_on_current / 1000." | bc -l` +else +echo "Run $RUN_NUMBER does not have a beam_on_current. Defaulting to beam_current." +set beam_on_current=`rcnd $RUN_NUMBER beam_current | awk '{print $1}'` +endif + +if ( "$colsize" == "B" || "$colsize" == "R" || "$JANA_CALIB_CONTEXT" != "variation=mc" ) then + set colsize="50" +endif + +set BGRATE_toUse=$BGRATE + +if ( "$BGRATE" != "rcdb" || "$VERSION" != "mc" ) then + set BGRATE_toUse=$BGGATE +else + echo "Calculating BGRate. This process takes a minute..." + set BGRATE_toUse=`BGRate_calc --runNo $RUN_NUMBER --coherent_peak $COHERENT_PEAK --beam_on_current $beam_on_current --beam_energy $eBEAM_ENERGY --collimator_diameter 0.00$colsize --radiator_thickness $radthick --endpoint_energy_low $GEN_MIN_ENERGY --endpoint_energy_high $GEN_MAX_ENERGY` + set BGRATE_list=($BGRATE_toUse:as/ / /) + set BGRATE_toUse=$BGRATE_list[$#BGRATE_list] +endif + # PRINT INPUTS echo "Job started: " `date` echo "sqlite path: " $SQLITEPATH @@ -180,6 +212,7 @@ echo "Output location: "$OUTDIR echo "Environment file: " $ENVIRONMENT echo "Context: "$JANA_CALIB_CONTEXT echo "Run Number: "$RUN_NUMBER +echo "Electron beam current to use: "$beam_on_current" uA" echo "Electron beam energy to use: "$eBEAM_ENERGY" GeV" echo "Radiator Thickness to use: "$radthick" m" echo "Photon Energy between "$GEN_MIN_ENERGY" and "$GEN_MAX_ENERGY" GeV" @@ -267,11 +300,6 @@ endif set STANDARD_NAME=$custom_tag$formatted_runNumber\_$formatted_fileNumber -set colsize=`rcnd $RUN_NUMBER collimator_diameter | awk '{print $1}' | sed -r 's/.{2}$//' | sed -e 's/\.//g'` -if ( "$colsize" == "B" || "$colsize" == "R" || "$JANA_CALIB_CONTEXT" != "variation=mc" ) then - set colsize="50" -endif - if ( `echo $eBEAM_ENERGY | grep -o "\." | wc -l` == 0 ) then set eBEAM_ENERGY=$eBEAM_ENERGY\. endif diff --git a/MCwrapper/MakeMC.sh b/MCwrapper/MakeMC.sh index 3282d9a4..1f656be5 100755 --- a/MCwrapper/MakeMC.sh +++ b/MCwrapper/MakeMC.sh @@ -168,6 +168,33 @@ if [[ "$polarization_angle" == "-1.0" ]]; then export COHERENT_PEAK=$copeak fi +beam_on_current=`rcnd $RUN_NUMBER beam_on_current | awk '{print $1}'` + +if [[ $beam_on_current != "" ]]; then +beam_on_current=`echo "$beam_on_current / 1000." | bc -l` +else +echo "Run $RUN_NUMBER does not have a beam_on_current. Defaulting to beam_current." +beam_on_current=`rcnd $RUN_NUMBER beam_current | awk '{print $1}'` +fi + +colsize=`rcnd $RUN_NUMBER collimator_diameter | awk '{print $1}' | sed -r 's/.{2}$//' | sed -e 's/\.//g'` +if [[ "$colsize" == "B" || "$colsize" == "R" || "$JANA_CALIB_CONTEXT" != "variation=mc" ]]; then + colsize="50" +fi + +BGRATE_toUse=$BGRATE + +if [[ "$BGRATE" != "rcdb" || "$VERSION" != "mc" ]]; then + BGRATE_toUse=$BGGATE +else + echo "Calculating BGRate. This process takes a minute..." + BGRATE_toUse=`BGRate_calc --runNo $RUN_NUMBER --coherent_peak $COHERENT_PEAK --beam_on_current $beam_on_current --beam_energy $eBEAM_ENERGY --collimator_diameter 0.00$colsize --radiator_thickness $radthick --endpoint_energy_low $GEN_MIN_ENERGY --endpoint_energy_high $GEN_MAX_ENERGY` + BGRATE_list=(`echo ${BGRATE_toUse}`) + BGRATE_list_length=${#BGRATE_list[@]} + BGRATE_toUse=`echo ${BGRATE_list[$(($BGRATE_list_length-1))]}` + +fi + # PRINT INPUTS echo "Job started: " `date` echo "sqlite path: " $SQLITEPATH @@ -178,6 +205,7 @@ echo "Output location: "$OUTDIR echo "Environment file: " $ENVIRONMENT echo "Context: "$JANA_CALIB_CONTEXT echo "Run Number: "$RUN_NUMBER +echo "Electron beam current to use: "$beam_on_current" uA" echo "Electron beam energy to use: "$eBEAM_ENERGY" GeV" echo "Radiator Thickness to use: "$radthick" m" echo "Photon Energy between "$GEN_MIN_ENERGY" and "$GEN_MAX_ENERGY" GeV" @@ -266,12 +294,6 @@ fi STANDARD_NAME=$custom_tag$formatted_runNumber\_$formatted_fileNumber -colsize=`rcnd $RUN_NUMBER collimator_diameter | awk '{print $1}' | sed -r 's/.{2}$//' | sed -e 's/\.//g'` -if [[ "$colsize" == "B" || "$colsize" == "R" || "$JANA_CALIB_CONTEXT" != "variation=mc" ]]; then - colsize="50" -fi - - if [[ `echo $eBEAM_ENERGY | grep -o "\." | wc -l` == 0 ]]; then eBEAM_ENERGY=$eBEAM_ENERGY\. fi diff --git a/MCwrapper/gluex_MC.py b/MCwrapper/gluex_MC.py index b8648a85..e9fa235e 100755 --- a/MCwrapper/gluex_MC.py +++ b/MCwrapper/gluex_MC.py @@ -195,8 +195,8 @@ def main(argv): #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! print "*********************************" - print "Welcome to v1.9.1 of the MCwrapper" - print "Thomas Britton 11/14/17" + print "Welcome to v1.10 of the MCwrapper" + print "Thomas Britton 11/20/17" print "*********************************" #load all argument passed in and set default options @@ -217,7 +217,7 @@ def main(argv): MIN_GEN_ENERGY="3" MAX_GEN_ENERGY="12" RADIATOR_THICKNESS="rcdb" - BGRATE=".15" #GHz + BGRATE="rcdb" #GHz BGTAGONLY="0" RUNNING_DIR="./" SQLITEPATH="no_sqlite" From 9d6bf429a7ac932ec107c6ffb00fdd57a422f9db Mon Sep 17 00:00:00 2001 From: tbritton Date: Tue, 21 Nov 2017 15:45:39 -0500 Subject: [PATCH 18/20] reordering...DDOS protection v0....BGrate_calc --- MCwrapper/MakeMC.csh | 82 +++++++++++++++++++------------- MCwrapper/MakeMC.sh | 92 +++++++++++++++++++++++------------- MCwrapper/examples/MC.config | 4 +- MCwrapper/gluex_MC.py | 28 ++++++----- 4 files changed, 128 insertions(+), 78 deletions(-) diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index f33a9024..f6b47c07 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -73,7 +73,9 @@ setenv PER_FILE $1 shift setenv RUNNING_DIR $1 shift -setenv SQLITEPATH $1 +setenv ccdbSQLITEPATH $1 +shift +setenv rcdbSQLITEPATH $1 shift setenv BGTAGONLY_OPTION $1 shift @@ -81,12 +83,42 @@ setenv RADIATOR_THICKNESS $1 shift setenv BGRATE $1 -echo "" -echo "" -echo "Detected c-shell" +#necessary to run swif, uses local directory if swif=0 is used +if ( "$BATCHRUN" != "0" ) then +# ENVIRONMENT + echo $ENVIRONMENT + + echo pwd=$PWD + mkdir -p $OUTDIR + mkdir -p $OUTDIR/log +endif + +if (! -d $RUNNING_DIR) then +mkdir $RUNNING_DIR +endif + +cd $RUNNING_DIR +if(! -d $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER}) then +mkdir $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER} +endif +cd $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER} + +if ( "$ccdbSQLITEPATH" != "no_sqlite" ) then + cp $ccdbSQLITEPATH ./ccdb.sqlite + setenv CCDB_CONNECTION sqlite:///$PWD/ccdb.sqlite + setenv JANA_CALIB_URL ${CCDB_CONNECTION} +endif +if ( "$rcdbSQLITEPATH" != "no_sqlite" ) then + cp $rcdbSQLITEPATH ./rcdb.sqlite + setenv RCDB_CONNECTION sqlite:///$PWD/rcdb.sqlite +endif + +echo "" +echo "" +echo "Detected c-shell" set radthick="50.e-6" @@ -109,21 +141,22 @@ else end endif -set polarization_angle = `rcnd $RUN_NUMBER polarization_angle | awk '{print $1}'` +set polarization_angle=`rcnd $RUN_NUMBER polarization_angle | awk '{print $1}'` echo polarization angle: $polarization_angle set elecE=0 set variation=$VERSION + if ( $CALIBTIME != "notime" ) then set variation=$variation+":"+$CALIBTIME endif -set ccdbelece=`ccdb dump PHOTON_BEAM/endpoint_energy:${RUN_NUMBER}:${variation}` + +set ccdbelece="`ccdb dump PHOTON_BEAM/endpoint_energy:${RUN_NUMBER}:${variation}`" set ccdblist=($ccdbelece:as/ / /) set elecE_text=$ccdblist[$#ccdblist] -#set elecE_text = `rcnd $RUN_NUMBER beam_energy | awk '{print $1}'` #echo "text: " $elecE_text @@ -198,13 +231,19 @@ if ( "$BGRATE" != "rcdb" || "$VERSION" != "mc" ) then else echo "Calculating BGRate. This process takes a minute..." set BGRATE_toUse=`BGRate_calc --runNo $RUN_NUMBER --coherent_peak $COHERENT_PEAK --beam_on_current $beam_on_current --beam_energy $eBEAM_ENERGY --collimator_diameter 0.00$colsize --radiator_thickness $radthick --endpoint_energy_low $GEN_MIN_ENERGY --endpoint_energy_high $GEN_MAX_ENERGY` + + if ( "$BGRATE_toUse" == "" ) then + echo "BGrate_calc is not built or inaccessible. Please check your build and/or specify a BGRate to be used." + exit 12 + else set BGRATE_list=($BGRATE_toUse:as/ / /) set BGRATE_toUse=$BGRATE_list[$#BGRATE_list] + endif endif # PRINT INPUTS echo "Job started: " `date` -echo "sqlite path: " $SQLITEPATH +echo "ccdb sqlite path: " $ccdbSQLITEPATH echo "Producing file number: "$FILE_NUMBER echo "Containing: " $EVT_TO_GEN"/""$PER_FILE"" events" echo "Running location:" $RUNNING_DIR @@ -235,35 +274,11 @@ echo "" echo "" -if (! -d $RUNNING_DIR) then -mkdir $RUNNING_DIR -endif -cd $RUNNING_DIR -if(! -d $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER}) then -mkdir $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER} -endif -cd $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER} -#necessary to run swif, uses local directory if swif=0 is used -if ( "$BATCHRUN" != "0" ) then -# ENVIRONMENT - echo $ENVIRONMENT - - if ( "$SQLITEPATH" != "no_sqlite" ) then - cp $SQLITEPATH ./ccdb.sqlite - setenv CCDB_CONNECTION sqlite:///$RUNNING_DIR/ccdb.sqlite - setenv JANA_CALIB_URL ${CCDB_CONNECTION} - endif - - echo pwd=$PWD - mkdir -p $OUTDIR - mkdir -p $OUTDIR/log -endif - set current_files=`find . -maxdepth 1 -type f` if ( "$CUSTOM_GCONTROL" == "0" ) then @@ -736,6 +751,9 @@ if ( "$GENR" != "0" ) then endif endif +rm -rf ccdb.sqlite +rm -rf rcdb.sqlite + if ( "$gen_pre" != "file" ) then mv $PWD/*.conf $OUTDIR/configurations/generation/ endif diff --git a/MCwrapper/MakeMC.sh b/MCwrapper/MakeMC.sh index 1f656be5..a9139af0 100755 --- a/MCwrapper/MakeMC.sh +++ b/MCwrapper/MakeMC.sh @@ -73,7 +73,9 @@ export PER_FILE=$1 shift export RUNNING_DIR=$1 shift -export SQLITEPATH=$1 +export ccdbSQLITEPATH=$1 +shift +export rcdbSQLITEPATH=$1 shift export BGTAGONLY_OPTION=$1 shift @@ -81,6 +83,44 @@ export RADIATOR_THICKNESS=$1 shift export BGRATE=$1 +#printenv +#necessary to run swif, uses local directory if swif=0 is used +if [[ "$BATCHRUN" != "0" ]]; then + # ENVIRONMENT + echo $ENVIRONMENT + if [[ "$BATCHSYS" == "QSUB" ]]; then + cd $RUNNING_DIR + fi + + + echo pwd=$PWD + mkdir -p $OUTDIR + mkdir -p $OUTDIR/log +fi + +if [[ ! -d $RUNNING_DIR ]]; then +mkdir $RUNNING_DIR +fi + +cd $RUNNING_DIR + +if [[ ! -d $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER} ]]; then +mkdir $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER} +fi + +cd $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER} + +if [[ "$ccdbSQLITEPATH" != "no_sqlite" ]]; then + cp $ccdbSQLITEPATH ./ccdb.sqlite + export CCDB_CONNECTION=sqlite:///$PWD/ccdb.sqlite + export JANA_CALIB_URL=$CCDB_CONNECTION +fi + +if [[ "$rcdbSQLITEPATH" != "no_sqlite" ]]; then + cp $rcdbSQLITEPATH ./rcdb.sqlite + export RCDB_CONNECTION=sqlite:///$PWD/rcdb.sqlite +fi + echo "" echo "" echo "Detected bash shell" @@ -189,15 +229,22 @@ if [[ "$BGRATE" != "rcdb" || "$VERSION" != "mc" ]]; then else echo "Calculating BGRate. This process takes a minute..." BGRATE_toUse=`BGRate_calc --runNo $RUN_NUMBER --coherent_peak $COHERENT_PEAK --beam_on_current $beam_on_current --beam_energy $eBEAM_ENERGY --collimator_diameter 0.00$colsize --radiator_thickness $radthick --endpoint_energy_low $GEN_MIN_ENERGY --endpoint_energy_high $GEN_MAX_ENERGY` + echo BGRATE Is: $BGRATE_toUse + if [[ $BGRATE_toUse == "" ]]; then + echo "BGrate_calc is not built or inaccessible. Please check your build and/or specify a BGRate to be used." + exit 12 + else + BGRATE_list=(`echo ${BGRATE_toUse}`) BGRATE_list_length=${#BGRATE_list[@]} BGRATE_toUse=`echo ${BGRATE_list[$(($BGRATE_list_length-1))]}` + fi fi # PRINT INPUTS echo "Job started: " `date` -echo "sqlite path: " $SQLITEPATH +echo "sqlite path: " $ccdbSQLITEPATH echo "Producing file number: "$FILE_NUMBER echo "Containing: " $EVT_TO_GEN"/""$PER_FILE"" events" echo "Running location:" $RUNNING_DIR @@ -227,36 +274,7 @@ echo "==============================================" echo "" echo "" -if [[ ! -d $RUNNING_DIR ]]; then -mkdir $RUNNING_DIR -fi - -cd $RUNNING_DIR - -if [[ ! -d $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER} ]]; then -mkdir $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER} -fi - -cd $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER} -#printenv -#necessary to run swif, uses local directory if swif=0 is used -if [[ "$BATCHRUN" != "0" ]]; then - # ENVIRONMENT - echo $ENVIRONMENT - if [[ "$BATCHSYS" == "QSUB" ]]; then - cd $RUNNING_DIR - fi - - if [[ "$SQLITEPATH" != "no_sqlite" ]]; then - cp $SQLITEPATH ./ccdb.sqlite - export CCDB_CONNECTION sqlite:///$RUNNING_DIR/ccdb.sqlite - export JANA_CALIB_URL $CCDB_CONNECTION - fi - echo pwd=$PWD - mkdir -p $OUTDIR - mkdir -p $OUTDIR/log -fi current_files=`find . -maxdepth 1 -type f` @@ -389,7 +407,7 @@ if [[ "$GENR" != "0" ]]; then else if [[ -f $CONFIG_FILE ]]; then echo "input file found" - elif [[ "$GENERATOR" == "gen_ee" ]] + elif [[ "$GENERATOR" == "gen_ee" ]]; then echo "Config file not applicable" else echo $CONFIG_FILE" does not exist" @@ -519,7 +537,7 @@ if [[ "$GENR" != "0" ]]; then echo $optionals_line echo gen_2k -c $STANDARD_NAME.conf -o $STANDARD_NAME.hddm -hd $STANDARD_NAME.root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY -b $GEN_MAX_ENERGY -p $COHERENT_PEAK -m $eBEAM_ENERGY $optionals_line gen_2k -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 -p $COHERENT_PEAK -m $eBEAM_ENERGY $optionals_line - elif [[ "$GENERATOR" == "bggen" ]]; then + elif [[ "$GENERATOR" == "bggen_jpsi" ]]; then RANDOMnum=`bash -c 'echo $RANDOM'` echo "Random number used: "$RANDOMnum sed -i 's/TEMPTRIG/'$EVT_TO_GEN'/' $STANDARD_NAME.conf @@ -535,7 +553,7 @@ if [[ "$GENR" != "0" ]]; then ln -s $STANDARD_NAME.conf fort.15 bggen_jpsi - mv bggen_jpsi.hddm $STANDARD_NAME.hddm + mv bggen.hddm $STANDARD_NAME.hddm elif [[ "$GENERATOR" == "gen_ee" ]]; then set RANDOMnum=`bash -c 'echo $RANDOM'` echo "Random number used: "$RANDOMnum @@ -726,6 +744,10 @@ if [[ "$GENR" != "0" ]]; then fi fi fi + +rm -rf ccdb.sqlite +rm -rf rcdb.sqlite + if [[ "$gen_pre" != "file" ]]; then mv $PWD/*.conf $OUTDIR/configurations/generation/ fi @@ -740,6 +762,8 @@ if [[ "$hddmfiles" != "" ]]; then done fi +cd .. + if [[ `ls $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER} | wc -l` == 0 ]]; then rm -rf $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER} else diff --git a/MCwrapper/examples/MC.config b/MCwrapper/examples/MC.config index eb0cca30..4a8968a2 100755 --- a/MCwrapper/examples/MC.config +++ b/MCwrapper/examples/MC.config @@ -7,7 +7,9 @@ #RUNNING_DIRECTORY=/run/in/this/directory #where the code should run. This is defaulted to ./ -#SQLITEPATH=/your/sqlite/path #if you use SQLITE and it is not part of the environment file that gets sourced +#ccdbSQLITEPATH=/your/sqlite/path #if you use SQLITE and it is not part of the environment file that gets sourced +#rcdbSQLITEPATH=/your/sqlite/path #if you use SQLITE and it is not part of the environment file that gets sourced + #TAG=my-custom-prefix-tag diff --git a/MCwrapper/gluex_MC.py b/MCwrapper/gluex_MC.py index e9fa235e..0f2d9915 100755 --- a/MCwrapper/gluex_MC.py +++ b/MCwrapper/gluex_MC.py @@ -196,7 +196,7 @@ def main(argv): print "*********************************" print "Welcome to v1.10 of the MCwrapper" - print "Thomas Britton 11/20/17" + print "Thomas Britton 11/21/17" print "*********************************" #load all argument passed in and set default options @@ -220,7 +220,8 @@ def main(argv): BGRATE="rcdb" #GHz BGTAGONLY="0" RUNNING_DIR="./" - SQLITEPATH="no_sqlite" + ccdbSQLITEPATH="no_sqlite" + rcdbSQLITEPATH="no_sqlite" GEANTVER = 4 BGFOLD="DEFAULT" @@ -382,8 +383,10 @@ def main(argv): CALIBTIME=str(parts[2]).split("#")[0].strip() else: VERSION=rm_comments[0].strip() - elif str(parts[0]).upper()=="SQLITEPATH" : - SQLITEPATH=rm_comments[0].strip() + elif str(parts[0]).upper()=="CCDBSQLITEPATH" : + ccdbSQLITEPATH=rm_comments[0].strip() + elif str(parts[0]).upper()=="RCDBSQLITEPATH" : + rcdbSQLITEPATH=rm_comments[0].strip() else: print "unknown config parameter!! "+str(parts[0]) #loop over command line arguments @@ -478,7 +481,7 @@ def main(argv): indir=os.environ.get('MCWRAPPER_CENTRAL') - script_to_use = "/MakeMC.csh" + script_to_use = "/MakeMC.sh" if environ['SHELL']=="/bin/bash" : script_to_use = "/MakeMC.sh" @@ -509,10 +512,10 @@ def main(argv): #Make python rcdb calls to form the vector db = rcdb.RCDBProvider("mysql://rcdb@hallddb/rcdb") - dbhost = "hallddb.jlab.org" - dbuser = 'datmon' - dbpass = '' - dbname = 'data_monitoring' + #dbhost = "hallddb.jlab.org" + #dbuser = 'datmon' + #dbpass = '' + #dbname = 'data_monitoring' runlow=0 runhigh=0 @@ -578,7 +581,7 @@ def main(argv): if num_this_file == 0: continue - COMMAND=str(BATCHRUN)+" "+ENVFILE+" "+GENCONFIG+" "+str(outdir)+" "+str(runs[0])+" "+str(BASEFILENUM+FILENUM_this_run+-1)+" "+str(num_this_file)+" "+str(VERSION)+" "+str(CALIBTIME)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(BATCHSYS)+" "+str(NCORES).split(':')[-1]+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY)+" "+str(TAGSTR)+" "+str(CUSTOM_PLUGINS)+" "+str(PERFILE)+" "+str(RUNNING_DIR)+" "+str(SQLITEPATH)+" "+str(BGTAGONLY)+" "+str(RADIATOR_THICKNESS)+" "+str(BGRATE) + COMMAND=str(BATCHRUN)+" "+ENVFILE+" "+GENCONFIG+" "+str(outdir)+" "+str(runs[0])+" "+str(BASEFILENUM+FILENUM_this_run+-1)+" "+str(num_this_file)+" "+str(VERSION)+" "+str(CALIBTIME)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(BATCHSYS)+" "+str(NCORES).split(':')[-1]+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY)+" "+str(TAGSTR)+" "+str(CUSTOM_PLUGINS)+" "+str(PERFILE)+" "+str(RUNNING_DIR)+" "+str(ccdbSQLITEPATH)+" "+str(rcdbSQLITEPATH)+" "+str(BGTAGONLY)+" "+str(RADIATOR_THICKNESS)+" "+str(BGRATE) if BATCHRUN == 0 or BATCHSYS=="NULL": #print str(runs[0])+" "+str(BASEFILENUM+FILENUM_this_run+-1)+" "+str(num_this_file) os.system(str(indir)+" "+COMMAND) @@ -592,6 +595,9 @@ def main(argv): #print "----------------" else: + if FILES_TO_GEN >= 500 and ( ccdbSQLITEPATH == "no_sqlite" or rcdbSQLITEPATH == "no_sqlite"): + print "This job has >500 subjobs and risks ddosing the servers. Please use sqlite or request again with a larger per file. " + return for FILENUM in range(1, FILES_TO_GEN + 2): num=PERFILE #last file gets the remainder @@ -601,7 +607,7 @@ def main(argv): if num == 0: continue - COMMAND=str(BATCHRUN)+" "+ENVFILE+" "+GENCONFIG+" "+str(outdir)+" "+str(RUNNUM)+" "+str(BASEFILENUM+FILENUM+-1)+" "+str(num)+" "+str(VERSION)+" "+str(CALIBTIME)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(BATCHSYS)+" "+str(NCORES).split(':')[-1]+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY)+" "+str(TAGSTR)+" "+str(CUSTOM_PLUGINS)+" "+str(PERFILE)+" "+str(RUNNING_DIR)+" "+str(SQLITEPATH)+" "+str(BGTAGONLY)+" "+str(RADIATOR_THICKNESS)+" "+str(BGRATE) + COMMAND=str(BATCHRUN)+" "+ENVFILE+" "+GENCONFIG+" "+str(outdir)+" "+str(RUNNUM)+" "+str(BASEFILENUM+FILENUM+-1)+" "+str(num)+" "+str(VERSION)+" "+str(CALIBTIME)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(BATCHSYS)+" "+str(NCORES).split(':')[-1]+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY)+" "+str(TAGSTR)+" "+str(CUSTOM_PLUGINS)+" "+str(PERFILE)+" "+str(RUNNING_DIR)+" "+str(ccdbSQLITEPATH)+" "+str(rcdbSQLITEPATH)+" "+str(BGTAGONLY)+" "+str(RADIATOR_THICKNESS)+" "+str(BGRATE) #print COMMAND #either call MakeMC.csh or add a job depending on swif flag From 1fecab405fe8cadb7e9febaf0c53f31a3f71c59c Mon Sep 17 00:00:00 2001 From: tbritton Date: Tue, 21 Nov 2017 16:06:36 -0500 Subject: [PATCH 19/20] whoops typo --- MCwrapper/gluex_MC.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MCwrapper/gluex_MC.py b/MCwrapper/gluex_MC.py index 0f2d9915..5d848ceb 100755 --- a/MCwrapper/gluex_MC.py +++ b/MCwrapper/gluex_MC.py @@ -481,7 +481,7 @@ def main(argv): indir=os.environ.get('MCWRAPPER_CENTRAL') - script_to_use = "/MakeMC.sh" + script_to_use = "/MakeMC.csh" if environ['SHELL']=="/bin/bash" : script_to_use = "/MakeMC.sh" From aac01ebf511810ee65c1a4fab84b432b7225cf30 Mon Sep 17 00:00:00 2001 From: tbritton Date: Wed, 22 Nov 2017 08:40:15 -0500 Subject: [PATCH 20/20] BGrate_calc only used if needed. Protections for DDOS. SQLITE support --- MCwrapper/MakeMC.csh | 18 ++++++++++-------- MCwrapper/MakeMC.sh | 23 ++++++++++++----------- MCwrapper/examples/MC.config | 6 +++--- MCwrapper/gluex_MC.py | 2 +- 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index f6b47c07..7b1cf4a5 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -229,15 +229,17 @@ set BGRATE_toUse=$BGRATE if ( "$BGRATE" != "rcdb" || "$VERSION" != "mc" ) then set BGRATE_toUse=$BGGATE else - echo "Calculating BGRate. This process takes a minute..." - set BGRATE_toUse=`BGRate_calc --runNo $RUN_NUMBER --coherent_peak $COHERENT_PEAK --beam_on_current $beam_on_current --beam_energy $eBEAM_ENERGY --collimator_diameter 0.00$colsize --radiator_thickness $radthick --endpoint_energy_low $GEN_MIN_ENERGY --endpoint_energy_high $GEN_MAX_ENERGY` + if ( $BGTAGONLY_OPTION == "1" || $BKGFOLDSTR == "BeamPhotons" ) then + echo "Calculating BGRate. This process takes a minute..." + set BGRATE_toUse=`BGRate_calc --runNo $RUN_NUMBER --coherent_peak $COHERENT_PEAK --beam_on_current $beam_on_current --beam_energy $eBEAM_ENERGY --collimator_diameter 0.00$colsize --radiator_thickness $radthick --endpoint_energy_low $GEN_MIN_ENERGY --endpoint_energy_high $GEN_MAX_ENERGY` - if ( "$BGRATE_toUse" == "" ) then - echo "BGrate_calc is not built or inaccessible. Please check your build and/or specify a BGRate to be used." - exit 12 - else - set BGRATE_list=($BGRATE_toUse:as/ / /) - set BGRATE_toUse=$BGRATE_list[$#BGRATE_list] + if ( "$BGRATE_toUse" == "" ) then + echo "BGrate_calc is not built or inaccessible. Please check your build and/or specify a BGRate to be used." + exit 12 + else + set BGRATE_list=($BGRATE_toUse:as/ / /) + set BGRATE_toUse=$BGRATE_list[$#BGRATE_list] + endif endif endif diff --git a/MCwrapper/MakeMC.sh b/MCwrapper/MakeMC.sh index a9139af0..3fa370cd 100755 --- a/MCwrapper/MakeMC.sh +++ b/MCwrapper/MakeMC.sh @@ -227,17 +227,18 @@ BGRATE_toUse=$BGRATE if [[ "$BGRATE" != "rcdb" || "$VERSION" != "mc" ]]; then BGRATE_toUse=$BGGATE else - echo "Calculating BGRate. This process takes a minute..." - BGRATE_toUse=`BGRate_calc --runNo $RUN_NUMBER --coherent_peak $COHERENT_PEAK --beam_on_current $beam_on_current --beam_energy $eBEAM_ENERGY --collimator_diameter 0.00$colsize --radiator_thickness $radthick --endpoint_energy_low $GEN_MIN_ENERGY --endpoint_energy_high $GEN_MAX_ENERGY` - echo BGRATE Is: $BGRATE_toUse - if [[ $BGRATE_toUse == "" ]]; then - echo "BGrate_calc is not built or inaccessible. Please check your build and/or specify a BGRate to be used." - exit 12 - else - - BGRATE_list=(`echo ${BGRATE_toUse}`) - BGRATE_list_length=${#BGRATE_list[@]} - BGRATE_toUse=`echo ${BGRATE_list[$(($BGRATE_list_length-1))]}` + if [[ $BGTAGONLY_OPTION == "1" || $BKGFOLDSTR=="BeamPhotons" ]]; then + echo "Calculating BGRate. This process takes a minute..." + BGRATE_toUse=`BGRate_calc --runNo $RUN_NUMBER --coherent_peak $COHERENT_PEAK --beam_on_current $beam_on_current --beam_energy $eBEAM_ENERGY --collimator_diameter 0.00$colsize --radiator_thickness $radthick --endpoint_energy_low $GEN_MIN_ENERGY --endpoint_energy_high $GEN_MAX_ENERGY` + echo BGRATE Is: $BGRATE_toUse + if [[ $BGRATE_toUse == "" ]]; then + echo "BGrate_calc is not built or inaccessible. Please check your build and/or specify a BGRate to be used." + exit 12 + else + BGRATE_list=(`echo ${BGRATE_toUse}`) + BGRATE_list_length=${#BGRATE_list[@]} + BGRATE_toUse=`echo ${BGRATE_list[$(($BGRATE_list_length-1))]}` + fi fi fi diff --git a/MCwrapper/examples/MC.config b/MCwrapper/examples/MC.config index 4a8968a2..974dda12 100755 --- a/MCwrapper/examples/MC.config +++ b/MCwrapper/examples/MC.config @@ -7,8 +7,8 @@ #RUNNING_DIRECTORY=/run/in/this/directory #where the code should run. This is defaulted to ./ -#ccdbSQLITEPATH=/your/sqlite/path #if you use SQLITE and it is not part of the environment file that gets sourced -#rcdbSQLITEPATH=/your/sqlite/path #if you use SQLITE and it is not part of the environment file that gets sourced +#ccdbSQLITEPATH=/your/sqlite/path/ccdb.sqlite #if you use SQLITE and it is not part of the environment file that gets sourced +#rcdbSQLITEPATH=/your/sqlite/path/rcdb.sqlite #if you use SQLITE and it is not part of the environment file that gets sourced #TAG=my-custom-prefix-tag @@ -17,7 +17,7 @@ DATA_OUTPUT_BASE_DIR=OUTPUT-LOCATION#your desired output location NCORES=4 # Number of CPU threads to use or nodes:node-id:ppn or nodes:ppn depending on your system -GENERATOR=generator-to-use #or you may specifile file:/.../file-to-use +GENERATOR=generator-to-use #or you may specifile file:/.../file-to-use.hddm GENERATOR_CONFIG=config file for generator #common parameters for generators diff --git a/MCwrapper/gluex_MC.py b/MCwrapper/gluex_MC.py index 5d848ceb..ea7fcc0e 100755 --- a/MCwrapper/gluex_MC.py +++ b/MCwrapper/gluex_MC.py @@ -196,7 +196,7 @@ def main(argv): print "*********************************" print "Welcome to v1.10 of the MCwrapper" - print "Thomas Britton 11/21/17" + print "Thomas Britton 11/22/17" print "*********************************" #load all argument passed in and set default options