Pythia8_ShowerWeights.py 9.01 KB
Newer Older
Ewelina Maria Lobodzinska's avatar
Ewelina Maria Lobodzinska committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Warnings:
# UserHooks Warning: the calculation of uncertainty variations will only be consistent in the absence of any external modifications to the shower branching probabilities via the UserHooks framework. It is therefore strongly advised to avoid combining the automated uncertainty calculations with any such UserHooks modifications.
#
#Merging Warning: in multi-jet merging approaches, trial showers are used to generate missing Sudakov factor corrections to the hard matrix elements. Currently that framework is not consistently combined with the variations introduced here, so the two should not be used simultaneously. This means shower weights should NOT be used with CKKLW or FxFx merging!
#
#
# Pythia8 shower weights are only available in release 2.26 and later.  The
# test below checks the Pythia8 release and also verifies that the Pythia_i
# tag is recent enought to store the shower weights.

if "PYTHIA8VER" in os.environ:
  verph8str = str(os.environ['PYTHIA8VER'])[:3]
  verph8 = int(verph8str)
  print("verph8 ", verph8)
else:
  print("PYTHIA8VER not available !!! assuming version 2.40")
17
  verph8 = 240  
Ewelina Maria Lobodzinska's avatar
Ewelina Maria Lobodzinska committed
18

19

