167
167
"""Initialise - does nothing"""
168
168
CodeSetup.__init__(self)
169
169
if os.getenv('ICOOL') == None:
170
raise EnvironmentError("Need to define $ICOOL environment "+\
171
"variable with ICOOL executable path")
172
if os.getenv('ICOOL_VERSION') == None:
173
raise EnvironmentError("Need to define $ICOOL_VERSION "+\
174
"environment variable with ICOOL version")
175
self._version = os.getenv('ICOOL_VERSION')
170
icool_version = open(os.path.\
171
expandvars('/home/hep/sm1208/icool/README'))\
173
icool_version = icool_version.rstrip('\n')
174
icool_version = icool_version.split(' ')[-1]
175
self._version = icool_version
179
self._version = os.getenv('ICOOL')
178
182
def __str__(self):
213
220
def get_executable(self):
214
221
"""Executable is simulate_mice.py"""
215
return os.path.expandvars('$ICOOL')
223
return os.path.join('/home/hep/sm1208/icool','icool')
217
226
def get_parameters(self):
218
227
"""Command line parameter to specify control files"""
230
239
"""Bunch is station 2"""
233
class G4blSetup(CodeSetup):
235
Conversions and setup for G4Beamline
238
"""Initialise - does nothing"""
239
CodeSetup.__init__(self)
240
if os.getenv('G4BL') == None:
241
raise EnvironmentError("Need to define $G4BL environment "+\
242
"variable with G4Beamline executable path")
243
if os.getenv('G4BL_VERSION') == None:
244
raise EnvironmentError("Need to define $G4BL_VERSION "+\
245
"environment variable with G4bl version")
246
self._version = os.getenv('G4BL_VERSION')
249
"""Return name of this code"""
250
return 'g4bl_'+self._version
252
def convert_position(self, value):
256
def convert_momentum(self, value):
260
def convert_pid(self, value):
264
def convert_material(self, value):
267
'lH2':'LH2', 'LITHIUM_HYDRIDE':'LITHIUM_HYDRIDE', 'Al':'Al',
268
'Be':'Be', 'lHe':'lHe', 'STEEL304':'Fe','Cu':'Cu', 'C':'C',
270
return conversions[value]
272
def get_substitutions(self):
273
"""Input file is configuration file and geometry definitions"""
274
return {geometry.source('g4bl/g4bl_deck.in'):\
275
geometry.temp('g4bl_deck')}
277
def get_executable(self):
278
"""Executable is simulate_mice.py"""
279
return os.getenv('G4BL')
281
def get_parameters(self):
282
"""Command line parameter to specify control files"""
283
return [geometry.temp('g4bl_deck')]
285
def get_output_filename(self):
286
"""Output filename dynamically pulls MAUS version from README"""
287
return 'g4bl.'+self._version+'.ref_data.dat'
289
def get_bunch_read_keys(self):
290
"""I/O type is maus_root_virtual_hit"""
291
return ('icool_for009', geometry.temp('for009_g4bl.txt'))
293
def get_bunch_index(self):
296
244
class G4MICESetup(CodeSetup):
446
394
in directory pointed to by $ICOOL_ELMSDB environment variable.
448
396
def __init__(self):
450
Additional initialisation is environment variable giving location of
453
398
super(IcoolElmsSetup, self).__init__()
454
if os.getenv('ICOOL_ELMSDB') == None:
455
raise EnvironmentError("Need to define $ICOOL_ELMSDB "+\
456
"environment variable with ELMS data")
457
run_dir = os.path.expandvars("${ICOOL_ELMSDB}/RunDirectory.txt")
399
#if os.getenv('ICOOL_ELMSDB') == None:
400
#raise EnvironmentError("/home/hep/sm1208/icool/elms")
401
run_dir = os.path.expandvars(\
402
"/home/hep/sm1208/icool/elms/"+\
458
404
if not os.path.isfile(run_dir):
459
405
raise EnvironmentError("Couldn't find "+run_dir+" needed for elms")
460
elms_db = "${ICOOL_ELMSDB}/ELMSFv3run*"
406
elms_db = "/home/hep/sm1208/icool/elms/ELMSFv3run*"
461
407
if len(glob.glob(os.path.expandvars(elms_db))) < 1:
462
408
raise EnvironmentError("Couldn't find files like "+elms_db+\
463
409
" needed for elms")
464
410
IcoolElmsSetup._substitute_elmscom()
466
415
def __str__(self):
467
416
"""Return icool_elms_<version>"""