# This script runs Lumi macros for the full Sim #-- fix params of simulation -------------------------------------------------- #numer of events used for resolution study SIMEVENTS=100000 #SIMEVENTS=100 #Declare array with elements for knoss stat. study ARRAY=(100000 50000 20000 10000 5000 2000 1000 500 200 100) #ARRAY=(100) #ARRAY=(100000) # get number of elements in the array ELEMENTS=${#ARRAY[@]} #Declare array with elements for misalignment scale #ARRAYD=(0 10 20 30 40 50 70 100 150 200 250 300 350 400 450 500) #mum ARRAYD=(0 25 50 100 150 200 250 300 350 400) #mum ELEMENTSD=${#ARRAYD[@]} #ARRAYA=(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) # 1e-3 rad ARRAYA=(0 3 6 9) # 1e-3 rad # get number of elements in the array ELEMENTSA=${#ARRAYA[@]} #--------------------------------------------------------------------------------------- # reads number of Events, name of run and verbose Level path="test" #verbose=0 mom=0 #echo Enter storage-folder: #read folder #echo "Storage Path: $folder!" # echo Enter verbosity Level: # read verbose # echo "Verbosity Level is: $verbose!" echo Enter momentum from "1.5, 4.06, 8.9, 11.91, 15 [GeV/c]": read mom echo "Beam momentum is: $mom!" momStr=`echo $mom | sed -e '{ s/\./_/g; }'` #echo ${path} # make data directory, if not there. all data file go there, makes them easier to move around # let's go for (( j=0;j<$ELEMENTSD;j++)); do for (( ia=0;ia<$ELEMENTSA;ia++)); do for (( i=0;i<$ELEMENTS;i++)); do T="$(date)" echo ${T} ": Now we'll do test with "${ARRAY[${i}]} "events for misalignment ~ "${ARRAYD[${j}]} "mum and" ${ARRAYA[${ia}]} "*10e-3 rad">> logSTAT path="/home/karavdin/datastorage/AlignmentStudy/mom_"${momStr}"/"misalign_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}_10e-3radDOF111111_${ARRAY[${i}]}_events if [ ! -d $path ]; then mkdir -p $path fi #echo "Output files will be saved in $path" if [ ! -d jobs/mom_${momStr} ]; then mkdir -p jobs/mom_${momStr} fi misalignfile=${path}"/lumi.misalign.par" cat >jobs/mom_${momStr}/job_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad_${ARRAY[${i}]}events.sh < ${path}/0-sim_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad.log time root -l -b -q runLumi1Digi.C\(${SIMEVENTS},0,"\"${path}\""\) &> ${path}/1-digi_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad.log time root -l -b -q create_misalignment_lumi.C\(${ARRAYD[${j}]},${ARRAYA[${ia}]},\"${misalignfile}\"\) &> ${path}/2a-misalign_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad.log time root -l -b -q runLumi2Reco.C\(${SIMEVENTS},0,"\"${path}\""\) &> ${path}/2-rechit_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad.log time root -l -b -q runLumi3Finder.C\(${SIMEVENTS},0,"\"${path}\"",0,\"CA\",false\) &> ${path}/3-trksearch_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad.log time root -l -b -q runLumi4Fitter.C\(${SIMEVENTS},0,"\"${path}\""\) &> ${path}/4-fit_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad.log time root -l -b -q runLumi5Geane.C\(${SIMEVENTS},$mom,0,"\"${path}\""\) &> ${path}/5-geane_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad.log cd /home/karavdin/pandaRoot12/build/bin ./rec_mc_match -s 0 -n ${SIMEVENTS} -mom ${mom} -path ${path} &> ${path}/6-resolution_info_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad.log ./hits_align -s 0 -n ${ARRAY[${i}]} -path ${path} -out "${path}/TrackForAlign.txt" -outhist "${path}/ResidualsHist_before.root" -v 0 &> ${path}/7-hitres_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad.log cd /home/karavdin/pandaRoot12/mySandbox/myKnossos ./knossos -i "${path}/TrackForAlign.txt" -o "${path}/LumiAlignConst.txt" -n ${ARRAY[${i}]} -r 1 &> ${path}/8-knossos_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad.log head -14 ${path}/lumi.misalign.par >> ${path}/lumi.misalign_after.par ./analyze -in '${path}/lumi.misalign.par' -out '${path}/LumiAlignConst.txt' -outroot '${path}/Results.root' -new '${path}/lumi.misalign_after.par' &> ${path}/9-alignresults.log mv ${path}/lumi.misalign.par ${path}/lumi.misalign_before.par cp ${path}/lumi.misalign_after.par ${path}/lumi.misalign.par mv ${path}/Lumi_out_MC_and_REC_trks_matches_with_IDs0.root ${path}/Lumi_out_MC_and_REC_trks_matches_with_IDs0_before.root rm ${path}/FairRunInfo* rm ${path}/Lumi_MC_0.root rm ${path}/Lumi_Params_0.root rm ${path}/Lumi_digi_0.root rm ${path}/Lumi_reco_0.root rm ${path}/Lumi_TCand_0.root rm ${path}/Lumi_Track_0.root rm ${path}/Lumi_Geane_0.root cd /home/karavdin/pandaRoot12/macro/lmd source config.sh time root -l -b -q runLumi0SimBox.C\(${SIMEVENTS},$mom,"\"${path}\""\) &> ${path}/10-sim_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad.log time root -l -b -q runLumi1Digi.C\(${SIMEVENTS},0,"\"${path}\""\) &> ${path}/11-digi_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad.log time root -l -b -q runLumi2Reco.C\(${SIMEVENTS},0,"\"${path}\""\) &> ${path}/12-rechit_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad.log time root -l -b -q runLumi3Finder.C\(${SIMEVENTS},0,"\"${path}\"",0,\"CA\",false\) &> ${path}/13-trksearch_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad.log time root -l -b -q runLumi4Fitter.C\(${SIMEVENTS},0,"\"${path}\""\) &> ${path}/14-fit_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad.log time root -l -b -q runLumi5Geane.C\(${SIMEVENTS},$mom,0,"\"${path}\""\) &> ${path}/15-geane_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad.log cd /home/karavdin/pandaRoot12/build/bin ./rec_mc_match -s 0 -n ${SIMEVENTS} -mom ${mom} -path ${path} ./hits_align -s 0 -n ${ARRAY[${i}]} -path ${path} -out "${path}/TrackForAlign.txt" -outhist "${path}/ResidualsHist_after.root" -v 0 &> ${path}/16-hitres_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad.log mv ${path}/Lumi_out_MC_and_REC_trks_matches_with_IDs0.root ${path}/Lumi_out_MC_and_REC_trks_matches_with_IDs0_after.root rm ${path}/FairRunInfo* rm ${path}/Lumi_MC_0.root rm ${path}/Lumi_Params_0.root rm ${path}/Lumi_digi_0.root rm ${path}/Lumi_reco_0.root rm ${path}/Lumi_TCand_0.root rm ${path}/Lumi_Track_0.root rm ${path}/Lumi_Geane_0.root exit 0 EOF ### submit job to batch system qsub jobs/mom_${momStr}/job_${ARRAYD[${j}]}mum_${ARRAYA[${ia}]}e-3rad_${ARRAY[${i}]}events.sh echo "Output files will be saved in $path" done done done exit