stack = Stack(*comparisonSamples) eventScale = 1. if args.small: for sample in stack.samples: sample.normalization = 1. sample.reduceFiles(factor=10) eventScale = 1. / sample.normalization weight_ = lambda event, sample: event.lumiweight1fb * lumi_scale * eventScale # Use some defaults (set defaults before you create/import list of Plots!!) Plot.setDefaults(stack=stack, weight=staticmethod(weight_), selectionString=cutInterpreter.cutString( args.selection)) #, addOverFlowBin='upper' ) def getPlots(): plotList = [] plotList.append( Plot( name="dl_pt", texX='p_{T}(ll) [GeV]', texY="Number of Events", attribute=lambda event, sample: event.recoZ_pt, binning=[20, 0, 400], )) plotList.append(
} bgcolors = [ ROOT.kRed + 1, ROOT.kGreen + 2, ROOT.kOrange + 1, ROOT.kViolet + 9, ROOT.kSpring - 7, ROOT.kRed + 2, ROOT.kPink - 9, ROOT.kBlue, ROOT.kRed - 7, ROOT.kRed - 10, ROOT.kRed + 3, ROOT.kGreen - 7, ROOT.kGreen - 10 ] for i, s in enumerate(mc): s.styles = styles.fillStyle(bgcolors[i]) lumi_scale = 136.6 stackList = [] mgSample = ttZSample if args.sample == "ttZ" else ttSample mgScale = mgSample.getYieldFromDraw(weightString="lumiweight1fb", selectionString=cutInterpreter.cutString( args.selection))["val"] ppScale = hepSample.root_samples_dict["PP"].getYieldFromDraw( weightString="lumiweight1fb*%f" % hepmcweight, selectionString=cutInterpreter.cutString(args.selection))["val"] fancyScale = mgScale / ppScale if ppScale else 1. #mgSample = ttZSample if args.sample == "ttZ" else ttSample #fancyScale = mgSample.getYieldFromDraw( weightString="lumiweight1fb", selectionString=cutInterpreter.cutString( args.selection ) )["val"] # Sample definition totalSignal = [] for name, sample in hepSample.root_samples_dict.iteritems(): if name == "PP": SMSample = copy.deepcopy(sample) SMSample.texName = args.sample + " (SM)" SMSample.scale = fancyScale #/ w if w else None
ttZSample, ttWSample, # ttgammaSample, tZqSample, tWZSample, tWSample, WJetsSample, ] signalPP = hepSample.root_samples_dict['PP'] signalGH = hepSample.root_samples_dict[args.pdf+'_GH'] signalHG = hepSample.root_samples_dict[args.pdf+'_HG'] signalHH = hepSample.root_samples_dict[args.pdf+'_HH'] hepmcweight = nloXSec/signalPP.xSection mgSample = ttZSample if args.sample == "ttZ" else ttSample mgScale = mgSample.getYieldFromDraw( weightString="lumiweight1fb", selectionString=cutInterpreter.cutString( args.selection ) )["val"] ppScale = signalPP.getYieldFromDraw( weightString="lumiweight1fb*%f"%hepmcweight, selectionString=cutInterpreter.cutString( args.selection ) )["val"] fancyScale = mgScale / abs(ppScale) if ppScale else 1. print fancyScale signal = [ signalPP, signalGH, signalHG, signalHH ] # set selection string selectionString = cutInterpreter.cutString(args.selection) # configure samples for sample in signal: sample.setWeightString( 'lumiweight1fb*%f*%f/2.5'%(lumi_scale, fancyScale ) ) #correct plots by hand (sorry) sample.setSelectionString( selectionString ) print sample.weightString, sample.name for sample in bg:
print "nBTag med", event.nBTag_medium print "nBTag", event.nBTag # Sequence sequence = [\ addBTag, # makeObservables, # printObjects, ] lumi_scale = 136.6 comparisonSamples = [] print hepSample.root_samples_dict["PP"].getYieldFromDraw( weightString="lumiweight1fb*%f"%hepmcweight, selectionString=cutInterpreter.cutString( args.selection ) )["val"] print hepSample.root_samples_dict[args.pdf+"_GH"].getYieldFromDraw( weightString="lumiweight1fb*%f"%hepmcweight, selectionString=cutInterpreter.cutString( args.selection ) )["val"] print hepSample.root_samples_dict[args.pdf+"_HG"].getYieldFromDraw( weightString="lumiweight1fb*%f"%hepmcweight, selectionString=cutInterpreter.cutString( args.selection ) )["val"] print hepSample.root_samples_dict[args.pdf+"_HH"].getYieldFromDraw( weightString="lumiweight1fb*%f"%hepmcweight, selectionString=cutInterpreter.cutString( args.selection ) )["val"] mgSample = ttZSample if args.sample == "ttZ" else ttSample mgScale = mgSample.getYieldFromDraw( weightString="lumiweight1fb", selectionString=cutInterpreter.cutString( args.selection ) )["val"] #ppScale = hepSample.root_samples_dict["PP"].getYieldFromDraw( weightString="lumiweight1fb*%f"%hepSample.root_samples_dict["PP"].hepmcweight, selectionString=cutInterpreter.cutString( args.selection ) )["val"] ppScale = hepSample.root_samples_dict["PP"].getYieldFromDraw( weightString="lumiweight1fb*%f"%hepmcweight, selectionString=cutInterpreter.cutString( args.selection ) )["val"] fancyScale = mgScale / ppScale if ppScale else 1. #mgSample = ttZSample if args.sample == "ttZ" else ttSample #fancyScale = mgSample.getYieldFromDraw( weightString="lumiweight1fb", selectionString=cutInterpreter.cutString( args.selection ) )["val"] # Sample definition for name, sample in hepSample.root_samples_dict.iteritems():