Fork me on GitHub

source: git/examples/validation.sh@ e5ea42e

Last change on this file since e5ea42e was d3fb80d, checked in by Michele Selvaggi <michele.selvaggi@…>, 8 years ago

removed now useless condition for non simple calorimeter

  • Property mode set to 100755
File size: 3.0 KB
Line 
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#
15# ./examples/validation.sh cards/delphes_card_CMS.tcl 100000
16#
17# Note that the more events you specify, the more accurate the controls plots will be ...
18# This said, 500k events should be ok for most cases.
19#
20############################################################################################
21
22#! /bin/sh
23
24EXPECTED_ARGS=2
25E_BADARGS=65
26
27if [ $# -ne $EXPECTED_ARGS ]
28then
29 echo "Usage: ./examples/validation.sh [detector_card] [number_of_events]"
30 echo "for instance: ./examples/validation.sh cards/delphes_card_CMS.tcl 10000"
31 exit $E_BADARGS
32fi
33
34cardbase=$(basename $1)
35carddir=$(dirname $1)
36nEvents=$2
37validationCard=$carddir/validation_$cardbase
38output=validation_${cardbase%.*}.root
39mainoutputdir=report_${cardbase%.*}
40outputroot=report_${cardbase%.*}/root
41cardlabel=${cardbase%.*}
42version=$(cat VERSION)
43outpdf=$mainoutputdir/${output%.*}.pdf
44
45mkdir -p $outputroot
46mkdir -p $mainoutputdir/www/fig
47
48sed 's/delphes_card_CMS.tcl/'$cardbase'/g' cards/validation_card.tcl > $validationCard
49
50function runParticleGun {
51 name=$1
52 pid=$2
53 cmnd="examples/Pythia8/configParticleGun_$name.cmnd"
54 rootfile="particleGun_${name}_${cardlabel}.root"
55 sed '/Main:spareMode1/s/=[[:space:]]*[0-9]*/= '$pid'/' examples/Pythia8/configParticleGun.cmnd > examples/Pythia8/tmp.cmnd
56 sed '/Main:numberOfEvents/s/=[[:space:]]*[0-9]*/= '$nEvents'/' examples/Pythia8/tmp.cmnd > $cmnd
57 ./DelphesPythia8 $validationCard $cmnd $outputroot/$rootfile
58
59}
60
61runParticleGun pion 211
62runParticleGun electron 11
63runParticleGun muon 13
64runParticleGun photon 22
65runParticleGun neutron 2112
66runParticleGun jet 1
67runParticleGun bjet 5
68runParticleGun cjet 4
69runParticleGun taujet 15
70
71./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
72
73
74# produce calo grid plots
75./CaloGrid $1 ECal
76./CaloGrid $1 HCal
77gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=tmp/tmp1.pdf $outpdf ECal.pdf
78gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$outpdf tmp/tmp1.pdf HCal.pdf
79mv ECal.pdf $mainoutputdir/www/fig/img_ecal.pdf
80mv ECal.png $mainoutputdir/www/fig/img_ecal.png
81mv HCal.pdf $mainoutputdir/www/fig/img_hcal.pdf
82mv HCal.png $mainoutputdir/www/fig/img_hcal.png
83
84
85
86
Note: See TracBrowser for help on using the repository browser.