import numpy as np outputDict = dict() for idx, tuningName in enumerate(tuningNameList): files = expandFolders(basepath + '/' + pathList[idx]) crossValGrid = [] for path in files: if path.endswith('.pic'): crossValGrid.append(path) pprint(crossValGrid) pprint(configList[idx]) pprint(refBenchmarkList[idx]) c = CrossValidStatAnalysis.exportDiscrFiles( crossValGrid, RingerOperation.L2, triggerChains=tuningName, refBenchCol=refBenchmarkList[idx], EtBins=etBins, EtaBins=etaBins, configCol=configList[idx]) mainLogger.info('%d bins found in this tuning: %s', len(c[tuningName].keys()), tuningName) for etIdx in range(len(etBins) - 1): for etaIdx in range(len(etaBins) - 1): thr = c[tuningName][('et%d_eta%d') % (etIdx, etaIdx)]['discriminator']['threshold'] if np.abs(thrRelax[idx]) > 0: if (np.abs(thr + thrRelax[idx]) < 0.95): c[tuningName][('et%d_eta%d') % ( etIdx,
import numpy as np outputDict=dict() for idx, tuningName in enumerate(tuningNameList): files = expandFolders(basepath+'/'+pathList[idx]) crossValGrid=[] for path in files: if path.endswith('.pic'): crossValGrid.append(path) pprint(crossValGrid) pprint(configList[idx]) pprint(refBenchmarkList[idx]) c = CrossValidStatAnalysis.exportDiscrFiles(crossValGrid, RingerOperation.L2, triggerChains=tuningName, refBenchCol=refBenchmarkList[idx], EtBins = etBins, EtaBins = etaBins, configCol=configList[idx]) mainLogger.info('%d bins found in this tuning: %s',len(c[tuningName].keys()),tuningName) for etIdx in range(len(etBins)-1): for etaIdx in range(len(etaBins)-1): thr = c[tuningName][('et%d_eta%d')%(etIdx,etaIdx)]['discriminator']['threshold'] if np.abs(thrRelax[idx])>0: if (np.abs(thr+thrRelax[idx])<0.95): c[tuningName][('et%d_eta%d')%(etIdx,etaIdx)]['discriminator']['threshold'] += thrRelax[idx] mainLogger.warning('Relax threshold %f of (etBin = %d, etaBin = %d) to %f', thr, etIdx, etaIdx, thr+thrRelax[idx])
referenceBenchCol = [['Pd','SP','Pf'], ['Pd','SP','Pf'], ['Pd','SP','Pf']] # Et Bins etBins = [ 20, 30, 40, 50, 500000 ] # Eta bins etaBins = [ 0, 0.8 , 1.37, 1.54, 2.5 ] # [Tight, Medium, Loose and VeryLoose] thrRelax = [0,0,0,0] ####################### Extract Ringer Configuration ######################### import numpy as np for path, referenceBench, configCol in zip(pathList, referenceBenchCol, configList): files = expandFolders( os.path.join( basepath, path ), '*.pic') for conf, ref in zip(configCol, referenceBench): refBenchmark = [[ref] * len(conf)]*len(conf[0]) c = CrossValidStatAnalysis.exportDiscrFiles( sorted(files) , RingerOperation.Offline , refBenchCol = ref , EtBins = etBins , EtaBins = etaBins , configCol = conf #, level = LoggingLevel.VERBOSE ) ###########################################################################
referenceBenchCol = [['Pd','SP','Pf'], ['Pd','SP','Pf'], ['Pd','SP','Pf']] # Et Bins etBins = [ 20, 30, 40, 50, 500000 ] # Eta bins etaBins = [ 0, 0.8 , 1.37, 1.54, 2.5 ] # [Tight, Medium, Loose and VeryLoose] thrRelax = [0,0,0,0] ####################### Extract Ringer Configuration ######################### import numpy as np for path, referenceBench, configCol in zip(pathList, referenceBenchCol, configList): files = expandFolders( os.path.join( basepath, path ), '*.pic.gz') for conf, ref in zip(configCol, referenceBench): refBenchmark = [[ref] * len(conf)]*len(conf[0]) c = CrossValidStatAnalysis.exportDiscrFiles( sorted(files) , RingerOperation.Offline , refBenchCol = ref , EtBins = etBins , EtaBins = etaBins , configCol = conf #, level = LoggingLevel.VERBOSE ) ###########################################################################
import numpy as np outputDict = dict() files = expandFolders(basepath) crossValGrid = [] for path in files: if path.endswith('.pic.gz'): crossValGrid.append(path) pprint(crossValGrid) pprint(configList[0]) pprint(refBenchmarkList[0]) d = CrossValidStatAnalysis.exportDiscrFiles(crossValGrid, RingerOperation.L2, triggerChains=tuningNameList[0], refBenchCol=refBenchmarkList[0], nEtBins=len(etBins), nEtaBins=len(etaBins), configCol=configList[0]) print d.keys() from copy import copy for tuningName in tuningNameList: c = {tuningName: copy(d[tuningNameList[0]])} mainLogger.info('%d bins found in this tuning: %s', len(c[tuningName].keys()), tuningName) outputDict.update(c) ####################### Write Ringer Configuration #########################