コード例 #1
0
# Define cuts
configMgr.cutsDict["UserRegion"] = "1."

# Define weights
configMgr.weights = "1."

# Define samples
bkgSample = Sample("Bkg", kGreen - 9)
bkgSample.setStatConfig(False)
bkgSample.buildHisto([nbkg], "UserRegion", "cuts")
# bkgSample.buildStatErrors([nbkgErr],"UserRegion","cuts")
# bkgSample.addSystematic(corb)
bkgSample.addSystematic(ucb)

sigSample = Sample("Sig", kPink)
sigSample.setNormFactor("mu_Sig", 1.0, 0.0, 100.0)
sigSample.setStatConfig(False)
sigSample.setNormByTheory(False)
sigSample.buildHisto([nsig], "UserRegion", "cuts")
# sigSample.buildStatErrors([nsigErr],"UserRegion","cuts")
# sigSample.addSystematic(cors)
# sigSample.addSystematic(ucs)

dataSample = Sample("Data", kBlack)
dataSample.setData()
dataSample.buildHisto([ndata], "UserRegion", "cuts")

# Define top-level
ana = configMgr.addTopLevelXML("SPlusB")
ana.addSamples([bkgSample, sigSample, dataSample])
ana.setSignalSample(sigSample)
コード例 #2
0
other_sample.setNormByTheory()
sample_list_bkg.append(other_sample)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# single top
single_top_sample = Sample("SingleTop", kGreen-1)

single_top_sample.setStatConfig(use_stat)
single_top_sample.setNormByTheory()
sample_list_bkg.append(single_top_sample)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Z/gamma*
z_sample = Sample("ZGamma", kRed+1 )

z_sample.setNormFactor("mu_z", 1, 0, 100)
z_sample.setStatConfig(use_stat)
sample_list_bkg.append(z_sample)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# ttbar
ttbar_sample = Sample("ttbar", kGreen+2)

ttbar_sample.setNormFactor("mu_ttbar", 1, 0, 100)
ttbar_sample.setStatConfig(use_stat)
sample_list_bkg.append(ttbar_sample)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# data
data_sample = Sample("data",kBlack)
data_sample.setData()
コード例 #3
0
# Define weights
configMgr.weights = "1."

# Define samples
bkgSample = Sample("Bkg",kGreen-9)
bkgSample.setNormByTheory(True)
bkgSample.buildHisto(nBkgCR,"CR","cuts",0.5)
bkgSample.buildHisto(nBkgSR,"SR","cuts",0.5)
bkgSample.addSystematic(bg1xsec)

ddSample = Sample("DataDriven",kGreen+2)
ddSample.addShapeFactor("DDShape")

sigSample = Sample("Sig",kPink)
sigSample.setNormFactor("mu_Sig",1.,0.2,1.5)
sigSample.buildHisto(nSigSR,"SR","cuts",0.5)
sigSample.setNormByTheory(True)
sigSample.addSystematic(sigxsec)

dataSample = Sample("Data",kBlack)
dataSample.setData()
dataSample.buildHisto(nDataCR,"CR","cuts",0.5)
dataSample.buildHisto(nDataSR,"SR","cuts",0.5)

# Define top-level
ana = configMgr.addFitConfig("SPlusB")
ana.addSamples([bkgSample,ddSample,dataSample])

# Define measurement
meas = ana.addMeasurement(name="NormalMeasurement",lumi=1.0,lumiErr=0.039)
コード例 #4
0
# NB: note that theoSys on diboson are applied on the level of the region definitions,
# since we have one for the SR and one for the CR
dibosonSample = Sample(zlFitterConfig.dibosonSampleName, kRed+3)
dibosonSample.setTreeName("Diboson_SRAll")
dibosonSample.setFileList(dibosonFiles)
dibosonSample.setStatConfig(zlFitterConfig.useStat)

#--------------------------
# QCD
#--------------------------
qcdSample = Sample(zlFitterConfig.qcdSampleName, kOrange+2)
if zlFitterConfig.useDDQCDsample:#normWeight is 0 => remove it
    qcdSample.setTreeName("Data_SRAll")
else :
    qcdSample.setTreeName("QCD_SRAll")
qcdSample.setNormFactor("mu_"+zlFitterConfig.qcdSampleName, 1., 0., 50000000.)
qcdSample.setFileList(qcdFiles)
qcdSample.setStatConfig(zlFitterConfig.useStat)

qcdWeight = 1
nJets = channel.nJets
if nJets > 0 and nJets < len(zlFitterConfig.qcdWeightList)+1:
    qcdWeight = zlFitterConfig.qcdWeightList[nJets-1]/ (zlFitterConfig.luminosity)
    if zlFitterConfig.useMCQCDsample:
        qcdWeight = 1

    qcdSample.addWeight(str(qcdWeight))
    for w in configMgr.weights: #add all other weights but not normWeight
        qcdSample.addWeight(w)
    if zlFitterConfig.useDDQCDsample:#normWeight is 0 => remove it
        qcdSample.removeWeight("normWeight")
コード例 #5
0
ファイル: MyConfigExample.py プロジェクト: dguest/HistFitter
topKtScale = Systematic("KtScaleTop",configMgr.weights,ktScaleTopHighWeights,ktScaleTopLowWeights,"weight","overallNormHistoSys")
wzKtScale = Systematic("KtScaleWZ",configMgr.weights,ktScaleWHighWeights,ktScaleWLowWeights,"weight","overallNormHistoSys")


# JES uncertainty as shapeSys - one systematic per region (combine WR and TR), merge samples
jes = Systematic("JES","_NoSys","_JESup","_JESdown","tree","overallNormHistoSys")

statWRwz  = Systematic("SLWR_wz", "_NoSys","","","tree","shapeStat")
statWRtop = Systematic("SLWR_top","_NoSys","","","tree","shapeStat")

# name of nominal histogram for systematics
configMgr.nomName = "_NoSys"

# List of samples and their plotting colours
topSample = Sample("Top",kGreen-9)
topSample.setNormFactor("mu_Top",1.,0.,5.)
topSample.setStatConfig(useStat)
topSample.setNormRegions([("SLWR","nJet"),("SLTR","nJet")])
wzSample = Sample("WZ",kAzure+1)
wzSample.setNormFactor("mu_WZ",1.,0.,5.)
wzSample.setStatConfig(useStat)
wzSample.setNormRegions([("SLWR","nJet"),("SLTR","nJet")])
bgSample = Sample("BG",kYellow-3)
bgSample.setNormFactor("mu_BG",1.,0.,5.)
bgSample.setStatConfig(useStat)
bgSample.setNormRegions([("SLWR","nJet"),("SLTR","nJet")])
qcdSample = Sample("QCD",kGray+1)
qcdSample.setQCD(True,"histoSys")
qcdSample.setStatConfig(useStat)
dataSample = Sample("Data",kBlack)
dataSample.setData()
コード例 #6
0
topKtScale = Systematic("KtScaleTop", configMgr.weights, ktScaleTopHighWeights,
                        ktScaleTopLowWeights, "weight", "normHistoSys")
wzKtScale = Systematic("KtScaleWZ", configMgr.weights, ktScaleWHighWeights,
                       ktScaleWLowWeights, "weight", "normHistoSys")

# JES uncertainty as shapeSys - one systematic per region (combine WR and TR), merge samples
jes = Systematic("JES", "_NoSys", "_JESup", "_JESdown", "tree", "normHistoSys")
mcstat = Systematic("mcstat", "_NoSys", "_NoSys", "_NoSys", "tree",
                    "shapeStat")

# name of nominal histogram for systematics
configMgr.nomName = "_NoSys"

# List of samples and their plotting colours
topSample = Sample("Top", kGreen - 9)
topSample.setNormFactor("mu_Top", 1., 0., 5.)
topSample.setStatConfig(useStat)
topSample.setNormRegions([("SLWR", "nJet"), ("SLTR", "nJet")])
wzSample = Sample("WZ", kAzure + 1)
wzSample.setNormFactor("mu_WZ", 1., 0., 5.)
wzSample.setStatConfig(useStat)
wzSample.setNormRegions([("SLWR", "nJet"), ("SLTR", "nJet")])
bgSample = Sample("BG", kYellow - 3)
bgSample.setNormFactor("mu_BG", 1., 0., 5.)
bgSample.setStatConfig(useStat)
bgSample.setNormRegions([("SLWR", "nJet"), ("SLTR", "nJet")])
qcdSample = Sample("QCD", kGray + 1)
qcdSample.setQCD(True, "histoSys")
qcdSample.setStatConfig(useStat)
dataSample = Sample("Data", kBlack)
dataSample.setData()
コード例 #7
0
# Define cuts
configMgr.cutsDict["UserRegion"] = "1."

