-
Notifications
You must be signed in to change notification settings - Fork 1
/
MANtag_combineCards.sh
executable file
·80 lines (69 loc) · 3.24 KB
/
MANtag_combineCards.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
###
### Macro for combining the datacards for separate categories into a single one for each mass point.
###
########## input arguments ##########
btagging=$1
combineYears=$2 #set to 1 if the separate years should be combined into a full run2 fit
#####################################
cd datacards/MANtag_study/$btagging
if [[ $combineYears -ne 1 ]]; then
for card1 in bb_*.txt
do
mass="${card1:9:4}"
let n=${#card1}-2
card2="bq${card1:2:$n}"
card3="mumu${card1:2:$n}"
if test -f "$card2"; then
if test -f "$card3"; then
echo "input cards:"
echo "1) datacards/MANtag_study/${btagging}/${card1}"
echo "2) datacards/MANtag_study/${btagging}/${card2}"
echo "3) datacards/MANtag_study/${btagging}/${card3}"
echo "output card: datacards/MANtag_study/${btagging}/combined/combined${card1:2:$n}"
combineCards.py bb="$card1" bq="$card2" mumu="$card3" > "combined/combined${card1:2:$n}"
else
echo "datacards/MANtag_study/${btagging}/${card3} does not exist"
fi
else
echo "datacards/MANtag_study/${btagging}/${card2} does not exist"
fi
done
else
for card_2016_bb in bb_2016_M*.txt; do
mass="${card_2016_bb:9:4}"
let n=${#card_2016_bb}-7
suffix="${card_2016_bb:7:$n}"
card_2016_bq="bq_2016${suffix}"
card_2016_mumu="mumu_2016${suffix}"
card_2017_bb="bb_2017${suffix}"
card_2017_bq="bq_2017${suffix}"
card_2017_mumu="mumu_2017${suffix}"
card_2018_bb="bb_2018${suffix}"
card_2018_bq="bq_2018${suffix}"
card_2018_mumu="mumu_2018${suffix}"
ncards=0
for card in $card_2016_bb $card_2016_bq $card_2016_mumu $card_2017_bb $card_2017_bq $card_2017_mumu $card_2018_bb $card_2018_bq $card_2018_mumu; do
if test -f "$card"; then
let ncards=$ncards+1
fi
done
if [[ $ncards -eq 9 ]]; then
echo "input datacards:"
echo "1) datacards/MANtag_study/${btagging}/${card_2016_bb}"
echo "2) datacards/MANtag_study/${btagging}/${card_2016_bq}"
echo "3) datacards/MANtag_study/${btagging}/${card_2016_mumu}"
echo "4) datacards/MANtag_study/${btagging}/${card_2017_bb}"
echo "5) datacards/MANtag_study/${btagging}/${card_2017_bq}"
echo "6) datacards/MANtag_study/${btagging}/${card_2017_mumu}"
echo "7) datacards/MANtag_study/${btagging}/${card_2018_bb}"
echo "8) datacards/MANtag_study/${btagging}/${card_2018_bq}"
echo "9) datacards/MANtag_study/${btagging}/${card_2018_mumu}"
echo "output datacard: datacards/MANtag_study/${btagging}/combined/fully_combined_run2${suffix}"
combineCards.py bb_2016="$card_2016_bb" bq_2016="$card_2016_bq" mumu_2016="$card_2016_mumu" bb_2017="$card_2017_bb" bq_2017="$card_2017_bq" mumu_2017="$card_2017_mumu" bb_2018="$card_2018_bb" bq_2018="$card_2018_bq" mumu_2018="$card_2018_mumu" > "combined/fully_combined_run2${suffix}"
else
echo "only ${ncards} could be associated to ${card_2016_bb}"
fi
done
fi
cd ../..