def analyze(self, event):
     if len(event.selElectrons) < 2 or len(event.selMuons) < 2: return False
     if len(event.selPhotons) < 2: return False
     event.Zcands = []
     for i, iEl in enumerate(event.selElectrons):
         for j, jEl in enumerate(event.selElectrons):
             if i >= j: continue
             if iEl.charge == jEl.charge: continue
             tmpCand = BaseObject(
                 "Zee_" + str(i) + "_" + str(j),
                 index1=i,
                 index2=j,
                 lep1P4=iEl.p4(),
                 lep2P4=jEl.p4(),
             )
             tmpCand.m = (tmpCand.lep1P4 + tmpCand.lep2P4).M()
             tmpCand.dm = abs(tmpCand.m - Z_mass)
             event.Zcands.append(tmpCand)
     for i, iMu in enumerate(event.selMuons):
         for j, jMu in enumerate(event.selMuons):
             if i >= j: continue
             if iMu.charge == jMu.charge: continue
             tmpCand = BaseObject(
                 "Zmm_" + str(i) + "_" + str(j),
                 index1=i,
                 index2=j,
                 lep1P4=iMu.p4(),
                 lep2P4=jMu.p4(),
             )
             tmpCand.m = (tmpCand.lep1P4 + tmpCand.lep2P4).M()
             tmpCand.dm = abs(tmpCand.m - Z_mass)
             event.Zcands.append(tmpCand)
     if not event.Zcands: return False
     dmList = [x.dm for x in event.Zcands]
     minIndex = dmList.index(min(dmList))
     event.Zcand = event.Zcands[minIndex]
     return True
Exemple #2
0
from Core.mkdir_p import mkdir_p
# ________________________________________________________________________________________ ||
ROOT.gROOT.SetBatch(ROOT.kTRUE)