#Define weights
configMgr.weights = "1."

#Define samples
bkgSample = Sample("Bkg",kGreen-9)
bkgSample.setStatConfig(True)
bkgSample.setNormByTheory(False)     #this has to be true for samples with normalisation taken from MC, it means include lumi error (set false if data driven)
bkgSample.buildHisto([nbkg],"UserRegion","cuts")
bkgSample.buildStatErrors([nbkgErr],"UserRegion","cuts")
bkgSample.addSystematic(ucb)

sigSample = Sample("Sig",kPink)
sigSample.setNormFactor("mu_Sig",1.0,0.,24645.6)
sigSample.setStatConfig(True)
sigSample.setNormByTheory(False)    #this has to be false since xsec is scaled by mu
sigSample.buildHisto([nsig],"UserRegion","cuts")
sigSample.buildStatErrors([nsigErr],"UserRegion","cuts")

dataSample = Sample("Data",kBlack)
dataSample.setData()
dataSample.buildHisto([ndata],"UserRegion","cuts")

# Define top-level
ana = configMgr.addFitConfig("SPlusB")
ana.addSamples([bkgSample,sigSample,dataSample])
ana.setSignalSample(sigSample)

# Define measurement
コード例 #8
0
# --------------------------
# Diboson
# --------------------------
# NB: note that theoSys on diboson are applied on the level of the region definitions,
# since we have one for the SR and one for the CR
dibosonSample = Sample(zlFitterConfig.dibosonSampleName, kRed + 3)
dibosonSample.setTreeName("Diboson_SRAll")
dibosonSample.setFileList(dibosonFiles)
dibosonSample.setStatConfig(zlFitterConfig.useStat)

# --------------------------
# QCD
# --------------------------
qcdSample = Sample(zlFitterConfig.qcdSampleName, kOrange + 2)
qcdSample.setTreeName("QCDdd_SRAll")
qcdSample.setNormFactor("mu_" + zlFitterConfig.qcdSampleName, 1.0, 0.0, 500.0)
qcdSample.setFileList(qcdFiles)
qcdSample.setStatConfig(zlFitterConfig.useStat)

qcdWeight = 1
nJets = channel.nJets
if nJets > 0 and nJets < len(zlFitterConfig.qcdWeightList):
    qcdWeight = zlFitterConfig.qcdWeightList[nJets - 1] / (zlFitterConfig.luminosity * 1000)
    qcdSample.addWeight(str(qcdWeight))
    for w in configMgr.weights:  # ATT: there is a bug in HistFitter, I have to add the other weight by hand
        qcdSample.addWeight(w)


# Define samples
# FakePhotonSample = Sample("Bkg",kGreen-9)
# FakePhotonSample.setStatConfig(False)
コード例 #9
0
    for region in yields_dict :
        configMgr.cutsDict[region] = "1."
    #    if "CR" in region :
    #        sample_for_cr = region.split("_")[1].lower()
    #        if sample.name.lower() == sample_for_cr :
    #            set_norm_by_theory = False
    #            sample.setNormFactor("mu_%s" % sample.name.lower(), 1.0, 0.0, 10.0)
    #            sample.setNormRegions([ (region, "cuts") ])
    if set_norm_by_theory :
        sample.setNormByTheory()

# add the samples
tlx.addSamples(all_samples)

# signal
if myFitType == FitType.Exclusion :

    sample_sig.setStatConfig(True)

    sample_sig.setNormFactor("mu_Test", 1.0, 0.0, 10.0)
    sample_sig.setNormRegions( [ ("CR_BKG0", "cuts") ] )#, ("CR_BKG1", "cuts") ] )
    sample_sig.setNormByTheory()
    tlx.addSamples(sample_sig)
#    tlx.setSignalSample(sample_sig)

#    tlx.addSignalChannels(sr_channels)

if myFitType == FitType.Background :
    #tlx.addSignalChannels(sr_channels)
    tlx.addValidationChannels(sr_channels)
コード例 #10
0
configMgr.cutsDict["UserRegion"] = "1."

# Define weights
configMgr.weights = "1."

# Define samples
bkgSample = Sample("Bkg",kGreen-9)
bkgSample.setStatConfig(True)
bkgSample.buildHisto([nbkg],"UserRegion","cuts")
bkgSample.buildStatErrors([nbkgErr],"UserRegion","cuts") ###
if(runMode=="exclusion"):
	bkgSample.addSystematic(corb)
bkgSample.addSystematic(ucb)

sigSample = Sample("Sig",kPink)
sigSample.setNormFactor("mu_Sig",1.,normFactorMin,normFactorMax)
sigSample.setStatConfig(False)
sigSample.setNormByTheory(False)
sigSample.buildHisto([nsig],"UserRegion","cuts")
sigSample.buildStatErrors([nsigErr],"UserRegion","cuts") ###
sigSample.addSystematic(cors) ###
sigSample.addSystematic(ucs) ###

dataSample = Sample("Data",kBlack)
dataSample.setData()
dataSample.buildHisto([ndata],"UserRegion","cuts")

# Define top-level
ana = configMgr.addTopLevelXML("SPlusB")
if(runMode=="exclusion"):
	ana.addSamples([bkgSample,sigSample,dataSample])
コード例 #11
0
# Define cuts
configMgr.cutsDict["UserRegion"] = "1."

# Define weights
configMgr.weights = "1."

# Define samples
bkgSample = Sample("Bkg", kGreen - 9)
bkgSample.setStatConfig(True)
bkgSample.buildHisto([nbkg], "UserRegion", "cuts", 0.5)

bkgSample.addSystematic(ucb)

sigSample = Sample("Sig", kPink)
sigSample.setNormFactor("mu_SS", 1, 0, 40)
#sigSample.setStatConfig(True)
sigSample.setNormByTheory()
sigSample.buildHisto([nsig], "UserRegion", "cuts", 0.5)

dataSample = Sample("Data", kBlack)
dataSample.setData()
dataSample.buildHisto([ndata], "UserRegion", "cuts", 0.5)

# Define top-level
ana = configMgr.addFitConfig("SPlusB")
ana.addSamples([bkgSample, sigSample, dataSample])
ana.setSignalSample(sigSample)

