Fork me on GitHub

source: git/examples/validation.sh@ 7010454

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 7010454 was eb3be06, checked in by Michele Selvaggi <michele.selvaggi@…>, 8 years ago

updated range, and added runJetGun

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