Esempio n. 1
0
 AABox::AABox()
 {
    // Default to null box
    SetMinimum(-0.5, -0.5, -0.5);
    SetMaximum(0.5, 0.5, 0.5);
    m_null = true;
 }
Esempio n. 2
0
void wxGenericProgressDialog::SetRange(int maximum)
{
    wxCHECK_RET( m_gauge, "dialog should be fully created" );

    wxCHECK_RET( maximum > 0, "Invalid range" );

    m_gauge->SetRange(maximum);

    SetMaximum(maximum);
}
Esempio n. 3
0
void wxMacControl::SetupTabs( const wxNotebook& notebook)
{
    const size_t countPages = notebook.GetPageCount();
    SetMaximum( countPages ) ;

    wxNotebookPage *page;
    ControlTabInfoRecV1 info;

    for (size_t ii = 0; ii < countPages; ii++)
    {
        page = (wxNotebookPage*) notebook.GetPage(ii);
        info.version = kControlTabInfoVersionOne;
        info.iconSuiteID = 0;
        wxCFStringRef cflabel( page->GetLabel(), page->GetFont().GetEncoding() ) ;
        info.name = cflabel ;
        SetData<ControlTabInfoRecV1>( ii + 1, kControlTabInfoTag, &info ) ;

        if ( notebook.GetImageList() && notebook.GetPageImage(ii) >= 0 )
        {
            const wxBitmap bmap = notebook.GetImageList()->GetBitmap( notebook.GetPageImage( ii ) ) ;
            if ( bmap.IsOk() )
            {
                ControlButtonContentInfo info ;

                wxMacCreateBitmapButton( &info, bmap ) ;

                OSStatus err = SetData<ControlButtonContentInfo>( ii + 1, kControlTabImageContentTag, &info );
                if ( err != noErr )
                {
                    wxFAIL_MSG("Error when setting icon on tab");
                }

                wxMacReleaseBitmapButton( &info ) ;
            }
        }
        SetTabEnabled( ii + 1, true ) ;
    }
}
Esempio n. 4
0
void derivefromprofile()
{

  auto file = config.getfile_djt("mcPbqcd");
  auto nt = (TTree *)file->Get("nt");

  for (unsigned i=1;i<binbounds.size();i++) {
    int b1 = binbounds[i-1];
    int b2 = binbounds[i];
    auto p = new TProfile(Form("p%d%d",b1,b2),Form("prof"),100,0,200);

    nt->Project(p->GetName(),"(subid2 == 0 && refpt2 > 20):jtptSignal2",Form("weight*(jtpt1>100&&bin>=%d && bin<%d)",b1,b2));
    profs.push_back(p);

    auto f = new TF1(Form("f%d%d",b1,b2),"exp(-[0]*exp(-[1]*x))");
    f->SetParameters(100,0.1);
    p->Fit(f);
    fs.push_back(f);

    float median = -1/f->GetParameter(1)*log(-1/f->GetParameter(0)*log(0.5));

    auto c = getc();
      TLatex *Tl = new TLatex();
    p->SetMinimum(0);p->SetMaximum(1);
    p->Draw();
    f->Draw("same");
    Tl->DrawLatexNDC(0.6,0.4,Form("PbPb bin %d-%d",b1,b2));
    Tl->DrawLatexNDC(0.6,0.35,Form("median = %.2f",median));

    TLine *l1 = new TLine(median,0,median, f->Eval(median));
    l1->Draw();
    TLine *l2 = new TLine(0,0.5,median, f->Eval(median));
    l2->Draw();

    SavePlot(c,Form("fit%d%d",b1,b2));
  }

}
Esempio n. 5
0
void ChebyshevPol() {


   auto legend = new TLegend(0.88,0.4,1.,1.);

   int colors[] = { kRed, kRed+3, kMagenta, kMagenta+3, kBlue, kBlue+3, kCyan+3, kGreen, kGreen+3, kYellow, kOrange };

   for (int degree=0; degree <=10; ++degree) {
      auto f1 = new TF1("f1",TString::Format("cheb%d",degree),-1,1);
      // all parameters are zero apart from the one corresponding to the degree
      f1->SetParameter(degree,1);
      f1->SetLineColor( colors[degree]);
      f1->SetMinimum(-1.2);
      f1->SetMaximum(1.2);
      TString opt = (degree == 0) ? "" : "same";
      //f1->Print("V");
      f1->SetNpx(1000);
      f1->SetTitle("Chebyshev Polynomial");
      f1->Draw(opt);
      legend->AddEntry(f1,TString::Format("N=%d",degree),"L");
   }
   legend->Draw();
}
Esempio n. 6
0
bool wxGenericProgressDialog::Create( const wxString& title,
                                      const wxString& message,
                                      int maximum,
                                      wxWindow *parent,
                                      int style )
{
    SetTopParent(parent);

    m_parentTop = wxGetTopLevelParent(parent);
    m_pdStyle = style;

    wxWindow* const
        realParent = GetParentForModalDialog(parent, GetWindowStyle());

    if (!wxDialog::Create(realParent, wxID_ANY, title))
        return false;

    SetMaximum(maximum);

    // We need a running event loop in order to update the dialog and be able
    // to process clicks on its buttons, so ensure that there is one running
    // even if this means we have to start it ourselves (this happens most
    // commonly during the program initialization, e.g. for the progress
    // dialogs shown from overridden wxApp::OnInit()).
    if ( !wxEventLoopBase::GetActive() )
    {
        m_tempEventLoop = new wxEventLoop;
        wxEventLoop::SetActive(m_tempEventLoop);
    }

#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
    // we have to remove the "Close" button from the title bar then as it is
    // confusing to have it - it doesn't work anyhow
    //
    // FIXME: should probably have a (extended?) window style for this
    if ( !HasPDFlag(wxPD_CAN_ABORT) )
    {
        EnableCloseButton(false);
    }
#endif // wxMSW

#if defined(__SMARTPHONE__)
    SetLeftMenu();
#endif

    m_state = HasPDFlag(wxPD_CAN_ABORT) ? Continue : Uncancelable;

    // top-level sizerTop
    wxSizer * const sizerTop = new wxBoxSizer(wxVERTICAL);

    m_msg = new wxStaticText(this, wxID_ANY, message);
    sizerTop->Add(m_msg, 0, wxLEFT | wxTOP, 2*LAYOUT_MARGIN);

    int gauge_style = wxGA_HORIZONTAL;
    if ( style & wxPD_SMOOTH )
        gauge_style |= wxGA_SMOOTH;

#ifdef __WXMSW__
    maximum /= m_factor;
#endif

    m_gauge = new wxGauge
                  (
                    this,
                    wxID_ANY,
                    maximum,
                    wxDefaultPosition,
                    // make the progress bar sufficiently long
                    wxSize(wxMin(wxGetClientDisplayRect().width/3, 300), -1),
                    gauge_style
                  );

    sizerTop->Add(m_gauge, 0, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, 2*LAYOUT_MARGIN);
    m_gauge->SetValue(0);

    // create the estimated/remaining/total time zones if requested
    m_elapsed =
    m_estimated =
    m_remaining = NULL;

    // also count how many labels we really have
    size_t nTimeLabels = 0;

    wxSizer * const sizerLabels = new wxFlexGridSizer(2);

    if ( style & wxPD_ELAPSED_TIME )
    {
        nTimeLabels++;

        m_elapsed = CreateLabel(GetElapsedLabel(), sizerLabels);
    }

    if ( style & wxPD_ESTIMATED_TIME )
    {
        nTimeLabels++;

        m_estimated = CreateLabel(GetEstimatedLabel(), sizerLabels);
    }

    if ( style & wxPD_REMAINING_TIME )
    {
        nTimeLabels++;

        m_remaining = CreateLabel(GetRemainingLabel(), sizerLabels);
    }
    sizerTop->Add(sizerLabels, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP, LAYOUT_MARGIN);

#if defined(__SMARTPHONE__)
    if ( HasPDFlag(wxPD_CAN_SKIP) )
        SetRightMenu(wxID_SKIP, _("Skip"));
    if ( HasPDFlag(wxPD_CAN_ABORT) )
        SetLeftMenu(wxID_CANCEL);
#else
    m_btnAbort =
    m_btnSkip = NULL;

    wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL);

    // Windows dialogs usually have buttons in the lower right corner
    const int sizerFlags =
