All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
make_xml_premcc1.0.sh
Go to the documentation of this file.
1 #! /bin/bash
2 #----------------------------------------------------------------------
3 #
4 # Name: make_xml_mcc1.0.sh
5 #
6 # Purpose: Make xml files for mcc 1.0. This script loops over all
7 # generator-level fcl files in the source area of the currently
8 # setup version of sbndcode (that is, under
9 # $SBNDCODE_DIR/source/fcl/gen), and makes a corresponding xml
10 # project file in the local directory.
11 #
12 # Usage:
13 #
14 # make_xml_mcc1.0.sh [-h|--help] [-r <release>] [-u|--user <user>] [--local <dir|tar>] [--nev <n>] [--nevjob <n>] [--nevgjob <n>]
15 #
16 # Options:
17 #
18 # -h|--help - Print help.
19 # -r <release> - Use the specified larsoft/sbndcode release.
20 # -u|--user <user> - Use users/<user> as working and output directories
21 # (default is to use sbndpro).
22 # --local <dir|tar> - Specify larsoft local directory or tarball (xml
23 # tag <local>...</local>).
24 # --nev <n> - Specify number of events for all samples. Otherwise
25 # use hardwired defaults.
26 # --nevjob <n> - Specify the default number of events per job.
27 # --nevgjob <n> - Specify the maximum number of events per gen/g4 job.
28 #
29 #----------------------------------------------------------------------
30 
31 # Parse arguments.
32 
33 rel=v00_07_00
34 userdir=users/sbndpro
35 qual=e9:prof
36 userbase=$userdir
37 nevarg=0
38 nevjob=100
39 nevgjobarg=0
40 local=''
41 
42 while [ $# -gt 0 ]; do
43  case "$1" in
44 
45  # User directory.
46 
47  -h|--help )
48  echo "Usage: make_xml_mcc1.0.sh [-h|--help] [-r <release>] [-q <qual>] [-u|--user <user>] [--local <dir|tar>] [--nev <n>] [--nevjob <n>] [--nevgjob <n>]"
49  exit
50  ;;
51 
52  # Release.
53 
54  -r )
55  if [ $# -gt 1 ]; then
56  rel=$2
57  shift
58  fi
59  ;;
60 
61  # Qualifier.
62 
63  -q)
64  if [ $# -gt 1 ]; then
65  qual=$2
66  shift
67  fi
68  ;;
69 
70 
71  # User.
72 
73  -u|--user )
74  if [ $# -gt 1 ]; then
75  userdir=users/$2
76  userbase=$2
77  shift
78  fi
79  ;;
80 
81  # Local release.
82 
83  --local )
84  if [ $# -gt 1 ]; then
85  local=$2
86  shift
87  fi
88  ;;
89 
90  # Total number of events.
91 
92  --nev )
93  if [ $# -gt 1 ]; then
94  nevarg=$2
95  shift
96  fi
97  ;;
98 
99  # Number of events per job.
100 
101  --nevjob )
102  if [ $# -gt 1 ]; then
104  shift
105  fi
106  ;;
107 
108  # Number of events per gen/g4 job.
109 
110  --nevgjob )
111  if [ $# -gt 1 ]; then
113  shift
114  fi
115  ;;
116 
117  esac
118  shift
119 done
120 
121 # Get qualifier.
122 
123 #qual=e9
124 
125 # Delete existing xml files.
126 
127 rm -f *.xml
128 
129 # Loop over existing generator fcl files.
130 
131 find $SBNDCODE_DIR/source/fcl/gen -name \*.fcl | while read fcl
132 do
133  if ! echo $fcl | grep -q common; then
134  newprj=`basename $fcl .fcl`
135  newxml=${newprj}.xml
136  filt=1
137 
138  # Make xml file.
139 
140  echo "Making ${newprj}.xml"
141 
142  # Generator
143 
144  genfcl=`basename $fcl`
145 
146  # G4
147 
148  g4fcl=standard_g4_sbnd.fcl
149  if echo $newprj | grep -q dirt; then
150  g4fcl=standard_g4_dirt_sbnd.fcl
151  fi
152 
153  # Detsim (optical + tpc).
154 
155  detsimfcl=standard_detsim_sbnd.fcl
156  if echo $newprj | grep -q dirt; then
157  detsimfcl=standard_detsim_sbnd_tpcfilt.fcl
158  if echo $newprj | grep -q bnb; then
160  else
161  filt=20
162  fi
163  fi
164 
165  # Reco
166 
167  recofcl=standard_reco_sbnd_basic.fcl
168 
169  # Merge/Analysis
170 
171  mergefcl=standard_anatree_sbnd.fcl
172 
173  # Set number of gen/g4 events per job.
174 
175  nevgjob=$nevgjobarg
176  if [ $nevgjob -eq 0 ]; then
177  if echo $newprj | grep -q dirt; then
178  if echo $newprj | grep -q cosmic; then
180  else
181  nevgjob=2000
182  fi
183  else
185  fi
186  fi
187 
188  # Set number of events.
189 
190  nev=$nevarg
191  if [ $nev -eq 0 ]; then
192  if [ $newprj = prodgenie_bnb_nu_cosmic_sbnd ]; then
193  nev=50000
194  elif [ $newprj = prodgenie_bnb_nu_sbnd ]; then
195  nev=20000
196  elif [ $newprj = prodgenie_bnb_nue_cosmic_sbnd ]; then
197  nev=20000
198  elif [ $newprj = prodgenie_bnb_nue_sbnd ]; then
199  nev=20000
200  elif [ $newprj = prodcosmics_sbnd ]; then
201  nev=20000
202  else
203  nev=10000
204  fi
205  fi
206  nev=$(( $nev * $filt ))
207 
208  # Calculate the number of worker jobs.
209 
210  njob1=$(( $nev / $nevgjob )) # Pre-filter (gen, g4)
211  njob2=$(( $nev / $nevjob / $filt )) # Post-filter (detsim and later)
212  if [ $njob1 -lt $njob2 ]; then
213  njob1=$njob2
214  fi
215 
216  cat <<EOF > $newxml
217 <?xml version="1.0"?>
218 
219 <!-- Production Project -->
220 
221 <!DOCTYPE project [
222 <!ENTITY release "$rel">
223 <!ENTITY file_type "mc">
224 <!ENTITY run_type "physics">
225 <!ENTITY name "$newprj">
226 <!ENTITY tag "mcc1.0">
227 ]>
228 
229 <project name="&name;">
230 
231  <!-- Project size -->
232  <numevents>$nev</numevents>
233 
234  <!-- Operating System -->
235  <os>SL6</os>
236 
237  <!-- Batch resources -->
238  <resource>DEDICATED,OPPORTUNISTIC</resource>
239 
240  <!-- Larsoft information -->
241  <larsoft>
242  <tag>&release;</tag>
243  <qual>${qual}</qual>
244 EOF
245  if [ x$local != x ]; then
246  echo "local=$local"
247  echo " <local>${local}</local>" >> $newxml
248  fi
249  cat <<EOF >> $newxml
250  </larsoft>
251 
252  <!-- Project stages -->
253 
254  <stage name="gen">
255  <fcl>$genfcl</fcl>
256  <outdir>/pnfs/sbnd/persistent/${userdir}/&release;/&name;/gen</outdir>
257  <workdir>/pnfs/sbnd/persistent/${userdir}/&release;/work/&name;/gen</workdir>
258  <numjobs>$njob1</numjobs>
259  <datatier>generated</datatier>
260  <defname>&name;_&tag;_gen</defname>
261  </stage>
262 
263  <stage name="g4">
264  <fcl>$g4fcl</fcl>
265  <outdir>/pnfs/sbnd/persistent/${userdir}/&release;/&name;/g4</outdir>
266  <workdir>/pnfs/sbnd/persistent/${userdir}/&release;/work/&name;/g4</workdir>
267  <numjobs>$njob1</numjobs>
268  <datatier>simulated</datatier>
269  <defname>&name;_&tag;_g4</defname>
270  </stage>
271 
272 EOF
273  if [ x$detsimfcl != x ]; then
274  cat <<EOF >> $newxml
275  <stage name="detsim">
276  <fcl>$detsimfcl</fcl>
277  <outdir>/pnfs/sbnd/persistent/${userdir}/&release;/&name;/detsim</outdir>
278  <workdir>/pnfs/sbnd/persistent/${userdir}/&release;/work/&name;/detsim</workdir>
279  <numjobs>$njob2</numjobs>
280  <datatier>detector-simulated</datatier>
281  <defname>&name;_&tag;_detsim</defname>
282  </stage>
283 
284 EOF
285  fi
286  if [ x$optsimfcl != x ]; then
287  cat <<EOF >> $newxml
288  <stage name="optsim">
289  <fcl>$optsimfcl</fcl>
290  <outdir>/pnfs/sbnd/persistent/${userdir}/&release;/&name;/optsim</outdir>
291  <workdir>/pnfs/sbnd/persistent/${userdir}/&release;/&name;/optsim</workdir>
292  <numjobs>$njob2</numjobs>
293  <datatier>optical-simulated</datatier>
294  <defname>&name;_&tag;_optsim</defname>
295  </stage>
296 
297 EOF
298  fi
299  if [ x$tpcsimfcl != x ]; then
300  cat <<EOF >> $newxml
301  <stage name="tpcsim">
302  <fcl>$tpcsimfcl</fcl>
303  <outdir>/pnfs/sbnd/persistent/${userdir}/&release;/&name;/tpcsim</outdir>
304  <workdir>/pnfs/sbnd/persistent/${userdir}/&release;/&name;/tpcsim</workdir>
305  <numjobs>$njob2</numjobs>
306  <datatier>tpc-simulated</datatier>
307  <defname>&name;_&tag;_tpcsim</defname>
308  </stage>
309 
310 EOF
311  fi
312  cat <<EOF >> $newxml
313  <stage name="reco">
314  <fcl>$recofcl</fcl>
315  <outdir>/pnfs/sbnd/persistent/${userdir}/&release;/&name;/reco</outdir>
316  <workdir>/pnfs/sbnd/persistent/${userdir}/&release;/work/&name;/reco</workdir>
317  <numjobs>$njob2</numjobs>
318  <datatier>reconstructed</datatier>
319  <defname>&name;_&tag;_reco</defname>
320  </stage>
321 
322  <stage name="anatree">
323  <fcl>$mergefcl</fcl>
324  <outdir>/pnfs/sbnd/persistent/${userdir}/&release;/&name;/anatree</outdir>
325  <workdir>/pnfs/sbnd/persistent/${userdir}/&release;/work/&name;/anatree</workdir>
326  <numjobs>$njob2</numjobs>
327  <targetsize>8000000000</targetsize>
328  <datatier>reconstructed</datatier>
329  <defname>&name;_&tag;</defname>
330  </stage>
331 
332  <!-- file type -->
333  <filetype>&file_type;</filetype>
334 
335  <!-- run type -->
336  <runtype>&run_type;</runtype>
337 
338 </project>
339 EOF
340 
341  fi
342 
343 done
process_name standard_reco_uboone fcl
opportunistic OPPORTUNISTIC
Definition: submit_lar.sh:296
then newprj
process_name opflash particleana ie x
process_name can override from command line with o or output proton mvapid_weights muon_all_BDT weights xml
Definition: runPID.fcl:28
then nevgjobarg
do source
* file
Definition: file_to_url.sh:69
then source cvmfs dune opensciencegrid org products dune setup_dune sh exit elif[-f/grid/fermiapp/products/dune/setup_dune_fermiapp.sh]
then nevgjob
then nevjob
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
shift
Definition: fcl_checks.sh:26
then qual
while getopts h
then local
process_name standard_reco_uboone reco
then if echo $newprj grep q dirt
then userdir
then njob1
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker see the discussion of warn common echo in *Note Linker such as a global int variable echo as opposed to a large global array echo echo I echo The symbol is an indirect reference to another symbol This echo is a GNU extension to the a out object file format which is echo rarely used echo echo N echo The symbol is a debugging symbol echo echo R echo The symbol is in a read only data section echo echo S echo The symbol is in an uninitialized data section for small echo objects echo echo T echo The symbol is in the the normal defined echo symbol is used with no error When a weak undefined symbol echo is linked and the symbol is not the value of the echo weak symbol becomes zero with no error echo echo W echo The symbol is a weak symbol that has not been specifically echo tagged as a weak object symbol When a weak defined symbol echo is linked with a normal defined the normal defined echo symbol is used with no error When a weak undefined symbol echo is linked and the symbol is not the value of the echo weak symbol becomes zero with no error echo echo echo The symbol is a stabs symbol in an a out object file In echo this the next values printed are the stabs other echo the stabs desc and the stab type Stabs symbols are echo used to hold debugging information For more information
then shift fi
esac shift done rm f *xml find $SBNDCODE_DIR source fcl gen name *fcl while read fcl do if!echo $fcl grep q common
then nevarg
physics filters filter
then nev
then detsimfcl
if &&[-z"$BASH_VERSION"] then echo Attempting to switch to bash bash shellSwitch exit fi &&["$1"= 'shellSwitch'] shift declare a IncludeDirectives for Dir in
then g4fcl
then filt
BEGIN_PROLOG cosmic
stream1 can override from command line with o or output services user sbnd
then echo fcl name
pnfs
Definition: file_to_url.sh:60
esac echo uname r