コード例 #1
0
ファイル: do_traps.c プロジェクト: aosm/X11
int 
InitTrapezoids(XParms xp, Parms p, int reps)
{
    int     i, numPoints;
    int     rows;
    int     x, y;
    int     size, skew;
    XPoint  *curPoint;

    pgc = xp->fggc;

    size = p->special;
    numPoints = (p->objects) * NUM_POINTS;  
    points = (XPoint *)malloc(numPoints * sizeof(XPoint));
    curPoint = points;
    x = size;
    y = 0;
    rows = 0;
    skew = size;

    for (i = 0; i != p->objects; i++, curPoint += NUM_POINTS) {
	curPoint[0].x = x - skew;
	curPoint[0].y = y;
	curPoint[1].x = x - skew + size;
	curPoint[1].y = y;
	curPoint[2].x = x + skew;
	curPoint[2].y = y + size;
	curPoint[3].x = x + skew - size;
	curPoint[3].y = y + size;

	skew--;
	if (skew < 0) skew = size;

	y += size;
	rows++;
	if (y + size > HEIGHT || rows == MAXROWS) {
	    rows = 0;
	    y = 0;
	    x += 2 * size;
	    if (x + size > WIDTH) {
		x = size;
	    }
	}
    }

    SetFillStyle(xp, p);
    return reps;
}
コード例 #2
0
ファイル: do_traps.c プロジェクト: aosm/X11
int
InitFixedTrapezoids(XParms xp, Parms p, int reps)
{
    int     i, numTraps;
    int     rows;
    int     x, y;
    int     size, skew;
    XTrapezoid	*curTrap;
    XRenderColor	color;

    pgc = xp->fggc;

    size = p->special;
    numTraps = p->objects;
    traps = (XTrapezoid *)malloc(numTraps * sizeof(XTrapezoid));
    curTrap = traps;
    x = size;
    y = 0;
    rows = 0;
    skew = size;
    aadraw = XftDrawCreate (xp->d, xp->w, 
			    xp->vinfo.visual, 
			    xp->cmap);
    if (p->font && !strcmp (p->font, "add"))
    {
	XRenderPictFormat   templ;
	templ.type = PictTypeDirect;
	templ.depth = 8;
	templ.direct.alpha = 0;
	templ.direct.alphaMask = 0xff;
	maskFormat = XRenderFindFormat (xp->d, 
					PictFormatType |
					PictFormatDepth |
					PictFormatAlpha |
					PictFormatAlphaMask,
					&templ,
					0);
    }
    else
	maskFormat = 0;
    color.red = 0;
    color.green = 0;
    color.blue = 0;
    color.alpha = 0xffff;
    if (!XftColorAllocValue (xp->d,
			     xp->vinfo.visual, 
			     xp->cmap,
			     &color, &aablack))
    {
	XftDrawDestroy (aadraw);
	aadraw = 0;
	return 0;
    }
    color.red = 0xffff;
    color.green = 0xffff;
    color.blue = 0xffff;
    color.alpha = 0xffff;
    if (!XftColorAllocValue (xp->d,
			     xp->vinfo.visual, 
			     xp->cmap,
			     &color, &aawhite))
    {
	XftDrawDestroy (aadraw);
	aadraw = 0;
	return 0;
    }

    for (i = 0; i != p->objects; i++, curTrap ++) {
	curTrap->top = XDoubleToFixed (y);
	curTrap->bottom = XDoubleToFixed (y + size);
	curTrap->left.p1.x = XDoubleToFixed (x - skew);
	curTrap->left.p1.y = XDoubleToFixed (y);
	curTrap->left.p2.x = XDoubleToFixed (x + skew - size);
	curTrap->left.p2.y = XDoubleToFixed (y + size);
	
	curTrap->right.p1.x = XDoubleToFixed (x - skew + size);
	curTrap->right.p1.y = XDoubleToFixed (y);
	curTrap->right.p2.x = XDoubleToFixed (x + skew);
	curTrap->right.p2.y = XDoubleToFixed (y + size);
	
	skew--;
	if (skew < 0) skew = size;

	y += size;
	rows++;
	if (y + size > HEIGHT || rows == MAXROWS) {
	    rows = 0;
	    y = 0;
	    x += 2 * size;
	    if (x + size > WIDTH) {
		x = size;
	    }
	}
    }

    
    SetFillStyle(xp, p);
    return reps;
}
コード例 #3
0
ファイル: do_tris.c プロジェクト: Bluerise/bitrig-xenocara
int 
InitTriangles(XParms xp, Parms p, int reps)
{
    int     i, j, numPoints;
    int     rows;
    int     x, y;
    int     size, iradius;
    double  phi, phiinc, radius, delta, phi2, area, aarea;
    XPoint  *curPoint;

    pgc = xp->fggc;

    size = p->special;
    phi = 0.0;
    delta = 2.0 * PI / ((double) NUM_POINTS);
    if (xp->version == VERSION1_2) {
	radius = ((double) size) * sqrt(3.0)/2.0;
	phiinc = delta/10.0;
    } else {
	/* Version 1.2's radius computation was completely bogus, and resulted
	   in triangles with sides about 50% longer than advertised.  However,
	   this inadvertently resulted in triangles with areas just a little bit
	   smaller than the triangle that covers size^2 pixels, which would
	   make the area directly comparable to 10x10 rectangles and 10x10
	   trapezoids.  So here's the new computation so -triangleN has the same
	   area as -rectN.
	 */
	radius = ((double) size) * sqrt(sqrt(16.0/27.0));
	phiinc = 1.75*PI / ((double) p->objects);
    }
    iradius = (int) (radius + 0.5);

    numPoints = (p->objects) * NUM_POINTS;  
    points = (XPoint *)malloc(numPoints * sizeof(XPoint));
    curPoint = points;
    x = iradius;
    y = iradius;
    rows = 0;
    aarea = 0.0;

    for (i = 0; i != p->objects; i++) {
	for (j = 0; j != NUM_POINTS; j++) {
	    phi2 = phi + ((double) j) * delta;
	    curPoint->x = (int) ((double)x + (radius * cos(phi2)) + 0.5);
	    curPoint->y = (int) ((double)y + (radius * sin(phi2)) + 0.5);
	    curPoint++;
	}
	area = Area(curPoint[-1], curPoint[-2], curPoint[-3]);
	aarea += area;
/*	printf("%6.1lf %6.1lf %6.1lf   %6.1lf\n",
	    Distance(curPoint[-1], curPoint[-2]),
	    Distance(curPoint[-1], curPoint[-3]),
	    Distance(curPoint[-2], curPoint[-3]),
	    area);
*/	
	phi += phiinc;
	y += 2 * iradius;
	rows++;
	if (y + iradius > HEIGHT || rows == MAXROWS) {
	    rows = 0;
	    y = iradius;
	    x += 2 * iradius;
	    if (x + iradius > WIDTH) {
		x = iradius;
	    }
	}
    }
/*    printf("Average area = %6.2lf\n", aarea/p->objects); */

    SetFillStyle(xp, p);

    return reps;
}
コード例 #4
0
ファイル: plotXJ.C プロジェクト: bjet2015/dibjets
void doPlotXJ(TString outname, int inc_or_bjet=1, bool useMC = true, bool addppunc = false)
{
  macro m(outname);

  // bool useMC = true;
  // bool addppunc = false;
  
  TFile *fin = new TFile("results_redoana_default/xJdphi.root");

  TFile *fpps1 = new TFile("results_redoana_ppsmear1/xJdphi.root");
  TFile *fpps2 = new TFile("results_redoana_ppsmear2/xJdphi.root");
  TFile *fpps3 = new TFile("results_redoana_ppsmear3/xJdphi.root");


  string species = "inc";
  if(inc_or_bjet) species = "bjt";

  TH1F *hData010 = (TH1F*) fin->Get(Form("xJ_data_%s_0_10",species.c_str()));
  TH1F *hData1030 = (TH1F*) fin->Get(Form("xJ_data_%s_10_30",species.c_str()));
  TH1F *hData30100 = (TH1F*) fin->Get(Form("xJ_data_%s_30_100",species.c_str()));
  TH1F *hDataPP = (TH1F*) fin->Get(Form("xJ_data_%s_pp",species.c_str()));
  
  TH1F *hMC010;
  TH1F *hMC1030;
  TH1F *hMC30100;
  TH1F *hMCPP = (TH1F*) fin->Get(Form("xJ_mc_%s_pp",species.c_str()));  

  if (useMC) {
    hMC010 = (TH1F*) fin->Get(Form("xJ_mc_%s_0_10",species.c_str()));
    hMC1030 = (TH1F*) fin->Get(Form("xJ_mc_%s_10_30",species.c_str()));
    hMC30100 = (TH1F*) fin->Get(Form("xJ_mc_%s_30_100",species.c_str()));
  } else
  {
    hMC010 = (TH1F*) fpps1->Get(Form("xJ_data_%s_pp",species.c_str()));
    hMC1030 = (TH1F*) fpps2->Get(Form("xJ_data_%s_pp",species.c_str()));
    hMC30100 = (TH1F*) fpps3->Get(Form("xJ_data_%s_pp",species.c_str()));
  }

  // if(inc_or_bjet) hMCPP = (TH1F*) fin->Get(Form("xJ_mc_%s_pp;1",species.c_str()));

Normalize({hMC010,hMC1030,hMC30100,hMCPP}); //temporary fix

  vector<float> syserr;
  if (inc_or_bjet) syserr = {0.023,0.018,0.014,0.008}; //0-10%, 10-30%, 30-100%, pp
  else syserr = {0.023,0.016,0.010,0.007};

  int syscolor = inc_or_bjet ? kredLight : kblueLight;
  int color = kblue;
  if(inc_or_bjet) color=kred;

  auto hData010sys =    makesysplot(hData010,syserr[0],syscolor);
  auto hData1030sys =   makesysplot(hData1030,syserr[1],syscolor);
  auto hData30100sys =  makesysplot(hData30100,syserr[2],syscolor);
  auto hDataPPsys =     makesysplot(hDataPP,syserr[3],syscolor);

  auto hSmPP010sys = makesysplot(hMC010,syserr[3],syscolor);
  auto hSmPP1030sys = makesysplot(hMC1030,syserr[3],syscolor);
  auto hSmPP30100sys = makesysplot(hMC30100,syserr[3],syscolor);


  hSmPP30100sys->SetFillStyle(3005);
  hSmPP30100sys->SetFillColor(color);
  hSmPP1030sys->SetFillStyle(3005);
  hSmPP1030sys->SetFillColor(color);
  hSmPP010sys->SetFillStyle(3005);
  hSmPP010sys->SetFillColor(color);

  lumi_sqrtS = lumi_sqrtSPbPb;


  TCanvas *c1=new TCanvas("c1","c1",600,600);



  
  hData010->SetMarkerColor(color);
  hData010->SetLineColor(color);
  hMC010->SetLineColor(color);

  hData010->GetXaxis()->CenterTitle(1);
  hData010->GetYaxis()->CenterTitle(1);
  hData010->SetYTitle("Event fraction");
  hData010->Draw();
  hData010sys->Draw("e2,same");
  if (addppunc) hSmPP010sys->Draw("e2,same");
  hData010->Draw("same"); //b/c systematics should be on the back

  hMC010->SetMarkerSize(0);
  hMC010->Draw("h,same");
  
  CMS_lumi(c1, iPeriod, iPos ); 
    
  TLegend *l =new TLegend(0.43,0.63,0.9,0.81);
l->AddEntry(hData010,"Data","P");
l->AddEntry(hMC010,useMC ? "Pythia6" : "pp-based reference","l");
 if(inc_or_bjet)l->SetHeader("b dijets");
 else l->SetHeader("Inclusive dijets");
 l->SetFillStyle(0);
 l->Draw();



  SavePlot(c1,"xJ010"+species);

  TCanvas *c2=new TCanvas("c2","c2",600,600);


  hData1030->SetMarkerColor(color);
  hData1030->SetLineColor(color);
  hMC1030->SetLineColor(color);

  hData1030->GetXaxis()->CenterTitle(1);
  hData1030->GetYaxis()->CenterTitle(1);
  hData1030->SetYTitle("Event fraction");
  hData1030->Draw();
  hData1030sys->Draw("e2,same");
  if (addppunc) hSmPP1030sys->Draw("e2,same");
  hData1030->Draw("same");
  
  hMC1030->SetMarkerSize(0);
  hMC1030->Draw("h,same");


  
  CMS_lumi(c2, iPeriod, iPos );

  l->Draw();



  SavePlot(c2,"xJ1030"+species);

    TCanvas *c3=new TCanvas("c3","c3",600,600);

  hData30100->SetMarkerColor(color);
  hData30100->SetLineColor(color);
  hMC30100->SetLineColor(color);
  hData30100->GetXaxis()->CenterTitle(1);
  hData30100->GetYaxis()->CenterTitle(1);
  hData30100->SetYTitle("Event fraction");
  hData30100->Draw();
  hData30100sys->Draw("e2,same");
  if (addppunc) hSmPP30100sys->Draw("e2,same");
  hData30100->Draw("same");
  
  hMC30100->SetMarkerSize(0);
  hMC30100->Draw("h,same");

  
  
  CMS_lumi(c3, iPeriod, iPos );

  l->Draw();
  
SavePlot(c3,"xJ30100"+species);



  lumi_sqrtS = lumi_sqrtSpp;
  

   TCanvas *c4=new TCanvas("c4","c4",600,600);


  hDataPP->SetMarkerColor(color);
  hDataPP->SetLineColor(color);
  hMCPP->SetLineColor(color);

  hDataPP->GetXaxis()->CenterTitle(1);
  hDataPP->GetYaxis()->CenterTitle(1);
  hDataPP->SetYTitle("Event fraction");
  hDataPP->Draw();
  hDataPPsys->Draw("e2,same");  
  hDataPP->Draw("same");
  hMCPP->SetMarkerSize(0);
  hMCPP->Draw("h,same");
  
  
  CMS_lumi(c4, iPeriod, iPos );


  l->Clear();
  l->AddEntry(hDataPP,"Data","P");
  l->AddEntry(hMCPP,"Pythia6","l");
  if(inc_or_bjet)l->SetHeader("b dijets");
  else l->SetHeader("Inclusive dijets");

  l->Draw();



SavePlot(c4,"xJpp"+species);
 
}
コード例 #5
0
ファイル: tageffcorr.C プロジェクト: bjet2015/dibjets
void findtruthpp()
{
  seth(10,0,1);
  auto hmcppxJTrue = geth("hmcppxJTrue","true;x_{J};Event fractions");
  auto hmcppxJTrueTag = geth("hmcppxJTrueTag","true tagged;x_{J};Event fractions");
  auto hmcppxJTrueTagCorr = geth("hmcppxJTrueTagCorr","true tagged corrected;x_{J};Event fractions");

  TFile *fmcpp = new TFile(config.getFileName_djt("mcppbfa"));
  Fill(fmcpp,[&] (dict &m) {
    if (m["pthat"]<pthatcut) return;
    if (m[pairCodeSB1]!=0) return;
    // if (m["pthat"]<80) return;
    
    // if (m["bProdCode"]!=1) return;
    float w = m["weight"]*processweight((int)m["bProdCode"]);

    // float w = m["weight"];
    // if (m["bProdCode"]==2) return;

    float corr = tageffcorrectionpp(m["jtpt1"],m["jteta1"],m[jtptSB],m[jtetaSB]);
    float wb = w*corr;

    if (m["jtpt1"]>pt1cut && m["refpt1"]>50 && abs(m["refparton_flavorForB1"])==5 && m[jtptSB]>pt2cut && m[dphiSB1]>PI23)
      hmcppxJTrue->Fill(m[jtptSB]/m["jtpt1"],w);

    if (m["jtpt1"]>pt1cut && m["refpt1"]>50 && abs(m["refparton_flavorForB1"])==5 && m[jtptSB]>pt2cut && m[dphiSB1]>PI23
        && m["discr_csvV1_1"]>0.9 && m[discr_csvV1_SB]>0.9) {
      hmcppxJTrueTag->Fill(m[jtptSB]/m["jtpt1"],w);
      hmcppxJTrueTagCorr->Fill(m[jtptSB]/m["jtpt1"],wb);
    }


  });

  NormalizeAllHists();
  plotputmean = true;
  plotytitle = "Event fractions";
  plotdivide = false;
  // aktstring += "R=0.4 |#eta|<2.0";
  // plotsecondline = Form("p_{T,1}>%d GeV, p_{T,2}>%d GeV", (int)pt1cut, (int)pt2cut);
  // plotthirdline = "#Delta#phi>2/3#pi";
  plottextposy = 0.8;
  plottextposx = 0.2;

  plotmeanposy = 0.43;
  plotymax = 0.2;
  plotymin = 0;
  plotlegendpos = BottomRight;//TopLeft;
  
  aktstring = "pp";
  SetMC({hmcppxJTrue,hmcppxJTrueTag,hmcppxJTrueTagCorr});
  SetData({hmcppxJTrue});
  Draw({hmcppxJTrue,hmcppxJTrueTag,hmcppxJTrueTagCorr});


  hmcppxJTrue->SetMinimum(0);
  hmcppxJTrue->SetMaximum(0.3);
  hmcppxJTrue->SetLineWidth(2);
  hmcppxJTrue->SetMarkerStyle(kNone);
  hmcppxJTrue->SetFillStyle(0);

  hmcppxJTrueTag->SetMarkerStyle(kOpenCircle);
  hmcppxJTrueTagCorr->SetMarkerStyle(kOpenSquare);


  plotymax = 0.3;

  SetB({hmcppxJTrue,hmcppxJTrueTag,hmcppxJTrueTagCorr});


  float xjtrue = hmcppxJTrue->GetMean();
  float xjtruetag = hmcppxJTrueTag->GetMean();
  float xjtruetagcorr = hmcppxJTrueTagCorr->GetMean();

  float exjtrue = hmcppxJTrue->GetMeanError();
  float exjtruetag = hmcppxJTrueTag->GetMeanError();
  float exjtruetagcorr = hmcppxJTrueTagCorr->GetMeanError();

  auto c = getc();
  hmcppxJTrue->Draw("hist");
  hmcppxJTrueTag->Draw("E1,same");
  hmcppxJTrueTagCorr->Draw("E1,same");

  plotlegendpos = TopLeft;
  auto l = getLegend();
  l->AddEntry(hmcppxJTrue,Form("b-dijets, #LTx_{J}#GT=%.3f#pm%.3f",xjtrue,exjtrue),"L");
  l->AddEntry(hmcppxJTrueTag,Form("uncorrected, #LTx_{J}#GT=%.3f#pm%.3f",xjtruetag,exjtruetag),"P");
  l->AddEntry(hmcppxJTrueTagCorr,Form("corrected, #LTx_{J}#GT=%.3f#pm%.3f",xjtruetagcorr,exjtruetagcorr),"P");
  l->Draw();
  TLatex *Tl = new TLatex();
  Tl->DrawLatexNDC(0.2, 0.8, aktstring);
  SavePlot(c,"closurepp");
}
コード例 #6
0
ファイル: tageffcorr.C プロジェクト: bjet2015/dibjets
void findtruthPbPb(int binMin, int binMax)
{
  TFile *fmc = new TFile(config.getFileName_djt("mcPbbfa"));

  buildNamesuffix = TString::Format("_bin_%d_%d",binMin, binMax);
  //  buildTitlesuffix = TString::Format("%d-%d %%",binMin/2, binMax/2);

  seth(10,0,1);
  auto hmcPbPbxJTrue = geth("hmcPbPbxJTrue","PbPb true;x_{J};Event fractions");
  auto hmcPbPbxJTrueTag = geth("hmcPbPbxJTrueTag","PbPb true tagged;x_{J};Event fractions");
  auto hmcPbPbxJTrueTagCorr = geth("hmcPbPbxJTrueTagCorr","PbPb true tagged corrected;x_{J};Event fractions");
  auto hmcPbPbxJTrueTagCorrPt = geth("hmcPbPbxJTrueTagCorrPt","PbPb true tagged corrected pt;x_{J};Event fractions");
  auto hmcPbPbxJTrueTagCorrEta = geth("hmcPbPbxJTrueTagCorrEta","PbPb true tagged corrected eta;x_{J};Event fractions");
  auto hmcPbPbxJTrueTagCorrBin = geth("hmcPbPbxJTrueTagCorrBin","PbPb true tagged corrected bin;x_{J};Event fractions");

  seth(12,20,140);//10,40,100);
  auto hpt2true = geth("hpt2true","true;p_{T,2} GeV");
  auto hpt2truetag = geth("hpt2truetag","true tagged;p_{T,2} GeV");
  auto hpt2truetagovertrue = geth("hpt2truetagovertrue","true tagged/true;p_{T,2} GeV");
  auto hpt2truetagcorr = geth("hpt2truetagcorr","true tagged corrected;p_{T,2} GeV");
  auto hpt2truetagcorrovertrue = geth("hpt2truetagcorrovertrue","true tagged corrected/true;p_{T,2} GeV");

  seth(10,100,200);
  auto hpt1true = geth("hpt1true","true;p_{T,1} GeV");
  auto hpt1truetag = geth("hpt1truetag","true tagged;p_{T,1} GeV");
  auto hpt1truetagovertrue = geth("hpt1truetagovertrue","true tagged/true;p_{T,1} GeV");
  auto hpt1truetagcorr = geth("hpt1truetagcorr","true tagged corrected;p_{T,1} GeV");
  auto hpt1truetagcorrovertrue = geth("hpt1truetagcorrovertrue","true tagged corrected/true;p_{T,1} GeV");

  seth(10,0,200);
  auto hbintrue = geth("hbintrue","true;bin");
  auto hbintruetag = geth("hbintruetag","true tagged;bin");
  auto hbintruetagovertrue = geth("hbintruetagovertrue","true tagged/true;bin");
  auto hbintruetagcorr = geth("hbintruetagcorr","true tagged corrected;bin");
  auto hbintruetagcorrovertrue = geth("hbintruetagcorrovertrue","true tagged corrected/true;bin");

  seth(20,-2,2);
  auto heta2true = geth("heta2true","true;#eta_{2}");
  auto heta2truetag = geth("heta2truetag","true tagged;#eta_{2}");
  auto heta2truetagovertrue = geth("heta2truetagovertrue","true tagged/true;#eta_{2}");
  auto heta2truetagcorr = geth("heta2truetagcorr","true tagged corrected;#eta_{2}");
  auto heta2truetagcorrovertrue = geth("heta2truetagcorrovertrue","true tagged corrected/true;#eta_{2}");

  auto heta1true = geth("heta1true","true;#eta_{1}");
  auto heta1truetag = geth("heta1truetag","true tagged;#eta_{1}");
  auto heta1truetagovertrue = geth("heta1truetagovertrue","true tagged/true;#eta_{1}");
  auto heta1truetagcorr = geth("heta1truetagcorr","true tagged corrected;#eta_{1}");
  auto heta1truetagcorrovertrue = geth("heta1truetagcorrovertrue","true tagged corrected/true;#eta_{1}");

  unordered_set<int> eventstodiscard = {1805770,1116573,1084397};//,
                                        // 5755734,1599758,395810,
                                      // 1363321,211625,3195128};
//

  Fill(fmc,[&] (dict &m) {
    if (m["bin"]<binMin || m["bin"]>=binMax) return;
    if (m["pthat"]<pthatcut) return;
    if (m[pairCodeSB1]!=0) return;

    // if (m["bProdCode"]>1) return;

    if (eventstodiscard.find(m["event"])!=eventstodiscard.end()) return; //kill large-weight GSP event

    float w = m["weight"]*processweight((int)m["bProdCode"]); //because we have only b-dijets


    float corr = tageffcorrectionPbPb(m["jtpt1"],m["jteta1"],m[jtptSB],m[jtetaSB],m["bin"]);
    // float corrpt  = getPbPbcorrectionPt(m["jtpt1"],m[jtptSB]);
    // float correta = getPbPbcorrectionEta(m["jteta1"],m[jtetaSB]);
    // float corrbin = getPbPbcorrectionBin(m["bin"]);


    float wb = w*corr;



   if (m["jtpt1"]>pt1cut && m["refpt1"]>50 && abs(m["refparton_flavorForB1"])==5 && m[jtptSB]>pt2cut && m[refptSB]>20 && m[dphiSB1]>PI23) {
      hmcPbPbxJTrue->Fill(m[jtptSB]/m["jtpt1"],w);
      hpt2true->Fill(m[jtptSB],w);
      hpt1true->Fill(m["jtpt1"],w);
      heta2true->Fill(m[jtetaSB],w);
      heta1true->Fill(m["jteta1"],w);
      hbintrue->Fill(m["bin"],w);
   }

    if (m["jtpt1"]>pt1cut && m["refpt1"]>50 && abs(m["refparton_flavorForB1"])==5 && m[jtptSB]>pt2cut && m[refptSB]>20 && m[dphiSB1]>PI23
        && m["discr_csvV1_1"]>0.9 &&  m[discr_csvV1_SB]>0.9) { //

     //corrpt *= m[jtptSB] < 60 ? 1./0.7 : 1;
     //wb *= m[jtptSB] < 60 ? 1./0.7 : 1;

      hmcPbPbxJTrueTag->Fill(m[jtptSB]/m["jtpt1"],w);
      hmcPbPbxJTrueTagCorr->Fill(m[jtptSB]/m["jtpt1"],wb);
      // hmcPbPbxJTrueTagCorrPt->Fill(m[jtptSB]/m["jtpt1"],w*corrpt);
      // hmcPbPbxJTrueTagCorrEta->Fill(m[jtptSB]/m["jtpt1"],w*corrpt*correta);
      // hmcPbPbxJTrueTagCorrBin->Fill(m[jtptSB]/m["jtpt1"],w*corrpt*correta*corrbin);


      hpt2truetag->Fill(m[jtptSB],w);
      hpt1truetag->Fill(m["jtpt1"],w);
      heta2truetag->Fill(m[jtetaSB],w);
      heta1truetag->Fill(m["jteta1"],w);
      hbintruetag->Fill(m["bin"],w);

      hpt2truetagcorr->Fill(m[jtptSB],wb);
      hpt1truetagcorr->Fill(m["jtpt1"],wb);
      heta2truetagcorr->Fill(m[jtetaSB],wb);
      heta1truetagcorr->Fill(m["jteta1"],wb);
      hbintruetagcorr->Fill(m["bin"],wb);

    }






  });

  NormalizeAllHists();
//plotymax = 9999;
  aktstring = TString::Format("PbPb %d-%d %%",binMin/2, binMax/2);//TString::Format("PbPb#Delta#phi>2/3#pi %d-%d %%",binMin/2, binMax/2);

  SetMC({hmcPbPbxJTrue,hmcPbPbxJTrueTag,hmcPbPbxJTrueTagCorr});
  SetData({hmcPbPbxJTrue});
  hmcPbPbxJTrue->SetMinimum(0);
  hmcPbPbxJTrue->SetMaximum(0.3);
  hmcPbPbxJTrue->SetLineWidth(2);
  hmcPbPbxJTrue->SetMarkerStyle(kNone);
  hmcPbPbxJTrue->SetFillStyle(0);

  hmcPbPbxJTrueTag->SetMarkerStyle(kOpenCircle);
  hmcPbPbxJTrueTagCorr->SetMarkerStyle(kOpenSquare);


  plotymax = 0.3;
  Draw({hmcPbPbxJTrue,hmcPbPbxJTrueTag,hmcPbPbxJTrueTagCorr});

  SetB({hmcPbPbxJTrue,hmcPbPbxJTrueTag,hmcPbPbxJTrueTagCorr});

  float xjtrue = hmcPbPbxJTrue->GetMean();
  float xjtruetag = hmcPbPbxJTrueTag->GetMean();
  float xjtruetagcorr = hmcPbPbxJTrueTagCorr->GetMean();

  float exjtrue = hmcPbPbxJTrue->GetMeanError();
  float exjtruetag = hmcPbPbxJTrueTag->GetMeanError();
  float exjtruetagcorr = hmcPbPbxJTrueTagCorr->GetMeanError();

  auto c = getc();
  hmcPbPbxJTrue->Draw("hist");
  hmcPbPbxJTrueTag->Draw("E1,same");
  hmcPbPbxJTrueTagCorr->Draw("E1,same");

  plotlegendpos = TopLeft;
  auto l = getLegend();
  l->AddEntry(hmcPbPbxJTrue,Form("b-dijets, #LTx_{J}#GT=%.3f#pm%.3f",xjtrue,exjtrue),"L");
  l->AddEntry(hmcPbPbxJTrueTag,Form("uncorrected, #LTx_{J}#GT=%.3f#pm%.3f",xjtruetag,exjtruetag),"P");
  l->AddEntry(hmcPbPbxJTrueTagCorr,Form("corrected, #LTx_{J}#GT=%.3f#pm%.3f",xjtruetagcorr,exjtruetagcorr),"P");
  l->Draw();
  TLatex *Tl = new TLatex();
  Tl->DrawLatexNDC(0.2, 0.8, aktstring);
  SavePlot(c,Form("closure%d%d",binMin,binMax));


    // //if (binMin==0 && binMax==200) {

    // Draw({hmcPbPbxJTrueTag,hmcPbPbxJTrueTagCorrPt,hmcPbPbxJTrueTagCorrEta,hmcPbPbxJTrueTagCorrBin});
 

    // SetMC({hpt2truetag,hpt1truetag,heta2truetag,heta1truetag,hbintruetag});

    // plotputmean = false;

    // plotymax = 0.2;

    // Draw({hpt2true,hpt2truetag,hpt2truetagcorr});

    // plotymax = 0.3;

    // Draw({hpt1true,hpt1truetag,hpt1truetagcorr});

    // plotymax = 0.2;
    // Draw({heta2true,heta2truetag,heta2truetagcorr});
    // Draw({heta1true,heta1truetag,heta1truetagcorr});

    // plotymax = 1;
    // Draw({hbintrue,hbintruetag,hbintruetagcorr});


plotymin = 0;
plotymax = 0.2;

Draw({hpt2truetag,hpt2true});
Draw({hpt2truetagcorr,hpt2true});
hpt2truetagovertrue->Divide(hpt2truetag,hpt2true,1,1); //"B"
hpt1truetagovertrue->Divide(hpt1truetag,hpt1true,1,1); //"B"
heta2truetagovertrue->Divide(heta2truetag,heta2true,1,1); //"B"
heta1truetagovertrue->Divide(heta1truetag,heta1true,1,1); //"B"
hbintruetagovertrue->Divide(hbintruetag,hbintrue,1,1); //"B"


hpt2truetagcorrovertrue->Divide(hpt2truetagcorr,hpt2true,1,1); //"B"
hpt1truetagcorrovertrue->Divide(hpt1truetagcorr,hpt1true,1,1); //"B"
heta2truetagcorrovertrue->Divide(heta2truetagcorr,heta2true,1,1); //"B"
heta1truetagcorrovertrue->Divide(heta1truetagcorr,heta1true,1,1); //"B"
hbintruetagcorrovertrue->Divide(hbintruetagcorr,hbintrue,1,1); //"B"

 NormalizeAllHists();

Draw({hpt2truetagovertrue,hpt2truetagcorrovertrue});
Draw({hpt1truetagovertrue,hpt1truetagcorrovertrue});
Draw({heta2truetagovertrue,heta2truetagcorrovertrue});
Draw({heta1truetagovertrue,heta1truetagcorrovertrue});
Draw({hbintruetagovertrue,hbintruetagcorrovertrue});



 // }

}