# Define measurement
meas = ana.addMeasurement(name="NormalMeasurement",
コード例 #12
0
# Define cuts
configMgr.cutsDict["UserRegion"] = "1."

# Define weights
configMgr.weights = "1."

# Define samples
bkgSample = Sample("Bkg",kGreen-9)
bkgSample.setStatConfig(True)
bkgSample.buildHisto([nbkg],"UserRegion","cuts",0.5)


bkgSample.addSystematic(ucb)

sigSample = Sample("Sig",kPink)
sigSample.setNormFactor("mu_SS",1.,0.,10.)
#sigSample.setStatConfig(True)
sigSample.setNormByTheory()
sigSample.buildHisto([nsig],"UserRegion","cuts",0.5)




dataSample = Sample("Data",kBlack)
dataSample.setData()
dataSample.buildHisto([ndata],"UserRegion","cuts",0.5)

# Define top-level
ana = configMgr.addFitConfig("SPlusB")
ana.addSamples([bkgSample,sigSample,dataSample])
ana.setSignalSample(sigSample)
コード例 #13
0
ファイル: LimitConfig.py プロジェクト: dantrim/SuperFitter
            zvSample.setNormRegions([("emCRZV14b","cuts")])

    # Add Systematics
    zvSample = addSys(zvSample, userOpts.doSimFit2LZV, sysObj)

    # Additional ZV Specific systematics
    if userOpts.doSimFit2LZV:
        #zvSample.addSystematic(sysObj.AR_all_GENZV)
        #zvSample.addSystematic(sysObj.AR_all_SCALEZV)
        #zvSample.addSystematic(sysObj.AR_all_SHOWERZV)
        #zvSample.addSystematic(sysObj.AR_all_PDFZV)

        # Specify where to take the normalization if
        # we are doing the simultaneous fit
        if 'SR1' in SR:
            zvSample.setNormFactor("mu_2LZV1",1.,0.,10.)
        elif('SR2a' in SR or 'SR2b' in SR or 'SR4a' in SR or 'SR4b' in SR or 'SR4c' in SR):
            zvSample.setNormFactor("mu_2LZV2a",1.,0.,10.)
        elif userOpts.doSimFit2LZV and 'SR5a' in SR:
            zvSample.setNormFactor("mu_2LZV5a",1.,0.,10.)
        elif('Super0a' in SR or 'Super0b' in SR or 'Super0c' in SR):
            zvSample.setNormFactor("mu_ZV14a",1.,0.,10.)
        elif('Super1a' in SR or 'Super1b' in SR or 'Super1c' in SR):
            zvSample.setNormFactor("mu_ZV14b",1.,0.,10.)
    else:	
        zvSample.setNormByTheory()
        #zvSample.addSystematic(sysObj.AR_all_GENZV)
        #zvSample.addSystematic(sysObj.AR_all_SCALEZV)
        #zvSample.addSystematic(sysObj.AR_all_SHOWERZV)
        #zvSample.addSystematic(sysObj.AR_all_PDFZV)		
コード例 #14
0
# Define weights
configMgr.weights = "1."

# Define samples
bkgSample = Sample("Bkg",kGreen-9)
bkgSample.setNormByTheory(True)
bkgSample.buildHisto(nBkgCR,"CR","cuts",0.5)
bkgSample.buildHisto(nBkgSR,"SR","cuts",0.5)
bkgSample.addSystematic(bg1xsec)

ddSample = Sample("DataDriven",kGreen+2)
ddSample.addShapeFactor("DDShape")

sigSample = Sample("Sig",kPink)
sigSample.setNormFactor("mu_Sig",1.,0.2,1.5)
sigSample.buildHisto(nSigSR,"SR","cuts",0.5)
sigSample.setNormByTheory(True)
sigSample.addSystematic(sigxsec)

dataSample = Sample("Data",kBlack)
dataSample.setData()
dataSample.buildHisto(nDataCR,"CR","cuts",0.5)
dataSample.buildHisto(nDataSR,"SR","cuts",0.5)

# Define top-level
ana = configMgr.addFitConfig("SPlusB")
ana.addSamples([bkgSample,ddSample,dataSample])

# Define measurement
meas = ana.addMeasurement(name="NormalMeasurement",lumi=1.0,lumiErr=0.039)
コード例 #15
0
# phoScaleMuWgamma = Systematic("phoScale",configMgr.weights, 1.018, 1-.018, "user","userOverallSys")
# phoScaleMuttgamma = Systematic("phoScale",configMgr.weights, 1.015,1-.015, "user","userOverallSys")
# phoScaleMuttbarDilep = Systematic("phoScale",configMgr.weights, 1.028, 1-.028, "user","userOverallSys")
# phoScaleMust = Systematic("phoScale",configMgr.weights, 1.023, 1-.023, "user","userOverallSys")
# phoScaleMudiboson = Systematic("phoScale",configMgr.weights, 1.040, 1-.040, "user","userOverallSys")
# phoScaleMuZgamma = Systematic("phoScale",configMgr.weights, 1.025, 1-.025, "user","userOverallSys")

## List of samples and their plotting colours. Associate dedicated systematics if applicable.

ttbargamma = Sample("ttbargamma",46) # brick
ttbargamma.setNormByTheory()
ttbargamma.setStatConfig(True)
ttbargamma.addSystematic(ttbargammaNorm)

Wgamma = Sample("Wgamma",7) # cyan
Wgamma.setNormFactor("mu_Wgamma",1.,0.,5.)
Wgamma.setNormRegions([("WCRhHTEl", "cuts")])
Wgamma.setStatConfig(True)
#Wgamma.addSystematic(WgammaNorm)

Zgamma = Sample("Zgamma",kViolet) # cyan
Zgamma.setNormByTheory()
Zgamma.setStatConfig(True)
Zgamma.addSystematic(ZgammaNorm)

Zjets = Sample("Zjets",kBlue) # cyan
Zjets.setNormByTheory()
Zjets.setStatConfig(True)
Zjets.addSystematic(ZjetsNorm)

Wjets = Sample("Wjets",3) # green
コード例 #16
0
other_sample.setNormByTheory()
sample_list_bkg.append(other_sample)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# single top
single_top_sample = Sample("SingleTop", kGreen-1)

single_top_sample.setStatConfig(use_stat)
single_top_sample.setNormByTheory()
sample_list_bkg.append(single_top_sample)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Z/gamma*
z_sample = Sample("ZGamma", kRed+1 )

z_sample.setNormFactor("mu_z", 1, 0, 100)
z_sample.setStatConfig(use_stat)
sample_list_bkg.append(z_sample)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# ttbar
ttbar_sample = Sample("ttbar", kGreen+2)

ttbar_sample.setNormFactor("mu_ttbar", 1, 0, 100)
ttbar_sample.setStatConfig(use_stat)
sample_list_bkg.append(ttbar_sample)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# data
data_sample = Sample("data",kBlack)
data_sample.setData()
コード例 #17
0
    "SU_160_160_0_10", "SU_1000_280_0_10", "SU_1000_160_0_10",
    "SU_400_100_0_10", "SU_760_190_0_10", "SU_680_160_0_10", "SU_840_220_0_10",
    "SU_360_340_0_10", "SU_1080_220_0_10", "SU_360_250_0_10",
    "SU_760_130_0_10", "SU_440_115_0_10", "SU_240_160_0_10", "SU_200_310_0_10",
    "SU_200_145_0_10", "SU_600_220_0_10", "SU_280_130_0_10", "SU_520_220_0_10",
    "SU_1080_160_0_10", "SU_40_190_0_10", "SU_1160_160_0_10",
    "SU_280_310_0_10", "SU_920_160_0_10", "SU_80_190_0_10", "SU_40_310_0_10",
    "SU_1160_130_0_10", "SU_40_250_0_10", "SU_40_100_0_10", "SU_400_220_0_10",
    "SU_40_340_0_10", "SU_1000_100_0_10", "SU_120_175_0_10", "SU_280_220_0_10",
    "SU_760_340_0_10", "SU_240_115_0_10", "SU_440_190_0_10",
    "SU_1160_340_0_10", "SU_600_100_0_10", "SU_200_250_0_10",
    "SU_280_145_0_10", "SU_200_190_0_10", "SU_200_205_0_10", "SU_760_250_0_10",
    "SU_120_250_0_10", "SU_80_175_0_10", "SU_40_130_0_10", "SU_920_250_0_10",
    "SU_80_160_0_10", "SU_240_175_0_10", "SU_280_100_0_10", "SU_1080_310_0_10",
    "SU_920_340_0_10", "SU_120_115_0_10", "SU_1160_100_0_10",
    "SU_280_340_0_10", "SU_1160_220_0_10", "SU_200_130_0_10",
    "SU_160_175_0_10", "SU_360_220_0_10"
]

for sig in sigSamples:
    myTopLvl = configMgr.addTopLevelXMLClone(bkgOnly, "SimpleChannel_%s" % sig)
    #myTopLvl.removeSystematic(jes)
    sigSample = Sample(sig, kBlue)
    sigSample.setNormFactor("mu_SIG", 0.5, 0., 1.)
    sigXSSyst = Systematic("SigXSec", None, None, None, "user", "overallSys")
    sigSample.addSystematic(sigXSSyst)
    #sigSample.addSystematic(jesSig)
    sigSample.setNormByTheory()
    myTopLvl.addSamples(sigSample)
    myTopLvl.setSignalSample(sigSample)
コード例 #18
0
# Samples 
#-----------------

# W/Z + jets
wjets_sample = Sample('wjets', color("wjets"))
zjets_sample = Sample('zjets', color("zjets"))

wjets_sample.setNormByTheory()
zjets_sample.setNormByTheory()

# ttbar
ttbar_sample  = Sample('ttbar', color("ttbar"))
ttbarg_sample = Sample('ttbarg', color("ttbarg"))

ttbar_sample.setNormByTheory()
ttbarg_sample.setNormFactor("mu_t", 1., 0., 2.)   

# W/Z gamma
wgamma_sample     = Sample('wgamma', color("wgamma"))
zllgamma_sample   = Sample('zllgamma', color("zllgamma"))
znunugamma_sample = Sample('znunugamma', color("znunugamma"))
vqqgamma_sample   = Sample("vqqgamma", color('vqqgamma'))

