-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.py
More file actions
107 lines (90 loc) · 3.8 KB
/
config.py
File metadata and controls
107 lines (90 loc) · 3.8 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
import yaml
import os
import logging
############################################################
# See config.yml for descriptions of configuration options #
############################################################
# Get location of config.py and config.yml
project_path = os.path.dirname(os.path.realpath(__file__))
class StopConfiguring(Exception):
""" Raise to stop configuring """
# Read config file and parse settings
try:
with open('/srv/scratch/user_config.yml', 'r') as ymlfile: # New location where htcondor will put input files
logging.info('Using user edited config file')
# Note the usage of yaml.safe_load()
# Using yaml.load() exposes the system to running any Python commands in the config file.
cfg = yaml.safe_load(ymlfile)
except:
try:
with open(project_path + '/user_config.yml', 'r') as ymlfile:
logging.info('Using user edited config file')
# Note the usage of yaml.safe_load()
# Using yaml.load() exposes the system to running any Python commands in the config file.
cfg = yaml.safe_load(ymlfile)
except:
logging.error("No config file. Please provide user_config.yml.")
print("No config file. Please provide user_config.yml.")
raise StopConfiguring("No config file. Please provide user_config.yml. Ending run...")
# Event by event sampling configuration
class EBE:
NUM_EVENTS = int(cfg['mode']['NUM_EVENTS'])
NUM_SAMPLES = int(cfg['mode']['NUM_SAMPLES'])
NUM_FRAGS = int(cfg['mode']['NUM_FRAGS'])
# Mode configuration
class mode:
VARY_POINT = bool(cfg['mode']['VARY_POINT'])
KEEP_EVENT = bool(cfg['mode']['KEEP_EVENT'])
KEEP_RECORD = bool(cfg['mode']['KEEP_RECORD'])
class transport:
GRID_STEP = float(cfg['transport']['GRID_STEP'])
TIME_STEP = float(cfg['transport']['TIME_STEP'])
GRID_MAX_TARGET = float(cfg['transport']['GRID_MAX_TARGET'])
class trento:
NORM = float(cfg['trento']['NORM'])
PROJ1 = str(cfg['trento']['PROJ1'])
PROJ2 = str(cfg['trento']['PROJ2'])
NUCLEON_WIDTH = float(cfg['trento']['NUCLEON_WIDTH'])
CROSS_SECTION = float(cfg['trento']['CROSS_SECTION'])
P = float(cfg['trento']['P'])
K = float(cfg['trento']['K'])
V = float(cfg['trento']['V'])
NC = int(cfg['trento']['NC'])
DMIN = float(cfg['trento']['DMIN'])
try:
BMIN = float(cfg['trento']['BMIN'])
except ValueError:
BMIN = None
try:
BMAX = float(cfg['trento']['BMAX'])
except ValueError:
BMAX = None
class hydro:
TAU_FS = float(cfg['transport']['TAU_FS'])
T_SWITCH = float(cfg['transport']['T_SWITCH'])
ETAS_MIN = float(cfg['transport']['ETAS_MIN'])
ETAS_SLOPE = float(cfg['transport']['ETAS_SLOPE'])
ETAS_CURV = float(cfg['transport']['ETAS_CURV'])
ZETAS_MAX = float(cfg['transport']['ZETAS_MAX'])
ZETAS_WIDTH = float(cfg['transport']['ZETAS_WIDTH'])
ZETAS_T0 = float(cfg['transport']['ZETAS_T0'])
# Jet configuration
class jet:
TAU_PROD = bool(cfg['jet']['TAU_PROD'])
PTHATMIN = float(cfg['jet']['PTHATMIN'])
PTHATMAX = float(cfg['jet']['PTHATMAX'])
PROCESS_CORRECTIONS = bool(cfg['jet']['PROCESS_CORRECTIONS'])
DTAU = float(cfg['jet']['DTAU'])
T_HRG = float(cfg['jet']['T_HRG'])
T_UNHYDRO = float(cfg['jet']['T_UNHYDRO'])
K_F_DRIFT = float(cfg['jet']['K_F_DRIFT'])
K_FG_DRIFT = float(cfg['jet']['K_FG_DRIFT'])
K_BBMG = 1 #float(cfg['jet']['K_BBMG'])
PT_BIN = float(cfg['jet']['PT_BIN'])
TYPE = str(cfg['jet']['TYPE'])
# Global constants
class constants:
G_RAD = float(cfg['global_constants']['G_RAD'])
G_COL = float(cfg['global_constants']['G_COL'])
G = G_RAD
ROOT_S = float(cfg['global_constants']['ROOT_S'])