[eb3be06] | 1 | #!/bin/sh
|
---|
[03d2c3f] | 2 | ################################################################################
|
---|
[fa068d3] | 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 | #
|
---|
[03d2c3f] | 21 | ################################################################################
|
---|
[fa068d3] | 22 |
|
---|
| 23 | EXPECTED_ARGS=2
|
---|
| 24 | E_BADARGS=65
|
---|
| 25 |
|
---|
| 26 | if [ $# -ne $EXPECTED_ARGS ]
|
---|
| 27 | then
|
---|
[4d999abd] | 28 | echo "Usage: ./validation/validation.sh [detector_card] [number_of_events]"
|
---|
| 29 | echo "for instance: ./validation/validation.sh cards/delphes_card_CMS.tcl 10000"
|
---|
[fa068d3] | 30 | exit $E_BADARGS
|
---|
| 31 | fi
|
---|
| 32 |
|
---|
[85ad2b9] | 33 | cardbase=$(basename $1)
|
---|
[e605a99] | 34 | carddir=$(dirname $1)
|
---|
[fa068d3] | 35 | nEvents=$2
|
---|
[85ad2b9] | 36 | output=validation_${cardbase%.*}.root
|
---|
| 37 | mainoutputdir=report_${cardbase%.*}
|
---|
[03d2c3f] | 38 | outputrootdir=report_${cardbase%.*}/root
|
---|
[85ad2b9] | 39 | cardlabel=${cardbase%.*}
|
---|
| 40 | version=$(cat VERSION)
|
---|
| 41 | outpdf=$mainoutputdir/${output%.*}.pdf
|
---|
[03d2c3f] | 42 | cardsdir=validation/cards
|
---|
| 43 | samplesdir=validation/samples
|
---|
[e605a99] | 44 | validationcard=$carddir/validation_$cardbase
|
---|
[85ad2b9] | 45 |
|
---|
[03d2c3f] | 46 | mkdir -p $cardsdir
|
---|
| 47 | mkdir -p $samplesdir
|
---|
| 48 | mkdir -p $outputrootdir
|
---|
[6387aea] | 49 | mkdir -p $mainoutputdir/www/fig
|
---|
| 50 |
|
---|
[03d2c3f] | 51 | sed "s/delphes_card_CMS.tcl/$cardbase/g" cards/validation_card.tcl > $validationcard
|
---|
| 52 | sed -i "1i set MaxEvents $nEvents" $validationcard
|
---|
[fa068d3] | 53 |
|
---|
[9f8d4e7] | 54 | function runParticleGun {
|
---|
[360d17e] | 55 | name=$1
|
---|
| 56 | pid=$2
|
---|
[03d2c3f] | 57 | cmnd=$cardsdir/configParticleGun_$name.cmnd
|
---|
| 58 | outputroot=particleGun_${name}_${cardlabel}.root
|
---|
| 59 | sed "/Main:spareMode1/s/=[[:space:]]*[0-9]*/= $pid/; /Main:numberOfEvents/s/=[[:space:]]*[0-9]*/= $nEvents/" examples/Pythia8/configParticleGun.cmnd > $cmnd
|
---|
| 60 | ./DelphesPythia8 $validationcard $cmnd $outputrootdir/$outputroot
|
---|
[e605a99] | 61 |
|
---|
[9f8d4e7] | 62 | }
|
---|
| 63 |
|
---|
[eb3be06] | 64 |
|
---|
| 65 | function runJetsGun {
|
---|
| 66 | name=$1
|
---|
| 67 | pid=$2
|
---|
[03d2c3f] | 68 | cmnd=$cardsdir/configLHE_$pid.cmnd
|
---|
| 69 | inputroot=$samplesdir/$pid.root
|
---|
| 70 | outputroot=particleGun_${name}_${cardlabel}.root
|
---|
| 71 |
|
---|
| 72 | if [ ! -f $inputroot ]
|
---|
| 73 | then
|
---|
[7e9d3d1] | 74 | python validation/FlatGunLHEventProducer.py --pdg $pid --ptmin 1 --ptmax 50000 --etamin -6 --etamax 6 --size $nEvents --seed 1 --output $samplesdir/events_$pid.lhe --log --ecm 100000
|
---|
[03d2c3f] | 75 |
|
---|
| 76 | cp examples/Pythia8/configLHE.cmnd $cmnd
|
---|
| 77 | echo "Beams:LHEF = $samplesdir/events_$pid.lhe" >> $cmnd
|
---|
| 78 | echo "Main:numberOfEvents = $nEvents" >> $cmnd
|
---|
| 79 |
|
---|
| 80 | ./DelphesPythia8 cards/gen_card.tcl $cmnd $inputroot
|
---|
| 81 | fi
|
---|
| 82 |
|
---|
| 83 | ./DelphesROOT $validationcard $outputrootdir/$outputroot $inputroot
|
---|
[eb3be06] | 84 | }
|
---|
| 85 |
|
---|
| 86 |
|
---|
| 87 | runParticleGun pion 211
|
---|
| 88 | runParticleGun electron 11
|
---|
| 89 | runParticleGun muon 13
|
---|
| 90 | runParticleGun photon 22
|
---|
| 91 | runParticleGun neutron 2112
|
---|
| 92 | runParticleGun taujet 15
|
---|
| 93 | runJetsGun jet 1 &
|
---|
| 94 | runJetsGun bjet 5 &
|
---|
| 95 | runJetsGun cjet 4 &
|
---|
| 96 |
|
---|
| 97 | wait
|
---|
| 98 | echo all particle guns complete ...
|
---|
| 99 |
|
---|
[03d2c3f] | 100 | ./Validation $outputrootdir/particleGun_pion_$cardlabel.root $outputrootdir/particleGun_electron_$cardlabel.root $outputrootdir/particleGun_muon_$cardlabel.root $outputrootdir/particleGun_photon_$cardlabel.root $outputrootdir/particleGun_neutron_$cardlabel.root $outputrootdir/particleGun_jet_$cardlabel.root $outputrootdir/particleGun_bjet_$cardlabel.root $outputrootdir/particleGun_cjet_$cardlabel.root $outputrootdir/particleGun_taujet_$cardlabel.root $mainoutputdir/$output $version
|
---|
[85ad2b9] | 101 |
|
---|
[d3fb80d] | 102 |
|
---|
| 103 | # produce calo grid plots
|
---|
| 104 | ./CaloGrid $1 ECal
|
---|
| 105 | ./CaloGrid $1 HCal
|
---|
| 106 | gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=tmp/tmp1.pdf $outpdf ECal.pdf
|
---|
| 107 | gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$outpdf tmp/tmp1.pdf HCal.pdf
|
---|
| 108 | mv ECal.pdf $mainoutputdir/www/fig/img_ecal.pdf
|
---|
| 109 | mv ECal.png $mainoutputdir/www/fig/img_ecal.png
|
---|
| 110 | mv HCal.pdf $mainoutputdir/www/fig/img_hcal.pdf
|
---|
| 111 | mv HCal.png $mainoutputdir/www/fig/img_hcal.png
|
---|
[85ad2b9] | 112 |
|
---|