Ewelina Maria Lobodzinska's avatar
Ewelina Maria Lobodzinska committed
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
if (verph8 >= 226):
   if "ShowerWeightNames" in genSeq.Pythia8.__slots__.keys():
      print "Initalizing Shower Weights from Pythia8_ShowerWeights.py"
      if("NNPDF" in evgenConfig.tune):
         genSeq.Pythia8.Commands += [
                            'UncertaintyBands:doVariations = on', 
                            'UncertaintyBands:List = {\
                             Var3cUp isr:muRfac=0.549241,\
                             Var3cDown isr:muRfac=1.960832,\
                             isr:muRfac=2.0_fsr:muRfac=2.0 isr:muRfac=2.0 fsr:muRfac=2.0,\
                             isr:muRfac=2.0_fsr:muRfac=1.0 isr:muRfac=2.0 fsr:muRfac=1.0,\
                             isr:muRfac=2.0_fsr:muRfac=0.5 isr:muRfac=2.0 fsr:muRfac=0.5,\
                             isr:muRfac=1.0_fsr:muRfac=2.0 isr:muRfac=1.0 fsr:muRfac=2.0,\
                             isr:muRfac=1.0_fsr:muRfac=0.5 isr:muRfac=1.0 fsr:muRfac=0.5,\
                             isr:muRfac=0.5_fsr:muRfac=2.0 isr:muRfac=0.5 fsr:muRfac=2.0,\
                             isr:muRfac=0.5_fsr:muRfac=1.0 isr:muRfac=0.5 fsr:muRfac=1.0,\
                             isr:muRfac=0.5_fsr:muRfac=0.5 isr:muRfac=0.5 fsr:muRfac=0.5,\
                             isr:muRfac=1.75_fsr:muRfac=1.0 isr:muRfac=1.75 fsr:muRfac=1.0,\
                             isr:muRfac=1.5_fsr:muRfac=1.0 isr:muRfac=1.5 fsr:muRfac=1.0,\
                             isr:muRfac=1.25_fsr:muRfac=1.0 isr:muRfac=1.25 fsr:muRfac=1.0,\
                             isr:muRfac=0.625_fsr:muRfac=1.0 isr:muRfac=0.625 fsr:muRfac=1.0,\
                             isr:muRfac=0.75_fsr:muRfac=1.0 isr:muRfac=0.75 fsr:muRfac=1.0,\
                             isr:muRfac=0.875_fsr:muRfac=1.0 isr:muRfac=0.875 fsr:muRfac=1.0,\
                             isr:muRfac=1.0_fsr:muRfac=1.75 isr:muRfac=1.0 fsr:muRfac=1.75,\
                             isr:muRfac=1.0_fsr:muRfac=1.5 isr:muRfac=1.0 fsr:muRfac=1.5,\
                             isr:muRfac=1.0_fsr:muRfac=1.25 isr:muRfac=1.0 fsr:muRfac=1.25,\
                             isr:muRfac=1.0_fsr:muRfac=0.625 isr:muRfac=1.0 fsr:muRfac=0.625,\
                             isr:muRfac=1.0_fsr:muRfac=0.75 isr:muRfac=1.0 fsr:muRfac=0.75,\
                             isr:muRfac=1.0_fsr:muRfac=0.875 isr:muRfac=1.0 fsr:muRfac=0.875,\
                             hardHi fsr:cNS=2.0 isr:cNS=2.0,\
                             hardLo fsr:cNS=-2.0 isr:cNS=-2.0,\
                             isr:PDF:plus=1,\
                             isr:PDF:minus=2\
                             }'] 

         genSeq.Pythia8.ShowerWeightNames = [ 
                             "Var3cUp",
                             "Var3cDown",
                             "isr:muRfac=2.0_fsr:muRfac=2.0",
                             "isr:muRfac=2.0_fsr:muRfac=1.0",
                             "isr:muRfac=2.0_fsr:muRfac=0.5",
                             "isr:muRfac=1.0_fsr:muRfac=2.0",
                             "isr:muRfac=1.0_fsr:muRfac=0.5",
                             "isr:muRfac=0.5_fsr:muRfac=2.0",
                             "isr:muRfac=0.5_fsr:muRfac=1.0",
                             "isr:muRfac=0.5_fsr:muRfac=0.5",
                             "isr:muRfac=1.75_fsr:muRfac=1.0",
                             "isr:muRfac=1.5_fsr:muRfac=1.0",
                             "isr:muRfac=1.25_fsr:muRfac=1.0",
                             "isr:muRfac=0.625_fsr:muRfac=1.0",
                             "isr:muRfac=0.75_fsr:muRfac=1.0",
                             "isr:muRfac=0.875_fsr:muRfac=1.0",
                             "isr:muRfac=1.0_fsr:muRfac=1.75",
                             "isr:muRfac=1.0_fsr:muRfac=1.5",
                             "isr:muRfac=1.0_fsr:muRfac=1.25",
                             "isr:muRfac=1.0_fsr:muRfac=0.625",
                             "isr:muRfac=1.0_fsr:muRfac=0.75",
                             "isr:muRfac=1.0_fsr:muRfac=0.875",
                             "hardHi",
                             "hardLo",
                             "isr:PDF:plus",
                             "isr:PDF:minus"
                             ]
      else:
         genSeq.Pythia8.Commands += [
                            'UncertaintyBands:doVariations = on', 
                            'UncertaintyBands:List = {\
                             Var3cUp isr:muRfac=0.549241,\
                             Var3cDown isr:muRfac=1.960832,\
                             isr:muRfac=2.0_fsr:muRfac=2.0 isr:muRfac=2.0 fsr:muRfac=2.0,\
                             isr:muRfac=2.0_fsr:muRfac=1.0 isr:muRfac=2.0 fsr:muRfac=1.0,\
                             isr:muRfac=2.0_fsr:muRfac=0.5 isr:muRfac=2.0 fsr:muRfac=0.5,\
                             isr:muRfac=1.0_fsr:muRfac=2.0 isr:muRfac=1.0 fsr:muRfac=2.0,\
                             isr:muRfac=1.0_fsr:muRfac=0.5 isr:muRfac=1.0 fsr:muRfac=0.5,\
                             isr:muRfac=0.5_fsr:muRfac=2.0 isr:muRfac=0.5 fsr:muRfac=2.0,\
                             isr:muRfac=0.5_fsr:muRfac=1.0 isr:muRfac=0.5 fsr:muRfac=1.0,\
                             isr:muRfac=0.5_fsr:muRfac=0.5 isr:muRfac=0.5 fsr:muRfac=0.5,\
                             isr:muRfac=1.75_fsr:muRfac=1.0 isr:muRfac=1.75 fsr:muRfac=1.0,\
                             isr:muRfac=1.5_fsr:muRfac=1.0 isr:muRfac=1.5 fsr:muRfac=1.0,\
                             isr:muRfac=1.25_fsr:muRfac=1.0 isr:muRfac=1.25 fsr:muRfac=1.0,\
                             isr:muRfac=0.625_fsr:muRfac=1.0 isr:muRfac=0.625 fsr:muRfac=1.0,\
                             isr:muRfac=0.75_fsr:muRfac=1.0 isr:muRfac=0.75 fsr:muRfac=1.0,\
                             isr:muRfac=0.875_fsr:muRfac=1.0 isr:muRfac=0.875 fsr:muRfac=1.0,\
                             isr:muRfac=1.0_fsr:muRfac=1.75 isr:muRfac=1.0 fsr:muRfac=1.75,\
                             isr:muRfac=1.0_fsr:muRfac=1.5 isr:muRfac=1.0 fsr:muRfac=1.5,\
                             isr:muRfac=1.0_fsr:muRfac=1.25 isr:muRfac=1.0 fsr:muRfac=1.25,\
                             isr:muRfac=1.0_fsr:muRfac=0.625 isr:muRfac=1.0 fsr:muRfac=0.625,\
                             isr:muRfac=1.0_fsr:muRfac=0.75 isr:muRfac=1.0 fsr:muRfac=0.75,\
                             isr:muRfac=1.0_fsr:muRfac=0.875 isr:muRfac=1.0 fsr:muRfac=0.875,\
                             hardHi fsr:cNS=2.0 isr:cNS=2.0,\
                             hardLo fsr:cNS=-2.0 isr:cNS=-2.0\
                             }'] 

         genSeq.Pythia8.ShowerWeightNames = [ 
                             "Var3cUp",
                             "Var3cDown",
                             "isr:muRfac=2.0_fsr:muRfac=2.0",
                             "isr:muRfac=2.0_fsr:muRfac=1.0",
                             "isr:muRfac=2.0_fsr:muRfac=0.5",
                             "isr:muRfac=1.0_fsr:muRfac=2.0",
                             "isr:muRfac=1.0_fsr:muRfac=0.5",
                             "isr:muRfac=0.5_fsr:muRfac=2.0",
                             "isr:muRfac=0.5_fsr:muRfac=1.0",
                             "isr:muRfac=0.5_fsr:muRfac=0.5",
                             "isr:muRfac=1.75_fsr:muRfac=1.0",
                             "isr:muRfac=1.5_fsr:muRfac=1.0",
                             "isr:muRfac=1.25_fsr:muRfac=1.0",
                             "isr:muRfac=0.625_fsr:muRfac=1.0",
                             "isr:muRfac=0.75_fsr:muRfac=1.0",
                             "isr:muRfac=0.875_fsr:muRfac=1.0",
                             "isr:muRfac=1.0_fsr:muRfac=1.75",
                             "isr:muRfac=1.0_fsr:muRfac=1.5",
                             "isr:muRfac=1.0_fsr:muRfac=1.25",
                             "isr:muRfac=1.0_fsr:muRfac=0.625",
                             "isr:muRfac=1.0_fsr:muRfac=0.75",
                             "isr:muRfac=1.0_fsr:muRfac=0.875",
                             "hardHi",
                             "hardLo"
                             ]
   else:
      print "Pythia8_i version too old for shower weights"
else:
   print "No shower weights since not supported in Pythia8.",verph8