55def get_SUSY_variations( process: str, masses: dict[str, str | float], syst_mod: str | None = None, ktdurham: str | None = None ) -> float:
56 """
57 Provides varied matching scales for SUSY event generation based on inputs
58 Params:
59 process: the process to be generated (e.g. p p > go go). Used to figure
60 out which particles are relevant for the matching scale
61 masses: the dictionary of PDGID to mass mapping, used to figure out the
62 scale setting in GeV
63 syst_mod: the requested systematic variation (if any); can be msup,
64 msdw, or None
65 ktdurham: the matching scale in case the user provides it by hand
66 Returns:
67 the matching scale
68 """
69
70 if ktdurham is None:
71 prod_particles = []
72 if process is not None:
73 id_map = {'go':'1000021','dl':'1000001','ul':'1000002','sl':'1000003','cl':'1000004','b1':'1000005','t1':'1000006',
74 'dr':'2000001','ur':'2000002','sr':'2000003','cr':'2000004','b2':'2000005','t2':'2000006',
75 'n1':'1000022','n2':'1000023','x1':'1000024','x2':'1000037','n3':'1000025','n4':'1000035',
76 'el':'1000011','mul':'1000013','ta1':'1000015','sve':'1000012','svm':'1000014','svt':'1000016',
77 'er':'2000011','mur':'2000013','ta2':'2000015'}
78 for l in process:
79 if 'generate' in l or 'add process' in l:
81 for particle in clean_proc.split():
82 if particle not in id_map:
83 susylog.info(f'Particle {particle} not found in PDG ID map - skipping')
84 else:
85 prod_particles += id_map[particle]
86
87
88 my_mass = 10000.
89 if len(prod_particles)>0:
90 for x in prod_particles:
91 if x in masses:
92 my_mass =
min(my_mass,abs(float(masses[x])))
93 else:
94 susylog.info(f'Seem to ask for production of PDG ID {x}, but {x} not in mass dictionary?')
95 if my_mass>9999.:
96 strong_ids = ['1000001','1000002','1000003','1000004','1000005','1000006','2000001','2000002','2000003','2000004','2000005','2000006','1000021']
97 weak_ids = ['1000023','1000024','1000025','1000011','1000013','1000015','2000011','2000013','2000015','1000012','1000014','1000016']
98
99 my_mass =
min([abs(float(masses[x]))
for x
in strong_ids
if x
in masses])
100
101 if my_mass>10000.:
102
103 my_mass =
max([abs(float(masses[x]))
for x
in weak_ids
if x
in masses
and float(masses[x])<10000.])
104
105 if my_mass>10000. and '1000022' in masses:
106 my_mass = masses['1000022']
107 if my_mass>10000.:
108 raise RuntimeError('Could not understand which mass to use for matching cut in '+str(masses))
109
110
111 ktdurham =
min(my_mass*0.25,500)
112
113 ktdurham =
max(ktdurham,15)
114 if syst_mod == 'msup':
115 susylog.info('Applying upward variation (by 2x) of matching scale')
116 ktdurham = ktdurham*2.
117 elif syst_mod == 'msdw':
118 susylog.info('Applying downward variation (by 2x) of matching scale')
119 ktdurham = ktdurham*0.5
120
121 susylog.info('For matching, will use ktdurham of '+str(ktdurham))
122
123 return abs(ktdurham)
124
125
126
std::string replace(std::string s, const std::string &s2, const std::string &s3)
std::vector< std::string > split(const std::string &s, const std::string &t=":")