From 0f0dc9d5051390b8848680285111f6502fb1bb6b Mon Sep 17 00:00:00 2001 From: Anthony Lefeld Date: Thu, 7 Nov 2019 14:45:43 -0500 Subject: [PATCH] Readd ctG --- Fitter/python/EFT16DModel.py | 16 ++++---- Fitter/scripts/DiscontinuityFinder.py | 2 +- Fitter/scripts/EFTFitter.py | 28 ++++++------- Fitter/scripts/EFTPlotter.py | 58 +++++++++++++-------------- Fitter/scripts/FitConversion16D.py | 2 +- 5 files changed, 53 insertions(+), 53 deletions(-) diff --git a/Fitter/python/EFT16DModel.py b/Fitter/python/EFT16DModel.py index 1faf508..606d3ec 100644 --- a/Fitter/python/EFT16DModel.py +++ b/Fitter/python/EFT16DModel.py @@ -27,15 +27,15 @@ class EFT16DModel(PhysicsModel): def setPhysicsOptions(self, options): self.fits = None # File containing WC parameterizations of each process+bin *with events*! - self.wcs = ['ctW','ctZ','ctp','cpQM','cbW','cpQ3','cptb','cpt','cQl3i','cQlMi','cQei','ctli','ctei','ctlSi','ctlTi'] # Hardcoded currently... - self.wc_ranges = { 'ctW':(-6,6), 'ctZ':(-7,7), - 'cpt':(-40,30), 'ctp':(-35,65), - 'ctli':(-20,20),'ctlSi':(-22,22), + self.wcs = ['ctW','ctZ','ctp','cpQM','ctG','cbW','cpQ3','cptb','cpt','cQl3i','cQlMi','cQei','ctli','ctei','ctlSi','ctlTi'] # Hardcoded currently... + self.wc_ranges = { 'ctW':(-6,6), 'ctZ':(-7,7), + 'cpt':(-40,30), 'ctp':(-35,65), + 'ctli':(-20,20), 'ctlSi':(-22,22), 'cQl3i':(-20,20),'cptb':(-40,40), - 'cpQM':(-30,50), - 'ctlTi':(-4,4),'ctei':(-20,20), - 'cQei':(-16,16),'cQlMi':(-17,17), - 'cpQ3':(-20,12),'cbW':(-10,10) + 'ctG':(-3,3), 'cpQM':(-30,50), + 'ctlTi':(-4,4), 'ctei':(-20,20), + 'cQei':(-16,16), 'cQlMi':(-17,17), + 'cpQ3':(-20,12), 'cbW':(-10,10) } wcs_override = [] # WCs specified by arguments self.procbins = [] # Process+bin combinations (tuple) that we have events for diff --git a/Fitter/scripts/DiscontinuityFinder.py b/Fitter/scripts/DiscontinuityFinder.py index 1833374..ae1b91a 100755 --- a/Fitter/scripts/DiscontinuityFinder.py +++ b/Fitter/scripts/DiscontinuityFinder.py @@ -11,7 +11,7 @@ 'QCDscale_V','QCDscale_VV','QCDscale_VVV','QCDscale_tHq','QCDscale_ttG','QCDscale_ttH','QCDscale_ttbar', 'hf','hfstats1','hfstats2','lf','lfstats1','lfstats2','lumi_13TeV_2017','pdf_gg','pdf_ggttH','pdf_qgtHq','pdf_qq', ] -wcs = ['ctW','ctZ','ctp','cpQM','cbW','cpQ3','cptb','cpt','cQl3i','cQlMi','cQei','ctli','ctei','ctlSi','ctlTi'] +wcs = ['ctW','ctZ','ctp','cpQM','ctG','cbW','cpQ3','cptb','cpt','cQl3i','cQlMi','cQei','ctli','ctei','ctlSi','ctlTi'] wcs_tracked = [wc for wc in wcs if wc != args.poi] print('../fit_files/higgsCombine{}.MultiDimFit.root'.format(args.basename)) diff --git a/Fitter/scripts/EFTFitter.py b/Fitter/scripts/EFTFitter.py index be41da1..85095a9 100644 --- a/Fitter/scripts/EFTFitter.py +++ b/Fitter/scripts/EFTFitter.py @@ -14,20 +14,20 @@ def __init__(self): # WCs lists for easy use # Full list of opeators - self.wcs = ['ctW','ctZ','ctp','cpQM','cbW','cpQ3','cptb','cpt','cQl3i','cQlMi','cQei','ctli','ctei','ctlSi','ctlTi'] + self.wcs = ['ctW','ctZ','ctp','cpQM','ctG','cbW','cpQ3','cptb','cpt','cQl3i','cQlMi','cQei','ctli','ctei','ctlSi','ctlTi'] # Default pair of wcs for 2D scans self.scan_wcs = ['ctW','ctZ'] # Default wcs to keep track of during 2D scans - self.wcs_tracked = ['ctp','cpQM','cbW','cpQ3','cptb','cpt','cQl3i','cQlMi','cQei','ctli','ctei','ctlSi','ctlTi'] + self.wcs_tracked = ['ctp','cpQM','ctG','cbW','cpQ3','cptb','cpt','cQl3i','cQlMi','cQei','ctli','ctei','ctlSi','ctlTi'] # Scan ranges of the wcs - self.wc_ranges = { 'ctW':(-6,6), 'ctZ':(-7,7), - 'cpt':(-40,30), 'ctp':(-35,65), - 'ctli':(-20,20),'ctlSi':(-22,22), + self.wc_ranges = { 'ctW':(-6,6), 'ctZ':(-7,7), + 'cpt':(-40,30), 'ctp':(-35,65), + 'ctli':(-20,20), 'ctlSi':(-22,22), 'cQl3i':(-20,20),'cptb':(-40,40), - 'cpQM':(-30,50), - 'ctlTi':(-4,4),'ctei':(-20,20), - 'cQei':(-16,16),'cQlMi':(-17,17), - 'cpQ3':(-20,12),'cbW':(-10,10) + 'ctG':(-3,3), 'cpQM':(-30,50), + 'ctlTi':(-4,4), 'ctei':(-20,20), + 'cQei':(-16,16), 'cQlMi':(-17,17), + 'cpQ3':(-20,12), 'cbW':(-10,10) } # Systematics names except for FR stats. Only used for debug self.systematics = ['CERR1','CERR2','CMS_eff_em','CMS_scale_j','ChargeFlips','FR_FF','LEPID','MUFR','PDF','PSISR','PU', @@ -168,7 +168,7 @@ def bestFit(self, name='.test', params_POI=[], startValuesString='', freeze=Fals sp.call(['mv','multidimfit'+name+'.root','../fit_files/']) self.printBestFits(name) - def gridScan(self, name='.test', batch='', scan_params=['ctW','ctZ'], params_tracked=['ctp','cpQM','cbW','cpQ3','cptb','cpt','cQl3i','cQlMi','cQei','ctli','ctei','ctlSi','ctlTi'], points=5000, freeze=False, other=[]): + def gridScan(self, name='.test', batch='', scan_params=['ctW','ctZ'], params_tracked=['ctp','cpQM','ctG','cbW','cpQ3','cptb','cpt','cQl3i','cQlMi','cQei','ctli','ctei','ctlSi','ctlTi'], points=5000, freeze=False, other=[]): ### Runs deltaNLL Scan in two parameters using CRAB or Condor ### logging.info("Doing grid scan...") @@ -315,7 +315,7 @@ def batch2DScanEFT(self, basename='.EFT.gridScan', batch='crab', freeze=False, p # Use each wc only once if not allPairs: - scan_wcs = [('ctZ','ctW'),('ctp','cpt'),('ctlSi','ctli'),('cptb','cQl3i'),('ctei','ctlTi'),('cQlMi','cQei'),('cpQ3','cbW')] + scan_wcs = [('ctZ','ctW'),('ctp','cpt'),('ctlSi','ctli'),('cptb','cQl3i'),('ctG','cpQM'),('ctei','ctlTi'),('cQlMi','cQei'),('cpQ3','cbW')] for wcs in scan_wcs: wcs_tracked = [wc for wc in self.wcs if wc not in wcs] @@ -347,7 +347,7 @@ def batchResubmit2DScansEFT(self, basename='.EFT.gridScan', allPairs=False): # Use each wc only once if not allPairs: - scan_wcs = [('ctZ','ctW'),('ctp','cpt'),('ctlSi','ctli'),('cptb','cQl3i'),('ctei','ctlTi'),('cQlMi','cQei'),('cpQ3','cbW')] + scan_wcs = [('ctZ','ctW'),('ctp','cpt'),('ctlSi','ctli'),('cptb','cQl3i'),('ctG','cpQM'),('ctei','ctlTi'),('cQlMi','cQei'),('cpQ3','cbW')] for wcs in scan_wcs: process = sp.Popen(['crab','resubmit','crab_'+basename.replace('.','')+wcs[0]+wcs[1]], stdout=sp.PIPE, stderr=sp.PIPE) @@ -374,7 +374,7 @@ def batchRetrieve2DScansEFT(self, basename='.EFT.gridScan', allPairs=False): # Use each wc only once if not allPairs: - scan_wcs = [('ctZ','ctW'),('ctp','cpt'),('ctlSi','ctli'),('cptb','cQl3i'),('ctei','ctlTi'),('cQlMi','cQei'),('cpQ3','cbW')] + scan_wcs = [('ctZ','ctW'),('ctp','cpt'),('ctlSi','ctli'),('cptb','cQl3i'),('ctG','cpQM'),('ctei','ctlTi'),('cQlMi','cQei'),('cpQ3','cbW')] for wcs in scan_wcs: self.retrieveGridScan('{}.{}{}'.format(basename,wcs[0],wcs[1])) @@ -594,7 +594,7 @@ def sortkey(elem): #Example of a workflow: #fitter.makeWorkspaceEFT('EFT_MultiDim_Datacard.txt') - #fitter.bestFit(name='.EFT.SM.Float.preScan', scan_params=['ctW','ctZ','ctp','cpQM','cbW','cpQ3','cptb','cpt','cQl3i','cQlMi','cQei','ctli','ctei','ctlSi','ctlTi'], freeze=False, autoBounds=True) + #fitter.bestFit(name='.EFT.SM.Float.preScan', scan_params=['ctW','ctZ','ctp','cpQM','ctG','cbW','cpQ3','cptb','cpt','cQl3i','cQlMi','cQei','ctli','ctei','ctlSi','ctlTi'], freeze=False, autoBounds=True) #fitter.gridScan(name='.EFT.SM.Float.gridScan.ctWctZ', batch='crab', scan_wcs=fitter.scan_params, params_tracked=fitter.wcs_tracked, points=50000, freeze=False) #fitter.retrieveGridScan(name='.EFT.SM.Float.gridScan.ctWctZ') #startValuesString = fitter.getBestValues2D(name='.EFT.SM.Float.gridScan.ctWctZ', scan_params=fitter.scan_wcs, params_tracked=fitter.wcs_tracked) diff --git a/Fitter/scripts/EFTPlotter.py b/Fitter/scripts/EFTPlotter.py index f6174d1..27b34d4 100644 --- a/Fitter/scripts/EFTPlotter.py +++ b/Fitter/scripts/EFTPlotter.py @@ -13,16 +13,16 @@ def __init__(self): self.ContourHelper = ContourHelper() self.SMMus = ['mu_ttll','mu_ttlnu','mu_ttH','mu_tllq'] - self.wcs = ['ctW','ctZ','ctp','cpQM','cbW','cpQ3','cptb','cpt','cQl3i','cQlMi','cQei','ctli','ctei','ctlSi','ctlTi'] - self.wcs_pairs = [('ctZ','ctW'),('ctp','cpt'),('ctlSi','ctli'),('cptb','cQl3i'),('ctei','ctlTi'),('cQlMi','cQei'),('cpQ3','cbW')] - self.wc_ranges = { 'ctW':(-6,6), 'ctZ':(-7,7), - 'cpt':(-40,30), 'ctp':(-35,65), - 'ctli':(-20,20),'ctlSi':(-22,22), + self.wcs = ['ctW','ctZ','ctp','cpQM','ctG','cbW','cpQ3','cptb','cpt','cQl3i','cQlMi','cQei','ctli','ctei','ctlSi','ctlTi'] + self.wcs_pairs = [('ctZ','ctW'),('ctp','cpt'),('ctlSi','ctli'),('cptb','cQl3i'),('ctG','cpQM'),('ctei','ctlTi'),('cQlMi','cQei'),('cpQ3','cbW')] + self.wc_ranges = { 'ctW':(-6,6), 'ctZ':(-7,7), + 'cpt':(-40,30), 'ctp':(-35,65), + 'ctli':(-20,20), 'ctlSi':(-22,22), 'cQl3i':(-20,20),'cptb':(-40,40), - 'cpQM':(-30,50), - 'ctlTi':(-4,4),'ctei':(-20,20), - 'cQei':(-16,16),'cQlMi':(-17,17), - 'cpQ3':(-20,12),'cbW':(-10,10) + 'ctG':(-3,3), 'cpQM':(-30,50), + 'ctlTi':(-4,4), 'ctei':(-20,20), + 'cQei':(-16,16), 'cQlMi':(-17,17), + 'cpQ3':(-20,12), 'cbW':(-10,10) } self.histosFileName = 'Histos.root' @@ -1044,11 +1044,11 @@ def BestScanPlot(self, basename_float='', basename_freeze=''): #fits_freeze = self.getIntervalFits('.EFT.SM.Freeze.Jan27.500') for idx,line in enumerate(fits_float): - #if line[0]=='ctG': - # line[0] = 'ctG#times10' - # line[1] = line[1]*10 - # line[2] = [val*10 for val in line[2]] - # line[3] = [val*10 for val in line[3]] + if line[0]=='ctG': + line[0] = 'ctG#times10' + line[1] = line[1]*10 + line[2] = [val*10 for val in line[2]] + line[3] = [val*10 for val in line[3]] if line[0]=='ctp': line[0] = 'ctp#divide5' line[1] = line[1]/5 @@ -1066,11 +1066,11 @@ def BestScanPlot(self, basename_float='', basename_freeze=''): line[3] = [val/2 for val in line[3]] for idx,line in enumerate(fits_freeze): - #if line[0]=='ctG': - # line[0] = 'ctG#times10' - # line[1] = line[1]*10 - # line[2] = [val*10 for val in line[2]] - # line[3] = [val*10 for val in line[3]] + if line[0]=='ctG': + line[0] = 'ctG#times10' + line[1] = line[1]*10 + line[2] = [val*10 for val in line[2]] + line[3] = [val*10 for val in line[3]] if line[0]=='ctp': line[0] = 'ctp#divide5' line[1] = line[1]/5 @@ -1088,8 +1088,8 @@ def BestScanPlot(self, basename_float='', basename_freeze=''): line[3] = [val/2 for val in line[3]] # Set y-coordinates for points and lines - y_float = [n*4+3 for n in range(0,15)] - y_freeze = [n*4+2 for n in range(0,15)] + y_float = [n*4+3 for n in range(0,16)] + y_freeze = [n*4+2 for n in range(0,16)] # Set up the pad and axes canvas = ROOT.TCanvas('canvas','Summary Plot (SM Expectation)',500,800) @@ -1100,7 +1100,7 @@ def BestScanPlot(self, basename_float='', basename_freeze=''): h_fit.Draw() h_fit.SetStats(0) h_fit.GetYaxis().SetTickLength(0) - h_fit.GetYaxis().SetNdivisions(15,False) + h_fit.GetYaxis().SetNdivisions(16,False) h_fit.GetYaxis().SetLabelSize(0) # Add y-axis labels @@ -1113,13 +1113,13 @@ def BestScanPlot(self, basename_float='', basename_freeze=''): # Set the best fit points graph_float = ROOT.TGraph() - graph_float = ROOT.TGraph(15, numpy.array([fittuple[1] for fittuple in fits_float], dtype='float'), numpy.array(y_float, dtype='float')) + graph_float = ROOT.TGraph(16, numpy.array([fittuple[1] for fittuple in fits_float], dtype='float'), numpy.array(y_float, dtype='float')) graph_float.SetMarkerStyle(20) graph_float.SetMarkerSize(0.5) graph_float.SetMarkerColor(1) graph_freeze = ROOT.TGraph() - graph_freeze = ROOT.TGraph(15, numpy.array([fittuple[1] for fittuple in fits_freeze], dtype='float'), numpy.array(y_freeze, dtype='float')) + graph_freeze = ROOT.TGraph(16, numpy.array([fittuple[1] for fittuple in fits_freeze], dtype='float'), numpy.array(y_freeze, dtype='float')) graph_freeze.SetMarkerStyle(20) graph_freeze.SetMarkerSize(0.5) graph_freeze.SetMarkerColor(2) @@ -1247,7 +1247,7 @@ def BestFitPlot(self): ('ctZ', 0.001943, 10.497099, -3.072483, 3.093559), ('ctp', 0.000558, 2.153222, -2.153222, 2.153222), ('cpQM', 0.000139, 1.147733, -1.147733, 1.147733), - #('ctG#times10', -4.3e-04, 01.49153, -01.49153, 01.49153), + ('ctG#times10', -4.3e-04, 01.49153, -01.49153, 01.49153), ('cbW', 0.0, 13.188208, -13.188208, 13.188208), ('cpQ3', -0.000237, 1.284475, -1.284475, 1.284475), ('cptb', 0.0, 53.786793, -53.786793, 53.786793), @@ -1266,7 +1266,7 @@ def BestFitPlot(self): ('ctZ', 0.001882, 2.732047, -1.259174, 1.26976), ('ctp', 0.010915, 2.809417, -3.5235, 4.18801), ('cpQM', 0.003549, 1.386955, -1.779072, 1.688684), - #('ctG#times10', 00.00868, 01.72676, -04.75713, 02.8743), + ('ctG#times10', 00.00868, 01.72676, -04.75713, 02.8743), ('cbW', -0.00522, 3.477419, -2.071278, 2.081717), ('cpQ3', 0.003113, 1.42997, -2.489773, 1.473674), ('cptb', -0.012994, 14.945221, -8.696135, 8.672515), @@ -1292,7 +1292,7 @@ def BestFitPlot(self): h_fit.SetStats(0) #h_fit.GetXaxis().SetTickLength(0.1) h_fit.GetYaxis().SetTickLength(0) - h_fit.GetYaxis().SetNdivisions(15,False) + h_fit.GetYaxis().SetNdivisions(16,False) h_fit.GetYaxis().SetLabelSize(0) # Add y-axis labels @@ -1303,12 +1303,12 @@ def BestFitPlot(self): y_labels[idy].SetTextSize(0.03) # Set the best fit points - graph_float = ROOT.TGraph(15, numpy.array([fittuple[1] for fittuple in fits_float], dtype='float'), numpy.array(y_float, dtype='float')) + graph_float = ROOT.TGraph(16, numpy.array([fittuple[1] for fittuple in fits_float], dtype='float'), numpy.array(y_float, dtype='float')) graph_float.SetMarkerStyle(20) graph_float.SetMarkerSize(0.5) graph_float.SetMarkerColor(2) - graph_freeze = ROOT.TGraph(15, numpy.array([fittuple[1] for fittuple in fits_freeze], dtype='float'), numpy.array(y_freeze, dtype='float')) + graph_freeze = ROOT.TGraph(16, numpy.array([fittuple[1] for fittuple in fits_freeze], dtype='float'), numpy.array(y_freeze, dtype='float')) graph_freeze.SetMarkerStyle(20) graph_freeze.SetMarkerSize(0.5) graph_freeze.SetMarkerColor(4) diff --git a/Fitter/scripts/FitConversion16D.py b/Fitter/scripts/FitConversion16D.py index ed01ae2..4e4eebd 100644 --- a/Fitter/scripts/FitConversion16D.py +++ b/Fitter/scripts/FitConversion16D.py @@ -16,7 +16,7 @@ hist_file = sys.argv[1] #List of operators to extract parameterizations for -operators = ['sm']+['ctW','ctp','cpQM','ctZ','cbW','cpQ3','cptb','cpt','cQl3i','cQlMi','cQei','ctli','ctei','ctlSi','ctlTi'] +operators = ['sm']+['ctW','ctp','cpQM','ctG','ctZ','cbW','cpQ3','cptb','cpt','cQl3i','cQlMi','cQei','ctli','ctei','ctlSi','ctlTi'] #operators = ['sm']+['ctW'] #Debug #Load file