Skip to content

Commit

Permalink
Readd ctG
Browse files Browse the repository at this point in the history
  • Loading branch information
alefeld committed Nov 7, 2019
1 parent 6bed2b5 commit 0f0dc9d
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 53 deletions.
16 changes: 8 additions & 8 deletions Fitter/python/EFT16DModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Fitter/scripts/DiscontinuityFinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
28 changes: 14 additions & 14 deletions Fitter/scripts/EFTFitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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...")

Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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)
Expand All @@ -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]))

Expand Down Expand Up @@ -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)
Expand Down
58 changes: 29 additions & 29 deletions Fitter/scripts/EFTPlotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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),
Expand All @@ -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),
Expand All @@ -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
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Fitter/scripts/FitConversion16D.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0f0dc9d

Please sign in to comment.