zllgamma_sample.setNormByTheory()
znunugamma_sample.setNormByTheory()
wgamma_sample.setNormFactor("mu_w", 1., 0., 2.)

# Fake met
photonjet_sample = Sample('photonjet', color("photonjet"))
multijet_sample  = Sample('multijet', color("multijet"))
コード例 #19
0
# Define cuts
configMgr.cutsDict["UserRegion"] = "1."

# Define weights
configMgr.weights = "1."

# Define samples
bkgSample = Sample("Bkg", kGreen - 9)
bkgSample.setStatConfig(True)
bkgSample.buildHisto([nbkg], "UserRegion", "cuts", 0.5)
bkgSample.buildStatErrors([nbkgErr], "UserRegion", "cuts")
bkgSample.addSystematic(corb)
bkgSample.addSystematic(ucb)

sigSample = Sample("Sig", kPink)
sigSample.setNormFactor("mu_Sig", 1., 0., 100.)
sigSample.setStatConfig(True)
sigSample.setNormByTheory()
sigSample.buildHisto([nsig], "UserRegion", "cuts", 0.5)
sigSample.buildStatErrors([nsigErr], "UserRegion", "cuts")
sigSample.addSystematic(cors)
sigSample.addSystematic(ucs)

dataSample = Sample("Data", kBlack)
dataSample.setData()
dataSample.buildHisto([ndata], "UserRegion", "cuts", 0.5)

# Define top-level
ana = configMgr.addFitConfig("SPlusB")
ana.addSamples([bkgSample, sigSample, dataSample])
ana.setSignalSample(sigSample)
コード例 #20
0
gammaToZSyst = Systematic("gammaToZSyst", configMgr.weights, 1.25,0.75, "user","userOverallSys")



#-------------------------------------------
# List of samples and their plotting colours
#-------------------------------------------
dibosonSample = Sample("Diboson",kRed+3)
dibosonSample.setTreeName("Diboson_SRAll")
dibosonSample.setFileList(dibosonFiles)
dibosonSample.setStatConfig(useStat)
dibosonSample.addSystematic(theoSysDiboson)

topSample = Sample("Top",kGreen-9)
topSample.setTreeName("Top_SRAll")
topSample.setNormFactor("mu_Top",1.,0.,50000.)
topSample.setFileList(topFiles)
topSample.setStatConfig(useStat)

qcdSample = Sample("MCMultijet",kOrange+2)
qcdSample.setTreeName("QCD_SRAll")
qcdSample.setNormFactor("mu_MCMultijet",1.,0.,500.)
qcdSample.setFileList(qcdFiles)
qcdSample.setStatConfig(useStat)

wSample = Sample("W",kAzure+1)
wSample.setTreeName("W_SRAll")
wSample.setNormFactor("mu_W",1.,0.,500.)
wSample.setFileList(wFiles)
wSample.setStatConfig(useStat)
コード例 #21
0
def common_setting(mass):
    from configManager import configMgr
    from ROOT import kBlack, kGray, kRed, kPink, kViolet, kBlue, kAzure, kGreen, \
        kOrange
    from configWriter import Sample
    from systematic import Systematic
    import os

    color_dict = {
        "Zbb": kAzure,
        "Zbc": kAzure,
        "Zbl": kAzure,
        "Zcc": kAzure,
        "Zcl": kBlue,
        "Zl": kBlue,
        "Wbb": kGreen,
        "Wbc": kGreen,
        "Wbl": kGreen,
        "Wcc": kGreen,
        "Wcl": kGreen,
        "Wl": kGreen,
        "ttbar": kOrange,
        "stop": kOrange,
        "stopWt": kOrange,
        "ZZPw": kGray,
        "WZPw": kGray,
        "WWPw": kGray,
        "fakes": kPink,
        "Zjets": kAzure,
        "Wjets": kGreen,
        "top": kOrange,
        "diboson": kGray,
        "$Z\\tau\\tau$+HF": kAzure,
        "$Z\\tau\\tau$+LF": kBlue,
        "$W$+jets": kGreen,
        "$Zee$": kViolet,
        "Zhf": kAzure,
        "Zlf": kBlue,
        "Zee": kViolet,
        "others": kViolet,
        signal_prefix + "1000": kRed,
        signal_prefix + "1100": kRed,
        signal_prefix + "1200": kRed,
        signal_prefix + "1400": kRed,
        signal_prefix + "1600": kRed,
        signal_prefix + "1800": kRed,
        signal_prefix + "2000": kRed,
        signal_prefix + "2500": kRed,
        signal_prefix + "3000": kRed,
        # Add your new processes here
        "VH": kGray + 2,
        "VHtautau": kGray + 2,
        "ttH": kGray + 2,
    }

    ##########################

    # Setting the parameters of the hypothesis test
    configMgr.doExclusion = True  # True=exclusion, False=discovery
    configMgr.nTOYs = 10000  # default=5000
    configMgr.calculatorType = 0  # 2=asymptotic calculator, 0=frequentist calculator
    configMgr.testStatType = 3  # 3=one-sided profile likelihood test statistic (LHC default)
    configMgr.nPoints = 30  # number of values scanned of signal-strength for upper-limit determination of signal strength.
    configMgr.writeXML = False
    configMgr.seed = 40
    configMgr.toySeedSet = True
    configMgr.toySeed = 400

    # Pruning
    # - any overallSys systematic uncertainty if the difference of between the up variation and the nominal and between
    #   the down variation and the nominal is below a certain (user) given threshold
    # - for histoSys types, the situation is more complex:
    #   - a first check is done if the integral of the up histogram - the integral of the nominal histogram is smaller
    #     than the integral of the nominal histogram and the same for the down histogram
    #   - then a second check is done if the shape of the up, down and nominal histograms is very similar Only when both
    #     conditions are fulfilled the systematics will be removed.
    # default is False, so the pruning is normally not enabled
    configMgr.prun = True
    # The threshold to decide if an uncertainty is small or not is set by configMgr.prunThreshold = 0.005
    # where the number gives the fraction of deviation with respect to the nominal histogram below which an uncertainty
    # is considered to be small. The default is currently set to 0.01, corresponding to 1 % (This might be very aggressive
    # for the one or the other analyses!)
    configMgr.prunThreshold = 0.005
    # method 1: a chi2 test (this is still a bit experimental, so watch out if this is working or not)
    # method 2: checking for every bin of the histograms that the difference between up variation and nominal and down (default)
    configMgr.prunMethod = 2
    # variation and nominal is below a certain threshold.
    # Smoothing: HistFitter does not provide any smoothing tools.
    # More Details: https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/HistFitterAdvancedTutorial#Pruning_in_HistFitter

    ##########################

    # Keep SRs also in background fit confuguration
    configMgr.keepSignalRegionType = True
    configMgr.blindSR = BLIND

    # Give the analysis a name
    configMgr.analysisName = "bbtautau" + "X" + mass
    configMgr.histCacheFile = "data/" + configMgr.analysisName + ".root"
    configMgr.outputFileName = "results/" + configMgr.analysisName + "_Output.root"

    # Define cuts
    configMgr.cutsDict["SR"] = "1."

    # Define weights
    configMgr.weights = "1."

    # Define samples
    list_samples = []

    yields_mass = yields[mass]
    for process, yields_process in yields_mass.items():
        if process == 'data' or signal_prefix in process: continue
        # print("-> {} / Colour: {}".format(process, color_dict[process]))
        bkg = Sample(str(process), color_dict[process])
        bkg.setStatConfig(stat_config)
        # OLD: add lumi uncertainty (bkg/sig correlated, not for data-driven fakes)
        # NOW: add lumi by hand
        bkg.setNormByTheory(False)
        noms = yields_process["nEvents"]
        errors = yields_process["nEventsErr"] if use_mcstat else [0.0]
        # print("  nEvents (StatError): {} ({})".format(noms, errors))
        bkg.buildHisto(noms, "SR", my_disc, 0.5)
        bkg.buildStatErrors(errors, "SR", my_disc)
        if not stat_only and not no_syst:
            if process == 'fakes':
                key_here = "ATLAS_FF_1BTAG_SIDEBAND_Syst_hadhad"
                if not impact_check_continue(dict_syst_check, key_here):
                    bkg.addSystematic(
                        Systematic(key_here, configMgr.weights, 1.50, 0.50,
                                   "user", syst_type))
            else:
                key_here = "ATLAS_Lumi_Run2_hadhad"
                if not impact_check_continue(dict_syst_check, key_here):
                    bkg.addSystematic(
                        Systematic(key_here, configMgr.weights, 1.017, 0.983,
                                   "user", syst_type))
            for key, values in yields_process.items():
                if 'ATLAS' not in key: continue
                if impact_check_continue(dict_syst_check, key): continue
                # this should not be applied on the Sherpa
                if process == 'Zhf' and key == 'ATLAS_DiTauSF_ZMODEL_hadhad':
                    continue
                if process == 'Zlf' and key == 'ATLAS_DiTauSF_ZMODEL_hadhad':
                    continue
                ups = values[0]
                downs = values[1]
                systUpRatio = [
                    u / n if n != 0. else float(1.) for u, n in zip(ups, noms)
                ]
                systDoRatio = [
                    d / n if n != 0. else float(1.)
                    for d, n in zip(downs, noms)
                ]
                bkg.addSystematic(
                    Systematic(str(key), configMgr.weights, systUpRatio,
                               systDoRatio, "user", syst_type))
        list_samples.append(bkg)

    # FIXME: This is unusual!
    top = Sample('top', kOrange)
    top.setStatConfig(False)  # No stat error
    top.setNormByTheory(False)  # consider lumi for it
    top.buildHisto([0.00001], "SR", my_disc, 0.5)  # small enough
    # HistFitter can accept such large up ratio
    # Systematic(name, weight, ratio_up, ratio_down, syst_type, syst_fistfactory_type)
    if not stat_only and not no_syst:
        key_here = 'ATLAS_TTBAR_YIELD_UPPER_hadhad'
        if not impact_check_continue(dict_syst_check, key_here):
            top.addSystematic(
                Systematic(key_here, configMgr.weights, unc_ttbar[mass], 0.9,
                           "user", syst_type))
    list_samples.append(top)

    sigSample = Sample("Sig", kRed)
    sigSample.setNormFactor("mu_Sig", 1., 0., 100.)
    #sigSample.setStatConfig(stat_config)
    sigSample.setStatConfig(False)
    sigSample.setNormByTheory(False)
    noms = yields_mass[signal_prefix + mass]["nEvents"]
    errors = yields_mass[signal_prefix +
                         mass]["nEventsErr"] if use_mcstat else [0.0]
    sigSample.buildHisto([n * MY_SIGNAL_NORM * 1e-3 for n in noms], "SR",
                         my_disc, 0.5)
    #sigSample.buildStatErrors(errors, "SR", my_disc)
    for key, values in yields_mass[signal_prefix + mass].items():
        if 'ATLAS' not in key: continue
        if impact_check_continue(dict_syst_check, key):
            continue
        ups = values[0]
        downs = values[1]
        systUpRatio = [
            u / n if n != 0. else float(1.) for u, n in zip(ups, noms)
        ]
        systDoRatio = [
            d / n if n != 0. else float(1.) for d, n in zip(downs, noms)
        ]
        if not stat_only and not no_syst:
            sigSample.addSystematic(
                Systematic(str(key), configMgr.weights, systUpRatio,
                           systDoRatio, "user", syst_type))
    if not stat_only and not no_syst:
        key_here = "ATLAS_SigAccUnc_hadhad"
        if not impact_check_continue(dict_syst_check, key_here):
            sigSample.addSystematic(
                Systematic(key_here, configMgr.weights,
                           [1 + unc_sig_acc[mass] for i in range(my_nbins)],
                           [1 - unc_sig_acc[mass]
                            for i in range(my_nbins)], "user", syst_type))
        key_here = "ATLAS_Lumi_Run2_hadhad"
        if not impact_check_continue(dict_syst_check, key_here):
            sigSample.addSystematic(
                Systematic(key_here, configMgr.weights, 1.017, 0.983, "user",
                           syst_type))

    list_samples.append(sigSample)

    # Set observed and expected number of events in counting experiment
    n_SPlusB = yields_mass[signal_prefix +
                           mass]["nEvents"][0] + sum_of_bkg(yields_mass)[0]
    n_BOnly = sum_of_bkg(yields_mass)[0]
    if BLIND:
        # configMgr.useAsimovSet = True # Use the Asimov dataset
        # configMgr.generateAsimovDataForObserved = True # Generate Asimov data as obsData for UL
        # configMgr.useSignalInBlindedData = False
        ndata = sum_of_bkg(yields_mass)
    else:
        try:
            ndata = yields_mass["data"]["nEvents"]
        except:
            ndata = [0. for _ in range(my_nbins)]

    lumiError = 0.017  # Relative luminosity uncertainty

    dataSample = Sample("Data", kBlack)
    dataSample.setData()
    dataSample.buildHisto(ndata, "SR", my_disc, 0.5)
    list_samples.append(dataSample)

    # Define top-level
    ana = configMgr.addFitConfig("SPlusB")
    ana.addSamples(list_samples)
    ana.setSignalSample(sigSample)

    # Define measurement
    meas = ana.addMeasurement(name="NormalMeasurement",
                              lumi=1.0,
                              lumiErr=lumiError / 100000.)
    # make it very small so that pruned
    # we use the one added by hand
    meas.addPOI("mu_Sig")
    #meas.statErrorType = "Poisson"
    # Fix the luminosity in HistFactory to constant
    meas.addParamSetting("Lumi", True, 1)

    # Add the channel
    chan = ana.addChannel(my_disc, ["SR"], my_nbins, my_xmin, my_xmax)
    chan.blind = BLIND
    #chan.statErrorType = "Poisson"
    ana.addSignalChannels([chan])

    # These lines are needed for the user analysis to run
    # Make sure file is re-made when executing HistFactory
    if configMgr.executeHistFactory:
        if os.path.isfile("data/%s.root" % configMgr.analysisName):
            os.remove("data/%s.root" % configMgr.analysisName)
