-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathProcess.py
More file actions
147 lines (116 loc) · 4.53 KB
/
Process.py
File metadata and controls
147 lines (116 loc) · 4.53 KB
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
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
145
146
147
import copy
from Particles import Particle
from Generators.CirceHelper import CirceHelper
class Process:
"""A standard Process"""
_required_args = [
"initial",
"final",
"sqrts",
"order",
"nlo",
"randomseed",
"decay",
"isrmode",
"beamstrahlung",
]
def __init__(self, procname, process, inputFileRead, particleData, **options):
# list of particles filled from the input yaml file
self._inputParticlesList = []
if particleData is not None:
for key, value in particleData.items():
Particle.set_info(key, value)
self._inputParticlesList.append(Particle.get_info(key))
# all particles in process list
self._particlesOfProcessList = []
# label to be used in the generatorDB
self.generatorDBTag = []
# process identifier
self.procname = procname
for arg in self._required_args:
setattr(self, arg, inputFileRead.get(arg))
for option, value in options.items():
setattr(self, option, value)
for key, value in process.items():
setattr(self, key, value)
# inputReader as deep copy without the process stuff
self.settings = copy.deepcopy(inputFileRead)
delattr(self.settings, "processes")
def prepareProcess(self):
# beam particles
self._beam1 = Particle.get_info(self.initial[0])
self._beam2 = Particle.get_info(self.initial[1])
# final state particle dictionary
self._finalStateParticleDict = {}
# final state particle list
self._finalStatePDGList = []
# add beam to all particles list
self._particlesOfProcessList.extend([self._beam1, self._beam2])
# full process label
self._proclabel = "{} {} -> ".format(self._beam1.name, self._beam2.name)
for p in self.final:
self._finalStateParticleDict[p] = Particle.get_info(p)
self._finalStatePDGList.append(str(p))
self._proclabel += f"{self._finalStateParticleDict[p].name} "
self._particlesOfProcessList.append(self._finalStateParticleDict[p])
# now the new DBTag:
initialstate = [self.initial[0], self.initial[1]]
initialstate.sort()
finalstate = [x for x in self.final]
finalstate.sort()
self._DBTag = [initialstate, finalstate]
def get_beam_flavour(self, beam):
if beam not in {1, 2}:
raise ValueError("Beam should be 1 or 2 not {}".format(beam))
return getattr(self, f"_beam{beam}").get("pdg_code")
def get_initialstate_pdgString(self):
return "{} {}".format(self.get_beam_flavour(1), self.get_beam_flavour(2))
def get_finalstate_pdgString(self):
return " ".join(self._finalStatePDGList)
def get_finalstate_pdgList(self):
return self._finalStatePDGList
def get_finalstate_pdgDictList(self):
return list(self._finalStateParticleDict)
def get(self, name):
try:
return getattr(self, name)
except:
try:
return self.settings.get(name)
except:
return None
def get_args(self):
return self._required_args
def get_particlesOfProcessList(self):
return self._particlesOfProcessList
def get_inputParticlesList(self):
return self._inputParticlesList
def get_qcd_order(self):
return self.get("order")[1]
def get_qed_order(self):
return self.get("order")[0]
def get_nlo(self):
return self.get("nlo")
def get_output_format(self):
return self.settings.get_output_format()
def get_PythiaTune(self):
return self.settings.get_PythiaTune()
def get_PolarisationDensity(self):
return self.settings.get_PolarisationDensity()
def get_PolarisationFraction(self):
return self.settings.get_PolarisationFraction()
def get_rndmSeed(self):
return self.get("randomseed")
def get_BeamstrahlungFile(self):
if self.get("beamstrahlung") is not None:
circe = CirceHelper(self.beamstrahlung, self.sqrts)
return circe.getFile()
def get_DBTag(self):
return self._DBTag
def get_DBTag(self):
return self._DBTag
def print_info(self):
print(f"Creating Runcards for {self._proclabel} at {self.sqrts} GeV")
print("Particles are defined with the following parameters")
for part in self._particlesOfProcessList:
part.print_info()