2 #----------------------------------------------------------------------
4 # Name: make_xml_mcp.sh
6 # Purpose: Make xml files for a Monte Carlo Production (MCP). 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.
14 # make_xml_mcp.sh [-h|--help] [-r <release>] [-u|--user <user>] [--local <dir|tar>] [--nev <n>] [--nevjob <n>] [--nevgjob <n>]
18 # -h|--help - Print help.
19 # --name <name> - The name of the production e.g. mcp1.0
20 # -r <release> - Use the specified larsoft/sbndcode release.
21 # -u|--user <user> - Use users/<user> as working and output directories
22 # (default is to use sbndpro).
23 # --local <dir|tar> - Specify larsoft local directory or tarball (xml
24 # tag <local>...</local>).
25 # --nev <n> - Specify number of events for all samples. Otherwise
26 # use hardwired defaults.
27 # --nevjob <n> - Specify the default number of events per job.
28 # --nevgjob <n> - Specify the maximum number of events per gen/g4 job.
30 #----------------------------------------------------------------------
34 echo
"Making ${newxml}"
39 <!-- Production Project -->
42 <!ENTITY release
"$rel">
43 <!ENTITY file_type
"mc">
44 <!ENTITY run_type
"physics">
45 <!ENTITY
name "$newprj">
49 <project
name=
"&name;">
52 <numevents>$nev</numevents>
54 <!-- Operating System -->
57 <!-- Batch resources -->
65 if [
x$local !=
x ]; then
67 echo
" <local>${local}</local>" >> $newxml
72 <!-- Project stages -->
78 <numjobs>$njob1</numjobs>
79 <datatier>generated</datatier>
80 <defname>&
name;_&tag;_gen</defname>
87 <numjobs>$njob1</numjobs>
88 <datatier>simulated</datatier>
89 <defname>&
name;_&tag;_g4</defname>
96 <numjobs>$njob2</numjobs>
97 <datatier>
detector-simulated</datatier>
98 <defname>&
name;_&tag;_detsim</defname>
105 <numjobs>$njob2</numjobs>
106 <datatier>reconstructed</datatier>
107 <defname>&
name;_&tag;_reco</defname>
110 <
stage name=
"anatree">
114 <numjobs>$njob2</numjobs>
115 <targetsize>8000000000</targetsize>
116 <datatier>reconstructed</datatier>
117 <defname>&
name;_&tag;</defname>
121 <filetype>&file_type;</filetype>
124 <runtype>&run_type;</runtype>
130 function set_default_fcl {
132 g4fcl=standard_g4_sbnd.fcl
134 # Detsim (optical + tpc).
138 recofcl=standard_reco_sbnd_basic.fcl
141 anatreefcl=standard_anatree_sbnd.fcl
157 while [ $# -gt 0 ];
do
163 echo
"Usage: make_xml_mcp.sh [-h|--help] [--name <prodution name e.g. mcp1.0>] [-r <release>] [-q <qual>] [-u|--user <user>] [--local <dir|tar>] [--nev <n>] [--nevjob <n>] [--nevgjob <n>]"
170 if [ $# -gt 1 ]; then
180 if [ $# -gt 1 ]; then
189 if [ $# -gt 1 ]; then
199 if [ $# -gt 1 ]; then
209 if [ $# -gt 1 ]; then
215 # Total number of events.
218 if [ $# -gt 1 ]; then
224 # Number of events per job.
227 if [ $# -gt 1 ]; then
233 # Number of events per gen/g4 job.
236 if [ $# -gt 1 ]; then
250 # Delete existing xml files.
254 # Loop over existing generator fcl files.
258 if ! echo $fcl | grep -
q common; then
259 newprj=`basename $fcl .fcl`
267 # Set number of gen/g4 events per job.
270 if [ $nevgjob -eq 0 ]; then
271 if echo $newprj | grep -
q dirt; then
272 if echo $newprj | grep -
q cosmic; then
282 # Set number of events.
285 if [ $nev -eq 0 ]; then
286 if [ $newprj = prodgenie_bnb_nu_cosmic_sbnd ]; then
288 elif [ $newprj = prodgenie_bnb_nu_sbnd ]; then
290 elif [ $newprj = prodgenie_bnb_nue_cosmic_sbnd ]; then
292 elif [ $newprj = prodgenie_bnb_nue_sbnd ]; then
294 elif [ $newprj = prodcosmics_sbnd ]; then
300 nev=$(( $nev * $filt ))
302 # Calculate the number of worker jobs.
304 njob1=$(( $nev / $nevgjob )) # Pre-
filter (gen, g4)
305 njob2=$(( $nev / $nevjob / $filt ))
# Post-filter (detsim and later)
306 if [ $njob1 -lt $njob2 ]; then
312 # Define the generator-level fcl
313 genfcl=`basename $fcl`
314 #Assume that we are going to produce this sample with the default fcls
315 makedefaultsample=
true
316 #Loop over the MCCSTATEMENTs in this fcl file to figure out what alternative samples need making
317 grep
"MCCSTATEMENT" $fcl |
318 { #being
the moron
I am,
I forgot that
a while loop uses
a subshell.
I want to maybe
319 #change the value of makedefaultsample and check it outside of the loop. So
320 #complete hack; wrap from here to the final makedefaultsample check in braces
321 #so it is all in the same subshell. Basically not having the braces means that
322 #makedefaultsample will evaluate to true outside of this while loop
323 while read mccstatement
325 #At time of writing, the MCCSTATEMENT should define an altnerative set of fcl files to
326 #process this particular sample through. Technically each MCCSTATEMENT line is a
327 #comma separated list of fcl files and a name for the alternative project. The first element in the
328 #comma separated list is a pair of statements separated by white space, the second of the pair is the
329 #name of the project. All subsequent elements in the list are also pairs separated by white space.
330 #The first element defines which stage to change the fcl file and can have the following names: G4:
331 #DETSIM: RECO: and ANATREE:.
333 #It is also possible that one of the statement lines asks us not to make the default sample path
334 #Check for this and set the flag to false if necessary
335 if echo $mccstatement | grep -
q SKIPDEFAULT; then
336 makedefaultsample=
false
337 #There shouldn't be anything else useful on this line so continue to the next statement
341 #For each new MCCSTATEMENT line we should initially reset the fcl files
343 #Also reset the project name to that of the default sample as otherwise the new project names keep
344 #getting appended to the previous new project name
345 newprj=`basename $fcl .fcl`
348 #Delimit the MCCSTATEMENT line on the commas
350 statementarray=($mccstatement)
352 for statementelement
in "${statementarray[@]}"
354 #The statementelement should be
a string pair basically with
a key
and a value. This time
355 #separated by whitespace
356 pair=($statementelement)
359 if echo $key | grep -
q MCCSTATEMENT; then
360 newprj=
"${newprj}_${value}"
362 elif echo $key | grep -
q G4; then
364 elif echo $key | grep -
q DETSIM; then
366 elif echo $key | grep -
q RECO; then
368 elif echo $key | grep -
q ANATREE; then
370 else echo
"ISSUE WITH MCCSTATEMENT IN $newprj. CAN NOT FIND THE SET STATEMENTS (MCCSTATEMENT G4 DETSIM RECO OR ANATREE)"
373 #make an XML file for each MCCSTATEMENT line
377 #if we still want to make the default file then make the XML
378 if [
"$makedefaultsample"=
true ] ; then
380 newprj=`basename $fcl .fcl` #reset
the newprj back to
the default project
385 } #
while loop subshell
process_name standard_reco_uboone fcl
see a below echo or echo I(indirect symbol).'echo" If the symbol is local (non-external)
opportunistic OPPORTUNISTIC
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
then source cvmfs dune opensciencegrid org products dune setup_dune sh exit elif[-f/grid/fermiapp/products/dune/setup_dune_fermiapp.sh]
std::size_t size(FixedBins< T, C > const &) noexcept
function print_xml_to_file
process_name standard_reco_uboone reco
then if echo $newprj grep q dirt
return match has_match and(match.match_pdg==11 or match.match_pdg==-11)
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
esac shift done rm f *xml find $SBNDCODE_DIR source fcl gen name *fcl while read fcl do if!echo $fcl grep q common
if &&[-z"$BASH_VERSION"] then echo Attempting to switch to bash bash shellSwitch exit fi &&["$1"= 'shellSwitch'] shift declare a IncludeDirectives for Dir in
stream1 can override from command line with o or output services user sbnd
BEGIN_PROLOG don t mess with this pandoraTrackGausCryoW true