コード例 #22
0
# Define cuts
configMgr.cutsDict["UserRegion"] = "1."

# Define weights
configMgr.weights = "1."

# Define samples
bkgSample = Sample("Bkg",kGreen-9)
bkgSample.setStatConfig(True)
bkgSample.buildHisto([nbkg],"UserRegion","cuts",0.5)
bkgSample.buildStatErrors([nbkgErr],"UserRegion","cuts")
bkgSample.addSystematic(corb)
bkgSample.addSystematic(ucb)

sigSample = Sample("Sig",kPink)
sigSample.setNormFactor("mu_Sig",1.,0.,100.)
sigSample.setStatConfig(True)
sigSample.setNormByTheory()
sigSample.buildHisto([nsig],"UserRegion","cuts",0.5)
sigSample.buildStatErrors([nsigErr],"UserRegion","cuts")
sigSample.addSystematic(cors)
sigSample.addSystematic(ucs)

dataSample = Sample("Data",kBlack)
dataSample.setData()
dataSample.buildHisto([ndata],"UserRegion","cuts",0.5)

# Define top-level
ana = configMgr.addFitConfig("SPlusB")
ana.addSamples([bkgSample,sigSample,dataSample])
ana.setSignalSample(sigSample)
コード例 #23
0
# Samples
#-----------------

# W/Z + jets
wjets_sample = Sample('wjets', color("wjets"))
zjets_sample = Sample('zjets', color("zjets"))

wjets_sample.setNormByTheory()
zjets_sample.setNormByTheory()

# ttbar
ttbar_sample = Sample('ttbar', color("ttbar"))
ttbarg_sample = Sample('ttgamma', color("ttbarg"))

ttbar_sample.setNormByTheory()
ttbarg_sample.setNormFactor("mu_t", 1., 0., 2.)

# W/Z gamma
wgamma_sample = Sample('wgamma', color("wgamma"))
zllgamma_sample = Sample('zllgamma', color("zllgamma"))
znunugamma_sample = Sample('znunugamma', color("znunugamma"))
vqqgamma_sample = Sample("vqqgamma", color('vqqgamma'))

zllgamma_sample.setNormByTheory()
znunugamma_sample.setNormByTheory()
wgamma_sample.setNormFactor("mu_w", 1., 0., 2.)

