1 | #!/bin/sh
|
---|
2 | ##############################################################################################
|
---|
3 | #
|
---|
4 | # This code produces at set of validation plots for a given detector card.
|
---|
5 | #
|
---|
6 | # In order to run this you need to compile Delphes with Pythia8 first, see:
|
---|
7 | #
|
---|
8 | # https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook/Pythia8
|
---|
9 | #
|
---|
10 | # After you (re-)compiled Delphes with Pythia8 you are ready to go, execute from Delphes main dir:
|
---|
11 | #
|
---|
12 | # ./examples/validation.sh [detector_card] [number_of_events]
|
---|
13 | #
|
---|
14 | # e.g.
|
---|
15 | #
|
---|
16 | # ./examples/validation.sh cards/delphes_card_CMS.tcl 100000
|
---|
17 | #
|
---|
18 | # Note that the more events you specify, the more accurate the controls plots will be ...
|
---|
19 | # This said, 500k events should be ok for most cases.
|
---|
20 | #
|
---|
21 | ############################################################################################
|
---|
22 |
|
---|
23 | EXPECTED_ARGS=2
|
---|
24 | E_BADARGS=65
|
---|
25 |
|
---|
26 | if [ $# -ne $EXPECTED_ARGS ]
|
---|
27 | then
|
---|
28 | echo "Usage: ./examples/validation.sh [detector_card] [number_of_events]"
|
---|
29 | echo "for instance: ./examples/validation.sh cards/delphes_card_CMS.tcl 10000"
|
---|
30 | exit $E_BADARGS
|
---|
31 | fi
|
---|
32 |
|
---|
33 | cardbase=$(basename $1)
|
---|
34 | carddir=$(dirname $1)
|
---|
35 | nEvents=$2
|
---|
36 | validationCard=$carddir/validation_$cardbase
|
---|
37 | output=validation_${cardbase%.*}.root
|
---|
38 | mainoutputdir=report_${cardbase%.*}
|
---|
39 | outputroot=report_${cardbase%.*}/root
|
---|
40 | cardlabel=${cardbase%.*}
|
---|
41 | version=$(cat VERSION)
|
---|
42 | outpdf=$mainoutputdir/${output%.*}.pdf
|
---|
43 | qcdPgLocation="/home/fynu/mselvaggi/storage/DelphesValidationSamples"
|
---|
44 |
|
---|
45 | mkdir -p $outputroot
|
---|
46 | mkdir -p $mainoutputdir/www/fig
|
---|
47 |
|
---|
48 | sed 's/delphes_card_CMS.tcl/'$cardbase'/g' cards/validation_card.tcl > $validationCard
|
---|
49 | sed -i "1i set MaxEvents ${nEvents}" "$validationCard"
|
---|
50 |
|
---|
51 | function runParticleGun {
|
---|
52 | name=$1
|
---|
53 | pid=$2
|
---|
54 | cmnd="examples/Pythia8/configParticleGun_$name.cmnd"
|
---|
55 | rootfile="particleGun_${name}_${cardlabel}.root"
|
---|
56 | sed '/Main:spareMode1/s/=[[:space:]]*[0-9]*/= '$pid'/' examples/Pythia8/configParticleGun.cmnd > examples/Pythia8/tmp.cmnd
|
---|
57 | sed '/Main:numberOfEvents/s/=[[:space:]]*[0-9]*/= '$nEvents'/' examples/Pythia8/tmp.cmnd > $cmnd
|
---|
58 | ./DelphesPythia8 $validationCard $cmnd $outputroot/$rootfile
|
---|
59 |
|
---|
60 | }
|
---|
61 |
|
---|
62 |
|
---|
63 | function runJetsGun {
|
---|
64 | name=$1
|
---|
65 | pid=$2
|
---|
66 | inputroot="${qcdPgLocation}/${pid}.root"
|
---|
67 | rootfile="particleGun_${name}_${cardlabel}.root"
|
---|
68 | ./DelphesROOT $validationCard $outputroot/$rootfile $inputroot
|
---|
69 | echo "./DelphesROOT $validationCard $outputroot/$rootfile $inputroot"
|
---|
70 | }
|
---|
71 |
|
---|
72 |
|
---|
73 | runParticleGun pion 211
|
---|
74 | runParticleGun electron 11
|
---|
75 | runParticleGun muon 13
|
---|
76 | runParticleGun photon 22
|
---|
77 | runParticleGun neutron 2112
|
---|
78 | runParticleGun taujet 15
|
---|
79 | runJetsGun jet 1 &
|
---|
80 | runJetsGun bjet 5 &
|
---|
81 | runJetsGun cjet 4 &
|
---|
82 |
|
---|
83 | wait
|
---|
84 | echo all particle guns complete ...
|
---|
85 |
|
---|
86 |
|
---|
87 | ./Validation $outputroot/particleGun_pion_$cardlabel.root $outputroot/particleGun_electron_$cardlabel.root $outputroot/particleGun_muon_$cardlabel.root $outputroot/particleGun_photon_$cardlabel.root $outputroot/particleGun_neutron_$cardlabel.root $outputroot/particleGun_jet_$cardlabel.root $outputroot/particleGun_bjet_$cardlabel.root $outputroot/particleGun_cjet_$cardlabel.root $outputroot/particleGun_taujet_$cardlabel.root $mainoutputdir/$output $version
|
---|
88 |
|
---|
89 |
|
---|
90 | # produce calo grid plots
|
---|
91 | ./CaloGrid $1 ECal
|
---|
92 | ./CaloGrid $1 HCal
|
---|
93 | gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=tmp/tmp1.pdf $outpdf ECal.pdf
|
---|
94 | gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$outpdf tmp/tmp1.pdf HCal.pdf
|
---|
95 | mv ECal.pdf $mainoutputdir/www/fig/img_ecal.pdf
|
---|
96 | mv ECal.png $mainoutputdir/www/fig/img_ecal.png
|
---|
97 | mv HCal.pdf $mainoutputdir/www/fig/img_hcal.pdf
|
---|
98 | mv HCal.png $mainoutputdir/www/fig/img_hcal.png
|
---|
99 |
|
---|
100 |
|
---|
101 |
|
---|
102 |
|
---|