inclRegionsTTG = inclRegionsTTGloose regionsTTG = regionsTTGloose blind = args.year != 2016 ptDict = { str(inclRegionsTTG[0]): "all", str(regionsTTG[0]): "lowPT", str(regionsTTG[1]): "medPT", str(regionsTTG[2]): "highPT" } catSel = ["all", "gen", "misID", "np"] else: ptDict = {str(noPhotonRegionTTG[0]): "all"} catSel = ["all"] setup = Setup(year=args.year, photonSelection=False, checkOnly=True) estimators = EstimatorList(setup) allProcesses = [ item for item in allProcesses if not "fakes-DD" in item and not "_had" in item ] allEstimators = estimators.constructEstimatorList(allProcesses) mc = list(set([e.name.split("_")[0] for e in allEstimators])) if not args.noData: allEstimators += [ DataObservation(name="Data", process=setup.processes["Data"], cacheDir=setup.defaultCacheDir()) ] if args.controlRegion:
else: allPhotonRegions = allRegions[ args.controlRegion]["inclRegion"] + allRegions[ args.controlRegion]["regions"] if photonSelection else allRegions[ args.controlRegion]["regions"] setup = Setup(year=args.year, photonSelection=photonSelection and not "QCD" in args.selectEstimator, checkOnly=True) #photonselection always false for qcd estimate # Select estimate if args.selectEstimator == "Data": estimate = DataObservation(name="Data", process=setup.processes["Data"]) estimate.isData = True else: estimators = EstimatorList(setup, processes=[args.selectEstimator]) estimate = getattr(estimators, args.selectEstimator) estimate.isData = False if not estimate: logger.warning(args.selectEstimator + " not known") sys.exit(0) estimate.initCache(setup.defaultCacheDir()) setup3p = setup.sysClone(parameters=parameters3p) setup3 = setup.sysClone(parameters=parameters3) setup4p = setup.sysClone(parameters=parameters4p) def wrapper(arg): r, channel, setup3p, addon, setup3, setup4p = arg
plot_directory_ = os.path.join(plot_directory, 'transferFactor', str(args.year), args.plot_directory, "ptEta", args.mode) if args.year == 2016: lumi_scale = 35.92 elif args.year == 2017: lumi_scale = 41.53 elif args.year == 2018: lumi_scale = 59.74 elif args.year == "RunII": lumi_scale = 35.92 + 41.53 + 59.74 print "hist2D" parameters = allRegions["WJets2"]["parameters"] setup = Setup(year=args.year, photonSelection=False, checkOnly=False, runOnLxPlus=False) estimators = EstimatorList(setup, processes=["QCD-DD"]) estimate = getattr(estimators, "QCD-DD") setup = setup.sysClone(parameters=parameters) estimate.initCache(setup.defaultCacheDir()) QCDTF_updates = {} QCDTF_updates["CR"] = { "invertLepIso": True, "nJet": (2, 2), "nBTag": (0, 0), "nPhoton": (0, 0), "MET": (0, -1), "m3Window": "all", "zWindow": "all", "leptonEta": (0, 1.479),
import RootTools.core.logger as logger_rt logger_rt = logger_rt.get_logger(args.logLevel, logFile=None) extensions_ = ["pdf", "png", "root"] plot_directory_ = os.path.join(plot_directory, 'QCDMCTFComp', str(args.year), args.plot_directory, args.mode) copyIndexPHP(plot_directory_) if args.year == 2016: lumi_scale = 35.92 elif args.year == 2017: lumi_scale = 41.53 elif args.year == 2018: lumi_scale = 59.74 elif args.year == "RunII": lumi_scale = 35.92 + 41.53 + 59.74 parameters0b0p = allRegions["WJets2"]["parameters"] setup0b0p = Setup(year=args.year, photonSelection=False, checkOnly=True) estimators0b0p = EstimatorList(setup0b0p, processes=["QCD-DD"]) estimate0b0p = getattr(estimators0b0p, "QCD-DD") setup0b0p = setup0b0p.sysClone(parameters=parameters0b0p) estimate0b0p.initCache(setup0b0p.defaultCacheDir()) parameters1b0p = allRegions["TT2"]["parameters"] setup1b0p = Setup(year=args.year, photonSelection=False, checkOnly=True) estimators1b0p = EstimatorList(setup1b0p, processes=["QCD-DD"]) estimate1b0p = getattr(estimators1b0p, "QCD-DD") setup1b0p = setup1b0p.sysClone(parameters=parameters1b0p) estimate1b0p.initCache(setup1b0p.defaultCacheDir()) cachedTF = {} cachedTF["0b0p"] = {} cachedTF["1b0p"] = {} cachedTF["0b1p"] = {}
coeff, str_val, ) in enumerate(zip(coeffs, str_vals)): EFTparams.append(coeff) EFTparams.append(str_val) eft = "_".join(EFTparams) if args.keepCard: args.overwrite = False regionNames = [] if not args.checkOnly: # Define estimators for CR default_setup = Setup(year=2016, checkOnly=True) default_setup.estimators = EstimatorList(default_setup) default_setup.data = default_setup.processes["Data"] # default_setup.processes = default_setup.estimators.constructProcessDict( processDict=default_processes ) default_setup.processes["Data"] = default_setup.data default_setup.addon = "" default_setup.regions = inclRegionsTTG if args.inclRegion else regionsTTG default_photon_setup = Setup(year=2016, photonSelection=True, checkOnly=True) default_photon_setup.estimators = EstimatorList(default_photon_setup) default_photon_setup.data = default_photon_setup.processes["Data"] # default_photon_setup.processes = default_setup.estimators.constructProcessDict( processDict=default_processes ) default_photon_setup.processes["Data"] = default_photon_setup.data default_photon_setup.addon = "" default_photon_setup.regions = inclRegionsTTG if args.inclRegion else regionsTTG
from RootTools.core.helpers import partition # inclEstimate = "TTG_NLO" # setup and sample parameters = allRegions["SR3"]["parameters"] channels = allRegions["SR3"]["channels"] photonSelection = not allRegions["SR3"]["noPhotonCR"] allPhotonRegions = allRegions["SR3"]["inclRegion"] + allRegions["SR3"][ "regions"] if photonSelection else allRegions["SR3"]["regions"] setup = Setup(year="RunII", photonSelection=photonSelection, private=True) #photonselection always false for qcd es$ setup = setup.sysClone(parameters=parameters) estimates = EstimatorList(setup, processes=["TTG_NLO_gen", inclEstimate]) estimate = getattr(estimates, "TTG_NLO_gen") estimate.initCache(setup.defaultCacheDir() + "/PDF") scale_indices = [0, 1, 3, 5, 7, 8] #4 central? pdf_indices = range(100) aS_variations = ["abs(LHEPdfWeight[101])", "abs(LHEPdfWeight[102])"] scale_variations = ["abs(LHEScaleWeight[%i])" % i for i in scale_indices] PDF_variations = ["abs(LHEPdfWeight[%i])" % i for i in pdf_indices] PDF_unc = [] Scale_unc = [] PS_unc = [] ISR_unc = [] FSR_unc = []
allEst = [] allEst += [s for s in mc] allEst += [s + "_gen" for s in mc] allEst += [s + "_misID" for s in mc] allEst += [s + "_had" for s in mc] allEst += [s + "_hp" for s in mc] allEst += [s + "_fake" for s in mc] allEst += [s + "_PU" for s in mc] years = [2016, 2017, 2018] if args.year == "RunII" else [args.year] setup = {} estimators = {} allEstimators = {} for y in years: setup[y] = Setup(year=y, photonSelection=True, checkOnly=True) estimators[y] = EstimatorList(setup[y]) allEstimators[y] = estimators[y].constructEstimatorList(allEst) for estimate in allEstimators[y]: estimate.initCache(setup[y].defaultCacheDir()) setup[y] = setup[y].sysClone(parameters=CR_para) def getVals(proc, ptRegion): print proc, ptRegion ests = [ proc + s for s in ["", "_gen", "_misID", "_had", "_hp", "_fake", "_PU"] ] filteredEsts = [] for est in ests:
photonSelection = not allRegions[args.controlRegion]["noPhotonCR"] allPhotonRegions = allRegions[args.controlRegion]["inclRegion"] + allRegions[ args.controlRegion]["regions"] if photonSelection else allRegions[ args.controlRegion]["regions"] regions = allPhotonRegions if not args.selectRegion else [ allPhotonRegions[args.selectRegion] ] setup = Setup( year=args.year, photonSelection=photonSelection, checkOnly=args.checkOnly, runOnLxPlus=args.runOnLxPlus, private=args.runOnTopNanoAOD) #photonselection always false for qcd es$ setup = setup.sysClone(parameters=parameters) estimates = EstimatorList(setup, processes=[args.selectEstimator, inclEstimate]) estimate = getattr(estimates, args.selectEstimator) estimate.initCache(setup.defaultCacheDir() + "/PDF") setupIncl = Setup( year=args.year, photonSelection=False, checkOnly=args.checkOnly, runOnLxPlus=args.runOnLxPlus, private=args.runOnTopNanoAOD) #photonselection always false for qcd es$ setupIncl = setupIncl.sysClone(parameters={ "zWindow": "all", "nJet": (0, -1), "nBTag": (0, -1), "nPhoton": (0, -1) })