# Fake met
photonjet_sample = Sample('photonjet', color("photonjet"))
multijet_sample = Sample('multijet', color("multijet"))
コード例 #24
0
ファイル: SuperConfig.py プロジェクト: dantrim/SuperFitter
    # Determine the normalization region :
    #    --> If zero jet : pick "a" CR
    #    --> If one jet  : pick "b" CR
    if userOpts.doSimFit2LZV :
        if('Super0a' in SR or 'Super0b' in SR or 'Super0c' in SR) :
            zvSample.setNormRegions([("emCRZV14a", "cuts")])
            userPrint(" >>> Normalization region for ZV : emCRZV14a")
        elif('Super1a' in SR or 'Super1b' in SR or 'Super1c' in SR) :
            zvSample.setNormRegions([("emCRZV14b", "cuts")])
            userPrint(" >>> Normalization region for ZV : emCRZV14b")
    # add systematics
    zvSample = addSys(zvSample, userOpts.doSimFit2LZV, sysObj)
    # set normalization factor
    if userOpts.doSimFit2LZV :
        if('Super0a' in SR or 'Super0b' in SR or 'Super0c' in SR) :
            zvSample.setNormFactor("mu_ZV14a", 1.,0.,10.)
            userPrint(" >>> Normalization factor for ZV : mu_ZV14a")
        elif('Super1a' in SR or 'Super1b' in SR or 'Super1c' in SR) :
            zvSample.setNormFactor("mu_ZV14b", 1., 0., 10.)
            userPrint(" >>> Normalization factor for ZV : mu_ZV14b")
    else :
        zvSample.setNormByTheory()

    # ----------------------------------------------------- #
    #                         TOP                           # 
    # ----------------------------------------------------- #

    topSample.setStatConfig(useStat)
    if userOpts.splitMCSys :
        topSample.addSystematic(sysObj.AR_mcstat_TOP)
コード例 #25
0
## Discovery fit
#discovery = configMgr.adFitConfigClone(bkgOnly,"SimpleChannel_Discovery")
#discovery.clearSystematics()
#sigSample = Sample("discoveryMode",kBlue)
#sigSample.setNormFactor("mu_SIG",1.0, 0.0, 5.0)
#sigSample.setNormByTheory()
#discovery.addSamples(sigSample)
#discovery.setSignalSample(sigSample)

## Exclusion fits (MSUGRA grid)
#sigSamples=["SU_180_360_0_10","SU_580_240_0_10","SU_740_330_0_10","SU_900_420_0_10","SU_1300_210_0_10"]
sigSamples = ["SU_680_310_0_10","SU_440_145_0_10","SU_200_160_0_10","SU_440_340_0_10","SU_440_100_0_10","SU_120_130_0_10","SU_600_280_0_10","SU_320_115_0_10","SU_360_175_0_10","SU_920_310_0_10","SU_280_205_0_10","SU_1080_340_0_10","SU_40_280_0_10","SU_760_160_0_10","SU_200_115_0_10","SU_280_280_0_10","SU_40_160_0_10","SU_520_280_0_10","SU_120_220_0_10","SU_680_220_0_10","SU_40_115_0_10","SU_920_190_0_10","SU_320_130_0_10","SU_440_280_0_10","SU_360_100_0_10","SU_120_160_0_10","SU_1080_190_0_10","SU_840_250_0_10","SU_120_100_0_10","SU_120_340_0_10","SU_840_280_0_10","SU_80_115_0_10","SU_840_130_0_10","SU_320_175_0_10","SU_120_205_0_10","SU_520_100_0_10","SU_400_130_0_10","SU_360_310_0_10","SU_160_115_0_10","SU_1000_310_0_10","SU_40_220_0_10","SU_440_130_0_10","SU_1000_190_0_10","SU_80_220_0_10","SU_840_160_0_10","SU_120_145_0_10","SU_440_175_0_10","SU_360_280_0_10","SU_320_145_0_10","SU_400_160_0_10","SU_1000_340_0_10","SU_600_310_0_10","SU_320_190_0_10","SU_840_310_0_10","SU_200_220_0_10","SU_440_205_0_10","SU_360_205_0_10","SU_120_280_0_10","SU_1080_130_0_10","SU_160_145_0_10","SU_520_250_0_10","SU_840_100_0_10","SU_160_220_0_10","SU_120_190_0_10","SU_40_205_0_10","SU_280_250_0_10","SU_80_145_0_10","SU_200_175_0_10","SU_840_190_0_10","SU_240_145_0_10","SU_160_205_0_10","SU_400_115_0_10","SU_440_250_0_10","SU_600_340_0_10","SU_80_100_0_10","SU_520_190_0_10","SU_1160_190_0_10","SU_80_130_0_10","SU_400_190_0_10","SU_400_175_0_10","SU_600_130_0_10","SU_1080_100_0_10","SU_200_340_0_10","SU_1160_310_0_10","SU_440_160_0_10","SU_240_220_0_10","SU_200_100_0_10","SU_240_130_0_10","SU_360_130_0_10","SU_1000_250_0_10","SU_920_130_0_10","SU_240_190_0_10","SU_520_340_0_10","SU_40_175_0_10","SU_240_100_0_10","SU_400_145_0_10","SU_40_145_0_10","SU_240_205_0_10","SU_1080_280_0_10","SU_600_250_0_10","SU_360_145_0_10","SU_520_130_0_10","SU_1000_130_0_10","SU_440_310_0_10","SU_600_160_0_10","SU_920_280_0_10","SU_760_280_0_10","SU_280_190_0_10","SU_280_175_0_10","SU_120_310_0_10","SU_440_220_0_10","SU_1000_220_0_10","SU_1160_250_0_10","SU_400_205_0_10","SU_160_160_0_10","SU_1000_280_0_10","SU_1000_160_0_10","SU_400_100_0_10","SU_760_190_0_10","SU_680_160_0_10","SU_840_220_0_10","SU_360_340_0_10","SU_1080_220_0_10","SU_360_250_0_10","SU_760_130_0_10","SU_440_115_0_10","SU_240_160_0_10","SU_200_310_0_10","SU_200_145_0_10","SU_600_220_0_10","SU_280_130_0_10","SU_520_220_0_10","SU_1080_160_0_10","SU_40_190_0_10","SU_1160_160_0_10","SU_280_310_0_10","SU_920_160_0_10","SU_80_190_0_10","SU_40_310_0_10","SU_1160_130_0_10","SU_40_250_0_10","SU_40_100_0_10","SU_400_220_0_10","SU_40_340_0_10","SU_1000_100_0_10","SU_120_175_0_10","SU_280_220_0_10","SU_760_340_0_10","SU_240_115_0_10","SU_440_190_0_10","SU_1160_340_0_10","SU_600_100_0_10","SU_200_250_0_10","SU_280_145_0_10","SU_200_190_0_10","SU_200_205_0_10","SU_760_250_0_10","SU_120_250_0_10","SU_80_175_0_10","SU_40_130_0_10","SU_920_250_0_10","SU_80_160_0_10","SU_240_175_0_10","SU_280_100_0_10","SU_1080_310_0_10","SU_920_340_0_10","SU_120_115_0_10","SU_1160_100_0_10","SU_280_340_0_10","SU_1160_220_0_10","SU_200_130_0_10","SU_160_175_0_10","SU_360_220_0_10"]

#if not 'sigSamples' in dir():
#    sigSamples=["SU_680_310_0_10"]


for sig in sigSamples:
    myTopLvl = configMgr.addFitConfigClone(bkgOnly,"SimpleChannel_%s"%sig)
    #myTopLvl.removeSystematic(jes)
    sigSample = Sample(sig,kBlue)
    sigSample.setNormFactor("mu_SIG", 1.0, 0., 5.0)
    sigXSSyst = Systematic("SigXSec",configMgr.weights,1.1,0.9,"user","overallSys")
    sigSample.addSystematic(sigXSSyst)
    #sigSample.addSystematic(jesSig)
    sigSample.setNormByTheory()
    myTopLvl.addSamples(sigSample)
    myTopLvl.setSignalSample(sigSample)
    ch = myTopLvl.getChannel("cuts",cutsRegions)
    myTopLvl.addSignalChannels(ch)
コード例 #26
0
#photon systematics in SR for Z
gammaToZSyst = Systematic("gammaToZSyst", configMgr.weights, 1.25, 0.75,
                          "user", "userOverallSys")

#-------------------------------------------
# List of samples and their plotting colours
#-------------------------------------------
dibosonSample = Sample("Diboson", kRed + 3)
dibosonSample.setTreeName("Diboson_SRAll")
dibosonSample.setFileList(dibosonFiles)
dibosonSample.setStatConfig(useStat)
dibosonSample.addSystematic(theoSysDiboson)

