Fork me on GitHub

source: git/validation/validation.sh@ 5a697dde

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 5a697dde was 7e9d3d1, checked in by Pavel Demin <pavel-demin@…>, 8 years ago

fix path to FlatGunLHEventProducer.py

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