#!/usr/bin/env python ReferenceList = [{'string':"KstJpsi", 'bool': True}, {'string':"KstMuMu", 'bool': False}] DataDict = {'name':"data", 'data':True, 'reference':[{'string':"", 'bool': False}], 'phsp': 'False', 'BkgStudy': 'False', 'stream': "Leptonic", 'line': "B2XMuMu_Line", 'channel': [{'string':"", 'boolKshort': 'True', 'boolKplus': 'True'}] } MCDict = {'name':"MC", 'data':False, 'reference':ReferenceList, 'phsp': 'False', 'BkgStudy': 'False', 'stream': "AllStreams", 'line': "B2XMuMu_Line", 'channel': [{'string':"_Kshort", 'boolKshort': 'True', 'boolKplus': 'False'}, {'string':"_Kplus", 'boolKshort': 'False', 'boolKplus': 'True'}] } PHSPDict = {'name':"PHSP", 'data':False, 'reference':[{'string':"", 'bool': False}], 'phsp': 'True', 'BkgStudy': 'False', 'stream': "B2XMuMu.Strip", 'line': "B2XMuMu_Line", 'channel': [{'string':"_Kshort", 'boolKshort': 'True', 'boolKplus': 'False'}, {'string':"_Kplus", 'boolKshort': 'False', 'boolKplus': 'True'}] } BkgDict = {'name':"MC", 'data':False, 'reference':[{'string':"BkgStudy", 'bool': False}], 'phsp': 'False', 'BkgStudy': 'True', 'stream': "AllStreams", 'line': "B2XMuMu_Line", 'channel': [{'string':"_Kplus", 'boolKshort': 'False', 'boolKplus': 'True'}] } DataTypeList = [DataDict,MCDict,PHSPDict,BkgDict] PolarityList = [{'string':"Down", 'bool': True}, {'string':"Up", 'bool': False}] YearList = ['2011','2012','2015','2016','2017','2018'] for Type in DataTypeList: for Year in YearList: for Polarity in PolarityList: for Ref in Type['reference']: for Channel in Type['channel']: ScriptName = "./optfiles/%s/%s/%s%s_%s%s.py" % (Type['name'],Ref['string'],Year, Polarity['string'],Type['name'],Channel['string']) f1 = open(ScriptName, 'w') f1.write( '############# Global settings\n' ) f1.write( 'runFilters = False\n' ) f1.write( 'reference = %s\n' % Ref['bool'] ) f1.write( 'phsp = %s\n' % Type['phsp'] ) f1.write( 'BkgStudy = %s\n' % Type['BkgStudy'] ) f1.write( 'data = %s\n' % Type['data'] ) f1.write( 'down = %s\n' % Polarity['bool'] ) f1.write( 'year = "%s"\n'%Year ) f1.write( 'stream = "%s"\n' % Type['stream'] ) f1.write( 'line = "%s"\n\n'% Type['line'] ) f1.write( '#subdecay chains\n' ) f1.write( 'KShortPiPlus = %s\n' % Channel['boolKshort'] ) f1.write( 'KplusPi0Merged = False\n') #% Channel['boolKplus'] ) f1.write( 'KplusPi0Resolved = %s\n\n\n'% Channel['boolKplus'] ) f = open('./optfiles/BasicOptfile.py') for line in f.readlines(): f1.write(line) f.close() f1.close()