topSample = Sample("Top", kGreen - 9)
topSample.setTreeName("Top_SRAll")
topSample.setNormFactor("mu_Top", 1., 0., 500.)
topSample.setFileList(topFiles)
topSample.setStatConfig(useStat)

qcdSample = Sample("MCMultijet", kOrange + 2)
qcdSample.setTreeName("QCD_SRAll")
qcdSample.setNormFactor("mu_MCMultijet", 1., 0., 500.)
qcdSample.setFileList(qcdFiles)
qcdSample.setStatConfig(useStat)

wSample = Sample("W", kAzure + 1)
wSample.setTreeName("W_SRAll")
wSample.setNormFactor("mu_W", 1., 0., 500.)
wSample.setFileList(wFiles)
wSample.setStatConfig(useStat)
コード例 #27
0
bkgOnly.addSystematic(jes)
meas = bkgOnly.addMeasurement(measName,measLumi,measLumiError)
meas.addPOI("mu_SIG")
cutsChannel = bkgOnly.addChannel("cuts",cutsRegions,cutsNBins,cutsBinLow,cutsBinHigh)

## Discovery fit
#discovery = configMgr.addTopLevelXMLClone(bkgOnly,"SimpleChannel_Discovery")
#discovery.clearSystematics()
#sigSample = Sample("discoveryMode",kBlue)
#sigSample.setNormFactor("mu_SIG",0.5,0.,1.)
#sigSample.setNormByTheory()
#discovery.addSamples(sigSample)
#discovery.setSignalSample(sigSample)

## Exclusion fits (MSUGRA grid)
#sigSamples=["SU_180_360_0_10","SU_580_240_0_10","SU_740_330_0_10","SU_900_420_0_10","SU_1300_210_0_10"]
sigSamples = ["SU_680_310_0_10","SU_440_145_0_10","SU_200_160_0_10","SU_440_340_0_10","SU_440_100_0_10","SU_120_130_0_10","SU_600_280_0_10","SU_320_115_0_10","SU_360_175_0_10","SU_920_310_0_10","SU_280_205_0_10","SU_1080_340_0_10","SU_40_280_0_10","SU_760_160_0_10","SU_200_115_0_10","SU_280_280_0_10","SU_40_160_0_10","SU_520_280_0_10","SU_120_220_0_10","SU_680_220_0_10","SU_40_115_0_10","SU_920_190_0_10","SU_320_130_0_10","SU_440_280_0_10","SU_360_100_0_10","SU_120_160_0_10","SU_1080_190_0_10","SU_840_250_0_10","SU_120_100_0_10","SU_120_340_0_10","SU_840_280_0_10","SU_80_115_0_10","SU_840_130_0_10","SU_320_175_0_10","SU_120_205_0_10","SU_520_100_0_10","SU_400_130_0_10","SU_360_310_0_10","SU_160_115_0_10","SU_1000_310_0_10","SU_40_220_0_10","SU_440_130_0_10","SU_1000_190_0_10","SU_80_220_0_10","SU_840_160_0_10","SU_120_145_0_10","SU_440_175_0_10","SU_360_280_0_10","SU_320_145_0_10","SU_400_160_0_10","SU_1000_340_0_10","SU_600_310_0_10","SU_320_190_0_10","SU_840_310_0_10","SU_200_220_0_10","SU_440_205_0_10","SU_360_205_0_10","SU_120_280_0_10","SU_1080_130_0_10","SU_160_145_0_10","SU_520_250_0_10","SU_840_100_0_10","SU_160_220_0_10","SU_120_190_0_10","SU_40_205_0_10","SU_280_250_0_10","SU_80_145_0_10","SU_200_175_0_10","SU_840_190_0_10","SU_240_145_0_10","SU_160_205_0_10","SU_400_115_0_10","SU_440_250_0_10","SU_600_340_0_10","SU_80_100_0_10","SU_520_190_0_10","SU_1160_190_0_10","SU_80_130_0_10","SU_400_190_0_10","SU_400_175_0_10","SU_600_130_0_10","SU_1080_100_0_10","SU_200_340_0_10","SU_1160_310_0_10","SU_440_160_0_10","SU_240_220_0_10","SU_200_100_0_10","SU_240_130_0_10","SU_360_130_0_10","SU_1000_250_0_10","SU_920_130_0_10","SU_240_190_0_10","SU_520_340_0_10","SU_40_175_0_10","SU_240_100_0_10","SU_400_145_0_10","SU_40_145_0_10","SU_240_205_0_10","SU_1080_280_0_10","SU_600_250_0_10","SU_360_145_0_10","SU_520_130_0_10","SU_1000_130_0_10","SU_440_310_0_10","SU_600_160_0_10","SU_920_280_0_10","SU_760_280_0_10","SU_280_190_0_10","SU_280_175_0_10","SU_120_310_0_10","SU_440_220_0_10","SU_1000_220_0_10","SU_1160_250_0_10","SU_400_205_0_10","SU_160_160_0_10","SU_1000_280_0_10","SU_1000_160_0_10","SU_400_100_0_10","SU_760_190_0_10","SU_680_160_0_10","SU_840_220_0_10","SU_360_340_0_10","SU_1080_220_0_10","SU_360_250_0_10","SU_760_130_0_10","SU_440_115_0_10","SU_240_160_0_10","SU_200_310_0_10","SU_200_145_0_10","SU_600_220_0_10","SU_280_130_0_10","SU_520_220_0_10","SU_1080_160_0_10","SU_40_190_0_10","SU_1160_160_0_10","SU_280_310_0_10","SU_920_160_0_10","SU_80_190_0_10","SU_40_310_0_10","SU_1160_130_0_10","SU_40_250_0_10","SU_40_100_0_10","SU_400_220_0_10","SU_40_340_0_10","SU_1000_100_0_10","SU_120_175_0_10","SU_280_220_0_10","SU_760_340_0_10","SU_240_115_0_10","SU_440_190_0_10","SU_1160_340_0_10","SU_600_100_0_10","SU_200_250_0_10","SU_280_145_0_10","SU_200_190_0_10","SU_200_205_0_10","SU_760_250_0_10","SU_120_250_0_10","SU_80_175_0_10","SU_40_130_0_10","SU_920_250_0_10","SU_80_160_0_10","SU_240_175_0_10","SU_280_100_0_10","SU_1080_310_0_10","SU_920_340_0_10","SU_120_115_0_10","SU_1160_100_0_10","SU_280_340_0_10","SU_1160_220_0_10","SU_200_130_0_10","SU_160_175_0_10","SU_360_220_0_10"]


for sig in sigSamples:
    myTopLvl = configMgr.addTopLevelXMLClone(bkgOnly,"SimpleChannel_%s"%sig)
    #myTopLvl.removeSystematic(jes)
    sigSample = Sample(sig,kBlue)
    sigSample.setNormFactor("mu_SIG",0.5,0.,1.)
    sigXSSyst = Systematic("SigXSec",None,None,None,"user","overallSys")
    sigSample.addSystematic(sigXSSyst)
    #sigSample.addSystematic(jesSig)
    sigSample.setNormByTheory()
    myTopLvl.addSamples(sigSample)
    myTopLvl.setSignalSample(sigSample)
コード例 #28
0
configMgr.outputFileName = "results/%s_Output.root" % configMgr.analysisName

# Define cuts
configMgr.cutsDict["SR"] = "1."

# Define weights
configMgr.weights = "1."

# Define samples
bkgSample = Sample("Bkg", ROOT.kGreen - 9)
bkgSample.setStatConfig(True)
bkgSample.buildHisto([nbkg], "SR", "cuts", 0.5)
bkgSample.addSystematic(ucb)

sigSample = Sample("GGM_GG_bhmix_%d_%d" % (args.m3, args.mu), ROOT.kOrange + 3)
sigSample.setNormFactor("mu_SIG", 1., 0., 10.)
#sigSample.setStatConfig(True)
sigSample.setNormByTheory()
sigSample.buildHisto([nsig], "SR", "cuts", 0.5)

dataSample = Sample("Data", ROOT.kBlack)
dataSample.setData()
dataSample.buildHisto([ndata], "SR", "cuts", 0.5)

# Define top-level
ana = configMgr.addFitConfig("Disc")
ana.addSamples([bkgSample, sigSample, dataSample])
ana.setSignalSample(sigSample)

