-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathgenerateEvents.sh
More file actions
executable file
·44 lines (35 loc) · 1.21 KB
/
Copy pathgenerateEvents.sh
File metadata and controls
executable file
·44 lines (35 loc) · 1.21 KB
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
#!/bin/bash -x
if [[ `basename $PWD` != "MCProd" ]]; then echo "Execute from MCProd dir"; exit; fi
if [[ $# < 1 ]];
then
echo "Usage: ./generateEvents.sh <mg script> [delphes card]"
echo "Example: ./generateEvents.sh $PWD/foo $PWD/delphes/cards/gen_card.tcl"
exit
else
mgScript=$1
if [[ $# -gt 1 ]]; then
delphesCard=$2
else
delphesCard="cards/gen_card.tcl"
fi
fi
source setup.sh
touch dummy
#########################################################################
cd MG5_aMC_v3_1_1
python ./bin/mg5_aMC < "${mgScript}"
gzs=`find . -newer ../dummy -name "unweighted_events.lhe.gz" -exec echo $PWD/{} \;`
echo $gzs
cd ..
#------------------------------------------------------------------------
cd delphes
for gz in $gzs; do
lhe=${gz%%.gz}
output=${lhe%%.lhe}.root #set delphes output path/name
gunzip $gz
n=`grep -c \<event\> $lhe`
echo $n
sed s%examples/Pythia8/events.lhe%$lhe% examples/Pythia8/configLHE.cmnd > configLHE.cmnd #this will create a new config pointing to your lhe
sed "s%Main:numberOfEvents = 10%Main:numberOfEvents = $n%" --in-place configLHE.cmnd
./DelphesPythia8 $delphesCard configLHE.cmnd $output #this runs delphes using your new config
done