[fa068d3] | 1 | ##############################################################################################
|
---|
| 2 | #
|
---|
| 3 | # This code produces at set of validation plots for a given detector card.
|
---|
| 4 | #
|
---|
| 5 | # In order to run this you need to compile Delphes with Pythia8 first, see:
|
---|
| 6 | #
|
---|
| 7 | # https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook/Pythia8
|
---|
| 8 | #
|
---|
| 9 | # After you (re-)compiled Delphes with Pythia8 you are ready to go, execute from Delphes main dir:
|
---|
| 10 | #
|
---|
| 11 | # ./examples/validation.sh [detector_card] [number_of_events]
|
---|
| 12 | #
|
---|
| 13 | # e.g.
|
---|
| 14 | #
|
---|
[e9971a7] | 15 | # ./examples/validation.sh cards/delphes_card_CMS.tcl 100000
|
---|
[fa068d3] | 16 | #
|
---|
| 17 | # Note that the more events you specify, the more accurate the controls plots will be ...
|
---|
[85ad2b9] | 18 | # This said, 500k events should be ok for most cases.
|
---|
[fa068d3] | 19 | #
|
---|
| 20 | ############################################################################################
|
---|
| 21 |
|
---|
[360d17e] | 22 | #! /bin/sh
|
---|
[fa068d3] | 23 |
|
---|
| 24 | EXPECTED_ARGS=2
|
---|
| 25 | E_BADARGS=65
|
---|
| 26 |
|
---|
| 27 | if [ $# -ne $EXPECTED_ARGS ]
|
---|
| 28 | then
|
---|
| 29 | echo "Usage: ./examples/validation.sh [detector_card] [number_of_events]"
|
---|
[e9971a7] | 30 | echo "for instance: ./examples/validation.sh cards/delphes_card_CMS.tcl 10000"
|
---|
[fa068d3] | 31 | exit $E_BADARGS
|
---|
| 32 | fi
|
---|
| 33 |
|
---|
[85ad2b9] | 34 | cardbase=$(basename $1)
|
---|
| 35 | carddir=$(dirname $1)
|
---|
[fa068d3] | 36 | nEvents=$2
|
---|
[85ad2b9] | 37 | validationCard=$carddir/validation_$cardbase
|
---|
| 38 | output=validation_${cardbase%.*}.root
|
---|
| 39 | mainoutputdir=report_${cardbase%.*}
|
---|
| 40 | outputroot=report_${cardbase%.*}/root
|
---|
| 41 | cardlabel=${cardbase%.*}
|
---|
| 42 | version=$(cat VERSION)
|
---|
| 43 | outpdf=$mainoutputdir/${output%.*}.pdf
|
---|
| 44 |
|
---|
[fa068d3] | 45 |
|
---|
[6387aea] | 46 | mkdir -p $outputroot
|
---|
| 47 | mkdir -p $mainoutputdir/www/fig
|
---|
| 48 |
|
---|
[85ad2b9] | 49 | sed 's/delphes_card_CMS.tcl/'$cardbase'/g' cards/validation_card.tcl > $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 |
|
---|
[6387aea] | 62 | runParticleGun pion 211
|
---|
[360d17e] | 63 | runParticleGun electron 11
|
---|
| 64 | runParticleGun muon 13
|
---|
| 65 | runParticleGun photon 22
|
---|
[6387aea] | 66 | runParticleGun neutron 2112
|
---|
[360d17e] | 67 | runParticleGun jet 1
|
---|
| 68 | runParticleGun bjet 5
|
---|
[6387aea] | 69 | runParticleGun cjet 4
|
---|
[360d17e] | 70 | runParticleGun taujet 15
|
---|
[629e819] | 71 |
|
---|
[85ad2b9] | 72 | ./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
|
---|
| 73 |
|
---|
| 74 | echo $outpdf
|
---|
| 75 | if grep -q SimpleCalorimeter "$1"; then
|
---|
| 76 | ./CaloGrid $1 ECal
|
---|
| 77 | ./CaloGrid $1 HCal
|
---|
| 78 | gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=tmp/tmp1.pdf $outpdf ECal.pdf
|
---|
| 79 | gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$outpdf tmp/tmp1.pdf HCal.pdf
|
---|
| 80 | mv ECal.pdf $mainoutputdir/www/fig/img_ecal.pdf
|
---|
| 81 | mv ECal.png $mainoutputdir/www/fig/img_ecal.png
|
---|
| 82 | mv HCal.pdf $mainoutputdir/www/fig/img_hcal.pdf
|
---|
| 83 | mv HCal.png $mainoutputdir/www/fig/img_hcal.png
|
---|
| 84 | else
|
---|
| 85 | ./CaloGrid $1 Calorimeter
|
---|
| 86 | gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=tmp/tmp1.pdf $outpdf Calorimeter.pdf
|
---|
| 87 | mv Calorimeter.pdf $mainoutputdir/www/fig/img_ecal.pdf
|
---|
| 88 | mv Calorimeter.png $mainoutputdir/www/fig/img_ecal.png
|
---|
| 89 | fi
|
---|
| 90 |
|
---|
| 91 |
|
---|
| 92 |
|
---|
| 93 |
|
---|