[eb3be06] | 1 | #!/bin/sh
|
---|
[fa068d3] | 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 | #
|
---|
[e9971a7] | 16 | # ./examples/validation.sh cards/delphes_card_CMS.tcl 100000
|
---|
[fa068d3] | 17 | #
|
---|
| 18 | # Note that the more events you specify, the more accurate the controls plots will be ...
|
---|
[85ad2b9] | 19 | # This said, 500k events should be ok for most cases.
|
---|
[fa068d3] | 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]"
|
---|
[e9971a7] | 29 | echo "for instance: ./examples/validation.sh cards/delphes_card_CMS.tcl 10000"
|
---|
[fa068d3] | 30 | exit $E_BADARGS
|
---|
| 31 | fi
|
---|
| 32 |
|
---|
[85ad2b9] | 33 | cardbase=$(basename $1)
|
---|
| 34 | carddir=$(dirname $1)
|
---|
[fa068d3] | 35 | nEvents=$2
|
---|
[85ad2b9] | 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
|
---|
[eb3be06] | 43 | qcdPgLocation="/home/fynu/mselvaggi/storage/DelphesValidationSamples"
|
---|
[85ad2b9] | 44 |
|
---|
[6387aea] | 45 | mkdir -p $outputroot
|
---|
| 46 | mkdir -p $mainoutputdir/www/fig
|
---|
| 47 |
|
---|
[85ad2b9] | 48 | sed 's/delphes_card_CMS.tcl/'$cardbase'/g' cards/validation_card.tcl > $validationCard
|
---|
[eb3be06] | 49 | sed -i "1i set MaxEvents ${nEvents}" "$validationCard"
|
---|
[fa068d3] | 50 |
|
---|
[9f8d4e7] | 51 | function runParticleGun {
|
---|
[360d17e] | 52 | name=$1
|
---|
| 53 | pid=$2
|
---|
| 54 | cmnd="examples/Pythia8/configParticleGun_$name.cmnd"
|
---|
[db8be5f] | 55 | rootfile="particleGun_${name}_${cardlabel}.root"
|
---|
[e9971a7] | 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
|
---|
[6387aea] | 58 | ./DelphesPythia8 $validationCard $cmnd $outputroot/$rootfile
|
---|
[db8be5f] | 59 |
|
---|
[9f8d4e7] | 60 | }
|
---|
| 61 |
|
---|
[eb3be06] | 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 |
|
---|
[629e819] | 86 |
|
---|
[85ad2b9] | 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 |
|
---|
[d3fb80d] | 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
|
---|
[85ad2b9] | 99 |
|
---|
| 100 |
|
---|
| 101 |
|
---|
| 102 |
|
---|