# ________________________________________________________________________________________ ||
inputDir = "/raid/raid7//lucien/Higgs/DarkZ/LeptonScale/2019-11-20_Run2016/"
bkgSamples = [
    "Higgs",
    "qqZZ",
    "ggZZ",
]
plots = [
    BaseObject(
        lepCat + "_Higgs" + m4l + "_LepScaleUp",
        varHistName=lepCat + "_Higgs" + m4l + "_LepScale-Up",
        nomHistName=lepCat + "_Higgs" + m4l + "",
        rebin=5000,
        samples=bkgSamples,
        fileName="StatInput.root",
    ) for lepCat in [
        "MuMu",
        "ElMu",
        "ElEl",
        "MuEl",
    ] for m4l in [
        "SR",
        "HighSB",
        "LowSB",
    ]
] + [
    BaseObject(
        lepCat + "_Higgs" + m4l + "_LepResUp",
Exemple #3
0
#inputShapeFile = ROOT.TFile(os.path.join(outputDir,"ZPlusX","shape.root"),"READ")
inputShapeFile = ROOT.TFile(os.path.join(outputDir,"ZPlusX","PlotShape.root"),"READ")

for p in plots:
    p.plotSetting.tdr_style = True
    p.plotSetting.divideByBinWidth = False
    p.plotSetting.cms_lumi = CMS_lumi
    p.plotSetting.skip_leg_err = True
    p.plotSetting.skip_data_mc_ratio = False
    p.plotSetting.shift_last_bin = False
    p.plotSetting.stack_x_label_size = 0
    p.plotSetting.bin_width_label = "Event / bin"
    p.plotSetting.x_axis_title = "m_{Z2} [GeV]"
    p.plotSetting.leg_pos = [0.20,0.65,0.80,0.90]
    p.customHistDict["ZPlusX"] = BaseObject(p.key,hist=copy.deepcopy(inputShapeFile.Get(p.key+"_shapehist")))
    p.plotSetting.leg_name_dict = {
            "HZZd_M30": "H #rightarrow Z Z_{D} m_{Z_{D}} = 30 GeV #varepsilon = 0.05",
            "HZZd_M15": "H #rightarrow Z Z_{D} m_{Z_{D}} = 15 GeV #varepsilon = 0.05",
            "ZPlusX": "Z+X",
            }

plot_el.plotSetting.linear_max_factor = 2.5
plot_el.plotSetting.custom_latex_list = [
       BaseObject(plot_el.key,x_pos=4.,y_pos=13.,text_size=0.035,text="2e channel",),
       ]
plot_mu.plotSetting.linear_max_factor = 2.0
plot_mu.plotSetting.custom_latex_list = [
       BaseObject(plot_mu.key,x_pos=4.,y_pos=16.5,text_size=0.035,text="2#mu channel",),
       ]
Exemple #4
0
        "H #rightarrow Z_{D} Z_{D} m_{Z_{D}} = 5 GeV #kappa = 10^{-4}",
        "HToZdZd_M50":
        "H #rightarrow Z_{D} Z_{D} m_{Z_{D}} = 50 GeV #kappa = 10^{-4}",
        "ZPlusX": "Z+X",
        "ttZ": "t#bar{t}Z"
    }
    if p.plotSetting.divideByBinWidth:
        p.plotSetting.bin_width_label = "Bin Width"
    if p.key in [
            "mZ12_4mu",
            "mZ12_4e",
            "mZ12_2e2mu",
            "mZ12_2mu2e",
    ]:
        p.customHistDict["ZPlusX"] = BaseObject(
            p.key,
            hist=copy.deepcopy(inputShapeFile.Get(p.key + "_shapehist")))

plot_4e.plotSetting.custom_latex_list = [
    BaseObject(
        plot_4e.key,
        x_pos=10.,
        y_pos=3.0,
        text_size=0.035,
        text="4e channel",
    ),
]
plot_4mu.plotSetting.custom_latex_list = [
    BaseObject(
        plot_4mu.key,
        x_pos=10.,
Exemple #5
0
 #BaseObject("mZ2_low-m4l_4e",rebin=5,histName="mZ2_low-m4l_4e"),
 #BaseObject("mZ2_mid-m4l_4e",rebin=5,histName="mZ2_mid-m4l_4e"),
 #BaseObject("mZ2_high-m4l_4e",rebin=5,histName="mZ2_high-m4l_4e"),
 #BaseObject("mZ2_2mu2e",rebin=5,histName="mZ2_2mu2e"),
 #BaseObject("mZ2_low-m4l_2mu2e",rebin=5,histName="mZ2_low-m4l_2mu2e"),
 #BaseObject("mZ2_mid-m4l_2mu2e",rebin=5,histName="mZ2_mid-m4l_2mu2e"),
 #BaseObject("mZ2_high-m4l_2mu2e",rebin=5,histName="mZ2_high-m4l_2mu2e"),
 #BaseObject("mZ2_4mu",rebin=10,histName="mZ2_4mu"),
 #BaseObject("mZ2_low-m4l_4mu",rebin=5,histName="mZ2_low-m4l_4mu"),
 #BaseObject("mZ2_mid-m4l_4mu",rebin=5,histName="mZ2_mid-m4l_4mu"),
 #BaseObject("mZ2_high-m4l_4mu",rebin=10,histName="mZ2_high-m4l_4mu"),
 #BaseObject("mZ2_2e2mu",rebin=10,histName="mZ2_2e2mu"),
 #BaseObject("mZ2_low-m4l_2e2mu",rebin=5,histName="mZ2_low-m4l_2e2mu"),
 #BaseObject("mZ2_mid-m4l_2e2mu",rebin=5,histName="mZ2_mid-m4l_2e2mu"),
 #BaseObject("mZ2_high-m4l_2e2mu",rebin=10,histName="mZ2_high-m4l_2e2mu"),
 BaseObject("mZ2_4e", rebin=5, histName="mZ2_4e"),
 BaseObject("mZ2_low-m4l_4e", rebin=5, histName="mZ2_4e"),
 BaseObject("mZ2_mid-m4l_4e", rebin=5, histName="mZ2_4e"),
 BaseObject("mZ2_high-m4l_4e", rebin=5, histName="mZ2_4e"),
 BaseObject("mZ2_2mu2e", rebin=5, histName="mZ2_2mu2e"),
 BaseObject("mZ2_low-m4l_2mu2e", rebin=5, histName="mZ2_2mu2e"),
 BaseObject("mZ2_mid-m4l_2mu2e", rebin=5, histName="mZ2_2mu2e"),
 BaseObject("mZ2_high-m4l_2mu2e", rebin=5, histName="mZ2_2mu2e"),
 BaseObject("mZ2_4mu", rebin=10, histName="mZ2_4mu"),
 BaseObject("mZ2_low-m4l_4mu", rebin=10, histName="mZ2_4mu"),
 BaseObject("mZ2_mid-m4l_4mu", rebin=10, histName="mZ2_4mu"),
 BaseObject("mZ2_high-m4l_4mu", rebin=10, histName="mZ2_4mu"),
 BaseObject("mZ2_2e2mu", rebin=10, histName="mZ2_2e2mu"),
 BaseObject("mZ2_low-m4l_2e2mu", rebin=10, histName="mZ2_2e2mu"),
 BaseObject("mZ2_mid-m4l_2e2mu", rebin=10, histName="mZ2_2e2mu"),
 BaseObject("mZ2_high-m4l_2e2mu", rebin=10, histName="mZ2_2e2mu"),
Exemple #6
0
    inputFile = ROOT.TFile(inputPath, "READ")
    rootObjs = [inputFile.Get(k.GetName()) for k in inputFile.GetListOfKeys()]
    categoryDict = {}
    for obj in rootObjs:
        items = obj.GetName().split("__")
        catStr = "_".join(items[0].split("_")[2:])
        sample = items[1]
        if len(items) == 2:
            vary = "central"
            syst = "nominal"
        elif len(items) == 4:
            syst = items[2]
            vary = items[3]
        if catStr not in categoryDict:
            categoryDict[catStr] = BaseObject(
                catStr,
                sampleDict=dict(),
            )
        if sample not in categoryDict[catStr].sampleDict:
            categoryDict[catStr].sampleDict[sample] = BaseObject(
                nameMap[sample],
                systList=list(),
            )
        if syst == "nominal":
            categoryDict[catStr].sampleDict[sample].hist = obj
        else:
            if syst not in categoryDict[catStr].sampleDict[sample].systList:
                categoryDict[catStr].sampleDict[sample].systList.append(
                    BaseObject(syst, hist=obj, vary=varyMap[vary]))

    config = CardConfig(signal_name)
    shapeStr = "shapes * * {fileName} $CHANNEL/$PROCESS $CHANNEL/$PROCESS_$SYSTEMATIC\n"
Exemple #7
0
input_channel_dict = {
    "4mu": LambdaFunc('event: ' + mu_ch_sel_str),
}

sequence = signal_sequence
yieldProducer = ParaYieldProducer(
    "ParaYieldProducer",
    channelDict=input_channel_dict,
)
if mvaSkim:
    mvaSkimmer = MVASkimmer(
        "MVSkimmer",
        BaseObject(
            "MVASetting",
            modelPath=
            "/raid/raid7/lucien/AnalysisCode/ML/Zprime-ML/result/2019-06-04_Run2017_qqZZ-zpToMuMu-M40_m4l-cosTheta1-cosTheta2-cosThetaStar-phi-phi1/mlp-classifier.pkl",
            threshold=0.45,
            varFunc=LambdaFunc(
                "x: [(x.mass4l[0]-80.)/20.,x.cosTheta1, x.cosTheta2, x.cosThetaStar, x.phi, x.phi1,]"
            ),
        ),
    )
    sequence.add(mvaSkimmer)
sequence.add(yieldProducer)

outputInfo = OutputInfo("OutputInfo")
outputInfo.outputDir = outputDir
outputInfo.TFileName = "StatInput.root"

endSequence = EndSequence(skipHadd=justEndSequence)
Exemple #8
0
ROOT.gROOT.SetBatch(ROOT.kTRUE)

# _____________________________________________________________________________ ||
inputFitFilePath = "/raid/raid7//lucien/Higgs/DarkZ/DarkPhotonSR/ShapeTemplate/2019-07-29_Run2017/ZPlusX/shape.root"
#inputParaFilePath   = "/raid/raid7//lucien/Higgs/DarkZ/ParaInput/DarkPhotonSelection_m4l100To170_Nominal/2019-07-31_m4lSR-m4lSB_HZZd-ppZZd_Run2017/ZPlusX/StatInput.root"
inputParaFilePath = "/raid/raid7//lucien/Higgs/DarkZ/ParaInput/DarkPhotonSelection_m4l100To170_Nominal/2019-08-14_m4lSR-m4lSB_HZZd-ppZZd_Run2017/ZPlusX/StatInput.root"
outputDir = os.path.dirname(inputParaFilePath)
outputFileName = "ParaShape.root"

fitFuncName_4mu = "mZ2_4mu_shape"
fitFuncName_2e2mu = "mZ2_2e2mu_shape"
fitFuncName_4e = "mZ2_4e_shape"
fitFuncName_2mu2e = "mZ2_2mu2e_shape"
binList = [
    BaseObject("MuMu_HiggsSR",
               fitFuncName=fitFuncName_4mu,
               inputParaName="MuMu_HiggsSR"),
    BaseObject("MuMu_HiggsLowSB",
               fitFuncName=fitFuncName_4mu,
               inputParaName="MuMu_HiggsLowSB"),
    BaseObject("MuMu_HiggsHighSB",
               fitFuncName=fitFuncName_4mu,
               inputParaName="MuMu_HiggsHighSB"),
    BaseObject("ElMu_HiggsSR",
               fitFuncName=fitFuncName_2e2mu,
               inputParaName="ElMu_HiggsSR"),
    BaseObject("ElMu_HiggsLowSB",
               fitFuncName=fitFuncName_2e2mu,
               inputParaName="ElMu_HiggsLowSB"),
    BaseObject("ElMu_HiggsHighSB",
               fitFuncName=fitFuncName_2e2mu,
ROOT.gROOT.SetBatch(ROOT.kTRUE)

# _____________________________________________________________________________ ||
inputFitFilePath = system.getStoragePath(
) + "/lucien/Higgs/HToZdZd/DarkPhotonSR/StatInput/2019-08-21_136p1_RunII_RatioCut0p05/ZPlusX/StatInput.root"
#inputFitFilePath    = system.getStoragePath()+"/lucien/Higgs/HToZdZd/DarkPhotonSR/DataMCDistributions/2020-04-06_RunII/ZPlusX/DataMCDistribution.root"
inputParaFilePath = system.getStoragePath(
) + "/lucien/Higgs/HToZdZd/DarkPhotonSR/DataMCDistributions/2020-04-06_RunII/ZPlusX/DataMCDistribution.root"
outputDir = os.path.dirname(inputParaFilePath)
outputFileName = "PlotShape.root"

binList = [
    BaseObject(
        "4mu",
        rebin=800,
        histName="comb",
        normHistName="mZ12_4mu",
    ),
    BaseObject(
        "4e",
        rebin=800,
        histName="comb",
        normHistName="mZ12_4e",
    ),
    BaseObject(
        "2e2mu",
        rebin=800,
        histName="comb",
        normHistName="mZ12_2e2mu",
    ),
]
blindSkimmer                = BlindSkimmer("BlindSkimmer")
xsWeighter                  = XSWeighter("XSWeighter")
nloWeighter                 = NLOWeighter("NLOWeighter")
dataMCWeighter              = DataMCWeighter("DataMCWeighter")
variableProducer            = VariableProducer("VariableProducer")
fakeRateWeighter            = FakeRateWeighter("FakeRateWeighter")

darkPhotonSRSkimmer         = AnalysisSkimmer("DarkPhotonSRSkimmer")
darkPhotonSBSkimmer         = AnalysisSkimmer("DarkPhotonSRSkimmer",cutflow="DarkPhoton-m4lSB")
darkPhotonFullM4lSkimmer    = AnalysisSkimmer("DarkPhotonSRSkimmer",cutflow="DarkPhoton-m4l70")
darkPhoton3P1FSkimmer       = AnalysisSkimmer("DarkPhotonSRSkimmer",cutflow="DarkPhoton-3P1F")
resonaceZ2Skimmer           = NarrowResonanceSkimmer(
        "NarrowResonanceSkimmer",
        [
            BaseObject(
                "NarrowResonanceSelection",
                selFunc=LambdaFunc("x: (abs(x.idL3[0]) == 11 and abs(x.idL4[0]) == 11 and x.massZ2[0] > 8.50 and x.massZ2[0] < 11.0) or (abs(x.idL3[0]) == 13 and abs(x.idL4[0]) == 13 and x.massZ2[0] > 8.50 and x.massZ2[0] < 11.0)"),
                ),
        ],
        )
resonaceZ1Skimmer           = NarrowResonanceSkimmer(
        "NarrowResonanceSkimmer",
        [
            BaseObject(
                "NarrowResonanceSelection",
                selFunc=LambdaFunc("x: (abs(x.idL3[0]) == 11 and abs(x.idL4[0]) == 11 and x.massZ1[0] > 8.50 and x.massZ1[0] < 11.0) or (abs(x.idL3[0]) == 13 and abs(x.idL4[0]) == 13 and x.massZ1[0] > 8.50 and x.massZ1[0] < 11.0)"),
                ),
        ],
        )

#____________________________________________________________________________________________________
# Make Sequences
import ROOT, os
from Core.BaseObject import BaseObject
from Core.mkdir_p import mkdir_p

ROOT.gROOT.SetBatch(ROOT.kTRUE)

# _____________________________________________________________________________ ||
inputFitFilePath = "/raid/raid7/lucien/Higgs/HToZdZd/DarkPhotonSR/StatInput/2019-08-21_136p1_RunII_RatioCut0p05/ZPlusX/StatInput.root"
inputParaFilePath = "/raid/raid7/lucien/Higgs/HToZdZd/DarkPhotonSR/DataMCDistributions/2020-02-29_RunII/ZPlusX/DataMCDistribution.root"
outputDir = os.path.dirname(inputParaFilePath)
outputFileName = "PlotShape.root"

binList = [
    BaseObject(
        "MuMu",
        rebin=800,
        histName="comb",
        normHistName="mZ2_4mu",
    ),
    BaseObject(
        "ElMu",
        rebin=800,
        histName="comb",
        normHistName="mZ2_2e2mu",
    ),
    BaseObject(
        "MuEl",
        rebin=800,
        histName="comb",
        normHistName="mZ2_2mu2e",
    ),
    BaseObject(
import ROOT, os
from Core.BaseObject import BaseObject

ROOT.gROOT.SetBatch(ROOT.kTRUE)

# _____________________________________________________________________________ ||
inputFitFilePath = "/home/lucien/public_html/Higgs/HToZdZd/Parametrization/2019-08-21_136p1_RunII_RatioCut0p05/shape.root"
inputParaFilePath = "/raid/raid7/lucien/Higgs/HToZdZd/DarkPhotonSR/StatInput/2019-08-21_Run2017/ZPlusX/StatInput.root"
outputDir = os.path.dirname(inputParaFilePath)
outputFileName = "ParaShape.root"

fitFuncName_Mu = "Mu_shape"
fitFuncName_El = "El_shape"
binList = [
    BaseObject("Mu", fitFuncName=fitFuncName_Mu, inputParaName="Mu"),
    BaseObject("El", fitFuncName=fitFuncName_El, inputParaName="El"),
]

# _____________________________________________________________________________ ||
inputFitFile = ROOT.TFile(inputFitFilePath, "READ")
inputParaFile = ROOT.TFile(inputParaFilePath, "READ")
outputFile = ROOT.TFile(os.path.join(outputDir, outputFileName), "RECREATE")
outputFile.cd()
for b in binList:
    fitFunc = inputFitFile.Get(b.fitFuncName)
    paraInputHist = inputParaFile.Get(b.inputParaName)
    outputHist = paraInputHist.Clone(b.name)
    for ibin in range(1, outputHist.GetNbinsX() + 1):
        x = outputHist.GetXaxis().GetBinCenter(ibin)
        outputHist.SetBinContent(ibin, fitFunc.Eval(x))
    outputHist.Scale(paraInputHist.Integral() / outputHist.Integral())
Exemple #13
0
        ' and '.join([el_Z1_ch_sel_str, el_Z2_ch_sel_str, higgsSR_sel_str])),
    "ElEl_HiggsLowSB":
    LambdaFunc('event: ' + ' and '.join(
        [el_Z1_ch_sel_str, el_Z2_ch_sel_str, higgsLowSB_sel_str])),
    "ElEl_HiggsHighSB":
    LambdaFunc('event: ' + ' and '.join(
        [el_Z1_ch_sel_str, el_Z2_ch_sel_str, higgsHighSB_sel_str])),
}

sequence = darkphoton_fullm4l_sequence
yieldProducer = ParaYieldProducer(
    "ParaYieldProducer",
    systList=[
        BaseObject(
            "LepScale-Up",
            fillValueFunc=LambdaFunc("x: x.massZ2_ScaleUp"),
            eventWeightFunc=LambdaFunc("x: x.weight"),
        ),
        BaseObject(
            "LepScale-Down",
            fillValueFunc=LambdaFunc("x: x.massZ2_ScaleDown"),
            eventWeightFunc=LambdaFunc("x: x.weight"),
        ),
        BaseObject(
            "LepRes-Up",
            fillValueFunc=LambdaFunc("x: x.massZ2_ResUp"),
            eventWeightFunc=LambdaFunc("x: x.weight"),
        ),
        BaseObject(
            "LepRes-Down",
            fillValueFunc=LambdaFunc("x: x.massZ2_ResDown"),
Exemple #14
0
disableProgressBar      = False
componentList           = bkgSamples + dataSamples
plots = general_4e_plots + general_2mu2e_plots + general_4mu_plots + general_2e2mu_plots

for sig in sigSamples:
    for p in plots:
        p.plotSetting.line_style_dict[sig.name] = 10
        p.plotSetting.line_width_dict[sig.name] = 4
        p.plotSetting.line_color_dict[sig.name] = ROOT.kRed
for sig in ppZZdSamples:
    for p in plots:
        p.plotSetting.line_style_dict[sig.name] = 9
        p.plotSetting.line_width_dict[sig.name] = 4
        p.plotSetting.line_color_dict[sig.name] = ROOT.kOrange

for s in sample2016.bkgSamples: s.input = BaseObject("2016",inputDir=os.path.join(baseDir,"2019-11-21_Run2016/"),postfix="_Run2016",)
for s in sample2017.bkgSamples: s.input = BaseObject("2017",inputDir=os.path.join(baseDir,"2019-11-21_Run2017/"),postfix="_Run2017",)
for s in sample2018.bkgSamples: s.input = BaseObject("2018",inputDir=os.path.join(baseDir,"2019-11-21_Run2018/"),postfix="_Run2018",)
for s in sample2016.dataSamples: s.input = BaseObject("2016",inputDir=os.path.join(baseDir,"2019-11-21_Run2016/"),postfix="",)
for s in sample2017.dataSamples: s.input = BaseObject("2017",inputDir=os.path.join(baseDir,"2019-11-21_Run2017/"),postfix="",)
for s in sample2018.dataSamples: s.input = BaseObject("2018",inputDir=os.path.join(baseDir,"2019-11-21_Run2018/"),postfix="",)
for cmp in componentList:
    targetDir = os.path.join(outputDir,cmp.name)
    sourceDir = os.path.join(cmp.input.inputDir,cmp.name.replace(cmp.input.postfix,""))
    shutil.copytree(sourceDir,targetDir)

outputInfo              = OutputInfo("OutputInfo")
outputInfo.outputDir    = outputDir
outputInfo.TFileName    = "DataMCDistribution.root"

endSequence = EndSequence(skipHadd=False)
Exemple #15
0
componentList = bkgSamples + [
    data2017,
] + sigSamples
justEndSequence = False

plots = general_mu_plots + general_el_plots

inputShapeFile = ROOT.TFile(os.path.join(outputDir, "ZPlusX", "shape.root"),
                            "READ")
for p in plots:
    p.plotSetting.divideByBinWidth = False
    if p.plotSetting.divideByBinWidth:
        p.plotSetting.bin_width_label = "Bin Width"
    if p.key in ["mZ2_mu", "mZ2_el"]:
        p.customHistDict["ZPlusX"] = BaseObject(
            p.key,
            hist=copy.deepcopy(inputShapeFile.Get(p.key + "_shapehist")))
        #p.customPdfDict["ZPlusX"] = BaseObject(p.key,hist=copy.deepcopy(inputShapeFile.Get(p.key+"_shapehist")))
        #p.customPdfDict = {}
        #leptonChannel = p.key.split("_")[-1]
        #p.customPdfDict["ZPlusX"] = BaseObject(p.key,hist=inputShapeFile.Get("mZ2"+"_"+leptonChannel+"_shapehist").Clone(p.key))

for sig in sigSamples:
    for p in plots:
        p.plotSetting.line_style_dict[sig.name] = 10
        p.plotSetting.line_width_dict[sig.name] = 4

outputInfo = OutputInfo("OutputInfo")
outputInfo.outputDir = outputDir
outputInfo.TFileName = "DataMCDistribution.root"
from Core.BaseObject import BaseObject
from Core.mkdir_p import mkdir_p

ROOT.gROOT.SetBatch(ROOT.kTRUE)

# _____________________________________________________________________________ ||
inputFitFilePath = "/raid/raid7/lucien/Higgs/HToZdZd/DarkPhotonSR/StatInput/2019-08-21_136p1_RunII_RatioCut0p05/ZPlusX/StatInput.root"
inputParaFilePath = "/raid/raid7/lucien/Higgs/HToZdZd/DarkPhotonSR/StatInput/2020-02-29_SR2D_Run2016/ZPlusX/StatInput.root"
#outputDir           = "/home/lucien/public_html/Higgs/HToZdZd/Parametrization/2020-02-29_SR2D_Run2016/"
outputDir = os.path.dirname(inputParaFilePath)
outputFileName = "ParaShape.root"

binList = [
    BaseObject(
        "MuMu",
        rebin=800,
        histName="comb",
        normHistName="MuMu",
    ),
    BaseObject(
        "ElMu",
        rebin=800,
        histName="comb",
        normHistName="ElMu",
    ),
    BaseObject(
        "MuEl",
        rebin=800,
        histName="comb",
        normHistName="MuEl",
    ),
    BaseObject(
import ROOT,os
from Core.BaseObject import BaseObject
from Core.mkdir_p import mkdir_p
from Utils.System import system

ROOT.gROOT.SetBatch(ROOT.kTRUE)

# _____________________________________________________________________________ ||
User                = "******"
inputFitFilePath    = system.getStoragePath()+"/"+User+"/Higgs/DarkZ/DarkPhotonSR/DataMCDistributions/2020-04-06_RunII/ZPlusX/DataMCDistribution.root"
inputParaFilePath   = system.getStoragePath()+"/"+User+"/Higgs/DarkZ/DarkPhotonSR/DataMCDistributions/2020-04-06_RunII/ZPlusX/DataMCDistribution.root"
outputDir           = os.path.dirname(inputParaFilePath)
outputFileName      = "PlotShape.root"

binList             = [
                        BaseObject("Mu",rebin=1,histName="mZ2_mu",normHistName="mZ2_mu",),
                        BaseObject("El",rebin=1,histName="mZ2_el",normHistName="mZ2_el",),
                        ]
fitFuncName         = "landau"
drawFit             = False

# _____________________________________________________________________________ ||
inputFitFile = ROOT.TFile(inputFitFilePath,"READ")
inputParaFile = ROOT.TFile(inputParaFilePath,"READ")
mkdir_p(outputDir)
outputFile = ROOT.TFile(os.path.join(outputDir,outputFileName),"RECREATE")
outputFile.cd()
for b in binList:
    fitHist = inputFitFile.Get(b.histName)
    fitHist.Rebin(b.rebin)
    fitHist.Scale(1./fitHist.Integral())
Exemple #18
0
from Core.BaseObject import BaseObject

Zp = BaseObject(
    "Zp",
    pdgId=999888,
)

Z = BaseObject(
    "Z",
    pdgId=23,
)
from Core.BaseObject import BaseObject
from Plotter.Plot import Plot
from Core.Utils.LambdaFunc import LambdaFunc

single_plot_cfgs = [
    BaseObject(
        "pt",
        plot_range=[20, 0., 200.],
    ),
    BaseObject(
        "eta",
        plot_range=[20, -3., 3.],
    ),
    BaseObject(
        "phi",
        plot_range=[20, -3.5, 3.5],
    ),
    BaseObject(
        "numberOfChambers",
        plot_range=[21, -0.5, 20.5],
    ),
    BaseObject(
        "numberOfSegments",
        plot_range=[11, -0.5, 10.5],
    ),
    BaseObject(
        "numberOfMatches",
        plot_range=[11, -0.5, 10.5],
    ),
    BaseObject(
        "calEnergyEm",
import os, ROOT, shutil

User = os.environ['USER']
baseDir = system.getStoragePath(
) + "/" + User + "/Higgs/DarkZ/DarkPhotonSR/StatInput/"
outputBaseDir = "2019-12-02_hadd_RunII/"
outputDir = os.path.join(baseDir, outputBaseDir)
nEvents = -1
disableProgressBar = False
componentList = bkgSamples + dataSamples + sigSamples
verbose = True

for s in sample2016.bkgSamples + sigSample2016.sigSamples:
    s.input = BaseObject(
        "2016",
        inputDir=os.path.join(baseDir, "2019-12-02_Run2016/"),
        postfix="_Run2016",
    )
for s in sample2017.bkgSamples + sigSample2017.sigSamples:
    s.input = BaseObject(
        "2017",
        inputDir=os.path.join(baseDir, "2019-12-02_Run2017/"),
        postfix="_Run2017",
    )
for s in sample2018.bkgSamples + sigSample2018.sigSamples:
    s.input = BaseObject(
        "2018",
        inputDir=os.path.join(baseDir, "2019-12-02_Run2018/"),
        postfix="_Run2018",
    )
for s in sample2016.dataSamples:
Exemple #21
0
in_path = "DarkPhotonSR/StatInput/2020-02-29_SignalInterpolation2D_Run2017/"
inputDir = system.getStoragePath() + "/" + User + "/Higgs/HToZdZd/" + in_path
TFileName = "StatInput.root"

outputDir = system.getPublicHtmlPath(
) + "/Higgs/HToZdZd/Interpolation/" + os.path.basename(
    os.path.normpath(in_path))

y_range = [0., 0.5]
draw_option = "AP"

# ________________________________________________________________________________________________ ||
signals = [SignalModel("HToZdZd_M" + str(m), m) for m in mass_points]

bins = [
    BaseObject("MuMu", histName="MuMu", x_width=0.02, y_width=0.02),
    BaseObject("ElMu", histName="ElMu", x_width=0.05, y_width=0.02),
    BaseObject("ElEl", histName="ElEl", x_width=0.05, y_width=0.05),
    BaseObject("MuEl", histName="MuEl", x_width=0.02, y_width=0.05),
]

# ________________________________________________________________________________________________ ||
print("Input directory: " + inputDir)
print("Output directory: " + outputDir)
print("Mass points: " + ", ".join([str(s.centre) for s in signals]))

mkdir_p(outputDir)

for power in fitlist:
    for b in bins:
        if (makePlot):
Exemple #22
0
inputParaFilePath = system.getStoragePath(
) + "/lucien/Higgs/HToZdZd/DarkPhotonSR/StatInput/2019-12-06_SR2D_Run2016/ZPlusX/StatInput.root"
#inputParaFilePath   = system.getStoragePath()+"/lucien/Higgs/HToZdZd/DarkPhotonSR/StatInput/2019-12-06_SR2D_Run2017/ZPlusX/StatInput.root"
#inputParaFilePath   = system.getStoragePath()+"/lucien/Higgs/HToZdZd/DarkPhotonSR/StatInput/2019-12-06_SR2D_Run2018/ZPlusX/StatInput.root"
outputDir = os.path.dirname(inputParaFilePath)
outputFileName = "ParaShape.root"
muWidth = 0.02
elWidth = 0.05
lowM = 4.
highM = 62.6
binList = [
    BaseObject("MuMu",
               fitFuncName="MuMu_shape",
               inputParaName="MuMu",
               cutPoints=[
                   (lowM, lowM * (1. - muWidth)),
                   (highM, highM * (1. - muWidth)),
                   (highM, highM * (1. + muWidth)),
                   (lowM, highM * (1. + muWidth)),
               ]),
    BaseObject("ElMu",
               fitFuncName="ElMu_shape",
               inputParaName="ElMu",
               cutPoints=[
                   (lowM, lowM * (1. - elWidth)),
                   (highM, highM * (1. - elWidth)),
                   (highM, highM * (1. + elWidth)),
                   (lowM, highM * (1. + elWidth)),
               ]),
    BaseObject("ElEl",
               fitFuncName="ElEl_shape",