MakeSimNoiseFcls.sh
Go to the documentation of this file.
1 #! /bin/bash
2 
3 ### What are my baseline values?
4 BaseLifetime="3000"
5 BaseField="[ 0.5, 0.782, 1.734 ]"
6 BaseDiffusion="6.2e-9"
7 BaseNoise="3.16"
8 
9 ### Declare the electron lifetime arrays
10 declare -a Lifetimes=("1000" "2000" "3000" "5000" "8000")
11 declare -a LifeNames=("1ms" "2ms" "3ms" "5ms" "8ms")
12 
13 ### Declare the electric field arrays
14 declare -a FieldValue=("[ 0.25, 0.782, 1.734 ]" "[ 0.375, 0.782, 1.734 ]" "[ 0.5, 0.782, 1.734 ]")
15 declare -a FieldNames=("250V" "375V" "500V")
16 
17 ### Delcare the diffusion const arrays
18 declare -a Diffusion=("0" "3.1e-9" "6.2e-9" "12.4e-9")
19 declare -a DiffNames=("0Diff" "50Diff" "100Diff" "200Diff")
20 
21 ### Delcare the noise normalisation arrays
22 declare -a NoiseLevel=("3.16" "6.32" "9.48" "12.64" "31.6")
23 declare -a HitThresh=("[ 6, 6, 6 ]" "[ 10, 10, 10 ]" "[ 15, 15, 15 ]" "[ 20, 20, 20 ]" "[ 40, 40, 40 ]")
24 declare -a NoiseNames=("100N" "200N" "300N" "400N" "1000N")
25 
26 ### Check that the length of the two electron lifetime arrays are equal
27 LifeLen=${#Lifetimes[@]}
28 LNamLen=${#LifeNames[@]}
29 if [ $LifeLen -ne $LNamLen ]; then
30  echo "The size of Lifetimes is ${LifeLen} and the size of LifeNames is ${LNamLen}.....Fix it"
31  exit
32 fi
33 ### Check that the length of the two electron field arrays are equal
34 FieldLen=${#FieldValue[@]}
35 FiNamLen=${#FieldNames[@]}
36 if [ $FieldLen -ne $FiNamLen ]; then
37  echo "The size of FieldValue is ${FieldLen} and the size of FieldNames is ${FiNamLen}.....Fix it"
38  exit
39 fi
40 ### Check that the length of the two electron field arrays are equal
41 DiffLen=${#Diffusion[@]}
42 DNamLen=${#DiffNames[@]}
43 if [ $DiffLen -ne $DNamLen ]; then
44  echo "The size of Diffusion is ${DiffLen} and the size of DiffNames is ${DNamLen}.....Fix it"
45  exit
46 fi
47 ### Check that the length of the two electron field arrays are equal
48 NoiseLen=${#NoiseLevel[@]}
49 HitThLen=${#HitThresh[@]}
50 NoNamLen=${#NoiseNames[@]}
51 if [[ $NoiseLen -ne $NoNamLen || $NoiseLen -ne $HitThLen || $HitThLen -ne $NoNamLen ]]; then
52  echo "The size of NoiseLevel is ${NoiseLen} the size of HitThresh is ${HitThLen} and the size of NoiseNames is ${NoNamLen}.....Fix it"
53  exit
54 fi
55 
56 ### Define where I am going to put the fcl files
57 MCTestFclDir=$MRB_SOURCE/dunetpc/fcl/dune35t/MCTests/
58 echo "Putting fcl files in this directory -> ${MCTestFclDir}"
59 
60 ### Define a function to make all of the fcl files ###
61 function MakeTheFcls(){
62  ThisLife=$BaseLifetime
63  ThisField=$BaseField
64  ThisDiff=$BaseDiffusion
65  ThisNoise=$BaseNoise
66 
67  LifeName="3ms"
68  FieldName="500V"
69  DiffName="100Diff"
70  NoiseName="100N"
71 
72  if [ $1 -eq 1 ]; then
73  ThisLife=${Lifetimes[$2-1]}
74  LifeName=${LifeNames[$2-1]}
75  elif [ $1 -eq 2 ]; then
76  ThisField=${FieldValue[$2-1]}
77  FieldName=${FieldNames[$2-1]}
78  elif [ $1 -eq 3 ]; then
79  ThisDiff=${Diffusion[$2-1]}
80  DiffName=${DiffNames[$2-1]}
81  elif [ $1 -eq 4 ]; then
82  ThisNoise=${NoiseLevel[$2-1]}
83  ThisHitTh=${HitThresh[$2-1]}
84  NoiseName=${NoiseNames[$2-1]}
85  else
86  echo "Something is wrong, you're asking for parameter "$2
87  fi
88 
89  echo "Making files for ${ThisLife} ${LifeName}, ${ThisField} ${FieldName}, ${ThisDiff} ${DiffName}, ${ThisNoise} ${NoiseName}"
90 
91 ### Make the G4 file
92 ### Note that this is using the counter muon GEANT4 fcl file!!!
93  cat <<EOF > ${MCTestFclDir}MCTest_g4_${LifeName}_${FieldName}_${DiffName}_${NoiseName}.fcl
94 #include "standard_g4_dune35t_countermu.fcl"
95 
96 services.DetectorPropertiesService.Electronlifetime: ${ThisLife}
97 services.DetectorPropertiesService.Efield: ${ThisField}
98 services.LArG4Parameters.LongitudinalDiffusion: ${ThisDiff}
99 
100 EOF
101 
102 ### Make the detsim file
103 ### Note that this is using the millblock detsim module!!!
104  cat <<EOF > ${MCTestFclDir}MCTest_detsim_${LifeName}_${FieldName}_${DiffName}_${NoiseName}.fcl
105 #include "standard_detsim_dune35t_milliblock.fcl"
106 
107 services.DetectorPropertiesService.Electronlifetime: ${ThisLife}
108 services.DetectorPropertiesService.Efield: ${ThisField}
109 services.LArG4Parameters.LongitudinalDiffusion: ${ThisDiff}
110 
111 services.ChannelNoiseService: @local::chnoiseold
112 
113 EOF
114  if [ $1 -eq 4 ]; then
115  cat<<EOF >> ${MCTestFclDir}MCTest_detsim_${LifeName}_${FieldName}_${DiffName}_${NoiseName}.fcl
116 services.ChannelNoiseService.NoiseNormU: ${ThisNoise} # 3.16
117 services.ChannelNoiseService.NoiseNormV: ${ThisNoise} # 3.16
118 services.ChannelNoiseService.NoiseNormZ: ${ThisNoise} # 3.16
119 
120 EOF
121  fi
122 
123 ### Make the G4 file
124 ### Note that this is using the counter muon GEANT4 fcl file!!!
125  cat <<EOF > ${MCTestFclDir}MCTest_reco_${LifeName}_${FieldName}_${DiffName}_${NoiseName}.fcl
126 #include "standard_reco_dune35tsim_milliblock.fcl"
127 
128 services.DetectorPropertiesService.Electronlifetime: ${ThisLife}
129 services.DetectorPropertiesService.Efield: ${ThisField}
130 
131 EOF
132  if [ $1 -eq 4 ]; then
133  cat <<EOF >> ${MCTestFclDir}MCTest_reco_${LifeName}_${FieldName}_${DiffName}_${NoiseName}.fcl
134 physics.producers.gaushit.MinSig: ${ThisHitTh} # [ 5, 5, 10 ]
135 physics.producers.fasthit.MinSigCol: 50
136 physics.producers.fasthit.MinSigInd: 50
137 EOF
138  fi
139 }
140 
141 ### Make the fcl files for the different electron lifetimes.
142 for (( life=1; life<${LifeLen}+1; life++ ));
143 do
144  MakeTheFcls 1 ${life}
145 done
146 
147 ### Now make the fcl files for the different electric fields.
148 for (( field=1; field<${FieldLen}+1; field++ ));
149 do
150  MakeTheFcls 2 ${field}
151 done
152 
153 ### Now make the fcl files for the different diffusion constants.
154 for (( diff=1; diff<${DiffLen}+1; diff++ ));
155 do
156  MakeTheFcls 3 ${diff}
157 done
158 
159 ### Now make the fcl files for the different noise levels.
160 for (( noise=1; noise<${NoiseLen}+1; noise++ ));
161 do
162  MakeTheFcls 4 ${noise}
163 done