# Define measurement
meas = ana.addMeasurement(name="NormalMeasurement",
コード例 #29
0
    zvSample.setStatConfig(useStat)
    if userOpts.splitMCSys:
        zvSample.addSystematic(sysObj.AR_mcstat_ZV)

    # Determine the normalization region
    # This should be done only if we fit
    # Regardless of channel combined ee+mm
    if userOpts.doSimFit2LZV:
        zvSample.setNormRegions([("emCRZV14a","cuts"),("emCRZV14b","cuts")])

    # Add Systematics
    zvSample = addSys(zvSample, userOpts.doSimFit2LZV, sysObj)

    # Additional ZV Specific systematics
    if userOpts.doSimFit2LZV:
        zvSample.setNormFactor("mu_ZV",1.,0.,10.)
    else:	
        zvSample.setNormByTheory()


    #------------------------------------------------#
    #                     TOP                        #
    #------------------------------------------------#
    topSample.setStatConfig(useStat)
    if userOpts.splitMCSys:
        topSample.addSystematic(sysObj.AR_mcstat_TOP)
    
    # Determine the normalization regions
    # This should be done only if we fit
    if userOpts.doSimFit2LTop :
        topSample.setNormRegions([("emCRTop14a","cuts"), ("emCRTop14b","cuts")])
signal_sample = None

# prepare the fit configuration
ana = configMgr.addFitConfig("shape_fit")
meas = ana.addMeasurement(name="shape_fit", lumi=1.0, lumiErr=0.01)

# load all MC templates ...
for sample_name, template_name, template_color, is_floating, is_signal in zip(
        sample_names, template_names, template_colors, normalization_floating,
        signal_samples):

    cur_sample = Sample(sample_name, template_color)

    if is_floating:
        normalization_name = "mu_" + sample_name
        cur_sample.setNormFactor(normalization_name, 1, 0, 100)

        if is_signal:
            POIs.append(normalization_name)
            signal_sample = cur_sample

    # ... for all regions
    for region_name, region_infile in zip(region_names, region_infiles):
        binvals, edges = HistogramImporter.import_histogram(
            os.path.join(indir, region_infile), template_name)
        bin_width = edges[1] - edges[0]

        cur_sample.buildHisto(binvals,
                              region_name,
                              "mBB",
                              binLow=edges[0],
コード例 #31
0
# - List of systematics
# ---------------------
# generic systematic -- placeholder for now
gen_syst = Systematic( "gen_syst" , configMgr.weights , 1.0 + 0.30 , 1.0 - 0.30 , "user" , "userOverallSys" )

# JES uncertainty as shapeSys - one systematic per region (combine WR and TR), merge samples
# jes = Systematic("JES","_NoSys","_JESup","_JESdown","tree","overallNormHistoSys")

# --------------------------------------------
# - List of samples and their plotting colours
# --------------------------------------------
sample_list = []

# ttbar
ttbar_sample = Sample( "ttbar" , kGreen-2 )
ttbar_sample.setNormFactor("mu_ttbar",1.,0.,5.)
ttbar_sample.setStatConfig(use_stat)
ttbar_sample.setNormByTheory()
sample_list.append(ttbar_sample)

# single top
single_top_sample = Sample( "SingleTop" , kGreen-1 )
single_top_sample.setNormFactor("mu_st",1.,0.,5.)
single_top_sample.setStatConfig(use_stat)
single_top_sample.setNormByTheory()
sample_list.append(single_top_sample)

# Z/gamma*
z_sample = Sample( "Z" , kRed+1 )
z_sample.setNormFactor("mu_z",1.,0.,5.)
z_sample.setStatConfig(use_stat)
コード例 #32
0
# **************

# Fit config instance
exclusionFitConfig = configMgr.addTopLevelXML("Exclusion")
meas = exclusionFitConfig.addMeasurement(name="NormalMeasurement", lumi=1.0, lumiErr=0.039)
meas.addPOI("mu_SIG")

# Samples
exclusionFitConfig.addSamples([topSample, wzSample, dataSample])

# Systematics
exclusionFitConfig.getSample("Top").addSystematic(topKtScale)
exclusionFitConfig.getSample("WZ").addSystematic(wzKtScale)
exclusionFitConfig.addSystematic(jes)

# Channel
srBin = exclusionFitConfig.addChannel("met/meff2Jet", ["SR"], 6, 0.1, 0.7)
srBin.useOverflowBin = True
srBin.useUnderflowBin = True
exclusionFitConfig.setSignalChannels([srBin])

sigSample = Sample("SM_GG_onestepCC_425_385_345", kPink)
sigSample.setFileList(["samples/tutorial/SusyFitterTree_p832_GG-One-Step_soft_v1.root"])
sigSample.setNormByTheory()
sigSample.setNormFactor("mu_SIG", 1.0, 0.0, 5.0)
exclusionFitConfig.addSamples(sigSample)
exclusionFitConfig.setSignalSample(sigSample)

# 2nd cloned-copy just to accomodate -l option...
exclusionFitClone = configMgr.addTopLevelXMLClone(exclusionFitConfig, "ExclusionFitClone")
コード例 #33
0
       exclusionFitConfig = configMgr.addFitConfig("Exclusion_"+sig)
       meas=exclusionFitConfig.addMeasurement(name="NormalMeasurement",lumi=1.0,lumiErr=0.039)
       meas.addPOI("mu_SIG")

       # Samples
       exclusionFitConfig.addSamples([topSample,wzSample,dataSample])

       # Systematics
       exclusionFitConfig.getSample("Top").addSystematic(topKtScale)
       exclusionFitConfig.getSample("WZ").addSystematic(wzKtScale)
       exclusionFitConfig.addSystematic(jes)

       # Channel
       srBin = exclusionFitConfig.addChannel("met/meff2Jet",["SR"],6,0.1,0.7)
       srBin.useOverflowBin=True
       srBin.useUnderflowBin=True
       exclusionFitConfig.setSignalChannels([srBin])

       sigSample = Sample(sig,kPink)
       sigSample.setFileList(["samples/tutorial/SusyFitterTree_p832_GG-One-Step_soft_v1.root"])
       sigSample.setNormByTheory()
       sigSample.setNormFactor("mu_SIG",1.,0.,5.)    
       #sigSample.addSampleSpecificWeight("0.001")                
       exclusionFitConfig.addSamples(sigSample)
       exclusionFitConfig.setSignalSample(sigSample)

       # Cosmetics
       srBin.minY = 0.0001
       srBin.maxY = 80.

コード例 #34
0
other_sample.setNormByTheory()
sample_list_bkg.append(other_sample)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# single top
single_top_sample = Sample("SingleTop", kGreen-1)

single_top_sample.setStatConfig(use_stat)
single_top_sample.setNormByTheory()
sample_list_bkg.append(single_top_sample)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Z/gamma*
z_sample = Sample("ZGamma", kRed+1 )

z_sample.setNormFactor("mu_z", 1, 0, 100)
z_sample.setStatConfig(use_stat)
sample_list_bkg.append(z_sample)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# ttbar
ttbar_sample = Sample("ttbar", kGreen+2)

ttbar_sample.setNormFactor("mu_ttbar", 1, 0, 100)
ttbar_sample.setStatConfig(use_stat)
sample_list_bkg.append(ttbar_sample)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# data
data_sample = Sample("data",kBlack)
data_sample.setData()
コード例 #35
0
        configMgr.cutsDict[region] = "1."
        if "CR" in region and "BKG" in region and perform_simfit :
            sample_for_cr = region.split("_")[1].lower()
            if sample.name.lower() == sample_for_cr :
                set_norm_by_theory = False
                sample.setNormFactor("mu_%s" % sample.name.lower(), 1.0, 0.0, 10.0)
                sample.setNormRegions([ (region, "cuts") ])
    if set_norm_by_theory :
        sample.setNormByTheory()


# signal
if myFitType == FitType.Exclusion :

    sample_sig.setStatConfig(False)

    sample_sig.setNormFactor("mu_SIG", 1.0, 0.0, 10.0)
    sample_sig.setNormRegions( [ ("SR_BKG0", "cuts") ] )#, ("CR_BKG1", "cuts") ] )
    sample_sig.setNormByTheory()
    #tlx.addSamples(sample_sig)
    tlx.setSignalSample(sample_sig)

    tlx.addSignalChannels(sr_channels)
# add the samples
tlx.addSamples(all_samples)

#if myFitType == FitType.Background :
#    tlx.addSignalChannels(cr_channels)
#    #tlx.addSignalChannels(sr_channels)
#    #tlx.addValidationChannels(sr_channels)