-
Notifications
You must be signed in to change notification settings - Fork 4
/
MakeMC.sh
executable file
·2010 lines (1818 loc) · 81.7 KB
/
MakeMC.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
if [[ $SINGULARITY_NAME != "" ]]; then
echo "RUNNING IN A SINGULARITY CONTAINER: "$SINGULARITY_NAME
fi
# SET INPUTS
export BATCHRUN=$1
shift
export ENVIRONMENT=$1
shift
if [[ "$BATCHRUN" != "0" ]]; then
xmltest=`echo $ENVIRONMENT | rev | cut -c -4 | rev`
if [[ "$xmltest" == ".xml" ]]; then
source /group/halld/Software/build_scripts/gluex_env_jlab.sh $ENVIRONMENT
else
source $ENVIRONMENT
fi
fi
export ANAENVIRONMENT=$1
shift
export CONFIG_FILE=$1
shift
export OUTDIR=$1
shift
export RUN_NUMBER=$1
shift
export FILE_NUMBER=$1
shift
export EVT_TO_GEN=$1
shift
export VERSION=$1
shift
export CALIBTIME=$1
wholecontext=$VERSION
if [[ "$CALIBTIME" != "notime" ]]; then
wholecontext="variation=$VERSION calibtime=$CALIBTIME"
else
wholecontext="variation=$VERSION"
fi
export JANA_CALIB_CONTEXT="$wholecontext"
shift
export GENR=$1
shift
export GEANT=$1
shift
export SMEAR=$1
shift
export RECON=$1
shift
export CLEANGENR=$1
shift
export CLEANGEANT=$1
shift
export CLEANSMEAR=$1
shift
export CLEANRECON=$1
shift
export BATCHSYS=$1
shift
export NUMTHREADS=$1
shift
export GENERATOR=$1
shift
export GEANTVER=$1
shift
export BKGFOLDSTR=$1
shift
export CUSTOM_GCONTROL=$1
shift
export eBEAM_ENERGY=$1
shift
export COHERENT_PEAK=$1
shift
export GEN_MIN_ENERGY=$1
shift
export GEN_MAX_ENERGY=$1
shift
export TAGSTR=$1
shift
export CUSTOM_PLUGINS=$1
shift
export CUSTOM_ANA_PLUGINS=$1
shift
export PER_FILE=$1
shift
export RUNNING_DIR=$1
shift
export ccdbSQLITEPATH=$1
shift
export rcdbSQLITEPATH=$1
shift
export BGTAGONLY_OPTION=$1
shift
export RADIATOR_THICKNESS=$1
shift
export BGRATE=$1
shift
export RANDBGTAG=$1
shift
export RECON_CALIBTIME=$1
shift
export GEANT_NOSCONDARIES=$1
shift
export MCWRAPPER_VERSION=$1
shift
export NOSIPMSATURATION=$1
shift
export FLUX_TO_GEN=$1
shift
export FLUX_HIST=$1
shift
export POL_TO_GEN=$1
shift
export POL_HIST=$1
shift
export eBEAM_CURRENT=$1
shift
export EXPERIMENT=$1
shift
export RANDOM_TRIG_NUM_EVT=$1
shift
export MCWRAPPER_RUN_LOCATION=$1
shift
export GENERATOR_POST=$1
shift
export GENERATOR_POST_CONFIG=$1
shift
export GENERATOR_POST_CONFIGEVT=$1
shift
export GENERATOR_POST_CONFIGDEC=$1
shift
export GEANT_VERTEXT_AREA=$1
shift
export GEANT_VERTEXT_LENGTH=$1
shift
export MCSMEAR_NOTAG=$1
shift
export PROJECT_DIR_NAME=$1
export USER_BC=`which bc`
export USER_PYTHON=`which python`
export USER_STAT=`which stat`
export BEARER_TOKEN_FILE=${_CONDOR_CREDS}/jlab_gluex.use
length_count=$((`echo $RUN_NUMBER | wc -c` - 1))
formatted_runNumber=""
while [ $length_count -lt 6 ]; do
formatted_runNumber="0""$formatted_runNumber"
length_count=$(($length_count + 1))
done
formatted_runNumber=$formatted_runNumber$RUN_NUMBER
flength_count=$((`echo $FILE_NUMBER | wc -c` - 1))
export XRD_RANDOMS_URL=root://sci-xrootd.jlab.org//osgpool/halld/
export RANDOMS_PREPEND=""
if [[ "$BATCHSYS" == "OSG" && "$BATCHRUN"=="1" ]]; then
export XRD_RANDOMS_URL=xroots://dtn-gluex.jlab.org/
export RANDOMS_PREPEND="/gluex/mcwrap/"
fi
if [[ ("$MCWRAPPER_RUN_LOCATION" == "JLAB" || `hostname` == *'.jlab.org'*) && "$BATCHSYS" != "slurmcont" ]]; then
#export XRD_RANDOMS_URL=root://sci-xrootd-ib.qcd.jlab.org//osgpool/halld/
echo "JLAB DETECTED RESETTING RUNNING DIR"
echo "changing "$RUNNING_DIR" to ./"
export RUNNING_DIR="./"
fi
export MAKE_MC_USING_XROOTD=0
#ls /usr/lib64/libXrdPosixPreload.so
if [[ -f /usr/lib64/libXrdPosixPreload.so && "$BKGFOLDSTR" != "None" && "$GENR" != "0" && "$GEANT" != "0" && "$SMEAR" != "0" ]]; then
export MAKE_MC_USING_XROOTD=1
export LD_PRELOAD=/usr/lib64/libXrdPosixPreload.so
echo "XROOTD is available for use if needed..."
if [[ "$BKGFOLDSTR" == "Random" ]]; then
#check if xrdfs $XRD_RANDOMS_URL ls /gluex/mcwrap/random_triggers/$RANDBGTAG/run$formatted_runNumber\_random.hddm | wc -l returns 1 or an ERROR
httokendecode -H
echo "XRD_RANDOMS_URL: $XRD_RANDOMS_URL"
echo "RANDBGTAG: $RANDBGTAG"
echo "formatted_runNumber: $formatted_runNumber"
echo `ls $XRD_RANDOMS_URL/$RANDOMS_PREPEND/random_triggers/$RANDBGTAG/run$formatted_runNumber\_random.hddm`
export con_test=`ls $XRD_RANDOMS_URL/$RANDOMS_PREPEND/random_triggers/$RANDBGTAG/run$formatted_runNumber\_random.hddm | head -c 1`
export contest=`xrdfs $XRD_RANDOMS_URL ls $RANDOMS_PREPEND/random_triggers/$RANDBGTAG/run$formatted_runNumber\_random.hddm | wc -l`
#echo "Executing command: xrdfs $XRD_RANDOMS_URL ls /gluex/mcwrap/random_triggers/$RANDBGTAG/run${formatted_runNumber}_random.hddm | wc -l"
#xrdfs $XRD_RANDOMS_URL ls /gluex/mcwrap/random_triggers/$RANDBGTAG/run${formatted_runNumber}_random.hddm | wc -l
#export con_test=$(xrdfs $XRD_RANDOMS_URL ls /gluex/mcwrap/random_triggers/$RANDBGTAG/run${formatted_runNumber}_random.hddm)
echo "random trigger connection test: $con_test"
echo xrdfs $XRD_RANDOMS_URL ls $RANDOMS_PREPEND/random_triggers/$RANDBGTAG/run$formatted_runNumber\_random.hddm
echo "random trigger connection test2: $contest"
if [[ $con_test != "r" && $contest == 0 ]]; then
echo "JLab Connection test failed. Falling back to UConn...."
#echo "attempting to copy the needed file from an alternate source..."
#rsync scosg16.jlab.org:/osgpool/halld/random_triggers/$RANDBGTAG/run$formatted_runNumber\_random.hddm ./
export XRD_RANDOMS_URL=root://nod25.phys.uconn.edu/Gluex/rawdata/
if [[ `ls $XRD_RANDOMS_URL/random_triggers/$RANDBGTAG/run$formatted_runNumber\_random.hddm | head -c 1` != "r" ]]; then
echo "Cannot connect to the file. Disabling xrootd...."
export MAKE_MC_USING_XROOTD=0
fi
#else
# export XRD_RANDOMS_URL=$XRD_RANDOMS_URL/gluex/mcwrap/
fi
fi
fi
#override xrootd
#export MAKE_MC_USING_XROOTD=0
if [[ "$BATCHSYS" == "OSG" && "$BATCHRUN"=="1" ]]; then
export USER_BC='/usr/bin/bc'
export USER_STAT='/usr/bin/stat'
fi
#printenv
#necessary to run swif, uses local directory if swif=0 is used
if [[ "$BATCHRUN" != "0" ]]; then
# ENVIRONMENT
echo $ENVIRONMENT
echo pwd=$PWD
mkdir -p $OUTDIR
mkdir -p $OUTDIR/log
fi
if [[ "$BATCHSYS" == "QSUB" ]]; then
if [[ ! -d $RUNNING_DIR ]]; then
mkdir $RUNNING_DIR
fi
cd $RUNNING_DIR
fi
if [[ ! -d $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER} ]]; then
echo "making work directory "$RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER}
mkdir -p $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER}
fi
echo "cd $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER}"
cd $RUNNING_DIR/${RUN_NUMBER}_${FILE_NUMBER}
if [[ "$ccdbSQLITEPATH" != "no_sqlite" && "$ccdbSQLITEPATH" != "batch_default" && "$ccdbSQLITEPATH" != "jlab_batch_default" ]]; then
if [[ `$USER_STAT --file-system --format=%T $PWD` == "lustre" ]]; then
echo "Attempting to use sqlite on a lustre file system. This does not work. Try running on a different file system!"
echo "something went wrong with initialization"
exit 1
fi
cp $ccdbSQLITEPATH ./ccdb.sqlite
export CCDB_CONNECTION=sqlite:///$PWD/ccdb.sqlite
export JANA_CALIB_URL=$CCDB_CONNECTION
elif [[ "$ccdbSQLITEPATH" == "batch_default" ]]; then
export CCDB_CONNECTION=sqlite:////group/halld/www/halldweb/html/dist/ccdb.sqlite
export JANA_CALIB_URL=${CCDB_CONNECTION}
elif [[ "$ccdbSQLITEPATH" == "jlab_batch_default" ]]; then
# if [[ -f /usr/lib64/libXrdPosixPreload.so ]]; then
# xrdcopy $XRD_RANDOMS_URL/ccdb.sqlite ./
# export CCDB_CONNECTION=sqlite:///$PWD/ccdb.sqlite
#else
# ccdb_jlab_sqlite_path=`echo $((1 + RANDOM % 100))`
# if [[ -f /work/halld/ccdb_sqlite/$ccdb_jlab_sqlite_path/ccdb.sqlite ]]; then
# cp /work/halld/ccdb_sqlite/$ccdb_jlab_sqlite_path/ccdb.sqlite $PWD/ccdb.sqlite
# export CCDB_CONNECTION=sqlite:///$PWD/ccdb.sqlite
# #setenv CCDB_CONNECTION sqlite:////work/halld/ccdb_sqlite/$ccdb_jlab_sqlite_path/ccdb.sqlite
# else
# export CCDB_CONNECTION=mysql://[email protected]/ccdb
# fi
#fi
export CCDB_CONNECTION=mysql://[email protected]/ccdb
export JANA_CALIB_URL=${CCDB_CONNECTION}
fi
#export JANA_GEOMETRY_URL="ccdb:///GEOMETRY/main_HDDS.xml context=\"$VERSION\""
if [[ "$rcdbSQLITEPATH" != "no_sqlite" && "$rcdbSQLITEPATH" != "batch_default" ]]; then
if [[ `$USER_STAT --file-system --format=%T $PWD` == "lustre" ]]; then
echo "Attempting to use sqlite on a lustre file system. This does not work. Try running on a different file system!"
echo "something went wrong with initialization"
exit 1
fi
cp $rcdbSQLITEPATH ./rcdb.sqlite
export RCDB_CONNECTION=sqlite:///$PWD/rcdb.sqlite
elif [[ "$rcdbSQLITEPATH" == "batch_default" ]]; then
#echo "keeping the RCDB on mysql now"
export RCDB_CONNECTION=sqlite:////group/halld/www/halldweb/html/dist/rcdb.sqlite
fi
echo ""
echo ""
echo "Detected bash shell"
current_files=`find . -maxdepth 1 -type f`
beam_on_current="Not needed"
radthick="Not needed"
colsize="Not Needed"
polarization_angle="Not Needed"
BGRATE_toUse="Not Needed"
gen_pre_rcdb=`echo $GENERATOR | cut -c1-4`
if [[ $gen_pre_rcdb != "file" || "$BGTAGONLY_OPTION" == "1" || "$BKGFOLDSTR" == "BeamPhotons" ]]; then
radthick="50.e-6"
if [[ "$RADIATOR_THICKNESS" != "rcdb" || "$VERSION" != "mc" && "$VERSION" != "mc_workfest2018" && "$VERSION" != "mc_cpp" && "$VERSION" != "mc_JEF" ]]; then
radthick=$RADIATOR_THICKNESS
else
words=`rcnd $RUN_NUMBER radiator_type | sed 's/ / /g' `
for word in $words;
do
if [[ "$word" != "number" ]]; then
if [[ "$word" == "3x10-4" ]]; then
radthick="30e-6"
break
else
removedum=`echo $word | sed 's/um/ /g'`
if [[ $removedum != $word ]]; then
radthick=`echo "$removedum e-6" | tr -d '[:space:]'`
fi
fi
fi
done
fi
echo "Radiator thickness set..."
polarization_angle=`rcnd $RUN_NUMBER polarization_angle | awk '{print $1}'`
if [[ "$polarization_angle" == "" ]]; then
poldir=`rcnd $RUN_NUMBER polarization_direction | awk '{print $1}'`
if [[ "$poldir" == "PARA" ]]; then
polarization_angle="0.0"
elif [[ "$poldir" == "PERP" ]]; then
polarization_angle="90.0"
else
polarization_angle="-1.0"
fi
fi
echo "Polarization angle set..."
elecE=0
variation=$VERSION
if [[ $CALIBTIME != "notime" ]]; then
variation=$variation":"$CALIBTIME
fi
ccdbelece="`ccdb dump PHOTON_BEAM/endpoint_energy:${RUN_NUMBER}:${variation} | grep -v \#`"
#ccdblist=(`echo ${ccdbelece}`) #(${ccdbelece:/\ /\ /})
#ccdblist_length=${#ccdblist[@]}
elecE_text="$ccdbelece" #`echo ${ccdblist[$(($ccdblist_length-1))]}`
#elecE_text=`rcnd $RUN_NUMBER beam_energy | awk '{print $1}'`
if [[ "$eBEAM_ENERGY" != "rcdb" || "$VERSION" != "mc" && "$VERSION" != "mc_workfest2018" && "$VERSION" != "mc_cpp" && "$VERSION" != "mc_JEF" ]]; then
elecE=$eBEAM_ENERGY
elif [[ $elecE_text == "Run" ]]; then
elecE=12
elif [[ $elecE_text == "-1.0" ]]; then
elecE=12 #Should never happen
else
elecE=`echo $elecE_text`
#elecE=`echo "$elecE_text / 1000" | bc -l `
fi
echo "Electron beam energy set..."
copeak=0
copeak_text=`rcnd $RUN_NUMBER coherent_peak | awk '{print $1}'`
if [[ "$COHERENT_PEAK" != "rcdb" && "$polarization_angle" == "-1.0" ]]; then
copeak=$COHERENT_PEAK
else
if [[ "$COHERENT_PEAK" != "rcdb" || "$VERSION" != "mc" && "$VERSION" != "mc_workfest2018" && "$VERSION" != "mc_cpp" && "$VERSION" != "mc_JEF" ]]; then
copeak=$COHERENT_PEAK
elif [[ $copeak_text == "Run" ]]; then
copeak=9
elif [[ $copeak_text == "-1.0" ]]; then
copeak=0
else
copeak=`echo "$copeak_text / 1000" | $USER_BC -l `
fi
fi
if [[ "$polarization_angle" == "-1.0" && "$COHERENT_PEAK" == "rcdb" ]]; then
copeak=0
fi
#echo $copeak
#set copeak=`rcnd $RUN_NUMBER coherent_peak | awk '{print $1}' | sed 's/\.//g' #| awk -vFS="" -vOFS="" '{$1=$1"."}1' `
export COHERENT_PEAK=$copeak
echo "Coherent peak set..."
if [[ "$VERSION" != "mc" && "$VERSION" != "mc_cpp" && "$VERSION" != "mc_JEF" && "$VERSION" != "mc_workfest2018" && "$COHERENT_PEAK" == "rcdb" ]]; then
echo "error in requesting rcdb for the coherent peak while not using variation=mc"
echo "something went wrong with initialization"
exit 1
fi
export eBEAM_ENERGY=$elecE
echo "eBEAM energy set..."
if [[ "$VERSION" != "mc" && "$VERSION" != "mc_cpp" && "$VERSION" != "mc_JEF" && "$VERSION" != "mc_workfest2018" && "$eBEAM_ENERGY" == "rcdb" ]]; then
echo "error in requesting rcdb for the electron beam energy and not using variation=mc"
echo "something went wrong with initialization"
exit 1
fi
echo RCDB exe: `which rcnd`
if [[ "$eBEAM_CURRENT" == "rcdb" ]]; then
beam_on_current=`rcnd $RUN_NUMBER beam_on_current | awk '{print $1}'`
echo beam_on_current is $beam_on_current
if [[ $beam_on_current == "" || $beam_on_current == "Run" ]]; then
echo "Run $RUN_NUMBER does not have a beam_on_current.Defaulting to beam_current."
beam_on_current=`rcnd $RUN_NUMBER beam_current | awk '{print $1}'`
echo beam_current is `rcnd $RUN_NUMBER beam_current`
fi
if [[ $beam_on_current == "Run" ]]; then
echo "The beam current could not be found for Run "$RUN_NUMBER". This is most like due to the run number provided not existing in the rcdb"
echo "Please set eBEAM_CURRENT explicitly in MC.config..."
echo "something went wrong with initialization"
exit 1
fi
beam_on_current=`echo "$beam_on_current / 1000." | $USER_BC -l`
echo "$eBEAM_CURRENT"
else
beam_on_current=$eBEAM_CURRENT
fi
echo "beam (on) current set..."
colsize=`rcnd $RUN_NUMBER collimator_diameter | awk '{print $1}' | sed -r 's/.{2}$//' | sed -e 's/\.//g'`
if [[ "$colsize" == "B" || "$colsize" == "R" || "$JANA_CALIB_CONTEXT" != "variation=mc" ]]; then
colsize="50"
fi
echo "Collimator size set..."
BGRATE_toUse=$BGRATE
if [[ "$BGRATE" != "rcdb" || "$VERSION" != "mc" && "$VERSION" != "mc_workfest2018" && "$VERSION" != "mc_cpp" && "$VERSION" != "mc_JEF" ]]; then
BGRATE_toUse=$BGRATE
else
if [[ $BGTAGONLY_OPTION == "1" || $BKGFOLDSTR == "BeamPhotons" ]]; then
echo "Calculating BGRate. This process takes a minute..."
BGRATE_toUse=`BGRate_calc --runNo $RUN_NUMBER --coherent_peak $COHERENT_PEAK --beam_on_current $beam_on_current --beam_energy $eBEAM_ENERGY --collimator_diameter 0.00$colsize --radiator_thickness $radthick --endpoint_energy_low $GEN_MIN_ENERGY --endpoint_energy_high $GEN_MAX_ENERGY`
if [[ $BGRATE_toUse == "" ]]; then
echo "BGrate_calc is not built or inaccessible. Please check your build and/or specify a BGRate to be used."
echo "something went wrong with initialization"
exit 12
else
BGRATE_list=(`echo ${BGRATE_toUse}`)
BGRATE_list_length=${#BGRATE_list[@]}
BGRATE_toUse=`echo ${BGRATE_list[$(($BGRATE_list_length-1))]}`
fi
fi
fi
if [[ "$polarization_angle" == "-1.0" ]]; then
POL_TO_GEN=0
fi
fi
isGreater=1
#echo $isGreater
isGreater=`echo $GEN_MAX_ENERGY'>'$eBEAM_ENERGY | $USER_BC -l`
#echo $isGreater
#echo "$isGreater"
if [[ "$isGreater" == "1" && "$eBEAM_ENERGY" != "rcdb" ]]; then
echo "WARNING: User requested GEN_MAX_ENERGY > eBEAM_ENERGY. This is not possible. Setting GEN_MAX_ENERGY to eBEAM_ENERGY..."
export GEN_MAX_ENERGY=$eBEAM_ENERGY
fi
# PRINT INPUTS
echo "Using : " $BATCHSYS
echo "This job has been configured to run at: " $MCWRAPPER_RUN_LOCATION" : "`hostname`
echo "Job started: " `date`
echo "Simulating the Experiment: " $EXPERIMENT
echo "ccdbsqlite path: " $ccdbSQLITEPATH $CCDB_CONNECTION
echo "rcdbsqlite path: " $rcdbSQLITEPATH $RCDB_CONNECTION
echo "Producing file number: "$FILE_NUMBER
echo "Containing: " $EVT_TO_GEN"/""$PER_FILE"" events"
echo "Running location:" $RUNNING_DIR
echo "Current Working Directory:" $PWD
echo "Output location: "$OUTDIR
echo "Project directory name: "$PROJECT_DIR_NAME
echo "Environment file: " $ENVIRONMENT
echo "Analysis Environment file: " $ANAENVIRONMENT
echo "Context: "$JANA_CALIB_CONTEXT
echo "Geometry URL: "$JANA_GEOMETRY_URL
echo "Reconstruction calibtime: "$RECON_CALIBTIME
echo "Run Number: "$RUN_NUMBER
echo "Electron beam current to use: "$beam_on_current" uA"
echo "Electron beam energy to use: "$eBEAM_ENERGY" GeV"
echo "Radiator Thickness to use: "$radthick" m"
echo "Collimator Diameter: 0.00"$colsize" m"
echo "Photon Energy between "$GEN_MIN_ENERGY" and "$GEN_MAX_ENERGY" GeV"
echo "Polarization Angle: "$polarization_angle "degrees"
echo "Coherent Peak position: "$COHERENT_PEAK
echo "----------------------------------------------"
echo "Run generation step? "$GENR" Will be cleaned?" $CLEANGENR
echo "Flux Hist to use: " "$FLUX_TO_GEN" " : " "$FLUX_HIST"
echo "Polarization to use: " "$POL_TO_GEN" " : " "$POL_HIST"
echo "Using "$GENERATOR" with config: "$CONFIG_FILE
echo "Will run "$GENERATOR_POST" postprocessing after generator with configuration: "$GENERATOR_POST_CONFIG", event definitions: "$GENERATOR_POST_CONFIGEVT" and decay definitions: "$GENERATOR_POST_CONFIGDEC
echo "----------------------------------------------"
echo "Run geant step? "$GEANT" Will be cleaned?" $CLEANGEANT
echo "Using geant"$GEANTVER
echo "Custom Gcontrol?" "$CUSTOM_GCONTROL"
echo "Background to use: "$BKGFOLDSTR
echo "Random trigger background to use: "$RANDBGTAG
echo "BGRATE will be set to: "$BGRATE_toUse" GHz (if applicable)"
echo "Run mcsmear? "$SMEAR" Will be cleaned?" $CLEANSMEAR
echo "----------------------------------------------"
echo "Run reconstruction? "$RECON" Will be cleaned?" $CLEANRECON
echo "With additional plugins: "$CUSTOM_PLUGINS
echo "With additional analysis launch plugins: "$CUSTOM_ANA_PLUGINS
echo "=============================================="
echo ""
echo ""
echo "=======SOFTWARE USED======="
echo "MCwrapper version v"$MCWRAPPER_VERSION
echo "MCwrapper location" $MCWRAPPER_CENTRAL
echo "LDPRELOAD: " $LD_PRELOAD
echo "Streaming via xrootd? "$MAKE_MC_USING_XROOTD "Event Count: "$RANDOM_TRIG_NUM_EVT
echo "BC "$USER_BC
echo "python "$USER_PYTHON
echo `which $GENERATOR`
if [[ "$GENERATOR_POST" != "No" ]]; then
echo `which $GENERATOR_POST`
fi
if [[ "$GEANTVER" == "3" ]]; then
echo `which hdgeant`
else
echo `which hdgeant4`
fi
echo `which mcsmear`
echo `which hd_root`
echo ""
echo ""
if [[ "$CUSTOM_GCONTROL" == "0" && "$GEANT" == "1" ]]; then
if [[ "$EXPERIMENT" == "GlueX" ]]; then
cp $MCWRAPPER_CENTRAL/Gcontrol.in ./temp_Gcontrol.in
elif [[ "$EXPERIMENT" == "CPP" ]]; then
cp $MCWRAPPER_CENTRAL/Gcontrol_cpp.in ./temp_Gcontrol.in
else
cp $MCWRAPPER_CENTRAL/Gcontrol.in ./temp_Gcontrol.in
fi
chmod 777 ./temp_Gcontrol.in
elif [[ "$CUSTOM_GCONTROL" != "0" && "$GEANT" == "1" ]]; then
cp $CUSTOM_GCONTROL ./temp_Gcontrol.in
else
echo "NO GEANT"
fi
formatted_fileNumber=""
while [ $flength_count -lt 3 ]; do
formatted_fileNumber="0""$formatted_fileNumber"
flength_count=$(($flength_count + 1))
done
formatted_fileNumber=$formatted_fileNumber$FILE_NUMBER
custom_tag=""
if [[ "$TAGSTR" != "I_dont_have_one" ]]; then
custom_tag=$TAGSTR\_
fi
STANDARD_NAME=$custom_tag$formatted_runNumber\_$formatted_fileNumber
if [[ `echo $eBEAM_ENERGY | grep -o "\." | wc -l` == 0 ]]; then
eBEAM_ENERGY=$eBEAM_ENERGY\.
fi
if [[ `echo $COHERENT_PEAK | grep -o "\." | wc -l` == 0 ]]; then
COHERENT_PEAK=$COHERENT_PEAK\.
fi
if [[ `echo $GEN_MIN_ENERGY | grep -o "\." | wc -l` == 0 ]]; then
GEN_MIN_ENERGY=$GEN_MIN_ENERGY\.
fi
if [[ `echo $GEN_MAX_ENERGY | grep -o "\." | wc -l` == 0 ]]; then
GEN_MAX_ENERGY=$GEN_MAX_ENERGY\.
fi
if [[ ! -d "$OUTDIR" ]]; then
mkdir $OUTDIR
fi
if [[ ! -d "$OUTDIR/configurations/" ]]; then
mkdir $OUTDIR/configurations/
fi
if [[ ! -d "$OUTDIR/configurations/generation/" ]]; then
mkdir $OUTDIR/configurations/generation/
fi
if [[ ! -d "$OUTDIR/configurations/geant/" ]]; then
mkdir $OUTDIR/configurations/geant/
fi
if [[ ! -d "$OUTDIR/hddm/" ]]; then
mkdir $OUTDIR/hddm/
fi
if [[ ! -d "$OUTDIR/root/" ]]; then
mkdir $OUTDIR/root/
fi
bkglocstring=""
bkgloc_pre=`echo $BKGFOLDSTR | cut -c 1-4`
if [[ ("$BKGFOLDSTR" == "DEFAULT" || "$bkgloc_pre" == "loc:" || "$BKGFOLDSTR" == "Random") && "$GENR" != "0" && "$GEANT" != "0" && "$SMEAR" != "0" ]]; then
#find file and run:1
if [[ "$RANDBGTAG" == "none" && "$bkgloc_pre" != "loc:" ]]; then
echo "Random background requested but no tag given. Please provide the desired tag e.g Random:recon-2017_01-ver03"
echo "something went wrong with initialization"
exit 1
fi
echo "Finding the right file to fold in during MCsmear step"
runperiod="RunPeriod-2017-01"
if [[ $RUN_NUMBER -gt 40000 || $RUN_NUMBER == 40000 ]]; then
runperiod="RunPeriod-2018-01"
elif [[ $RUN_NUMBER -gt 30000 || $RUN_NUMBER == 30000 ]]; then
runperiod="RunPeriod-2017-01"
elif [[ $RUN_NUMBER -gt 20000 || $RUN_NUMBER == 20000 ]]; then
runperiod="RunPeriod-2016-10"
elif [[ $RUN_NUMBER -gt 10000 || $RUN_NUMBER == 10000 ]]; then
runperiod="RunPeriod-2016-02"
fi
if [[ $RUN_NUMBER < 10000 ]]; then
echo "Warning: random triggers do not exist for this run number"
exit
fi
if [[ "$bkgloc_pre" == "loc:" ]]; then
rand_bkg_loc=`echo $BKGFOLDSTR | cut -c 5-`
if [[ "$BATCHSYS" == "OSG" && $BATCHRUN != 0 ]]; then
if [[ "$MAKE_MC_USING_XROOTD" == "0" ]]; then
bkglocstring="/srv""/run$formatted_runNumber""_random.hddm"
else
bkglocstring="$XRD_RANDOMS_URL/random_triggers/$RANDBGTAG/run$formatted_runNumber""_random.hddm"
fi
else
bkglocstring=$rand_bkg_loc"/run$formatted_runNumber""_random.hddm"
fi
else
#bkglocstring="/cache/halld/""$runperiod""/sim/random_triggers/""run$formatted_runNumber""_random.hddm"
if [[ "$BATCHSYS" == "OSG" && $BATCHRUN != 0 ]]; then
if [[ "$MAKE_MC_USING_XROOTD" == "0" ]]; then
bkglocstring="/srv""/run$formatted_runNumber""_random.hddm"
else
bkglocstring="$XRD_RANDOMS_URL/random_triggers/$RANDBGTAG/run$formatted_runNumber""_random.hddm"
fi
else
bkglocstring="/work/osgpool/halld/random_triggers/"$RANDBGTAG"/run"$formatted_runNumber"_random.hddm"
if [[ `hostname` == 'scosg16.jlab.org' || `hostname` == 'scosg20.jlab.org' || `hostname` == 'scosg2201.jlab.org' ]]; then
bkglocstring="/work/osgpool/halld/random_triggers/"$RANDBGTAG"/run"$formatted_runNumber"_random.hddm"
fi
fi
fi
#set bkglocstring="/w/halld-scifs1a/home/tbritton/converted.hddm"
if [[ ! -f $bkglocstring && "$MAKE_MC_USING_XROOTD" == "0" ]]; then
echo "something went wrong with initialization"
echo "Could not find mix-in file "$bkglocstring
exit 1000
fi
#if [[ "$BATCHSYS" == "OSG" && "$MAKE_MC_USING_XROOTD" == "1" && $RANDOM_TRIG_NUM_EVT == -1 ]]; then
#echo "something went wrong with initialization"
#echo "Could not find mix-in file "$bkglocstring
#exit 1000
#fi
fi
recon_pre=`echo $CUSTOM_PLUGINS | cut -c1-4`
jana_config_file=`echo $CUSTOM_PLUGINS | sed -r 's/^.{5}//'`
echo "RECO PREFIX: " $recon_pre
if [[ $recon_pre == "file" ]]; then
if [[ -f $jana_config_file ]]; then
echo "gathering jana config file"
cp $jana_config_file ./jana_config.cfg
fi
fi
gen_pre=""
if [[ "$CUSTOM_ANA_PLUGINS" != "None" ]]; then
ana_pre=`echo $CUSTOM_ANA_PLUGINS | cut -c1-4`
jana_ana_config_file=`echo $CUSTOM_ANA_PLUGINS | sed -r 's/^.{5}//'`
echo "ANA PREFIX: " $ana_pre
if [[ $ana_pre == "file" ]]; then
if [[ -f $jana_ana_config_file ]]; then
echo "gathering jana config file"
cp $jana_ana_config_file ./ana_jana.cfg
fi
fi
fi
if [[ "$GENR" != "0" ]]; then # run generation
gen_pre=`echo $GENERATOR | cut -c1-4`
if [[ "$gen_pre" != "file" && "$GENERATOR" != "genr8" && "$GENERATOR" != "bggen" && "$GENERATOR" != "genEtaRegge" && "$GENERATOR" != "genScalarRegge" && "$GENERATOR" != "gen_2pi_amp" && "$GENERATOR" != "gen_pi0" && "$GENERATOR" != "gen_2pi_primakoff" && "$GENERATOR" != "gen_2pi0_primakoff" && "$GENERATOR" != "gen_omega_3pi" && "$GENERATOR" != "gen_omegapi" && "$GENERATOR" != "gen_2k" && "$GENERATOR" != "bggen_jpsi" && "$GENERATOR" != "gen_ee" && "$GENERATOR" != "gen_ee_hb" && "$GENERATOR" != "particle_gun" && "$GENERATOR" != "geantBEAM" && "$GENERATOR" != "bggen_phi_ee" && "$GENERATOR" != "genBH" && "$GENERATOR" != "gen_omega_radiative" && "$GENERATOR" != "gen_amp" && "$GENERATOR" != "gen_amp_V2" && "$GENERATOR" != "genr8_new" && "$GENERATOR" != "gen_compton" && "$GENERATOR" != "gen_npi" && "$GENERATOR" != "gen_compton_simple" && "$GENERATOR" != "gen_primex_eta_he4" && "$GENERATOR" != "gen_whizard" && "$GENERATOR" != "mc_gen" && "$GENERATOR" != "gen_vec_ps" && "$GENERATOR" != "bggen_upd" && "$GENERATOR" != "python" ]]; then
echo "NO VALID GENERATOR GIVEN"
echo "only [genr8, bggen, genEtaRegge, genScalarRegge, gen_2pi_amp, gen_pi0, gen_omega_3pi, gen_2k, bggen_jpsi, gen_ee, gen_ee_hb, bggen_phi_ee, particle_gun, geantBEAM, genBH, gen_omega_radiative, gen_amp, gen_amp_V2, gen_compton, gen_npi, gen_compton_simple, gen_primex_eta_he4, gen_whizard, gen_omegapi, mc_gen, gen_vec_ps, bggen_upd, python] are supported"
exit 1
fi
if [[ "$gen_pre" == "file" ]]; then
gen_in_file=`echo $GENERATOR | sed -r 's/^.{5}//'`
echo "bypassing generation"
echo "using "$gen_in_file
if [[ -f $gen_in_file ]]; then
echo "using pre-generated file: "$gen_in_file
cp $gen_in_file ./$STANDARD_NAME.hddm
else
echo "cannot find file: "$gen_in_file
exit
fi
generator_return_code=0
elif [[ "$GENERATOR" == "particle_gun" ]]; then
echo "bypassing generation"
echo "using" $CONFIG_FILE
if [[ "$CUSTOM_GCONTROL" == "0" ]]; then
if [[ ! -f $CONFIG_FILE ]]; then
echo "Generator config file : "$CONFIG_FILE "not found"
echo "something went wrong with initialization"
exit 1
else
echo "performing error checking"
echo "Note: this specific error checking has been disabled as it causes issues on some bash shells. Basically if you need to use the THETA and PHI parameters then make sure they are set."
#echo `grep "^[^c]" | grep KINE $CONFIG_FILE | awk '{print $2}' `
#echo `grep "^[^c]" | grep KINE $CONFIG_FILE | wc -w`
#if [[ `grep "^[^c]" | grep KINE $CONFIG_FILE | awk '{print $2}' ` < 100 && `grep "^[^c]" | grep KINE $CONFIG_FILE | wc -w` > 3 ]]; then
# echo "ERROR THETA AND PHI APPEAR TO BE SET BUT WILL BE IGNORED. PLEASE REMOVE THESE SETTINGS FROM:"$CONFIG_FILE" AND RESUBMIT."
# exit 1
#elif [[ `grep "^[^c]" | grep KINE $CONFIG_FILE | awk '{print $2}' ` > 100 && `grep "^[^c]" | grep KINE $CONFIG_FILE | wc -w` < 8 ]]; then
# echo "ERROR THETA AND PHI DON'T APPEAR TO BE SET BUT ARE GOING TO BE USED. PLEASE ADD THESE SETTINGS FROM: "$CONFIG_FILE" AND RESUBMIT."
# exit 1
#fi
fi
fi
generator_return_code=0
elif [[ "$GENERATOR" == "geantBEAM" ]]; then
echo "bypassing generation"
echo "using" $CONFIG_FILE
if [[ "$CUSTOM_GCONTROL" == "0" ]]; then
if [[ ! -f $CONFIG_FILE ]]; then
echo "Generator config file : "$CONFIG_FILE "not found"
echo "something went wrong with initialization"
exit 1
else
echo "performing error checking"
echo "Note: this specific error checking has been disabled as it causes issues on some bash shells. Basically if you use the GENBEAM parameters then make sure they are set correctly."
# echo `grep "^[^c]" | grep GENBEAM $CONFIG_FILE | awk '{print $2}' `
# if [[ `grep "^[^c]" | grep GENBEAM $CONFIG_FILE | awk '{print $2}' ` != "'precol'" && `grep "^[^c]" | grep GENBEAM $CONFIG_FILE | awk '{print $2}' ` != "'postcol'" && `grep "^[^c]" | grep GENBEAM $CONFIG_FILE | awk '{print $2}' ` != "'postconv'" && `grep "^[^c]" | grep GENBEAM $CONFIG_FILE | awk '{print $2}' ` != "'BHgen'" ]]; then
# echo "ERROR GENBEAM CARD NOT VALID. PLEASE CHANGE THE SETTING IN:"$CONFIG_FILE" AND RESUBMIT."
# exit 1
# fi
fi
fi
generator_return_code=0
else
if [[ -f $CONFIG_FILE ]]; then
echo "input file found"
elif [[ "$GENERATOR" == "gen_ee_hb" || "$GENERATOR" == "genBH" ]]; then
echo "Config file not applicable"
else
echo $CONFIG_FILE" does not exist"
echo "something went wrong with initialization"
exit 1
fi
fi
echo "Begin writing beam.config"
echo "PolarizationAngle $polarization_angle" > beam.config
echo "PhotonBeamLowEnergy $GEN_MIN_ENERGY" >> beam.config
echo "PhotonBeamHighEnergy $GEN_MAX_ENERGY" >> beam.config
if [[ "$FLUX_TO_GEN" == "ccdb" ]]; then
echo "CCDBRunNumber $RUN_NUMBER" >> beam.config
echo "ROOTFluxFile $FLUX_TO_GEN" >> beam.config
if [[ "$POL_TO_GEN" == "ccdb" ]]; then
echo "ROOTPolFile $POL_TO_GEN" >> beam.config
elif [[ "$POL_HIST" == "unset" ]]; then
echo "PolarizationMagnitude $POL_TO_GEN" >> beam.config
else
echo "ROOTPolFile $POL_TO_GEN" >> beam.config
echo "ROOTPolName $POL_HIST" >> beam.config
fi
elif [[ "$FLUX_TO_GEN" == "cobrems" ]]; then
echo "ElectronBeamEnergy $eBEAM_ENERGY" >> beam.config
echo "CoherentPeakEnergy $COHERENT_PEAK" >> beam.config
echo "Emittance 2.5.e-9" >> beam.config
echo "RadiatorThickness $radthick" >> beam.config
echo "CollimatorDiameter 0.00$colsize" >> beam.config
echo "CollimatorDistance 76.0" >> beam.config
if [[ "$POL_TO_GEN" == "ccdb" ]]; then
echo "Ignoring TPOL from ccdb in favor of cobrems generated values"
elif [[ "$POL_HIST" == "cobrems" ]]; then
echo "PolarizationMagnitude $POL_TO_GEN" >> beam.config
elif [[ "$POL_HIST" != "unset" ]]; then
echo "Ignoring TPOL from $POL_TO_GEN in favor of cobrems generated values"
fi
else
echo "ROOTFluxFile $FLUX_TO_GEN" >> beam.config
echo "ROOTFluxName $FLUX_HIST" >> beam.config
if [[ "$POL_TO_GEN" == "ccdb" ]]; then
echo "Can't use a flux file and Polarization from ccdb"
echo "something went wrong with initialization"
exit 1
elif [[ "$POL_HIST" == "unset" ]]; then
echo "PolarizationMagnitude $POL_TO_GEN" >> beam.config
else
echo "ROOTPolFile $POL_TO_GEN" >> beam.config
echo "ROOTPolName $POL_HIST" >> beam.config
fi
fi
echo "finished writing beam.config"
if [[ "$GENERATOR" == "genr8" ]]; then
echo "configuring genr8"
STANDARD_NAME="genr8_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
replacementNum=`grep TEMPCOHERENT ./$STANDARD_NAME.conf | wc -l`
#if [[ "$polarization_angle" == "-1.0" && "$COHERENT_PEAK" == "0." && $replacementNum != 0 && "1"=="0" ]]; then
# echo "Running genr8 with an AMO run number without supplying the energy desired to COHERENT_PEAK causes an inifinite loop."
# echo "Please specify the desired energy via the COHERENT_PEAK parameter and retry."
# exit 1
#fi
elif [[ "$GENERATOR" == "genr8_new" ]]; then
echo "configuring new genr8"
STANDARD_NAME="genr8_new_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "bggen" ]]; then
echo "configuring bggen"
STANDARD_NAME="bggen_"$STANDARD_NAME
cp $MCWRAPPER_CENTRAL/Generators/bggen/particle.dat ./
cp $MCWRAPPER_CENTRAL/Generators/bggen/pythia.dat ./
cp $MCWRAPPER_CENTRAL/Generators/bggen/pythia-geant.map ./
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "genEtaRegge" ]]; then
echo "configuring genEtaRegge"
STANDARD_NAME="genEtaRegge_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "genScalarRegge" ]]; then
echo "configuring genScalerRegge"
STANDARD_NAME="genScalarRegge_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_amp" ]]; then
echo "configuring gen_amp"
STANDARD_NAME="gen_amp_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_amp_V2" ]]; then
echo "configuring gen_amp_V2"
STANDARD_NAME="gen_amp_V2_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_2pi_amp" ]]; then
echo "configuring gen_2pi_amp"
STANDARD_NAME="gen_2pi_amp_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_omega_3pi" ]]; then
echo "configuring gen_omega_3pi"
STANDARD_NAME="gen_omega_3pi_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_omegapi" ]]; then
echo "configuring gen_omegapi"
STANDARD_NAME="gen_omegapi_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_vec_ps" ]]; then
echo "configuring gen_vec_ps"
STANDARD_NAME="gen_vec_ps_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_omega_radiative" ]]; then
echo "configuring gen_omega_radiative"
STANDARD_NAME="gen_omega_radiative_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_2pi_primakoff" ]]; then
echo "configuring gen_2pi_primakoff"
STANDARD_NAME="gen_2pi_primakoff_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "mc_gen" ]]; then
echo "configuring mc_gen"
STANDARD_NAME="mc_gen_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_2pi0_primakoff" ]]; then
echo "configuring gen_2pi0_primakoff"
STANDARD_NAME="gen_2pi0_primakoff_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_pi0" ]]; then
echo "configuring gen_pi0"
STANDARD_NAME="gen_pi0_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_compton" ]]; then
echo "configuring gen_compton"
STANDARD_NAME="gen_compton_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_compton_simple" ]]; then
echo "configuring gen_compton_simple"
STANDARD_NAME="gen_compton_simple_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_primex_eta_he4" ]]; then
echo "configuring gen_primex_eta_he4"
STANDARD_NAME="gen_primex_eta_he4_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_whizard" ]]; then
echo "configuring gen_whizard"
STANDARD_NAME="gen_whizard_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_npi" ]]; then
echo "configuring gen_npi"
STANDARD_NAME="gen_npi_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_2k" ]]; then
echo "configuring gen_2k"
STANDARD_NAME="gen_2k_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "bggen_jpsi" ]]; then
echo "configuring bggen_jpsi"
STANDARD_NAME="bggen_jpsi_"$STANDARD_NAME
cp $MCWRAPPER_CENTRAL/Generators/bggen_jpsi/particle.dat ./
cp $MCWRAPPER_CENTRAL/Generators/bggen_jpsi/pythia.dat ./
cp $MCWRAPPER_CENTRAL/Generators/bggen_jpsi/pythia-geant.map ./
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "bggen_upd" ]]; then
echo "configuring bggen_upd"
STANDARD_NAME="bggen_upd_"$STANDARD_NAME
cp $HALLD_SIM_HOME/src/programs/Simulation/bggen_upd/run/particles.ffr ./
cp $HALLD_SIM_HOME/src/programs/Simulation/bggen_upd/run/pythia.dat ./
cp $HALLD_SIM_HOME/src/programs/Simulation/bggen_upd/run/run_mcwrapper.ffr ./
mkdir ./spec_fun
cp $HALLD_SIM_HOME/src/programs/Simulation/bggen_upd/run/spec_fun/* ./spec_fun/
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "bggen_phi_ee" ]]; then
echo "configuring bggen_phi_ee"
STANDARD_NAME="bggen_phi_ee_"$STANDARD_NAME
cp $MCWRAPPER_CENTRAL/Generators/bggen_phi_ee/particle.dat ./
cp $MCWRAPPER_CENTRAL/Generators/bggen_phi_ee/pythia.dat ./
cp $MCWRAPPER_CENTRAL/Generators/bggen_phi_ee/pythia-geant.map ./
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_ee" ]]; then
echo "configuring gen_ee"
STANDARD_NAME="gen_ee_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "gen_ee_hb" ]]; then
echo "configuring gen_ee_hb"
STANDARD_NAME="gen_ee_hb_"$STANDARD_NAME
echo "note: this generator is run completely from command line, thus no config file will be made and/or modified"
cp $CONFIG_FILE ./cobrems.root
cp $MCWRAPPER_CENTRAL/Generators/gen_ee_hb/CFFs_DD_Feb2012.dat ./
elif [[ "$GENERATOR" == "particle_gun" ]]; then
echo "configuring the particle gun"
STANDARD_NAME="particle_gun_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "geantBEAM" ]]; then
echo "configuring geantBEAM"
STANDARD_NAME="geantBeam"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
elif [[ "$GENERATOR" == "genBH" ]]; then
echo "configuring genBH"
STANDARD_NAME="genBH_"$STANDARD_NAME
echo "note: this generator is run completely from command line, thus no config file will be made and/or modified"
cp $CONFIG_FILE ./cobrems.root
elif [[ "$GENERATOR" == "python" ]]; then
echo "configuring python script"
STANDARD_NAME="python_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.py
fi
if [[ "$gen_pre" != "file" ]]; then
config_file_name=`basename "$CONFIG_FILE"`
echo $config_file_name