diff --git a/geometry_standalone_edep/mollerMother.gdml b/geometry_standalone_edep/mollerMother.gdml new file mode 100644 index 000000000..c10302996 --- /dev/null +++ b/geometry_standalone_edep/mollerMother.gdml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/geometry_standalone_edep/mollerParallel.gdml b/geometry_standalone_edep/mollerParallel.gdml new file mode 100644 index 000000000..242feefea --- /dev/null +++ b/geometry_standalone_edep/mollerParallel.gdml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scripts/standalone_edep_studies/DSconfig.list b/scripts/standalone_edep_studies/DSconfig.list new file mode 100644 index 000000000..52faba4de --- /dev/null +++ b/scripts/standalone_edep_studies/DSconfig.list @@ -0,0 +1,29 @@ +config_name, DSconfig +single_slab, false +nevents, 2000 +particle, e+ +energy, 100 +n_conductors, 6 +single_conductor_height, 9.7 +single_conductor_width, 24.0 +sideplate_width, 0.2 +first_insulation_width, 0.4 +second_insulation_width, 0.4 +topbot_insulation_width, 1.0 +stack_height, 61.75 +conductor_hole_radius, 3.05 +insulation_mat, mix6337 +sideplate_mat, mix6337 +conductor_hole_mat, G4_WATER +conductor_mat, G4_Cu +x_rotation, 90 +y_rotation, 0 +z_rotation, 0 +beam_x_pos, 0 +beam_y_pos, 0 +beam_z_pos, -40 +beam_th_dir, 10 +beam_ph_dir, 0 +max_step_limit_charged_particles, 0.1 +run_macro, macros/run.mac +output_geometry, geometry_standalone_edep/mollerMother.gdml diff --git a/scripts/standalone_edep_studies/README.md b/scripts/standalone_edep_studies/README.md new file mode 100644 index 000000000..9e02f1030 --- /dev/null +++ b/scripts/standalone_edep_studies/README.md @@ -0,0 +1,33 @@ +# README + +To generate a new config: +```python generateStandalone.py -c ``` + +Important variables: + +Position and Direction: +For upstream coils, leave x_rotation, y_rotation and z_rotation as 0. To change direction of beam hitting a spot on the coil, you need to modify the beam pos and beam dir variables. + +For downstream coils, set x_rotation to 90. Leave the other two as 0. To change direction of beam hitting a spot on the coil, you need to modify the beam pos and beam dir variables. + + +Charged particle Step Length: +You can check the effect of varying the charged particle step length. This is set using the max_step_limit_charged_particles variable in the config file. Note that this will not set limits on gammas. + +Running simulations: +Short jobs (nEvents<2000) can be run from command line: +./build/remoll macros/run.mac + +For long jobs (nEvents), adapt and use the given job submission script. + +Detector IDs: +1, 6 = Outer most insulation layer +2, 5 = Side Plates +3, 4 = Inner most insulation layer +7, 8 = Top and bottom insulation layer + +50-59: Conductor hole +60-69: Conductor +70-79: Gaps between conductor layers filled with insulation + + diff --git a/scripts/standalone_edep_studies/USconfig.list b/scripts/standalone_edep_studies/USconfig.list new file mode 100644 index 000000000..fe712ccdb --- /dev/null +++ b/scripts/standalone_edep_studies/USconfig.list @@ -0,0 +1,29 @@ +config_name, USconfig1 +single_slab, false +nevents, 100 +particle, e+ +energy, 100 +n_conductors, 5 +single_conductor_height, 9.0 +single_conductor_width, 9.0 +sideplate_width, 0.5 +first_insulation_width, 0.5 +second_insulation_width, 0.5 +topbot_insulation_width, 1.0 +stack_height, 47.845 +conductor_hole_radius, 2.85 +insulation_mat, mix6337 +sideplate_mat, G4_W +conductor_hole_mat, G4_WATER +conductor_mat, G4_Cu +x_rotation, 0 +y_rotation, 0 +z_rotation, 0 +beam_x_pos, -220.81 +beam_y_pos, 59.17 +beam_z_pos, -20 +beam_th_dir, 85 +beam_ph_dir, -15 +run_macro, macros/run.mac +output_geometry, geometry_standalone_edep/mollerMother.gdml +max_step_limit_charged_particles, 0.1 diff --git a/scripts/standalone_edep_studies/generateStandalone.py b/scripts/standalone_edep_studies/generateStandalone.py new file mode 100644 index 000000000..527ff196b --- /dev/null +++ b/scripts/standalone_edep_studies/generateStandalone.py @@ -0,0 +1,349 @@ +#!/usr/bin/env python +import sys +import os +import math +import time +import argparse +import csv + + +def printMaterials(): + out="\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n \ + \n\ + \n\ + \n\ + \n\ + \n\ + \n \ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n\ + " + + return out + +def single_slab(p): + detname = ["layer1_log"] + detid = [10] + out="\ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + " + return [detname, detid, out] + +def layers(p): + detname=['second_sglass_logic', 'W_sideplate_logic', 'first_sglass_logic', 'second_sglass_logic1', 'W_sideplate_logic1', 'first_sglass_logic1','top_sglass_logic', 'bot_sglass_logic'] + detid = [1,2,3,4,5,6,7,8] + out="\ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n" + detname + for i in range(0,int(p["n_conductors"])): + detname.append("water_tube_logic_"+str(i)) + detname.append("single_conductor_logic_"+str(i)) + detid.append(50+i) + detid.append(60+i) + out+=" \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n" + if i \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n " + out+=" \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n\ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n " + + for i in range(0,int(p["n_conductors"])): + out+=" \n \ + \n \ + \n \ + \n " + if i \n \ + \n \ + \n \ + \n " + out+=" \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + " + return [detname, detid, out] + +parser= argparse.ArgumentParser(description="Generate geometry to run standalone sims. Example: python generateStandalone.py -c config1.list") +parser.add_argument("-c", dest="par_list", action="store", required=True, help="Include a config file with list of parameters") + +args=parser.parse_args() + +p={} # dictionary of parameter values + +with open(args.par_list) as csvfile: + reader=csv.reader(csvfile, delimiter=',', quotechar='|') + for row in reader: + p[row[0]]=row[1].strip() + + +macro_file = os.path.realpath(p["run_macro"]) +output_file=os.path.realpath(p["output_geometry"]) + +f=open(output_file, "w+") + +out ="" + +if (p["single_slab"] =="true"): + out =" \n\ + \n \ + \n\ + \n \ + \n " + out+=printMaterials() + layerinfo=single_slab(p) + out+=layerinfo[2] + +else: + p["gap_height"] = (float(p["stack_height"])-float(p["n_conductors"])*float(p["single_conductor_height"]))/(float(p["n_conductors"])-1) + out =" \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + \n \ + " + out+=printMaterials() + layerinfo = layers(p) + out+=layerinfo[2] + +f.write(out) + +m=open(macro_file, "w+") + + +out = "\ +/remoll/setgeofile geometry_standalone_edep/mollerMother.gdml \n\ +/remoll/physlist/register QGSP_BERT_HP \n\ +/remoll/physlist/parallel/enable \n\ +/remoll/parallel/setfile geometry_standalone_edep/mollerParallel.gdml \n\ +/run/initialize \n\ +" +for i in layerinfo[0]: + out+="/remoll/geometry/userlimits/usermaxallowedstep "+i+" "+p["max_step_limit_charged_particles"]+"*mm \n\ +" +out+="/remoll/evgen/set beam \n\ +/remoll/oldras false \n\ +/remoll/evgen/beam/rasrefz "+p["beam_z_pos"]+" mm \n\ +/remoll/evgen/beam/rasx 0.0 \n\ +/remoll/evgen/beam/rasy 0.0 \n\ +/remoll/evgen/beam/corrx 0.0 \n\ +/remoll/evgen/beam/corry 0.0 \n\ +/remoll/evgen/beam/partName "+p["particle"]+" \n\ +/remoll/beamene "+p["energy"]+" \n\ +/remoll/evgen/beam/origin "+p["beam_x_pos"]+" "+p["beam_y_pos"]+" "+p["beam_z_pos"]+" mm \n\ +/remoll/evgen/beam/th "+p["beam_th_dir"]+" deg \n\ +/remoll/evgen/beam/ph "+p["beam_ph_dir"]+" deg \n\ +/remoll/SD/disable_all \n" +for i in layerinfo[1]: + out += "\ +/remoll/SD/enable "+str(i)+" \n\ +/remoll/SD/detect lowenergyneutral "+str(i)+" \n\ +/remoll/SD/detect secondaries "+str(i)+" \n" +out+="\ +/remoll/filename "+p["config_name"]+".root\n\ +/run/beamOn "+p["nevents"]+"\n\ +" + +m.write(out) + diff --git a/scripts/standalone_edep_studies/submitBelugaJobs.sh b/scripts/standalone_edep_studies/submitBelugaJobs.sh new file mode 100644 index 000000000..578010d5b --- /dev/null +++ b/scripts/standalone_edep_studies/submitBelugaJobs.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +#SBATCH --account=rrg-jmammei +#SBATCH --job-name=remoll-standalone-edep +#SBATCH --time=00:30:00 +#SBATCH --nodes=1 +#SBATCH --ntasks=1 +#SBATCH --cpus-per-task=4 +#SBATCH --mem=16GB +#SBATCH --output=/lustre03/project/6049248/commonFiles/log/%A_%a.out +#SBATCH --error=/lustre03/project/6049248/commonFiles/log/%A_%a.err + +cp -r /lustre03/project/6049248/commonFiles/remoll $TMPDIR + +cd $TMPDIR/remoll + +python scripts/standalone_edep_studies/generateStandalone.py -c scripts/standalone_edep_studies/USconfig.list + +./build/remoll macros/run.mac + +mv USconfig.root /lustre03/project/6049248/commonFiles/out/USconfig_${SLURM_JOBID}_${SLURM_ARRAY_TASK_ID}.root