#if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXOSX__)
                           wxALIGN_RIGHT | wxALL
#else // !MSW
                           wxALIGN_CENTER_HORIZONTAL | wxBOTTOM | wxTOP
#endif // MSW/!MSW
                           ;

    if ( HasPDFlag(wxPD_CAN_SKIP) )
    {
        m_btnSkip = new wxButton(this, wxID_SKIP, _("&Skip"));

        buttonSizer->Add(m_btnSkip, 0, sizerFlags, LAYOUT_MARGIN);
    }

    if ( HasPDFlag(wxPD_CAN_ABORT) )
    {
        m_btnAbort = new wxButton(this, wxID_CANCEL);

        buttonSizer->Add(m_btnAbort, 0, sizerFlags, LAYOUT_MARGIN);
    }

    if ( !HasPDFlag(wxPD_CAN_SKIP | wxPD_CAN_ABORT) )
        buttonSizer->AddSpacer(LAYOUT_MARGIN);

    sizerTop->Add(buttonSizer, 0, sizerFlags, LAYOUT_MARGIN );
#endif // __SMARTPHONE__/!__SMARTPHONE__

    SetSizerAndFit(sizerTop);

    Centre(wxCENTER_FRAME | wxBOTH);

    DisableOtherWindows();

    Show();
    Enable();

    // this one can be initialized even if the others are unknown for now
    //
    // NB: do it after calling Layout() to keep the labels correctly aligned
    if ( m_elapsed )
    {
        SetTimeLabel(0, m_elapsed);
    }

    Update();
    return true;
}
Esempio n. 7
0
void drawdphideta()
{
  macro m("drawdphideta_0p95",true);

  csvcut = 0.95;

  seth(25,0,3.142,25,0,4);

  auto hdphidetasig = geth2d("hdphidetasig",";#Delta#phi;#Delta#eta");
  auto hdphidetabkg = geth2d("hdphidetabkg",";#Delta#phi;#Delta#eta");

  auto hdphidetasig12 = geth2d("hdphidetasig12",";#Delta#phi;#Delta#eta");
  auto hdphidetabkg12 = geth2d("hdphidetabkg12",";#Delta#phi;#Delta#eta");


  auto fmcPb = config.getfile_djt("mcPbbfa");

  Fill(fmcPb,[&] (dict &d) {
      if (d["pthat"]<pthatcut) return;
      float w = weight1SLPbPb(d);
      if (d["bin"]>20) return;

      float w2 = d["weight"];
      if (d["pairCodeSignal21"]==0) w2*=processweight((int)d["bProdCode"]);


      if (d["jtpt1"]>pt1cut && d["refpt1"]>50 && abs(d["refparton_flavorForB1"])==5 && d["jtptSL"]>pt2cut) {
        if (IsSignal(d))
          hdphidetasig->Fill(d["dphiSL1"],abs(d["jteta1"]-d["jtetaSL"]),w);
        else
          hdphidetabkg->Fill(d["dphiSL1"],abs(d["jteta1"]-d["jtetaSL"]),w);
      }

      if (d["jtpt1"]>pt1cut && d["refpt1"]>50 && abs(d["refparton_flavorForB1"])==5 && d["jtptSignal2"]>pt2cut && d["discr_csvV1_Signal2"]>csvcut)
          hdphidetasig12->Fill(d["dphiSignal21"],abs(d["jteta1"]-d["jtetaSignal2"]),w2);

      if (d["jtpt1"]>pt1cut && d["refpt1"]>50 && abs(d["refparton_flavorForB1"])==5 && d["jtpt2"]>pt2cut && d["discr_csvV1_2"]>csvcut && !IsSignal(d["subid2"],d["refpt2"]))
          hdphidetabkg12->Fill(d["dphi21"],abs(d["jteta1"]-d["jteta2"]),w);


      // if (d["jtpt1"]>pt1cut && d["refpt1"]>50 && abs(d["refparton_flavorForB1"])==5 && d["jtpt2"]>pt2cut) {
      //   if (IsSignal(d["subid2"],d["refpt2"]))
      //     hdphidetasig12->Fill(d["dphi21"],abs(d["jteta1"]-d["jteta2"]),w2);
      //   else
      //     hdphidetabkg12->Fill(d["dphi21"],abs(d["jteta1"]-d["jteta2"]),w);
      // }

    
      });

  auto c1 = getc();
  c1->SetLogz();
  hdphidetasig->SetMaximum(5E-9);
  hdphidetasig->Draw("colz");
  SavePlots(c1,"signaldphideta");

  auto c2 = getc();
  c2->SetLogz();
  hdphidetabkg->SetMaximum(5E-9);
  hdphidetabkg->Draw("colz");
  SavePlots(c2,"bkgdphideta");


  auto c3 = getc();
  c3->SetLogz();
  hdphidetasig12->SetMaximum(5E-9);//1E-7);
  hdphidetasig12->Draw("colz");
  SavePlots(c3,"signaldphideta12");

  auto c4 = getc();
  c4->SetLogz();
  hdphidetabkg12->SetMaximum(5E-9);//1E-7);
  hdphidetabkg12->Draw("colz");
  SavePlots(c4,"bkgdphideta12");

}
Esempio n. 8
0
void derivefromNS(bool data = false)
{
  // float shift = mode == 2 ? -2 : mode*2; //mode = 0,1,2 shift = 0,2,-2
  // cout<<"shift = "<<shift<<endl;

  auto file = config.getfile_djt(data ? "dtPbjcl" : "mcPbqcd");
  auto nt = (TTree *)file->Get("nt");

  for (unsigned i=1;i<binbounds.size();i++) {
    int b1 = binbounds[i-1];
    int b2 = binbounds[i];
    seth(71,38,180); //71,38
    auto h = geth(Form("h%d%d",b1,b2)); //allowing one more bin for overflow
    seth(b2-b1,b1,b2);
    auto hb = geth(Form("hb%d%d",b1,b2));

   
    TString mcappendix = data ? "" : "&& pthat>50";//"&& subid2!=0 && pthat>50"; //"&& pthat>50";//"&& !(subid2==0 && refpt2>20) && pthat>50"; //"&& pthat>80";//
   
    //Form("jtpt2+%f",shift)
    nt->Project(h->GetName(),"jtpt2", Form("weight*(jtpt1>100&&bin>=%d && bin<%d && dphi21<1.05 %s)",b1,b2,mcappendix.Data()));
    nt->Project(hb->GetName(),"bin", Form("weight*(jtpt1>100&&bin>=%d && bin<%d && dphi21<1.05 %s)",b1,b2,mcappendix.Data()));

    ScaleVisibleBins(h,NSfrac[i-1]);

    h->SetBinContent(1,h->GetBinContent(0)+h->GetBinContent(1));

    // auto p = new TProfile(Form("p%d%d",b1,b2),Form("prof"),71,38,180);
    // nt->Project(p->GetName(),"(subid2 == 0 && refpt2 > 20):jtptSignal2",Form("weight*(jtpt1>100&&bin>=%d && bin<%d && dphiSignal21<1.05 && !(subid2==0 && refpt2>20) && pthat>80)",b1,b2));


    auto g = getCDFgraph(h);
    g->GetXaxis()->SetTitle("p_{T,2} threshold [GeV]");
    g->GetYaxis()->SetTitle("found fraction");

    auto gtemp = getCDFgraph(h);
    meanb.push_back(hb->GetMean());
    prob.push_back(gtemp->Eval(pt));

    float c0=g->Eval(50);
    cout<<"prob at 50: "<<c0<<endl;

    auto gf = new TFile("graph.root","recreate");
    gtemp->Write();
    gf->Close();

    // auto f = new TF1(Form("f%d%d",b1,b2),"1-[0]*exp(-[1]*(x-40))",40,180);
    // f->SetParameters(0.1,0.1);
    // // f->FixParameter(1,0.08);

    // auto f = new TF1(Form("f%d%d",b1,b2),"TMath::Erf((x-[0])/[1])",40,180);
    // f->SetParameters(40,10);
    // f->FixParameter(1,25);

    auto f = new TF1(Form("f%d%d",b1,b2),"exp(-[0]*exp(-[1]*x))",40,180);
    f->SetParameters(100,0.1);
    // f->FixParameter(1,0.11); //!!!!!!!!!!

    f->SetLineColor(kRed);
    f->SetLineWidth(2);
    g->Fit(f,"RM");
    fs.push_back(f);
    binmean.push_back(hb->GetMean());

    float median = -1/f->GetParameter(1)*log(-1/f->GetParameter(0)*log(0.5));

    Draw({h});

    // h->Rebin(2);
    auto gcoarse = getCDFgraph(h);

    auto c = getc();
          TLatex *Tl = new TLatex();
    gcoarse->SetMinimum(0);g->SetMaximum(1);
    gcoarse->Draw("AP");
    f->Draw("same");
    Tl->DrawLatexNDC(0.6,0.55,"y=e^{-a e^{-b x} }");
    Tl->DrawLatexNDC(0.6,0.50,Form("a = %.1f",f->GetParameter(0)));
    Tl->DrawLatexNDC(0.6,0.45,Form("b = %.2f",f->GetParameter(1)));
    Tl->DrawLatexNDC(0.6,0.4,Form("PbPb bin %d-%d",b1,b2));
    Tl->DrawLatexNDC(0.6,0.35,Form("median = %.2f",median));

    TLine *l1 = new TLine(median,0,median, f->Eval(median));
    l1->Draw();
    TLine *l2 = new TLine(0,0.5,median, f->Eval(median));
    l2->Draw();

    // p->SetMarkerColor(kRed);
    // p->SetMarkerSize(1);
    // p->Draw("same");
    SavePlot(c,Form("fit%d%d",b1,b2));//return;
  }

}
Esempio n. 9
0
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");
}
Esempio n. 10
0
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});



 // }

}