Fork me on GitHub

source: git/validation/validation.sh@ ebf40fd

Last change on this file since ebf40fd was 183eef2, checked in by Pavel Demin <pavel.demin@…>, 4 years ago

remove VERSION from validation.sh

  • Property mode set to 100755
File size: 3.8 KB
RevLine 
[354b7f3]1#!/bin/bash
[03d2c3f]2################################################################################
[fa068d3]3#
[09ffaee]4# This code produces a set of validation plots for a given detector card.
[88c03bc]5#
6# In order to run this you need to compile Delphes with Pythia8 first, see:
[fa068d3]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#
[09ffaee]12# ./validation/validation.sh [detector_card] [number_of_events]
[88c03bc]13#
[fa068d3]14# e.g.
[88c03bc]15#
[09ffaee]16# ./validation/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 ...
[88c03bc]19# This said, 500k events should be ok for most cases.
[fa068d3]20#
[03d2c3f]21################################################################################
[fa068d3]22
23EXPECTED_ARGS=2
24E_BADARGS=65
25
26if [ $# -ne $EXPECTED_ARGS ]
27then
[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
31fi
32
[85ad2b9]33cardbase=$(basename $1)
[e605a99]34carddir=$(dirname $1)
[fa068d3]35nEvents=$2
[85ad2b9]36output=validation_${cardbase%.*}.root
37mainoutputdir=report_${cardbase%.*}
[03d2c3f]38outputrootdir=report_${cardbase%.*}/root
[85ad2b9]39cardlabel=${cardbase%.*}
[183eef2]40version=x.y.z
[85ad2b9]41outpdf=$mainoutputdir/${output%.*}.pdf
[03d2c3f]42cardsdir=validation/cards
43samplesdir=validation/samples
[e605a99]44validationcard=$carddir/validation_$cardbase
[85ad2b9]45
[03d2c3f]46mkdir -p $cardsdir
47mkdir -p $samplesdir
48mkdir -p $outputrootdir
[6387aea]49mkdir -p $mainoutputdir/www/fig
50
[03d2c3f]51sed "s/delphes_card_CMS.tcl/$cardbase/g" cards/validation_card.tcl > $validationcard
52sed -i "1i set MaxEvents $nEvents" $validationcard
[fa068d3]53
[9f8d4e7]54function runParticleGun {
[360d17e]55 name=$1
56 pid=$2
[03d2c3f]57 cmnd=$cardsdir/configParticleGun_$name.cmnd
58 outputroot=particleGun_${name}_${cardlabel}.root
[d108fdc]59 sed "/Main:spareMode1/s|=[[:space:]]*[0-9]*|= $pid|; /Main:numberOfEvents/s|=[[:space:]]*[0-9]*|= $nEvents|" examples/Pythia8/configParticleGun.cmnd > $cmnd
[03d2c3f]60 ./DelphesPythia8 $validationcard $cmnd $outputrootdir/$outputroot
[e605a99]61
[9f8d4e7]62}
63
[eb3be06]64
65function runJetsGun {
66 name=$1
67 pid=$2
[d108fdc]68 lhe=$samplesdir/events_$name.lhe
69 cmnd=$cardsdir/configLHE_$name.cmnd
70 inputroot=$samplesdir/$name.root
[03d2c3f]71 outputroot=particleGun_${name}_${cardlabel}.root
72
73 if [ ! -f $inputroot ]
74 then
[6038170]75 python validation/flatGunLHEventProducer.py --pdg $pid --guntype pt --pmin 1 --pmax 50000 --etamin -6 --etamax 6 --nevts $nEvents --seed 1 --output $lhe --log --ecm 100000
76 gunzip $lhe.gz
[d108fdc]77 sed "/Beams:LHEF/s|=[[:space:]].*|= $lhe|; /Main:numberOfEvents/s/=[[:space:]]*[0-9]*/= $nEvents/" examples/Pythia8/configLHE.cmnd > $cmnd
[03d2c3f]78
79 ./DelphesPythia8 cards/gen_card.tcl $cmnd $inputroot
80 fi
81
82 ./DelphesROOT $validationcard $outputrootdir/$outputroot $inputroot
[eb3be06]83}
84
85
[5107603]86runParticleGun pion 211 &
87runParticleGun electron 11 &
88runParticleGun muon 13 &
89runParticleGun photon 22 &
90runParticleGun neutron 2112 &
91runParticleGun taujet 15 &
[eb3be06]92runJetsGun jet 1 &
93runJetsGun bjet 5 &
94runJetsGun cjet 4 &
95
96wait
97echo all particle guns complete ...
98
[181c061]99./DelphesValidation $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]100
[d3fb80d]101
[88c03bc]102# produce calo grid plots
[d3fb80d]103./CaloGrid $1 ECal
104./CaloGrid $1 HCal
[88c03bc]105gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=tmp/tmp1.pdf $outpdf ECal.pdf
[d3fb80d]106gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$outpdf tmp/tmp1.pdf HCal.pdf
[88c03bc]107mv ECal.pdf $mainoutputdir/www/fig/img_ecal.pdf
108mv ECal.png $mainoutputdir/www/fig/img_ecal.png
[d3fb80d]109mv HCal.pdf $mainoutputdir/www/fig/img_hcal.pdf
110mv HCal.png $mainoutputdir/www/fig/img_hcal.png
[85ad2b9]111
Note: See TracBrowser for help on using the repository browser.